From: support Date: Tue, 21 Jun 2022 08:38:23 +0000 (+0000) Subject: Built motion from commit d824bffd.|2.6.11 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=fcf6417fdcafd6b4ecdf5ebe542aa246a5c8e6fc;p=motion2.git Built motion from commit d824bffd.|2.6.11 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 15c992c..9d8f856 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-06-21T07:33:12.595Z", + "time": "2022-06-21T08:30:10.520Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ea2b315..f60df4d 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-06-21T07:33:12.595Z", + "time": "2022-06-21T08:30:10.520Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/legacy-libs/google-auth-library/node_modules/semver/CHANGELOG.md b/legacy-libs/google-auth-library/node_modules/semver/CHANGELOG.md new file mode 100644 index 0000000..66304fd --- /dev/null +++ b/legacy-libs/google-auth-library/node_modules/semver/CHANGELOG.md @@ -0,0 +1,39 @@ +# 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/legacy-libs/google-auth-library/node_modules/semver/LICENSE b/legacy-libs/google-auth-library/node_modules/semver/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/google-auth-library/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/google-auth-library/node_modules/semver/README.md b/legacy-libs/google-auth-library/node_modules/semver/README.md new file mode 100644 index 0000000..f8dfa5a --- /dev/null +++ b/legacy-libs/google-auth-library/node_modules/semver/README.md @@ -0,0 +1,412 @@ +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/legacy-libs/google-auth-library/node_modules/semver/bin/semver b/legacy-libs/google-auth-library/node_modules/semver/bin/semver new file mode 100644 index 0000000..801e77f --- /dev/null +++ b/legacy-libs/google-auth-library/node_modules/semver/bin/semver @@ -0,0 +1,160 @@ +#!/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/legacy-libs/google-auth-library/node_modules/semver/package.json b/legacy-libs/google-auth-library/node_modules/semver/package.json new file mode 100644 index 0000000..b43d344 --- /dev/null +++ b/legacy-libs/google-auth-library/node_modules/semver/package.json @@ -0,0 +1,60 @@ +{ + "_from": "semver@^5.5.0", + "_id": "semver@5.7.1", + "_inBundle": false, + "_integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "_location": "/google-auth-library/semver", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "semver@^5.5.0", + "name": "semver", + "escapedName": "semver", + "rawSpec": "^5.5.0", + "saveSpec": null, + "fetchSpec": "^5.5.0" + }, + "_requiredBy": [ + "/google-auth-library" + ], + "_resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "_shasum": "a954f931aeba508d307bbf069eff0c01c96116f7", + "_spec": "semver@^5.5.0", + "_where": "/home/vito/Development/MOTION_V2/CUSTOM_PKGS/dfnode8/node_modules/google-auth-library", + "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/legacy-libs/google-auth-library/node_modules/semver/range.bnf b/legacy-libs/google-auth-library/node_modules/semver/range.bnf new file mode 100644 index 0000000..d4c6ae0 --- /dev/null +++ b/legacy-libs/google-auth-library/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +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/legacy-libs/google-auth-library/node_modules/semver/semver.js b/legacy-libs/google-auth-library/node_modules/semver/semver.js new file mode 100644 index 0000000..d315d5d --- /dev/null +++ b/legacy-libs/google-auth-library/node_modules/semver/semver.js @@ -0,0 +1,1483 @@ +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/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/CHANGELOG.md b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/CHANGELOG.md new file mode 100644 index 0000000..19a0501 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/CHANGELOG.md @@ -0,0 +1,78 @@ +# Changelog + +[npm history][1] + +[1]: https://www.npmjs.com/package/nodejs-promisify?activeTab=versions + +## v0.4.0 + +02-12-2019 19:44 PST + +### New features +- feat: add callbackify() and callbackifyAll() methods ([#82](https://github.com/googleapis/nodejs-promisify/pull/82)) + +### Documentation +- docs: update contributing path in README ([#86](https://github.com/googleapis/nodejs-promisify/pull/86)) +- chore: move CONTRIBUTING.md to root ([#85](https://github.com/googleapis/nodejs-promisify/pull/85)) +- docs: add lint/fix example to contributing guide ([#83](https://github.com/googleapis/nodejs-promisify/pull/83)) + +### Internal / Testing Changes +- build: create docs test npm scripts ([#88](https://github.com/googleapis/nodejs-promisify/pull/88)) +- build: test using @grpc/grpc-js in CI ([#87](https://github.com/googleapis/nodejs-promisify/pull/87)) +- build: ignore googleapis.com in doc link check ([#81](https://github.com/googleapis/nodejs-promisify/pull/81)) +- build: check broken links in generated docs ([#79](https://github.com/googleapis/nodejs-promisify/pull/79)) +- chore(deps): update dependency @types/sinon to v7 ([#78](https://github.com/googleapis/nodejs-promisify/pull/78)) +- chore(build): inject yoshi automation key ([#77](https://github.com/googleapis/nodejs-promisify/pull/77)) +- chore: update nyc and eslint configs ([#76](https://github.com/googleapis/nodejs-promisify/pull/76)) +- chore: fix publish.sh permission +x ([#74](https://github.com/googleapis/nodejs-promisify/pull/74)) +- fix(build): fix Kokoro release script ([#73](https://github.com/googleapis/nodejs-promisify/pull/73)) +- build: add Kokoro configs for autorelease ([#72](https://github.com/googleapis/nodejs-promisify/pull/72)) +- chore: always nyc report before calling codecov ([#69](https://github.com/googleapis/nodejs-promisify/pull/69)) +- chore: nyc ignore build/test by default ([#68](https://github.com/googleapis/nodejs-promisify/pull/68)) +- chore(build): update prettier config ([#66](https://github.com/googleapis/nodejs-promisify/pull/66)) +- fix: get the build passing ([#65](https://github.com/googleapis/nodejs-promisify/pull/65)) +- chore: update license file ([#64](https://github.com/googleapis/nodejs-promisify/pull/64)) +- fix(build): fix system key decryption ([#60](https://github.com/googleapis/nodejs-promisify/pull/60)) +- chore(deps): update dependency @types/sinon to v5.0.7 ([#58](https://github.com/googleapis/nodejs-promisify/pull/58)) +- fix: Pin @types/sinon to last compatible version ([#57](https://github.com/googleapis/nodejs-promisify/pull/57)) +- chore: add synth.metadata +- chore(deps): update dependency gts to ^0.9.0 ([#54](https://github.com/googleapis/nodejs-promisify/pull/54)) +- chore: update eslintignore config ([#53](https://github.com/googleapis/nodejs-promisify/pull/53)) +- chore: use latest npm on Windows ([#52](https://github.com/googleapis/nodejs-promisify/pull/52)) +- chore: update CircleCI config ([#51](https://github.com/googleapis/nodejs-promisify/pull/51)) +- chore: include build in eslintignore ([#48](https://github.com/googleapis/nodejs-promisify/pull/48)) +- chore: update issue templates ([#44](https://github.com/googleapis/nodejs-promisify/pull/44)) +- chore: remove old issue template ([#42](https://github.com/googleapis/nodejs-promisify/pull/42)) +- build: run tests on node11 ([#41](https://github.com/googleapis/nodejs-promisify/pull/41)) +- chores(build): do not collect sponge.xml from windows builds ([#40](https://github.com/googleapis/nodejs-promisify/pull/40)) +- chores(build): run codecov on continuous builds ([#39](https://github.com/googleapis/nodejs-promisify/pull/39)) +- chore: update new issue template ([#38](https://github.com/googleapis/nodejs-promisify/pull/38)) +- chore(deps): update dependency sinon to v7 ([#33](https://github.com/googleapis/nodejs-promisify/pull/33)) +- build: fix codecov uploading on Kokoro ([#34](https://github.com/googleapis/nodejs-promisify/pull/34)) +- Update kokoro config ([#30](https://github.com/googleapis/nodejs-promisify/pull/30)) +- Update CI config ([#28](https://github.com/googleapis/nodejs-promisify/pull/28)) +- Don't publish sourcemaps ([#26](https://github.com/googleapis/nodejs-promisify/pull/26)) +- Update kokoro config ([#24](https://github.com/googleapis/nodejs-promisify/pull/24)) +- test: remove appveyor config ([#23](https://github.com/googleapis/nodejs-promisify/pull/23)) +- Update CI config ([#22](https://github.com/googleapis/nodejs-promisify/pull/22)) +- Enable prefer-const in the eslint config ([#21](https://github.com/googleapis/nodejs-promisify/pull/21)) +- Enable no-var in eslint ([#19](https://github.com/googleapis/nodejs-promisify/pull/19)) +- Update CI config ([#18](https://github.com/googleapis/nodejs-promisify/pull/18)) + +## v0.3.1 + +### Internal / Testing Changes +- Add synth script and update CI (#14) +- chore(deps): update dependency nyc to v13 (#12) +- chore: ignore package-lock.json (#11) +- chore(deps): lock file maintenance (#10) +- chore: update renovate config (#9) +- remove that whitespace (#8) +- chore(deps): lock file maintenance (#7) +- chore(deps): update dependency typescript to v3 (#6) +- chore: assert.deelEqual => assert.deepStrictEqual (#5) +- chore: move mocha options to mocha.opts (#4) +- chore(deps): update dependency gts to ^0.8.0 (#1) +- chore(deps): lock file maintenance (#3) +- chore(deps): lock file maintenance (#2) + diff --git a/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/LICENSE b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/LICENSE @@ -0,0 +1,202 @@ + + 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/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/README.md b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/README.md new file mode 100644 index 0000000..c24ecfb --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/README.md @@ -0,0 +1,40 @@ +Google Cloud Platform logo + +# @google-cloud/promisify +> A simple utility for promisifying and callbackifying functions and classes. + +Google Cloud Common node.js module contains stuff used by other Cloud API modules. + +* [github.com/googlecloudplatform/google-cloud-node](https://github.com/googlecloudplatform/google-cloud-node) + +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 + +### Installing the package + +It's unlikely you will need to install this package directly, as it will be +installed as a dependency when you install other `@google-cloud` packages. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + +This library is considered to be in **alpha**. This means it is still a +work-in-progress and under active development. Any release is subject to +backwards-incompatible changes at any time. + +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/nodejs-promisify/blob/master/CONTRIBUTING.md). + +## License + +Apache Version 2.0 + +See [LICENSE](https://github.com/googlecloudplatform/google-cloud-node/blob/master/LICENSE) diff --git a/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/build/src/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/build/src/index.d.ts new file mode 100644 index 0000000..199195e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/build/src/index.d.ts @@ -0,0 +1,76 @@ +/** + * Copyright 2014 Google Inc. 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. + */ +export interface PromisifyAllOptions extends PromisifyOptions { + /** + * Array of methods to ignore when promisifying. + */ + exclude?: string[]; +} +export interface PromisifyOptions { + /** + * Resolve the promise with single arg instead of an array. + */ + singular?: boolean; +} +export interface PromiseMethod extends Function { + promisified_?: boolean; +} +export interface WithPromise { + Promise?: PromiseConstructor; +} +export interface CallbackifyAllOptions { + /** + * Array of methods to ignore when callbackifying. + */ + exclude?: string[]; +} +export interface CallbackMethod extends Function { + callbackified_?: boolean; +} +/** + * Wraps a callback style function to conditionally return a promise. + * + * @param {function} originalMethod - The method to promisify. + * @param {object=} options - Promise options. + * @param {boolean} options.singular - Resolve the promise with single arg instead of an array. + * @return {function} wrapped + */ +export declare function promisify(originalMethod: PromiseMethod, options?: PromisifyOptions): any; +/** + * Promisifies certain Class methods. This will not promisify private or + * streaming methods. + * + * @param {module:common/service} Class - Service class. + * @param {object=} options - Configuration object. + */ +export declare function promisifyAll(Class: Function, options?: PromisifyAllOptions): void; +/** + * Wraps a promisy type function to conditionally call a callback function. + * + * @param {function} originalMethod - The method to callbackify. + * @param {object=} options - Callback options. + * @param {boolean} options.singular - Pass to the callback a single arg instead of an array. + * @return {function} wrapped + */ +export declare function callbackify(originalMethod: CallbackMethod): CallbackMethod; +/** + * Callbackifies certain Class methods. This will not callbackify private or + * streaming methods. + * + * @param {module:common/service} Class - Service class. + * @param {object=} options - Configuration object. + */ +export declare function callbackifyAll(Class: Function, options?: CallbackifyAllOptions): void; diff --git a/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/build/src/index.js b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/build/src/index.js new file mode 100644 index 0000000..3bd0226 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/build/src/index.js @@ -0,0 +1,162 @@ +"use strict"; +/** + * Copyright 2014 Google Inc. 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. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Wraps a callback style function to conditionally return a promise. + * + * @param {function} originalMethod - The method to promisify. + * @param {object=} options - Promise options. + * @param {boolean} options.singular - Resolve the promise with single arg instead of an array. + * @return {function} wrapped + */ +function promisify(originalMethod, options) { + if (originalMethod.promisified_) { + return originalMethod; + } + options = options || {}; + const slice = Array.prototype.slice; + // tslint:disable-next-line:no-any + const wrapper = function () { + const context = this; + let last; + for (last = arguments.length - 1; last >= 0; last--) { + const arg = arguments[last]; + if (typeof arg === 'undefined') { + continue; // skip trailing undefined. + } + if (typeof arg !== 'function') { + break; // non-callback last argument found. + } + return originalMethod.apply(context, arguments); + } + // peel trailing undefined. + const args = slice.call(arguments, 0, last + 1); + // tslint:disable-next-line:variable-name + let PromiseCtor = Promise; + // Because dedupe will likely create a single install of + // @google-cloud/common to be shared amongst all modules, we need to + // localize it at the Service level. + if (context && context.Promise) { + PromiseCtor = context.Promise; + } + return new PromiseCtor((resolve, reject) => { + // tslint:disable-next-line:no-any + args.push((...args) => { + const callbackArgs = slice.call(args); + const err = callbackArgs.shift(); + if (err) { + return reject(err); + } + if (options.singular && callbackArgs.length === 1) { + resolve(callbackArgs[0]); + } + else { + resolve(callbackArgs); + } + }); + originalMethod.apply(context, args); + }); + }; + wrapper.promisified_ = true; + return wrapper; +} +exports.promisify = promisify; +/** + * Promisifies certain Class methods. This will not promisify private or + * streaming methods. + * + * @param {module:common/service} Class - Service class. + * @param {object=} options - Configuration object. + */ +// tslint:disable-next-line:variable-name +function promisifyAll(Class, options) { + const exclude = (options && options.exclude) || []; + const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype); + const methods = ownPropertyNames.filter((methodName) => { + // clang-format off + return (typeof Class.prototype[methodName] === 'function' && // is it a function? + !/(^_|(Stream|_)|promise$)|^constructor$/.test(methodName) && // is it promisable? + exclude.indexOf(methodName) === -1); // is it blacklisted? + // clang-format on + }); + methods.forEach((methodName) => { + const originalMethod = Class.prototype[methodName]; + if (!originalMethod.promisified_) { + Class.prototype[methodName] = exports.promisify(originalMethod, options); + } + }); +} +exports.promisifyAll = promisifyAll; +/** + * Wraps a promisy type function to conditionally call a callback function. + * + * @param {function} originalMethod - The method to callbackify. + * @param {object=} options - Callback options. + * @param {boolean} options.singular - Pass to the callback a single arg instead of an array. + * @return {function} wrapped + */ +function callbackify(originalMethod) { + if (originalMethod.callbackified_) { + return originalMethod; + } + // tslint:disable-next-line:no-any + const wrapper = function () { + const context = this; + if (typeof arguments[arguments.length - 1] !== 'function') { + return originalMethod.apply(context, arguments); + } + const cb = Array.prototype.pop.call(arguments); + originalMethod + .apply(context, arguments) + // tslint:disable-next-line:no-any + .then((res) => { + res = Array.isArray(res) ? res : [res]; + cb(null, ...res); + }, (err) => cb(err)); + }; + wrapper.callbackified_ = true; + return wrapper; +} +exports.callbackify = callbackify; +/** + * Callbackifies certain Class methods. This will not callbackify private or + * streaming methods. + * + * @param {module:common/service} Class - Service class. + * @param {object=} options - Configuration object. + */ +function callbackifyAll( +// tslint:disable-next-line:variable-name +Class, options) { + const exclude = (options && options.exclude) || []; + const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype); + const methods = ownPropertyNames.filter((methodName) => { + // clang-format off + return (typeof Class.prototype[methodName] === 'function' && // is it a function? + !/^_|(Stream|_)|^constructor$/.test(methodName) && // is it callbackifyable? + exclude.indexOf(methodName) === -1); // is it blacklisted? + // clang-format on + }); + methods.forEach((methodName) => { + const originalMethod = Class.prototype[methodName]; + if (!originalMethod.callbackified_) { + Class.prototype[methodName] = exports.callbackify(originalMethod); + } + }); +} +exports.callbackifyAll = callbackifyAll; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/package.json b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/package.json new file mode 100644 index 0000000..0c69aa9 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@google-cloud/promisify/package.json @@ -0,0 +1,130 @@ +{ + "_args": [ + [ + { + "raw": "@google-cloud/promisify@^0.4.0", + "scope": "@google-cloud", + "escapedName": "@google-cloud%2fpromisify", + "name": "@google-cloud/promisify", + "rawSpec": "^0.4.0", + "spec": ">=0.4.0 <0.5.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/google-proto-files" + ] + ], + "_from": "@google-cloud/promisify@>=0.4.0 <0.5.0", + "_hasShrinkwrap": false, + "_id": "@google-cloud/promisify@0.4.0", + "_inCache": true, + "_location": "/@google-cloud/promisify", + "_nodeVersion": "8.15.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/promisify_0.4.0_1550076723142_0.4569426648631332" + }, + "_npmUser": { + "name": "google-node-team", + "email": "node-team-npm@google.com" + }, + "_npmVersion": "6.4.1", + "_phantomChildren": {}, + "_requested": { + "raw": "@google-cloud/promisify@^0.4.0", + "scope": "@google-cloud", + "escapedName": "@google-cloud%2fpromisify", + "name": "@google-cloud/promisify", + "rawSpec": "^0.4.0", + "spec": ">=0.4.0 <0.5.0", + "type": "range" + }, + "_requiredBy": [ + "/google-proto-files" + ], + "_resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-0.4.0.tgz", + "_shasum": "4fbfcf4d85bb6a2e4ccf05aa63d2b10d6c9aad9b", + "_shrinkwrap": null, + "_spec": "@google-cloud/promisify@^0.4.0", + "_where": "/var/opt/motion2/node_modules/google-proto-files", + "author": { + "name": "Google Inc." + }, + "bugs": { + "url": "https://github.com/googleapis/nodejs-promisify/issues" + }, + "dependencies": {}, + "description": "A simple utility for promisifying functions and classes.", + "devDependencies": { + "@compodoc/compodoc": "^1.1.7", + "@types/mocha": "^5.2.4", + "@types/node": "^10.5.2", + "@types/sinon": "^7.0.0", + "broken-link-checker-local": "^0.2.0", + "codecov": "^3.0.4", + "gts": "^0.9.0", + "hard-rejection": "^1.0.0", + "intelli-espower-loader": "^1.0.1", + "mocha": "^5.2.0", + "nyc": "^13.0.0", + "sinon": "^7.0.0", + "source-map-support": "^0.5.6", + "typescript": "^3.0.0" + }, + "directories": {}, + "dist": { + "integrity": "sha512-4yAHDC52TEMCNcMzVC8WlqnKKKq+Ssi2lXoUg9zWWkZ6U6tq9ZBRYLHHCRdfU+EU9YJsVmivwGcKYCjRGjnf4Q==", + "shasum": "4fbfcf4d85bb6a2e4ccf05aa63d2b10d6c9aad9b", + "tarball": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-0.4.0.tgz", + "fileCount": 6, + "unpackedSize": 28605, + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZEs0CRA9TVsSAnZWagAAYeYQAIu4gIj99PtmT+98gH8w\nJ6znPbyICrOIHwbgEQhqqb1lzqykXmpRVbCwK/d/ttB2AWDCaQ60boE7qCjN\nFhM6QTr7V4qukz+O+mX2/DKBpQym5SegbjV8GrRWnqNTn/sNaNGJoYi/DVzE\nMpHL36oqYJk9p7dTGJzPoFwoZTCxq9xkafcVLLTyDbHyPcnvqdxAeElNoMax\n8W6tFzHUhid/HVDDQwEBbIvq2hl/wHcRgWxtBYVwFQIscfIO6XO43clGa9Xy\n6K+N7uc6rkeo76stgOeYWxLJGdsugmp4SnaO5AqpMPyRW9pLga5PkHRBEF4X\n1n+vZw5odDxwtyUW6vmN00xGvDZbJt47fEEcVy6tI+84cY010RX+mQ8aqUzM\npKfAg/j3hNQd3aR45u6e3Yg8hl3+VN1JMN6WqP64xunRmWcxsDzaR7nhTO/2\n0x7dl3vJ4ST/47MHZA+ym3MuSKTQqVfCAr3KkY2qaU0QMeIOoEg9tDVrT5LW\n2z03uEh5SzAuc5DWFa6cBLnUz3QeUHOWIDD042HrgApyGujNDH1uaxXZBaCh\ntCS0fs3hs0lqqjc1PQmhGNLUcht61OqzBh55uiohLrTGDzdFuBazOZqo2B/4\ngFn1/sjDMBYTc8pCddq7QZnFfo8T0QQUS4q3xIcetVymoFKNnViLhCZvqNFd\nRBxi\r\n=YIr2\r\n-----END PGP SIGNATURE-----\r\n" + }, + "gitHead": "c97037fede2817b34db7e9c04749cb685ad8a6ea", + "homepage": "https://github.com/googleapis/nodejs-promisify#readme", + "keywords": [], + "license": "Apache-2.0", + "main": "build/src/index.js", + "maintainers": [ + { + "name": "fenster", + "email": "npm@fenster.name" + }, + { + "name": "google-node-team", + "email": "node-team-npm@google.com" + }, + { + "name": "justinbeckwith", + "email": "justin.beckwith@gmail.com" + }, + { + "name": "ofrobots", + "email": "ofrobots@google.com" + } + ], + "name": "@google-cloud/promisify", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/googleapis/nodejs-promisify.git" + }, + "scripts": { + "clean": "gts clean", + "compile": "tsc -p .", + "docs": "compodoc src/", + "docs-test": "blcl docs -r --exclude www.googleapis.com", + "fix": "gts fix", + "lint": "gts check", + "posttest": "npm run lint", + "predocs-test": "npm run docs", + "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": "nyc mocha build/test" + }, + "types": "build/src/index.d.ts", + "version": "0.4.0" +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/LICENSE b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/README.md b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/README.md new file mode 100644 index 0000000..e391866 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/README.md @@ -0,0 +1,31 @@ +# Pure JavaScript gRPC Client + +**Note: This is an beta-level release. Some APIs may not yet be present and there may be bugs. Please report any that you encounter** + +## Installation + +Node 10 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 +``` + +## Features + + - Unary and streaming calls + - Cancellation + - Deadlines + - TLS channel credentials + - Call credentials (for auth) + - Simple reconnection + - Channel API + +This library does not directly handle `.proto` files. To use `.proto` files with this library we recommend using the `@grpc/proto-loader` package. + +## 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. diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.d.ts new file mode 100644 index 0000000..c15735a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.d.ts @@ -0,0 +1,16 @@ +import { Call } from './call-stream'; +import { Http2Channel } 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: Http2Channel, stream: Call); + sendMetadata(metadata: Promise): Promise; +} +export declare class CallCredentialsFilterFactory implements FilterFactory { + private readonly channel; + constructor(channel: Http2Channel); + createFilter(callStream: Call): CallCredentialsFilter; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.js new file mode 100644 index 0000000..77ee72d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const filter_1 = require("./filter"); +class CallCredentialsFilter extends filter_1.BaseFilter { + constructor(channel, stream) { + 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]; + } + /* Currently, call credentials are only allowed on HTTPS connections, so we + * can assume that the scheme is "https" */ + this.serviceUrl = `https://${stream.getHost()}/${serviceName}`; + } + async sendMetadata(metadata) { + const channelCredentials = this.channel.credentials._getCallCredentials(); + const streamCredentials = this.stream.getCredentials(); + const credentials = channelCredentials.compose(streamCredentials); + const credsMetadata = credentials.generateMetadata({ service_url: this.serviceUrl }); + const resultMetadata = await metadata; + resultMetadata.merge(await credsMetadata); + return resultMetadata; + } +} +exports.CallCredentialsFilter = CallCredentialsFilter; +class CallCredentialsFilterFactory { + constructor(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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials.d.ts new file mode 100644 index 0000000..d7a1636 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials.d.ts @@ -0,0 +1,32 @@ +import { Metadata } from './metadata'; +export declare type CallMetadataOptions = { + service_url: string; +}; +export declare type CallMetadataGenerator = (options: CallMetadataOptions, cb: (err: Error | null, metadata?: Metadata) => void) => void; +/** + * 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; + /** + * 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; + static createEmpty(): CallCredentials; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials.js new file mode 100644 index 0000000..04f12c9 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-credentials.js @@ -0,0 +1,70 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const metadata_1 = require("./metadata"); +/** + * 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); + } + 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])); + } +} +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]); + } +} +class EmptyCallCredentials extends CallCredentials { + generateMetadata(options) { + return Promise.resolve(new metadata_1.Metadata()); + } + compose(other) { + return other; + } +} +//# sourceMappingURL=call-credentials.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-stream.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-stream.d.ts new file mode 100644 index 0000000..f444fb9 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-stream.d.ts @@ -0,0 +1,100 @@ +/// +import * as http2 from 'http2'; +import { Duplex } from 'stream'; +import { CallCredentials } from './call-credentials'; +import { Http2Channel } from './channel'; +import { Status } from './constants'; +import { EmitterAugmentation1 } from './events'; +import { Filter } from './filter'; +import { FilterStackFactory } from './filter-stack'; +import { Metadata } from './metadata'; +import { ObjectDuplex, WriteCallback } from './object-stream'; +export declare type Deadline = Date | number; +export interface CallStreamOptions { + deadline: Deadline; + flags: number; + host: string; + parentCall: Call | 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; +} +/** + * This interface represents a duplex stream associated with a single gRPC call. + */ +export declare type Call = { + cancelWithStatus(status: Status, details: string): void; + getPeer(): string; + sendMetadata(metadata: Metadata): void; + getDeadline(): Deadline; + getCredentials(): CallCredentials; + setCredentials(credentials: CallCredentials): void; + getStatus(): StatusObject | null; + getMethod(): string; + getHost(): string; +} & EmitterAugmentation1<'metadata', Metadata> & EmitterAugmentation1<'status', StatusObject> & ObjectDuplex; +export declare class Http2CallStream extends Duplex implements Call { + private readonly methodName; + private readonly channel; + private readonly options; + credentials: CallCredentials; + filterStack: Filter; + private http2Stream; + private pendingRead; + private pendingWrite; + private pendingWriteCallback; + private pendingFinalCallback; + private readState; + private readCompressFlag; + private readPartialSize; + private readSizeRemaining; + private readMessageSize; + private readPartialMessage; + private readMessageRemaining; + private isReadFilterPending; + private canPush; + private unpushedReadMessages; + private unfilteredReadMessages; + private mappedStatusCode; + private handlingHeaders; + private handlingTrailers; + private finalStatus; + constructor(methodName: string, channel: Http2Channel, options: CallStreamOptions, filterStackFactory: FilterStackFactory); + /** + * 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 handleFilterError; + private handleFilteredRead; + private filterReceivedMessage; + private tryPush; + private handleTrailers; + attachHttp2Stream(stream: http2.ClientHttp2Stream): void; + sendMetadata(metadata: Metadata): 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; + _read(size: number): void; + _write(chunk: WriteObject, encoding: string, cb: WriteCallback): void; + _final(cb: Function): void; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-stream.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-stream.js new file mode 100644 index 0000000..ca8cee8 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call-stream.js @@ -0,0 +1,410 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const http2 = require("http2"); +const stream_1 = require("stream"); +const call_credentials_1 = require("./call-credentials"); +const constants_1 = require("./constants"); +const metadata_1 = require("./metadata"); +const { HTTP2_HEADER_STATUS, HTTP2_HEADER_CONTENT_TYPE, NGHTTP2_CANCEL } = http2.constants; +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 Http2CallStream extends stream_1.Duplex { + constructor(methodName, channel, options, filterStackFactory) { + super({ objectMode: true }); + this.methodName = methodName; + this.channel = channel; + this.options = options; + this.credentials = call_credentials_1.CallCredentials.createEmpty(); + this.http2Stream = null; + this.pendingRead = false; + this.pendingWrite = null; + this.pendingWriteCallback = null; + this.pendingFinalCallback = null; + 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; + this.isReadFilterPending = false; + this.canPush = 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; + // Promise objects that are re-assigned to resolving promises when headers + // or trailers received. Processing headers/trailers is asynchronous, so we + // can use these objects to await their completion. This helps us establish + // order of precedence when obtaining the status of the call. + this.handlingHeaders = Promise.resolve(); + this.handlingTrailers = Promise.resolve(); + // This is populated (non-null) if and only if the call has ended + this.finalStatus = null; + this.filterStack = filterStackFactory.createFilter(this); + } + /** + * 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 (this.finalStatus === null) { + this.finalStatus = status; + this.emit('status', status); + } + } + handleFilterError(error) { + this.cancelWithStatus(constants_1.Status.INTERNAL, error.message); + } + handleFilteredRead(message) { + /* If we the call has already ended, we don't want to do anything with + * this message. Dropping it on the floor is correct behavior */ + if (this.finalStatus !== null) { + return; + } + this.isReadFilterPending = false; + if (this.canPush) { + if (!this.push(message)) { + this.canPush = false; + this.http2Stream.pause(); + } + } + else { + 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, we don't want to do anything with + * this message. Dropping it on the floor is correct behavior */ + if (this.finalStatus !== null) { + return; + } + if (framedMessage === null) { + if (this.canPush) { + this.push(null); + } + else { + this.unpushedReadMessages.push(null); + } + return; + } + this.isReadFilterPending = true; + this.filterStack.receiveMessage(Promise.resolve(framedMessage)) + .then(this.handleFilteredRead.bind(this), this.handleFilterError.bind(this)); + } + tryPush(messageBytes) { + if (this.isReadFilterPending) { + this.unfilteredReadMessages.push(messageBytes); + } + else { + this.filterReceivedMessage(messageBytes); + } + } + handleTrailers(headers) { + const code = this.mappedStatusCode; + const details = ''; + let metadata; + try { + metadata = metadata_1.Metadata.fromHttp2Headers(headers); + } + catch (e) { + metadata = new metadata_1.Metadata(); + } + const status = { code, details, metadata }; + this.handlingTrailers = (async () => { + let finalStatus; + try { + // Attempt to assign final status. + finalStatus = + await this.filterStack.receiveTrailers(Promise.resolve(status)); + } + catch (error) { + await this.handlingHeaders; + // 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; + } + // It's possible that headers were received but not fully handled yet. + // Give the headers handler an opportunity to end the call first, + // if an error occurred. + await this.handlingHeaders; + // This is a no-op if the call was already ended when handling headers. + this.endCall(finalStatus); + })(); + } + attachHttp2Stream(stream) { + if (this.finalStatus !== null) { + stream.close(NGHTTP2_CANCEL); + } + else { + this.http2Stream = stream; + stream.on('response', (headers, flags) => { + switch (headers[HTTP2_HEADER_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; + } + this.handlingHeaders = + this.filterStack.receiveMetadata(Promise.resolve(metadata)) + .then((finalMetadata) => { + this.emit('metadata', finalMetadata); + }) + .catch((error) => { + this.destroyHttp2Stream(); + 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) => { + let readHead = 0; + let toRead; + 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 { + this.tryPush(Buffer.concat([this.readCompressFlag, this.readPartialSize])); + this.readState = ReadState.NO_DATA; + } + } + 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.tryPush(framedMessage); + this.readState = ReadState.NO_DATA; + } + break; + default: + throw new Error('This should never happen'); + } + } + }); + stream.on('end', () => { + this.tryPush(null); + }); + stream.on('close', async (errorCode) => { + let code; + let details = ''; + switch (errorCode) { + case http2.constants.NGHTTP2_REFUSED_STREAM: + code = constants_1.Status.UNAVAILABLE; + break; + case http2.constants.NGHTTP2_CANCEL: + code = constants_1.Status.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; + default: + code = constants_1.Status.INTERNAL; + } + // This guarantees that if trailers were received, the value of the + // 'grpc-status' header takes precedence for emitted status data. + await this.handlingTrailers; + // 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) => { + this.endCall({ + code: constants_1.Status.INTERNAL, + details: 'Internal HTTP2 error', + metadata: new metadata_1.Metadata() + }); + }); + if (!this.pendingRead) { + stream.pause(); + } + if (this.pendingWrite) { + if (!this.pendingWriteCallback) { + throw new Error('Invalid state in write handling code'); + } + stream.write(this.pendingWrite, this.pendingWriteCallback); + } + if (this.pendingFinalCallback) { + stream.end(this.pendingFinalCallback); + } + } + } + sendMetadata(metadata) { + this.channel._startHttp2Stream(this.options.host, this.methodName, this, metadata); + } + 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) { + /* TODO(murgatroid99): Determine if we want to send different RST_STREAM + * codes based on the status code */ + this.http2Stream.close(NGHTTP2_CANCEL); + } + } + cancelWithStatus(status, details) { + this.destroyHttp2Stream(); + (async () => { + // If trailers are currently being processed, the call should be ended + // by handleTrailers instead. + await this.handlingTrailers; + this.endCall({ code: status, details, metadata: new metadata_1.Metadata() }); + })(); + } + getDeadline() { + return this.options.deadline; + } + getCredentials() { + return this.credentials; + } + setCredentials(credentials) { + this.credentials = credentials; + } + getStatus() { + return this.finalStatus; + } + getPeer() { + throw new Error('Not yet implemented'); + } + getMethod() { + return this.methodName; + } + getHost() { + return this.options.host; + } + _read(size) { + /* If we have already emitted a status, we should not emit any more + * messages and we should communicate that the stream has ended */ + if (this.finalStatus !== null) { + this.push(null); + return; + } + this.canPush = true; + if (this.http2Stream === null) { + this.pendingRead = true; + } + else { + while (this.unpushedReadMessages.length > 0) { + const nextMessage = this.unpushedReadMessages.shift(); + this.canPush = this.push(nextMessage); + if (nextMessage === null || (!this.canPush)) { + this.canPush = false; + return; + } + } + /* Only resume reading from the http2Stream if we don't have any pending + * messages to emit, and we haven't gotten the signal to stop pushing + * messages */ + this.http2Stream.resume(); + } + } + _write(chunk, encoding, cb) { + this.filterStack.sendMessage(Promise.resolve(chunk)).then((message) => { + if (this.http2Stream === null) { + this.pendingWrite = message.message; + this.pendingWriteCallback = cb; + } + else { + this.http2Stream.write(message.message, cb); + } + }, this.handleFilterError.bind(this)); + } + _final(cb) { + if (this.http2Stream === null) { + this.pendingFinalCallback = cb; + } + else { + this.http2Stream.end(cb); + } + } +} +exports.Http2CallStream = Http2CallStream; +//# sourceMappingURL=call-stream.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call.d.ts new file mode 100644 index 0000000..0fb6b6e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call.d.ts @@ -0,0 +1,72 @@ +/// +import { EventEmitter } from 'events'; +import { Duplex, Readable, Writable } from 'stream'; +import { Call, StatusObject } from './call-stream'; +import { EmitterAugmentation1 } from './events'; +import { Metadata } from './metadata'; +import { ObjectReadable, ObjectWritable } from './object-stream'; +/** + * 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 = { + 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; +export declare class ClientUnaryCallImpl extends EventEmitter implements ClientUnaryCall { + private readonly call; + constructor(call: Call); + cancel(): void; + getPeer(): string; +} +export declare class ClientReadableStreamImpl extends Readable implements ClientReadableStream { + private readonly call; + readonly deserialize: (chunk: Buffer) => ResponseType; + constructor(call: Call, deserialize: (chunk: Buffer) => ResponseType); + cancel(): void; + getPeer(): string; + _read(_size: number): void; +} +export declare class ClientWritableStreamImpl extends Writable implements ClientWritableStream { + private readonly call; + readonly serialize: (value: RequestType) => Buffer; + constructor(call: Call, serialize: (value: RequestType) => Buffer); + cancel(): void; + getPeer(): string; + _write(chunk: RequestType, encoding: string, cb: Function): void; + _final(cb: Function): void; +} +export declare class ClientDuplexStreamImpl extends Duplex implements ClientDuplexStream { + private readonly call; + readonly serialize: (value: RequestType) => Buffer; + readonly deserialize: (chunk: Buffer) => ResponseType; + constructor(call: Call, serialize: (value: RequestType) => Buffer, deserialize: (chunk: Buffer) => ResponseType); + cancel(): void; + getPeer(): string; + _read(_size: number): void; + _write(chunk: RequestType, encoding: string, cb: Function): void; + _final(cb: Function): void; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call.js new file mode 100644 index 0000000..c660387 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/call.js @@ -0,0 +1,154 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events_1 = require("events"); +const stream_1 = require("stream"); +const constants_1 = require("./constants"); +class ClientUnaryCallImpl extends events_1.EventEmitter { + constructor(call) { + super(); + this.call = call; + call.on('metadata', (metadata) => { + this.emit('metadata', metadata); + }); + call.on('status', (status) => { + this.emit('status', status); + }); + } + cancel() { + this.call.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); + } + getPeer() { + return this.call.getPeer(); + } +} +exports.ClientUnaryCallImpl = ClientUnaryCallImpl; +function setUpReadableStream(stream, call, deserialize) { + let statusEmitted = false; + call.on('data', (data) => { + let deserialized; + try { + deserialized = deserialize(data); + } + catch (e) { + call.cancelWithStatus(constants_1.Status.INTERNAL, 'Failed to parse server response'); + return; + } + if (!stream.push(deserialized)) { + call.pause(); + } + }); + call.on('end', () => { + if (statusEmitted) { + stream.push(null); + } + else { + call.once('status', () => { + stream.push(null); + }); + } + }); + call.on('status', (status) => { + if (status.code !== constants_1.Status.OK) { + const error = Object.assign(new Error(status.details), status); + stream.emit('error', error); + } + stream.emit('status', status); + statusEmitted = true; + }); + call.pause(); +} +class ClientReadableStreamImpl extends stream_1.Readable { + constructor(call, deserialize) { + super({ objectMode: true }); + this.call = call; + this.deserialize = deserialize; + call.on('metadata', (metadata) => { + this.emit('metadata', metadata); + }); + setUpReadableStream(this, call, deserialize); + } + cancel() { + this.call.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); + } + getPeer() { + return this.call.getPeer(); + } + _read(_size) { + this.call.resume(); + } +} +exports.ClientReadableStreamImpl = ClientReadableStreamImpl; +function tryWrite(call, serialize, chunk, encoding, cb) { + let message; + const flags = Number(encoding); + try { + message = serialize(chunk); + } + catch (e) { + call.cancelWithStatus(constants_1.Status.INTERNAL, 'Serialization failure'); + cb(e); + return; + } + const writeObj = { message }; + if (!Number.isNaN(flags)) { + writeObj.flags = flags; + } + call.write(writeObj, cb); +} +class ClientWritableStreamImpl extends stream_1.Writable { + constructor(call, serialize) { + super({ objectMode: true }); + this.call = call; + this.serialize = serialize; + call.on('metadata', (metadata) => { + this.emit('metadata', metadata); + }); + call.on('status', (status) => { + this.emit('status', status); + }); + } + cancel() { + this.call.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); + } + getPeer() { + return this.call.getPeer(); + } + _write(chunk, encoding, cb) { + tryWrite(this.call, this.serialize, chunk, encoding, cb); + } + _final(cb) { + this.call.end(); + cb(); + } +} +exports.ClientWritableStreamImpl = ClientWritableStreamImpl; +class ClientDuplexStreamImpl extends stream_1.Duplex { + constructor(call, serialize, deserialize) { + super({ objectMode: true }); + this.call = call; + this.serialize = serialize; + this.deserialize = deserialize; + call.on('metadata', (metadata) => { + this.emit('metadata', metadata); + }); + setUpReadableStream(this, call, deserialize); + } + cancel() { + this.call.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); + } + getPeer() { + return this.call.getPeer(); + } + _read(_size) { + this.call.resume(); + } + _write(chunk, encoding, cb) { + tryWrite(this.call, this.serialize, chunk, encoding, cb); + } + _final(cb) { + this.call.end(); + cb(); + } +} +exports.ClientDuplexStreamImpl = ClientDuplexStreamImpl; +//# sourceMappingURL=call.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-credentials.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-credentials.d.ts new file mode 100644 index 0000000..0cb7cdf --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-credentials.d.ts @@ -0,0 +1,73 @@ +/// +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; + /** + * 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; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-credentials.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-credentials.js new file mode 100644 index 0000000..89689ff --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-credentials.js @@ -0,0 +1,96 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tls_1 = require("tls"); +const call_credentials_1 = require("./call-credentials"); +// tslint:disable-next-line:no-any +function verifyIsBufferOrNull(obj, friendlyName) { + if (obj && !(obj instanceof Buffer)) { + throw new TypeError(`${friendlyName}, if provided, must be a Buffer.`); + } +} +/** + * 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'); + } + const secureContext = tls_1.createSecureContext({ + ca: rootCerts || undefined, + key: privateKey || undefined, + cert: certChain || undefined + }); + const connectionOptions = { secureContext }; + if (verifyOptions && verifyOptions.checkServerIdentity) { + connectionOptions.checkServerIdentity = + (host, cert) => { + return verifyOptions.checkServerIdentity(host, { raw: cert.raw }); + }; + } + return new SecureChannelCredentialsImpl(connectionOptions); + } + /** + * 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; + } +} +class SecureChannelCredentialsImpl extends ChannelCredentials { + constructor(connectionOptions, callCredentials) { + super(callCredentials); + this.connectionOptions = connectionOptions; + } + compose(callCredentials) { + const combinedCallCredentials = this.callCredentials.compose(callCredentials); + return new SecureChannelCredentialsImpl(this.connectionOptions, combinedCallCredentials); + } + _getConnectionOptions() { + return this.connectionOptions; + } + _isSecure() { + return true; + } +} +//# sourceMappingURL=channel-credentials.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-options.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-options.d.ts new file mode 100644 index 0000000..dc7d666 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-options.d.ts @@ -0,0 +1,24 @@ +/** + * 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; + [key: string]: string | number; +} +/** + * 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; +}; diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-options.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-options.js new file mode 100644 index 0000000..5abebf6 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel-options.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * 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 +}; +//# sourceMappingURL=channel-options.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel.d.ts new file mode 100644 index 0000000..b6ad83e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel.d.ts @@ -0,0 +1,92 @@ +/// +import { EventEmitter } from 'events'; +import { Call, Deadline, Http2CallStream } from './call-stream'; +import { ChannelCredentials } from './channel-credentials'; +import { ChannelOptions } from './channel-options'; +import { Metadata } from './metadata'; +export declare enum ConnectivityState { + CONNECTING = 0, + READY = 1, + TRANSIENT_FAILURE = 2, + IDLE = 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 | null | undefined, host: string | null | undefined, parentCall: Call | null | undefined, propagateFlags: number | null | undefined): Call; +} +export declare class Http2Channel extends EventEmitter implements Channel { + readonly credentials: ChannelCredentials; + private readonly options; + private readonly userAgent; + private readonly target; + private readonly defaultAuthority; + private connectivityState; + private connecting; + private subChannel; + private filterStackFactory; + private subChannelConnectCallback; + private subChannelCloseCallback; + private backoffTimerId; + private currentBackoff; + private currentBackoffDeadline; + private handleStateChange; + private transitionToState; + private startConnecting; + constructor(address: string, credentials: ChannelCredentials, options: Partial); + _startHttp2Stream(authority: string, methodName: string, stream: Http2CallStream, metadata: Metadata): void; + createCall(method: string, deadline: Deadline | null | undefined, host: string | null | undefined, parentCall: Call | null | undefined, propagateFlags: number | null | undefined): Call; + /** + * Attempts to connect, returning a Promise that resolves when the connection + * is successful, or rejects if the channel is shut down. + */ + private connect; + getConnectivityState(tryToConnect: boolean): ConnectivityState; + watchConnectivityState(currentState: ConnectivityState, deadline: Date | number, callback: (error?: Error) => void): void; + getTarget(): string; + close(): void; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel.js new file mode 100644 index 0000000..2ecca4e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/channel.js @@ -0,0 +1,297 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events_1 = require("events"); +const http2 = require("http2"); +const tls_1 = require("tls"); +const url = require("url"); +const call_credentials_filter_1 = require("./call-credentials-filter"); +const call_stream_1 = require("./call-stream"); +const channel_options_1 = require("./channel-options"); +const compression_filter_1 = require("./compression-filter"); +const constants_1 = require("./constants"); +const deadline_filter_1 = require("./deadline-filter"); +const filter_stack_1 = require("./filter-stack"); +const metadata_status_filter_1 = require("./metadata-status-filter"); +const subchannel_1 = require("./subchannel"); +const { version: clientVersion } = require('../../package.json'); +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; +const { HTTP2_HEADER_AUTHORITY, HTTP2_HEADER_CONTENT_TYPE, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_TE, HTTP2_HEADER_USER_AGENT } = http2.constants; +var ConnectivityState; +(function (ConnectivityState) { + ConnectivityState[ConnectivityState["CONNECTING"] = 0] = "CONNECTING"; + ConnectivityState[ConnectivityState["READY"] = 1] = "READY"; + ConnectivityState[ConnectivityState["TRANSIENT_FAILURE"] = 2] = "TRANSIENT_FAILURE"; + ConnectivityState[ConnectivityState["IDLE"] = 3] = "IDLE"; + ConnectivityState[ConnectivityState["SHUTDOWN"] = 4] = "SHUTDOWN"; +})(ConnectivityState = exports.ConnectivityState || (exports.ConnectivityState = {})); +function uniformRandom(min, max) { + return Math.random() * (max - min) + min; +} +class Http2Channel extends events_1.EventEmitter { + constructor(address, credentials, options) { + super(); + this.credentials = credentials; + this.options = options; + this.connectivityState = ConnectivityState.IDLE; + // Helper Promise object only used in the implementation of connect(). + this.connecting = null; + /* For now, we have up to one subchannel, which will exist as long as we are + * connecting or trying to connect */ + this.subChannel = null; + this.subChannelConnectCallback = () => { }; + this.subChannelCloseCallback = () => { }; + this.currentBackoff = INITIAL_BACKOFF_MS; + for (const option in options) { + if (options.hasOwnProperty(option)) { + if (!channel_options_1.recognizedOptions.hasOwnProperty(option)) { + console.warn(`Unrecognized channel argument '${option}' will be ignored.`); + } + } + } + if (credentials._isSecure()) { + this.target = new url.URL(`https://${address}`); + } + else { + this.target = new url.URL(`http://${address}`); + } + // TODO(murgatroid99): Add more centralized handling of channel options + if (this.options['grpc.default_authority']) { + this.defaultAuthority = this.options['grpc.default_authority']; + } + else { + this.defaultAuthority = this.target.host; + } + this.filterStackFactory = new filter_stack_1.FilterStackFactory([ + new call_credentials_filter_1.CallCredentialsFilterFactory(this), new deadline_filter_1.DeadlineFilterFactory(this), + new metadata_status_filter_1.MetadataStatusFilterFactory(this), new compression_filter_1.CompressionFilterFactory(this) + ]); + this.currentBackoffDeadline = new Date(); + /* The only purpose of these lines is to ensure that this.backoffTimerId has + * a value of type NodeJS.Timer. */ + this.backoffTimerId = setTimeout(() => { }, 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 + } + handleStateChange(oldState, newState) { + const now = new Date(); + switch (newState) { + case ConnectivityState.CONNECTING: + if (oldState === ConnectivityState.IDLE) { + this.currentBackoff = INITIAL_BACKOFF_MS; + this.currentBackoffDeadline = + new Date(now.getTime() + INITIAL_BACKOFF_MS); + } + else if (oldState === ConnectivityState.TRANSIENT_FAILURE) { + this.currentBackoff = Math.min(this.currentBackoff * BACKOFF_MULTIPLIER, MAX_BACKOFF_MS); + const jitterMagnitude = BACKOFF_JITTER * this.currentBackoff; + this.currentBackoffDeadline = new Date(now.getTime() + this.currentBackoff + + uniformRandom(-jitterMagnitude, jitterMagnitude)); + } + this.startConnecting(); + break; + case ConnectivityState.READY: + this.emit('connect'); + break; + case ConnectivityState.TRANSIENT_FAILURE: + this.subChannel = null; + this.backoffTimerId = setTimeout(() => { + this.transitionToState([ConnectivityState.TRANSIENT_FAILURE], ConnectivityState.CONNECTING); + }, this.currentBackoffDeadline.getTime() - now.getTime()); + break; + case ConnectivityState.IDLE: + case ConnectivityState.SHUTDOWN: + if (this.subChannel) { + this.subChannel.close(); + this.subChannel.removeListener('connect', this.subChannelConnectCallback); + this.subChannel.removeListener('close', this.subChannelCloseCallback); + this.subChannel = null; + this.emit('shutdown'); + clearTimeout(this.backoffTimerId); + } + break; + default: + throw new Error('This should never happen'); + } + } + // Transition from any of a set of oldStates to a specific newState + transitionToState(oldStates, newState) { + if (oldStates.indexOf(this.connectivityState) > -1) { + const oldState = this.connectivityState; + this.connectivityState = newState; + this.handleStateChange(oldState, newState); + this.emit('connectivityStateChanged', newState); + } + } + startConnecting() { + const connectionOptions = this.credentials._getConnectionOptions() || {}; + if (connectionOptions.secureContext !== null) { + // 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; + } + } + const subChannel = new subchannel_1.Http2SubChannel(this.target, connectionOptions, this.userAgent, this.options); + this.subChannel = subChannel; + const now = new Date(); + const connectionTimeout = Math.max(this.currentBackoffDeadline.getTime() - now.getTime(), MIN_CONNECT_TIMEOUT_MS); + const connectionTimerId = setTimeout(() => { + // This should trigger the 'close' event, which will send us back to + // TRANSIENT_FAILURE + subChannel.close(); + }, connectionTimeout); + this.subChannelConnectCallback = () => { + // Connection succeeded + clearTimeout(connectionTimerId); + this.transitionToState([ConnectivityState.CONNECTING], ConnectivityState.READY); + }; + subChannel.once('connect', this.subChannelConnectCallback); + this.subChannelCloseCallback = () => { + // Connection failed + clearTimeout(connectionTimerId); + /* TODO(murgatroid99): verify that this works for + * CONNECTING->TRANSITIVE_FAILURE see nodejs/node#16645 */ + this.transitionToState([ConnectivityState.CONNECTING, ConnectivityState.READY], ConnectivityState.TRANSIENT_FAILURE); + }; + subChannel.once('close', this.subChannelCloseCallback); + } + _startHttp2Stream(authority, methodName, stream, metadata) { + const finalMetadata = stream.filterStack.sendMetadata(Promise.resolve(metadata.clone())); + Promise.all([finalMetadata, this.connect()]) + .then(([metadataValue]) => { + const headers = metadataValue.toHttp2Headers(); + headers[HTTP2_HEADER_AUTHORITY] = authority; + headers[HTTP2_HEADER_USER_AGENT] = this.userAgent; + headers[HTTP2_HEADER_CONTENT_TYPE] = 'application/grpc'; + headers[HTTP2_HEADER_METHOD] = 'POST'; + headers[HTTP2_HEADER_PATH] = methodName; + headers[HTTP2_HEADER_TE] = 'trailers'; + if (this.connectivityState === ConnectivityState.READY) { + const subChannel = this.subChannel; + subChannel.startCallStream(metadataValue, stream); + } + else { + /* In this case, we lost the connection while finalizing + * metadata. That should be very unusual */ + setImmediate(() => { + this._startHttp2Stream(authority, methodName, stream, metadata); + }); + } + }) + .catch((error) => { + // We assume the error code isn't 0 (Status.OK) + stream.cancelWithStatus(error.code || constants_1.Status.UNKNOWN, `Getting metadata from plugin failed with error: ${error.message}`); + }); + } + createCall(method, deadline, host, parentCall, propagateFlags) { + if (this.connectivityState === ConnectivityState.SHUTDOWN) { + throw new Error('Channel has been shut down'); + } + const finalOptions = { + deadline: (deadline === null || deadline === undefined) ? Infinity : + deadline, + flags: propagateFlags || 0, + host: host || this.defaultAuthority, + parentCall: parentCall || null + }; + const stream = new call_stream_1.Http2CallStream(method, this, finalOptions, this.filterStackFactory); + return stream; + } + /** + * Attempts to connect, returning a Promise that resolves when the connection + * is successful, or rejects if the channel is shut down. + */ + connect() { + if (this.connectivityState === ConnectivityState.READY) { + return Promise.resolve(); + } + else if (this.connectivityState === ConnectivityState.SHUTDOWN) { + return Promise.reject(new Error('Channel has been shut down')); + } + else { + // In effect, this.connecting is only assigned upon the first attempt to + // transition from IDLE to CONNECTING, so this condition could have also + // been (connectivityState === IDLE). + if (!this.connecting) { + this.connecting = new Promise((resolve, reject) => { + this.transitionToState([ConnectivityState.IDLE], ConnectivityState.CONNECTING); + const onConnect = () => { + this.connecting = null; + this.removeListener('shutdown', onShutdown); + resolve(); + }; + const onShutdown = () => { + this.connecting = null; + this.removeListener('connect', onConnect); + reject(new Error('Channel has been shut down')); + }; + this.once('connect', onConnect); + this.once('shutdown', onShutdown); + }); + } + return this.connecting; + } + } + getConnectivityState(tryToConnect) { + if (tryToConnect) { + this.transitionToState([ConnectivityState.IDLE], ConnectivityState.CONNECTING); + } + return this.connectivityState; + } + watchConnectivityState(currentState, deadline, callback) { + if (this.connectivityState !== currentState) { + /* If the connectivity state is different from the provided currentState, + * we assume that a state change has successfully occurred */ + setImmediate(callback); + } + else { + let deadlineMs = 0; + if (deadline instanceof Date) { + deadlineMs = deadline.getTime(); + } + else { + deadlineMs = deadline; + } + let timeout = deadlineMs - Date.now(); + if (timeout < 0) { + timeout = 0; + } + const timeoutId = setTimeout(() => { + this.removeListener('connectivityStateChanged', eventCb); + callback(new Error('Channel state did not change before deadline')); + }, timeout); + const eventCb = () => { + clearTimeout(timeoutId); + callback(); + }; + this.once('connectivityStateChanged', eventCb); + } + } + getTarget() { + return this.target.toString(); + } + close() { + if (this.connectivityState === ConnectivityState.SHUTDOWN) { + throw new Error('Channel has been shut down'); + } + this.transitionToState([ + ConnectivityState.CONNECTING, ConnectivityState.READY, + ConnectivityState.TRANSIENT_FAILURE, ConnectivityState.IDLE + ], ConnectivityState.SHUTDOWN); + } +} +exports.Http2Channel = Http2Channel; +//# sourceMappingURL=channel.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/client.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/client.d.ts new file mode 100644 index 0000000..ba9b7a0 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/client.d.ts @@ -0,0 +1,49 @@ +/// +import { ClientDuplexStream, ClientReadableStream, ClientUnaryCall, ClientWritableStream, ServiceError } from './call'; +import { CallCredentials } from './call-credentials'; +import { Call, Deadline } from './call-stream'; +import { Channel } from './channel'; +import { ChannelCredentials } from './channel-credentials'; +import { ChannelOptions } from './channel-options'; +import { Metadata } from './metadata'; +export declare const kChannel: unique symbol; +export interface UnaryCallback { + (err: ServiceError | null, value?: ResponseType): void; +} +export interface CallOptions { + deadline?: Deadline; + host?: string; + parent?: Call; + propagate_flags?: number; + credentials?: CallCredentials; +} +export declare type ClientOptions = Partial & { + channelOverride?: Channel; + channelFactoryOverride?: (address: string, credentials: ChannelCredentials, options: ClientOptions) => Channel; +}; +/** + * A generic gRPC client. Primarily useful as a base class for all generated + * clients. + */ +export declare class Client { + private readonly [kChannel]; + constructor(address: string, credentials: ChannelCredentials, options?: ClientOptions); + close(): void; + getChannel(): Channel; + waitForReady(deadline: Deadline, callback: (error?: Error) => void): void; + private handleUnaryResponse; + 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; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/client.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/client.js new file mode 100644 index 0000000..9e4ae72 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/client.js @@ -0,0 +1,186 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const call_1 = require("./call"); +const channel_1 = require("./channel"); +const constants_1 = require("./constants"); +const metadata_1 = require("./metadata"); +// This symbol must be exported (for now). +// See: https://github.com/Microsoft/TypeScript/issues/20080 +exports.kChannel = Symbol(); +/** + * A generic gRPC client. Primarily useful as a base class for all generated + * clients. + */ +class Client { + constructor(address, credentials, options = {}) { + if (options.channelOverride) { + this[exports.kChannel] = options.channelOverride; + } + else if (options.channelFactoryOverride) { + this[exports.kChannel] = + options.channelFactoryOverride(address, credentials, options); + } + else { + this[exports.kChannel] = new channel_1.Http2Channel(address, credentials, options); + } + } + close() { + this[exports.kChannel].close(); + } + getChannel() { + return this[exports.kChannel]; + } + waitForReady(deadline, callback) { + const checkState = (err) => { + if (err) { + callback(new Error('Failed to connect before the deadline')); + return; + } + let newState; + try { + newState = this[exports.kChannel].getConnectivityState(true); + } + catch (e) { + callback(new Error('The channel has been closed')); + return; + } + if (newState === channel_1.ConnectivityState.READY) { + callback(); + } + else { + try { + this[exports.kChannel].watchConnectivityState(newState, deadline, checkState); + } + catch (e) { + callback(new Error('The channel has been closed')); + } + } + }; + setImmediate(checkState); + } + handleUnaryResponse(call, deserialize, callback) { + let responseMessage = null; + call.on('data', (data) => { + if (responseMessage != null) { + call.cancelWithStatus(constants_1.Status.INTERNAL, 'Too many responses received'); + } + try { + responseMessage = deserialize(data); + } + catch (e) { + call.cancelWithStatus(constants_1.Status.INTERNAL, 'Failed to parse server response'); + } + }); + call.on('end', () => { + if (responseMessage == null) { + call.cancelWithStatus(constants_1.Status.INTERNAL, 'Not enough responses received'); + } + }); + call.on('status', (status) => { + /* We assume that call emits status after it emits end, and that it + * accounts for any cancelWithStatus calls up until it emits status. + * Therefore, considering the above event handlers, status.code should be + * OK if and only if we have a non-null responseMessage */ + if (status.code === constants_1.Status.OK) { + callback(null, responseMessage); + } + else { + const error = Object.assign(new Error(status.details), status); + callback(error); + } + }); + } + 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) { + ({ metadata, options, callback } = + this.checkOptionalUnaryResponseArguments(metadata, options, callback)); + const call = this[exports.kChannel].createCall(method, options.deadline, options.host, options.parent, options.propagate_flags); + if (options.credentials) { + call.setCredentials(options.credentials); + } + const message = serialize(argument); + const writeObj = { message }; + call.sendMetadata(metadata); + call.write(writeObj); + call.end(); + this.handleUnaryResponse(call, deserialize, callback); + return new call_1.ClientUnaryCallImpl(call); + } + makeClientStreamRequest(method, serialize, deserialize, metadata, options, callback) { + ({ metadata, options, callback } = + this.checkOptionalUnaryResponseArguments(metadata, options, callback)); + const call = this[exports.kChannel].createCall(method, options.deadline, options.host, options.parent, options.propagate_flags); + if (options.credentials) { + call.setCredentials(options.credentials); + } + call.sendMetadata(metadata); + this.handleUnaryResponse(call, deserialize, callback); + return new call_1.ClientWritableStreamImpl(call, serialize); + } + 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) { + ({ metadata, options } = this.checkMetadataAndOptions(metadata, options)); + const call = this[exports.kChannel].createCall(method, options.deadline, options.host, options.parent, options.propagate_flags); + if (options.credentials) { + call.setCredentials(options.credentials); + } + const message = serialize(argument); + const writeObj = { message }; + call.sendMetadata(metadata); + call.write(writeObj); + call.end(); + return new call_1.ClientReadableStreamImpl(call, deserialize); + } + makeBidiStreamRequest(method, serialize, deserialize, metadata, options) { + ({ metadata, options } = this.checkMetadataAndOptions(metadata, options)); + const call = this[exports.kChannel].createCall(method, options.deadline, options.host, options.parent, options.propagate_flags); + if (options.credentials) { + call.setCredentials(options.credentials); + } + call.sendMetadata(metadata); + return new call_1.ClientDuplexStreamImpl(call, serialize, deserialize); + } +} +exports.Client = Client; +//# sourceMappingURL=client.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/compression-filter.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/compression-filter.d.ts new file mode 100644 index 0000000..73c1d2c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/compression-filter.d.ts @@ -0,0 +1,18 @@ +/// +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: Promise): Promise; + 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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/compression-filter.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/compression-filter.js new file mode 100644 index 0000000..978f267 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/compression-filter.js @@ -0,0 +1,185 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +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 wth 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-encoding', 'identity'); + headers.set('grpc-accept-encoding', 'identity,deflate,gzip'); + return headers; + } + async receiveMetadata(metadata) { + const headers = await metadata; + const receiveEncoding = headers.get('grpc-encoding'); + if (receiveEncoding.length > 0) { + const encoding = receiveEncoding[0]; + if (typeof encoding === 'string') { + this.receiveCompression = getCompressionHandler(encoding); + } + } + headers.remove('grpc-encoding'); + headers.remove('grpc-accept-encoding'); + return headers; + } + 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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/constants.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/constants.d.ts new file mode 100644 index 0000000..d0f5eb0 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/constants.d.ts @@ -0,0 +1,24 @@ +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 +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/constants.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/constants.js new file mode 100644 index 0000000..130a325 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/constants.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +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 = {})); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/deadline-filter.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/deadline-filter.d.ts new file mode 100644 index 0000000..c645fd2 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/deadline-filter.d.ts @@ -0,0 +1,17 @@ +import { Call } from './call-stream'; +import { Http2Channel } 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: Http2Channel, callStream: Call); + sendMetadata(metadata: Promise): Promise; +} +export declare class DeadlineFilterFactory implements FilterFactory { + private readonly channel; + constructor(channel: Http2Channel); + createFilter(callStream: Call): DeadlineFilter; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/deadline-filter.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/deadline-filter.js new file mode 100644 index 0000000..b93476b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/deadline-filter.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const channel_1 = require("./channel"); +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) { + 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); + callStream.on('status', () => clearTimeout(this.timer)); + } + } + sendMetadata(metadata) { + if (this.deadline === Infinity) { + return metadata; + } + return new Promise((resolve, reject) => { + if (this.channel.getConnectivityState(false) === + channel_1.ConnectivityState.READY) { + resolve(metadata); + } + else { + const handleStateChange = (newState) => { + if (newState === channel_1.ConnectivityState.READY) { + resolve(metadata); + this.channel.removeListener('connectivityStateChanged', handleStateChange); + this.callStream.removeListener('status', handleStatus); + } + }; + const handleStatus = () => { + reject(new Error('Call ended')); + this.channel.removeListener('connectivityStateChanged', handleStateChange); + }; + this.channel.on('connectivityStateChanged', handleStateChange); + this.callStream.once('status', handleStatus); + } + }) + .then((finalMetadata) => { + const timeoutString = getDeadline(this.deadline); + finalMetadata.set('grpc-timeout', timeoutString); + return finalMetadata; + }); + } +} +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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/events.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/events.d.ts new file mode 100644 index 0000000..d1a764e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/events.d.ts @@ -0,0 +1,9 @@ +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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/events.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/events.js new file mode 100644 index 0000000..003052c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/events.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter-stack.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter-stack.d.ts new file mode 100644 index 0000000..5d69854 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter-stack.d.ts @@ -0,0 +1,18 @@ +/// +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: Promise): Promise; + sendMessage(message: Promise): Promise; + receiveMessage(message: Promise): Promise; + receiveTrailers(status: Promise): Promise; +} +export declare class FilterStackFactory implements FilterFactory { + private readonly factories; + constructor(factories: Array>); + createFilter(callStream: Call): FilterStack; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter-stack.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter-stack.js new file mode 100644 index 0000000..f381f1d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter-stack.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter.d.ts new file mode 100644 index 0000000..b7addfa --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter.d.ts @@ -0,0 +1,24 @@ +/// +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: Promise): Promise; + sendMessage(message: Promise): Promise; + receiveMessage(message: Promise): Promise; + receiveTrailers(status: Promise): Promise; +} +export declare abstract class BaseFilter { + sendMetadata(metadata: Promise): Promise; + receiveMetadata(metadata: Promise): Promise; + sendMessage(message: Promise): Promise; + receiveMessage(message: Promise): Promise; + receiveTrailers(status: Promise): Promise; +} +export interface FilterFactory { + createFilter(callStream: Call): T; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter.js new file mode 100644 index 0000000..78480cf --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/filter.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class BaseFilter { + async sendMetadata(metadata) { + return metadata; + } + async receiveMetadata(metadata) { + return metadata; + } + async sendMessage(message) { + return message; + } + async receiveMessage(message) { + return message; + } + async receiveTrailers(status) { + return status; + } +} +exports.BaseFilter = BaseFilter; +//# sourceMappingURL=filter.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/index.d.ts new file mode 100644 index 0000000..8aac4ea --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/index.d.ts @@ -0,0 +1,46 @@ +/// +import { Channel } from './channel'; +import { Client } from './client'; +import { LogVerbosity, Status } from './constants'; +import { loadPackageDefinition, makeClientConstructor } from './make-client'; +import { Metadata } from './metadata'; +import { StatusBuilder } from './status-builder'; +export interface OAuth2Client { + getRequestMetadata: (url: string, callback: (err: Error | null, headers?: { + Authorization: string; + }) => void) => void; + getRequestHeaders: (url?: string) => Promise<{ + Authorization: string; + }>; +} +/**** Client Credentials ****/ +export declare const credentials: { + [key: string]: Function; +}; +/**** Metadata ****/ +export { Metadata }; +/**** Constants ****/ +export { LogVerbosity as logVerbosity, Status as status }; +/**** Client ****/ +export { Client, loadPackageDefinition, makeClientConstructor, makeClientConstructor as makeGenericClientConstructor, Channel }; +/** + * Close a Client object. + * @param client The client to close. + */ +export declare const closeClient: (client: Client) => void; +export declare const waitForClientReady: (client: Client, deadline: number | Date, callback: (error?: Error | undefined) => void) => void; +/**** 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 declare const Server: (options: any) => never; +export declare const ServerCredentials: { + createSsl: (rootCerts: any, keyCertPairs: any, checkClientCertificate: any) => never; + createInsecure: () => never; +}; +export declare const getClientChannel: (client: Client) => Channel; +export { StatusBuilder }; +export declare const ListenerBuilder: () => never; +export declare const InterceptorBuilder: () => never; +export declare const InterceptingCall: () => never; diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/index.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/index.js new file mode 100644 index 0000000..fe8f537 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/index.js @@ -0,0 +1,137 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const semver = require("semver"); +const call_credentials_1 = require("./call-credentials"); +const channel_credentials_1 = require("./channel-credentials"); +const client_1 = require("./client"); +exports.Client = client_1.Client; +const constants_1 = require("./constants"); +exports.logVerbosity = constants_1.LogVerbosity; +exports.status = constants_1.Status; +const logging = require("./logging"); +const make_client_1 = require("./make-client"); +exports.loadPackageDefinition = make_client_1.loadPackageDefinition; +exports.makeClientConstructor = make_client_1.makeClientConstructor; +exports.makeGenericClientConstructor = make_client_1.makeClientConstructor; +const metadata_1 = require("./metadata"); +exports.Metadata = metadata_1.Metadata; +const status_builder_1 = require("./status-builder"); +exports.StatusBuilder = status_builder_1.StatusBuilder; +const supportedNodeVersions = '^8.11.2 || >=9.4'; +if (!semver.satisfies(process.version, supportedNodeVersions)) { + throw new Error(`@grpc/grpc-js only works on Node ${supportedNodeVersions}`); +} +function mixin(...sources) { + const result = {}; + for (const source of sources) { + for (const propName of Object.getOwnPropertyNames(source)) { + const property = source[propName]; // tslint:disable-line no-any + if (typeof property === 'function') { + result[propName] = property; + } + } + } + return result; +} +/**** Client Credentials ****/ +// Using assign only copies enumerable properties, which is what we want +exports.credentials = mixin({ + /** + * Create a gRPC credential from a Google credential object. + * @param googleCredentials The authentication client to use. + * @return The resulting CallCredentials object. + */ + createFromGoogleCredential: (googleCredentials) => { + return call_credentials_1.CallCredentials.createFromMetadataGenerator((options, callback) => { + // google-auth-library pre-v2.0.0 does not have getRequestHeaders + // but has getRequestMetadata, which is deprecated in v2.0.0 + let getHeaders; + if (typeof googleCredentials.getRequestHeaders === 'function') { + 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(); + metadata.add('authorization', headers.Authorization); + callback(null, metadata); + }, err => { + callback(err); + }); + }); + }, + /** + * 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); + } +}, channel_credentials_1.ChannelCredentials, call_credentials_1.CallCredentials); +/** + * Close a Client object. + * @param client The client to close. + */ +exports.closeClient = (client) => client.close(); +exports.waitForClientReady = (client, deadline, callback) => client.waitForReady(deadline, callback); +/**** Unimplemented function stubs ****/ +/* tslint:disable:no-any variable-name */ +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.Server = (options) => { + throw new Error('Not yet implemented'); +}; +exports.ServerCredentials = { + createSsl: (rootCerts, keyCertPairs, checkClientCertificate) => { + throw new Error('Not yet implemented'); + }, + createInsecure: () => { + throw new Error('Not yet implemented'); + } +}; +exports.getClientChannel = (client) => { + return client_1.Client.prototype.getChannel.call(client); +}; +exports.ListenerBuilder = () => { + throw new Error('Not yet implemented'); +}; +exports.InterceptorBuilder = () => { + throw new Error('Not yet implemented'); +}; +exports.InterceptingCall = () => { + throw new Error('Not yet implemented'); +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/logging.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/logging.d.ts new file mode 100644 index 0000000..e85362f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/logging.d.ts @@ -0,0 +1,6 @@ +/// +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; diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/logging.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/logging.js new file mode 100644 index 0000000..a918fa6 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/logging.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const constants_1 = require("./constants"); +let _logger = console; +let _logVerbosity = constants_1.LogVerbosity.DEBUG; +exports.getLogger = () => { + return _logger; +}; +exports.setLogger = (logger) => { + _logger = logger; +}; +exports.setLoggerVerbosity = (verbosity) => { + _logVerbosity = verbosity; +}; +// tslint:disable-next-line no-any +exports.log = (severity, ...args) => { + if (severity >= _logVerbosity && typeof _logger.error === 'function') { + _logger.error(...args); + } +}; +//# sourceMappingURL=logging.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/make-client.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/make-client.d.ts new file mode 100644 index 0000000..e299d27 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/make-client.d.ts @@ -0,0 +1,62 @@ +/// +import { ChannelCredentials } from './channel-credentials'; +import { ChannelOptions } from './channel-options'; +import { Client } from './client'; +export interface Serialize { + (value: T): Buffer; +} +export interface Deserialize { + (bytes: Buffer): T; +} +export interface MethodDefinition { + path: string; + requestStream: boolean; + responseStream: boolean; + requestSerialize: Serialize; + responseSerialize: Serialize; + requestDeserialize: Deserialize; + responseDeserialize: Deserialize; + originalName?: string; +} +export interface ServiceDefinition { + [index: string]: 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 declare type 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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/make-client.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/make-client.js new file mode 100644 index 0000000..5336e95 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/make-client.js @@ -0,0 +1,112 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +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) => { + 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) { + ServiceClientImpl.prototype[attrs.originalName] = + ServiceClientImpl.prototype[name]; + } + }); + ServiceClientImpl.service = methods; + return ServiceClientImpl; +} +exports.makeClientConstructor = makeClientConstructor; +function partial(fn, path, serialize, deserialize) { + // tslint:disable-next-line:no-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 (packageDef.hasOwnProperty(serviceFqn)) { + const service = packageDef[serviceFqn]; + const nameComponents = serviceFqn.split('.'); + 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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata-status-filter.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata-status-filter.d.ts new file mode 100644 index 0000000..de4d94c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata-status-filter.d.ts @@ -0,0 +1,12 @@ +import { Call } from './call-stream'; +import { StatusObject } from './call-stream'; +import { Channel } from './channel'; +import { BaseFilter, Filter, FilterFactory } from './filter'; +export declare class MetadataStatusFilter extends BaseFilter implements Filter { + receiveTrailers(status: Promise): Promise; +} +export declare class MetadataStatusFilterFactory implements FilterFactory { + private readonly channel; + constructor(channel: Channel); + createFilter(callStream: Call): MetadataStatusFilter; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata-status-filter.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata-status-filter.js new file mode 100644 index 0000000..d1906d5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata-status-filter.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const constants_1 = require("./constants"); +const filter_1 = require("./filter"); +class MetadataStatusFilter extends filter_1.BaseFilter { + async receiveTrailers(status) { + // tslint:disable-next-line:prefer-const + let { code, details, metadata } = await status; + if (code !== constants_1.Status.UNKNOWN) { + // we already have a known status, so don't assign a new one. + return { code, details, metadata }; + } + const metadataMap = metadata.getMap(); + if (typeof metadataMap['grpc-status'] === 'string') { + const receivedCode = Number(metadataMap['grpc-status']); + if (receivedCode in constants_1.Status) { + code = receivedCode; + } + metadata.remove('grpc-status'); + } + if (typeof metadataMap['grpc-message'] === 'string') { + details = decodeURI(metadataMap['grpc-message']); + metadata.remove('grpc-message'); + } + return { code, details, metadata }; + } +} +exports.MetadataStatusFilter = MetadataStatusFilter; +class MetadataStatusFilterFactory { + constructor(channel) { + this.channel = channel; + } + createFilter(callStream) { + return new MetadataStatusFilter(); + } +} +exports.MetadataStatusFilterFactory = MetadataStatusFilterFactory; +//# sourceMappingURL=metadata-status-filter.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata.d.ts new file mode 100644 index 0000000..120691b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata.d.ts @@ -0,0 +1,69 @@ +/// +import * as http2 from 'http2'; +export declare type MetadataValue = string | Buffer; +export declare type MetadataObject = Map; +/** + * A class for storing metadata. Keys are normalized to lowercase ASCII. + */ +export declare class Metadata { + protected internalRepr: MetadataObject; + /** + * 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; + /** + * 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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata.js new file mode 100644 index 0000000..482398a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/metadata.js @@ -0,0 +1,206 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +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 normalizeKey(key) { + return key.toLowerCase(); +} +function validate(key, value) { + if (!isLegalKey(key)) { + throw new Error('Metadata key "' + key + '" contains illegal characters'); + } + if (value != null) { + 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() { + this.internalRepr = new Map(); + } + /** + * 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(); + 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); + }); + } + /** + * 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]; + if (isBinaryKey(key)) { + if (Array.isArray(values)) { + values.forEach((value) => { + result.add(key, Buffer.from(value, 'base64')); + }); + } + else if (values !== undefined) { + values.split(',').forEach(v => { + result.add(key, Buffer.from(v.trim(), 'base64')); + }); + } + } + else { + if (Array.isArray(values)) { + values.forEach((value) => { + result.add(key, value); + }); + } + else if (values !== undefined) { + values.split(',').forEach(v => result.add(key, v.trim())); + } + } + }); + return result; + } +} +exports.Metadata = Metadata; +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/object-stream.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/object-stream.d.ts new file mode 100644 index 0000000..d8dfe9e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/object-stream.d.ts @@ -0,0 +1,37 @@ +/// +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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/object-stream.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/object-stream.js new file mode 100644 index 0000000..f8eb9ef --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/object-stream.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=object-stream.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/status-builder.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/status-builder.d.ts new file mode 100644 index 0000000..e8fbcec --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/status-builder.d.ts @@ -0,0 +1,28 @@ +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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/status-builder.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/status-builder.js new file mode 100644 index 0000000..22909a8 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/status-builder.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * 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/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/subchannel.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/subchannel.d.ts new file mode 100644 index 0000000..7b96269 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/subchannel.d.ts @@ -0,0 +1,33 @@ +/// +import { EventEmitter } from 'events'; +import * as http2 from 'http2'; +import * as url from 'url'; +import { Call, Http2CallStream } from './call-stream'; +import { ChannelOptions } from './channel-options'; +import { Metadata } from './metadata'; +export interface SubChannel extends EventEmitter { + /** + * Attach a call stream to this subchannel's connection to start it + * @param headers The headers to start the stream with + * @param callStream The stream to start + */ + startCallStream(metadata: Metadata, callStream: Call): void; + close(): void; +} +export declare class Http2SubChannel extends EventEmitter implements SubChannel { + private session; + private refCount; + private userAgent; + private keepaliveTimeMs; + private keepaliveTimeoutMs; + private keepaliveIntervalId; + private keepaliveTimeoutId; + constructor(target: url.URL, connectionOptions: http2.SecureClientSessionOptions, userAgent: string, channelArgs: Partial); + private ref; + private unref; + private sendPing; + private startKeepalivePings; + private stopKeepalivePings; + startCallStream(metadata: Metadata, callStream: Http2CallStream): void; + close(): void; +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/subchannel.js b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/subchannel.js new file mode 100644 index 0000000..f15e8a4 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/build/src/subchannel.js @@ -0,0 +1,97 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events_1 = require("events"); +const http2 = require("http2"); +const { HTTP2_HEADER_AUTHORITY, HTTP2_HEADER_CONTENT_TYPE, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_TE, HTTP2_HEADER_USER_AGENT } = http2.constants; +/* 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_TIME_MS = ~(1 << 31); +const KEEPALIVE_TIMEOUT_MS = 20000; +class Http2SubChannel extends events_1.EventEmitter { + constructor(target, connectionOptions, userAgent, channelArgs) { + super(); + this.refCount = 0; + this.keepaliveTimeMs = KEEPALIVE_TIME_MS; + this.keepaliveTimeoutMs = KEEPALIVE_TIMEOUT_MS; + this.session = http2.connect(target, connectionOptions); + this.session.unref(); + this.session.on('connect', () => { + this.emit('connect'); + }); + this.session.on('close', () => { + this.stopKeepalivePings(); + this.emit('close'); + }); + this.session.on('error', () => { + this.stopKeepalivePings(); + this.emit('close'); + }); + this.userAgent = userAgent; + if (channelArgs['grpc.keepalive_time_ms']) { + this.keepaliveTimeMs = channelArgs['grpc.keepalive_time_ms']; + } + if (channelArgs['grpc.keepalive_timeout_ms']) { + this.keepaliveTimeoutMs = channelArgs['grpc.keepalive_timeout_ms']; + } + this.keepaliveIntervalId = setTimeout(() => { }, 0); + clearTimeout(this.keepaliveIntervalId); + this.keepaliveTimeoutId = setTimeout(() => { }, 0); + clearTimeout(this.keepaliveTimeoutId); + } + ref() { + if (this.refCount === 0) { + this.session.ref(); + this.startKeepalivePings(); + } + this.refCount += 1; + } + unref() { + this.refCount -= 1; + if (this.refCount === 0) { + this.session.unref(); + this.stopKeepalivePings(); + } + } + sendPing() { + this.keepaliveTimeoutId = setTimeout(() => { + this.emit('close'); + }, this.keepaliveTimeoutMs); + this.session.ping((err, duration, payload) => { + clearTimeout(this.keepaliveTimeoutId); + }); + } + /* TODO(murgatroid99): refactor subchannels so that keepalives can be handled + * per subchannel */ + startKeepalivePings() { + this.keepaliveIntervalId = setInterval(() => { + this.sendPing(); + }, this.keepaliveTimeMs); + this.sendPing(); + } + stopKeepalivePings() { + clearInterval(this.keepaliveIntervalId); + clearTimeout(this.keepaliveTimeoutId); + } + // Prerequisite: this subchannel is connected + startCallStream(metadata, callStream) { + 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'; + const http2Stream = this.session.request(headers); + this.ref(); + http2Stream.on('close', () => { + this.unref(); + }); + callStream.attachHttp2Stream(http2Stream); + } + close() { + this.session.close(); + } +} +exports.Http2SubChannel = Http2SubChannel; +//# sourceMappingURL=subchannel.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/package.json b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/package.json new file mode 100644 index 0000000..a343fd6 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/grpc-js/package.json @@ -0,0 +1,131 @@ +{ + "_args": [ + [ + { + "raw": "@grpc/grpc-js@^0.3.0", + "scope": "@grpc", + "escapedName": "@grpc%2fgrpc-js", + "name": "@grpc/grpc-js", + "rawSpec": "^0.3.0", + "spec": ">=0.3.0 <0.4.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/google-gax" + ] + ], + "_from": "@grpc/grpc-js@>=0.3.0 <0.4.0", + "_hasShrinkwrap": false, + "_id": "@grpc/grpc-js@0.3.6", + "_inCache": true, + "_location": "/@grpc/grpc-js", + "_nodeVersion": "8.12.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/grpc-js_0.3.6_1552069270433_0.09785338326415816" + }, + "_npmUser": { + "name": "murgatroid99", + "email": "mlumish@google.com" + }, + "_npmVersion": "6.4.1", + "_phantomChildren": {}, + "_requested": { + "raw": "@grpc/grpc-js@^0.3.0", + "scope": "@grpc", + "escapedName": "@grpc%2fgrpc-js", + "name": "@grpc/grpc-js", + "rawSpec": "^0.3.0", + "spec": ">=0.3.0 <0.4.0", + "type": "range" + }, + "_requiredBy": [ + "/google-gax" + ], + "_resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-0.3.6.tgz", + "_shasum": "d9b52043907170d38e06711d9477fde29ab46fa8", + "_shrinkwrap": null, + "_spec": "@grpc/grpc-js@^0.3.0", + "_where": "/var/opt/motion2/node_modules/google-gax", + "author": { + "name": "Google Inc." + }, + "contributors": [ + { + "name": "Google Inc." + } + ], + "dependencies": { + "semver": "^5.5.0" + }, + "description": "gRPC Library for Node - pure JS implementation", + "devDependencies": { + "@types/lodash": "^4.14.108", + "@types/mocha": "^2.2.43", + "@types/node": "^10.5.4", + "clang-format": "^1.0.55", + "gts": "^0.5.1", + "lodash": "^4.17.4", + "typescript": "~3.3.3333" + }, + "directories": {}, + "dist": { + "integrity": "sha512-SmLNuPGlUur64bNS9aHZguqWDVQ8+Df1CGn+xsh7l6T2wiP5ArOMlywZ3TZo6z/rwKtGQgUJY9ZrPYUmHEXd/Q==", + "shasum": "d9b52043907170d38e06711d9477fde29ab46fa8", + "tarball": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-0.3.6.tgz", + "fileCount": 47, + "unpackedSize": 140076, + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcgrKXCRA9TVsSAnZWagAAx6QP/jjt1XYboVWVF/tX+ISJ\nmzO6uvrxwM56k4jaqFUHQoTry+Y8irJ/JrF9YqYRJoFWY8BJMX+TVAkqtSEm\nAmPW9wrNSb6eoITWOsR3tqO6c7Q/Q/A53q6GUD3O6exqIvzjEFRtOd9BNU6t\n1naDL6qBZRiHgOFpofpoFeOCEY451v+iIqtfBPq+prSRgGeYk2x2hdN6CuKd\nhViGgtef2lXjw3/RiuH/ldx8ODhMN4KhUNhWJjwwY3EOneLIM4lzJMqTIeHp\nRkV2d7TMdQpm5LNZNUft/80AC4a7Wm8FeUX6wntCloF1/jwMG22nVpWkbrLo\nC4knCsi0pMKMx8S3PIPSIQP5oDXiCXhl+pyA/kjy+TZhlRmgSawow9Tvxljq\nRoJG/1OcyQXqnkPqtiX5aG6J6GaWPsu9dY4jw4xnLfMurYY2sR581EEHRkuQ\nuNox25wepps4qJgMnR9HbPggKRVGDCbKSuHwmMi1Gfq0uJ9c+y4ju43EuJDu\nmS/3NQbYJthEj2/R4kH3YT5mBLRgSLZOAU8DWAwsi93HMDiiefboKbFuyJKH\nS4SNHMmuh93aV7xxZZOdvTCJniMplAkSPgGziHVbn2POuRheF88czPUamRTl\na+Byf1dEXa5/86LZPMcKWdkp4WMepStkYUlzGVjZqJT4oS1ZQIMVjMZI8xzT\nsHtx\r\n=8dhQ\r\n-----END PGP SIGNATURE-----\r\n" + }, + "engines": { + "node": "^8.11.2 || >=9.4" + }, + "homepage": "https://grpc.io/", + "keywords": [], + "license": "Apache-2.0", + "main": "build/src/index.js", + "maintainers": [ + { + "name": "grpc-packages", + "email": "grpc-packages@google.com" + }, + { + "name": "murgatroid99", + "email": "mlumish@google.com" + }, + { + "name": "nicolasnoble", + "email": "nicolas@nobis-crew.org" + } + ], + "name": "@grpc/grpc-js", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js" + }, + "scripts": { + "build": "npm run compile", + "check": "gts check", + "clean": "gts clean", + "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" + }, + "types": "build/src/index.d.ts", + "version": "0.3.6", + "warnings": [ + { + "code": "ENOTSUP", + "required": { + "node": "^8.11.2 || >=9.4" + }, + "pkgid": "@grpc/grpc-js@0.3.6" + } + ] +} diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/README.md b/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/README.md new file mode 100644 index 0000000..481b862 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/README.md @@ -0,0 +1,53 @@ +# 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/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/build/src/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/build/src/index.d.ts new file mode 100644 index 0000000..943ba1f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/build/src/index.d.ts @@ -0,0 +1,96 @@ +/// +/** + * @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. + * + */ +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 The file path 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, options?: Options): Promise; +export declare function loadSync(filename: string, options?: Options): PackageDefinition; diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/build/src/index.js b/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/build/src/index.js new file mode 100644 index 0000000..8fbed58 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/build/src/index.js @@ -0,0 +1,228 @@ +"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. + * + */ +var Protobuf = require("protobufjs"); +var descriptor = require("protobufjs/ext/descriptor"); +var fs = require("fs"); +var path = require("path"); +var camelCase = require("lodash.camelcase"); +var 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) { + var 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(function (name) { + return getAllHandledReflectionObjects(obj.nested[name], objName); + }).reduce(function (accumulator, currentValue) { return 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) { + var message = cls.fromObject(arg); + return cls.encode(message).finish(); + }; +} +function createMethodDefinition(method, serviceName, options) { + /* This is only ever called after the corresponding root.resolveAll(), so we + * can assume that the resolved request and response types are non-null */ + var requestType = method.resolvedRequestType; + var 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), + responseType: createMessageDefinition(responseType) + }; +} +function createServiceDefinition(service, name, options) { + var def = {}; + for (var _i = 0, _a = service.methodsArray; _i < _a.length; _i++) { + var method = _a[_i]; + def[method.name] = createMethodDefinition(method, name, options); + } + return def; +} +var fileDescriptorCache = new Map(); +function getFileDescriptors(root) { + if (fileDescriptorCache.has(root)) { + return fileDescriptorCache.get(root); + } + else { + var descriptorList = root.toDescriptor('proto3').file; + var bufferList = descriptorList.map(function (value) { return Buffer.from(descriptor.FileDescriptorProto.encode(value).finish()); }); + fileDescriptorCache.set(root, bufferList); + return bufferList; + } +} +function createMessageDefinition(message) { + var messageDescriptor = message.toDescriptor('proto3'); + return { + format: 'Protocol Buffer 3 DescriptorProto', + type: messageDescriptor.$type.toObject(messageDescriptor, descriptorOptions), + fileDescriptorProtos: getFileDescriptors(message.root) + }; +} +function createEnumDefinition(enumType) { + var enumDescriptor = enumType.toDescriptor('proto3'); + return { + format: 'Protocol Buffer 3 EnumDescriptorProto', + type: enumDescriptor.$type.toObject(enumDescriptor, descriptorOptions), + fileDescriptorProtos: getFileDescriptors(enumType.root) + }; +} +/** + * 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) { + if (obj instanceof Protobuf.Service) { + return createServiceDefinition(obj, name, options); + } + else if (obj instanceof Protobuf.Type) { + return createMessageDefinition(obj); + } + else if (obj instanceof Protobuf.Enum) { + return createEnumDefinition(obj); + } + else { + throw new Error('Type mismatch in reflection object handling'); + } +} +function createPackageDefinition(root, options) { + var def = {}; + root.resolveAll(); + for (var _i = 0, _a = getAllHandledReflectionObjects(root, ''); _i < _a.length; _i++) { + var _b = _a[_i], name = _b[0], obj = _b[1]; + def[name] = createDefinition(obj, name, options); + } + return def; +} +function addIncludePathResolver(root, includePaths) { + var originalResolvePath = root.resolvePath; + root.resolvePath = function (origin, target) { + if (path.isAbsolute(target)) { + return target; + } + for (var _i = 0, includePaths_1 = includePaths; _i < includePaths_1.length; _i++) { + var directory = includePaths_1[_i]; + var fullPath = path.join(directory, target); + try { + fs.accessSync(fullPath, fs.constants.R_OK); + return fullPath; + } + catch (err) { + continue; + } + } + return originalResolvePath(origin, target); + }; +} +/** + * Load a .proto file with the specified options. + * @param filename The file path 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) { + var root = new Protobuf.Root(); + options = options || {}; + if (!!options.includeDirs) { + if (!(options.includeDirs instanceof Array)) { + return Promise.reject(new Error('The includeDirs option must be an array')); + } + addIncludePathResolver(root, options.includeDirs); + } + return root.load(filename, options).then(function (loadedRoot) { + loadedRoot.resolveAll(); + return createPackageDefinition(root, options); + }); +} +exports.load = load; +function loadSync(filename, options) { + var root = new Protobuf.Root(); + options = options || {}; + if (!!options.includeDirs) { + if (!(options.includeDirs instanceof Array)) { + throw new Error('The include option must be an array'); + } + addIncludePathResolver(root, options.includeDirs); + } + var loadedRoot = root.loadSync(filename, options); + loadedRoot.resolveAll(); + return createPackageDefinition(root, options); +} +exports.loadSync = loadSync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/package.json b/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/package.json new file mode 100644 index 0000000..8aca934 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@grpc/proto-loader/package.json @@ -0,0 +1,124 @@ +{ + "_args": [ + [ + { + "raw": "@grpc/proto-loader@^0.4.0", + "scope": "@grpc", + "escapedName": "@grpc%2fproto-loader", + "name": "@grpc/proto-loader", + "rawSpec": "^0.4.0", + "spec": ">=0.4.0 <0.5.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/google-gax" + ] + ], + "_from": "@grpc/proto-loader@>=0.4.0 <0.5.0", + "_hasShrinkwrap": false, + "_id": "@grpc/proto-loader@0.4.0", + "_inCache": true, + "_location": "/@grpc/proto-loader", + "_nodeVersion": "8.11.2", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/proto-loader_0.4.0_1547758327418_0.7862900007567022" + }, + "_npmUser": { + "name": "murgatroid99", + "email": "mlumish@google.com" + }, + "_npmVersion": "5.6.0", + "_phantomChildren": {}, + "_requested": { + "raw": "@grpc/proto-loader@^0.4.0", + "scope": "@grpc", + "escapedName": "@grpc%2fproto-loader", + "name": "@grpc/proto-loader", + "rawSpec": "^0.4.0", + "spec": ">=0.4.0 <0.5.0", + "type": "range" + }, + "_requiredBy": [ + "/google-gax" + ], + "_resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.4.0.tgz", + "_shasum": "a823a51eb2fde58369bef1deb5445fd808d70901", + "_shrinkwrap": null, + "_spec": "@grpc/proto-loader@^0.4.0", + "_where": "/var/opt/motion2/node_modules/google-gax", + "author": { + "name": "Google Inc." + }, + "bugs": { + "url": "https://github.com/grpc/grpc-node/issues" + }, + "contributors": [ + { + "name": "Michael Lumish", + "email": "mlumish@google.com" + } + ], + "dependencies": { + "lodash.camelcase": "^4.3.0", + "protobufjs": "^6.8.6" + }, + "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": "^0.5.3", + "typescript": "~2.7.2" + }, + "directories": {}, + "dist": { + "integrity": "sha512-Jm6o+75uWT7E6+lt8edg4J1F/9+BedOjaMgwE14pxS/AO43/0ZqK+rCLVVrXLoExwSAZvgvOD2B0ivy3Spsspw==", + "shasum": "a823a51eb2fde58369bef1deb5445fd808d70901", + "tarball": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.4.0.tgz", + "fileCount": 4, + "unpackedSize": 16380, + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcQOr4CRA9TVsSAnZWagAAYQAP/1BNPBMs2zd48wvTlSnr\nHBPsl0d0ZfrdNYHLQsJ8TQLVq1b4qYAl25DqUoaptEfYhZRIj0wOh1W7TD7L\naPA+DCL2NEmMAUaRdsYL+BcTD5cCZ48AL679YG4ntdLxGTx+rmSO0W0nk8PW\nNzI4IPdfVkXjAsR7CqA79EJUPGW3KUv51Usp1XdOs5ot9uQtPdSF/sct64LD\nY1AG0oWI74mVEP3MbZLkDrUXPeCDGxfdoeRhsk9tbK27rCmb3Fpc1CKGgmVJ\nkIujZOaU9BnDs1qsa8KY3PQdBp2nLLNKaTQE3XVUvxdotOaLahM/NRwF21es\njku0nPQjJSZmVdjXHR24cQXj1COH5e9d78PFH+khECGxjnNUhcydclPp/myn\nJaOPCOPYTYAYO6n6MQljJvcBbQfsjhorkmNy2Ywb1gJjZH+elc7upxUY1QRu\n8VDtLlzh+ctx1TvzrPgNuUuo7CK1lflr7MMHPl0Kh/Hl/GoRvxWoOdMhN+3m\nXbC/9nFljMCGmKff71xh9K3bE1ugXDMNVyrSPCCJRZjLT2CLcqy3TH0Anx0f\nwCKqcEeLPlAUiel2CbL4HVS20DFo4K7wwvjG7u/sGQhDX/rGo4MpJmIVW9WS\nc94HGbzecwEV/fo9WkxHODQndmnIQgk9mu1AULI8nbW/SMz+TXeTNCOfbz/Z\nwe2Y\r\n=dFkd\r\n-----END PGP SIGNATURE-----\r\n" + }, + "engines": { + "node": ">=6" + }, + "homepage": "https://grpc.io/", + "license": "Apache-2.0", + "main": "build/src/index.js", + "maintainers": [ + { + "name": "grpc-packages", + "email": "grpc-packages@google.com" + }, + { + "name": "murgatroid99", + "email": "mlumish@google.com" + }, + { + "name": "nicolasnoble", + "email": "nicolas@nobis-crew.org" + } + ], + "name": "@grpc/proto-loader", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/grpc/grpc-node.git" + }, + "scripts": { + "build": "npm run compile", + "check": "gts check", + "clean": "gts clean", + "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.4.0" +} diff --git a/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/LICENSE b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/LICENSE @@ -0,0 +1,26 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/README.md b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/README.md new file mode 100644 index 0000000..7227096 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/README.md @@ -0,0 +1,13 @@ +@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/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/index.d.ts new file mode 100644 index 0000000..afbd89a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/index.d.ts @@ -0,0 +1,13 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/index.js new file mode 100644 index 0000000..b10f826 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/index.js @@ -0,0 +1,52 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/package.json b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/package.json new file mode 100644 index 0000000..e8f1b6f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/package.json @@ -0,0 +1,93 @@ +{ + "_args": [ + [ + { + "raw": "@protobufjs/aspromise@^1.1.2", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2faspromise", + "name": "@protobufjs/aspromise", + "rawSpec": "^1.1.2", + "spec": ">=1.1.2 <2.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/protobufjs" + ] + ], + "_from": "@protobufjs/aspromise@>=1.1.2 <2.0.0", + "_id": "@protobufjs/aspromise@1.1.2", + "_inCache": true, + "_location": "/@protobufjs/aspromise", + "_nodeVersion": "6.9.1", + "_npmOperationalInternal": { + "host": "packages-18-east.internal.npmjs.com", + "tmp": "tmp/aspromise-1.1.2.tgz_1493030312365_0.014110192423686385" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "4.0.5", + "_phantomChildren": {}, + "_requested": { + "raw": "@protobufjs/aspromise@^1.1.2", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2faspromise", + "name": "@protobufjs/aspromise", + "rawSpec": "^1.1.2", + "spec": ">=1.1.2 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/@protobufjs/fetch", + "/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "_shasum": "9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf", + "_shrinkwrap": null, + "_spec": "@protobufjs/aspromise@^1.1.2", + "_where": "/var/opt/motion2/node_modules/protobufjs", + "author": { + "name": "Daniel Wirtz", + "email": "dcode+protobufjs@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "dependencies": {}, + "description": "Returns a promise from a node-style callback function.", + "devDependencies": { + "istanbul": "^0.4.5", + "tape": "^4.6.3" + }, + "directories": {}, + "dist": { + "shasum": "9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf", + "tarball": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz" + }, + "homepage": "https://github.com/dcodeIO/protobuf.js#readme", + "license": "BSD-3-Clause", + "main": "index.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + { + "name": "protobufjs", + "email": "dcode+protobufjs@dcode.io" + } + ], + "name": "@protobufjs/aspromise", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "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/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/tests/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/tests/index.js new file mode 100644 index 0000000..6d8d24c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/aspromise/tests/index.js @@ -0,0 +1,130 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/LICENSE b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/LICENSE @@ -0,0 +1,26 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/README.md b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/README.md new file mode 100644 index 0000000..0e2eb33 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/README.md @@ -0,0 +1,19 @@ +@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/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/index.d.ts new file mode 100644 index 0000000..16fd7db --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/index.d.ts @@ -0,0 +1,32 @@ +/** + * 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/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/index.js new file mode 100644 index 0000000..26d5443 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/index.js @@ -0,0 +1,139 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/package.json b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/package.json new file mode 100644 index 0000000..22b27e7 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/package.json @@ -0,0 +1,93 @@ +{ + "_args": [ + [ + { + "raw": "@protobufjs/base64@^1.1.2", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2fbase64", + "name": "@protobufjs/base64", + "rawSpec": "^1.1.2", + "spec": ">=1.1.2 <2.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/protobufjs" + ] + ], + "_from": "@protobufjs/base64@>=1.1.2 <2.0.0", + "_id": "@protobufjs/base64@1.1.2", + "_inCache": true, + "_location": "/@protobufjs/base64", + "_nodeVersion": "8.0.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/base64-1.1.2.tgz_1497000720755_0.053681070916354656" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "5.0.1", + "_phantomChildren": {}, + "_requested": { + "raw": "@protobufjs/base64@^1.1.2", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2fbase64", + "name": "@protobufjs/base64", + "rawSpec": "^1.1.2", + "spec": ">=1.1.2 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "_shasum": "4c85730e59b9a1f1f349047dbf24296034bb2735", + "_shrinkwrap": null, + "_spec": "@protobufjs/base64@^1.1.2", + "_where": "/var/opt/motion2/node_modules/protobufjs", + "author": { + "name": "Daniel Wirtz", + "email": "dcode+protobufjs@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "dependencies": {}, + "description": "A minimal base64 implementation for number arrays.", + "devDependencies": { + "istanbul": "^0.4.5", + "tape": "^4.6.3" + }, + "directories": {}, + "dist": { + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "shasum": "4c85730e59b9a1f1f349047dbf24296034bb2735", + "tarball": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz" + }, + "homepage": "https://github.com/dcodeIO/protobuf.js#readme", + "license": "BSD-3-Clause", + "main": "index.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode@dcode.io" + }, + { + "name": "protobufjs", + "email": "dcode+npm-protobufjs@dcode.io" + } + ], + "name": "@protobufjs/base64", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "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/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/tests/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/tests/index.js new file mode 100644 index 0000000..89828f2 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/base64/tests/index.js @@ -0,0 +1,46 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/LICENSE b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/LICENSE @@ -0,0 +1,26 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/README.md b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/README.md new file mode 100644 index 0000000..0169338 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/README.md @@ -0,0 +1,49 @@ +@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/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/index.d.ts new file mode 100644 index 0000000..f7fb921 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/index.d.ts @@ -0,0 +1,31 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/index.js new file mode 100644 index 0000000..de73f80 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/index.js @@ -0,0 +1,99 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/package.json b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/package.json new file mode 100644 index 0000000..dde2069 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/package.json @@ -0,0 +1,86 @@ +{ + "_args": [ + [ + { + "raw": "@protobufjs/codegen@^2.0.4", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2fcodegen", + "name": "@protobufjs/codegen", + "rawSpec": "^2.0.4", + "spec": ">=2.0.4 <3.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/protobufjs" + ] + ], + "_from": "@protobufjs/codegen@>=2.0.4 <3.0.0", + "_id": "@protobufjs/codegen@2.0.4", + "_inCache": true, + "_location": "/@protobufjs/codegen", + "_nodeVersion": "8.0.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/codegen-2.0.4.tgz_1497041777758_0.900342388311401" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "5.0.1", + "_phantomChildren": {}, + "_requested": { + "raw": "@protobufjs/codegen@^2.0.4", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2fcodegen", + "name": "@protobufjs/codegen", + "rawSpec": "^2.0.4", + "spec": ">=2.0.4 <3.0.0", + "type": "range" + }, + "_requiredBy": [ + "/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "_shasum": "7ef37f0d010fb028ad1ad59722e506d9262815cb", + "_shrinkwrap": null, + "_spec": "@protobufjs/codegen@^2.0.4", + "_where": "/var/opt/motion2/node_modules/protobufjs", + "author": { + "name": "Daniel Wirtz", + "email": "dcode+protobufjs@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "dependencies": {}, + "description": "A minimalistic code generation utility.", + "devDependencies": {}, + "directories": {}, + "dist": { + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "shasum": "7ef37f0d010fb028ad1ad59722e506d9262815cb", + "tarball": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz" + }, + "homepage": "https://github.com/dcodeIO/protobuf.js#readme", + "license": "BSD-3-Clause", + "main": "index.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode@dcode.io" + }, + { + "name": "protobufjs", + "email": "dcode+npm-protobufjs@dcode.io" + } + ], + "name": "@protobufjs/codegen", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/dcodeIO/protobuf.js.git" + }, + "types": "index.d.ts", + "version": "2.0.4" +} diff --git a/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/tests/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/tests/index.js new file mode 100644 index 0000000..f3a3db1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/codegen/tests/index.js @@ -0,0 +1,13 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/LICENSE b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/LICENSE @@ -0,0 +1,26 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/README.md b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/README.md new file mode 100644 index 0000000..998d315 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/README.md @@ -0,0 +1,22 @@ +@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/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/index.d.ts new file mode 100644 index 0000000..4615963 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/index.d.ts @@ -0,0 +1,43 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/index.js new file mode 100644 index 0000000..76ce938 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/index.js @@ -0,0 +1,76 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/package.json b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/package.json new file mode 100644 index 0000000..4abce6b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/package.json @@ -0,0 +1,92 @@ +{ + "_args": [ + [ + { + "raw": "@protobufjs/eventemitter@^1.1.0", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2feventemitter", + "name": "@protobufjs/eventemitter", + "rawSpec": "^1.1.0", + "spec": ">=1.1.0 <2.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/protobufjs" + ] + ], + "_from": "@protobufjs/eventemitter@>=1.1.0 <2.0.0", + "_id": "@protobufjs/eventemitter@1.1.0", + "_inCache": true, + "_location": "/@protobufjs/eventemitter", + "_nodeVersion": "6.9.1", + "_npmOperationalInternal": { + "host": "packages-18-east.internal.npmjs.com", + "tmp": "tmp/eventemitter-1.1.0.tgz_1485367943950_0.18555008037947118" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "4.0.5", + "_phantomChildren": {}, + "_requested": { + "raw": "@protobufjs/eventemitter@^1.1.0", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2feventemitter", + "name": "@protobufjs/eventemitter", + "rawSpec": "^1.1.0", + "spec": ">=1.1.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "_shasum": "355cbc98bafad5978f9ed095f397621f1d066b70", + "_shrinkwrap": null, + "_spec": "@protobufjs/eventemitter@^1.1.0", + "_where": "/var/opt/motion2/node_modules/protobufjs", + "author": { + "name": "Daniel Wirtz", + "email": "dcode+protobufjs@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "dependencies": {}, + "description": "A minimal event emitter.", + "devDependencies": { + "istanbul": "^0.4.5", + "tape": "^4.6.3" + }, + "directories": {}, + "dist": { + "shasum": "355cbc98bafad5978f9ed095f397621f1d066b70", + "tarball": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz" + }, + "homepage": "https://github.com/dcodeIO/protobuf.js#readme", + "license": "BSD-3-Clause", + "main": "index.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode@dcode.io" + }, + { + "name": "protobufjs", + "email": "dcode+npm-protobufjs@dcode.io" + } + ], + "name": "@protobufjs/eventemitter", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "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/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/tests/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/tests/index.js new file mode 100644 index 0000000..aeee277 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/eventemitter/tests/index.js @@ -0,0 +1,47 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/LICENSE b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/LICENSE @@ -0,0 +1,26 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/README.md b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/README.md new file mode 100644 index 0000000..11088a0 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/README.md @@ -0,0 +1,13 @@ +@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/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/index.d.ts new file mode 100644 index 0000000..77cf9f3 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/index.d.ts @@ -0,0 +1,56 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/index.js new file mode 100644 index 0000000..f2766f5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/index.js @@ -0,0 +1,115 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/package.json b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/package.json new file mode 100644 index 0000000..5b1214d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/package.json @@ -0,0 +1,95 @@ +{ + "_args": [ + [ + { + "raw": "@protobufjs/fetch@^1.1.0", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2ffetch", + "name": "@protobufjs/fetch", + "rawSpec": "^1.1.0", + "spec": ">=1.1.0 <2.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/protobufjs" + ] + ], + "_from": "@protobufjs/fetch@>=1.1.0 <2.0.0", + "_id": "@protobufjs/fetch@1.1.0", + "_inCache": true, + "_location": "/@protobufjs/fetch", + "_nodeVersion": "6.9.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/fetch-1.1.0.tgz_1485532253082_0.3777743794489652" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "4.0.5", + "_phantomChildren": {}, + "_requested": { + "raw": "@protobufjs/fetch@^1.1.0", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2ffetch", + "name": "@protobufjs/fetch", + "rawSpec": "^1.1.0", + "spec": ">=1.1.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "_shasum": "ba99fb598614af65700c1619ff06d454b0d84c45", + "_shrinkwrap": null, + "_spec": "@protobufjs/fetch@^1.1.0", + "_where": "/var/opt/motion2/node_modules/protobufjs", + "author": { + "name": "Daniel Wirtz", + "email": "dcode+protobufjs@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + }, + "description": "Fetches the contents of a file accross node and browsers.", + "devDependencies": { + "istanbul": "^0.4.5", + "tape": "^4.6.3" + }, + "directories": {}, + "dist": { + "shasum": "ba99fb598614af65700c1619ff06d454b0d84c45", + "tarball": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz" + }, + "homepage": "https://github.com/dcodeIO/protobuf.js#readme", + "license": "BSD-3-Clause", + "main": "index.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + { + "name": "protobufjs", + "email": "dcode+protobufjs@dcode.io" + } + ], + "name": "@protobufjs/fetch", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "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/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/tests/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/tests/index.js new file mode 100644 index 0000000..3cb0dae --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/fetch/tests/index.js @@ -0,0 +1,16 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/LICENSE b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/LICENSE @@ -0,0 +1,26 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/README.md b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/README.md new file mode 100644 index 0000000..8947bae --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/README.md @@ -0,0 +1,102 @@ +@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/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/bench/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/bench/index.js new file mode 100644 index 0000000..1b3c4b8 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/bench/index.js @@ -0,0 +1,87 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/bench/suite.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/bench/suite.js new file mode 100644 index 0000000..3820579 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/bench/suite.js @@ -0,0 +1,46 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/index.d.ts new file mode 100644 index 0000000..ab05de3 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/index.d.ts @@ -0,0 +1,83 @@ +/** + * 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/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/index.js new file mode 100644 index 0000000..706d096 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/index.js @@ -0,0 +1,335 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/package.json b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/package.json new file mode 100644 index 0000000..7ee37d1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/package.json @@ -0,0 +1,96 @@ +{ + "_args": [ + [ + { + "raw": "@protobufjs/float@^1.0.2", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2ffloat", + "name": "@protobufjs/float", + "rawSpec": "^1.0.2", + "spec": ">=1.0.2 <2.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/protobufjs" + ] + ], + "_from": "@protobufjs/float@>=1.0.2 <2.0.0", + "_id": "@protobufjs/float@1.0.2", + "_inCache": true, + "_location": "/@protobufjs/float", + "_nodeVersion": "6.9.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/float-1.0.2.tgz_1491129941022_0.6265034212265164" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "4.0.5", + "_phantomChildren": {}, + "_requested": { + "raw": "@protobufjs/float@^1.0.2", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2ffloat", + "name": "@protobufjs/float", + "rawSpec": "^1.0.2", + "spec": ">=1.0.2 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "_shasum": "5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1", + "_shrinkwrap": null, + "_spec": "@protobufjs/float@^1.0.2", + "_where": "/var/opt/motion2/node_modules/protobufjs", + "author": { + "name": "Daniel Wirtz", + "email": "dcode+protobufjs@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "dependencies": {}, + "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" + }, + "directories": {}, + "dist": { + "shasum": "5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1", + "tarball": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz" + }, + "homepage": "https://github.com/dcodeIO/protobuf.js#readme", + "license": "BSD-3-Clause", + "main": "index.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + { + "name": "protobufjs", + "email": "dcode+protobufjs@dcode.io" + } + ], + "name": "@protobufjs/float", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "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/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/tests/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/tests/index.js new file mode 100644 index 0000000..324e85c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/float/tests/index.js @@ -0,0 +1,100 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/LICENSE b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/LICENSE @@ -0,0 +1,26 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/README.md b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/README.md new file mode 100644 index 0000000..22f9968 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/README.md @@ -0,0 +1,13 @@ +@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/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/index.d.ts new file mode 100644 index 0000000..6f9825b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/index.d.ts @@ -0,0 +1,9 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/index.js new file mode 100644 index 0000000..33778b5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/index.js @@ -0,0 +1,17 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/package.json b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/package.json new file mode 100644 index 0000000..a91b63f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/package.json @@ -0,0 +1,93 @@ +{ + "_args": [ + [ + { + "raw": "@protobufjs/inquire@^1.1.0", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2finquire", + "name": "@protobufjs/inquire", + "rawSpec": "^1.1.0", + "spec": ">=1.1.0 <2.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/protobufjs" + ] + ], + "_from": "@protobufjs/inquire@>=1.1.0 <2.0.0", + "_id": "@protobufjs/inquire@1.1.0", + "_inCache": true, + "_location": "/@protobufjs/inquire", + "_nodeVersion": "6.9.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/inquire-1.1.0.tgz_1485367981156_0.06349746254272759" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "4.0.5", + "_phantomChildren": {}, + "_requested": { + "raw": "@protobufjs/inquire@^1.1.0", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2finquire", + "name": "@protobufjs/inquire", + "rawSpec": "^1.1.0", + "spec": ">=1.1.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/@protobufjs/fetch", + "/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "_shasum": "ff200e3e7cf2429e2dcafc1140828e8cc638f089", + "_shrinkwrap": null, + "_spec": "@protobufjs/inquire@^1.1.0", + "_where": "/var/opt/motion2/node_modules/protobufjs", + "author": { + "name": "Daniel Wirtz", + "email": "dcode+protobufjs@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "dependencies": {}, + "description": "Requires a module only if available and hides the require call from bundlers.", + "devDependencies": { + "istanbul": "^0.4.5", + "tape": "^4.6.3" + }, + "directories": {}, + "dist": { + "shasum": "ff200e3e7cf2429e2dcafc1140828e8cc638f089", + "tarball": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz" + }, + "homepage": "https://github.com/dcodeIO/protobuf.js#readme", + "license": "BSD-3-Clause", + "main": "index.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + { + "name": "protobufjs", + "email": "dcode+protobufjs@dcode.io" + } + ], + "name": "@protobufjs/inquire", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "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/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/array.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/array.js new file mode 100644 index 0000000..96627c3 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/array.js @@ -0,0 +1 @@ +module.exports = [1]; diff --git a/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/emptyArray.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/emptyArray.js new file mode 100644 index 0000000..0630c8f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/emptyArray.js @@ -0,0 +1 @@ +module.exports = []; diff --git a/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/emptyObject.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/emptyObject.js new file mode 100644 index 0000000..0369aa4 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/emptyObject.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/object.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/object.js new file mode 100644 index 0000000..3226d44 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/data/object.js @@ -0,0 +1 @@ +module.exports = { a: 1 }; diff --git a/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/index.js new file mode 100644 index 0000000..7d6496f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/inquire/tests/index.js @@ -0,0 +1,20 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/LICENSE b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/LICENSE @@ -0,0 +1,26 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/README.md b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/README.md new file mode 100644 index 0000000..0e8e6bc --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/README.md @@ -0,0 +1,19 @@ +@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/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/index.d.ts new file mode 100644 index 0000000..567c3dc --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/index.d.ts @@ -0,0 +1,22 @@ +/** + * 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/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/index.js new file mode 100644 index 0000000..1ea7b17 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/index.js @@ -0,0 +1,65 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/package.json b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/package.json new file mode 100644 index 0000000..a699e67 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/package.json @@ -0,0 +1,92 @@ +{ + "_args": [ + [ + { + "raw": "@protobufjs/path@^1.1.2", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2fpath", + "name": "@protobufjs/path", + "rawSpec": "^1.1.2", + "spec": ">=1.1.2 <2.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/protobufjs" + ] + ], + "_from": "@protobufjs/path@>=1.1.2 <2.0.0", + "_id": "@protobufjs/path@1.1.2", + "_inCache": true, + "_location": "/@protobufjs/path", + "_nodeVersion": "6.9.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/path-1.1.2.tgz_1487868856921_0.727851988747716" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "4.0.5", + "_phantomChildren": {}, + "_requested": { + "raw": "@protobufjs/path@^1.1.2", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2fpath", + "name": "@protobufjs/path", + "rawSpec": "^1.1.2", + "spec": ">=1.1.2 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "_shasum": "6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d", + "_shrinkwrap": null, + "_spec": "@protobufjs/path@^1.1.2", + "_where": "/var/opt/motion2/node_modules/protobufjs", + "author": { + "name": "Daniel Wirtz", + "email": "dcode+protobufjs@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "dependencies": {}, + "description": "A minimal path module to resolve Unix, Windows and URL paths alike.", + "devDependencies": { + "istanbul": "^0.4.5", + "tape": "^4.6.3" + }, + "directories": {}, + "dist": { + "shasum": "6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d", + "tarball": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz" + }, + "homepage": "https://github.com/dcodeIO/protobuf.js#readme", + "license": "BSD-3-Clause", + "main": "index.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + { + "name": "protobufjs", + "email": "dcode+protobufjs@dcode.io" + } + ], + "name": "@protobufjs/path", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "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/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/tests/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/tests/index.js new file mode 100644 index 0000000..927736e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/path/tests/index.js @@ -0,0 +1,60 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/LICENSE b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/LICENSE @@ -0,0 +1,26 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/README.md b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/README.md new file mode 100644 index 0000000..3955ae0 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/README.md @@ -0,0 +1,13 @@ +@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/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/index.d.ts new file mode 100644 index 0000000..465559c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/index.d.ts @@ -0,0 +1,32 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/index.js new file mode 100644 index 0000000..9556f5a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/index.js @@ -0,0 +1,48 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/package.json b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/package.json new file mode 100644 index 0000000..119d282 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/package.json @@ -0,0 +1,92 @@ +{ + "_args": [ + [ + { + "raw": "@protobufjs/pool@^1.1.0", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2fpool", + "name": "@protobufjs/pool", + "rawSpec": "^1.1.0", + "spec": ">=1.1.0 <2.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/protobufjs" + ] + ], + "_from": "@protobufjs/pool@>=1.1.0 <2.0.0", + "_id": "@protobufjs/pool@1.1.0", + "_inCache": true, + "_location": "/@protobufjs/pool", + "_nodeVersion": "6.9.1", + "_npmOperationalInternal": { + "host": "packages-18-east.internal.npmjs.com", + "tmp": "tmp/pool-1.1.0.tgz_1485367998862_0.3938121625687927" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "4.0.5", + "_phantomChildren": {}, + "_requested": { + "raw": "@protobufjs/pool@^1.1.0", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2fpool", + "name": "@protobufjs/pool", + "rawSpec": "^1.1.0", + "spec": ">=1.1.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "_shasum": "09fd15f2d6d3abfa9b65bc366506d6ad7846ff54", + "_shrinkwrap": null, + "_spec": "@protobufjs/pool@^1.1.0", + "_where": "/var/opt/motion2/node_modules/protobufjs", + "author": { + "name": "Daniel Wirtz", + "email": "dcode+protobufjs@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "dependencies": {}, + "description": "A general purpose buffer pool.", + "devDependencies": { + "istanbul": "^0.4.5", + "tape": "^4.6.3" + }, + "directories": {}, + "dist": { + "shasum": "09fd15f2d6d3abfa9b65bc366506d6ad7846ff54", + "tarball": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz" + }, + "homepage": "https://github.com/dcodeIO/protobuf.js#readme", + "license": "BSD-3-Clause", + "main": "index.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode@dcode.io" + }, + { + "name": "protobufjs", + "email": "dcode+npm-protobufjs@dcode.io" + } + ], + "name": "@protobufjs/pool", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "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/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/tests/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/tests/index.js new file mode 100644 index 0000000..dc488b8 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/pool/tests/index.js @@ -0,0 +1,33 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/LICENSE b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/LICENSE @@ -0,0 +1,26 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/README.md b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/README.md new file mode 100644 index 0000000..3696289 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/README.md @@ -0,0 +1,20 @@ +@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/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/index.d.ts b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/index.d.ts new file mode 100644 index 0000000..010888c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/index.d.ts @@ -0,0 +1,24 @@ +/** + * 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/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/index.js new file mode 100644 index 0000000..e4ff8df --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/index.js @@ -0,0 +1,105 @@ +"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/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/package.json b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/package.json new file mode 100644 index 0000000..916a7c6 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/package.json @@ -0,0 +1,92 @@ +{ + "_args": [ + [ + { + "raw": "@protobufjs/utf8@^1.1.0", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2futf8", + "name": "@protobufjs/utf8", + "rawSpec": "^1.1.0", + "spec": ">=1.1.0 <2.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/protobufjs" + ] + ], + "_from": "@protobufjs/utf8@>=1.1.0 <2.0.0", + "_id": "@protobufjs/utf8@1.1.0", + "_inCache": true, + "_location": "/@protobufjs/utf8", + "_nodeVersion": "6.9.1", + "_npmOperationalInternal": { + "host": "packages-18-east.internal.npmjs.com", + "tmp": "tmp/utf8-1.1.0.tgz_1485368134514_0.7150300552602857" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "4.0.5", + "_phantomChildren": {}, + "_requested": { + "raw": "@protobufjs/utf8@^1.1.0", + "scope": "@protobufjs", + "escapedName": "@protobufjs%2futf8", + "name": "@protobufjs/utf8", + "rawSpec": "^1.1.0", + "spec": ">=1.1.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "_shasum": "a777360b5b39a1a2e5106f8e858f2fd2d060c570", + "_shrinkwrap": null, + "_spec": "@protobufjs/utf8@^1.1.0", + "_where": "/var/opt/motion2/node_modules/protobufjs", + "author": { + "name": "Daniel Wirtz", + "email": "dcode+protobufjs@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "dependencies": {}, + "description": "A minimal UTF8 implementation for number arrays.", + "devDependencies": { + "istanbul": "^0.4.5", + "tape": "^4.6.3" + }, + "directories": {}, + "dist": { + "shasum": "a777360b5b39a1a2e5106f8e858f2fd2d060c570", + "tarball": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz" + }, + "homepage": "https://github.com/dcodeIO/protobuf.js#readme", + "license": "BSD-3-Clause", + "main": "index.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode@dcode.io" + }, + { + "name": "protobufjs", + "email": "dcode+npm-protobufjs@dcode.io" + } + ], + "name": "@protobufjs/utf8", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "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/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/tests/data/utf8.txt b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/tests/data/utf8.txt new file mode 100644 index 0000000..580b4c4 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/tests/data/utf8.txt @@ -0,0 +1,216 @@ +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/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/tests/index.js b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/tests/index.js new file mode 100644 index 0000000..222cd8a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@protobufjs/utf8/tests/index.js @@ -0,0 +1,57 @@ +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/legacy-libs/grpc-cloned/node_modules/@types/babel-types/LICENSE b/legacy-libs/grpc-cloned/node_modules/@types/babel-types/LICENSE new file mode 100644 index 0000000..2107107 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@types/babel-types/LICENSE @@ -0,0 +1,21 @@ + 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/legacy-libs/grpc-cloned/node_modules/@types/babel-types/README.md b/legacy-libs/grpc-cloned/node_modules/@types/babel-types/README.md new file mode 100644 index 0000000..1aea8bc --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/@types/babel-types/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/babel-types` + +# Summary +This package contains type definitions for babel-types (https://github.com/babel/babel/tree/master/packages/babel-types). + +# Details +Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-types + +Additional Details + * Last updated: Mon, 26 Feb 2018 19:08:08 GMT + * Dependencies: none + * Global values: none + +# Credits +These definitions were written by Troy Gerwien , Sam Baxter , Marvin Hagemeister , Boris Cherny . diff --git a/legacy-libs/grpc-cloned/node_modules/camelcase/index.js b/legacy-libs/grpc-cloned/node_modules/camelcase/index.js new file mode 100644 index 0000000..929facb --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/camelcase/index.js @@ -0,0 +1,56 @@ +'use strict'; + +function preserveCamelCase(str) { + var isLastCharLower = false; + + for (var i = 0; i < str.length; i++) { + var c = str.charAt(i); + + if (isLastCharLower && (/[a-zA-Z]/).test(c) && c.toUpperCase() === c) { + str = str.substr(0, i) + '-' + str.substr(i); + isLastCharLower = false; + i++; + } else { + isLastCharLower = (c.toLowerCase() === c); + } + } + + return str; +} + +module.exports = function () { + var str = [].map.call(arguments, function (str) { + return str.trim(); + }).filter(function (str) { + return str.length; + }).join('-'); + + if (!str.length) { + return ''; + } + + if (str.length === 1) { + return str; + } + + if (!(/[_.\- ]+/).test(str)) { + if (str === str.toUpperCase()) { + return str.toLowerCase(); + } + + if (str[0] !== str[0].toLowerCase()) { + return str[0].toLowerCase() + str.slice(1); + } + + return str; + } + + str = preserveCamelCase(str); + + return str + .replace(/^[_.\- ]+/, '') + .toLowerCase() + .replace(/[_.\- ]+(\w|$)/g, function (m, p1) { + return p1.toUpperCase(); + }); +}; diff --git a/legacy-libs/grpc-cloned/node_modules/camelcase/license b/legacy-libs/grpc-cloned/node_modules/camelcase/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/camelcase/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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/legacy-libs/grpc-cloned/node_modules/camelcase/package.json b/legacy-libs/grpc-cloned/node_modules/camelcase/package.json new file mode 100644 index 0000000..2558bd6 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/camelcase/package.json @@ -0,0 +1,107 @@ +{ + "_args": [ + [ + { + "raw": "camelcase@^2.0.1", + "scope": null, + "escapedName": "camelcase", + "name": "camelcase", + "rawSpec": "^2.0.1", + "spec": ">=2.0.1 <3.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/grpc/node_modules/yargs" + ] + ], + "_from": "camelcase@>=2.0.1 <3.0.0", + "_id": "camelcase@2.1.1", + "_inCache": true, + "_location": "/grpc/camelcase", + "_nodeVersion": "4.3.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/camelcase-2.1.1.tgz_1457803836074_0.4515206723008305" + }, + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "_npmVersion": "2.14.12", + "_phantomChildren": {}, + "_requested": { + "raw": "camelcase@^2.0.1", + "scope": null, + "escapedName": "camelcase", + "name": "camelcase", + "rawSpec": "^2.0.1", + "spec": ">=2.0.1 <3.0.0", + "type": "range" + }, + "_requiredBy": [ + "/grpc/yargs" + ], + "_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "_shasum": "7c1d16d679a1bbe59ca02cacecfb011e201f5a1f", + "_shrinkwrap": null, + "_spec": "camelcase@^2.0.1", + "_where": "/var/opt/motion2/node_modules/grpc/node_modules/yargs", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/camelcase/issues" + }, + "dependencies": {}, + "description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "directories": {}, + "dist": { + "shasum": "7c1d16d679a1bbe59ca02cacecfb011e201f5a1f", + "tarball": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "gitHead": "35c9c8abce5b9cc9defe534ab25823dc6383180f", + "homepage": "https://github.com/sindresorhus/camelcase", + "keywords": [ + "camelcase", + "camel-case", + "camel", + "case", + "dash", + "hyphen", + "dot", + "underscore", + "separator", + "string", + "text", + "convert" + ], + "license": "MIT", + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "name": "camelcase", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/camelcase.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.1.1" +} diff --git a/legacy-libs/grpc-cloned/node_modules/camelcase/readme.md b/legacy-libs/grpc-cloned/node_modules/camelcase/readme.md new file mode 100644 index 0000000..080b2a1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/camelcase/readme.md @@ -0,0 +1,57 @@ +# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase) + +> Convert a dash/dot/underscore/space separated string to camelCase: `foo-bar` → `fooBar` + + +## Install + +``` +$ npm install --save camelcase +``` + + +## Usage + +```js +const camelCase = require('camelcase'); + +camelCase('foo-bar'); +//=> 'fooBar' + +camelCase('foo_bar'); +//=> 'fooBar' + +camelCase('Foo-Bar'); +//=> 'fooBar' + +camelCase('--foo.bar'); +//=> 'fooBar' + +camelCase('__foo__bar__'); +//=> 'fooBar' + +camelCase('foo bar'); +//=> 'fooBar' + +console.log(process.argv[3]); +//=> '--foo-bar' +camelCase(process.argv[3]); +//=> 'fooBar' + +camelCase('foo', 'bar'); +//=> 'fooBar' + +camelCase('__foo__', '--bar'); +//=> 'fooBar' +``` + + +## Related + +- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module +- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/legacy-libs/grpc-cloned/node_modules/cliui/CHANGELOG.md b/legacy-libs/grpc-cloned/node_modules/cliui/CHANGELOG.md new file mode 100644 index 0000000..ef6a35e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/cliui/CHANGELOG.md @@ -0,0 +1,15 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + + +# [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11) + + +### Bug Fixes + +* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33)) + +### Features + +* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32)) diff --git a/legacy-libs/grpc-cloned/node_modules/cliui/LICENSE.txt b/legacy-libs/grpc-cloned/node_modules/cliui/LICENSE.txt new file mode 100644 index 0000000..c7e2747 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/cliui/LICENSE.txt @@ -0,0 +1,14 @@ +Copyright (c) 2015, 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/legacy-libs/grpc-cloned/node_modules/cliui/README.md b/legacy-libs/grpc-cloned/node_modules/cliui/README.md new file mode 100644 index 0000000..028392c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/cliui/README.md @@ -0,0 +1,110 @@ +# cliui + +[![Build Status](https://travis-ci.org/yargs/cliui.svg)](https://travis-ci.org/yargs/cliui) +[![Coverage Status](https://coveralls.io/repos/yargs/cliui/badge.svg?branch=)](https://coveralls.io/r/yargs/cliui?branch=) +[![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui) +[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) + +easily create complex multi-column command-line-interfaces. + +## Example + +```js +var ui = require('cliui')({ + width: 80 +}) + +ui.div('Usage: $0 [command] [options]') + +ui.div({ + text: 'Options:', + padding: [2, 0, 2, 0] +}) + +ui.div( + { + text: "-f, --file", + width: 20, + padding: [0, 4, 0, 4] + }, + { + text: "the file to load." + + chalk.green("(if this description is long it wraps).") + , + width: 20 + }, + { + text: chalk.red("[required]"), + align: 'right' + } +) + +console.log(ui.toString()) +``` + + + +## Layout DSL + +cliui exposes a simple layout DSL: + +If you create a single `ui.row`, passing a string rather than an +object: + +* `\n`: characters will be interpreted as new rows. +* `\t`: characters will be interpreted as new columns. +* `\s`: characters will be interpreted as padding. + +**as an example...** + +```js +var ui = require('./')({ + width: 60 +}) + +ui.div( + 'Usage: node ./bin/foo.js\n' + + ' \t provide a regex\n' + + ' \t provide a glob\t [required]' +) + +console.log(ui.toString()) +``` + +**will output:** + +```shell +Usage: node ./bin/foo.js + provide a regex + provide a glob [required] +``` + +## Methods + +```js +cliui = require('cliui') +``` + +### cliui({width: integer}) + +Specify the maximum width of the UI being generated. + +### cliui({wrap: boolean}) + +Enable or disable the wrapping of text in a column. + +### cliui.div(column, column, column) + +Create a row with any number of columns, a column +can either be a string, or an object with the following +options: + +* **width:** the width of a column. +* **align:** alignment, `right` or `center`. +* **padding:** `[top, right, bottom, left]`. +* **border:** should a border be placed around the div? + +### cliui.span(column, column, column) + +Similar to `div`, except the next row will be appended without +a new line being created. diff --git a/legacy-libs/grpc-cloned/node_modules/cliui/index.js b/legacy-libs/grpc-cloned/node_modules/cliui/index.js new file mode 100644 index 0000000..e501e78 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/cliui/index.js @@ -0,0 +1,316 @@ +var stringWidth = require('string-width') +var stripAnsi = require('strip-ansi') +var wrap = require('wrap-ansi') +var align = { + right: alignRight, + center: alignCenter +} +var top = 0 +var right = 1 +var bottom = 2 +var left = 3 + +function UI (opts) { + this.width = opts.width + this.wrap = opts.wrap + this.rows = [] +} + +UI.prototype.span = function () { + var cols = this.div.apply(this, arguments) + cols.span = true +} + +UI.prototype.div = function () { + if (arguments.length === 0) this.div('') + if (this.wrap && this._shouldApplyLayoutDSL.apply(this, arguments)) { + return this._applyLayoutDSL(arguments[0]) + } + + var cols = [] + + for (var i = 0, arg; (arg = arguments[i]) !== undefined; i++) { + if (typeof arg === 'string') cols.push(this._colFromString(arg)) + else cols.push(arg) + } + + this.rows.push(cols) + return cols +} + +UI.prototype._shouldApplyLayoutDSL = function () { + return arguments.length === 1 && typeof arguments[0] === 'string' && + /[\t\n]/.test(arguments[0]) +} + +UI.prototype._applyLayoutDSL = function (str) { + var _this = this + var rows = str.split('\n') + var leftColumnWidth = 0 + + // simple heuristic for layout, make sure the + // second column lines up along the left-hand. + // don't allow the first column to take up more + // than 50% of the screen. + rows.forEach(function (row) { + var columns = row.split('\t') + if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) { + leftColumnWidth = Math.min( + Math.floor(_this.width * 0.5), + stringWidth(columns[0]) + ) + } + }) + + // generate a table: + // replacing ' ' with padding calculations. + // using the algorithmically generated width. + rows.forEach(function (row) { + var columns = row.split('\t') + _this.div.apply(_this, columns.map(function (r, i) { + return { + text: r.trim(), + padding: _this._measurePadding(r), + width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined + } + })) + }) + + return this.rows[this.rows.length - 1] +} + +UI.prototype._colFromString = function (str) { + return { + text: str, + padding: this._measurePadding(str) + } +} + +UI.prototype._measurePadding = function (str) { + // measure padding without ansi escape codes + var noAnsi = stripAnsi(str) + return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length] +} + +UI.prototype.toString = function () { + var _this = this + var lines = [] + + _this.rows.forEach(function (row, i) { + _this.rowToString(row, lines) + }) + + // don't display any lines with the + // hidden flag set. + lines = lines.filter(function (line) { + return !line.hidden + }) + + return lines.map(function (line) { + return line.text + }).join('\n') +} + +UI.prototype.rowToString = function (row, lines) { + var _this = this + var padding + var rrows = this._rasterize(row) + var str = '' + var ts + var width + var wrapWidth + + rrows.forEach(function (rrow, r) { + str = '' + rrow.forEach(function (col, c) { + ts = '' // temporary string used during alignment/padding. + width = row[c].width // the width with padding. + wrapWidth = _this._negatePadding(row[c]) // the width without padding. + + ts += col + + for (var i = 0; i < wrapWidth - stringWidth(col); i++) { + ts += ' ' + } + + // align the string within its column. + if (row[c].align && row[c].align !== 'left' && _this.wrap) { + ts = align[row[c].align](ts, wrapWidth) + if (stringWidth(ts) < wrapWidth) ts += new Array(width - stringWidth(ts)).join(' ') + } + + // apply border and padding to string. + padding = row[c].padding || [0, 0, 0, 0] + if (padding[left]) str += new Array(padding[left] + 1).join(' ') + str += addBorder(row[c], ts, '| ') + str += ts + str += addBorder(row[c], ts, ' |') + if (padding[right]) str += new Array(padding[right] + 1).join(' ') + + // if prior row is span, try to render the + // current row on the prior line. + if (r === 0 && lines.length > 0) { + str = _this._renderInline(str, lines[lines.length - 1]) + } + }) + + // remove trailing whitespace. + lines.push({ + text: str.replace(/ +$/, ''), + span: row.span + }) + }) + + return lines +} + +function addBorder (col, ts, style) { + if (col.border) { + if (/[.']-+[.']/.test(ts)) return '' + else if (ts.trim().length) return style + else return ' ' + } + return '' +} + +// if the full 'source' can render in +// the target line, do so. +UI.prototype._renderInline = function (source, previousLine) { + var leadingWhitespace = source.match(/^ */)[0].length + var target = previousLine.text + var targetTextWidth = stringWidth(target.trimRight()) + + if (!previousLine.span) return source + + // if we're not applying wrapping logic, + // just always append to the span. + if (!this.wrap) { + previousLine.hidden = true + return target + source + } + + if (leadingWhitespace < targetTextWidth) return source + + previousLine.hidden = true + + return target.trimRight() + new Array(leadingWhitespace - targetTextWidth + 1).join(' ') + source.trimLeft() +} + +UI.prototype._rasterize = function (row) { + var _this = this + var i + var rrow + var rrows = [] + var widths = this._columnWidths(row) + var wrapped + + // word wrap all columns, and create + // a data-structure that is easy to rasterize. + row.forEach(function (col, c) { + // leave room for left and right padding. + col.width = widths[c] + if (_this.wrap) wrapped = wrap(col.text, _this._negatePadding(col), {hard: true}).split('\n') + else wrapped = col.text.split('\n') + + if (col.border) { + wrapped.unshift('.' + new Array(_this._negatePadding(col) + 3).join('-') + '.') + wrapped.push("'" + new Array(_this._negatePadding(col) + 3).join('-') + "'") + } + + // add top and bottom padding. + if (col.padding) { + for (i = 0; i < (col.padding[top] || 0); i++) wrapped.unshift('') + for (i = 0; i < (col.padding[bottom] || 0); i++) wrapped.push('') + } + + wrapped.forEach(function (str, r) { + if (!rrows[r]) rrows.push([]) + + rrow = rrows[r] + + for (var i = 0; i < c; i++) { + if (rrow[i] === undefined) rrow.push('') + } + rrow.push(str) + }) + }) + + return rrows +} + +UI.prototype._negatePadding = function (col) { + var wrapWidth = col.width + if (col.padding) wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0) + if (col.border) wrapWidth -= 4 + return wrapWidth +} + +UI.prototype._columnWidths = function (row) { + var _this = this + var widths = [] + var unset = row.length + var unsetWidth + var remainingWidth = this.width + + // column widths can be set in config. + row.forEach(function (col, i) { + if (col.width) { + unset-- + widths[i] = col.width + remainingWidth -= col.width + } else { + widths[i] = undefined + } + }) + + // any unset widths should be calculated. + if (unset) unsetWidth = Math.floor(remainingWidth / unset) + widths.forEach(function (w, i) { + if (!_this.wrap) widths[i] = row[i].width || stringWidth(row[i].text) + else if (w === undefined) widths[i] = Math.max(unsetWidth, _minWidth(row[i])) + }) + + return widths +} + +// calculates the minimum width of +// a column, based on padding preferences. +function _minWidth (col) { + var padding = col.padding || [] + var minWidth = 1 + (padding[left] || 0) + (padding[right] || 0) + if (col.border) minWidth += 4 + return minWidth +} + +function alignRight (str, width) { + str = str.trim() + var padding = '' + var strWidth = stringWidth(str) + + if (strWidth < width) { + padding = new Array(width - strWidth + 1).join(' ') + } + + return padding + str +} + +function alignCenter (str, width) { + str = str.trim() + var padding = '' + var strWidth = stringWidth(str.trim()) + + if (strWidth < width) { + padding = new Array(parseInt((width - strWidth) / 2, 10) + 1).join(' ') + } + + return padding + str +} + +module.exports = function (opts) { + opts = opts || {} + + return new UI({ + width: (opts || {}).width || 80, + wrap: typeof opts.wrap === 'boolean' ? opts.wrap : true + }) +} diff --git a/legacy-libs/grpc-cloned/node_modules/cliui/package.json b/legacy-libs/grpc-cloned/node_modules/cliui/package.json new file mode 100644 index 0000000..2f6f7dd --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/cliui/package.json @@ -0,0 +1,131 @@ +{ + "_args": [ + [ + { + "raw": "cliui@^3.0.3", + "scope": null, + "escapedName": "cliui", + "name": "cliui", + "rawSpec": "^3.0.3", + "spec": ">=3.0.3 <4.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/grpc/node_modules/yargs" + ] + ], + "_from": "cliui@>=3.0.3 <4.0.0", + "_id": "cliui@3.2.0", + "_inCache": true, + "_location": "/grpc/cliui", + "_nodeVersion": "5.1.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/cliui-3.2.0.tgz_1460342854008_0.8861493801232427" + }, + "_npmUser": { + "name": "bcoe", + "email": "ben@npmjs.com" + }, + "_npmVersion": "3.3.12", + "_phantomChildren": {}, + "_requested": { + "raw": "cliui@^3.0.3", + "scope": null, + "escapedName": "cliui", + "name": "cliui", + "rawSpec": "^3.0.3", + "spec": ">=3.0.3 <4.0.0", + "type": "range" + }, + "_requiredBy": [ + "/grpc/yargs" + ], + "_resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "_shasum": "120601537a916d29940f934da3b48d585a39213d", + "_shrinkwrap": null, + "_spec": "cliui@^3.0.3", + "_where": "/var/opt/motion2/node_modules/grpc/node_modules/yargs", + "author": { + "name": "Ben Coe", + "email": "ben@npmjs.com" + }, + "bugs": { + "url": "https://github.com/yargs/cliui/issues" + }, + "config": { + "blanket": { + "pattern": [ + "index.js" + ], + "data-cover-never": [ + "node_modules", + "test" + ], + "output-reporter": "spec" + } + }, + "dependencies": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + }, + "description": "easily create complex multi-column command-line-interfaces", + "devDependencies": { + "chai": "^3.5.0", + "chalk": "^1.1.2", + "coveralls": "^2.11.8", + "mocha": "^2.4.5", + "nyc": "^6.4.0", + "standard": "^6.0.8", + "standard-version": "^2.1.2" + }, + "directories": {}, + "dist": { + "shasum": "120601537a916d29940f934da3b48d585a39213d", + "tarball": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz" + }, + "files": [ + "index.js" + ], + "gitHead": "75d62e9dfa77a0e0a9c3ac3b96b02baa294142ce", + "homepage": "https://github.com/yargs/cliui#readme", + "keywords": [ + "cli", + "command-line", + "layout", + "design", + "console", + "wrap", + "table" + ], + "license": "ISC", + "main": "index.js", + "maintainers": [ + { + "name": "bcoe", + "email": "ben@npmjs.com" + } + ], + "name": "cliui", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/yargs/cliui.git" + }, + "scripts": { + "coverage": "nyc --reporter=text-lcov mocha | coveralls", + "pretest": "standard", + "test": "nyc mocha", + "version": "standard-version" + }, + "standard": { + "ignore": [ + "**/example/**" + ], + "globals": [ + "it" + ] + }, + "version": "3.2.0" +} diff --git a/legacy-libs/grpc-cloned/node_modules/nan/CHANGELOG.md b/legacy-libs/grpc-cloned/node_modules/nan/CHANGELOG.md new file mode 100644 index 0000000..93d9496 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/CHANGELOG.md @@ -0,0 +1,537 @@ +# NAN ChangeLog + +**Version 2.14.2: current Node 14.13.1, Node 0.12: 0.12.18, Node 0.10: 0.10.48, iojs: 3.3.1** + +### 2.14.2 Oct 13 2020 + + - Bugfix: fix gcc 8 function cast warning (#899) 35f0fab205574b2cbda04e6347c8b2db755e124f + +### 2.14.1 Apr 21 2020 + + - Bugfix: use GetBackingStore() instead of GetContents() (#888) 2c023bd447661a61071da318b0ff4003c3858d39 + +### 2.14.0 May 16 2019 + + - Feature: Add missing methods to Nan::Maybe (#852) 4e962489fb84a184035b9fa74f245f650249aca6 + +### 2.13.2 Mar 24 2019 + + - Bugfix: remove usage of deprecated `IsNearDeath` (#842) fbaf42252af279c3d867c6b193571f9711c39847 + +### 2.13.1 Mar 14 2019 + + - Bugfix: check V8 version directly instead of inferring from NMV (#840) 12f9df9f393285de8fb4a8cd01478dc4fe3b089d + +### 2.13.0 Mar 13 2019 + + - Feature: add support for node master (#831) 113c0282072e7ff4f9dfc98b432fd894b798c2c + +### 2.12.1 Dec 18 2018 + + - Bugfix: Fix build breakage with Node.js 10.0.0-10.9.0. (#833) 625e90e8fef8d39ffa7247250a76a100b2487474 + +### 2.12.0 Dec 16 2018 + + - Bugfix: Add scope.Escape() to Call() (#817) 2e5ed4fc3a8ac80a6ef1f2a55099ab3ac8800dc6 + - Bugfix: Fix Node.js v10.12.0 deprecation warnings. 509859cc23b1770376b56550a027840a2ce0f73d + - Feature: Allow SetWeak() for non-object persistent handles. (#824) e6ef6a48e7e671fe3e4b7dddaa8912a3f8262ecd + +### 2.11.1 Sep 29 2018 + + - Fix: adapt to V8 7.0 24a22c3b25eeeec2016c6ec239bdd6169e985447 + +### 2.11.0 Aug 25 2018 + + - Removal: remove `FunctionCallbackInfo::Callee` for nodejs `>= 10` 1a56c0a6efd4fac944cb46c30912a8e023bda7d4 + - Bugfix: Fix `AsyncProgressWorkerBase::WorkProgress` sends invalid data b0c764d1dab11e9f8b37ffb81e2560a4498aad5e + - Feature: Introduce `GetCurrentEventLoop` b4911b0bb1f6d47d860e10ec014d941c51efac5e + - Feature: Add `NAN_MODULE_WORKER_ENABLED` macro as a replacement for `NAN_MODULE` b058fb047d18a58250e66ae831444441c1f2ac7a + +### 2.10.0 Mar 16 2018 + + - Deprecation: Deprecate `MakeCallback` 5e92b19a59e194241d6a658bd6ff7bfbda372950 + - Feature: add `Nan::Call` overload 4482e1242fe124d166fc1a5b2be3c1cc849fe452 + - Feature: add more `Nan::Call` overloads 8584e63e6d04c7d2eb8c4a664e4ef57d70bf672b + - Feature: Fix deprecation warnings for Node 10 1caf258243b0602ed56922bde74f1c91b0cbcb6a + +### 2.9.2 Feb 22 2018 + + - Bugfix: Bandaid for async hooks 212bd2f849be14ef1b02fc85010b053daa24252b + +### 2.9.1 Feb 22 2018 + + - Bugfix: Avoid deprecation warnings in deprecated `Nan::Callback::operator()` 372b14d91289df4604b0f81780709708c45a9aa4 + - Bugfix: Avoid deprecation warnings in `Nan::JSON` 3bc294bce0b7d0a3ee4559926303e5ed4866fda2 + +### 2.9.0 Feb 22 2018 + + - Deprecation: Deprecate legacy `Callback::Call` 6dd5fa690af61ca3523004b433304c581b3ea309 + - Feature: introduce `AsyncResource` class 90c0a179c0d8cb5fd26f1a7d2b1d6231eb402d48o + - Feature: Add context aware `Nan::Callback::Call` functions 7169e09fb088418b6e388222e88b4c13f07ebaee + - Feature: Make `AsyncWorker` context aware 066ba21a6fb9e2b5230c9ed3a6fc51f1211736a4 + - Feature: add `Callback` overload to `Nan::Call` 5328daf66e202658c1dc0d916c3aaba99b3cc606 + - Bugfix: fix warning: suggest parentheses around `&&` within `||` b2bb63d68b8ae623a526b542764e1ac82319cb2c + - Bugfix: Fix compilation on io.js 3 d06114dba0a522fb436f0c5f47b994210968cd7b + +### 2.8.0 Nov 15 2017 + + - Deprecation: Deprecate `Nan::ForceSet` in favor of `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 + - Feature: Add `Nan::AsyncProgressQueueWorker` a976636ecc2ef617d1b061ce4a6edf39923691cb + - Feature: Add `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 + - Bugfix: Fix compiling on io.js 1 & 2 82705a64503ce60c62e98df5bd02972bba090900 + - Bugfix: Use DefineOwnProperty instead of ForceSet 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 + +### 2.7.0 Aug 30 2017 + + - Feature: Add `Nan::To()` overload. b93280670c9f6da42ed4cf6cbf085ffdd87bd65b + - Bugfix: Fix ternary in `Nan::MaybeLocal::FromMaybe()`. 79a26f7d362e756a9524e672a82c3d603b542867 + +### 2.6.2 Apr 12 2017 + + - Bugfix: Fix v8::JSON::Parse() deprecation warning. 87f6a3c65815fa062296a994cc863e2fa124867d + +### 2.6.1 Apr 6 2017 + + - Bugfix: nan_json.h: fix build breakage in Node 6 ac8d47dc3c10bfbf3f15a6b951633120c0ee6d51 + +### 2.6.0 Apr 6 2017 + + - Feature: nan: add support for JSON::Parse & Stringify b533226c629cce70e1932a873bb6f849044a56c5 + +### 2.5.1 Jan 23 2017 + + - Bugfix: Fix disappearing handle for private value 6a80995694f162ef63dbc9948fbefd45d4485aa0 + - Bugfix: Add missing scopes a93b8bae6bc7d32a170db6e89228b7f60ee57112 + - Bugfix: Use string::data instead of string::front in NewOneByteString d5f920371e67e1f3b268295daee6e83af86b6e50 + +### 2.5.0 Dec 21 2016 + + - Feature: Support Private accessors a86255cb357e8ad8ccbf1f6a4a901c921e39a178 + - Bugfix: Abort in delete operators that shouldn't be called 0fe38215ff8581703967dfd26c12793feb960018 + +### 2.4.0 Jul 10 2016 + + - Feature: Rewrite Callback to add Callback::Reset c4cf44d61f8275cd5f7b0c911d7a806d4004f649 + - Feature: AsyncProgressWorker: add template types for .send 1242c9a11a7ed481c8f08ec06316385cacc513d0 + - Bugfix: Add constness to old Persistent comparison operators bd43cb9982c7639605d60fd073efe8cae165d9b2 + +### 2.3.5 May 31 2016 + + - Bugfix: Replace NAN_INLINE with 'inline' keyword. 71819d8725f822990f439479c9aba3b240804909 + +### 2.3.4 May 31 2016 + + - Bugfix: Remove V8 deprecation warnings 0592fb0a47f3a1c7763087ebea8e1138829f24f9 + - Bugfix: Fix new versions not to use WeakCallbackInfo::IsFirstPass 615c19d9e03d4be2049c10db0151edbc3b229246 + - Bugfix: Make ObjectWrap::handle() const d19af99595587fe7a26bd850af6595c2a7145afc + - Bugfix: Fix compilation errors related to 0592fb0a47f3a1c7763087ebea8e1138829f24f9 e9191c525b94f652718325e28610a1adcf90fed8 + +### 2.3.3 May 4 2016 + + - Bugfix: Refactor SetMethod() to deal with v8::Templates (#566) b9083cf6d5de6ebe6bcb49c7502fbb7c0d9ddda8 + +### 2.3.2 Apr 27 2016 + + - Bugfix: Fix compilation on outdated versions due to Handle removal f8b7c875d04d425a41dfd4f3f8345bc3a11e6c52 + +### 2.3.1 Apr 27 2016 + + - Bugfix: Don't use deprecated v8::Template::Set() in SetMethod a90951e9ea70fa1b3836af4b925322919159100e + +### 2.3.0 Apr 27 2016 + + - Feature: added Signal() for invoking async callbacks without sending data from AsyncProgressWorker d8adba45f20e077d00561b20199133620c990b38 + - Bugfix: Don't use deprecated v8::Template::Set() 00dacf0a4b86027415867fa7f1059acc499dcece + +### 2.2.1 Mar 29 2016 + + - Bugfix: Use NewFromUnsigned in ReturnValue::Set(uint32_t i) for pre_12 3a18f9bdce29826e0e4c217854bc476918241a58 + - Performance: Remove unneeeded nullptr checks b715ef44887931c94f0d1605b3b1a4156eebece9 + +### 2.2.0 Jan 9 2016 + + - Feature: Add Function::Call wrapper 4c157474dacf284d125c324177b45aa5dabc08c6 + - Feature: Rename GC*logueCallback to GCCallback for > 4.0 3603435109f981606d300eb88004ca101283acec + - Bugfix: Fix Global::Pass for old versions 367e82a60fbaa52716232cc89db1cc3f685d77d9 + - Bugfix: Remove weird MaybeLocal wrapping of what already is a MaybeLocal 23b4590db10c2ba66aee2338aebe9751c4cb190b + +### 2.1.0 Oct 8 2015 + + - Deprecation: Deprecate NanErrnoException in favor of ErrnoException 0af1ca4cf8b3f0f65ed31bc63a663ab3319da55c + - Feature: added helper class for accessing contents of typedarrays 17b51294c801e534479d5463697a73462d0ca555 + - Feature: [Maybe types] Add MakeMaybe(...) 48d7b53d9702b0c7a060e69ea10fea8fb48d814d + - Feature: new: allow utf16 string with length 66ac6e65c8ab9394ef588adfc59131b3b9d8347b + - Feature: Introduce SetCallHandler and SetCallAsFunctionHandler 7764a9a115d60ba10dc24d86feb0fbc9b4f75537 + - Bugfix: Enable creating Locals from Globals under Node 0.10. 9bf9b8b190821af889790fdc18ace57257e4f9ff + - Bugfix: Fix issue #462 where PropertyCallbackInfo data is not stored safely. 55f50adedd543098526c7b9f4fffd607d3f9861f + +### 2.0.9 Sep 8 2015 + + - Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7 + +### 2.0.8 Aug 28 2015 + + - Work around duplicate linking bug in clang 11902da + +### 2.0.7 Aug 26 2015 + + - Build: Repackage + +### 2.0.6 Aug 26 2015 + + - Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1 + - Bugfix: Remove unused static std::map instances 525bddc + - Bugfix: Make better use of maybe versions of APIs bfba85b + - Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d + +### 2.0.5 Aug 10 2015 + + - Bugfix: Reimplement weak callback in ObjectWrap 98d38c1 + - Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d + +### 2.0.4 Aug 6 2015 + + - Build: Repackage + +### 2.0.3 Aug 6 2015 + + - Bugfix: Don't use clang++ / g++ syntax extension. 231450e + +### 2.0.2 Aug 6 2015 + + - Build: Repackage + +### 2.0.1 Aug 6 2015 + + - Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687 + - Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601 + - Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f + - Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed + +### 2.0.0 Jul 31 2015 + + - Change: Renamed identifiers with leading underscores b5932b4 + - Change: Replaced NanObjectWrapHandle with class NanObjectWrap 464f1e1 + - Change: Replace NanScope and NanEscpableScope macros with classes 47751c4 + - Change: Rename NanNewBufferHandle to NanNewBuffer 6745f99 + - Change: Rename NanBufferUse to NanNewBuffer 3e8b0a5 + - Change: Rename NanNewBuffer to NanCopyBuffer d6af78d + - Change: Remove Nan prefix from all names 72d1f67 + - Change: Update Buffer API for new upstream changes d5d3291 + - Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope 21a7a6a + - Change: Get rid of Handles e6c0daf + - Feature: Support io.js 3 with V8 4.4 + - Feature: Introduce NanPersistent 7fed696 + - Feature: Introduce NanGlobal 4408da1 + - Feature: Added NanTryCatch 10f1ca4 + - Feature: Update for V8 v4.3 4b6404a + - Feature: Introduce NanNewOneByteString c543d32 + - Feature: Introduce namespace Nan 67ed1b1 + - Removal: Remove NanLocker and NanUnlocker dd6e401 + - Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9 + - Removal: Remove NanReturn* macros d90a25c + - Removal: Remove HasInstance e8f84fe + + +### 1.9.0 Jul 31 2015 + + - Feature: Added `NanFatalException` 81d4a2c + - Feature: Added more error types 4265f06 + - Feature: Added dereference and function call operators to NanCallback c4b2ed0 + - Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c + - Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6 + - Feature: Added NanErrnoException dd87d9e + - Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130 + - Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c + - Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b + +### 1.8.4 Apr 26 2015 + + - Build: Repackage + +### 1.8.3 Apr 26 2015 + + - Bugfix: Include missing header 1af8648 + +### 1.8.2 Apr 23 2015 + + - Build: Repackage + +### 1.8.1 Apr 23 2015 + + - Bugfix: NanObjectWrapHandle should take a pointer 155f1d3 + +### 1.8.0 Apr 23 2015 + + - Feature: Allow primitives with NanReturnValue 2e4475e + - Feature: Added comparison operators to NanCallback 55b075e + - Feature: Backport thread local storage 15bb7fa + - Removal: Remove support for signatures with arguments 8a2069d + - Correcteness: Replaced NanObjectWrapHandle macro with function 0bc6d59 + +### 1.7.0 Feb 28 2015 + + - Feature: Made NanCallback::Call accept optional target 8d54da7 + - Feature: Support atom-shell 0.21 0b7f1bb + +### 1.6.2 Feb 6 2015 + + - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 + +### 1.6.1 Jan 23 2015 + + - Build: version bump + +### 1.5.3 Jan 23 2015 + + - Build: repackage + +### 1.6.0 Jan 23 2015 + + - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af + - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 + - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 + +### 1.5.2 Jan 23 2015 + + - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 + - Bugfix: Readded missing String constructors 18d828f + - Bugfix: Add overload handling NanNew(..) 5ef813b + - Bugfix: Fix uv_work_cb versioning 997e4ae + - Bugfix: Add function factory and test 4eca89c + - Bugfix: Add object template factory and test cdcb951 + - Correctness: Lifted an io.js related typedef c9490be + - Correctness: Make explicit downcasts of String lengths 00074e6 + - Windows: Limit the scope of disabled warning C4530 83d7deb + +### 1.5.1 Jan 15 2015 + + - Build: version bump + +### 1.4.3 Jan 15 2015 + + - Build: version bump + +### 1.4.2 Jan 15 2015 + + - Feature: Support io.js 0dbc5e8 + +### 1.5.0 Jan 14 2015 + + - Feature: Support io.js b003843 + - Correctness: Improved NanNew internals 9cd4f6a + - Feature: Implement progress to NanAsyncWorker 8d6a160 + +### 1.4.1 Nov 8 2014 + + - Bugfix: Handle DEBUG definition correctly + - Bugfix: Accept int as Boolean + +### 1.4.0 Nov 1 2014 + + - Feature: Added NAN_GC_CALLBACK 6a5c245 + - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 + - Correctness: Added constness to references in NanHasInstance 02c61cd + - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 + - Windoze: Shut Visual Studio up when compiling 8d558c1 + - License: Switch to plain MIT from custom hacked MIT license 11de983 + - Build: Added test target to Makefile e232e46 + - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 + - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 + - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 + +### 1.3.0 Aug 2 2014 + + - Added NanNew(std::string) + - Added NanNew(std::string&) + - Added NanAsciiString helper class + - Added NanUtf8String helper class + - Added NanUcs2String helper class + - Deprecated NanRawString() + - Deprecated NanCString() + - Added NanGetIsolateData(v8::Isolate *isolate) + - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) + - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) + - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + +### 1.2.0 Jun 5 2014 + + - Add NanSetPrototypeTemplate + - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, + introduced _NanWeakCallbackDispatcher + - Removed -Wno-unused-local-typedefs from test builds + - Made test builds Windows compatible ('Sleep()') + +### 1.1.2 May 28 2014 + + - Release to fix more stuff-ups in 1.1.1 + +### 1.1.1 May 28 2014 + + - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 + +### 1.1.0 May 25 2014 + + - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead + - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), + (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, + v8::String::ExternalAsciiStringResource* + - Deprecate NanSymbol() + - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker + +### 1.0.0 May 4 2014 + + - Heavy API changes for V8 3.25 / Node 0.11.13 + - Use cpplint.py + - Removed NanInitPersistent + - Removed NanPersistentToLocal + - Removed NanFromV8String + - Removed NanMakeWeak + - Removed NanNewLocal + - Removed NAN_WEAK_CALLBACK_OBJECT + - Removed NAN_WEAK_CALLBACK_DATA + - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions + - Introduce NanUndefined, NanNull, NanTrue and NanFalse + - Introduce NanEscapableScope and NanEscapeScope + - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node) + - Introduce NanMakeCallback for node::MakeCallback + - Introduce NanSetTemplate + - Introduce NanGetCurrentContext + - Introduce NanCompileScript and NanRunScript + - Introduce NanAdjustExternalMemory + - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback + - Introduce NanGetHeapStatistics + - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent() + +### 0.8.0 Jan 9 2014 + + - NanDispose -> NanDisposePersistent, deprecate NanDispose + - Extract _NAN_*_RETURN_TYPE, pull up NAN_*() + +### 0.7.1 Jan 9 2014 + + - Fixes to work against debug builds of Node + - Safer NanPersistentToLocal (avoid reinterpret_cast) + - Speed up common NanRawString case by only extracting flattened string when necessary + +### 0.7.0 Dec 17 2013 + + - New no-arg form of NanCallback() constructor. + - NanCallback#Call takes Handle rather than Local + - Removed deprecated NanCallback#Run method, use NanCallback#Call instead + - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS + - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call() + - Introduce NanRawString() for char* (or appropriate void*) from v8::String + (replacement for NanFromV8String) + - Introduce NanCString() for null-terminated char* from v8::String + +### 0.6.0 Nov 21 2013 + + - Introduce NanNewLocal(v8::Handle value) for use in place of + v8::Local::New(...) since v8 started requiring isolate in Node 0.11.9 + +### 0.5.2 Nov 16 2013 + + - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public + +### 0.5.1 Nov 12 2013 + + - Use node::MakeCallback() instead of direct v8::Function::Call() + +### 0.5.0 Nov 11 2013 + + - Added @TooTallNate as collaborator + - New, much simpler, "include_dirs" for binding.gyp + - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros + +### 0.4.4 Nov 2 2013 + + - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+ + +### 0.4.3 Nov 2 2013 + + - Include node_object_wrap.h, removed from node.h for Node 0.11.8. + +### 0.4.2 Nov 2 2013 + + - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for + Node 0.11.8 release. + +### 0.4.1 Sep 16 2013 + + - Added explicit `#include ` as it was removed from node.h for v0.11.8 + +### 0.4.0 Sep 2 2013 + + - Added NAN_INLINE and NAN_DEPRECATED and made use of them + - Added NanError, NanTypeError and NanRangeError + - Cleaned up code + +### 0.3.2 Aug 30 2013 + + - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent + in NanAsyncWorker + +### 0.3.1 Aug 20 2013 + + - fix "not all control paths return a value" compile warning on some platforms + +### 0.3.0 Aug 19 2013 + + - Made NAN work with NPM + - Lots of fixes to NanFromV8String, pulling in features from new Node core + - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API + - Added optional error number argument for NanThrowError() + - Added NanInitPersistent() + - Added NanReturnNull() and NanReturnEmptyString() + - Added NanLocker and NanUnlocker + - Added missing scopes + - Made sure to clear disposed Persistent handles + - Changed NanAsyncWorker to allocate error messages on the heap + - Changed NanThrowError(Local) to NanThrowError(Handle) + - Fixed leak in NanAsyncWorker when errmsg is used + +### 0.2.2 Aug 5 2013 + + - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() + +### 0.2.1 Aug 5 2013 + + - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for + NanFromV8String() + +### 0.2.0 Aug 5 2013 + + - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, + NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY + - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, + _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, + _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, + _NAN_PROPERTY_QUERY_ARGS + - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer + - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, + NAN_WEAK_CALLBACK_DATA, NanMakeWeak + - Renamed THROW_ERROR to _NAN_THROW_ERROR + - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) + - Added NanBufferUse(char*, uint32_t) + - Added NanNewContextHandle(v8::ExtensionConfiguration*, + v8::Handle, v8::Handle) + - Fixed broken NanCallback#GetFunction() + - Added optional encoding and size arguments to NanFromV8String() + - Added NanGetPointerSafe() and NanSetPointerSafe() + - Added initial test suite (to be expanded) + - Allow NanUInt32OptionValue to convert any Number object + +### 0.1.0 Jul 21 2013 + + - Added `NAN_GETTER`, `NAN_SETTER` + - Added `NanThrowError` with single Local argument + - Added `NanNewBufferHandle` with single uint32_t argument + - Added `NanHasInstance(Persistent&, Handle)` + - Added `Local NanCallback#GetFunction()` + - Added `NanCallback#Call(int, Local[])` + - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/legacy-libs/grpc-cloned/node_modules/nan/LICENSE.md b/legacy-libs/grpc-cloned/node_modules/nan/LICENSE.md new file mode 100644 index 0000000..dddd13d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/LICENSE.md @@ -0,0 +1,13 @@ +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. diff --git a/legacy-libs/grpc-cloned/node_modules/nan/README.md b/legacy-libs/grpc-cloned/node_modules/nan/README.md new file mode 100644 index 0000000..f671ef1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/README.md @@ -0,0 +1,455 @@ +Native Abstractions for Node.js +=============================== + +**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10, 0.12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 and 14.** + +***Current version: 2.14.2*** + +*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)* + +[![NPM](https://nodei.co/npm/nan.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6&height=3)](https://nodei.co/npm/nan/) + +[![Build Status](https://api.travis-ci.org/nodejs/nan.svg?branch=master)](https://travis-ci.org/nodejs/nan) +[![Build status](https://ci.appveyor.com/api/projects/status/kh73pbm9dsju7fgh)](https://ci.appveyor.com/project/RodVagg/nan) + +Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle. + +This project also contains some helper utilities that make addon development a bit more pleasant. + + * **[News & Updates](#news)** + * **[Usage](#usage)** + * **[Example](#example)** + * **[API](#api)** + * **[Tests](#tests)** + * **[Known issues](#issues)** + * **[Governance & Contributing](#governance)** + + + +## News & Updates + + + +## Usage + +Simply add **NAN** as a dependency in the *package.json* of your Node addon: + +``` bash +$ npm install --save nan +``` + +Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include ` in your *.cpp* files: + +``` python +"include_dirs" : [ + "` when compiling your addon. + + + +## Example + +Just getting started with Nan? Take a look at the **[Node Add-on Examples](https://github.com/nodejs/node-addon-examples)**. + +Refer to a [quick-start **Nan** Boilerplate](https://github.com/fcanas/node-native-boilerplate) for a ready-to-go project that utilizes basic Nan functionality. + +For a simpler example, see the **[async pi estimation example](https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**. + +Yet another example is **[nan-example-eol](https://github.com/CodeCharmLtd/nan-example-eol)**. It shows newline detection implemented as a native addon. + +Also take a look at our comprehensive **[C++ test suite](https://github.com/nodejs/nan/tree/master/test/cpp)** which has a plethora of code snippets for your pasting pleasure. + + + +## API + +Additional to the NAN documentation below, please consult: + +* [The V8 Getting Started * Guide](https://v8.dev/docs/embed) +* [V8 API Documentation](https://v8docs.nodesource.com/) +* [Node Add-on Documentation](https://nodejs.org/api/addons.html) + + + +### JavaScript-accessible methods + +A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information. + +In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. + +* **Method argument types** + - Nan::FunctionCallbackInfo + - Nan::PropertyCallbackInfo + - Nan::ReturnValue +* **Method declarations** + - Method declaration + - Getter declaration + - Setter declaration + - Property getter declaration + - Property setter declaration + - Property enumerator declaration + - Property deleter declaration + - Property query declaration + - Index getter declaration + - Index setter declaration + - Index enumerator declaration + - Index deleter declaration + - Index query declaration +* Method and template helpers + - Nan::SetMethod() + - Nan::SetPrototypeMethod() + - Nan::SetAccessor() + - Nan::SetNamedPropertyHandler() + - Nan::SetIndexedPropertyHandler() + - Nan::SetTemplate() + - Nan::SetPrototypeTemplate() + - Nan::SetInstanceTemplate() + - Nan::SetCallHandler() + - Nan::SetCallAsFunctionHandler() + +### Scopes + +A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. + +A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. + +The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. + + - Nan::HandleScope + - Nan::EscapableHandleScope + +Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection). + +### Persistent references + +An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. + +Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. + + - Nan::PersistentBase & v8::PersistentBase + - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits + - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits + - Nan::Persistent + - Nan::Global + - Nan::WeakCallbackInfo + - Nan::WeakCallbackType + +Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). + +### New + +NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. + + - Nan::New() + - Nan::Undefined() + - Nan::Null() + - Nan::True() + - Nan::False() + - Nan::EmptyString() + + +### Converters + +NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. + + - Nan::To() + +### Maybe Types + +The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. + +* **Maybe Types** + - Nan::MaybeLocal + - Nan::Maybe + - Nan::Nothing + - Nan::Just +* **Maybe Helpers** + - Nan::Call() + - Nan::ToDetailString() + - Nan::ToArrayIndex() + - Nan::Equals() + - Nan::NewInstance() + - Nan::GetFunction() + - Nan::Set() + - Nan::DefineOwnProperty() + - Nan::ForceSet() + - Nan::Get() + - Nan::GetPropertyAttributes() + - Nan::Has() + - Nan::Delete() + - Nan::GetPropertyNames() + - Nan::GetOwnPropertyNames() + - Nan::SetPrototype() + - Nan::ObjectProtoToString() + - Nan::HasOwnProperty() + - Nan::HasRealNamedProperty() + - Nan::HasRealIndexedProperty() + - Nan::HasRealNamedCallbackProperty() + - Nan::GetRealNamedPropertyInPrototypeChain() + - Nan::GetRealNamedProperty() + - Nan::CallAsFunction() + - Nan::CallAsConstructor() + - Nan::GetSourceLine() + - Nan::GetLineNumber() + - Nan::GetStartColumn() + - Nan::GetEndColumn() + - Nan::CloneElementAt() + - Nan::HasPrivate() + - Nan::GetPrivate() + - Nan::SetPrivate() + - Nan::DeletePrivate() + - Nan::MakeMaybe() + +### Script + +NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. + + - Nan::CompileScript() + - Nan::RunScript() + + +### JSON + +The _JSON_ object provides the C++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object. + + - Nan::JSON.Parse + - Nan::JSON.Stringify + +Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments. + +### Errors + +NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. + +Note that an Error object is simply a specialized form of `v8::Value`. + +Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. + + - Nan::Error() + - Nan::RangeError() + - Nan::ReferenceError() + - Nan::SyntaxError() + - Nan::TypeError() + - Nan::ThrowError() + - Nan::ThrowRangeError() + - Nan::ThrowReferenceError() + - Nan::ThrowSyntaxError() + - Nan::ThrowTypeError() + - Nan::FatalException() + - Nan::ErrnoException() + - Nan::TryCatch + + +### Buffers + +NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. + + - Nan::NewBuffer() + - Nan::CopyBuffer() + - Nan::FreeCallback() + +### Nan::Callback + +`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. + + - Nan::Callback + +### Asynchronous work helpers + +`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier. + + - Nan::AsyncWorker + - Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker + - Nan::AsyncProgressQueueWorker + - Nan::AsyncQueueWorker + +### Strings & Bytes + +Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. + + - Nan::Encoding + - Nan::Encode() + - Nan::DecodeBytes() + - Nan::DecodeWrite() + + +### Object Wrappers + +The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects. + + - Nan::ObjectWrap + + +### V8 internals + +The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. + + - NAN_GC_CALLBACK() + - Nan::AddGCEpilogueCallback() + - Nan::RemoveGCEpilogueCallback() + - Nan::AddGCPrologueCallback() + - Nan::RemoveGCPrologueCallback() + - Nan::GetHeapStatistics() + - Nan::SetCounterFunction() + - Nan::SetCreateHistogramFunction() + - Nan::SetAddHistogramSampleFunction() + - Nan::IdleNotification() + - Nan::LowMemoryNotification() + - Nan::ContextDisposedNotification() + - Nan::GetInternalFieldPointer() + - Nan::SetInternalFieldPointer() + - Nan::AdjustExternalMemory() + + +### Miscellaneous V8 Helpers + + - Nan::Utf8String + - Nan::GetCurrentContext() + - Nan::SetIsolateData() + - Nan::GetIsolateData() + - Nan::TypedArrayContents + + +### Miscellaneous Node Helpers + + - Nan::AsyncResource + - Nan::MakeCallback() + - NAN_MODULE_INIT() + - Nan::Export() + + + + + + +### Tests + +To run the NAN tests do: + +``` sh +npm install +npm run-script rebuild-tests +npm test +``` + +Or just: + +``` sh +npm install +make test +``` + + + +## Known issues + +### Compiling against Node.js 0.12 on OSX + +With new enough compilers available on OSX, the versions of V8 headers corresponding to Node.js 0.12 +do not compile anymore. The error looks something like: + +``` +❯ CXX(target) Release/obj.target/accessors/cpp/accessors.o +In file included from ../cpp/accessors.cpp:9: +In file included from ../../nan.h:51: +In file included from /Users/ofrobots/.node-gyp/0.12.18/include/node/node.h:61: +/Users/ofrobots/.node-gyp/0.12.18/include/node/v8.h:5800:54: error: 'CreateHandle' is a protected member of 'v8::HandleScope' + return Handle(reinterpret_cast(HandleScope::CreateHandle( + ~~~~~~~~~~~~~^~~~~~~~~~~~ +``` + +This can be worked around by patching your local versions of v8.h corresponding to Node 0.12 to make +`v8::Handle` a friend of `v8::HandleScope`. Since neither Node.js not V8 support this release line anymore +this patch cannot be released by either project in an official release. + +For this reason, we do not test against Node.js 0.12 on OSX in this project's CI. If you need to support +that configuration, you will need to either get an older compiler, or apply a source patch to the version +of V8 headers as a workaround. + + + +## Governance & Contributing + +NAN is governed by the [Node.js Addon API Working Group](https://github.com/nodejs/CTC/blob/master/WORKING_GROUPS.md#addon-api) + +### Addon API Working Group (WG) + +The NAN project is jointly governed by a Working Group which is responsible for high-level guidance of the project. + +Members of the WG are also known as Collaborators, there is no distinction between the two, unlike other Node.js projects. + +The WG has final authority over this project including: + +* Technical direction +* Project governance and process (including this policy) +* Contribution policy +* GitHub repository hosting +* Maintaining the list of additional Collaborators + +For the current list of WG members, see the project [README.md](./README.md#collaborators). + +Individuals making significant and valuable contributions are made members of the WG and given commit-access to the project. These individuals are identified by the WG and their addition to the WG is discussed via GitHub and requires unanimous consensus amongst those WG members participating in the discussion with a quorum of 50% of WG members required for acceptance of the vote. + +_Note:_ If you make a significant contribution and are not considered for commit-access log an issue or contact a WG member directly. + +For the current list of WG members / Collaborators, see the project [README.md](./README.md#collaborators). + +### Consensus Seeking Process + +The WG follows a [Consensus Seeking](https://en.wikipedia.org/wiki/Consensus-seeking_decision-making) decision making model. + +Modifications of the contents of the NAN 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 WG. All pull requests must be reviewed and accepted by a WG member with sufficient expertise who is able to take full responsibility for the change. In the case of pull requests proposed by an existing WG member, an additional WG member is required for sign-off. Consensus should be sought if additional WG members participate and there is disagreement around a particular modification. + +If a change proposal cannot reach a consensus, a WG member can call for a vote amongst the members of the WG. Simple majority wins. + + + +## 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. + + + +### WG Members / Collaborators + + + + + + + + + + +
Rod VaggGitHub/rvaggTwitter/@rvagg
Benjamin ByholmGitHub/kkoopa-
Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris
Nathan RajlichGitHub/TooTallNateTwitter/@TooTallNate
Brett LawsonGitHub/brett19Twitter/@brett19x
Ben NoordhuisGitHub/bnoordhuisTwitter/@bnoordhuis
David SiegelGitHub/agnatTwitter/@agnat
Michael Ira KrufkyGitHub/mkrufkyTwitter/@mkrufky
+ +## Licence & copyright + +Copyright (c) 2018 NAN WG Members / Collaborators (listed above). + +Native Abstractions for Node.js is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/asyncworker.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/asyncworker.md new file mode 100644 index 0000000..04231f8 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/asyncworker.md @@ -0,0 +1,146 @@ +## Asynchronous work helpers + +`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier. + + - Nan::AsyncWorker + - Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker + - Nan::AsyncProgressQueueWorker + - Nan::AsyncQueueWorker + + +### Nan::AsyncWorker + +`Nan::AsyncWorker` is an _abstract_ class that you can subclass to have much of the annoying asynchronous queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the asynchronous work is in progress. + +This class internally handles the details of creating an [`AsyncResource`][AsyncResource], and running the callback in the +correct async context. To be able to identify the async resources created by this class in async-hooks, provide a +`resource_name` to the constructor. It is recommended that the module name be used as a prefix to the `resource_name` to avoid +collisions in the names. For more details see [`AsyncResource`][AsyncResource] documentation. The `resource_name` needs to stay valid for the lifetime of the worker instance. + +Definition: + +```c++ +class AsyncWorker { + public: + explicit AsyncWorker(Callback *callback_, const char* resource_name = "nan:AsyncWorker"); + + virtual ~AsyncWorker(); + + virtual void WorkComplete(); + + void SaveToPersistent(const char *key, const v8::Local &value); + + void SaveToPersistent(const v8::Local &key, + const v8::Local &value); + + void SaveToPersistent(uint32_t index, + const v8::Local &value); + + v8::Local GetFromPersistent(const char *key) const; + + v8::Local GetFromPersistent(const v8::Local &key) const; + + v8::Local GetFromPersistent(uint32_t index) const; + + virtual void Execute() = 0; + + uv_work_t request; + + virtual void Destroy(); + + protected: + Persistent persistentHandle; + + Callback *callback; + + virtual void HandleOKCallback(); + + virtual void HandleErrorCallback(); + + void SetErrorMessage(const char *msg); + + const char* ErrorMessage(); +}; +``` + + +### Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker + +`Nan::AsyncProgressWorkerBase` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. + +Previously the definition of `Nan::AsyncProgressWorker` only allowed sending `const char` data. Now extending `Nan::AsyncProgressWorker` will yield an instance of the implicit `Nan::AsyncProgressWorkerBase` template with type `` for compatibility. + +`Nan::AsyncProgressWorkerBase` & `Nan::AsyncProgressWorker` is intended for best-effort delivery of nonessential progress messages, e.g. a progress bar. The last event sent before the main thread is woken will be delivered. + +Definition: + +```c++ +template +class AsyncProgressWorkerBase : public AsyncWorker { + public: + explicit AsyncProgressWorkerBase(Callback *callback_, const char* resource_name = ...); + + virtual ~AsyncProgressWorkerBase(); + + void WorkProgress(); + + class ExecutionProgress { + public: + void Signal() const; + void Send(const T* data, size_t count) const; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + + virtual void HandleProgressCallback(const T *data, size_t count) = 0; + + virtual void Destroy(); +}; + +typedef AsyncProgressWorkerBase AsyncProgressWorker; +``` + + +### Nan::AsyncProgressQueueWorker + +`Nan::AsyncProgressQueueWorker` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. + +`Nan::AsyncProgressQueueWorker` behaves exactly the same as `Nan::AsyncProgressWorker`, except all events are queued and delivered to the main thread. + +Definition: + +```c++ +template +class AsyncProgressQueueWorker : public AsyncWorker { + public: + explicit AsyncProgressQueueWorker(Callback *callback_, const char* resource_name = "nan:AsyncProgressQueueWorker"); + + virtual ~AsyncProgressQueueWorker(); + + void WorkProgress(); + + class ExecutionProgress { + public: + void Send(const T* data, size_t count) const; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + + virtual void HandleProgressCallback(const T *data, size_t count) = 0; + + virtual void Destroy(); +}; +``` + + +### Nan::AsyncQueueWorker + +`Nan::AsyncQueueWorker` will run a `Nan::AsyncWorker` asynchronously via libuv. Both the `execute` and `after_work` steps are taken care of for you. Most of the logic for this is embedded in `Nan::AsyncWorker`. + +Definition: + +```c++ +void AsyncQueueWorker(AsyncWorker *); +``` + +[AsyncResource]: node_misc.md#api_nan_asyncresource diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/buffers.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/buffers.md new file mode 100644 index 0000000..8d8d25c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/buffers.md @@ -0,0 +1,54 @@ +## Buffers + +NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. + + - Nan::NewBuffer() + - Nan::CopyBuffer() + - Nan::FreeCallback() + + +### Nan::NewBuffer() + +Allocate a new `node::Buffer` object with the specified size and optional data. Calls `node::Buffer::New()`. + +Note that when creating a `Buffer` using `Nan::NewBuffer()` and an existing `char*`, it is assumed that the ownership of the pointer is being transferred to the new `Buffer` for management. +When a `node::Buffer` instance is garbage collected and a `FreeCallback` has not been specified, `data` will be disposed of via a call to `free()`. +You _must not_ free the memory space manually once you have created a `Buffer` in this way. + +Signature: + +```c++ +Nan::MaybeLocal Nan::NewBuffer(uint32_t size) +Nan::MaybeLocal Nan::NewBuffer(char* data, uint32_t size) +Nan::MaybeLocal Nan::NewBuffer(char *data, + size_t length, + Nan::FreeCallback callback, + void *hint) +``` + + + +### Nan::CopyBuffer() + +Similar to [`Nan::NewBuffer()`](#api_nan_new_buffer) except that an implicit memcpy will occur within Node. Calls `node::Buffer::Copy()`. + +Management of the `char*` is left to the user, you should manually free the memory space if necessary as the new `Buffer` will have its own copy. + +Signature: + +```c++ +Nan::MaybeLocal Nan::CopyBuffer(const char *data, uint32_t size) +``` + + + +### Nan::FreeCallback() + +A free callback that can be provided to [`Nan::NewBuffer()`](#api_nan_new_buffer). +The supplied callback will be invoked when the `Buffer` undergoes garbage collection. + +Signature: + +```c++ +typedef void (*FreeCallback)(char *data, void *hint); +``` diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/callback.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/callback.md new file mode 100644 index 0000000..f7af0bf --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/callback.md @@ -0,0 +1,76 @@ +## Nan::Callback + +`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. + + - Nan::Callback + + +### Nan::Callback + +```c++ +class Callback { + public: + Callback(); + + explicit Callback(const v8::Local &fn); + + ~Callback(); + + bool operator==(const Callback &other) const; + + bool operator!=(const Callback &other) const; + + v8::Local operator*() const; + + MaybeLocal operator()(AsyncResource* async_resource, + v8::Local target, + int argc = 0, + v8::Local argv[] = 0) const; + + MaybeLocal operator()(AsyncResource* async_resource, + int argc = 0, + v8::Local argv[] = 0) const; + + void SetFunction(const v8::Local &fn); + + v8::Local GetFunction() const; + + bool IsEmpty() const; + + void Reset(const v8::Local &fn); + + void Reset(); + + MaybeLocal Call(v8::Local target, + int argc, + v8::Local argv[], + AsyncResource* async_resource) const; + MaybeLocal Call(int argc, + v8::Local argv[], + AsyncResource* async_resource) const; + + // Deprecated versions. Use the versions that accept an async_resource instead + // as they run the callback in the correct async context as specified by the + // resource. If you want to call a synchronous JS function (i.e. on a + // non-empty JS stack), you can use Nan::Call instead. + v8::Local operator()(v8::Local target, + int argc = 0, + v8::Local argv[] = 0) const; + + v8::Local operator()(int argc = 0, + v8::Local argv[] = 0) const; + v8::Local Call(v8::Local target, + int argc, + v8::Local argv[]) const; + + v8::Local Call(int argc, v8::Local argv[]) const; +}; +``` + +Example usage: + +```c++ +v8::Local function; +Nan::Callback callback(function); +callback.Call(0, 0); +``` diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/converters.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/converters.md new file mode 100644 index 0000000..d20861b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/converters.md @@ -0,0 +1,41 @@ +## Converters + +NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. + + - Nan::To() + + +### Nan::To() + +Converts a `v8::Local` to a different subtype of `v8::Value` or to a native data type. Returns a `Nan::MaybeLocal<>` or a `Nan::Maybe<>` accordingly. + +See [maybe_types.md](./maybe_types.md) for more information on `Nan::Maybe` types. + +Signatures: + +```c++ +// V8 types +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); + +// Native types +Nan::Maybe Nan::To(v8::Local val); +Nan::Maybe Nan::To(v8::Local val); +Nan::Maybe Nan::To(v8::Local val); +Nan::Maybe Nan::To(v8::Local val); +Nan::Maybe Nan::To(v8::Local val); +``` + +### Example + +```c++ +v8::Local val; +Nan::MaybeLocal str = Nan::To(val); +Nan::Maybe d = Nan::To(val); +``` + diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/errors.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/errors.md new file mode 100644 index 0000000..843435b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/errors.md @@ -0,0 +1,226 @@ +## Errors + +NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. + +Note that an Error object is simply a specialized form of `v8::Value`. + +Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. + + - Nan::Error() + - Nan::RangeError() + - Nan::ReferenceError() + - Nan::SyntaxError() + - Nan::TypeError() + - Nan::ThrowError() + - Nan::ThrowRangeError() + - Nan::ThrowReferenceError() + - Nan::ThrowSyntaxError() + - Nan::ThrowTypeError() + - Nan::FatalException() + - Nan::ErrnoException() + - Nan::TryCatch + + + +### Nan::Error() + +Create a new Error object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. + +Note that an Error object is simply a specialized form of `v8::Value`. + +Signature: + +```c++ +v8::Local Nan::Error(const char *msg); +v8::Local Nan::Error(v8::Local msg); +``` + + + +### Nan::RangeError() + +Create a new RangeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. + +Note that an RangeError object is simply a specialized form of `v8::Value`. + +Signature: + +```c++ +v8::Local Nan::RangeError(const char *msg); +v8::Local Nan::RangeError(v8::Local msg); +``` + + + +### Nan::ReferenceError() + +Create a new ReferenceError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. + +Note that an ReferenceError object is simply a specialized form of `v8::Value`. + +Signature: + +```c++ +v8::Local Nan::ReferenceError(const char *msg); +v8::Local Nan::ReferenceError(v8::Local msg); +``` + + + +### Nan::SyntaxError() + +Create a new SyntaxError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. + +Note that an SyntaxError object is simply a specialized form of `v8::Value`. + +Signature: + +```c++ +v8::Local Nan::SyntaxError(const char *msg); +v8::Local Nan::SyntaxError(v8::Local msg); +``` + + + +### Nan::TypeError() + +Create a new TypeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. + +Note that an TypeError object is simply a specialized form of `v8::Value`. + +Signature: + +```c++ +v8::Local Nan::TypeError(const char *msg); +v8::Local Nan::TypeError(v8::Local msg); +``` + + + +### Nan::ThrowError() + +Throw an Error object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new Error object will be created. + +Signature: + +```c++ +void Nan::ThrowError(const char *msg); +void Nan::ThrowError(v8::Local msg); +void Nan::ThrowError(v8::Local error); +``` + + + +### Nan::ThrowRangeError() + +Throw an RangeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new RangeError object will be created. + +Signature: + +```c++ +void Nan::ThrowRangeError(const char *msg); +void Nan::ThrowRangeError(v8::Local msg); +void Nan::ThrowRangeError(v8::Local error); +``` + + + +### Nan::ThrowReferenceError() + +Throw an ReferenceError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new ReferenceError object will be created. + +Signature: + +```c++ +void Nan::ThrowReferenceError(const char *msg); +void Nan::ThrowReferenceError(v8::Local msg); +void Nan::ThrowReferenceError(v8::Local error); +``` + + + +### Nan::ThrowSyntaxError() + +Throw an SyntaxError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new SyntaxError object will be created. + +Signature: + +```c++ +void Nan::ThrowSyntaxError(const char *msg); +void Nan::ThrowSyntaxError(v8::Local msg); +void Nan::ThrowSyntaxError(v8::Local error); +``` + + + +### Nan::ThrowTypeError() + +Throw an TypeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new TypeError object will be created. + +Signature: + +```c++ +void Nan::ThrowTypeError(const char *msg); +void Nan::ThrowTypeError(v8::Local msg); +void Nan::ThrowTypeError(v8::Local error); +``` + + +### Nan::FatalException() + +Replaces `node::FatalException()` which has a different API across supported versions of Node. For use with [`Nan::TryCatch`](#api_nan_try_catch). + +Signature: + +```c++ +void Nan::FatalException(const Nan::TryCatch& try_catch); +``` + + +### Nan::ErrnoException() + +Replaces `node::ErrnoException()` which has a different API across supported versions of Node. + +Signature: + +```c++ +v8::Local Nan::ErrnoException(int errorno, + const char* syscall = NULL, + const char* message = NULL, + const char* path = NULL); +``` + + + +### Nan::TryCatch + +A simple wrapper around [`v8::TryCatch`](https://v8docs.nodesource.com/node-8.16/d4/dc6/classv8_1_1_try_catch.html) compatible with all supported versions of V8. Can be used as a direct replacement in most cases. See also [`Nan::FatalException()`](#api_nan_fatal_exception) for an internal use compatible with `node::FatalException`. + +Signature: + +```c++ +class Nan::TryCatch { + public: + Nan::TryCatch(); + + bool HasCaught() const; + + bool CanContinue() const; + + v8::Local ReThrow(); + + v8::Local Exception() const; + + // Nan::MaybeLocal for older versions of V8 + v8::MaybeLocal StackTrace() const; + + v8::Local Message() const; + + void Reset(); + + void SetVerbose(bool value); + + void SetCaptureMessage(bool value); +}; +``` + diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/json.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/json.md new file mode 100644 index 0000000..d142597 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/json.md @@ -0,0 +1,62 @@ +## JSON + +The _JSON_ object provides the c++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object. + + - Nan::JSON.Parse + - Nan::JSON.Stringify + +Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments. + + + +### Nan::JSON.Parse + +A simple wrapper around [`v8::JSON::Parse`](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html#a936310d2540fb630ed37d3ee3ffe4504). + +Definition: + +```c++ +Nan::MaybeLocal Nan::JSON::Parse(v8::Local json_string); +``` + +Use `JSON.Parse(json_string)` to parse a string into a `v8::Value`. + +Example: + +```c++ +v8::Local json_string = Nan::New("{ \"JSON\": \"object\" }").ToLocalChecked(); + +Nan::JSON NanJSON; +Nan::MaybeLocal result = NanJSON.Parse(json_string); +if (!result.IsEmpty()) { + v8::Local val = result.ToLocalChecked(); +} +``` + + + +### Nan::JSON.Stringify + +A simple wrapper around [`v8::JSON::Stringify`](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html#a44b255c3531489ce43f6110209138860). + +Definition: + +```c++ +Nan::MaybeLocal Nan::JSON::Stringify(v8::Local json_object, v8::Local gap = v8::Local()); +``` + +Use `JSON.Stringify(value)` to stringify a `v8::Object`. + +Example: + +```c++ +// using `v8::Local val` from the `JSON::Parse` example +v8::Local obj = Nan::To(val).ToLocalChecked(); + +Nan::JSON NanJSON; +Nan::MaybeLocal result = NanJSON.Stringify(obj); +if (!result.IsEmpty()) { + v8::Local stringified = result.ToLocalChecked(); +} +``` + diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/maybe_types.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/maybe_types.md new file mode 100644 index 0000000..142851a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/maybe_types.md @@ -0,0 +1,583 @@ +## Maybe Types + +The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. + +* **Maybe Types** + - Nan::MaybeLocal + - Nan::Maybe + - Nan::Nothing + - Nan::Just +* **Maybe Helpers** + - Nan::Call() + - Nan::ToDetailString() + - Nan::ToArrayIndex() + - Nan::Equals() + - Nan::NewInstance() + - Nan::GetFunction() + - Nan::Set() + - Nan::DefineOwnProperty() + - Nan::ForceSet() + - Nan::Get() + - Nan::GetPropertyAttributes() + - Nan::Has() + - Nan::Delete() + - Nan::GetPropertyNames() + - Nan::GetOwnPropertyNames() + - Nan::SetPrototype() + - Nan::ObjectProtoToString() + - Nan::HasOwnProperty() + - Nan::HasRealNamedProperty() + - Nan::HasRealIndexedProperty() + - Nan::HasRealNamedCallbackProperty() + - Nan::GetRealNamedPropertyInPrototypeChain() + - Nan::GetRealNamedProperty() + - Nan::CallAsFunction() + - Nan::CallAsConstructor() + - Nan::GetSourceLine() + - Nan::GetLineNumber() + - Nan::GetStartColumn() + - Nan::GetEndColumn() + - Nan::CloneElementAt() + - Nan::HasPrivate() + - Nan::GetPrivate() + - Nan::SetPrivate() + - Nan::DeletePrivate() + - Nan::MakeMaybe() + + +### Nan::MaybeLocal + +A `Nan::MaybeLocal` is a wrapper around [`v8::Local`](https://v8docs.nodesource.com/node-8.16/de/deb/classv8_1_1_local.html) that enforces a check that determines whether the `v8::Local` is empty before it can be used. + +If an API method returns a `Nan::MaybeLocal`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, an empty `Nan::MaybeLocal` is returned. + +Definition: + +```c++ +template class Nan::MaybeLocal { + public: + MaybeLocal(); + + template MaybeLocal(v8::Local that); + + bool IsEmpty() const; + + template bool ToLocal(v8::Local *out); + + // Will crash if the MaybeLocal<> is empty. + v8::Local ToLocalChecked(); + + template v8::Local FromMaybe(v8::Local default_value) const; +}; +``` + +See the documentation for [`v8::MaybeLocal`](https://v8docs.nodesource.com/node-8.16/d8/d7d/classv8_1_1_maybe_local.html) for further details. + + +### Nan::Maybe + +A simple `Nan::Maybe` type, representing an object which may or may not have a value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html. + +If an API method returns a `Nan::Maybe<>`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, a "Nothing" value is returned. + +Definition: + +```c++ +template class Nan::Maybe { + public: + bool IsNothing() const; + bool IsJust() const; + + // Will crash if the Maybe<> is nothing. + T FromJust(); + + T FromMaybe(const T& default_value); + + bool operator==(const Maybe &other); + + bool operator!=(const Maybe &other); +}; +``` + +See the documentation for [`v8::Maybe`](https://v8docs.nodesource.com/node-8.16/d9/d4b/classv8_1_1_maybe.html) for further details. + + +### Nan::Nothing + +Construct an empty `Nan::Maybe` type representing _nothing_. + +```c++ +template Nan::Maybe Nan::Nothing(); +``` + + +### Nan::Just + +Construct a `Nan::Maybe` type representing _just_ a value. + +```c++ +template Nan::Maybe Nan::Just(const T &t); +``` + + +### Nan::Call() + +A helper method for calling a synchronous [`v8::Function#Call()`](https://v8docs.nodesource.com/node-8.16/d5/d54/classv8_1_1_function.html#a9c3d0e4e13ddd7721fce238aa5b94a11) in a way compatible across supported versions of V8. + +For asynchronous callbacks, use Nan::Callback::Call along with an AsyncResource. + +Signature: + +```c++ +Nan::MaybeLocal Nan::Call(v8::Local fun, v8::Local recv, int argc, v8::Local argv[]); +Nan::MaybeLocal Nan::Call(const Nan::Callback& callback, v8::Local recv, + int argc, v8::Local argv[]); +Nan::MaybeLocal Nan::Call(const Nan::Callback& callback, int argc, v8::Local argv[]); +``` + + + +### Nan::ToDetailString() + +A helper method for calling [`v8::Value#ToDetailString()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#a2f9770296dc2c8d274bc8cc0dca243e5) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::ToDetailString(v8::Local val); +``` + + + +### Nan::ToArrayIndex() + +A helper method for calling [`v8::Value#ToArrayIndex()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#acc5bbef3c805ec458470c0fcd6f13493) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::ToArrayIndex(v8::Local val); +``` + + + +### Nan::Equals() + +A helper method for calling [`v8::Value#Equals()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#a08fba1d776a59bbf6864b25f9152c64b) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::Equals(v8::Local a, v8::Local(b)); +``` + + + +### Nan::NewInstance() + +A helper method for calling [`v8::Function#NewInstance()`](https://v8docs.nodesource.com/node-8.16/d5/d54/classv8_1_1_function.html#ae477558b10c14b76ed00e8dbab44ce5b) and [`v8::ObjectTemplate#NewInstance()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#ad605a7543cfbc5dab54cdb0883d14ae4) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::NewInstance(v8::Local h); +Nan::MaybeLocal Nan::NewInstance(v8::Local h, int argc, v8::Local argv[]); +Nan::MaybeLocal Nan::NewInstance(v8::Local h); +``` + + + +### Nan::GetFunction() + +A helper method for calling [`v8::FunctionTemplate#GetFunction()`](https://v8docs.nodesource.com/node-8.16/d8/d83/classv8_1_1_function_template.html#a56d904662a86eca78da37d9bb0ed3705) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetFunction(v8::Local t); +``` + + + +### Nan::Set() + +A helper method for calling [`v8::Object#Set()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a67604ea3734f170c66026064ea808f20) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::Set(v8::Local obj, + v8::Local key, + v8::Local value) +Nan::Maybe Nan::Set(v8::Local obj, + uint32_t index, + v8::Local value); +``` + + + +### Nan::DefineOwnProperty() + +A helper method for calling [`v8::Object#DefineOwnProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a6f76b2ed605cb8f9185b92de0033a820) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::DefineOwnProperty(v8::Local obj, + v8::Local key, + v8::Local value, + v8::PropertyAttribute attribs = v8::None); +``` + + + +### Nan::ForceSet() + +Deprecated, use Nan::DefineOwnProperty(). + +A helper method for calling [`v8::Object#ForceSet()`](https://v8docs.nodesource.com/node-0.12/db/d85/classv8_1_1_object.html#acfbdfd7427b516ebdb5c47c4df5ed96c) in a way compatible across supported versions of V8. + +Signature: + +```c++ +NAN_DEPRECATED Nan::Maybe Nan::ForceSet(v8::Local obj, + v8::Local key, + v8::Local value, + v8::PropertyAttribute attribs = v8::None); +``` + + + +### Nan::Get() + +A helper method for calling [`v8::Object#Get()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a2565f03e736694f6b1e1cf22a0b4eac2) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::Get(v8::Local obj, + v8::Local key); +Nan::MaybeLocal Nan::Get(v8::Local obj, uint32_t index); +``` + + + +### Nan::GetPropertyAttributes() + +A helper method for calling [`v8::Object#GetPropertyAttributes()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a9b898894da3d1db2714fd9325a54fe57) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::GetPropertyAttributes( + v8::Local obj, + v8::Local key); +``` + + + +### Nan::Has() + +A helper method for calling [`v8::Object#Has()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab3c3d89ea7c2f9afd08965bd7299a41d) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::Has(v8::Local obj, v8::Local key); +Nan::Maybe Nan::Has(v8::Local obj, uint32_t index); +``` + + + +### Nan::Delete() + +A helper method for calling [`v8::Object#Delete()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a48e4a19b2cedff867eecc73ddb7d377f) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::Delete(v8::Local obj, + v8::Local key); +Nan::Maybe Nan::Delete(v8::Local obj, uint32_t index); +``` + + + +### Nan::GetPropertyNames() + +A helper method for calling [`v8::Object#GetPropertyNames()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#aced885270cfd2c956367b5eedc7fbfe8) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetPropertyNames(v8::Local obj); +``` + + + +### Nan::GetOwnPropertyNames() + +A helper method for calling [`v8::Object#GetOwnPropertyNames()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a79a6e4d66049b9aa648ed4dfdb23e6eb) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetOwnPropertyNames(v8::Local obj); +``` + + + +### Nan::SetPrototype() + +A helper method for calling [`v8::Object#SetPrototype()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a442706b22fceda6e6d1f632122a9a9f4) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::SetPrototype(v8::Local obj, + v8::Local prototype); +``` + + + +### Nan::ObjectProtoToString() + +A helper method for calling [`v8::Object#ObjectProtoToString()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab7a92b4dcf822bef72f6c0ac6fea1f0b) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::ObjectProtoToString(v8::Local obj); +``` + + + +### Nan::HasOwnProperty() + +A helper method for calling [`v8::Object#HasOwnProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab7b7245442ca6de1e1c145ea3fd653ff) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::HasOwnProperty(v8::Local obj, + v8::Local key); +``` + + + +### Nan::HasRealNamedProperty() + +A helper method for calling [`v8::Object#HasRealNamedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ad8b80a59c9eb3c1e6c3cd6c84571f767) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::HasRealNamedProperty(v8::Local obj, + v8::Local key); +``` + + + +### Nan::HasRealIndexedProperty() + +A helper method for calling [`v8::Object#HasRealIndexedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af94fc1135a5e74a2193fb72c3a1b9855) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::HasRealIndexedProperty(v8::Local obj, + uint32_t index); +``` + + + +### Nan::HasRealNamedCallbackProperty() + +A helper method for calling [`v8::Object#HasRealNamedCallbackProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af743b7ea132b89f84d34d164d0668811) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::HasRealNamedCallbackProperty( + v8::Local obj, + v8::Local key); +``` + + + +### Nan::GetRealNamedPropertyInPrototypeChain() + +A helper method for calling [`v8::Object#GetRealNamedPropertyInPrototypeChain()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a8700b1862e6b4783716964ba4d5e6172) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetRealNamedPropertyInPrototypeChain( + v8::Local obj, + v8::Local key); +``` + + + +### Nan::GetRealNamedProperty() + +A helper method for calling [`v8::Object#GetRealNamedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a84471a824576a5994fdd0ffcbf99ccc0) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetRealNamedProperty(v8::Local obj, + v8::Local key); +``` + + + +### Nan::CallAsFunction() + +A helper method for calling [`v8::Object#CallAsFunction()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ad3ffc36f3dfc3592ce2a96bc047ee2cd) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::CallAsFunction(v8::Local obj, + v8::Local recv, + int argc, + v8::Local argv[]); +``` + + + +### Nan::CallAsConstructor() + +A helper method for calling [`v8::Object#CallAsConstructor()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a50d571de50d0b0dfb28795619d07a01b) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::CallAsConstructor(v8::Local obj, + int argc, + v8::Local argv[]); +``` + + + +### Nan::GetSourceLine() + +A helper method for calling [`v8::Message#GetSourceLine()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#a849f7a6c41549d83d8159825efccd23a) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetSourceLine(v8::Local msg); +``` + + + +### Nan::GetLineNumber() + +A helper method for calling [`v8::Message#GetLineNumber()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#adbe46c10a88a6565f2732a2d2adf99b9) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::GetLineNumber(v8::Local msg); +``` + + + +### Nan::GetStartColumn() + +A helper method for calling [`v8::Message#GetStartColumn()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#a60ede616ba3822d712e44c7a74487ba6) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::GetStartColumn(v8::Local msg); +``` + + + +### Nan::GetEndColumn() + +A helper method for calling [`v8::Message#GetEndColumn()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#aaa004cf19e529da980bc19fcb76d93be) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::GetEndColumn(v8::Local msg); +``` + + + +### Nan::CloneElementAt() + +A helper method for calling [`v8::Array#CloneElementAt()`](https://v8docs.nodesource.com/node-4.8/d3/d32/classv8_1_1_array.html#a1d3a878d4c1c7cae974dd50a1639245e) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::CloneElementAt(v8::Local array, uint32_t index); +``` + + +### Nan::HasPrivate() + +A helper method for calling [`v8::Object#HasPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af68a0b98066cfdeb8f943e98a40ba08d) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::HasPrivate(v8::Local object, v8::Local key); +``` + + +### Nan::GetPrivate() + +A helper method for calling [`v8::Object#GetPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a169f2da506acbec34deadd9149a1925a) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetPrivate(v8::Local object, v8::Local key); +``` + + +### Nan::SetPrivate() + +A helper method for calling [`v8::Object#SetPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ace1769b0f3b86bfe9fda1010916360ee) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::SetPrivate(v8::Local object, v8::Local key, v8::Local value); +``` + + +### Nan::DeletePrivate() + +A helper method for calling [`v8::Object#DeletePrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a138bb32a304f3982be02ad499693b8fd) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::DeletePrivate(v8::Local object, v8::Local key); +``` + + +### Nan::MakeMaybe() + +Wraps a `v8::Local<>` in a `Nan::MaybeLocal<>`. When called with a `Nan::MaybeLocal<>` it just returns its argument. This is useful in generic template code that builds on NAN. + +Synopsis: + +```c++ + MaybeLocal someNumber = MakeMaybe(New(3.141592654)); + MaybeLocal someString = MakeMaybe(New("probably")); +``` + +Signature: + +```c++ +template class MaybeMaybe> +Nan::MaybeLocal Nan::MakeMaybe(MaybeMaybe v); +``` diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/methods.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/methods.md new file mode 100644 index 0000000..9642d02 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/methods.md @@ -0,0 +1,664 @@ +## JavaScript-accessible methods + +A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information. + +In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. + +* **Method argument types** + - Nan::FunctionCallbackInfo + - Nan::PropertyCallbackInfo + - Nan::ReturnValue +* **Method declarations** + - Method declaration + - Getter declaration + - Setter declaration + - Property getter declaration + - Property setter declaration + - Property enumerator declaration + - Property deleter declaration + - Property query declaration + - Index getter declaration + - Index setter declaration + - Index enumerator declaration + - Index deleter declaration + - Index query declaration +* Method and template helpers + - Nan::SetMethod() + - Nan::SetPrototypeMethod() + - Nan::SetAccessor() + - Nan::SetNamedPropertyHandler() + - Nan::SetIndexedPropertyHandler() + - Nan::SetTemplate() + - Nan::SetPrototypeTemplate() + - Nan::SetInstanceTemplate() + - Nan::SetCallHandler() + - Nan::SetCallAsFunctionHandler() + + +### Nan::FunctionCallbackInfo + +`Nan::FunctionCallbackInfo` should be used in place of [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.16/dd/d0d/classv8_1_1_function_callback_info.html), even with older versions of Node where `v8::FunctionCallbackInfo` does not exist. + +Definition: + +```c++ +template class FunctionCallbackInfo { + public: + ReturnValue GetReturnValue() const; + v8::Local Callee(); // NOTE: Not available in NodeJS >= 10.0.0 + v8::Local Data(); + v8::Local Holder(); + bool IsConstructCall(); + int Length() const; + v8::Local operator[](int i) const; + v8::Local This() const; + v8::Isolate *GetIsolate() const; +}; +``` + +See the [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.16/dd/d0d/classv8_1_1_function_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from methods. + +**Note:** `FunctionCallbackInfo::Callee` is removed in Node.js after `10.0.0` because it is was deprecated in V8. Consider using `info.Data()` to pass any information you need. + + +### Nan::PropertyCallbackInfo + +`Nan::PropertyCallbackInfo` should be used in place of [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d7/dc5/classv8_1_1_property_callback_info.html), even with older versions of Node where `v8::PropertyCallbackInfo` does not exist. + +Definition: + +```c++ +template class PropertyCallbackInfo : public PropertyCallbackInfoBase { + public: + ReturnValue GetReturnValue() const; + v8::Isolate* GetIsolate() const; + v8::Local Data() const; + v8::Local This() const; + v8::Local Holder() const; +}; +``` + +See the [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d7/dc5/classv8_1_1_property_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from property accessor methods. + + +### Nan::ReturnValue + +`Nan::ReturnValue` is used in place of [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.16/da/da7/classv8_1_1_return_value.html) on both [`Nan::FunctionCallbackInfo`](#api_nan_function_callback_info) and [`Nan::PropertyCallbackInfo`](#api_nan_property_callback_info) as the return type of `GetReturnValue()`. + +Example usage: + +```c++ +void EmptyArray(const Nan::FunctionCallbackInfo& info) { + info.GetReturnValue().Set(Nan::New()); +} +``` + +Definition: + +```c++ +template class ReturnValue { + public: + // Handle setters + template void Set(const v8::Local &handle); + template void Set(const Nan::Global &handle); + + // Fast primitive setters + void Set(bool value); + void Set(double i); + void Set(int32_t i); + void Set(uint32_t i); + + // Fast JS primitive setters + void SetNull(); + void SetUndefined(); + void SetEmptyString(); + + // Convenience getter for isolate + v8::Isolate *GetIsolate() const; +}; +``` + +See the documentation on [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.16/da/da7/classv8_1_1_return_value.html) for further information on this. + + +### Method declaration + +JavaScript-accessible methods should be declared with the following signature to form a `Nan::FunctionCallback`: + +```c++ +typedef void(*FunctionCallback)(const FunctionCallbackInfo&); +``` + +Example: + +```c++ +void MethodName(const Nan::FunctionCallbackInfo& info) { + ... +} +``` + +You do not need to declare a new `HandleScope` within a method as one is implicitly created for you. + +**Example usage** + +```c++ +// .h: +class Foo : public Nan::ObjectWrap { + ... + + static void Bar(const Nan::FunctionCallbackInfo& info); + static void Baz(const Nan::FunctionCallbackInfo& info); +} + + +// .cc: +void Foo::Bar(const Nan::FunctionCallbackInfo& info) { + ... +} + +void Foo::Baz(const Nan::FunctionCallbackInfo& info) { + ... +} +``` + +A helper macro `NAN_METHOD(methodname)` exists, compatible with NAN v1 method declarations. + +**Example usage with `NAN_METHOD(methodname)`** + +```c++ +// .h: +class Foo : public Nan::ObjectWrap { + ... + + static NAN_METHOD(Bar); + static NAN_METHOD(Baz); +} + + +// .cc: +NAN_METHOD(Foo::Bar) { + ... +} + +NAN_METHOD(Foo::Baz) { + ... +} +``` + +Use [`Nan::SetPrototypeMethod`](#api_nan_set_prototype_method) to attach a method to a JavaScript function prototype or [`Nan::SetMethod`](#api_nan_set_method) to attach a method directly on a JavaScript object. + + +### Getter declaration + +JavaScript-accessible getters should be declared with the following signature to form a `Nan::GetterCallback`: + +```c++ +typedef void(*GetterCallback)(v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void GetterName(v8::Local property, + const Nan::PropertyCallbackInfo& info) { + ... +} +``` + +You do not need to declare a new `HandleScope` within a getter as one is implicitly created for you. + +A helper macro `NAN_GETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors). + + +### Setter declaration + +JavaScript-accessible setters should be declared with the following signature to form a Nan::SetterCallback: + +```c++ +typedef void(*SetterCallback)(v8::Local, + v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void SetterName(v8::Local property, + v8::Local value, + const Nan::PropertyCallbackInfo& info) { + ... +} +``` + +You do not need to declare a new `HandleScope` within a setter as one is implicitly created for you. + +A helper macro `NAN_SETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors). + + +### Property getter declaration + +JavaScript-accessible property getters should be declared with the following signature to form a Nan::PropertyGetterCallback: + +```c++ +typedef void(*PropertyGetterCallback)(v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void PropertyGetterName(v8::Local property, + const Nan::PropertyCallbackInfo& info) { + ... +} +``` + +You do not need to declare a new `HandleScope` within a property getter as one is implicitly created for you. + +A helper macro `NAN_PROPERTY_GETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Property setter declaration + +JavaScript-accessible property setters should be declared with the following signature to form a Nan::PropertySetterCallback: + +```c++ +typedef void(*PropertySetterCallback)(v8::Local, + v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void PropertySetterName(v8::Local property, + v8::Local value, + const Nan::PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a property setter as one is implicitly created for you. + +A helper macro `NAN_PROPERTY_SETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Property enumerator declaration + +JavaScript-accessible property enumerators should be declared with the following signature to form a Nan::PropertyEnumeratorCallback: + +```c++ +typedef void(*PropertyEnumeratorCallback)(const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void PropertyEnumeratorName(const Nan::PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a property enumerator as one is implicitly created for you. + +A helper macro `NAN_PROPERTY_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Property deleter declaration + +JavaScript-accessible property deleters should be declared with the following signature to form a Nan::PropertyDeleterCallback: + +```c++ +typedef void(*PropertyDeleterCallback)(v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void PropertyDeleterName(v8::Local property, + const Nan::PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a property deleter as one is implicitly created for you. + +A helper macro `NAN_PROPERTY_DELETER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Property query declaration + +JavaScript-accessible property query methods should be declared with the following signature to form a Nan::PropertyQueryCallback: + +```c++ +typedef void(*PropertyQueryCallback)(v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void PropertyQueryName(v8::Local property, + const Nan::PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a property query method as one is implicitly created for you. + +A helper macro `NAN_PROPERTY_QUERY(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Index getter declaration + +JavaScript-accessible index getter methods should be declared with the following signature to form a Nan::IndexGetterCallback: + +```c++ +typedef void(*IndexGetterCallback)(uint32_t, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void IndexGetterName(uint32_t index, const PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a index getter as one is implicitly created for you. + +A helper macro `NAN_INDEX_GETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Index setter declaration + +JavaScript-accessible index setter methods should be declared with the following signature to form a Nan::IndexSetterCallback: + +```c++ +typedef void(*IndexSetterCallback)(uint32_t, + v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void IndexSetterName(uint32_t index, + v8::Local value, + const PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a index setter as one is implicitly created for you. + +A helper macro `NAN_INDEX_SETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Index enumerator declaration + +JavaScript-accessible index enumerator methods should be declared with the following signature to form a Nan::IndexEnumeratorCallback: + +```c++ +typedef void(*IndexEnumeratorCallback)(const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void IndexEnumeratorName(const PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a index enumerator as one is implicitly created for you. + +A helper macro `NAN_INDEX_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Index deleter declaration + +JavaScript-accessible index deleter methods should be declared with the following signature to form a Nan::IndexDeleterCallback: + +```c++ +typedef void(*IndexDeleterCallback)(uint32_t, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void IndexDeleterName(uint32_t index, const PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a index deleter as one is implicitly created for you. + +A helper macro `NAN_INDEX_DELETER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Index query declaration + +JavaScript-accessible index query methods should be declared with the following signature to form a Nan::IndexQueryCallback: + +```c++ +typedef void(*IndexQueryCallback)(uint32_t, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void IndexQueryName(uint32_t index, const PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a index query method as one is implicitly created for you. + +A helper macro `NAN_INDEX_QUERY(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Nan::SetMethod() + +Sets a method with a given name directly on a JavaScript object where the method has the `Nan::FunctionCallback` signature (see Method declaration). + +Signature: + +```c++ +void Nan::SetMethod(v8::Local recv, + const char *name, + Nan::FunctionCallback callback, + v8::Local data = v8::Local()) +void Nan::SetMethod(v8::Local templ, + const char *name, + Nan::FunctionCallback callback, + v8::Local data = v8::Local()) +``` + + +### Nan::SetPrototypeMethod() + +Sets a method with a given name on a `FunctionTemplate`'s prototype where the method has the `Nan::FunctionCallback` signature (see Method declaration). + +Signature: + +```c++ +void Nan::SetPrototypeMethod(v8::Local recv, + const char* name, + Nan::FunctionCallback callback, + v8::Local data = v8::Local()) +``` + + +### Nan::SetAccessor() + +Sets getters and setters for a property with a given name on an `ObjectTemplate` or a plain `Object`. Accepts getters with the `Nan::GetterCallback` signature (see Getter declaration) and setters with the `Nan::SetterCallback` signature (see Setter declaration). + +Signature: + +```c++ +void SetAccessor(v8::Local tpl, + v8::Local name, + Nan::GetterCallback getter, + Nan::SetterCallback setter = 0, + v8::Local data = v8::Local(), + v8::AccessControl settings = v8::DEFAULT, + v8::PropertyAttribute attribute = v8::None, + imp::Sig signature = imp::Sig()); +bool SetAccessor(v8::Local obj, + v8::Local name, + Nan::GetterCallback getter, + Nan::SetterCallback setter = 0, + v8::Local data = v8::Local(), + v8::AccessControl settings = v8::DEFAULT, + v8::PropertyAttribute attribute = v8::None) +``` + +See the V8 [`ObjectTemplate#SetAccessor()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#aca0ed196f8a9adb1f68b1aadb6c9cd77) and [`Object#SetAccessor()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ae91b3b56b357f285288c89fbddc46d1b) for further information about how to use `Nan::SetAccessor()`. + + +### Nan::SetNamedPropertyHandler() + +Sets named property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts: + +* Property getters with the `Nan::PropertyGetterCallback` signature (see Property getter declaration) +* Property setters with the `Nan::PropertySetterCallback` signature (see Property setter declaration) +* Property query methods with the `Nan::PropertyQueryCallback` signature (see Property query declaration) +* Property deleters with the `Nan::PropertyDeleterCallback` signature (see Property deleter declaration) +* Property enumerators with the `Nan::PropertyEnumeratorCallback` signature (see Property enumerator declaration) + +Signature: + +```c++ +void SetNamedPropertyHandler(v8::Local tpl, + Nan::PropertyGetterCallback getter, + Nan::PropertySetterCallback setter = 0, + Nan::PropertyQueryCallback query = 0, + Nan::PropertyDeleterCallback deleter = 0, + Nan::PropertyEnumeratorCallback enumerator = 0, + v8::Local data = v8::Local()) +``` + +See the V8 [`ObjectTemplate#SetNamedPropertyHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#a33b3ebd7de641f6cc6414b7de01fc1c7) for further information about how to use `Nan::SetNamedPropertyHandler()`. + + +### Nan::SetIndexedPropertyHandler() + +Sets indexed property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts: + +* Indexed property getters with the `Nan::IndexGetterCallback` signature (see Index getter declaration) +* Indexed property setters with the `Nan::IndexSetterCallback` signature (see Index setter declaration) +* Indexed property query methods with the `Nan::IndexQueryCallback` signature (see Index query declaration) +* Indexed property deleters with the `Nan::IndexDeleterCallback` signature (see Index deleter declaration) +* Indexed property enumerators with the `Nan::IndexEnumeratorCallback` signature (see Index enumerator declaration) + +Signature: + +```c++ +void SetIndexedPropertyHandler(v8::Local tpl, + Nan::IndexGetterCallback getter, + Nan::IndexSetterCallback setter = 0, + Nan::IndexQueryCallback query = 0, + Nan::IndexDeleterCallback deleter = 0, + Nan::IndexEnumeratorCallback enumerator = 0, + v8::Local data = v8::Local()) +``` + +See the V8 [`ObjectTemplate#SetIndexedPropertyHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#ac89f06d634add0e890452033f7d17ff1) for further information about how to use `Nan::SetIndexedPropertyHandler()`. + + +### Nan::SetTemplate() + +Adds properties on an `Object`'s or `Function`'s template. + +Signature: + +```c++ +void Nan::SetTemplate(v8::Local templ, + const char *name, + v8::Local value); +void Nan::SetTemplate(v8::Local templ, + v8::Local name, + v8::Local value, + v8::PropertyAttribute attributes) +``` + +Calls the `Template`'s [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#ae3fbaff137557aa6a0233bc7e52214ac). + + +### Nan::SetPrototypeTemplate() + +Adds properties on an `Object`'s or `Function`'s prototype template. + +Signature: + +```c++ +void Nan::SetPrototypeTemplate(v8::Local templ, + const char *name, + v8::Local value); +void Nan::SetPrototypeTemplate(v8::Local templ, + v8::Local name, + v8::Local value, + v8::PropertyAttribute attributes) +``` + +Calls the `FunctionTemplate`'s _PrototypeTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf). + + +### Nan::SetInstanceTemplate() + +Use to add instance properties on `FunctionTemplate`'s. + +Signature: + +```c++ +void Nan::SetInstanceTemplate(v8::Local templ, + const char *name, + v8::Local value); +void Nan::SetInstanceTemplate(v8::Local templ, + v8::Local name, + v8::Local value, + v8::PropertyAttribute attributes) +``` + +Calls the `FunctionTemplate`'s _InstanceTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf). + + +### Nan::SetCallHandler() + +Set the call-handler callback for a `v8::FunctionTemplate`. +This callback is called whenever the function created from this FunctionTemplate is called. + +Signature: + +```c++ +void Nan::SetCallHandler(v8::Local templ, Nan::FunctionCallback callback, v8::Local data = v8::Local()) +``` + +Calls the `FunctionTemplate`'s [`SetCallHandler()`](https://v8docs.nodesource.com/node-8.16/d8/d83/classv8_1_1_function_template.html#ab7574b298db3c27fbc2ed465c08ea2f8). + + +### Nan::SetCallAsFunctionHandler() + +Sets the callback to be used when calling instances created from the `v8::ObjectTemplate` as a function. +If no callback is set, instances behave like normal JavaScript objects that cannot be called as a function. + +Signature: + +```c++ +void Nan::SetCallAsFunctionHandler(v8::Local templ, Nan::FunctionCallback callback, v8::Local data = v8::Local()) +``` + +Calls the `ObjectTemplate`'s [`SetCallAsFunctionHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#a5e9612fc80bf6db8f2da199b9b0bd04e). + diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/new.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/new.md new file mode 100644 index 0000000..0f28a0e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/new.md @@ -0,0 +1,147 @@ +## New + +NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. + + - Nan::New() + - Nan::Undefined() + - Nan::Null() + - Nan::True() + - Nan::False() + - Nan::EmptyString() + + + +### Nan::New() + +`Nan::New()` should be used to instantiate new JavaScript objects. + +Refer to the specific V8 type in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/d1/d83/classv8_1_1_data.html) for information on the types of arguments required for instantiation. + +Signatures: + +Return types are mostly omitted from the signatures for simplicity. In most cases the type will be contained within a `v8::Local`. The following types will be contained within a `Nan::MaybeLocal`: `v8::String`, `v8::Date`, `v8::RegExp`, `v8::Script`, `v8::UnboundScript`. + +Empty objects: + +```c++ +Nan::New(); +``` + +Generic single and multiple-argument: + +```c++ +Nan::New(A0 arg0); +Nan::New(A0 arg0, A1 arg1); +Nan::New(A0 arg0, A1 arg1, A2 arg2); +Nan::New(A0 arg0, A1 arg1, A2 arg2, A3 arg3); +``` + +For creating `v8::FunctionTemplate` and `v8::Function` objects: + +_The definition of `Nan::FunctionCallback` can be found in the [Method declaration](./methods.md#api_nan_method) documentation._ + +```c++ +Nan::New(Nan::FunctionCallback callback, + v8::Local data = v8::Local()); +Nan::New(Nan::FunctionCallback callback, + v8::Local data = v8::Local(), + A2 a2 = A2()); +``` + +Native number types: + +```c++ +v8::Local Nan::New(bool value); +v8::Local Nan::New(int32_t value); +v8::Local Nan::New(uint32_t value); +v8::Local Nan::New(double value); +``` + +String types: + +```c++ +Nan::MaybeLocal Nan::New(std::string const& value); +Nan::MaybeLocal Nan::New(const char * value, int length); +Nan::MaybeLocal Nan::New(const char * value); +Nan::MaybeLocal Nan::New(const uint16_t * value); +Nan::MaybeLocal Nan::New(const uint16_t * value, int length); +``` + +Specialized types: + +```c++ +v8::Local Nan::New(v8::String::ExternalStringResource * value); +v8::Local Nan::New(Nan::ExternalOneByteStringResource * value); +v8::Local Nan::New(v8::Local pattern, v8::RegExp::Flags flags); +``` + +Note that `Nan::ExternalOneByteStringResource` maps to [`v8::String::ExternalOneByteStringResource`](https://v8docs.nodesource.com/node-8.16/d9/db3/classv8_1_1_string_1_1_external_one_byte_string_resource.html), and `v8::String::ExternalAsciiStringResource` in older versions of V8. + + + +### Nan::Undefined() + +A helper method to reference the `v8::Undefined` object in a way that is compatible across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::Undefined() +``` + + +### Nan::Null() + +A helper method to reference the `v8::Null` object in a way that is compatible across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::Null() +``` + + +### Nan::True() + +A helper method to reference the `v8::Boolean` object representing the `true` value in a way that is compatible across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::True() +``` + + +### Nan::False() + +A helper method to reference the `v8::Boolean` object representing the `false` value in a way that is compatible across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::False() +``` + + +### Nan::EmptyString() + +Call [`v8::String::Empty`](https://v8docs.nodesource.com/node-8.16/d2/db3/classv8_1_1_string.html#a7c1bc8886115d7ee46f1d571dd6ebc6d) to reference the empty string in a way that is compatible across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::EmptyString() +``` + + + +### Nan::NewOneByteString() + +An implementation of [`v8::String::NewFromOneByte()`](https://v8docs.nodesource.com/node-8.16/d2/db3/classv8_1_1_string.html#a5264d50b96d2c896ce525a734dc10f09) provided for consistent availability and API across supported versions of V8. Allocates a new string from Latin-1 data. + +Signature: + +```c++ +Nan::MaybeLocal Nan::NewOneByteString(const uint8_t * value, + int length = -1) +``` diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/node_misc.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/node_misc.md new file mode 100644 index 0000000..17578e3 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/node_misc.md @@ -0,0 +1,123 @@ +## Miscellaneous Node Helpers + + - Nan::AsyncResource + - Nan::MakeCallback() + - NAN_MODULE_INIT() + - Nan::Export() + + +### Nan::AsyncResource + +This class is analogous to the `AsyncResource` JavaScript class exposed by Node's [async_hooks][] API. + +When calling back into JavaScript asynchronously, special care must be taken to ensure that the runtime can properly track +async hops. `Nan::AsyncResource` is a class that provides an RAII wrapper around `node::EmitAsyncInit`, `node::EmitAsyncDestroy`, +and `node::MakeCallback`. Using this mechanism to call back into JavaScript, as opposed to `Nan::MakeCallback` or +`v8::Function::Call` ensures that the callback is executed in the correct async context. This ensures that async mechanisms +such as domains and [async_hooks][] function correctly. + +Definition: + +```c++ +class AsyncResource { + public: + AsyncResource(v8::Local name, + v8::Local resource = New()); + AsyncResource(const char* name, + v8::Local resource = New()); + ~AsyncResource(); + + v8::MaybeLocal runInAsyncScope(v8::Local target, + v8::Local func, + int argc, + v8::Local* argv); + v8::MaybeLocal runInAsyncScope(v8::Local target, + v8::Local symbol, + int argc, + v8::Local* argv); + v8::MaybeLocal runInAsyncScope(v8::Local target, + const char* method, + int argc, + v8::Local* argv); +}; +``` + +* `name`: Identifier for the kind of resource that is being provided for diagnostics information exposed by the [async_hooks][] + API. This will be passed to the possible `init` hook as the `type`. To avoid name collisions with other modules we recommend + that the name include the name of the owning module as a prefix. For example `mysql` module could use something like + `mysql:batch-db-query-resource`. +* `resource`: An optional object associated with the async work that will be passed to the possible [async_hooks][] + `init` hook. If this parameter is omitted, or an empty handle is provided, this object will be created automatically. +* When calling JS on behalf of this resource, one can use `runInAsyncScope`. This will ensure that the callback runs in the + correct async execution context. +* `AsyncDestroy` is automatically called when an AsyncResource object is destroyed. + +For more details, see the Node [async_hooks][] documentation. You might also want to take a look at the documentation for the +[N-API counterpart][napi]. For example usage, see the `asyncresource.cpp` example in the `test/cpp` directory. + + +### Nan::MakeCallback() + +Deprecated wrappers around the legacy `node::MakeCallback()` APIs. Node.js 10+ +has deprecated these legacy APIs as they do not provide a mechanism to preserve +async context. + +We recommend that you use the `AsyncResource` class and `AsyncResource::runInAsyncScope` instead of using `Nan::MakeCallback` or +`v8::Function#Call()` directly. `AsyncResource` properly takes care of running the callback in the correct async execution +context – something that is essential for functionality like domains, async_hooks and async debugging. + +Signatures: + +```c++ +NAN_DEPRECATED +v8::Local Nan::MakeCallback(v8::Local target, + v8::Local func, + int argc, + v8::Local* argv); +NAN_DEPRECATED +v8::Local Nan::MakeCallback(v8::Local target, + v8::Local symbol, + int argc, + v8::Local* argv); +NAN_DEPRECATED +v8::Local Nan::MakeCallback(v8::Local target, + const char* method, + int argc, + v8::Local* argv); +``` + + + +### NAN_MODULE_INIT() + +Used to define the entry point function to a Node add-on. Creates a function with a given `name` that receives a `target` object representing the equivalent of the JavaScript `exports` object. + +See example below. + + +### Nan::Export() + +A simple helper to register a `v8::FunctionTemplate` from a JavaScript-accessible method (see [Methods](./methods.md)) as a property on an object. Can be used in a way similar to assigning properties to `module.exports` in JavaScript. + +Signature: + +```c++ +void Export(v8::Local target, const char *name, Nan::FunctionCallback f) +``` + +Also available as the shortcut `NAN_EXPORT` macro. + +Example: + +```c++ +NAN_METHOD(Foo) { + ... +} + +NAN_MODULE_INIT(Init) { + NAN_EXPORT(target, Foo); +} +``` + +[async_hooks]: https://nodejs.org/dist/latest-v9.x/docs/api/async_hooks.html +[napi]: https://nodejs.org/dist/latest-v9.x/docs/api/n-api.html#n_api_custom_asynchronous_operations diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/object_wrappers.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/object_wrappers.md new file mode 100644 index 0000000..07d8c05 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/object_wrappers.md @@ -0,0 +1,263 @@ +## Object Wrappers + +The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects. + + - Nan::ObjectWrap + + + +### Nan::ObjectWrap() + +A reimplementation of `node::ObjectWrap` that adds some API not present in older versions of Node. Should be preferred over `node::ObjectWrap` in all cases for consistency. + +Definition: + +```c++ +class ObjectWrap { + public: + ObjectWrap(); + + virtual ~ObjectWrap(); + + template + static inline T* Unwrap(v8::Local handle); + + inline v8::Local handle(); + + inline Nan::Persistent& persistent(); + + protected: + inline void Wrap(v8::Local handle); + + inline void MakeWeak(); + + /* Ref() marks the object as being attached to an event loop. + * Refed objects will not be garbage collected, even if + * all references are lost. + */ + virtual void Ref(); + + /* Unref() marks an object as detached from the event loop. This is its + * default state. When an object with a "weak" reference changes from + * attached to detached state it will be freed. Be careful not to access + * the object after making this call as it might be gone! + * (A "weak reference" means an object that only has a + * persistent handle.) + * + * DO NOT CALL THIS FROM DESTRUCTOR + */ + virtual void Unref(); + + int refs_; // ro +}; +``` + +See the Node documentation on [Wrapping C++ Objects](https://nodejs.org/api/addons.html#addons_wrapping_c_objects) for more details. + +### This vs. Holder + +When calling `Unwrap`, it is important that the argument is indeed some JavaScript object which got wrapped by a `Wrap` call for this class or any derived class. +The `Signature` installed by [`Nan::SetPrototypeMethod()`](methods.md#api_nan_set_prototype_method) does ensure that `info.Holder()` is just such an instance. +In Node 0.12 and later, `info.This()` will also be of such a type, since otherwise the invocation will get rejected. +However, in Node 0.10 and before it was possible to invoke a method on a JavaScript object which just had the extension type in its prototype chain. +In such a situation, calling `Unwrap` on `info.This()` will likely lead to a failed assertion causing a crash, but could lead to even more serious corruption. + +On the other hand, calling `Unwrap` in an [accessor](methods.md#api_nan_set_accessor) should not use `Holder()` if the accessor is defined on the prototype. +So either define your accessors on the instance template, +or use `This()` after verifying that it is indeed a valid object. + +### Examples + +#### Basic + +```c++ +class MyObject : public Nan::ObjectWrap { + public: + static NAN_MODULE_INIT(Init) { + v8::Local tpl = Nan::New(New); + tpl->SetClassName(Nan::New("MyObject").ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + Nan::SetPrototypeMethod(tpl, "getHandle", GetHandle); + Nan::SetPrototypeMethod(tpl, "getValue", GetValue); + + constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); + Nan::Set(target, Nan::New("MyObject").ToLocalChecked(), + Nan::GetFunction(tpl).ToLocalChecked()); + } + + private: + explicit MyObject(double value = 0) : value_(value) {} + ~MyObject() {} + + static NAN_METHOD(New) { + if (info.IsConstructCall()) { + double value = info[0]->IsUndefined() ? 0 : Nan::To(info[0]).FromJust(); + MyObject *obj = new MyObject(value); + obj->Wrap(info.This()); + info.GetReturnValue().Set(info.This()); + } else { + const int argc = 1; + v8::Local argv[argc] = {info[0]}; + v8::Local cons = Nan::New(constructor()); + info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); + } + } + + static NAN_METHOD(GetHandle) { + MyObject* obj = Nan::ObjectWrap::Unwrap(info.Holder()); + info.GetReturnValue().Set(obj->handle()); + } + + static NAN_METHOD(GetValue) { + MyObject* obj = Nan::ObjectWrap::Unwrap(info.Holder()); + info.GetReturnValue().Set(obj->value_); + } + + static inline Nan::Persistent & constructor() { + static Nan::Persistent my_constructor; + return my_constructor; + } + + double value_; +}; + +NODE_MODULE(objectwrapper, MyObject::Init) +``` + +To use in Javascript: + +```Javascript +var objectwrapper = require('bindings')('objectwrapper'); + +var obj = new objectwrapper.MyObject(5); +console.log('Should be 5: ' + obj.getValue()); +``` + +#### Factory of wrapped objects + +```c++ +class MyFactoryObject : public Nan::ObjectWrap { + public: + static NAN_MODULE_INIT(Init) { + v8::Local tpl = Nan::New(New); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + Nan::SetPrototypeMethod(tpl, "getValue", GetValue); + + constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); + } + + static NAN_METHOD(NewInstance) { + v8::Local cons = Nan::New(constructor()); + double value = info[0]->IsNumber() ? Nan::To(info[0]).FromJust() : 0; + const int argc = 1; + v8::Local argv[1] = {Nan::New(value)}; + info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); + } + + // Needed for the next example: + inline double value() const { + return value_; + } + + private: + explicit MyFactoryObject(double value = 0) : value_(value) {} + ~MyFactoryObject() {} + + static NAN_METHOD(New) { + if (info.IsConstructCall()) { + double value = info[0]->IsNumber() ? Nan::To(info[0]).FromJust() : 0; + MyFactoryObject * obj = new MyFactoryObject(value); + obj->Wrap(info.This()); + info.GetReturnValue().Set(info.This()); + } else { + const int argc = 1; + v8::Local argv[argc] = {info[0]}; + v8::Local cons = Nan::New(constructor()); + info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); + } + } + + static NAN_METHOD(GetValue) { + MyFactoryObject* obj = ObjectWrap::Unwrap(info.Holder()); + info.GetReturnValue().Set(obj->value_); + } + + static inline Nan::Persistent & constructor() { + static Nan::Persistent my_constructor; + return my_constructor; + } + + double value_; +}; + +NAN_MODULE_INIT(Init) { + MyFactoryObject::Init(target); + Nan::Set(target, + Nan::New("newFactoryObjectInstance").ToLocalChecked(), + Nan::GetFunction( + Nan::New(MyFactoryObject::NewInstance)).ToLocalChecked() + ); +} + +NODE_MODULE(wrappedobjectfactory, Init) +``` + +To use in Javascript: + +```Javascript +var wrappedobjectfactory = require('bindings')('wrappedobjectfactory'); + +var obj = wrappedobjectfactory.newFactoryObjectInstance(10); +console.log('Should be 10: ' + obj.getValue()); +``` + +#### Passing wrapped objects around + +Use the `MyFactoryObject` class above along with the following: + +```c++ +static NAN_METHOD(Sum) { + Nan::MaybeLocal maybe1 = Nan::To(info[0]); + Nan::MaybeLocal maybe2 = Nan::To(info[1]); + + // Quick check: + if (maybe1.IsEmpty() || maybe2.IsEmpty()) { + // return value is undefined by default + return; + } + + MyFactoryObject* obj1 = + Nan::ObjectWrap::Unwrap(maybe1.ToLocalChecked()); + MyFactoryObject* obj2 = + Nan::ObjectWrap::Unwrap(maybe2.ToLocalChecked()); + + info.GetReturnValue().Set(Nan::New(obj1->value() + obj2->value())); +} + +NAN_MODULE_INIT(Init) { + MyFactoryObject::Init(target); + Nan::Set(target, + Nan::New("newFactoryObjectInstance").ToLocalChecked(), + Nan::GetFunction( + Nan::New(MyFactoryObject::NewInstance)).ToLocalChecked() + ); + Nan::Set(target, + Nan::New("sum").ToLocalChecked(), + Nan::GetFunction(Nan::New(Sum)).ToLocalChecked() + ); +} + +NODE_MODULE(myaddon, Init) +``` + +To use in Javascript: + +```Javascript +var myaddon = require('bindings')('myaddon'); + +var obj1 = myaddon.newFactoryObjectInstance(5); +var obj2 = myaddon.newFactoryObjectInstance(10); +console.log('sum of object values: ' + myaddon.sum(obj1, obj2)); +``` diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/persistent.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/persistent.md new file mode 100644 index 0000000..2e13f6b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/persistent.md @@ -0,0 +1,296 @@ +## Persistent references + +An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. + +Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. + + - Nan::PersistentBase & v8::PersistentBase + - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits + - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits + - Nan::Persistent + - Nan::Global + - Nan::WeakCallbackInfo + - Nan::WeakCallbackType + +Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). + + +### Nan::PersistentBase & v8::PersistentBase + +A persistent handle contains a reference to a storage cell in V8 which holds an object value and which is updated by the garbage collector whenever the object is moved. A new storage cell can be created using the constructor or `Nan::PersistentBase::Reset()`. Existing handles can be disposed using an argument-less `Nan::PersistentBase::Reset()`. + +Definition: + +_(note: this is implemented as `Nan::PersistentBase` for older versions of V8 and the native `v8::PersistentBase` is used for newer versions of V8)_ + +```c++ +template class PersistentBase { + public: + /** + * If non-empty, destroy the underlying storage cell + */ + void Reset(); + + /** + * If non-empty, destroy the underlying storage cell and create a new one with + * the contents of another if it is also non-empty + */ + template void Reset(const v8::Local &other); + + /** + * If non-empty, destroy the underlying storage cell and create a new one with + * the contents of another if it is also non-empty + */ + template void Reset(const PersistentBase &other); + + /** Returns true if the handle is empty. */ + bool IsEmpty() const; + + /** + * If non-empty, destroy the underlying storage cell + * IsEmpty() will return true after this call. + */ + void Empty(); + + template bool operator==(const PersistentBase &that); + + template bool operator==(const v8::Local &that); + + template bool operator!=(const PersistentBase &that); + + template bool operator!=(const v8::Local &that); + + /** + * Install a finalization callback on this object. + * NOTE: There is no guarantee as to *when* or even *if* the callback is + * invoked. The invocation is performed solely on a best effort basis. + * As always, GC-based finalization should *not* be relied upon for any + * critical form of resource management! At the moment you can either + * specify a parameter for the callback or the location of two internal + * fields in the dying object. + */ + template + void SetWeak(P *parameter, + typename WeakCallbackInfo

::Callback callback, + WeakCallbackType type); + + void ClearWeak(); + + /** + * Marks the reference to this object independent. Garbage collector is free + * to ignore any object groups containing this object. Weak callback for an + * independent handle should not assume that it will be preceded by a global + * GC prologue callback or followed by a global GC epilogue callback. + */ + void MarkIndependent() const; + + bool IsIndependent() const; + + /** Checks if the handle holds the only reference to an object. */ + bool IsNearDeath() const; + + /** Returns true if the handle's reference is weak. */ + bool IsWeak() const +}; +``` + +See the V8 documentation for [`PersistentBase`](https://v8docs.nodesource.com/node-8.16/d4/dca/classv8_1_1_persistent_base.html) for further information. + +**Tip:** To get a `v8::Local` reference to the original object back from a `PersistentBase` or `Persistent` object: + +```c++ +v8::Local object = Nan::New(persistent); +``` + + +### Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits + +Default traits for `Nan::Persistent`. This class does not allow use of the a copy constructor or assignment operator. At present `kResetInDestructor` is not set, but that will change in a future version. + +Definition: + +_(note: this is implemented as `Nan::NonCopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_ + +```c++ +template class NonCopyablePersistentTraits { + public: + typedef Persistent > NonCopyablePersistent; + + static const bool kResetInDestructor = false; + + template + static void Copy(const Persistent &source, + NonCopyablePersistent *dest); + + template static void Uncompilable(); +}; +``` + +See the V8 documentation for [`NonCopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.16/de/d73/classv8_1_1_non_copyable_persistent_traits.html) for further information. + + +### Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits + +A helper class of traits to allow copying and assignment of `Persistent`. This will clone the contents of storage cell, but not any of the flags, etc.. + +Definition: + +_(note: this is implemented as `Nan::CopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_ + +```c++ +template +class CopyablePersistentTraits { + public: + typedef Persistent > CopyablePersistent; + + static const bool kResetInDestructor = true; + + template + static void Copy(const Persistent &source, + CopyablePersistent *dest); +}; +``` + +See the V8 documentation for [`CopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.16/da/d5c/structv8_1_1_copyable_persistent_traits.html) for further information. + + +### Nan::Persistent + +A type of `PersistentBase` which allows copy and assignment. Copy, assignment and destructor behavior is controlled by the traits class `M`. + +Definition: + +```c++ +template > +class Persistent; + +template class Persistent : public PersistentBase { + public: + /** + * A Persistent with no storage cell. + */ + Persistent(); + + /** + * Construct a Persistent from a v8::Local. When the v8::Local is non-empty, a + * new storage cell is created pointing to the same object, and no flags are + * set. + */ + template Persistent(v8::Local that); + + /** + * Construct a Persistent from a Persistent. When the Persistent is non-empty, + * a new storage cell is created pointing to the same object, and no flags are + * set. + */ + Persistent(const Persistent &that); + + /** + * The copy constructors and assignment operator create a Persistent exactly + * as the Persistent constructor, but the Copy function from the traits class + * is called, allowing the setting of flags based on the copied Persistent. + */ + Persistent &operator=(const Persistent &that); + + template + Persistent &operator=(const Persistent &that); + + /** + * The destructor will dispose the Persistent based on the kResetInDestructor + * flags in the traits class. Since not calling dispose can result in a + * memory leak, it is recommended to always set this flag. + */ + ~Persistent(); +}; +``` + +See the V8 documentation for [`Persistent`](https://v8docs.nodesource.com/node-8.16/d2/d78/classv8_1_1_persistent.html) for further information. + + +### Nan::Global + +A type of `PersistentBase` which has move semantics. + +```c++ +template class Global : public PersistentBase { + public: + /** + * A Global with no storage cell. + */ + Global(); + + /** + * Construct a Global from a v8::Local. When the v8::Local is non-empty, a new + * storage cell is created pointing to the same object, and no flags are set. + */ + template Global(v8::Local that); + /** + * Construct a Global from a PersistentBase. When the Persistent is non-empty, + * a new storage cell is created pointing to the same object, and no flags are + * set. + */ + template Global(const PersistentBase &that); + + /** + * Pass allows returning globals from functions, etc. + */ + Global Pass(); +}; +``` + +See the V8 documentation for [`Global`](https://v8docs.nodesource.com/node-8.16/d5/d40/classv8_1_1_global.html) for further information. + + +### Nan::WeakCallbackInfo + +`Nan::WeakCallbackInfo` is used as an argument when setting a persistent reference as weak. You may need to free any external resources attached to the object. It is a mirror of `v8:WeakCallbackInfo` as found in newer versions of V8. + +Definition: + +```c++ +template class WeakCallbackInfo { + public: + typedef void (*Callback)(const WeakCallbackInfo& data); + + v8::Isolate *GetIsolate() const; + + /** + * Get the parameter that was associated with the weak handle. + */ + T *GetParameter() const; + + /** + * Get pointer from internal field, index can be 0 or 1. + */ + void *GetInternalField(int index) const; +}; +``` + +Example usage: + +```c++ +void weakCallback(const WeakCallbackInfo &data) { + int *parameter = data.GetParameter(); + delete parameter; +} + +Persistent obj; +int *data = new int(0); +obj.SetWeak(data, callback, WeakCallbackType::kParameter); +``` + +See the V8 documentation for [`WeakCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d8/d06/classv8_1_1_weak_callback_info.html) for further information. + + +### Nan::WeakCallbackType + +Represents the type of a weak callback. +A weak callback of type `kParameter` makes the supplied parameter to `Nan::PersistentBase::SetWeak` available through `WeakCallbackInfo::GetParameter`. +A weak callback of type `kInternalFields` uses up to two internal fields at indices 0 and 1 on the `Nan::PersistentBase` being made weak. +Note that only `v8::Object`s and derivatives can have internal fields. + +Definition: + +```c++ +enum class WeakCallbackType { kParameter, kInternalFields }; +``` diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/scopes.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/scopes.md new file mode 100644 index 0000000..84000ee --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/scopes.md @@ -0,0 +1,73 @@ +## Scopes + +A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. + +A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. + +The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. + + - Nan::HandleScope + - Nan::EscapableHandleScope + +Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection). + + +### Nan::HandleScope + +A simple wrapper around [`v8::HandleScope`](https://v8docs.nodesource.com/node-8.16/d3/d95/classv8_1_1_handle_scope.html). + +Definition: + +```c++ +class Nan::HandleScope { + public: + Nan::HandleScope(); + static int NumberOfHandles(); +}; +``` + +Allocate a new `Nan::HandleScope` whenever you are creating new V8 JavaScript objects. Note that an implicit `HandleScope` is created for you on JavaScript-accessible methods so you do not need to insert one yourself. + +Example: + +```c++ +// new object is created, it needs a new scope: +void Pointless() { + Nan::HandleScope scope; + v8::Local obj = Nan::New(); +} + +// JavaScript-accessible method already has a HandleScope +NAN_METHOD(Pointless2) { + v8::Local obj = Nan::New(); +} +``` + + +### Nan::EscapableHandleScope + +Similar to [`Nan::HandleScope`](#api_nan_handle_scope) but should be used in cases where a function needs to return a V8 JavaScript type that has been created within it. + +Definition: + +```c++ +class Nan::EscapableHandleScope { + public: + Nan::EscapableHandleScope(); + static int NumberOfHandles(); + template v8::Local Escape(v8::Local value); +} +``` + +Use `Escape(value)` to return the object. + +Example: + +```c++ +v8::Local EmptyObj() { + Nan::EscapableHandleScope scope; + v8::Local obj = Nan::New(); + return scope.Escape(obj); +} +``` + diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/script.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/script.md new file mode 100644 index 0000000..213320a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/script.md @@ -0,0 +1,38 @@ +## Script + +NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. + + - Nan::CompileScript() + - Nan::RunScript() + + + +### Nan::CompileScript() + +A wrapper around [`v8::ScriptCompiler::Compile()`](https://v8docs.nodesource.com/node-8.16/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b). + +Note that `Nan::BoundScript` is an alias for `v8::Script`. + +Signature: + +```c++ +Nan::MaybeLocal Nan::CompileScript( + v8::Local s, + const v8::ScriptOrigin& origin); +Nan::MaybeLocal Nan::CompileScript(v8::Local s); +``` + + + +### Nan::RunScript() + +Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`. + +Note that `Nan::BoundScript` is an alias for `v8::Script` and `Nan::UnboundScript` is an alias for `v8::UnboundScript` where available and `v8::Script` on older versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::RunScript(v8::Local script) +Nan::MaybeLocal Nan::RunScript(v8::Local script) +``` diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/string_bytes.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/string_bytes.md new file mode 100644 index 0000000..7c1bd32 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/string_bytes.md @@ -0,0 +1,62 @@ +## Strings & Bytes + +Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. + + - Nan::Encoding + - Nan::Encode() + - Nan::DecodeBytes() + - Nan::DecodeWrite() + + + +### Nan::Encoding + +An enum representing the supported encoding types. A copy of `node::encoding` that is consistent across versions of Node. + +Definition: + +```c++ +enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER } +``` + + + +### Nan::Encode() + +A wrapper around `node::Encode()` that provides a consistent implementation across supported versions of Node. + +Signature: + +```c++ +v8::Local Nan::Encode(const void *buf, + size_t len, + enum Nan::Encoding encoding = BINARY); +``` + + + +### Nan::DecodeBytes() + +A wrapper around `node::DecodeBytes()` that provides a consistent implementation across supported versions of Node. + +Signature: + +```c++ +ssize_t Nan::DecodeBytes(v8::Local val, + enum Nan::Encoding encoding = BINARY); +``` + + + +### Nan::DecodeWrite() + +A wrapper around `node::DecodeWrite()` that provides a consistent implementation across supported versions of Node. + +Signature: + +```c++ +ssize_t Nan::DecodeWrite(char *buf, + size_t len, + v8::Local val, + enum Nan::Encoding encoding = BINARY); +``` diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/v8_internals.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/v8_internals.md new file mode 100644 index 0000000..08dd6d0 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/v8_internals.md @@ -0,0 +1,199 @@ +## V8 internals + +The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. + + - NAN_GC_CALLBACK() + - Nan::AddGCEpilogueCallback() + - Nan::RemoveGCEpilogueCallback() + - Nan::AddGCPrologueCallback() + - Nan::RemoveGCPrologueCallback() + - Nan::GetHeapStatistics() + - Nan::SetCounterFunction() + - Nan::SetCreateHistogramFunction() + - Nan::SetAddHistogramSampleFunction() + - Nan::IdleNotification() + - Nan::LowMemoryNotification() + - Nan::ContextDisposedNotification() + - Nan::GetInternalFieldPointer() + - Nan::SetInternalFieldPointer() + - Nan::AdjustExternalMemory() + + + +### NAN_GC_CALLBACK(callbackname) + +Use `NAN_GC_CALLBACK` to declare your callbacks for `Nan::AddGCPrologueCallback()` and `Nan::AddGCEpilogueCallback()`. Your new method receives the arguments `v8::GCType type` and `v8::GCCallbackFlags flags`. + +```c++ +static Nan::Persistent callback; + +NAN_GC_CALLBACK(gcPrologueCallback) { + v8::Local argv[] = { Nan::New("prologue").ToLocalChecked() }; + Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(callback), 1, argv); +} + +NAN_METHOD(Hook) { + callback.Reset(To(args[0]).ToLocalChecked()); + Nan::AddGCPrologueCallback(gcPrologueCallback); + info.GetReturnValue().Set(info.Holder()); +} +``` + + +### Nan::AddGCEpilogueCallback() + +Signature: + +```c++ +void Nan::AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, v8::GCType gc_type_filter = v8::kGCTypeAll) +``` + +Calls V8's [`AddGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a580f976e4290cead62c2fc4dd396be3e). + + +### Nan::RemoveGCEpilogueCallback() + +Signature: + +```c++ +void Nan::RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback) +``` + +Calls V8's [`RemoveGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#adca9294555a3908e9f23c7bb0f0f284c). + + +### Nan::AddGCPrologueCallback() + +Signature: + +```c++ +void Nan::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback, v8::GCType gc_type_filter callback) +``` + +Calls V8's [`AddGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a6dbef303603ebdb03da6998794ea05b8). + + +### Nan::RemoveGCPrologueCallback() + +Signature: + +```c++ +void Nan::RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback) +``` + +Calls V8's [`RemoveGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5f72c7cda21415ce062bbe5c58abe09e). + + +### Nan::GetHeapStatistics() + +Signature: + +```c++ +void Nan::GetHeapStatistics(v8::HeapStatistics *heap_statistics) +``` + +Calls V8's [`GetHeapStatistics()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5593ac74687b713095c38987e5950b34). + + +### Nan::SetCounterFunction() + +Signature: + +```c++ +void Nan::SetCounterFunction(v8::CounterLookupCallback cb) +``` + +Calls V8's [`SetCounterFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a045d7754e62fa0ec72ae6c259b29af94). + + +### Nan::SetCreateHistogramFunction() + +Signature: + +```c++ +void Nan::SetCreateHistogramFunction(v8::CreateHistogramCallback cb) +``` + +Calls V8's [`SetCreateHistogramFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a542d67e85089cb3f92aadf032f99e732). + + +### Nan::SetAddHistogramSampleFunction() + +Signature: + +```c++ +void Nan::SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) +``` + +Calls V8's [`SetAddHistogramSampleFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aeb420b690bc2c216882d6fdd00ddd3ea). + + +### Nan::IdleNotification() + +Signature: + +```c++ +bool Nan::IdleNotification(int idle_time_in_ms) +``` + +Calls V8's [`IdleNotification()` or `IdleNotificationDeadline()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad6a2a02657f5425ad460060652a5a118) depending on V8 version. + + +### Nan::LowMemoryNotification() + +Signature: + +```c++ +void Nan::LowMemoryNotification() +``` + +Calls V8's [`LowMemoryNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a24647f61d6b41f69668094bdcd6ea91f). + + +### Nan::ContextDisposedNotification() + +Signature: + +```c++ +void Nan::ContextDisposedNotification() +``` + +Calls V8's [`ContextDisposedNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad7f5dc559866343fe6cd8db1f134d48b). + + +### Nan::GetInternalFieldPointer() + +Gets a pointer to the internal field with at `index` from a V8 `Object` handle. + +Signature: + +```c++ +void* Nan::GetInternalFieldPointer(v8::Local object, int index) +``` + +Calls the Object's [`GetAlignedPointerFromInternalField()` or `GetPointerFromInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a580ea84afb26c005d6762eeb9e3c308f) depending on the version of V8. + + +### Nan::SetInternalFieldPointer() + +Sets the value of the internal field at `index` on a V8 `Object` handle. + +Signature: + +```c++ +void Nan::SetInternalFieldPointer(v8::Local object, int index, void* value) +``` + +Calls the Object's [`SetAlignedPointerInInternalField()` or `SetPointerInInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab3c57184263cf29963ef0017bec82281) depending on the version of V8. + + +### Nan::AdjustExternalMemory() + +Signature: + +```c++ +int Nan::AdjustExternalMemory(int bytesChange) +``` + +Calls V8's [`AdjustAmountOfExternalAllocatedMemory()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ae1a59cac60409d3922582c4af675473e). + diff --git a/legacy-libs/grpc-cloned/node_modules/nan/doc/v8_misc.md b/legacy-libs/grpc-cloned/node_modules/nan/doc/v8_misc.md new file mode 100644 index 0000000..1bd46d3 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/doc/v8_misc.md @@ -0,0 +1,85 @@ +## Miscellaneous V8 Helpers + + - Nan::Utf8String + - Nan::GetCurrentContext() + - Nan::SetIsolateData() + - Nan::GetIsolateData() + - Nan::TypedArrayContents + + + +### Nan::Utf8String + +Converts an object to a UTF-8-encoded character array. If conversion to a string fails (e.g. due to an exception in the toString() method of the object) then the length() method returns 0 and the * operator returns NULL. The underlying memory used for this object is managed by the object. + +An implementation of [`v8::String::Utf8Value`](https://v8docs.nodesource.com/node-8.16/d4/d1b/classv8_1_1_string_1_1_utf8_value.html) that is consistent across all supported versions of V8. + +Definition: + +```c++ +class Nan::Utf8String { + public: + Nan::Utf8String(v8::Local from); + + int length() const; + + char* operator*(); + const char* operator*() const; +}; +``` + + +### Nan::GetCurrentContext() + +A call to [`v8::Isolate::GetCurrent()->GetCurrentContext()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a81c7a1ed7001ae2a65e89107f75fd053) that works across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::GetCurrentContext() +``` + + +### Nan::SetIsolateData() + +A helper to provide a consistent API to [`v8::Isolate#SetData()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a7acadfe7965997e9c386a05f098fbe36). + +Signature: + +```c++ +void Nan::SetIsolateData(v8::Isolate *isolate, T *data) +``` + + + +### Nan::GetIsolateData() + +A helper to provide a consistent API to [`v8::Isolate#GetData()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aabd223436bc1100a787dadaa024c6257). + +Signature: + +```c++ +T *Nan::GetIsolateData(v8::Isolate *isolate) +``` + + +### Nan::TypedArrayContents + +A helper class for accessing the contents of an ArrayBufferView (aka a typedarray) from C++. If the input array is not a valid typedarray, then the data pointer of TypedArrayContents will default to `NULL` and the length will be 0. If the data pointer is not compatible with the alignment requirements of type, an assertion error will fail. + +Note that you must store a reference to the `array` object while you are accessing its contents. + +Definition: + +```c++ +template +class Nan::TypedArrayContents { + public: + TypedArrayContents(v8::Local array); + + size_t length() const; + + T* const operator*(); + const T* const operator*() const; +}; +``` diff --git a/legacy-libs/grpc-cloned/node_modules/nan/include_dirs.js b/legacy-libs/grpc-cloned/node_modules/nan/include_dirs.js new file mode 100644 index 0000000..4f1dfb4 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/include_dirs.js @@ -0,0 +1 @@ +console.log(require('path').relative('.', __dirname)); diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan.h b/legacy-libs/grpc-cloned/node_modules/nan/nan.h new file mode 100644 index 0000000..59cd9b6 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan.h @@ -0,0 +1,2898 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors: + * - Rod Vagg + * - Benjamin Byholm + * - Trevor Norris + * - Nathan Rajlich + * - Brett Lawson + * - Ben Noordhuis + * - David Siegel + * - Michael Ira Krufky + * + * MIT License + * + * Version 2.14.2: current Node 14.13.1, Node 0.12: 0.12.18, Node 0.10: 0.10.48, iojs: 3.3.1 + * + * See https://github.com/nodejs/nan for the latest update to this file + **********************************************************************************/ + +#ifndef NAN_H_ +#define NAN_H_ + +#include + +#define NODE_0_10_MODULE_VERSION 11 +#define NODE_0_12_MODULE_VERSION 14 +#define ATOM_0_21_MODULE_VERSION 41 +#define IOJS_1_0_MODULE_VERSION 42 +#define IOJS_1_1_MODULE_VERSION 43 +#define IOJS_2_0_MODULE_VERSION 44 +#define IOJS_3_0_MODULE_VERSION 45 +#define NODE_4_0_MODULE_VERSION 46 +#define NODE_5_0_MODULE_VERSION 47 +#define NODE_6_0_MODULE_VERSION 48 +#define NODE_7_0_MODULE_VERSION 51 +#define NODE_8_0_MODULE_VERSION 57 +#define NODE_9_0_MODULE_VERSION 59 +#define NODE_10_0_MODULE_VERSION 64 +#define NODE_11_0_MODULE_VERSION 67 +#define NODE_12_0_MODULE_VERSION 72 +#define NODE_13_0_MODULE_VERSION 79 +#define NODE_14_0_MODULE_VERSION 83 + +#ifdef _MSC_VER +# define NAN_HAS_CPLUSPLUS_11 (_MSC_VER >= 1800) +#else +# define NAN_HAS_CPLUSPLUS_11 (__cplusplus >= 201103L) +#endif + +#if NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION && !NAN_HAS_CPLUSPLUS_11 +# error This version of node/NAN/v8 requires a C++11 compiler +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) +# pragma warning( push ) +# pragma warning( disable : 4530 ) +# include +# include +# include +# pragma warning( pop ) +#else +# include +# include +# include +#endif + +// uv helpers +#ifdef UV_VERSION_MAJOR +# ifndef UV_VERSION_PATCH +# define UV_VERSION_PATCH 0 +# endif +# define NAUV_UVVERSION ((UV_VERSION_MAJOR << 16) | \ + (UV_VERSION_MINOR << 8) | \ + (UV_VERSION_PATCH)) +#else +# define NAUV_UVVERSION 0x000b00 +#endif + +#if NAUV_UVVERSION < 0x000b0b +# ifdef WIN32 +# include +# else +# include +# endif +#endif + +namespace Nan { + +#define NAN_CONCAT(a, b) NAN_CONCAT_HELPER(a, b) +#define NAN_CONCAT_HELPER(a, b) a##b + +#define NAN_INLINE inline // TODO(bnoordhuis) Remove in v3.0.0. + +#if defined(__GNUC__) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __declspec(deprecated) +#else +# define NAN_DEPRECATED +#endif + +#if NAN_HAS_CPLUSPLUS_11 +# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&) = delete; +# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&) = delete; +# define NAN_DISALLOW_MOVE(CLASS) \ + CLASS(CLASS&&) = delete; /* NOLINT(build/c++11) */ \ + void operator=(CLASS&&) = delete; +#else +# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&); +# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&); +# define NAN_DISALLOW_MOVE(CLASS) +#endif + +#define NAN_DISALLOW_ASSIGN_COPY(CLASS) \ + NAN_DISALLOW_ASSIGN(CLASS) \ + NAN_DISALLOW_COPY(CLASS) + +#define NAN_DISALLOW_ASSIGN_MOVE(CLASS) \ + NAN_DISALLOW_ASSIGN(CLASS) \ + NAN_DISALLOW_MOVE(CLASS) + +#define NAN_DISALLOW_COPY_MOVE(CLASS) \ + NAN_DISALLOW_COPY(CLASS) \ + NAN_DISALLOW_MOVE(CLASS) + +#define NAN_DISALLOW_ASSIGN_COPY_MOVE(CLASS) \ + NAN_DISALLOW_ASSIGN(CLASS) \ + NAN_DISALLOW_COPY(CLASS) \ + NAN_DISALLOW_MOVE(CLASS) + +#define TYPE_CHECK(T, S) \ + while (false) { \ + *(static_cast(0)) = static_cast(0); \ + } + +//=== RegistrationFunction ===================================================== + +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + typedef v8::Handle ADDON_REGISTER_FUNCTION_ARGS_TYPE; +#else + typedef v8::Local ADDON_REGISTER_FUNCTION_ARGS_TYPE; +#endif + +#define NAN_MODULE_INIT(name) \ + void name(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) + +#if NODE_MAJOR_VERSION >= 10 || \ + NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 +#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \ + extern "C" NODE_MODULE_EXPORT void \ + NAN_CONCAT(node_register_module_v, NODE_MODULE_VERSION)( \ + v8::Local exports, v8::Local module, \ + v8::Local context) \ + { \ + registration(exports); \ + } +#else +#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \ + NODE_MODULE(module_name, registration) +#endif + +//=== CallbackInfo ============================================================= + +#include "nan_callbacks.h" // NOLINT(build/include) + +//============================================================================== + +#if (NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION) +typedef v8::Script UnboundScript; +typedef v8::Script BoundScript; +#else +typedef v8::UnboundScript UnboundScript; +typedef v8::Script BoundScript; +#endif + +#if (NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION) +typedef v8::String::ExternalAsciiStringResource + ExternalOneByteStringResource; +#else +typedef v8::String::ExternalOneByteStringResource + ExternalOneByteStringResource; +#endif + +#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) +template +class NonCopyablePersistentTraits : + public v8::NonCopyablePersistentTraits {}; +template +class CopyablePersistentTraits : + public v8::CopyablePersistentTraits {}; + +template +class PersistentBase : + public v8::PersistentBase {}; + +template > +class Persistent; +#else +template class NonCopyablePersistentTraits; +template class PersistentBase; +template class WeakCallbackData; +template > +class Persistent; +#endif // NODE_MODULE_VERSION + +template +class Maybe { + public: + inline bool IsNothing() const { return !has_value_; } + inline bool IsJust() const { return has_value_; } + + inline T ToChecked() const { return FromJust(); } + inline void Check() const { FromJust(); } + + inline bool To(T* out) const { + if (IsJust()) *out = value_; + return IsJust(); + } + + inline T FromJust() const { +#if defined(V8_ENABLE_CHECKS) + assert(IsJust() && "FromJust is Nothing"); +#endif // V8_ENABLE_CHECKS + return value_; + } + + inline T FromMaybe(const T& default_value) const { + return has_value_ ? value_ : default_value; + } + + inline bool operator==(const Maybe &other) const { + return (IsJust() == other.IsJust()) && + (!IsJust() || FromJust() == other.FromJust()); + } + + inline bool operator!=(const Maybe &other) const { + return !operator==(other); + } + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + // Allow implicit conversions from v8::Maybe to Nan::Maybe. + Maybe(const v8::Maybe& that) // NOLINT(runtime/explicit) + : has_value_(that.IsJust()) + , value_(that.FromMaybe(T())) {} +#endif + + private: + Maybe() : has_value_(false) {} + explicit Maybe(const T& t) : has_value_(true), value_(t) {} + bool has_value_; + T value_; + + template + friend Maybe Nothing(); + template + friend Maybe Just(const U& u); +}; + +template +inline Maybe Nothing() { + return Maybe(); +} + +template +inline Maybe Just(const T& t) { + return Maybe(t); +} + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +# include "nan_maybe_43_inl.h" // NOLINT(build/include) +#else +# include "nan_maybe_pre_43_inl.h" // NOLINT(build/include) +#endif + +#include "nan_converters.h" // NOLINT(build/include) +#include "nan_new.h" // NOLINT(build/include) + +#if NAUV_UVVERSION < 0x000b17 +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async, int) +#else +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async) +#endif + +#if NAUV_UVVERSION >= 0x000b0b + +typedef uv_key_t nauv_key_t; + +inline int nauv_key_create(nauv_key_t *key) { + return uv_key_create(key); +} + +inline void nauv_key_delete(nauv_key_t *key) { + uv_key_delete(key); +} + +inline void* nauv_key_get(nauv_key_t *key) { + return uv_key_get(key); +} + +inline void nauv_key_set(nauv_key_t *key, void *value) { + uv_key_set(key, value); +} + +#else + +/* Implement thread local storage for older versions of libuv. + * This is essentially a backport of libuv commit 5d2434bf + * written by Ben Noordhuis, adjusted for names and inline. + */ + +#ifndef WIN32 + +typedef pthread_key_t nauv_key_t; + +inline int nauv_key_create(nauv_key_t* key) { + return -pthread_key_create(key, NULL); +} + +inline void nauv_key_delete(nauv_key_t* key) { + if (pthread_key_delete(*key)) + abort(); +} + +inline void* nauv_key_get(nauv_key_t* key) { + return pthread_getspecific(*key); +} + +inline void nauv_key_set(nauv_key_t* key, void* value) { + if (pthread_setspecific(*key, value)) + abort(); +} + +#else + +typedef struct { + DWORD tls_index; +} nauv_key_t; + +inline int nauv_key_create(nauv_key_t* key) { + key->tls_index = TlsAlloc(); + if (key->tls_index == TLS_OUT_OF_INDEXES) + return UV_ENOMEM; + return 0; +} + +inline void nauv_key_delete(nauv_key_t* key) { + if (TlsFree(key->tls_index) == FALSE) + abort(); + key->tls_index = TLS_OUT_OF_INDEXES; +} + +inline void* nauv_key_get(nauv_key_t* key) { + void* value = TlsGetValue(key->tls_index); + if (value == NULL) + if (GetLastError() != ERROR_SUCCESS) + abort(); + return value; +} + +inline void nauv_key_set(nauv_key_t* key, void* value) { + if (TlsSetValue(key->tls_index, value) == FALSE) + abort(); +} + +#endif +#endif + +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION +template +v8::Local New(v8::Handle); +#endif + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + typedef v8::WeakCallbackType WeakCallbackType; +#else +struct WeakCallbackType { + enum E {kParameter, kInternalFields}; + E type; + WeakCallbackType(E other) : type(other) {} // NOLINT(runtime/explicit) + inline bool operator==(E other) { return other == this->type; } + inline bool operator!=(E other) { return !operator==(other); } +}; +#endif + +template class WeakCallbackInfo; + +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION +# include "nan_persistent_12_inl.h" // NOLINT(build/include) +#else +# include "nan_persistent_pre_12_inl.h" // NOLINT(build/include) +#endif + +namespace imp { + static const size_t kMaxLength = 0x3fffffff; + // v8::String::REPLACE_INVALID_UTF8 was introduced + // in node.js v0.10.29 and v0.8.27. +#if NODE_MAJOR_VERSION > 0 || \ + NODE_MINOR_VERSION > 10 || \ + NODE_MINOR_VERSION == 10 && NODE_PATCH_VERSION >= 29 || \ + NODE_MINOR_VERSION == 8 && NODE_PATCH_VERSION >= 27 + static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8; +#else + static const unsigned kReplaceInvalidUtf8 = 0; +#endif +} // end of namespace imp + +//=== HandleScope ============================================================== + +class HandleScope { + v8::HandleScope scope; + + public: +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + inline HandleScope() : scope(v8::Isolate::GetCurrent()) {} + inline static int NumberOfHandles() { + return v8::HandleScope::NumberOfHandles(v8::Isolate::GetCurrent()); + } +#else + inline HandleScope() : scope() {} + inline static int NumberOfHandles() { + return v8::HandleScope::NumberOfHandles(); + } +#endif + + private: + // Make it hard to create heap-allocated or illegal handle scopes by + // disallowing certain operations. + HandleScope(const HandleScope &); + void operator=(const HandleScope &); + void *operator new(size_t size); + void operator delete(void *, size_t) { + abort(); + } +}; + +class EscapableHandleScope { + public: +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + inline EscapableHandleScope() : scope(v8::Isolate::GetCurrent()) {} + + inline static int NumberOfHandles() { + return v8::EscapableHandleScope::NumberOfHandles(v8::Isolate::GetCurrent()); + } + + template + inline v8::Local Escape(v8::Local value) { + return scope.Escape(value); + } + + private: + v8::EscapableHandleScope scope; +#else + inline EscapableHandleScope() : scope() {} + + inline static int NumberOfHandles() { + return v8::HandleScope::NumberOfHandles(); + } + + template + inline v8::Local Escape(v8::Local value) { + return scope.Close(value); + } + + private: + v8::HandleScope scope; +#endif + + private: + // Make it hard to create heap-allocated or illegal handle scopes by + // disallowing certain operations. + EscapableHandleScope(const EscapableHandleScope &); + void operator=(const EscapableHandleScope &); + void *operator new(size_t size); + void operator delete(void *, size_t) { + abort(); + } +}; + +//=== TryCatch ================================================================= + +class TryCatch { + v8::TryCatch try_catch_; + friend void FatalException(const TryCatch&); + + public: +#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION + TryCatch() : try_catch_(v8::Isolate::GetCurrent()) {} +#endif + + inline bool HasCaught() const { return try_catch_.HasCaught(); } + + inline bool CanContinue() const { return try_catch_.CanContinue(); } + + inline v8::Local ReThrow() { +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + return New(try_catch_.ReThrow()); +#else + return try_catch_.ReThrow(); +#endif + } + + inline v8::Local Exception() const { + return try_catch_.Exception(); + } + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + inline v8::MaybeLocal StackTrace() const { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(try_catch_.StackTrace(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); + } +#else + inline MaybeLocal StackTrace() const { + return try_catch_.StackTrace(); + } +#endif + + inline v8::Local Message() const { + return try_catch_.Message(); + } + + inline void Reset() { try_catch_.Reset(); } + + inline void SetVerbose(bool value) { try_catch_.SetVerbose(value); } + + inline void SetCaptureMessage(bool value) { + try_catch_.SetCaptureMessage(value); + } +}; + +v8::Local MakeCallback(v8::Local target, + v8::Local func, + int argc, + v8::Local* argv); +v8::Local MakeCallback(v8::Local target, + v8::Local symbol, + int argc, + v8::Local* argv); +v8::Local MakeCallback(v8::Local target, + const char* method, + int argc, + v8::Local* argv); + +// === AsyncResource =========================================================== + +class AsyncResource { + public: + AsyncResource( + v8::Local name + , v8::Local resource = New()) { +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + + if (resource.IsEmpty()) { + resource = New(); + } + + context = node::EmitAsyncInit(isolate, resource, name); +#endif + } + + AsyncResource( + const char* name + , v8::Local resource = New()) { +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + + if (resource.IsEmpty()) { + resource = New(); + } + + v8::Local name_string = + New(name).ToLocalChecked(); + context = node::EmitAsyncInit(isolate, resource, name_string); +#endif + } + + ~AsyncResource() { +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + node::EmitAsyncDestroy(isolate, context); +#endif + } + + inline MaybeLocal runInAsyncScope( + v8::Local target + , v8::Local func + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION + return MakeCallback(target, func, argc, argv); +#else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, func, argc, argv, context); +#endif + } + + inline MaybeLocal runInAsyncScope( + v8::Local target + , v8::Local symbol + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION + return MakeCallback(target, symbol, argc, argv); +#else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, symbol, argc, argv, context); +#endif + } + + inline MaybeLocal runInAsyncScope( + v8::Local target + , const char* method + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION + return MakeCallback(target, method, argc, argv); +#else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, method, argc, argv, context); +#endif + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncResource) +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + node::async_context context; +#endif +}; + +inline uv_loop_t* GetCurrentEventLoop() { +#if NODE_MAJOR_VERSION >= 10 || \ + NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 || \ + NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION >= 10 + return node::GetCurrentEventLoop(v8::Isolate::GetCurrent()); +#else + return uv_default_loop(); +#endif +} + +//============ ================================================================= + +/* node 0.12 */ +#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION + inline + void SetCounterFunction(v8::CounterLookupCallback cb) { + v8::Isolate::GetCurrent()->SetCounterFunction(cb); + } + + inline + void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb); + } + + inline + void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); + } + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + inline bool IdleNotification(int idle_time_in_ms) { + return v8::Isolate::GetCurrent()->IdleNotificationDeadline( + idle_time_in_ms * 0.001); + } +# else + inline bool IdleNotification(int idle_time_in_ms) { + return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms); + } +#endif + + inline void LowMemoryNotification() { + v8::Isolate::GetCurrent()->LowMemoryNotification(); + } + + inline void ContextDisposedNotification() { + v8::Isolate::GetCurrent()->ContextDisposedNotification(); + } +#else + inline + void SetCounterFunction(v8::CounterLookupCallback cb) { + v8::V8::SetCounterFunction(cb); + } + + inline + void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::V8::SetCreateHistogramFunction(cb); + } + + inline + void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::V8::SetAddHistogramSampleFunction(cb); + } + + inline bool IdleNotification(int idle_time_in_ms) { + return v8::V8::IdleNotification(idle_time_in_ms); + } + + inline void LowMemoryNotification() { + v8::V8::LowMemoryNotification(); + } + + inline void ContextDisposedNotification() { + v8::V8::ContextDisposedNotification(); + } +#endif + +#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) // Node 0.12 + inline v8::Local Undefined() { +# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(v8::Undefined(v8::Isolate::GetCurrent()))); +# else + return v8::Undefined(v8::Isolate::GetCurrent()); +# endif + } + + inline v8::Local Null() { +# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(v8::Null(v8::Isolate::GetCurrent()))); +# else + return v8::Null(v8::Isolate::GetCurrent()); +# endif + } + + inline v8::Local True() { +# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(v8::True(v8::Isolate::GetCurrent()))); +# else + return v8::True(v8::Isolate::GetCurrent()); +# endif + } + + inline v8::Local False() { +# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(v8::False(v8::Isolate::GetCurrent()))); +# else + return v8::False(v8::Isolate::GetCurrent()); +# endif + } + + inline v8::Local EmptyString() { + return v8::String::Empty(v8::Isolate::GetCurrent()); + } + + inline int AdjustExternalMemory(int bc) { + return static_cast( + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); + } + + inline void SetTemplate( + v8::Local templ + , const char *name + , v8::Local value) { + templ->Set(v8::Isolate::GetCurrent(), name, value); + } + + inline void SetTemplate( + v8::Local templ + , v8::Local name + , v8::Local value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + inline v8::Local GetCurrentContext() { + return v8::Isolate::GetCurrent()->GetCurrentContext(); + } + + inline void* GetInternalFieldPointer( + v8::Local object + , int index) { + return object->GetAlignedPointerFromInternalField(index); + } + + inline void SetInternalFieldPointer( + v8::Local object + , int index + , void* value) { + object->SetAlignedPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) + +#if NODE_MODULE_VERSION <= NODE_4_0_MODULE_VERSION + typedef v8::Isolate::GCEpilogueCallback GCEpilogueCallback; + typedef v8::Isolate::GCPrologueCallback GCPrologueCallback; +#else + typedef v8::Isolate::GCCallback GCEpilogueCallback; + typedef v8::Isolate::GCCallback GCPrologueCallback; +#endif + + inline void AddGCEpilogueCallback( + GCEpilogueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); + } + + inline void RemoveGCEpilogueCallback( + GCEpilogueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); + } + + inline void AddGCPrologueCallback( + GCPrologueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); + } + + inline void RemoveGCPrologueCallback( + GCPrologueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); + } + + inline void GetHeapStatistics( + v8::HeapStatistics *heap_statistics) { + v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); + } + +# define X(NAME) \ + inline v8::Local NAME(const char *msg) { \ + EscapableHandleScope scope; \ + return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked())); \ + } \ + \ + inline \ + v8::Local NAME(v8::Local msg) { \ + return v8::Exception::NAME(msg); \ + } \ + \ + inline void Throw ## NAME(const char *msg) { \ + HandleScope scope; \ + v8::Isolate::GetCurrent()->ThrowException( \ + v8::Exception::NAME(New(msg).ToLocalChecked())); \ + } \ + \ + inline void Throw ## NAME(v8::Local msg) { \ + HandleScope scope; \ + v8::Isolate::GetCurrent()->ThrowException( \ + v8::Exception::NAME(msg)); \ + } + + X(Error) + X(RangeError) + X(ReferenceError) + X(SyntaxError) + X(TypeError) + +# undef X + + inline void ThrowError(v8::Local error) { + v8::Isolate::GetCurrent()->ThrowException(error); + } + + inline MaybeLocal NewBuffer( + char *data + , size_t length +#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION + , node::Buffer::FreeCallback callback +#else + , node::smalloc::FreeCallback callback +#endif + , void *hint + ) { + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(length <= imp::kMaxLength && "too large buffer"); +#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION + return node::Buffer::New( + v8::Isolate::GetCurrent(), data, length, callback, hint); +#else + return node::Buffer::New(v8::Isolate::GetCurrent(), data, length, callback, + hint); +#endif + } + + inline MaybeLocal CopyBuffer( + const char *data + , uint32_t size + ) { + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(size <= imp::kMaxLength && "too large buffer"); +#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION + return node::Buffer::Copy( + v8::Isolate::GetCurrent(), data, size); +#else + return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); +#endif + } + + inline MaybeLocal NewBuffer(uint32_t size) { + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(size <= imp::kMaxLength && "too large buffer"); +#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION + return node::Buffer::New( + v8::Isolate::GetCurrent(), size); +#else + return node::Buffer::New(v8::Isolate::GetCurrent(), size); +#endif + } + + inline MaybeLocal NewBuffer( + char* data + , uint32_t size + ) { + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(size <= imp::kMaxLength && "too large buffer"); +#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION + return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); +#else + return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); +#endif + } + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + inline MaybeLocal + NewOneByteString(const uint8_t * value, int length = -1) { + return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, + v8::NewStringType::kNormal, length); + } + + inline MaybeLocal CompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::ScriptCompiler::Source source(s, origin); + return scope.Escape( + v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source) + .FromMaybe(v8::Local())); + } + + inline MaybeLocal CompileScript( + v8::Local s + ) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::ScriptCompiler::Source source(s); + return scope.Escape( + v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source) + .FromMaybe(v8::Local())); + } + + inline MaybeLocal RunScript( + v8::Local script + ) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(script->BindToCurrentContext() + ->Run(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); + } + + inline MaybeLocal RunScript( + v8::Local script + ) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(script->Run(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); + } +#else + inline MaybeLocal + NewOneByteString(const uint8_t * value, int length = -1) { + return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); + } + + inline MaybeLocal CompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + v8::ScriptCompiler::Source source(s, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + inline MaybeLocal CompileScript( + v8::Local s + ) { + v8::ScriptCompiler::Source source(s); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + inline MaybeLocal RunScript( + v8::Local script + ) { + EscapableHandleScope scope; + return scope.Escape(script->BindToCurrentContext()->Run()); + } + + inline MaybeLocal RunScript( + v8::Local script + ) { + return script->Run(); + } +#endif + + NAN_DEPRECATED inline v8::Local MakeCallback( + v8::Local target + , v8::Local func + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(node::MakeCallback( + v8::Isolate::GetCurrent(), target, func, argc, argv))); +#else +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource res("nan:makeCallback"); + return res.runInAsyncScope(target, func, argc, argv) + .FromMaybe(v8::Local()); +# else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, func, argc, argv); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + } + + NAN_DEPRECATED inline v8::Local MakeCallback( + v8::Local target + , v8::Local symbol + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(node::MakeCallback( + v8::Isolate::GetCurrent(), target, symbol, argc, argv))); +#else +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource res("nan:makeCallback"); + return res.runInAsyncScope(target, symbol, argc, argv) + .FromMaybe(v8::Local()); +# else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, symbol, argc, argv); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + } + + NAN_DEPRECATED inline v8::Local MakeCallback( + v8::Local target + , const char* method + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(node::MakeCallback( + v8::Isolate::GetCurrent(), target, method, argc, argv))); +#else +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource res("nan:makeCallback"); + return res.runInAsyncScope(target, method, argc, argv) + .FromMaybe(v8::Local()); +# else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, method, argc, argv); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + } + + inline void FatalException(const TryCatch& try_catch) { + node::FatalException(v8::Isolate::GetCurrent(), try_catch.try_catch_); + } + + inline v8::Local ErrnoException( + int errorno + , const char* syscall = NULL + , const char* message = NULL + , const char* path = NULL) { + return node::ErrnoException(v8::Isolate::GetCurrent(), errorno, syscall, + message, path); + } + + NAN_DEPRECATED inline v8::Local NanErrnoException( + int errorno + , const char* syscall = NULL + , const char* message = NULL + , const char* path = NULL) { + return ErrnoException(errorno, syscall, message, path); + } + + template + inline void SetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(0, data); + } + + template + inline T *GetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData(0)); + } + +class Utf8String { + public: + inline explicit Utf8String(v8::Local from) : + length_(0), str_(str_st_) { + HandleScope scope; + if (!from.IsEmpty()) { +#if NODE_MAJOR_VERSION >= 10 + v8::Local context = GetCurrentContext(); + v8::Local string = + from->ToString(context).FromMaybe(v8::Local()); +#else + v8::Local string = from->ToString(); +#endif + if (!string.IsEmpty()) { + size_t len = 3 * string->Length() + 1; + assert(len <= INT_MAX); + if (len > sizeof (str_st_)) { + str_ = static_cast(malloc(len)); + assert(str_ != 0); + } + const int flags = + v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; +#if NODE_MAJOR_VERSION >= 11 + length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, + static_cast(len), 0, flags); +#else + // See https://github.com/nodejs/nan/issues/832. + // Disable the warning as there is no way around it. +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4996) +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + length_ = string->WriteUtf8(str_, static_cast(len), 0, flags); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#endif // NODE_MAJOR_VERSION < 11 + str_[length_] = '\0'; + } + } + } + + inline int length() const { + return length_; + } + + inline char* operator*() { return str_; } + inline const char* operator*() const { return str_; } + + inline ~Utf8String() { + if (str_ != str_st_) { + free(str_); + } + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String) + + int length_; + char *str_; + char str_st_[1024]; +}; + +#else // Node 0.8 and 0.10 + inline v8::Local Undefined() { + EscapableHandleScope scope; + return scope.Escape(New(v8::Undefined())); + } + + inline v8::Local Null() { + EscapableHandleScope scope; + return scope.Escape(New(v8::Null())); + } + + inline v8::Local True() { + EscapableHandleScope scope; + return scope.Escape(New(v8::True())); + } + + inline v8::Local False() { + EscapableHandleScope scope; + return scope.Escape(New(v8::False())); + } + + inline v8::Local EmptyString() { + return v8::String::Empty(); + } + + inline int AdjustExternalMemory(int bc) { + return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); + } + + inline void SetTemplate( + v8::Local templ + , const char *name + , v8::Local value) { + templ->Set(name, value); + } + + inline void SetTemplate( + v8::Local templ + , v8::Local name + , v8::Local value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + inline v8::Local GetCurrentContext() { + return v8::Context::GetCurrent(); + } + + inline void* GetInternalFieldPointer( + v8::Local object + , int index) { + return object->GetPointerFromInternalField(index); + } + + inline void SetInternalFieldPointer( + v8::Local object + , int index + , void* value) { + object->SetPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::GCType type, v8::GCCallbackFlags flags) + + inline void AddGCEpilogueCallback( + v8::GCEpilogueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::V8::AddGCEpilogueCallback(callback, gc_type_filter); + } + inline void RemoveGCEpilogueCallback( + v8::GCEpilogueCallback callback) { + v8::V8::RemoveGCEpilogueCallback(callback); + } + inline void AddGCPrologueCallback( + v8::GCPrologueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::V8::AddGCPrologueCallback(callback, gc_type_filter); + } + inline void RemoveGCPrologueCallback( + v8::GCPrologueCallback callback) { + v8::V8::RemoveGCPrologueCallback(callback); + } + inline void GetHeapStatistics( + v8::HeapStatistics *heap_statistics) { + v8::V8::GetHeapStatistics(heap_statistics); + } + +# define X(NAME) \ + inline v8::Local NAME(const char *msg) { \ + EscapableHandleScope scope; \ + return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked())); \ + } \ + \ + inline \ + v8::Local NAME(v8::Local msg) { \ + return v8::Exception::NAME(msg); \ + } \ + \ + inline void Throw ## NAME(const char *msg) { \ + HandleScope scope; \ + v8::ThrowException(v8::Exception::NAME(New(msg).ToLocalChecked())); \ + } \ + \ + inline \ + void Throw ## NAME(v8::Local errmsg) { \ + HandleScope scope; \ + v8::ThrowException(v8::Exception::NAME(errmsg)); \ + } + + X(Error) + X(RangeError) + X(ReferenceError) + X(SyntaxError) + X(TypeError) + +# undef X + + inline void ThrowError(v8::Local error) { + v8::ThrowException(error); + } + + inline MaybeLocal NewBuffer( + char *data + , size_t length + , node::Buffer::free_callback callback + , void *hint + ) { + EscapableHandleScope scope; + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(length <= imp::kMaxLength && "too large buffer"); + return scope.Escape( + New(node::Buffer::New(data, length, callback, hint)->handle_)); + } + + inline MaybeLocal CopyBuffer( + const char *data + , uint32_t size + ) { + EscapableHandleScope scope; + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(size <= imp::kMaxLength && "too large buffer"); +#if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION + return scope.Escape(New(node::Buffer::New(data, size)->handle_)); +#else + return scope.Escape( + New(node::Buffer::New(const_cast(data), size)->handle_)); +#endif + } + + inline MaybeLocal NewBuffer(uint32_t size) { + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + assert(size <= imp::kMaxLength && "too large buffer"); + return scope.Escape(New(node::Buffer::New(size)->handle_)); + } + + inline void FreeData(char *data, void *hint) { + (void) hint; // unused + delete[] data; + } + + inline MaybeLocal NewBuffer( + char* data + , uint32_t size + ) { + EscapableHandleScope scope; + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(size <= imp::kMaxLength && "too large buffer"); + return scope.Escape( + New(node::Buffer::New(data, size, FreeData, NULL)->handle_)); + } + +namespace imp { +inline void +widenString(std::vector *ws, const uint8_t *s, int l) { + size_t len = static_cast(l); + if (l < 0) { + len = strlen(reinterpret_cast(s)); + } + assert(len <= INT_MAX && "string too long"); + ws->resize(len); + std::copy(s, s + len, ws->begin()); // NOLINT(build/include_what_you_use) +} +} // end of namespace imp + + inline MaybeLocal + NewOneByteString(const uint8_t * value, int length = -1) { + std::vector wideString; // NOLINT(build/include_what_you_use) + imp::widenString(&wideString, value, length); + return v8::String::New(wideString.data(), + static_cast(wideString.size())); + } + + inline MaybeLocal CompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + return v8::Script::Compile(s, const_cast(&origin)); + } + + inline MaybeLocal CompileScript( + v8::Local s + ) { + return v8::Script::Compile(s); + } + + inline + MaybeLocal RunScript(v8::Local script) { + return script->Run(); + } + + inline v8::Local MakeCallback( + v8::Local target + , v8::Local func + , int argc + , v8::Local* argv) { + v8::HandleScope scope; + return scope.Close(New(node::MakeCallback(target, func, argc, argv))); + } + + inline v8::Local MakeCallback( + v8::Local target + , v8::Local symbol + , int argc + , v8::Local* argv) { + v8::HandleScope scope; + return scope.Close(New(node::MakeCallback(target, symbol, argc, argv))); + } + + inline v8::Local MakeCallback( + v8::Local target + , const char* method + , int argc + , v8::Local* argv) { + v8::HandleScope scope; + return scope.Close(New(node::MakeCallback(target, method, argc, argv))); + } + + inline void FatalException(const TryCatch& try_catch) { + node::FatalException(const_cast(try_catch.try_catch_)); + } + + inline v8::Local ErrnoException( + int errorno + , const char* syscall = NULL + , const char* message = NULL + , const char* path = NULL) { + return node::ErrnoException(errorno, syscall, message, path); + } + + NAN_DEPRECATED inline v8::Local NanErrnoException( + int errorno + , const char* syscall = NULL + , const char* message = NULL + , const char* path = NULL) { + return ErrnoException(errorno, syscall, message, path); + } + + + template + inline void SetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(data); + } + + template + inline T *GetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData()); + } + +class Utf8String { + public: + inline explicit Utf8String(v8::Local from) : + length_(0), str_(str_st_) { + v8::HandleScope scope; + if (!from.IsEmpty()) { + v8::Local string = from->ToString(); + if (!string.IsEmpty()) { + size_t len = 3 * string->Length() + 1; + assert(len <= INT_MAX); + if (len > sizeof (str_st_)) { + str_ = static_cast(malloc(len)); + assert(str_ != 0); + } + const int flags = + v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; + length_ = string->WriteUtf8(str_, static_cast(len), 0, flags); + str_[length_] = '\0'; + } + } + } + + inline int length() const { + return length_; + } + + inline char* operator*() { return str_; } + inline const char* operator*() const { return str_; } + + inline ~Utf8String() { + if (str_ != str_st_) { + free(str_); + } + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String) + + int length_; + char *str_; + char str_st_[1024]; +}; + +#endif // NODE_MODULE_VERSION + +typedef void (*FreeCallback)(char *data, void *hint); + +typedef const FunctionCallbackInfo& NAN_METHOD_ARGS_TYPE; +typedef void NAN_METHOD_RETURN_TYPE; + +typedef const PropertyCallbackInfo& NAN_GETTER_ARGS_TYPE; +typedef void NAN_GETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& NAN_SETTER_ARGS_TYPE; +typedef void NAN_SETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_PROPERTY_GETTER_ARGS_TYPE; +typedef void NAN_PROPERTY_GETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_PROPERTY_SETTER_ARGS_TYPE; +typedef void NAN_PROPERTY_SETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_PROPERTY_ENUMERATOR_ARGS_TYPE; +typedef void NAN_PROPERTY_ENUMERATOR_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_PROPERTY_DELETER_ARGS_TYPE; +typedef void NAN_PROPERTY_DELETER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_PROPERTY_QUERY_ARGS_TYPE; +typedef void NAN_PROPERTY_QUERY_RETURN_TYPE; + +typedef const PropertyCallbackInfo& NAN_INDEX_GETTER_ARGS_TYPE; +typedef void NAN_INDEX_GETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& NAN_INDEX_SETTER_ARGS_TYPE; +typedef void NAN_INDEX_SETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_INDEX_ENUMERATOR_ARGS_TYPE; +typedef void NAN_INDEX_ENUMERATOR_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_INDEX_DELETER_ARGS_TYPE; +typedef void NAN_INDEX_DELETER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_INDEX_QUERY_ARGS_TYPE; +typedef void NAN_INDEX_QUERY_RETURN_TYPE; + +#define NAN_METHOD(name) \ + Nan::NAN_METHOD_RETURN_TYPE name(Nan::NAN_METHOD_ARGS_TYPE info) +#define NAN_GETTER(name) \ + Nan::NAN_GETTER_RETURN_TYPE name( \ + v8::Local property \ + , Nan::NAN_GETTER_ARGS_TYPE info) +#define NAN_SETTER(name) \ + Nan::NAN_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local value \ + , Nan::NAN_SETTER_ARGS_TYPE info) +#define NAN_PROPERTY_GETTER(name) \ + Nan::NAN_PROPERTY_GETTER_RETURN_TYPE name( \ + v8::Local property \ + , Nan::NAN_PROPERTY_GETTER_ARGS_TYPE info) +#define NAN_PROPERTY_SETTER(name) \ + Nan::NAN_PROPERTY_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local value \ + , Nan::NAN_PROPERTY_SETTER_ARGS_TYPE info) +#define NAN_PROPERTY_ENUMERATOR(name) \ + Nan::NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name( \ + Nan::NAN_PROPERTY_ENUMERATOR_ARGS_TYPE info) +#define NAN_PROPERTY_DELETER(name) \ + Nan::NAN_PROPERTY_DELETER_RETURN_TYPE name( \ + v8::Local property \ + , Nan::NAN_PROPERTY_DELETER_ARGS_TYPE info) +#define NAN_PROPERTY_QUERY(name) \ + Nan::NAN_PROPERTY_QUERY_RETURN_TYPE name( \ + v8::Local property \ + , Nan::NAN_PROPERTY_QUERY_ARGS_TYPE info) +# define NAN_INDEX_GETTER(name) \ + Nan::NAN_INDEX_GETTER_RETURN_TYPE name( \ + uint32_t index \ + , Nan::NAN_INDEX_GETTER_ARGS_TYPE info) +#define NAN_INDEX_SETTER(name) \ + Nan::NAN_INDEX_SETTER_RETURN_TYPE name( \ + uint32_t index \ + , v8::Local value \ + , Nan::NAN_INDEX_SETTER_ARGS_TYPE info) +#define NAN_INDEX_ENUMERATOR(name) \ + Nan::NAN_INDEX_ENUMERATOR_RETURN_TYPE \ + name(Nan::NAN_INDEX_ENUMERATOR_ARGS_TYPE info) +#define NAN_INDEX_DELETER(name) \ + Nan::NAN_INDEX_DELETER_RETURN_TYPE name( \ + uint32_t index \ + , Nan::NAN_INDEX_DELETER_ARGS_TYPE info) +#define NAN_INDEX_QUERY(name) \ + Nan::NAN_INDEX_QUERY_RETURN_TYPE name( \ + uint32_t index \ + , Nan::NAN_INDEX_QUERY_ARGS_TYPE info) + +class Callback { + public: + Callback() {} + + explicit Callback(const v8::Local &fn) : handle_(fn) {} + + ~Callback() { + handle_.Reset(); + } + + bool operator==(const Callback &other) const { + return handle_ == other.handle_; + } + + bool operator!=(const Callback &other) const { + return !operator==(other); + } + + inline + v8::Local operator*() const { return GetFunction(); } + + NAN_DEPRECATED inline v8::Local operator()( + v8::Local target + , int argc = 0 + , v8::Local argv[] = 0) const { +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource async("nan:Callback:operator()"); + return Call_(isolate, target, argc, argv, &async) + .FromMaybe(v8::Local()); +# else + return Call_(isolate, target, argc, argv); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#else + return Call_(target, argc, argv); +#endif // NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + } + + NAN_DEPRECATED inline v8::Local operator()( + int argc = 0 + , v8::Local argv[] = 0) const { +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource async("nan:Callback:operator()"); + return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(), + argc, argv, &async) + .FromMaybe(v8::Local())); +# else + return scope.Escape( + Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#else + v8::HandleScope scope; + return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); +#endif // NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + } + + inline MaybeLocal operator()( + AsyncResource* resource + , int argc = 0 + , v8::Local argv[] = 0) const { + return this->Call(argc, argv, resource); + } + + inline MaybeLocal operator()( + AsyncResource* resource + , v8::Local target + , int argc = 0 + , v8::Local argv[] = 0) const { + return this->Call(target, argc, argv, resource); + } + + // TODO(kkoopa): remove + inline void SetFunction(const v8::Local &fn) { + Reset(fn); + } + + inline void Reset(const v8::Local &fn) { + handle_.Reset(fn); + } + + inline void Reset() { + handle_.Reset(); + } + + inline v8::Local GetFunction() const { + return New(handle_); + } + + inline bool IsEmpty() const { + return handle_.IsEmpty(); + } + + // Deprecated: For async callbacks Use the versions that accept an + // AsyncResource. If this callback does not correspond to an async resource, + // that is, it is a synchronous function call on a non-empty JS stack, you + // should Nan::Call instead. + NAN_DEPRECATED inline v8::Local + Call(v8::Local target + , int argc + , v8::Local argv[]) const { +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource async("nan:Callback:Call"); + return Call_(isolate, target, argc, argv, &async) + .FromMaybe(v8::Local()); +# else + return Call_(isolate, target, argc, argv); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#else + return Call_(target, argc, argv); +#endif + } + + // Deprecated: For async callbacks Use the versions that accept an + // AsyncResource. If this callback does not correspond to an async resource, + // that is, it is a synchronous function call on a non-empty JS stack, you + // should Nan::Call instead. + NAN_DEPRECATED inline v8::Local + Call(int argc, v8::Local argv[]) const { +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource async("nan:Callback:Call"); + return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(), + argc, argv, &async) + .FromMaybe(v8::Local())); +# else + return scope.Escape( + Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#else + v8::HandleScope scope; + return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); +#endif + } + + inline MaybeLocal + Call(v8::Local target + , int argc + , v8::Local argv[] + , AsyncResource* resource) const { +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + return Call_(isolate, target, argc, argv, resource); +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + return Call_(isolate, target, argc, argv); +#else + return Call_(target, argc, argv); +#endif + } + + inline MaybeLocal + Call(int argc, v8::Local argv[], AsyncResource* resource) const { +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + return Call(isolate->GetCurrentContext()->Global(), argc, argv, resource); +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); +#else + v8::HandleScope scope; + return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); +#endif + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(Callback) + Persistent handle_; + +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + MaybeLocal Call_(v8::Isolate *isolate + , v8::Local target + , int argc + , v8::Local argv[] + , AsyncResource* resource) const { + EscapableHandleScope scope; + v8::Local func = New(handle_); + auto maybe = resource->runInAsyncScope(target, func, argc, argv); + v8::Local local; + if (!maybe.ToLocal(&local)) return MaybeLocal(); + return scope.Escape(local); + } +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Local Call_(v8::Isolate *isolate + , v8::Local target + , int argc + , v8::Local argv[]) const { + EscapableHandleScope scope; + + v8::Local callback = New(handle_); +# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + return scope.Escape(New(node::MakeCallback( + isolate + , target + , callback + , argc + , argv + ))); +# else + return scope.Escape(node::MakeCallback( + isolate + , target + , callback + , argc + , argv + )); +# endif + } +#else + v8::Local Call_(v8::Local target + , int argc + , v8::Local argv[]) const { + EscapableHandleScope scope; + + v8::Local callback = New(handle_); + return scope.Escape(New(node::MakeCallback( + target + , callback + , argc + , argv + ))); + } +#endif +}; + +inline MaybeLocal Call( + const Nan::Callback& callback + , v8::Local recv + , int argc + , v8::Local argv[]) { + return Call(*callback, recv, argc, argv); +} + +inline MaybeLocal Call( + const Nan::Callback& callback + , int argc + , v8::Local argv[]) { +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + Call(*callback, isolate->GetCurrentContext()->Global(), argc, argv) + .FromMaybe(v8::Local())); +#else + EscapableHandleScope scope; + return scope.Escape( + Call(*callback, v8::Context::GetCurrent()->Global(), argc, argv) + .FromMaybe(v8::Local())); +#endif +} + +inline MaybeLocal Call( + v8::Local symbol + , v8::Local recv + , int argc + , v8::Local argv[]) { + EscapableHandleScope scope; + v8::Local fn_v = + Get(recv, symbol).FromMaybe(v8::Local()); + if (fn_v.IsEmpty() || !fn_v->IsFunction()) return v8::Local(); + v8::Local fn = fn_v.As(); + return scope.Escape( + Call(fn, recv, argc, argv).FromMaybe(v8::Local())); +} + +inline MaybeLocal Call( + const char* method + , v8::Local recv + , int argc + , v8::Local argv[]) { + EscapableHandleScope scope; + v8::Local method_string = + New(method).ToLocalChecked(); + return scope.Escape( + Call(method_string, recv, argc, argv).FromMaybe(v8::Local())); +} + +/* abstract */ class AsyncWorker { + public: + explicit AsyncWorker(Callback *callback_, + const char* resource_name = "nan:AsyncWorker") + : callback(callback_), errmsg_(NULL) { + request.data = this; + + HandleScope scope; + v8::Local obj = New(); + persistentHandle.Reset(obj); + async_resource = new AsyncResource(resource_name, obj); + } + + virtual ~AsyncWorker() { + HandleScope scope; + + if (!persistentHandle.IsEmpty()) + persistentHandle.Reset(); + delete callback; + delete[] errmsg_; + delete async_resource; + } + + virtual void WorkComplete() { + HandleScope scope; + + if (errmsg_ == NULL) + HandleOKCallback(); + else + HandleErrorCallback(); + delete callback; + callback = NULL; + } + + inline void SaveToPersistent( + const char *key, const v8::Local &value) { + HandleScope scope; + Set(New(persistentHandle), New(key).ToLocalChecked(), value).FromJust(); + } + + inline void SaveToPersistent( + const v8::Local &key, const v8::Local &value) { + HandleScope scope; + Set(New(persistentHandle), key, value).FromJust(); + } + + inline void SaveToPersistent( + uint32_t index, const v8::Local &value) { + HandleScope scope; + Set(New(persistentHandle), index, value).FromJust(); + } + + inline v8::Local GetFromPersistent(const char *key) const { + EscapableHandleScope scope; + return scope.Escape( + Get(New(persistentHandle), New(key).ToLocalChecked()) + .FromMaybe(v8::Local())); + } + + inline v8::Local + GetFromPersistent(const v8::Local &key) const { + EscapableHandleScope scope; + return scope.Escape( + Get(New(persistentHandle), key) + .FromMaybe(v8::Local())); + } + + inline v8::Local GetFromPersistent(uint32_t index) const { + EscapableHandleScope scope; + return scope.Escape( + Get(New(persistentHandle), index) + .FromMaybe(v8::Local())); + } + + virtual void Execute() = 0; + + uv_work_t request; + + virtual void Destroy() { + delete this; + } + + protected: + Persistent persistentHandle; + Callback *callback; + AsyncResource *async_resource; + + virtual void HandleOKCallback() { + HandleScope scope; + + callback->Call(0, NULL, async_resource); + } + + virtual void HandleErrorCallback() { + HandleScope scope; + + v8::Local argv[] = { + v8::Exception::Error(New(ErrorMessage()).ToLocalChecked()) + }; + callback->Call(1, argv, async_resource); + } + + void SetErrorMessage(const char *msg) { + delete[] errmsg_; + + size_t size = strlen(msg) + 1; + errmsg_ = new char[size]; + memcpy(errmsg_, msg, size); + } + + const char* ErrorMessage() const { + return errmsg_; + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncWorker) + char *errmsg_; +}; + +/* abstract */ class AsyncBareProgressWorkerBase : public AsyncWorker { + public: + explicit AsyncBareProgressWorkerBase( + Callback *callback_, + const char* resource_name = "nan:AsyncBareProgressWorkerBase") + : AsyncWorker(callback_, resource_name) { + uv_async_init( + GetCurrentEventLoop() + , &async + , AsyncProgress_ + ); + async.data = this; + } + + virtual ~AsyncBareProgressWorkerBase() { + } + + virtual void WorkProgress() = 0; + + virtual void Destroy() { + uv_close(reinterpret_cast(&async), AsyncClose_); + } + + private: + inline static NAUV_WORK_CB(AsyncProgress_) { + AsyncBareProgressWorkerBase *worker = + static_cast(async->data); + worker->WorkProgress(); + } + + inline static void AsyncClose_(uv_handle_t* handle) { + AsyncBareProgressWorkerBase *worker = + static_cast(handle->data); + delete worker; + } + + protected: + uv_async_t async; +}; + +template +/* abstract */ +class AsyncBareProgressWorker : public AsyncBareProgressWorkerBase { + public: + explicit AsyncBareProgressWorker( + Callback *callback_, + const char* resource_name = "nan:AsyncBareProgressWorker") + : AsyncBareProgressWorkerBase(callback_, resource_name) { + uv_mutex_init(&async_lock); + } + + virtual ~AsyncBareProgressWorker() { + uv_mutex_destroy(&async_lock); + } + + class ExecutionProgress { + friend class AsyncBareProgressWorker; + public: + void Signal() const { + uv_mutex_lock(&that_->async_lock); + uv_async_send(&that_->async); + uv_mutex_unlock(&that_->async_lock); + } + + void Send(const T* data, size_t count) const { + that_->SendProgress_(data, count); + } + + private: + explicit ExecutionProgress(AsyncBareProgressWorker *that) : that_(that) {} + NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress) + AsyncBareProgressWorker* const that_; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + virtual void HandleProgressCallback(const T *data, size_t size) = 0; + + protected: + uv_mutex_t async_lock; + + private: + void Execute() /*final override*/ { + ExecutionProgress progress(this); + Execute(progress); + } + + virtual void SendProgress_(const T *data, size_t count) = 0; +}; + +template +/* abstract */ +class AsyncProgressWorkerBase : public AsyncBareProgressWorker { + public: + explicit AsyncProgressWorkerBase( + Callback *callback_, + const char* resource_name = "nan:AsyncProgressWorkerBase") + : AsyncBareProgressWorker(callback_, resource_name), asyncdata_(NULL), + asyncsize_(0) { + } + + virtual ~AsyncProgressWorkerBase() { + delete[] asyncdata_; + } + + void WorkProgress() { + uv_mutex_lock(&this->async_lock); + T *data = asyncdata_; + size_t size = asyncsize_; + asyncdata_ = NULL; + asyncsize_ = 0; + uv_mutex_unlock(&this->async_lock); + + // Don't send progress events after we've already completed. + if (this->callback) { + this->HandleProgressCallback(data, size); + } + delete[] data; + } + + private: + void SendProgress_(const T *data, size_t count) { + T *new_data = new T[count]; + std::copy(data, data + count, new_data); + + uv_mutex_lock(&this->async_lock); + T *old_data = asyncdata_; + asyncdata_ = new_data; + asyncsize_ = count; + uv_async_send(&this->async); + uv_mutex_unlock(&this->async_lock); + + delete[] old_data; + } + + T *asyncdata_; + size_t asyncsize_; +}; + +// This ensures compatibility to the previous un-templated AsyncProgressWorker +// class definition. +typedef AsyncProgressWorkerBase AsyncProgressWorker; + +template +/* abstract */ +class AsyncBareProgressQueueWorker : public AsyncBareProgressWorkerBase { + public: + explicit AsyncBareProgressQueueWorker( + Callback *callback_, + const char* resource_name = "nan:AsyncBareProgressQueueWorker") + : AsyncBareProgressWorkerBase(callback_, resource_name) { + } + + virtual ~AsyncBareProgressQueueWorker() { + } + + class ExecutionProgress { + friend class AsyncBareProgressQueueWorker; + public: + void Send(const T* data, size_t count) const { + that_->SendProgress_(data, count); + } + + private: + explicit ExecutionProgress(AsyncBareProgressQueueWorker *that) + : that_(that) {} + NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress) + AsyncBareProgressQueueWorker* const that_; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + virtual void HandleProgressCallback(const T *data, size_t size) = 0; + + private: + void Execute() /*final override*/ { + ExecutionProgress progress(this); + Execute(progress); + } + + virtual void SendProgress_(const T *data, size_t count) = 0; +}; + +template +/* abstract */ +class AsyncProgressQueueWorker : public AsyncBareProgressQueueWorker { + public: + explicit AsyncProgressQueueWorker( + Callback *callback_, + const char* resource_name = "nan:AsyncProgressQueueWorker") + : AsyncBareProgressQueueWorker(callback_) { + uv_mutex_init(&async_lock); + } + + virtual ~AsyncProgressQueueWorker() { + uv_mutex_lock(&async_lock); + + while (!asyncdata_.empty()) { + std::pair &datapair = asyncdata_.front(); + T *data = datapair.first; + + asyncdata_.pop(); + + delete[] data; + } + + uv_mutex_unlock(&async_lock); + uv_mutex_destroy(&async_lock); + } + + void WorkComplete() { + WorkProgress(); + AsyncWorker::WorkComplete(); + } + + void WorkProgress() { + uv_mutex_lock(&async_lock); + + while (!asyncdata_.empty()) { + std::pair &datapair = asyncdata_.front(); + + T *data = datapair.first; + size_t size = datapair.second; + + asyncdata_.pop(); + uv_mutex_unlock(&async_lock); + + // Don't send progress events after we've already completed. + if (this->callback) { + this->HandleProgressCallback(data, size); + } + + delete[] data; + + uv_mutex_lock(&async_lock); + } + + uv_mutex_unlock(&async_lock); + } + + private: + void SendProgress_(const T *data, size_t count) { + T *new_data = new T[count]; + std::copy(data, data + count, new_data); + + uv_mutex_lock(&async_lock); + asyncdata_.push(std::pair(new_data, count)); + uv_mutex_unlock(&async_lock); + + uv_async_send(&this->async); + } + + uv_mutex_t async_lock; + std::queue > asyncdata_; +}; + +inline void AsyncExecute (uv_work_t* req) { + AsyncWorker *worker = static_cast(req->data); + worker->Execute(); +} + +/* uv_after_work_cb has 1 argument before node-v0.9.4 and + * 2 arguments since node-v0.9.4 + * https://github.com/libuv/libuv/commit/92fb84b751e18f032c02609467f44bfe927b80c5 + */ +inline void AsyncExecuteComplete(uv_work_t *req) { + AsyncWorker* worker = static_cast(req->data); + worker->WorkComplete(); + worker->Destroy(); +} +inline void AsyncExecuteComplete (uv_work_t* req, int status) { + AsyncExecuteComplete(req); +} + +inline void AsyncQueueWorker (AsyncWorker* worker) { + uv_queue_work( + GetCurrentEventLoop() + , &worker->request + , AsyncExecute + , AsyncExecuteComplete + ); +} + +namespace imp { + +inline +ExternalOneByteStringResource const* +GetExternalResource(v8::Local str) { +#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION + return str->GetExternalAsciiStringResource(); +#else + return str->GetExternalOneByteStringResource(); +#endif +} + +inline +bool +IsExternal(v8::Local str) { +#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION + return str->IsExternalAscii(); +#else + return str->IsExternalOneByte(); +#endif +} + +} // end of namespace imp + +enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; + +#if NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION +# include "nan_string_bytes.h" // NOLINT(build/include) +#endif + +inline v8::Local Encode( + const void *buf, size_t len, enum Encoding encoding = BINARY) { +#if (NODE_MODULE_VERSION >= ATOM_0_21_MODULE_VERSION) + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + node::encoding node_enc = static_cast(encoding); + + if (encoding == UCS2) { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len / 2); + } else { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len + , node_enc); + } +#elif (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) + return node::Encode( + v8::Isolate::GetCurrent() + , buf, len + , static_cast(encoding)); +#else +# if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION + return node::Encode(buf, len, static_cast(encoding)); +# else + return imp::Encode(reinterpret_cast(buf), len, encoding); +# endif +#endif +} + +inline ssize_t DecodeBytes( + v8::Local val, enum Encoding encoding = BINARY) { +#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) + return node::DecodeBytes( + v8::Isolate::GetCurrent() + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION) + if (encoding == BUFFER) { + return node::DecodeBytes(val, node::BINARY); + } +# endif + return node::DecodeBytes(val, static_cast(encoding)); +#endif +} + +inline ssize_t DecodeWrite( + char *buf + , size_t len + , v8::Local val + , enum Encoding encoding = BINARY) { +#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) + return node::DecodeWrite( + v8::Isolate::GetCurrent() + , buf + , len + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION) + if (encoding == BUFFER) { + return node::DecodeWrite(buf, len, val, node::BINARY); + } +# endif + return node::DecodeWrite( + buf + , len + , val + , static_cast(encoding)); +#endif +} + +inline void SetPrototypeTemplate( + v8::Local templ + , const char *name + , v8::Local value +) { + HandleScope scope; + SetTemplate(templ->PrototypeTemplate(), name, value); +} + +inline void SetPrototypeTemplate( + v8::Local templ + , v8::Local name + , v8::Local value + , v8::PropertyAttribute attributes +) { + HandleScope scope; + SetTemplate(templ->PrototypeTemplate(), name, value, attributes); +} + +inline void SetInstanceTemplate( + v8::Local templ + , const char *name + , v8::Local value +) { + HandleScope scope; + SetTemplate(templ->InstanceTemplate(), name, value); +} + +inline void SetInstanceTemplate( + v8::Local templ + , v8::Local name + , v8::Local value + , v8::PropertyAttribute attributes +) { + HandleScope scope; + SetTemplate(templ->InstanceTemplate(), name, value, attributes); +} + +namespace imp { + +// Note(@agnat): Helper to distinguish different receiver types. The first +// version deals with receivers derived from v8::Template. The second version +// handles everything else. The final argument only serves as discriminator and +// is unused. +template +inline +void +SetMethodAux(T recv, + v8::Local name, + v8::Local tpl, + v8::Template *) { + recv->Set(name, tpl); +} + +template +inline +void +SetMethodAux(T recv, + v8::Local name, + v8::Local tpl, + ...) { + Set(recv, name, GetFunction(tpl).ToLocalChecked()); +} + +} // end of namespace imp + +template class HandleType> +inline void SetMethod( + HandleType recv + , const char *name + , FunctionCallback callback + , v8::Local data = v8::Local()) { + HandleScope scope; + v8::Local t = New(callback, data); + v8::Local fn_name = New(name).ToLocalChecked(); + t->SetClassName(fn_name); + // Note(@agnat): Pass an empty T* as discriminator. See note on + // SetMethodAux(...) above + imp::SetMethodAux(recv, fn_name, t, static_cast(0)); +} + +inline void SetPrototypeMethod( + v8::Local recv + , const char* name + , FunctionCallback callback + , v8::Local data = v8::Local()) { + HandleScope scope; + v8::Local t = New( + callback + , data + , New(recv)); + v8::Local fn_name = New(name).ToLocalChecked(); + recv->PrototypeTemplate()->Set(fn_name, t); + t->SetClassName(fn_name); +} + +//=== Accessors and Such ======================================================= + +inline void SetAccessor( + v8::Local tpl + , v8::Local name + , GetterCallback getter + , SetterCallback setter = 0 + , v8::Local data = v8::Local() + , v8::AccessControl settings = v8::DEFAULT + , v8::PropertyAttribute attribute = v8::None + , imp::Sig signature = imp::Sig()) { + HandleScope scope; + + imp::NativeGetter getter_ = + imp::GetterCallbackWrapper; + imp::NativeSetter setter_ = + setter ? imp::SetterCallbackWrapper : 0; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kAccessorFieldCount); + v8::Local obj = NewInstance(otpl).ToLocalChecked(); + + obj->SetInternalField( + imp::kGetterIndex + , New(reinterpret_cast(getter))); + + if (setter != 0) { + obj->SetInternalField( + imp::kSetterIndex + , New(reinterpret_cast(setter))); + } + + if (!data.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, data); + } + + tpl->SetAccessor( + name + , getter_ + , setter_ + , obj + , settings + , attribute + , signature); +} + +inline bool SetAccessor( + v8::Local obj + , v8::Local name + , GetterCallback getter + , SetterCallback setter = 0 + , v8::Local data = v8::Local() + , v8::AccessControl settings = v8::DEFAULT + , v8::PropertyAttribute attribute = v8::None) { + HandleScope scope; + + imp::NativeGetter getter_ = + imp::GetterCallbackWrapper; + imp::NativeSetter setter_ = + setter ? imp::SetterCallbackWrapper : 0; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kAccessorFieldCount); + v8::Local dataobj = NewInstance(otpl).ToLocalChecked(); + + dataobj->SetInternalField( + imp::kGetterIndex + , New(reinterpret_cast(getter))); + + if (!data.IsEmpty()) { + dataobj->SetInternalField(imp::kDataIndex, data); + } + + if (setter) { + dataobj->SetInternalField( + imp::kSetterIndex + , New(reinterpret_cast(setter))); + } + +#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) + return obj->SetAccessor( + GetCurrentContext() + , name + , getter_ + , setter_ + , dataobj + , settings + , attribute).FromMaybe(false); +#else + return obj->SetAccessor( + name + , getter_ + , setter_ + , dataobj + , settings + , attribute); +#endif +} + +inline void SetNamedPropertyHandler( + v8::Local tpl + , PropertyGetterCallback getter + , PropertySetterCallback setter = 0 + , PropertyQueryCallback query = 0 + , PropertyDeleterCallback deleter = 0 + , PropertyEnumeratorCallback enumerator = 0 + , v8::Local data = v8::Local()) { + HandleScope scope; + + imp::NativePropertyGetter getter_ = + imp::PropertyGetterCallbackWrapper; + imp::NativePropertySetter setter_ = + setter ? imp::PropertySetterCallbackWrapper : 0; + imp::NativePropertyQuery query_ = + query ? imp::PropertyQueryCallbackWrapper : 0; + imp::NativePropertyDeleter *deleter_ = + deleter ? imp::PropertyDeleterCallbackWrapper : 0; + imp::NativePropertyEnumerator enumerator_ = + enumerator ? imp::PropertyEnumeratorCallbackWrapper : 0; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kPropertyFieldCount); + v8::Local obj = NewInstance(otpl).ToLocalChecked(); + obj->SetInternalField( + imp::kPropertyGetterIndex + , New(reinterpret_cast(getter))); + + if (setter) { + obj->SetInternalField( + imp::kPropertySetterIndex + , New(reinterpret_cast(setter))); + } + + if (query) { + obj->SetInternalField( + imp::kPropertyQueryIndex + , New(reinterpret_cast(query))); + } + + if (deleter) { + obj->SetInternalField( + imp::kPropertyDeleterIndex + , New(reinterpret_cast(deleter))); + } + + if (enumerator) { + obj->SetInternalField( + imp::kPropertyEnumeratorIndex + , New(reinterpret_cast(enumerator))); + } + + if (!data.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, data); + } + +#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION + tpl->SetHandler(v8::NamedPropertyHandlerConfiguration( + getter_, setter_, query_, deleter_, enumerator_, obj)); +#else + tpl->SetNamedPropertyHandler( + getter_ + , setter_ + , query_ + , deleter_ + , enumerator_ + , obj); +#endif +} + +inline void SetIndexedPropertyHandler( + v8::Local tpl + , IndexGetterCallback getter + , IndexSetterCallback setter = 0 + , IndexQueryCallback query = 0 + , IndexDeleterCallback deleter = 0 + , IndexEnumeratorCallback enumerator = 0 + , v8::Local data = v8::Local()) { + HandleScope scope; + + imp::NativeIndexGetter getter_ = + imp::IndexGetterCallbackWrapper; + imp::NativeIndexSetter setter_ = + setter ? imp::IndexSetterCallbackWrapper : 0; + imp::NativeIndexQuery query_ = + query ? imp::IndexQueryCallbackWrapper : 0; + imp::NativeIndexDeleter deleter_ = + deleter ? imp::IndexDeleterCallbackWrapper : 0; + imp::NativeIndexEnumerator enumerator_ = + enumerator ? imp::IndexEnumeratorCallbackWrapper : 0; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kIndexPropertyFieldCount); + v8::Local obj = NewInstance(otpl).ToLocalChecked(); + obj->SetInternalField( + imp::kIndexPropertyGetterIndex + , New(reinterpret_cast(getter))); + + if (setter) { + obj->SetInternalField( + imp::kIndexPropertySetterIndex + , New(reinterpret_cast(setter))); + } + + if (query) { + obj->SetInternalField( + imp::kIndexPropertyQueryIndex + , New(reinterpret_cast(query))); + } + + if (deleter) { + obj->SetInternalField( + imp::kIndexPropertyDeleterIndex + , New(reinterpret_cast(deleter))); + } + + if (enumerator) { + obj->SetInternalField( + imp::kIndexPropertyEnumeratorIndex + , New(reinterpret_cast(enumerator))); + } + + if (!data.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, data); + } + +#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION + tpl->SetHandler(v8::IndexedPropertyHandlerConfiguration( + getter_, setter_, query_, deleter_, enumerator_, obj)); +#else + tpl->SetIndexedPropertyHandler( + getter_ + , setter_ + , query_ + , deleter_ + , enumerator_ + , obj); +#endif +} + +inline void SetCallHandler( + v8::Local tpl + , FunctionCallback callback + , v8::Local data = v8::Local()) { + HandleScope scope; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kFunctionFieldCount); + v8::Local obj = NewInstance(otpl).ToLocalChecked(); + + obj->SetInternalField( + imp::kFunctionIndex + , New(reinterpret_cast(callback))); + + if (!data.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, data); + } + + tpl->SetCallHandler(imp::FunctionCallbackWrapper, obj); +} + + +inline void SetCallAsFunctionHandler( + v8::Local tpl, + FunctionCallback callback, + v8::Local data = v8::Local()) { + HandleScope scope; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kFunctionFieldCount); + v8::Local obj = NewInstance(otpl).ToLocalChecked(); + + obj->SetInternalField( + imp::kFunctionIndex + , New(reinterpret_cast(callback))); + + if (!data.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, data); + } + + tpl->SetCallAsFunctionHandler(imp::FunctionCallbackWrapper, obj); +} + +//=== Weak Persistent Handling ================================================= + +#include "nan_weak.h" // NOLINT(build/include) + +//=== ObjectWrap =============================================================== + +#include "nan_object_wrap.h" // NOLINT(build/include) + +//=== HiddenValue/Private ====================================================== + +#include "nan_private.h" // NOLINT(build/include) + +//=== Export ================================================================== + +inline +void +Export(ADDON_REGISTER_FUNCTION_ARGS_TYPE target, const char *name, + FunctionCallback f) { + HandleScope scope; + + Set(target, New(name).ToLocalChecked(), + GetFunction(New(f)).ToLocalChecked()); +} + +//=== Tap Reverse Binding ===================================================== + +struct Tap { + explicit Tap(v8::Local t) : t_() { + HandleScope scope; + + t_.Reset(To(t).ToLocalChecked()); + } + + ~Tap() { t_.Reset(); } // not sure if necessary + + inline void plan(int i) { + HandleScope scope; + v8::Local arg = New(i); + Call("plan", New(t_), 1, &arg); + } + + inline void ok(bool isOk, const char *msg = NULL) { + HandleScope scope; + v8::Local args[2]; + args[0] = New(isOk); + if (msg) args[1] = New(msg).ToLocalChecked(); + Call("ok", New(t_), msg ? 2 : 1, args); + } + + inline void pass(const char * msg = NULL) { + HandleScope scope; + v8::Local hmsg; + if (msg) hmsg = New(msg).ToLocalChecked(); + Call("pass", New(t_), msg ? 1 : 0, &hmsg); + } + + inline void end() { + HandleScope scope; + Call("end", New(t_), 0, NULL); + } + + private: + Persistent t_; +}; + +#define NAN_STRINGIZE2(x) #x +#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) +#define NAN_TEST_EXPRESSION(expression) \ + ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression + +#define NAN_EXPORT(target, function) Export(target, #function, function) + +#undef TYPE_CHECK + +//=== Generic Maybefication =================================================== + +namespace imp { + +template struct Maybefier; + +template struct Maybefier > { + inline static MaybeLocal convert(v8::Local v) { + return v; + } +}; + +template struct Maybefier > { + inline static MaybeLocal convert(MaybeLocal v) { + return v; + } +}; + +} // end of namespace imp + +template class MaybeMaybe> +inline MaybeLocal +MakeMaybe(MaybeMaybe v) { + return imp::Maybefier >::convert(v); +} + +//=== TypedArrayContents ======================================================= + +#include "nan_typedarray_contents.h" // NOLINT(build/include) + +//=== JSON ===================================================================== + +#include "nan_json.h" // NOLINT(build/include) + +} // end of namespace Nan + +#endif // NAN_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_callbacks.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_callbacks.h new file mode 100644 index 0000000..53ede84 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_callbacks.h @@ -0,0 +1,88 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CALLBACKS_H_ +#define NAN_CALLBACKS_H_ + +template class FunctionCallbackInfo; +template class PropertyCallbackInfo; +template class Global; + +typedef void(*FunctionCallback)(const FunctionCallbackInfo&); +typedef void(*GetterCallback) + (v8::Local, const PropertyCallbackInfo&); +typedef void(*SetterCallback)( + v8::Local, + v8::Local, + const PropertyCallbackInfo&); +typedef void(*PropertyGetterCallback)( + v8::Local, + const PropertyCallbackInfo&); +typedef void(*PropertySetterCallback)( + v8::Local, + v8::Local, + const PropertyCallbackInfo&); +typedef void(*PropertyEnumeratorCallback) + (const PropertyCallbackInfo&); +typedef void(*PropertyDeleterCallback)( + v8::Local, + const PropertyCallbackInfo&); +typedef void(*PropertyQueryCallback)( + v8::Local, + const PropertyCallbackInfo&); +typedef void(*IndexGetterCallback)( + uint32_t, + const PropertyCallbackInfo&); +typedef void(*IndexSetterCallback)( + uint32_t, + v8::Local, + const PropertyCallbackInfo&); +typedef void(*IndexEnumeratorCallback) + (const PropertyCallbackInfo&); +typedef void(*IndexDeleterCallback)( + uint32_t, + const PropertyCallbackInfo&); +typedef void(*IndexQueryCallback)( + uint32_t, + const PropertyCallbackInfo&); + +namespace imp { +typedef v8::Local Sig; + +static const int kDataIndex = 0; + +static const int kFunctionIndex = 1; +static const int kFunctionFieldCount = 2; + +static const int kGetterIndex = 1; +static const int kSetterIndex = 2; +static const int kAccessorFieldCount = 3; + +static const int kPropertyGetterIndex = 1; +static const int kPropertySetterIndex = 2; +static const int kPropertyEnumeratorIndex = 3; +static const int kPropertyDeleterIndex = 4; +static const int kPropertyQueryIndex = 5; +static const int kPropertyFieldCount = 6; + +static const int kIndexPropertyGetterIndex = 1; +static const int kIndexPropertySetterIndex = 2; +static const int kIndexPropertyEnumeratorIndex = 3; +static const int kIndexPropertyDeleterIndex = 4; +static const int kIndexPropertyQueryIndex = 5; +static const int kIndexPropertyFieldCount = 6; + +} // end of namespace imp + +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION +# include "nan_callbacks_12_inl.h" // NOLINT(build/include) +#else +# include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include) +#endif + +#endif // NAN_CALLBACKS_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_callbacks_12_inl.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_callbacks_12_inl.h new file mode 100644 index 0000000..c27b18d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_callbacks_12_inl.h @@ -0,0 +1,514 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CALLBACKS_12_INL_H_ +#define NAN_CALLBACKS_12_INL_H_ + +template +class ReturnValue { + v8::ReturnValue value_; + + public: + template + explicit inline ReturnValue(const v8::ReturnValue &value) : + value_(value) {} + template + explicit inline ReturnValue(const ReturnValue& that) + : value_(that.value_) { + TYPE_CHECK(T, S); + } + + // Handle setters + template inline void Set(const v8::Local &handle) { + TYPE_CHECK(T, S); + value_.Set(handle); + } + + template inline void Set(const Global &handle) { + TYPE_CHECK(T, S); +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && \ + (V8_MINOR_VERSION > 5 || (V8_MINOR_VERSION == 5 && \ + defined(V8_BUILD_NUMBER) && V8_BUILD_NUMBER >= 8)))) + value_.Set(handle); +#else + value_.Set(*reinterpret_cast*>(&handle)); + const_cast &>(handle).Reset(); +#endif + } + + // Fast primitive setters + inline void Set(bool value) { + TYPE_CHECK(T, v8::Boolean); + value_.Set(value); + } + + inline void Set(double i) { + TYPE_CHECK(T, v8::Number); + value_.Set(i); + } + + inline void Set(int32_t i) { + TYPE_CHECK(T, v8::Integer); + value_.Set(i); + } + + inline void Set(uint32_t i) { + TYPE_CHECK(T, v8::Integer); + value_.Set(i); + } + + // Fast JS primitive setters + inline void SetNull() { + TYPE_CHECK(T, v8::Primitive); + value_.SetNull(); + } + + inline void SetUndefined() { + TYPE_CHECK(T, v8::Primitive); + value_.SetUndefined(); + } + + inline void SetEmptyString() { + TYPE_CHECK(T, v8::String); + value_.SetEmptyString(); + } + + // Convenience getter for isolate + inline v8::Isolate *GetIsolate() const { + return value_.GetIsolate(); + } + + // Pointer setter: Uncompilable to prevent inadvertent misuse. + template + inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } +}; + +template +class FunctionCallbackInfo { + const v8::FunctionCallbackInfo &info_; + const v8::Local data_; + + public: + explicit inline FunctionCallbackInfo( + const v8::FunctionCallbackInfo &info + , v8::Local data) : + info_(info) + , data_(data) {} + + inline ReturnValue GetReturnValue() const { + return ReturnValue(info_.GetReturnValue()); + } + +#if NODE_MAJOR_VERSION < 10 + inline v8::Local Callee() const { return info_.Callee(); } +#endif + inline v8::Local Data() const { return data_; } + inline v8::Local Holder() const { return info_.Holder(); } + inline bool IsConstructCall() const { return info_.IsConstructCall(); } + inline int Length() const { return info_.Length(); } + inline v8::Local operator[](int i) const { return info_[i]; } + inline v8::Local This() const { return info_.This(); } + inline v8::Isolate *GetIsolate() const { return info_.GetIsolate(); } + + + protected: + static const int kHolderIndex = 0; + static const int kIsolateIndex = 1; + static const int kReturnValueDefaultValueIndex = 2; + static const int kReturnValueIndex = 3; + static const int kDataIndex = 4; + static const int kCalleeIndex = 5; + static const int kContextSaveIndex = 6; + static const int kArgsLength = 7; + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo) +}; + +template +class PropertyCallbackInfo { + const v8::PropertyCallbackInfo &info_; + const v8::Local data_; + + public: + explicit inline PropertyCallbackInfo( + const v8::PropertyCallbackInfo &info + , const v8::Local data) : + info_(info) + , data_(data) {} + + inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } + inline v8::Local Data() const { return data_; } + inline v8::Local This() const { return info_.This(); } + inline v8::Local Holder() const { return info_.Holder(); } + inline ReturnValue GetReturnValue() const { + return ReturnValue(info_.GetReturnValue()); + } + + protected: + static const int kHolderIndex = 0; + static const int kIsolateIndex = 1; + static const int kReturnValueDefaultValueIndex = 2; + static const int kReturnValueIndex = 3; + static const int kDataIndex = 4; + static const int kThisIndex = 5; + static const int kArgsLength = 6; + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfo) +}; + +namespace imp { +static +void FunctionCallbackWrapper(const v8::FunctionCallbackInfo &info) { + v8::Local obj = info.Data().As(); + FunctionCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kFunctionIndex).As()->Value())); + FunctionCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + callback(cbinfo); +} + +typedef void (*NativeFunction)(const v8::FunctionCallbackInfo &); + +#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION +static +void GetterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + GetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kGetterIndex).As()->Value())); + callback(property.As(), cbinfo); +} + +typedef void (*NativeGetter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void SetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + SetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kSetterIndex).As()->Value())); + callback(property.As(), value, cbinfo); +} + +typedef void (*NativeSetter)( + v8::Local + , v8::Local + , const v8::PropertyCallbackInfo &); +#else +static +void GetterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + GetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kGetterIndex).As()->Value())); + callback(property, cbinfo); +} + +typedef void (*NativeGetter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void SetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + SetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kSetterIndex).As()->Value())); + callback(property, value, cbinfo); +} + +typedef void (*NativeSetter)( + v8::Local + , v8::Local + , const v8::PropertyCallbackInfo &); +#endif + +#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION +static +void PropertyGetterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyGetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyGetterIndex) + .As()->Value())); + callback(property.As(), cbinfo); +} + +typedef void (*NativePropertyGetter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void PropertySetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertySetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertySetterIndex) + .As()->Value())); + callback(property.As(), value, cbinfo); +} + +typedef void (*NativePropertySetter)( + v8::Local + , v8::Local + , const v8::PropertyCallbackInfo &); + +static +void PropertyEnumeratorCallbackWrapper( + const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyEnumeratorCallback callback = + reinterpret_cast(reinterpret_cast( + obj->GetInternalField(kPropertyEnumeratorIndex) + .As()->Value())); + callback(cbinfo); +} + +typedef void (*NativePropertyEnumerator) + (const v8::PropertyCallbackInfo &); + +static +void PropertyDeleterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyDeleterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyDeleterIndex) + .As()->Value())); + callback(property.As(), cbinfo); +} + +typedef void (NativePropertyDeleter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void PropertyQueryCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyQueryCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyQueryIndex) + .As()->Value())); + callback(property.As(), cbinfo); +} + +typedef void (*NativePropertyQuery) + (v8::Local, const v8::PropertyCallbackInfo &); +#else +static +void PropertyGetterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyGetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyGetterIndex) + .As()->Value())); + callback(property, cbinfo); +} + +typedef void (*NativePropertyGetter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void PropertySetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertySetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertySetterIndex) + .As()->Value())); + callback(property, value, cbinfo); +} + +typedef void (*NativePropertySetter)( + v8::Local + , v8::Local + , const v8::PropertyCallbackInfo &); + +static +void PropertyEnumeratorCallbackWrapper( + const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyEnumeratorCallback callback = + reinterpret_cast(reinterpret_cast( + obj->GetInternalField(kPropertyEnumeratorIndex) + .As()->Value())); + callback(cbinfo); +} + +typedef void (*NativePropertyEnumerator) + (const v8::PropertyCallbackInfo &); + +static +void PropertyDeleterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyDeleterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyDeleterIndex) + .As()->Value())); + callback(property, cbinfo); +} + +typedef void (NativePropertyDeleter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void PropertyQueryCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyQueryCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyQueryIndex) + .As()->Value())); + callback(property, cbinfo); +} + +typedef void (*NativePropertyQuery) + (v8::Local, const v8::PropertyCallbackInfo &); +#endif + +static +void IndexGetterCallbackWrapper( + uint32_t index, const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexGetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyGetterIndex) + .As()->Value())); + callback(index, cbinfo); +} + +typedef void (*NativeIndexGetter) + (uint32_t, const v8::PropertyCallbackInfo &); + +static +void IndexSetterCallbackWrapper( + uint32_t index + , v8::Local value + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexSetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertySetterIndex) + .As()->Value())); + callback(index, value, cbinfo); +} + +typedef void (*NativeIndexSetter)( + uint32_t + , v8::Local + , const v8::PropertyCallbackInfo &); + +static +void IndexEnumeratorCallbackWrapper( + const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexEnumeratorCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField( + kIndexPropertyEnumeratorIndex).As()->Value())); + callback(cbinfo); +} + +typedef void (*NativeIndexEnumerator) + (const v8::PropertyCallbackInfo &); + +static +void IndexDeleterCallbackWrapper( + uint32_t index, const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexDeleterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyDeleterIndex) + .As()->Value())); + callback(index, cbinfo); +} + +typedef void (*NativeIndexDeleter) + (uint32_t, const v8::PropertyCallbackInfo &); + +static +void IndexQueryCallbackWrapper( + uint32_t index, const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexQueryCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyQueryIndex) + .As()->Value())); + callback(index, cbinfo); +} + +typedef void (*NativeIndexQuery) + (uint32_t, const v8::PropertyCallbackInfo &); +} // end of namespace imp + +#endif // NAN_CALLBACKS_12_INL_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_callbacks_pre_12_inl.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_callbacks_pre_12_inl.h new file mode 100644 index 0000000..c9ba499 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_callbacks_pre_12_inl.h @@ -0,0 +1,520 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CALLBACKS_PRE_12_INL_H_ +#define NAN_CALLBACKS_PRE_12_INL_H_ + +namespace imp { +template class ReturnValueImp; +} // end of namespace imp + +template +class ReturnValue { + v8::Isolate *isolate_; + v8::Persistent *value_; + friend class imp::ReturnValueImp; + + public: + template + explicit inline ReturnValue(v8::Isolate *isolate, v8::Persistent *p) : + isolate_(isolate), value_(p) {} + template + explicit inline ReturnValue(const ReturnValue& that) + : isolate_(that.isolate_), value_(that.value_) { + TYPE_CHECK(T, S); + } + + // Handle setters + template inline void Set(const v8::Local &handle) { + TYPE_CHECK(T, S); + value_->Dispose(); + *value_ = v8::Persistent::New(handle); + } + + template inline void Set(const Global &handle) { + TYPE_CHECK(T, S); + value_->Dispose(); + *value_ = v8::Persistent::New(handle.persistent); + const_cast &>(handle).Reset(); + } + + // Fast primitive setters + inline void Set(bool value) { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Boolean); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Boolean::New(value)); + } + + inline void Set(double i) { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Number); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Number::New(i)); + } + + inline void Set(int32_t i) { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Integer); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Int32::New(i)); + } + + inline void Set(uint32_t i) { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Integer); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Uint32::NewFromUnsigned(i)); + } + + // Fast JS primitive setters + inline void SetNull() { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Primitive); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Null()); + } + + inline void SetUndefined() { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Primitive); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Undefined()); + } + + inline void SetEmptyString() { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::String); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::String::Empty()); + } + + // Convenience getter for isolate + inline v8::Isolate *GetIsolate() const { + return isolate_; + } + + // Pointer setter: Uncompilable to prevent inadvertent misuse. + template + inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } +}; + +template +class FunctionCallbackInfo { + const v8::Arguments &args_; + v8::Local data_; + ReturnValue return_value_; + v8::Persistent retval_; + + public: + explicit inline FunctionCallbackInfo( + const v8::Arguments &args + , v8::Local data) : + args_(args) + , data_(data) + , return_value_(args.GetIsolate(), &retval_) + , retval_(v8::Persistent::New(v8::Undefined())) {} + + inline ~FunctionCallbackInfo() { + retval_.Dispose(); + retval_.Clear(); + } + + inline ReturnValue GetReturnValue() const { + return ReturnValue(return_value_); + } + + inline v8::Local Callee() const { return args_.Callee(); } + inline v8::Local Data() const { return data_; } + inline v8::Local Holder() const { return args_.Holder(); } + inline bool IsConstructCall() const { return args_.IsConstructCall(); } + inline int Length() const { return args_.Length(); } + inline v8::Local operator[](int i) const { return args_[i]; } + inline v8::Local This() const { return args_.This(); } + inline v8::Isolate *GetIsolate() const { return args_.GetIsolate(); } + + + protected: + static const int kHolderIndex = 0; + static const int kIsolateIndex = 1; + static const int kReturnValueDefaultValueIndex = 2; + static const int kReturnValueIndex = 3; + static const int kDataIndex = 4; + static const int kCalleeIndex = 5; + static const int kContextSaveIndex = 6; + static const int kArgsLength = 7; + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo) +}; + +template +class PropertyCallbackInfoBase { + const v8::AccessorInfo &info_; + const v8::Local data_; + + public: + explicit inline PropertyCallbackInfoBase( + const v8::AccessorInfo &info + , const v8::Local data) : + info_(info) + , data_(data) {} + + inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } + inline v8::Local Data() const { return data_; } + inline v8::Local This() const { return info_.This(); } + inline v8::Local Holder() const { return info_.Holder(); } + + protected: + static const int kHolderIndex = 0; + static const int kIsolateIndex = 1; + static const int kReturnValueDefaultValueIndex = 2; + static const int kReturnValueIndex = 3; + static const int kDataIndex = 4; + static const int kThisIndex = 5; + static const int kArgsLength = 6; + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfoBase) +}; + +template +class PropertyCallbackInfo : public PropertyCallbackInfoBase { + ReturnValue return_value_; + v8::Persistent retval_; + + public: + explicit inline PropertyCallbackInfo( + const v8::AccessorInfo &info + , const v8::Local data) : + PropertyCallbackInfoBase(info, data) + , return_value_(info.GetIsolate(), &retval_) + , retval_(v8::Persistent::New(v8::Undefined())) {} + + inline ~PropertyCallbackInfo() { + retval_.Dispose(); + retval_.Clear(); + } + + inline ReturnValue GetReturnValue() const { return return_value_; } +}; + +template<> +class PropertyCallbackInfo : + public PropertyCallbackInfoBase { + ReturnValue return_value_; + v8::Persistent retval_; + + public: + explicit inline PropertyCallbackInfo( + const v8::AccessorInfo &info + , const v8::Local data) : + PropertyCallbackInfoBase(info, data) + , return_value_(info.GetIsolate(), &retval_) + , retval_(v8::Persistent::New(v8::Local())) {} + + inline ~PropertyCallbackInfo() { + retval_.Dispose(); + retval_.Clear(); + } + + inline ReturnValue GetReturnValue() const { + return return_value_; + } +}; + +template<> +class PropertyCallbackInfo : + public PropertyCallbackInfoBase { + ReturnValue return_value_; + v8::Persistent retval_; + + public: + explicit inline PropertyCallbackInfo( + const v8::AccessorInfo &info + , const v8::Local data) : + PropertyCallbackInfoBase(info, data) + , return_value_(info.GetIsolate(), &retval_) + , retval_(v8::Persistent::New(v8::Local())) {} + + inline ~PropertyCallbackInfo() { + retval_.Dispose(); + retval_.Clear(); + } + + inline ReturnValue GetReturnValue() const { + return return_value_; + } +}; + +template<> +class PropertyCallbackInfo : + public PropertyCallbackInfoBase { + ReturnValue return_value_; + v8::Persistent retval_; + + public: + explicit inline PropertyCallbackInfo( + const v8::AccessorInfo &info + , const v8::Local data) : + PropertyCallbackInfoBase(info, data) + , return_value_(info.GetIsolate(), &retval_) + , retval_(v8::Persistent::New(v8::Local())) {} + + inline ~PropertyCallbackInfo() { + retval_.Dispose(); + retval_.Clear(); + } + + inline ReturnValue GetReturnValue() const { + return return_value_; + } +}; + +namespace imp { +template +class ReturnValueImp : public ReturnValue { + public: + explicit ReturnValueImp(ReturnValue that) : + ReturnValue(that) {} + inline v8::Handle Value() { + return *ReturnValue::value_; + } +}; + +static +v8::Handle FunctionCallbackWrapper(const v8::Arguments &args) { + v8::Local obj = args.Data().As(); + FunctionCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kFunctionIndex).As()->Value())); + FunctionCallbackInfo + cbinfo(args, obj->GetInternalField(kDataIndex)); + callback(cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeFunction)(const v8::Arguments &); + +static +v8::Handle GetterCallbackWrapper( + v8::Local property, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + GetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kGetterIndex).As()->Value())); + callback(property, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeGetter) + (v8::Local, const v8::AccessorInfo &); + +static +void SetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + SetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kSetterIndex).As()->Value())); + callback(property, value, cbinfo); +} + +typedef void (*NativeSetter) + (v8::Local, v8::Local, const v8::AccessorInfo &); + +static +v8::Handle PropertyGetterCallbackWrapper( + v8::Local property, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyGetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyGetterIndex) + .As()->Value())); + callback(property, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativePropertyGetter) + (v8::Local, const v8::AccessorInfo &); + +static +v8::Handle PropertySetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertySetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertySetterIndex) + .As()->Value())); + callback(property, value, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativePropertySetter) + (v8::Local, v8::Local, const v8::AccessorInfo &); + +static +v8::Handle PropertyEnumeratorCallbackWrapper( + const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyEnumeratorCallback callback = + reinterpret_cast(reinterpret_cast( + obj->GetInternalField(kPropertyEnumeratorIndex) + .As()->Value())); + callback(cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativePropertyEnumerator) + (const v8::AccessorInfo &); + +static +v8::Handle PropertyDeleterCallbackWrapper( + v8::Local property + , const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyDeleterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyDeleterIndex) + .As()->Value())); + callback(property, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (NativePropertyDeleter) + (v8::Local, const v8::AccessorInfo &); + +static +v8::Handle PropertyQueryCallbackWrapper( + v8::Local property, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyQueryCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyQueryIndex) + .As()->Value())); + callback(property, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativePropertyQuery) + (v8::Local, const v8::AccessorInfo &); + +static +v8::Handle IndexGetterCallbackWrapper( + uint32_t index, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexGetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyGetterIndex) + .As()->Value())); + callback(index, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeIndexGetter) + (uint32_t, const v8::AccessorInfo &); + +static +v8::Handle IndexSetterCallbackWrapper( + uint32_t index + , v8::Local value + , const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexSetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertySetterIndex) + .As()->Value())); + callback(index, value, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeIndexSetter) + (uint32_t, v8::Local, const v8::AccessorInfo &); + +static +v8::Handle IndexEnumeratorCallbackWrapper( + const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexEnumeratorCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyEnumeratorIndex) + .As()->Value())); + callback(cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeIndexEnumerator) + (const v8::AccessorInfo &); + +static +v8::Handle IndexDeleterCallbackWrapper( + uint32_t index, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexDeleterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyDeleterIndex) + .As()->Value())); + callback(index, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeIndexDeleter) + (uint32_t, const v8::AccessorInfo &); + +static +v8::Handle IndexQueryCallbackWrapper( + uint32_t index, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexQueryCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyQueryIndex) + .As()->Value())); + callback(index, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeIndexQuery) + (uint32_t, const v8::AccessorInfo &); +} // end of namespace imp + +#endif // NAN_CALLBACKS_PRE_12_INL_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_converters.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_converters.h new file mode 100644 index 0000000..c0b3272 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_converters.h @@ -0,0 +1,72 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CONVERTERS_H_ +#define NAN_CONVERTERS_H_ + +namespace imp { +template struct ToFactoryBase { + typedef MaybeLocal return_t; +}; +template struct ValueFactoryBase { typedef Maybe return_t; }; + +template struct ToFactory; + +template<> +struct ToFactory : ToFactoryBase { + static inline return_t convert(v8::Local val) { + if (val.IsEmpty() || !val->IsFunction()) return MaybeLocal(); + return MaybeLocal(val.As()); + } +}; + +#define X(TYPE) \ + template<> \ + struct ToFactory : ToFactoryBase { \ + static inline return_t convert(v8::Local val); \ + }; + +X(Boolean) +X(Number) +X(String) +X(Object) +X(Integer) +X(Uint32) +X(Int32) + +#undef X + +#define X(TYPE) \ + template<> \ + struct ToFactory : ValueFactoryBase { \ + static inline return_t convert(v8::Local val); \ + }; + +X(bool) +X(double) +X(int64_t) +X(uint32_t) +X(int32_t) + +#undef X +} // end of namespace imp + +template +inline +typename imp::ToFactory::return_t To(v8::Local val) { + return imp::ToFactory::convert(val); +} + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +# include "nan_converters_43_inl.h" +#else +# include "nan_converters_pre_43_inl.h" +#endif + +#endif // NAN_CONVERTERS_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_converters_43_inl.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_converters_43_inl.h new file mode 100644 index 0000000..41b72de --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_converters_43_inl.h @@ -0,0 +1,68 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CONVERTERS_43_INL_H_ +#define NAN_CONVERTERS_43_INL_H_ + +#define X(TYPE) \ +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ + v8::EscapableHandleScope scope(isolate); \ + return scope.Escape( \ + val->To ## TYPE(isolate->GetCurrentContext()) \ + .FromMaybe(v8::Local())); \ +} + +X(Number) +X(String) +X(Object) +X(Integer) +X(Uint32) +X(Int32) +// V8 <= 7.0 +#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) +X(Boolean) +#else +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ + v8::EscapableHandleScope scope(isolate); \ + return scope.Escape(val->ToBoolean(isolate)); \ +} +#endif + +#undef X + +#define X(TYPE, NAME) \ +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ + v8::HandleScope scope(isolate); \ + return val->NAME ## Value(isolate->GetCurrentContext()); \ +} + +X(double, Number) +X(int64_t, Integer) +X(uint32_t, Uint32) +X(int32_t, Int32) +// V8 <= 7.0 +#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) +X(bool, Boolean) +#else +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ + v8::HandleScope scope(isolate); \ + return Just(val->BooleanValue(isolate)); \ +} +#endif + +#undef X + +#endif // NAN_CONVERTERS_43_INL_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_converters_pre_43_inl.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_converters_pre_43_inl.h new file mode 100644 index 0000000..ae0518a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_converters_pre_43_inl.h @@ -0,0 +1,42 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CONVERTERS_PRE_43_INL_H_ +#define NAN_CONVERTERS_PRE_43_INL_H_ + +#define X(TYPE) \ +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + return val->To ## TYPE(); \ +} + +X(Boolean) +X(Number) +X(String) +X(Object) +X(Integer) +X(Uint32) +X(Int32) + +#undef X + +#define X(TYPE, NAME) \ +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + return Just(val->NAME ## Value()); \ +} + +X(bool, Boolean) +X(double, Number) +X(int64_t, Integer) +X(uint32_t, Uint32) +X(int32_t, Int32) + +#undef X + +#endif // NAN_CONVERTERS_PRE_43_INL_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_define_own_property_helper.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_define_own_property_helper.h new file mode 100644 index 0000000..d710ef2 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_define_own_property_helper.h @@ -0,0 +1,29 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_ +#define NAN_DEFINE_OWN_PROPERTY_HELPER_H_ + +namespace imp { + +inline Maybe DefineOwnPropertyHelper( + v8::PropertyAttribute current + , v8::Handle obj + , v8::Handle key + , v8::Handle value + , v8::PropertyAttribute attribs = v8::None) { + return !(current & v8::DontDelete) || // configurable OR + (!(current & v8::ReadOnly) && // writable AND + !((attribs ^ current) & ~v8::ReadOnly)) // same excluding RO + ? Just(obj->ForceSet(key, value, attribs)) + : Nothing(); +} + +} // end of namespace imp + +#endif // NAN_DEFINE_OWN_PROPERTY_HELPER_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_implementation_12_inl.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_implementation_12_inl.h new file mode 100644 index 0000000..255293a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_implementation_12_inl.h @@ -0,0 +1,430 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_12_INL_H_ +#define NAN_IMPLEMENTATION_12_INL_H_ +//============================================================================== +// node v0.11 implementation +//============================================================================== + +namespace imp { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(v8::Isolate::GetCurrent()); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(v8::Isolate::GetCurrent(), length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(v8::Isolate::GetCurrent(), value); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { +#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) + return v8::BooleanObject::New( + v8::Isolate::GetCurrent(), value).As(); +#else + return v8::BooleanObject::New(value).As(); +#endif +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Local tmpl + , v8::Local obj) { + return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj); +} + +//=== Date ===================================================================== + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +Factory::return_t +Factory::New(double value) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(v8::Date::New(isolate->GetCurrentContext(), value) + .FromMaybe(v8::Local()).As()); +} +#else +Factory::return_t +Factory::New(double value) { + return v8::Date::New(v8::Isolate::GetCurrent(), value).As(); +} +#endif + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(v8::Isolate::GetCurrent(), value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( FunctionCallback callback + , v8::Local data) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::Local tpl = v8::ObjectTemplate::New(isolate); + tpl->SetInternalFieldCount(imp::kFunctionFieldCount); + v8::Local obj = NewInstance(tpl).ToLocalChecked(); + + obj->SetInternalField( + imp::kFunctionIndex + , v8::External::New(isolate, reinterpret_cast(callback))); + + v8::Local val = v8::Local::New(isolate, data); + + if (!val.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, val); + } + +#if NODE_MAJOR_VERSION >= 10 + v8::Local context = isolate->GetCurrentContext(); + v8::Local function = + v8::Function::New(context, imp::FunctionCallbackWrapper, obj) + .ToLocalChecked(); +#else + v8::Local function = + v8::Function::New(isolate, imp::FunctionCallbackWrapper, obj); +#endif + + return scope.Escape(function); +} + +//=== Function Template ======================================================== + +Factory::return_t +Factory::New( FunctionCallback callback + , v8::Local data + , v8::Local signature) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + if (callback) { + v8::EscapableHandleScope scope(isolate); + v8::Local tpl = v8::ObjectTemplate::New(isolate); + tpl->SetInternalFieldCount(imp::kFunctionFieldCount); + v8::Local obj = NewInstance(tpl).ToLocalChecked(); + + obj->SetInternalField( + imp::kFunctionIndex + , v8::External::New(isolate, reinterpret_cast(callback))); + v8::Local val = v8::Local::New(isolate, data); + + if (!val.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, val); + } + + return scope.Escape(v8::FunctionTemplate::New( isolate + , imp::FunctionCallbackWrapper + , obj + , signature)); + } else { + return v8::FunctionTemplate::New(isolate, 0, data, signature); + } +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(v8::Isolate::GetCurrent(), value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New( v8::Isolate::GetCurrent() + , value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(v8::Isolate::GetCurrent(), value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(v8::Isolate::GetCurrent()); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(v8::Isolate::GetCurrent()); +} + +//=== RegExp =================================================================== + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +Factory::return_t +Factory::New( + v8::Local pattern + , v8::RegExp::Flags flags) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + v8::RegExp::New(isolate->GetCurrentContext(), pattern, flags) + .FromMaybe(v8::Local())); +} +#else +Factory::return_t +Factory::New( + v8::Local pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} +#endif + +//=== Script =================================================================== + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +Factory::return_t +Factory::New( v8::Local source) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::ScriptCompiler::Source src(source); + return scope.Escape( + v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src) + .FromMaybe(v8::Local())); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::ScriptCompiler::Source src(source, origin); + return scope.Escape( + v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src) + .FromMaybe(v8::Local())); +} +#else +Factory::return_t +Factory::New( v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} +#endif + +//=== Signature ================================================================ + +Factory::return_t +Factory::New(Factory::FTH receiver) { + return v8::Signature::New(v8::Isolate::GetCurrent(), receiver); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(v8::Isolate::GetCurrent()); +} + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::NewFromUtf8( + v8::Isolate::GetCurrent(), value, v8::NewStringType::kNormal, length); +} + +Factory::return_t +Factory::New(std::string const& value) { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), + value.data(), v8::NewStringType::kNormal, static_cast(value.size())); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, + v8::NewStringType::kNormal, length); +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternalTwoByte(v8::Isolate::GetCurrent(), value); +} + +Factory::return_t +Factory::New(ExternalOneByteStringResource * value) { + return v8::String::NewExternalOneByte(v8::Isolate::GetCurrent(), value); +} +#else +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New( + std::string const& value) /* NOLINT(build/include_what_you_use) */ { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value.data(), + v8::String::kNormalString, + static_cast(value.size())); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} + +Factory::return_t +Factory::New(ExternalOneByteStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} +#endif + +//=== String Object ============================================================ + +// See https://github.com/nodejs/nan/pull/811#discussion_r224594980. +// Disable the warning as there is no way around it. +// TODO(bnoordhuis) Use isolate-based version in Node.js v12. +Factory::return_t +Factory::New(v8::Local value) { +// V8 > 7.0 +#if V8_MAJOR_VERSION > 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION > 0) + return v8::StringObject::New(v8::Isolate::GetCurrent(), value) + .As(); +#else +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4996) +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + return v8::StringObject::New(value).As(); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#endif +} + +//=== Unbound Script =========================================================== + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +Factory::return_t +Factory::New(v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::CompileUnboundScript( + v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::CompileUnboundScript( + v8::Isolate::GetCurrent(), &src); +} +#else +Factory::return_t +Factory::New(v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} +#endif + +} // end of namespace imp + +//=== Presistents and Handles ================================================== + +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION +template +inline v8::Local New(v8::Handle h) { + return v8::Local::New(v8::Isolate::GetCurrent(), h); +} +#endif + +template +inline v8::Local New(v8::Persistent const& p) { + return v8::Local::New(v8::Isolate::GetCurrent(), p); +} + +template +inline v8::Local New(Persistent const& p) { + return v8::Local::New(v8::Isolate::GetCurrent(), p); +} + +template +inline v8::Local New(Global const& p) { + return v8::Local::New(v8::Isolate::GetCurrent(), p); +} + +#endif // NAN_IMPLEMENTATION_12_INL_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_implementation_pre_12_inl.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_implementation_pre_12_inl.h new file mode 100644 index 0000000..1472421 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_implementation_pre_12_inl.h @@ -0,0 +1,263 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_ +#define NAN_IMPLEMENTATION_PRE_12_INL_H_ + +//============================================================================== +// node v0.10 implementation +//============================================================================== + +namespace imp { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(value)->ToBoolean(); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::BooleanObject::New(value).As(); +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Local tmpl + , v8::Local obj) { + v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = v8::Local::New(ctx); + ctx.Dispose(); + return lctx; +} + +//=== Date ===================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Date::New(value).As(); +} + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( FunctionCallback callback + , v8::Local data) { + v8::HandleScope scope; + + return scope.Close(Factory::New( + callback, data, v8::Local()) + ->GetFunction()); +} + + +//=== FunctionTemplate ========================================================= + +Factory::return_t +Factory::New( FunctionCallback callback + , v8::Local data + , v8::Local signature) { + if (callback) { + v8::HandleScope scope; + + v8::Local tpl = v8::ObjectTemplate::New(); + tpl->SetInternalFieldCount(imp::kFunctionFieldCount); + v8::Local obj = tpl->NewInstance(); + + obj->SetInternalField( + imp::kFunctionIndex + , v8::External::New(reinterpret_cast(callback))); + + v8::Local val = v8::Local::New(data); + + if (!val.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, val); + } + + // Note(agnat): Emulate length argument here. Unfortunately, I couldn't find + // a way. Have at it though... + return scope.Close( + v8::FunctionTemplate::New(imp::FunctionCallbackWrapper + , obj + , signature)); + } else { + return v8::FunctionTemplate::New(0, data, signature); + } +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New(value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(); +} + +//=== RegExp =================================================================== + +Factory::return_t +Factory::New( + v8::Local pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} + +//=== Script =================================================================== + +Factory::return_t +Factory::New( v8::Local source) { + return v8::Script::New(source); +} +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + return v8::Script::New(source, const_cast(&origin)); +} + +//=== Signature ================================================================ + +Factory::return_t +Factory::New(Factory::FTH receiver) { + return v8::Signature::New(receiver); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(); +} + +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New( + std::string const& value) /* NOLINT(build/include_what_you_use) */ { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::New(value.data(), static_cast(value.size())); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(value); +} + +Factory::return_t +Factory::New(v8::String::ExternalAsciiStringResource * value) { + return v8::String::NewExternal(value); +} + +//=== String Object ============================================================ + +Factory::return_t +Factory::New(v8::Local value) { + return v8::StringObject::New(value).As(); +} + +} // end of namespace imp + +//=== Presistents and Handles ================================================== + +template +inline v8::Local New(v8::Handle h) { + return v8::Local::New(h); +} + +template +inline v8::Local New(v8::Persistent const& p) { + return v8::Local::New(p); +} + +template +inline v8::Local New(Persistent const& p) { + return v8::Local::New(p.persistent); +} + +template +inline v8::Local New(Global const& p) { + return v8::Local::New(p.persistent); +} + +#endif // NAN_IMPLEMENTATION_PRE_12_INL_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_json.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_json.h new file mode 100644 index 0000000..33ac8ba --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_json.h @@ -0,0 +1,166 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_JSON_H_ +#define NAN_JSON_H_ + +#if NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION +#define NAN_JSON_H_NEED_PARSE 1 +#else +#define NAN_JSON_H_NEED_PARSE 0 +#endif // NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION + +#if NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION +#define NAN_JSON_H_NEED_STRINGIFY 0 +#else +#define NAN_JSON_H_NEED_STRINGIFY 1 +#endif // NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION + +class JSON { + public: + JSON() { +#if NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY + Nan::HandleScope scope; + + Nan::MaybeLocal maybe_global_json = Nan::Get( + Nan::GetCurrentContext()->Global(), + Nan::New("JSON").ToLocalChecked() + ); + + assert(!maybe_global_json.IsEmpty() && "global JSON is empty"); + v8::Local val_global_json = maybe_global_json.ToLocalChecked(); + + assert(val_global_json->IsObject() && "global JSON is not an object"); + Nan::MaybeLocal maybe_obj_global_json = + Nan::To(val_global_json); + + assert(!maybe_obj_global_json.IsEmpty() && "global JSON object is empty"); + v8::Local global_json = maybe_obj_global_json.ToLocalChecked(); + +#if NAN_JSON_H_NEED_PARSE + Nan::MaybeLocal maybe_parse_method = Nan::Get( + global_json, Nan::New("parse").ToLocalChecked() + ); + + assert(!maybe_parse_method.IsEmpty() && "JSON.parse is empty"); + v8::Local parse_method = maybe_parse_method.ToLocalChecked(); + + assert(parse_method->IsFunction() && "JSON.parse is not a function"); + parse_cb_.Reset(parse_method.As()); +#endif // NAN_JSON_H_NEED_PARSE + +#if NAN_JSON_H_NEED_STRINGIFY + Nan::MaybeLocal maybe_stringify_method = Nan::Get( + global_json, Nan::New("stringify").ToLocalChecked() + ); + + assert(!maybe_stringify_method.IsEmpty() && "JSON.stringify is empty"); + v8::Local stringify_method = + maybe_stringify_method.ToLocalChecked(); + + assert( + stringify_method->IsFunction() && "JSON.stringify is not a function" + ); + stringify_cb_.Reset(stringify_method.As()); +#endif // NAN_JSON_H_NEED_STRINGIFY +#endif // NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY + } + + inline + Nan::MaybeLocal Parse(v8::Local json_string) { + Nan::EscapableHandleScope scope; +#if NAN_JSON_H_NEED_PARSE + return scope.Escape(parse(json_string)); +#else + Nan::MaybeLocal result; +#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && \ + NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION + result = v8::JSON::Parse(json_string); +#else +#if NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION + v8::Local context_or_isolate = Nan::GetCurrentContext(); +#else + v8::Isolate* context_or_isolate = v8::Isolate::GetCurrent(); +#endif // NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION + result = v8::JSON::Parse(context_or_isolate, json_string); +#endif // NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && + // NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION + if (result.IsEmpty()) return v8::Local(); + return scope.Escape(result.ToLocalChecked()); +#endif // NAN_JSON_H_NEED_PARSE + } + + inline + Nan::MaybeLocal Stringify(v8::Local json_object) { + Nan::EscapableHandleScope scope; + Nan::MaybeLocal result = +#if NAN_JSON_H_NEED_STRINGIFY + Nan::To(stringify(json_object)); +#else + v8::JSON::Stringify(Nan::GetCurrentContext(), json_object); +#endif // NAN_JSON_H_NEED_STRINGIFY + if (result.IsEmpty()) return v8::Local(); + return scope.Escape(result.ToLocalChecked()); + } + + inline + Nan::MaybeLocal Stringify(v8::Local json_object, + v8::Local gap) { + Nan::EscapableHandleScope scope; + Nan::MaybeLocal result = +#if NAN_JSON_H_NEED_STRINGIFY + Nan::To(stringify(json_object, gap)); +#else + v8::JSON::Stringify(Nan::GetCurrentContext(), json_object, gap); +#endif // NAN_JSON_H_NEED_STRINGIFY + if (result.IsEmpty()) return v8::Local(); + return scope.Escape(result.ToLocalChecked()); + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(JSON) +#if NAN_JSON_H_NEED_PARSE + Nan::Callback parse_cb_; +#endif // NAN_JSON_H_NEED_PARSE +#if NAN_JSON_H_NEED_STRINGIFY + Nan::Callback stringify_cb_; +#endif // NAN_JSON_H_NEED_STRINGIFY + +#if NAN_JSON_H_NEED_PARSE + inline v8::Local parse(v8::Local arg) { + assert(!parse_cb_.IsEmpty() && "parse_cb_ is empty"); + AsyncResource resource("nan:JSON.parse"); + return parse_cb_.Call(1, &arg, &resource).FromMaybe(v8::Local()); + } +#endif // NAN_JSON_H_NEED_PARSE + +#if NAN_JSON_H_NEED_STRINGIFY + inline v8::Local stringify(v8::Local arg) { + assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty"); + AsyncResource resource("nan:JSON.stringify"); + return stringify_cb_.Call(1, &arg, &resource) + .FromMaybe(v8::Local()); + } + + inline v8::Local stringify(v8::Local arg, + v8::Local gap) { + assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty"); + + v8::Local argv[] = { + arg, + Nan::Null(), + gap + }; + AsyncResource resource("nan:JSON.stringify"); + return stringify_cb_.Call(3, argv, &resource) + .FromMaybe(v8::Local()); + } +#endif // NAN_JSON_H_NEED_STRINGIFY +}; + +#endif // NAN_JSON_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_maybe_43_inl.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_maybe_43_inl.h new file mode 100644 index 0000000..c04ce30 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_maybe_43_inl.h @@ -0,0 +1,356 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_MAYBE_43_INL_H_ +#define NAN_MAYBE_43_INL_H_ + +template +using MaybeLocal = v8::MaybeLocal; + +inline +MaybeLocal ToDetailString(v8::Local val) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(val->ToDetailString(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal ToArrayIndex(v8::Local val) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(val->ToArrayIndex(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline +Maybe Equals(v8::Local a, v8::Local(b)) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return a->Equals(isolate->GetCurrentContext(), b); +} + +inline +MaybeLocal NewInstance(v8::Local h) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(h->NewInstance(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal NewInstance( + v8::Local h + , int argc + , v8::Local argv[]) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(h->NewInstance(isolate->GetCurrentContext(), argc, argv) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal NewInstance(v8::Local h) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(h->NewInstance(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + + +inline MaybeLocal GetFunction( + v8::Local t) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(t->GetFunction(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline Maybe Set( + v8::Local obj + , v8::Local key + , v8::Local value) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Set(isolate->GetCurrentContext(), key, value); +} + +inline Maybe Set( + v8::Local obj + , uint32_t index + , v8::Local value) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Set(isolate->GetCurrentContext(), index, value); +} + +#if NODE_MODULE_VERSION < NODE_4_0_MODULE_VERSION +#include "nan_define_own_property_helper.h" // NOLINT(build/include) +#endif + +inline Maybe DefineOwnProperty( + v8::Local obj + , v8::Local key + , v8::Local value + , v8::PropertyAttribute attribs = v8::None) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); +#if NODE_MODULE_VERSION >= NODE_4_0_MODULE_VERSION + return obj->DefineOwnProperty(isolate->GetCurrentContext(), key, value, + attribs); +#else + Maybe maybeCurrent = + obj->GetPropertyAttributes(isolate->GetCurrentContext(), key); + if (maybeCurrent.IsNothing()) { + return Nothing(); + } + v8::PropertyAttribute current = maybeCurrent.FromJust(); + return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs); +#endif +} + +NAN_DEPRECATED inline Maybe ForceSet( + v8::Local obj + , v8::Local key + , v8::Local value + , v8::PropertyAttribute attribs = v8::None) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + return key->IsName() + ? obj->DefineOwnProperty(isolate->GetCurrentContext(), + key.As(), value, attribs) + : Nothing(); +#else + return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs); +#endif +} + +inline MaybeLocal Get( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->Get(isolate->GetCurrentContext(), key) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal Get(v8::Local obj, uint32_t index) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->Get(isolate->GetCurrentContext(), index) + .FromMaybe(v8::Local())); +} + +inline v8::PropertyAttribute GetPropertyAttributes( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->GetPropertyAttributes(isolate->GetCurrentContext(), key) + .FromJust(); +} + +inline Maybe Has( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Has(isolate->GetCurrentContext(), key); +} + +inline Maybe Has(v8::Local obj, uint32_t index) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Has(isolate->GetCurrentContext(), index); +} + +inline Maybe Delete( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Delete(isolate->GetCurrentContext(), key); +} + +inline +Maybe Delete(v8::Local obj, uint32_t index) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Delete(isolate->GetCurrentContext(), index); +} + +inline +MaybeLocal GetPropertyNames(v8::Local obj) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->GetPropertyNames(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal GetOwnPropertyNames(v8::Local obj) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->GetOwnPropertyNames(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline Maybe SetPrototype( + v8::Local obj + , v8::Local prototype) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->SetPrototype(isolate->GetCurrentContext(), prototype); +} + +inline MaybeLocal ObjectProtoToString( + v8::Local obj) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->ObjectProtoToString(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline Maybe HasOwnProperty( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->HasOwnProperty(isolate->GetCurrentContext(), key); +} + +inline Maybe HasRealNamedProperty( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->HasRealNamedProperty(isolate->GetCurrentContext(), key); +} + +inline Maybe HasRealIndexedProperty( + v8::Local obj + , uint32_t index) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->HasRealIndexedProperty(isolate->GetCurrentContext(), index); +} + +inline Maybe HasRealNamedCallbackProperty( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->HasRealNamedCallbackProperty(isolate->GetCurrentContext(), key); +} + +inline MaybeLocal GetRealNamedPropertyInPrototypeChain( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->GetRealNamedPropertyInPrototypeChain( + isolate->GetCurrentContext(), key) + .FromMaybe(v8::Local())); +} + +inline MaybeLocal GetRealNamedProperty( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + obj->GetRealNamedProperty(isolate->GetCurrentContext(), key) + .FromMaybe(v8::Local())); +} + +inline MaybeLocal CallAsFunction( + v8::Local obj + , v8::Local recv + , int argc + , v8::Local argv[]) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + obj->CallAsFunction(isolate->GetCurrentContext(), recv, argc, argv) + .FromMaybe(v8::Local())); +} + +inline MaybeLocal CallAsConstructor( + v8::Local obj + , int argc, v8::Local argv[]) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + obj->CallAsConstructor(isolate->GetCurrentContext(), argc, argv) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal GetSourceLine(v8::Local msg) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(msg->GetSourceLine(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline Maybe GetLineNumber(v8::Local msg) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return msg->GetLineNumber(isolate->GetCurrentContext()); +} + +inline Maybe GetStartColumn(v8::Local msg) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return msg->GetStartColumn(isolate->GetCurrentContext()); +} + +inline Maybe GetEndColumn(v8::Local msg) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return msg->GetEndColumn(isolate->GetCurrentContext()); +} + +inline MaybeLocal CloneElementAt( + v8::Local array + , uint32_t index) { +#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::Local context = isolate->GetCurrentContext(); + v8::Local elem; + v8::Local obj; + if (!array->Get(context, index).ToLocal(&elem)) { + return scope.Escape(obj); + } + if (!elem->ToObject(context).ToLocal(&obj)) { + return scope.Escape(v8::Local()); + } + return scope.Escape(obj->Clone()); +#else + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(array->CloneElementAt(isolate->GetCurrentContext(), index) + .FromMaybe(v8::Local())); +#endif +} + +inline MaybeLocal Call( + v8::Local fun + , v8::Local recv + , int argc + , v8::Local argv[]) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(fun->Call(isolate->GetCurrentContext(), recv, argc, argv) + .FromMaybe(v8::Local())); +} + +#endif // NAN_MAYBE_43_INL_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_maybe_pre_43_inl.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_maybe_pre_43_inl.h new file mode 100644 index 0000000..83325ae --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_maybe_pre_43_inl.h @@ -0,0 +1,268 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_MAYBE_PRE_43_INL_H_ +#define NAN_MAYBE_PRE_43_INL_H_ + +template +class MaybeLocal { + public: + inline MaybeLocal() : val_(v8::Local()) {} + + template +# if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION + inline + MaybeLocal(v8::Local that) : val_(that) {} // NOLINT(runtime/explicit) +# else + inline + MaybeLocal(v8::Local that) : // NOLINT(runtime/explicit) + val_(*reinterpret_cast*>(&that)) {} +# endif + + inline bool IsEmpty() const { return val_.IsEmpty(); } + + template + inline bool ToLocal(v8::Local *out) const { + *out = val_; + return !IsEmpty(); + } + + inline v8::Local ToLocalChecked() const { +#if defined(V8_ENABLE_CHECKS) + assert(!IsEmpty() && "ToLocalChecked is Empty"); +#endif // V8_ENABLE_CHECKS + return val_; + } + + template + inline v8::Local FromMaybe(v8::Local default_value) const { + return IsEmpty() ? default_value : v8::Local(val_); + } + + private: + v8::Local val_; +}; + +inline +MaybeLocal ToDetailString(v8::Handle val) { + return MaybeLocal(val->ToDetailString()); +} + +inline +MaybeLocal ToArrayIndex(v8::Handle val) { + return MaybeLocal(val->ToArrayIndex()); +} + +inline +Maybe Equals(v8::Handle a, v8::Handle(b)) { + return Just(a->Equals(b)); +} + +inline +MaybeLocal NewInstance(v8::Handle h) { + return MaybeLocal(h->NewInstance()); +} + +inline +MaybeLocal NewInstance( + v8::Local h + , int argc + , v8::Local argv[]) { + return MaybeLocal(h->NewInstance(argc, argv)); +} + +inline +MaybeLocal NewInstance(v8::Handle h) { + return MaybeLocal(h->NewInstance()); +} + +inline +MaybeLocal GetFunction(v8::Handle t) { + return MaybeLocal(t->GetFunction()); +} + +inline Maybe Set( + v8::Handle obj + , v8::Handle key + , v8::Handle value) { + return Just(obj->Set(key, value)); +} + +inline Maybe Set( + v8::Handle obj + , uint32_t index + , v8::Handle value) { + return Just(obj->Set(index, value)); +} + +#include "nan_define_own_property_helper.h" // NOLINT(build/include) + +inline Maybe DefineOwnProperty( + v8::Handle obj + , v8::Handle key + , v8::Handle value + , v8::PropertyAttribute attribs = v8::None) { + v8::PropertyAttribute current = obj->GetPropertyAttributes(key); + return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs); +} + +NAN_DEPRECATED inline Maybe ForceSet( + v8::Handle obj + , v8::Handle key + , v8::Handle value + , v8::PropertyAttribute attribs = v8::None) { + return Just(obj->ForceSet(key, value, attribs)); +} + +inline MaybeLocal Get( + v8::Handle obj + , v8::Handle key) { + return MaybeLocal(obj->Get(key)); +} + +inline MaybeLocal Get( + v8::Handle obj + , uint32_t index) { + return MaybeLocal(obj->Get(index)); +} + +inline Maybe GetPropertyAttributes( + v8::Handle obj + , v8::Handle key) { + return Just(obj->GetPropertyAttributes(key)); +} + +inline Maybe Has( + v8::Handle obj + , v8::Handle key) { + return Just(obj->Has(key)); +} + +inline Maybe Has( + v8::Handle obj + , uint32_t index) { + return Just(obj->Has(index)); +} + +inline Maybe Delete( + v8::Handle obj + , v8::Handle key) { + return Just(obj->Delete(key)); +} + +inline Maybe Delete( + v8::Handle obj + , uint32_t index) { + return Just(obj->Delete(index)); +} + +inline +MaybeLocal GetPropertyNames(v8::Handle obj) { + return MaybeLocal(obj->GetPropertyNames()); +} + +inline +MaybeLocal GetOwnPropertyNames(v8::Handle obj) { + return MaybeLocal(obj->GetOwnPropertyNames()); +} + +inline Maybe SetPrototype( + v8::Handle obj + , v8::Handle prototype) { + return Just(obj->SetPrototype(prototype)); +} + +inline MaybeLocal ObjectProtoToString( + v8::Handle obj) { + return MaybeLocal(obj->ObjectProtoToString()); +} + +inline Maybe HasOwnProperty( + v8::Handle obj + , v8::Handle key) { + return Just(obj->HasOwnProperty(key)); +} + +inline Maybe HasRealNamedProperty( + v8::Handle obj + , v8::Handle key) { + return Just(obj->HasRealNamedProperty(key)); +} + +inline Maybe HasRealIndexedProperty( + v8::Handle obj + , uint32_t index) { + return Just(obj->HasRealIndexedProperty(index)); +} + +inline Maybe HasRealNamedCallbackProperty( + v8::Handle obj + , v8::Handle key) { + return Just(obj->HasRealNamedCallbackProperty(key)); +} + +inline MaybeLocal GetRealNamedPropertyInPrototypeChain( + v8::Handle obj + , v8::Handle key) { + return MaybeLocal( + obj->GetRealNamedPropertyInPrototypeChain(key)); +} + +inline MaybeLocal GetRealNamedProperty( + v8::Handle obj + , v8::Handle key) { + return MaybeLocal(obj->GetRealNamedProperty(key)); +} + +inline MaybeLocal CallAsFunction( + v8::Handle obj + , v8::Handle recv + , int argc + , v8::Handle argv[]) { + return MaybeLocal(obj->CallAsFunction(recv, argc, argv)); +} + +inline MaybeLocal CallAsConstructor( + v8::Handle obj + , int argc + , v8::Local argv[]) { + return MaybeLocal(obj->CallAsConstructor(argc, argv)); +} + +inline +MaybeLocal GetSourceLine(v8::Handle msg) { + return MaybeLocal(msg->GetSourceLine()); +} + +inline Maybe GetLineNumber(v8::Handle msg) { + return Just(msg->GetLineNumber()); +} + +inline Maybe GetStartColumn(v8::Handle msg) { + return Just(msg->GetStartColumn()); +} + +inline Maybe GetEndColumn(v8::Handle msg) { + return Just(msg->GetEndColumn()); +} + +inline MaybeLocal CloneElementAt( + v8::Handle array + , uint32_t index) { + return MaybeLocal(array->CloneElementAt(index)); +} + +inline MaybeLocal Call( + v8::Local fun + , v8::Local recv + , int argc + , v8::Local argv[]) { + return MaybeLocal(fun->Call(recv, argc, argv)); +} + +#endif // NAN_MAYBE_PRE_43_INL_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_new.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_new.h new file mode 100644 index 0000000..cdf8bbe --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_new.h @@ -0,0 +1,340 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_NEW_H_ +#define NAN_NEW_H_ + +namespace imp { // scnr + +// TODO(agnat): Generalize +template v8::Local To(v8::Local i); + +template <> +inline +v8::Local +To(v8::Local i) { + return Nan::To(i).ToLocalChecked(); +} + +template <> +inline +v8::Local +To(v8::Local i) { + return Nan::To(i).ToLocalChecked(); +} + +template <> +inline +v8::Local +To(v8::Local i) { + return Nan::To(i).ToLocalChecked(); +} + +template struct FactoryBase { + typedef v8::Local return_t; +}; + +template struct MaybeFactoryBase { + typedef MaybeLocal return_t; +}; + +template struct Factory; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); + static inline return_t New(int length); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( v8::ExtensionConfiguration* extensions = NULL + , v8::Local tmpl = v8::Local() + , v8::Local obj = v8::Local()); +}; + +template <> +struct Factory : MaybeFactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(void *value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( FunctionCallback callback + , v8::Local data = v8::Local()); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( FunctionCallback callback = NULL + , v8::Local data = v8::Local() + , v8::Local signature = v8::Local()); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template +struct IntegerFactory : FactoryBase { + typedef typename FactoryBase::return_t return_t; + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : MaybeFactoryBase { + static inline return_t New( + v8::Local pattern, v8::RegExp::Flags flags); +}; + +template <> +struct Factory : MaybeFactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +template <> +struct Factory : FactoryBase { + typedef v8::Local FTH; + static inline return_t New(FTH receiver = FTH()); +}; + +template <> +struct Factory : MaybeFactoryBase { + static inline return_t New(); + static inline return_t New(const char *value, int length = -1); + static inline return_t New(const uint16_t *value, int length = -1); + static inline return_t New(std::string const& value); + + static inline return_t New(v8::String::ExternalStringResource * value); + static inline return_t New(ExternalOneByteStringResource * value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(v8::Local value); +}; + +} // end of namespace imp + +#if (NODE_MODULE_VERSION >= 12) + +namespace imp { + +template <> +struct Factory : MaybeFactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +} // end of namespace imp + +# include "nan_implementation_12_inl.h" + +#else // NODE_MODULE_VERSION >= 12 + +# include "nan_implementation_pre_12_inl.h" + +#endif + +//=== API ====================================================================== + +template +typename imp::Factory::return_t +New() { + return imp::Factory::New(); +} + +template +typename imp::Factory::return_t +New(A0 arg0) { + return imp::Factory::New(arg0); +} + +template +typename imp::Factory::return_t +New(A0 arg0, A1 arg1) { + return imp::Factory::New(arg0, arg1); +} + +template +typename imp::Factory::return_t +New(A0 arg0, A1 arg1, A2 arg2) { + return imp::Factory::New(arg0, arg1, arg2); +} + +template +typename imp::Factory::return_t +New(A0 arg0, A1 arg1, A2 arg2, A3 arg3) { + return imp::Factory::New(arg0, arg1, arg2, arg3); +} + +// Note(agnat): When passing overloaded function pointers to template functions +// as generic arguments the compiler needs help in picking the right overload. +// These two functions handle New and New with +// all argument variations. + +// v8::Function and v8::FunctionTemplate with one or two arguments +template +typename imp::Factory::return_t +New( FunctionCallback callback + , v8::Local data = v8::Local()) { + return imp::Factory::New(callback, data); +} + +// v8::Function and v8::FunctionTemplate with three arguments +template +typename imp::Factory::return_t +New( FunctionCallback callback + , v8::Local data = v8::Local() + , A2 a2 = A2()) { + return imp::Factory::New(callback, data, a2); +} + +// Convenience + +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION +template inline v8::Local New(v8::Handle h); +#endif + +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION +template + inline v8::Local New(v8::Persistent const& p); +#else +template inline v8::Local New(v8::Persistent const& p); +#endif +template +inline v8::Local New(Persistent const& p); +template +inline v8::Local New(Global const& p); + +inline +imp::Factory::return_t +New(bool value) { + return New(value); +} + +inline +imp::Factory::return_t +New(int32_t value) { + return New(value); +} + +inline +imp::Factory::return_t +New(uint32_t value) { + return New(value); +} + +inline +imp::Factory::return_t +New(double value) { + return New(value); +} + +inline +imp::Factory::return_t +New(std::string const& value) { // NOLINT(build/include_what_you_use) + return New(value); +} + +inline +imp::Factory::return_t +New(const char * value, int length) { + return New(value, length); +} + +inline +imp::Factory::return_t +New(const uint16_t * value, int length) { + return New(value, length); +} + +inline +imp::Factory::return_t +New(const char * value) { + return New(value); +} + +inline +imp::Factory::return_t +New(const uint16_t * value) { + return New(value); +} + +inline +imp::Factory::return_t +New(v8::String::ExternalStringResource * value) { + return New(value); +} + +inline +imp::Factory::return_t +New(ExternalOneByteStringResource * value) { + return New(value); +} + +inline +imp::Factory::return_t +New(v8::Local pattern, v8::RegExp::Flags flags) { + return New(pattern, flags); +} + +#endif // NAN_NEW_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_object_wrap.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_object_wrap.h new file mode 100644 index 0000000..78712f9 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_object_wrap.h @@ -0,0 +1,156 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_OBJECT_WRAP_H_ +#define NAN_OBJECT_WRAP_H_ + +class ObjectWrap { + public: + ObjectWrap() { + refs_ = 0; + } + + + virtual ~ObjectWrap() { + if (persistent().IsEmpty()) { + return; + } + + persistent().ClearWeak(); + persistent().Reset(); + } + + + template + static inline T* Unwrap(v8::Local object) { + assert(!object.IsEmpty()); + assert(object->InternalFieldCount() > 0); + // Cast to ObjectWrap before casting to T. A direct cast from void + // to T won't work right when T has more than one base class. + void* ptr = GetInternalFieldPointer(object, 0); + ObjectWrap* wrap = static_cast(ptr); + return static_cast(wrap); + } + + + inline v8::Local handle() const { + return New(handle_); + } + + + inline Persistent& persistent() { + return handle_; + } + + + protected: + inline void Wrap(v8::Local object) { + assert(persistent().IsEmpty()); + assert(object->InternalFieldCount() > 0); + SetInternalFieldPointer(object, 0, this); + persistent().Reset(object); + MakeWeak(); + } + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + + inline void MakeWeak() { + persistent().v8::PersistentBase::SetWeak( + this, WeakCallback, v8::WeakCallbackType::kParameter); +#if NODE_MAJOR_VERSION < 10 + // FIXME(bnoordhuis) Probably superfluous in older Node.js versions too. + persistent().MarkIndependent(); +#endif + } + +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + + inline void MakeWeak() { + persistent().v8::PersistentBase::SetWeak(this, WeakCallback); + persistent().MarkIndependent(); + } + +#else + + inline void MakeWeak() { + persistent().persistent.MakeWeak(this, WeakCallback); + persistent().MarkIndependent(); + } + +#endif + + /* Ref() marks the object as being attached to an event loop. + * Refed objects will not be garbage collected, even if + * all references are lost. + */ + virtual void Ref() { + assert(!persistent().IsEmpty()); + persistent().ClearWeak(); + refs_++; + } + + /* Unref() marks an object as detached from the event loop. This is its + * default state. When an object with a "weak" reference changes from + * attached to detached state it will be freed. Be careful not to access + * the object after making this call as it might be gone! + * (A "weak reference" means an object that only has a + * persistent handle.) + * + * DO NOT CALL THIS FROM DESTRUCTOR + */ + virtual void Unref() { + assert(!persistent().IsEmpty()); + assert(!persistent().IsWeak()); + assert(refs_ > 0); + if (--refs_ == 0) + MakeWeak(); + } + + int refs_; // ro + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(ObjectWrap) +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + + static void + WeakCallback(v8::WeakCallbackInfo const& info) { + ObjectWrap* wrap = info.GetParameter(); + assert(wrap->refs_ == 0); + wrap->handle_.Reset(); + delete wrap; + } + +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + + static void + WeakCallback(v8::WeakCallbackData const& data) { + ObjectWrap* wrap = data.GetParameter(); + assert(wrap->refs_ == 0); + assert(wrap->handle_.IsNearDeath()); + wrap->handle_.Reset(); + delete wrap; + } + +#else + + static void WeakCallback(v8::Persistent value, void *data) { + ObjectWrap *wrap = static_cast(data); + assert(wrap->refs_ == 0); + assert(wrap->handle_.IsNearDeath()); + wrap->handle_.Reset(); + delete wrap; + } + +#endif + Persistent handle_; +}; + + +#endif // NAN_OBJECT_WRAP_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_persistent_12_inl.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_persistent_12_inl.h new file mode 100644 index 0000000..d9649e8 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_persistent_12_inl.h @@ -0,0 +1,132 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_PERSISTENT_12_INL_H_ +#define NAN_PERSISTENT_12_INL_H_ + +template class Persistent : + public v8::Persistent { + public: + inline Persistent() : v8::Persistent() {} + + template inline Persistent(v8::Local that) : + v8::Persistent(v8::Isolate::GetCurrent(), that) {} + + template + inline + Persistent(const v8::Persistent &that) : // NOLINT(runtime/explicit) + v8::Persistent(v8::Isolate::GetCurrent(), that) {} + + inline void Reset() { v8::PersistentBase::Reset(); } + + template + inline void Reset(const v8::Local &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void Reset(const v8::PersistentBase &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type); + + private: + inline T *operator*() const { return *PersistentBase::persistent; } + + template + inline void Copy(const Persistent &that) { + TYPE_CHECK(T, S); + + this->Reset(); + + if (!that.IsEmpty()) { + this->Reset(that); + M::Copy(that, this); + } + } +}; + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +template +class Global : public v8::Global { + public: + inline Global() : v8::Global() {} + + template inline Global(v8::Local that) : + v8::Global(v8::Isolate::GetCurrent(), that) {} + + template + inline + Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit) + v8::Global(v8::Isolate::GetCurrent(), that) {} + + inline void Reset() { v8::PersistentBase::Reset(); } + + template + inline void Reset(const v8::Local &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void Reset(const v8::PersistentBase &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + reinterpret_cast*>(this)->SetWeak( + parameter, callback, type); + } +}; +#else +template +class Global : public v8::UniquePersistent { + public: + inline Global() : v8::UniquePersistent() {} + + template inline Global(v8::Local that) : + v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} + + template + inline + Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit) + v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} + + inline void Reset() { v8::PersistentBase::Reset(); } + + template + inline void Reset(const v8::Local &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void Reset(const v8::PersistentBase &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + reinterpret_cast*>(this)->SetWeak( + parameter, callback, type); + } +}; +#endif + +#endif // NAN_PERSISTENT_12_INL_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_persistent_pre_12_inl.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_persistent_pre_12_inl.h new file mode 100644 index 0000000..4c9c59d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_persistent_pre_12_inl.h @@ -0,0 +1,242 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_PERSISTENT_PRE_12_INL_H_ +#define NAN_PERSISTENT_PRE_12_INL_H_ + +template +class PersistentBase { + v8::Persistent persistent; + template + friend v8::Local New(const PersistentBase &p); + template + friend v8::Local New(const Persistent &p); + template + friend v8::Local New(const Global &p); + template friend class ReturnValue; + + public: + inline PersistentBase() : + persistent() {} + + inline void Reset() { + persistent.Dispose(); + persistent.Clear(); + } + + template + inline void Reset(const v8::Local &other) { + TYPE_CHECK(T, S); + + if (!persistent.IsEmpty()) { + persistent.Dispose(); + } + + if (other.IsEmpty()) { + persistent.Clear(); + } else { + persistent = v8::Persistent::New(other); + } + } + + template + inline void Reset(const PersistentBase &other) { + TYPE_CHECK(T, S); + + if (!persistent.IsEmpty()) { + persistent.Dispose(); + } + + if (other.IsEmpty()) { + persistent.Clear(); + } else { + persistent = v8::Persistent::New(other.persistent); + } + } + + inline bool IsEmpty() const { return persistent.IsEmpty(); } + + inline void Empty() { persistent.Clear(); } + + template + inline bool operator==(const PersistentBase &that) const { + return this->persistent == that.persistent; + } + + template + inline bool operator==(const v8::Local &that) const { + return this->persistent == that; + } + + template + inline bool operator!=(const PersistentBase &that) const { + return !operator==(that); + } + + template + inline bool operator!=(const v8::Local &that) const { + return !operator==(that); + } + + template + inline void SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type); + + inline void ClearWeak() { persistent.ClearWeak(); } + + inline void MarkIndependent() { persistent.MarkIndependent(); } + + inline bool IsIndependent() const { return persistent.IsIndependent(); } + + inline bool IsNearDeath() const { return persistent.IsNearDeath(); } + + inline bool IsWeak() const { return persistent.IsWeak(); } + + private: + inline explicit PersistentBase(v8::Persistent that) : + persistent(that) { } + inline explicit PersistentBase(T *val) : persistent(val) {} + template friend class Persistent; + template friend class Global; + friend class ObjectWrap; +}; + +template +class NonCopyablePersistentTraits { + public: + typedef Persistent > + NonCopyablePersistent; + static const bool kResetInDestructor = false; + template + inline static void Copy(const Persistent &source, + NonCopyablePersistent *dest) { + Uncompilable(); + } + + template inline static void Uncompilable() { + TYPE_CHECK(O, v8::Primitive); + } +}; + +template +struct CopyablePersistentTraits { + typedef Persistent > CopyablePersistent; + static const bool kResetInDestructor = true; + template + static inline void Copy(const Persistent &source, + CopyablePersistent *dest) {} +}; + +template class Persistent : + public PersistentBase { + public: + inline Persistent() {} + + template inline Persistent(v8::Handle that) + : PersistentBase(v8::Persistent::New(that)) { + TYPE_CHECK(T, S); + } + + inline Persistent(const Persistent &that) : PersistentBase() { + Copy(that); + } + + template + inline Persistent(const Persistent &that) : + PersistentBase() { + Copy(that); + } + + inline Persistent &operator=(const Persistent &that) { + Copy(that); + return *this; + } + + template + inline Persistent &operator=(const Persistent &that) { + Copy(that); + return *this; + } + + inline ~Persistent() { + if (M::kResetInDestructor) this->Reset(); + } + + private: + inline T *operator*() const { return *PersistentBase::persistent; } + + template + inline void Copy(const Persistent &that) { + TYPE_CHECK(T, S); + + this->Reset(); + + if (!that.IsEmpty()) { + this->persistent = v8::Persistent::New(that.persistent); + M::Copy(that, this); + } + } +}; + +template +class Global : public PersistentBase { + struct RValue { + inline explicit RValue(Global* obj) : object(obj) {} + Global* object; + }; + + public: + inline Global() : PersistentBase(0) { } + + template + inline Global(v8::Local that) // NOLINT(runtime/explicit) + : PersistentBase(v8::Persistent::New(that)) { + TYPE_CHECK(T, S); + } + + template + inline Global(const PersistentBase &that) // NOLINT(runtime/explicit) + : PersistentBase(that) { + TYPE_CHECK(T, S); + } + /** + * Move constructor. + */ + inline Global(RValue rvalue) // NOLINT(runtime/explicit) + : PersistentBase(rvalue.object->persistent) { + rvalue.object->Reset(); + } + inline ~Global() { this->Reset(); } + /** + * Move via assignment. + */ + template + inline Global &operator=(Global rhs) { + TYPE_CHECK(T, S); + this->Reset(rhs.persistent); + rhs.Reset(); + return *this; + } + /** + * Cast operator for moves. + */ + inline operator RValue() { return RValue(this); } + /** + * Pass allows returning uniques from functions, etc. + */ + Global Pass() { return Global(RValue(this)); } + + private: + Global(Global &); + void operator=(Global &); + template friend class ReturnValue; +}; + +#endif // NAN_PERSISTENT_PRE_12_INL_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_private.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_private.h new file mode 100644 index 0000000..15f44cc --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_private.h @@ -0,0 +1,73 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_PRIVATE_H_ +#define NAN_PRIVATE_H_ + +inline Maybe +HasPrivate(v8::Local object, v8::Local key) { + HandleScope scope; +#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::Local context = isolate->GetCurrentContext(); + v8::Local private_key = v8::Private::ForApi(isolate, key); + return object->HasPrivate(context, private_key); +#else + return Just(!object->GetHiddenValue(key).IsEmpty()); +#endif +} + +inline MaybeLocal +GetPrivate(v8::Local object, v8::Local key) { +#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::Local context = isolate->GetCurrentContext(); + v8::Local private_key = v8::Private::ForApi(isolate, key); + v8::MaybeLocal v = object->GetPrivate(context, private_key); + return scope.Escape(v.ToLocalChecked()); +#else + EscapableHandleScope scope; + v8::Local v = object->GetHiddenValue(key); + if (v.IsEmpty()) { + v = Undefined(); + } + return scope.Escape(v); +#endif +} + +inline Maybe SetPrivate( + v8::Local object, + v8::Local key, + v8::Local value) { +#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION + HandleScope scope; + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::Local context = isolate->GetCurrentContext(); + v8::Local private_key = v8::Private::ForApi(isolate, key); + return object->SetPrivate(context, private_key, value); +#else + return Just(object->SetHiddenValue(key, value)); +#endif +} + +inline Maybe DeletePrivate( + v8::Local object, + v8::Local key) { +#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION + HandleScope scope; + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::Local private_key = v8::Private::ForApi(isolate, key); + return object->DeletePrivate(isolate->GetCurrentContext(), private_key); +#else + return Just(object->DeleteHiddenValue(key)); +#endif +} + +#endif // NAN_PRIVATE_H_ + diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_string_bytes.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_string_bytes.h new file mode 100644 index 0000000..a2e6437 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_string_bytes.h @@ -0,0 +1,305 @@ +// 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. + +#ifndef NAN_STRING_BYTES_H_ +#define NAN_STRING_BYTES_H_ + +// Decodes a v8::Local or Buffer to a raw char* + +namespace imp { + +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + + +//// Base 64 //// + +#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) + + + +//// HEX //// + +static bool contains_non_ascii_slow(const char* buf, size_t len) { + for (size_t i = 0; i < len; ++i) { + if (buf[i] & 0x80) return true; + } + return false; +} + + +static bool contains_non_ascii(const char* src, size_t len) { + if (len < 16) { + return contains_non_ascii_slow(src, len); + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned unaligned = reinterpret_cast(src) & align_mask; + + if (unaligned > 0) { + const unsigned n = bytes_per_word - unaligned; + if (contains_non_ascii_slow(src, n)) return true; + src += n; + len -= n; + } + + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = 0x8080808080808080ll; +#else + const uintptr_t mask = 0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + if (srcw[i] & mask) return true; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + if (contains_non_ascii_slow(src + offset, remainder)) return true; + } + + return false; +} + + +static void force_ascii_slow(const char* src, char* dst, size_t len) { + for (size_t i = 0; i < len; ++i) { + dst[i] = src[i] & 0x7f; + } +} + + +static void force_ascii(const char* src, char* dst, size_t len) { + if (len < 16) { + force_ascii_slow(src, dst, len); + return; + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned src_unalign = reinterpret_cast(src) & align_mask; + const unsigned dst_unalign = reinterpret_cast(dst) & align_mask; + + if (src_unalign > 0) { + if (src_unalign == dst_unalign) { + const unsigned unalign = bytes_per_word - src_unalign; + force_ascii_slow(src, dst, unalign); + src += unalign; + dst += unalign; + len -= src_unalign; + } else { + force_ascii_slow(src, dst, len); + return; + } + } + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = ~0x8080808080808080ll; +#else + const uintptr_t mask = ~0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + uintptr_t* dstw = reinterpret_cast(dst); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + dstw[i] = srcw[i] & mask; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + force_ascii_slow(src + offset, dst + offset, remainder); + } +} + + +static size_t base64_encode(const char* src, + size_t slen, + char* dst, + size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= base64_encoded_size(slen) && + "not enough space provided for base64 encode"); + + dlen = base64_encoded_size(slen); + + unsigned a; + unsigned b; + unsigned c; + unsigned i; + unsigned k; + unsigned n; + + static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + + i = 0; + k = 0; + n = slen / 3 * 3; + + while (i < n) { + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + c = src[i + 2] & 0xff; + + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; + dst[k + 3] = table[c & 0x3f]; + + i += 3; + k += 4; + } + + if (n != slen) { + switch (slen - n) { + case 1: + a = src[i + 0] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[(a & 3) << 4]; + dst[k + 2] = '='; + dst[k + 3] = '='; + break; + + case 2: + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[(b & 0x0f) << 2]; + dst[k + 3] = '='; + break; + } + } + + return dlen; +} + + +static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= slen * 2 && + "not enough space provided for hex encode"); + + dlen = slen * 2; + for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { + static const char hex[] = "0123456789abcdef"; + uint8_t val = static_cast(src[i]); + dst[k + 0] = hex[val >> 4]; + dst[k + 1] = hex[val & 15]; + } + + return dlen; +} + + + +static Local Encode(const char* buf, + size_t buflen, + enum Encoding encoding) { + assert(buflen <= node::Buffer::kMaxLength); + if (!buflen && encoding != BUFFER) + return New("").ToLocalChecked(); + + Local val; + switch (encoding) { + case BUFFER: + return CopyBuffer(buf, buflen).ToLocalChecked(); + + case ASCII: + if (contains_non_ascii(buf, buflen)) { + char* out = new char[buflen]; + force_ascii(buf, out, buflen); + val = New(out, buflen).ToLocalChecked(); + delete[] out; + } else { + val = New(buf, buflen).ToLocalChecked(); + } + break; + + case UTF8: + val = New(buf, buflen).ToLocalChecked(); + break; + + case BINARY: { + // TODO(isaacs) use ExternalTwoByteString? + const unsigned char *cbuf = reinterpret_cast(buf); + uint16_t * twobytebuf = new uint16_t[buflen]; + for (size_t i = 0; i < buflen; i++) { + // XXX is the following line platform independent? + twobytebuf[i] = cbuf[i]; + } + val = New(twobytebuf, buflen).ToLocalChecked(); + delete[] twobytebuf; + break; + } + + case BASE64: { + size_t dlen = base64_encoded_size(buflen); + char* dst = new char[dlen]; + + size_t written = base64_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = New(dst, dlen).ToLocalChecked(); + delete[] dst; + break; + } + + case UCS2: { + const uint16_t* data = reinterpret_cast(buf); + val = New(data, buflen / 2).ToLocalChecked(); + break; + } + + case HEX: { + size_t dlen = buflen * 2; + char* dst = new char[dlen]; + size_t written = hex_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = New(dst, dlen).ToLocalChecked(); + delete[] dst; + break; + } + + default: + assert(0 && "unknown encoding"); + break; + } + + return val; +} + +#undef base64_encoded_size + +} // end of namespace imp + +#endif // NAN_STRING_BYTES_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_typedarray_contents.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_typedarray_contents.h new file mode 100644 index 0000000..c6ac8a4 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_typedarray_contents.h @@ -0,0 +1,96 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_TYPEDARRAY_CONTENTS_H_ +#define NAN_TYPEDARRAY_CONTENTS_H_ + +template +class TypedArrayContents { + public: + inline explicit TypedArrayContents(v8::Local from) : + length_(0), data_(NULL) { + HandleScope scope; + + size_t length = 0; + void* data = NULL; + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + + if (from->IsArrayBufferView()) { + v8::Local array = + v8::Local::Cast(from); + + const size_t byte_length = array->ByteLength(); + const ptrdiff_t byte_offset = array->ByteOffset(); + v8::Local buffer = array->Buffer(); + + length = byte_length / sizeof(T); +// Actually it's 7.9 here but this would lead to ABI issues with Node.js 13 +// using 7.8 till 13.2.0. +#if (V8_MAJOR_VERSION >= 8) + data = static_cast(buffer->GetBackingStore()->Data()) + byte_offset; +#else + data = static_cast(buffer->GetContents().Data()) + byte_offset; +#endif + } + +#else + + if (from->IsObject() && !from->IsNull()) { + v8::Local array = v8::Local::Cast(from); + + MaybeLocal buffer = Get(array, + New("buffer").ToLocalChecked()); + MaybeLocal byte_length = Get(array, + New("byteLength").ToLocalChecked()); + MaybeLocal byte_offset = Get(array, + New("byteOffset").ToLocalChecked()); + + if (!buffer.IsEmpty() && + !byte_length.IsEmpty() && byte_length.ToLocalChecked()->IsUint32() && + !byte_offset.IsEmpty() && byte_offset.ToLocalChecked()->IsUint32()) { + data = array->GetIndexedPropertiesExternalArrayData(); + if(data) { + length = byte_length.ToLocalChecked()->Uint32Value() / sizeof(T); + } + } + } + +#endif + +#if defined(_MSC_VER) && _MSC_VER >= 1900 || __cplusplus >= 201103L + assert(reinterpret_cast(data) % alignof (T) == 0); +#elif defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__GNUC__) + assert(reinterpret_cast(data) % __alignof(T) == 0); +#else + assert(reinterpret_cast(data) % sizeof (T) == 0); +#endif + + length_ = length; + data_ = static_cast(data); + } + + inline size_t length() const { return length_; } + inline T* operator*() { return data_; } + inline const T* operator*() const { return data_; } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(TypedArrayContents) + + //Disable heap allocation + void *operator new(size_t size); + void operator delete(void *, size_t) { + abort(); + } + + size_t length_; + T* data_; +}; + +#endif // NAN_TYPEDARRAY_CONTENTS_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/nan_weak.h b/legacy-libs/grpc-cloned/node_modules/nan/nan_weak.h new file mode 100644 index 0000000..7e7ab07 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/nan_weak.h @@ -0,0 +1,437 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_WEAK_H_ +#define NAN_WEAK_H_ + +static const int kInternalFieldsInWeakCallback = 2; +static const int kNoInternalFieldIndex = -1; + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ + v8::WeakCallbackInfo > const& +# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ + NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ +#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION +# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ + v8::PhantomCallbackData > const& +# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ + NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ +#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION +# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ + v8::PhantomCallbackData > const& +# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ + v8::InternalFieldsCallbackData, void> const& +# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION +# define NAN_WEAK_CALLBACK_DATA_TYPE_ \ + v8::WeakCallbackData > const& +# define NAN_WEAK_CALLBACK_SIG_ NAN_WEAK_CALLBACK_DATA_TYPE_ +#else +# define NAN_WEAK_CALLBACK_DATA_TYPE_ void * +# define NAN_WEAK_CALLBACK_SIG_ \ + v8::Persistent, NAN_WEAK_CALLBACK_DATA_TYPE_ +#endif + +template +class WeakCallbackInfo { + public: + typedef void (*Callback)(const WeakCallbackInfo& data); + WeakCallbackInfo( + Persistent *persistent + , Callback callback + , void *parameter + , void *field1 = 0 + , void *field2 = 0) : + callback_(callback), isolate_(0), parameter_(parameter) { + std::memcpy(&persistent_, persistent, sizeof (v8::Persistent)); + internal_fields_[0] = field1; + internal_fields_[1] = field2; + } + inline v8::Isolate *GetIsolate() const { return isolate_; } + inline T *GetParameter() const { return static_cast(parameter_); } + inline void *GetInternalField(int index) const { + assert((index == 0 || index == 1) && "internal field index out of bounds"); + if (index == 0) { + return internal_fields_[0]; + } else { + return internal_fields_[1]; + } + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(WeakCallbackInfo) + Callback callback_; + v8::Isolate *isolate_; + void *parameter_; + void *internal_fields_[kInternalFieldsInWeakCallback]; + v8::Persistent persistent_; + template friend class Persistent; + template friend class PersistentBase; +#if NODE_MODULE_VERSION <= NODE_0_12_MODULE_VERSION +# if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + template + static void invoke(NAN_WEAK_CALLBACK_SIG_ data); + template + static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data); +# else + static void invoke(NAN_WEAK_CALLBACK_SIG_ data); + static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data); +# endif +#else +# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + template + static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data); + template + static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data); +# else + static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data); + static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data); +# endif + static WeakCallbackInfo *unwrapparameter( + NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data); + static WeakCallbackInfo *unwraptwofield( + NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data); +#endif +}; + + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + +template +template +void +WeakCallbackInfo::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwrapparameter(data); + if (isFirstPass) { + cbinfo->persistent_.Reset(); + data.SetSecondPassCallback(invokeparameter); + } else { + cbinfo->callback_(*cbinfo); + delete cbinfo; + } +} + +template +template +void +WeakCallbackInfo::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwraptwofield(data); + if (isFirstPass) { + cbinfo->persistent_.Reset(); + data.SetSecondPassCallback(invoketwofield); + } else { + cbinfo->callback_(*cbinfo); + delete cbinfo; + } +} + +template +WeakCallbackInfo *WeakCallbackInfo::unwrapparameter( + NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) { + WeakCallbackInfo *cbinfo = + static_cast*>(data.GetParameter()); + cbinfo->isolate_ = data.GetIsolate(); + return cbinfo; +} + +template +WeakCallbackInfo *WeakCallbackInfo::unwraptwofield( + NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) { + WeakCallbackInfo *cbinfo = + static_cast*>(data.GetInternalField(0)); + cbinfo->isolate_ = data.GetIsolate(); + return cbinfo; +} + +#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_ +#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_ +#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ +# elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION + +template +void +WeakCallbackInfo::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwrapparameter(data); + cbinfo->persistent_.Reset(); + cbinfo->callback_(*cbinfo); + delete cbinfo; +} + +template +void +WeakCallbackInfo::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwraptwofield(data); + cbinfo->persistent_.Reset(); + cbinfo->callback_(*cbinfo); + delete cbinfo; +} + +template +WeakCallbackInfo *WeakCallbackInfo::unwrapparameter( + NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) { + WeakCallbackInfo *cbinfo = + static_cast*>(data.GetParameter()); + cbinfo->isolate_ = data.GetIsolate(); + return cbinfo; +} + +template +WeakCallbackInfo *WeakCallbackInfo::unwraptwofield( + NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) { + WeakCallbackInfo *cbinfo = + static_cast*>(data.GetInternalField1()); + cbinfo->isolate_ = data.GetIsolate(); + return cbinfo; +} + +#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_ +#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_ +#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + +template +template +void WeakCallbackInfo::invoke(NAN_WEAK_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwrap(data); + cbinfo->persistent_.Reset(); + cbinfo->callback_(*cbinfo); + delete cbinfo; +} + +template +template +WeakCallbackInfo *WeakCallbackInfo::unwrap( + NAN_WEAK_CALLBACK_DATA_TYPE_ data) { + void *parameter = data.GetParameter(); + WeakCallbackInfo *cbinfo = + static_cast*>(parameter); + cbinfo->isolate_ = data.GetIsolate(); + return cbinfo; +} + +#undef NAN_WEAK_CALLBACK_SIG_ +#undef NAN_WEAK_CALLBACK_DATA_TYPE_ +#else + +template +void WeakCallbackInfo::invoke(NAN_WEAK_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwrap(data); + cbinfo->persistent_.Dispose(); + cbinfo->persistent_.Clear(); + cbinfo->callback_(*cbinfo); + delete cbinfo; +} + +template +WeakCallbackInfo *WeakCallbackInfo::unwrap( + NAN_WEAK_CALLBACK_DATA_TYPE_ data) { + WeakCallbackInfo *cbinfo = + static_cast*>(data); + cbinfo->isolate_ = v8::Isolate::GetCurrent(); + return cbinfo; +} + +#undef NAN_WEAK_CALLBACK_SIG_ +#undef NAN_WEAK_CALLBACK_DATA_TYPE_ +#endif + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +template +template +inline void Persistent::SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + WeakCallbackInfo

*wcbd; + if (type == WeakCallbackType::kParameter) { + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , parameter); + v8::PersistentBase::SetWeak( + wcbd + , WeakCallbackInfo

::template invokeparameter + , type); + } else { + v8::Local* self_v(reinterpret_cast*>(this)); + assert((*self_v)->IsObject()); + v8::Local self((*self_v).As()); + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { + internal_fields[i] = self->GetAlignedPointerFromInternalField(i); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , 0 + , internal_fields[0] + , internal_fields[1]); + self->SetAlignedPointerInInternalField(0, wcbd); + v8::PersistentBase::SetWeak( + static_cast*>(0) + , WeakCallbackInfo

::template invoketwofield + , type); + } +} +#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION +template +template +inline void Persistent::SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + WeakCallbackInfo

*wcbd; + if (type == WeakCallbackType::kParameter) { + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , parameter); + v8::PersistentBase::SetPhantom( + wcbd + , WeakCallbackInfo

::invokeparameter); + } else { + v8::Local* self_v(reinterpret_cast*>(this)); + assert((*self_v)->IsObject()); + v8::Local self((*self_v).As()); + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { + internal_fields[i] = self->GetAlignedPointerFromInternalField(i); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , 0 + , internal_fields[0] + , internal_fields[1]); + self->SetAlignedPointerInInternalField(0, wcbd); + v8::PersistentBase::SetPhantom( + static_cast*>(0) + , WeakCallbackInfo

::invoketwofield + , 0 + , count > 1 ? 1 : kNoInternalFieldIndex); + } +} +#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION +template +template +inline void Persistent::SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + WeakCallbackInfo

*wcbd; + if (type == WeakCallbackType::kParameter) { + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , parameter); + v8::PersistentBase::SetPhantom( + wcbd + , WeakCallbackInfo

::invokeparameter); + } else { + v8::Local* self_v(reinterpret_cast*>(this)); + assert((*self_v)->IsObject()); + v8::Local self((*self_v).As()); + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { + internal_fields[i] = self->GetAlignedPointerFromInternalField(i); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , 0 + , internal_fields[0] + , internal_fields[1]); + self->SetAlignedPointerInInternalField(0, wcbd); + v8::PersistentBase::SetPhantom( + WeakCallbackInfo

::invoketwofield + , 0 + , count > 1 ? 1 : kNoInternalFieldIndex); + } +} +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION +template +template +inline void Persistent::SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + WeakCallbackInfo

*wcbd; + if (type == WeakCallbackType::kParameter) { + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , parameter); + v8::PersistentBase::SetWeak(wcbd, WeakCallbackInfo

::invoke); + } else { + v8::Local* self_v(reinterpret_cast*>(this)); + assert((*self_v)->IsObject()); + v8::Local self((*self_v).As()); + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { + internal_fields[i] = self->GetAlignedPointerFromInternalField(i); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , 0 + , internal_fields[0] + , internal_fields[1]); + v8::PersistentBase::SetWeak(wcbd, WeakCallbackInfo

::invoke); + } +} +#else +template +template +inline void PersistentBase::SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + WeakCallbackInfo

*wcbd; + if (type == WeakCallbackType::kParameter) { + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , parameter); + persistent.MakeWeak(wcbd, WeakCallbackInfo

::invoke); + } else { + v8::Local* self_v(reinterpret_cast*>(this)); + assert((*self_v)->IsObject()); + v8::Local self((*self_v).As()); + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { + internal_fields[i] = self->GetPointerFromInternalField(i); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , 0 + , internal_fields[0] + , internal_fields[1]); + persistent.MakeWeak(wcbd, WeakCallbackInfo

::invoke); + } +} +#endif + +#endif // NAN_WEAK_H_ diff --git a/legacy-libs/grpc-cloned/node_modules/nan/package.json b/legacy-libs/grpc-cloned/node_modules/nan/package.json new file mode 100644 index 0000000..b2939e5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/package.json @@ -0,0 +1,143 @@ +{ + "_args": [ + [ + { + "raw": "nan@^2.13.2", + "scope": null, + "escapedName": "nan", + "name": "nan", + "rawSpec": "^2.13.2", + "spec": ">=2.13.2 <3.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/grpc" + ] + ], + "_from": "nan@>=2.13.2 <3.0.0", + "_hasShrinkwrap": false, + "_id": "nan@2.14.2", + "_inCache": true, + "_location": "/grpc/nan", + "_nodeVersion": "9.6.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/nan_2.14.2_1602593394727_0.8742800087816833" + }, + "_npmUser": { + "name": "kkoopa", + "email": "bbyholm@abo.fi" + }, + "_npmVersion": "5.6.0", + "_phantomChildren": {}, + "_requested": { + "raw": "nan@^2.13.2", + "scope": null, + "escapedName": "nan", + "name": "nan", + "rawSpec": "^2.13.2", + "spec": ">=2.13.2 <3.0.0", + "type": "range" + }, + "_requiredBy": [ + "/grpc" + ], + "_resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "_shasum": "f5376400695168f4cc694ac9393d0c9585eeea19", + "_shrinkwrap": null, + "_spec": "nan@^2.13.2", + "_where": "/var/opt/motion2/node_modules/grpc", + "bugs": { + "url": "https://github.com/nodejs/nan/issues" + }, + "contributors": [ + { + "name": "Rod Vagg", + "email": "r@va.gg", + "url": "https://github.com/rvagg" + }, + { + "name": "Benjamin Byholm", + "email": "bbyholm@abo.fi", + "url": "https://github.com/kkoopa/" + }, + { + "name": "Trevor Norris", + "email": "trev.norris@gmail.com", + "url": "https://github.com/trevnorris" + }, + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "https://github.com/TooTallNate" + }, + { + "name": "Brett Lawson", + "email": "brett19@gmail.com", + "url": "https://github.com/brett19" + }, + { + "name": "Ben Noordhuis", + "email": "info@bnoordhuis.nl", + "url": "https://github.com/bnoordhuis" + }, + { + "name": "David Siegel", + "email": "david@artcom.de", + "url": "https://github.com/agnat" + }, + { + "name": "Michael Ira Krufky", + "email": "mkrufky@gmail.com", + "url": "https://github.com/mkrufky" + } + ], + "dependencies": {}, + "description": "Native Abstractions for Node.js: C++ header for Node 0.8 -> 14 compatibility", + "devDependencies": { + "bindings": "~1.2.1", + "commander": "^2.8.1", + "glob": "^5.0.14", + "node-gyp": "~3.6.2", + "readable-stream": "^2.1.4", + "request": "=2.81.0", + "tap": "~0.7.1", + "xtend": "~4.0.0" + }, + "directories": {}, + "dist": { + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", + "shasum": "f5376400695168f4cc694ac9393d0c9585eeea19", + "tarball": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "fileCount": 46, + "unpackedSize": 417991, + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfhaJzCRA9TVsSAnZWagAAqa0P/33rKLxI1mx53dz2Z6/B\nQQAJOUcgZgpIdY7LkaDGw6oTRyYoDg9uq1aOW7uL6OTJGZb/0UH3LS/gs5CK\nUk1CnYitqHSmyzOCO6tZyQmiFqYqLJf5drQn+uV9sU3bi2+u42Z03vTv5v+j\nEwRLH3TfeMbrEOgDdBuo6RB+jgaZHKyEXsvCe6NXXAaAQ8as82vtDOA1FOzq\nhB91RTYgS57lF3g/ciWg/Bvb7o2Fwep7+Ah/22Cpz9UC8fm8QGz4/lQRba3m\n504ah7HXRoF79+HqvntRKF0j8fJ8fpX3cu7wQ5UND8bj/VhhNpKZtM/tCv98\nq00KMaWYNqD+NJYKULLS658iJVjpPNr9UElb3+jNDCoX+UEvdOckuJKwo5u0\n7HRmqpE6Pb0MGfVqhHK6K3buwg+eccMcCKPiHHaiZvqa/jD0savGNx2ylMVD\niTpyl8XV+ZU9vfR1tJ3OFYzOGfXOGG5LqOut/hT0qjBLTWXL3ajPcxCNdJRH\nWSrDJ7Y3da/KkyMdX37t39Q6JkQbD2hz2nGNIr1pe36CNqx8FMOvnHG2Gwuy\nGFdcABFLpkppKhHmRebaRlQXJ416KHzxUkD+A/5DcUb7ChoJgn4j6TN7ewVb\nNOb7UllppKKHOseXgre8uJM1vVslNLVsBYzfgv58uhSTbMvo5QBuK/QHKilw\nRoBa\r\n=4oJR\r\n-----END PGP SIGNATURE-----\r\n" + }, + "gitHead": "7c3fc6884666bd19b597ea58a99f51f2f4860c4e", + "homepage": "https://github.com/nodejs/nan#readme", + "license": "MIT", + "main": "include_dirs.js", + "maintainers": [ + { + "name": "kkoopa", + "email": "bbyholm@abo.fi" + }, + { + "name": "rvagg", + "email": "r@va.gg" + } + ], + "name": "nan", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/nan.git" + }, + "scripts": { + "docs": "doc/.build.sh", + "rebuild-tests": "node-gyp rebuild --msvs_version=2015 --directory test", + "test": "tap --gc --stderr test/js/*-test.js", + "test:worker": "node --experimental-worker test/tap-as-worker.js --gc --stderr test/js/*-test.js" + }, + "version": "2.14.2" +} diff --git a/legacy-libs/grpc-cloned/node_modules/nan/tools/1to2.js b/legacy-libs/grpc-cloned/node_modules/nan/tools/1to2.js new file mode 100644 index 0000000..6af2505 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/tools/1to2.js @@ -0,0 +1,412 @@ +#!/usr/bin/env node +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +var commander = require('commander'), + fs = require('fs'), + glob = require('glob'), + groups = [], + total = 0, + warning1 = '/* ERROR: Rewrite using Buffer */\n', + warning2 = '\\/\\* ERROR\\: Rewrite using Buffer \\*\\/\\n', + length, + i; + +fs.readFile(__dirname + '/package.json', 'utf8', function (err, data) { + if (err) { + throw err; + } + + commander + .version(JSON.parse(data).version) + .usage('[options] ') + .parse(process.argv); + + if (!process.argv.slice(2).length) { + commander.outputHelp(); + } +}); + +/* construct strings representing regular expressions + each expression contains a unique group allowing for identification of the match + the index of this key group, relative to the regular expression in question, + is indicated by the first array member */ + +/* simple substistutions, key group is the entire match, 0 */ +groups.push([0, [ + '_NAN_', + 'NODE_SET_METHOD', + 'NODE_SET_PROTOTYPE_METHOD', + 'NanAsciiString', + 'NanEscapeScope', + 'NanReturnValue', + 'NanUcs2String'].join('|')]); + +/* substitutions of parameterless macros, key group is 1 */ +groups.push([1, ['(', [ + 'NanEscapableScope', + 'NanReturnNull', + 'NanReturnUndefined', + 'NanScope'].join('|'), ')\\(\\)'].join('')]); + +/* replace TryCatch with NanTryCatch once, gobbling possible namespace, key group 2 */ +groups.push([2, '(?:(?:v8\\:\\:)?|(Nan)?)(TryCatch)']); + +/* NanNew("string") will likely not fail a ToLocalChecked(), key group 1 */ +groups.push([1, ['(NanNew)', '(\\("[^\\"]*"[^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]); + +/* Removed v8 APIs, warn that the code needs rewriting using node::Buffer, key group 2 */ +groups.push([2, ['(', warning2, ')?', '^.*?(', [ + 'GetIndexedPropertiesExternalArrayDataLength', + 'GetIndexedPropertiesExternalArrayData', + 'GetIndexedPropertiesExternalArrayDataType', + 'GetIndexedPropertiesPixelData', + 'GetIndexedPropertiesPixelDataLength', + 'HasIndexedPropertiesInExternalArrayData', + 'HasIndexedPropertiesInPixelData', + 'SetIndexedPropertiesToExternalArrayData', + 'SetIndexedPropertiesToPixelData'].join('|'), ')'].join('')]); + +/* No need for NanScope in V8-exposed methods, key group 2 */ +groups.push([2, ['((', [ + 'NAN_METHOD', + 'NAN_GETTER', + 'NAN_SETTER', + 'NAN_PROPERTY_GETTER', + 'NAN_PROPERTY_SETTER', + 'NAN_PROPERTY_ENUMERATOR', + 'NAN_PROPERTY_DELETER', + 'NAN_PROPERTY_QUERY', + 'NAN_INDEX_GETTER', + 'NAN_INDEX_SETTER', + 'NAN_INDEX_ENUMERATOR', + 'NAN_INDEX_DELETER', + 'NAN_INDEX_QUERY'].join('|'), ')\\([^\\)]*\\)\\s*\\{)\\s*NanScope\\(\\)\\s*;'].join('')]); + +/* v8::Value::ToXXXXXXX returns v8::MaybeLocal, key group 3 */ +groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->(', [ + 'Boolean', + 'Number', + 'String', + 'Object', + 'Integer', + 'Uint32', + 'Int32'].join('|'), ')\\('].join('')]); + +/* v8::Value::XXXXXXXValue returns v8::Maybe, key group 3 */ +groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->((?:', [ + 'Boolean', + 'Number', + 'Integer', + 'Uint32', + 'Int32'].join('|'), ')Value)\\('].join('')]); + +/* NAN_WEAK_CALLBACK macro was removed, write out callback definition, key group 1 */ +groups.push([1, '(NAN_WEAK_CALLBACK)\\(([^\\s\\)]+)\\)']); + +/* node::ObjectWrap and v8::Persistent have been replaced with Nan implementations, key group 1 */ +groups.push([1, ['(', [ + 'NanDisposePersistent', + 'NanObjectWrapHandle'].join('|'), ')\\s*\\(\\s*([^\\s\\)]+)'].join('')]); + +/* Since NanPersistent there is no need for NanMakeWeakPersistent, key group 1 */ +groups.push([1, '(NanMakeWeakPersistent)\\s*\\(\\s*([^\\s,]+)\\s*,\\s*']); + +/* Many methods of v8::Object and others now return v8::MaybeLocal, key group 3 */ +groups.push([3, ['([\\s])([^\\s]+)->(', [ + 'GetEndColumn', + 'GetFunction', + 'GetLineNumber', + 'NewInstance', + 'GetPropertyNames', + 'GetOwnPropertyNames', + 'GetSourceLine', + 'GetStartColumn', + 'ObjectProtoToString', + 'ToArrayIndex', + 'ToDetailString', + 'CallAsConstructor', + 'CallAsFunction', + 'CloneElementAt', + 'Delete', + 'ForceSet', + 'Get', + 'GetPropertyAttributes', + 'GetRealNamedProperty', + 'GetRealNamedPropertyInPrototypeChain', + 'Has', + 'HasOwnProperty', + 'HasRealIndexedProperty', + 'HasRealNamedCallbackProperty', + 'HasRealNamedProperty', + 'Set', + 'SetAccessor', + 'SetIndexedPropertyHandler', + 'SetNamedPropertyHandler', + 'SetPrototype'].join('|'), ')\\('].join('')]); + +/* You should get an error if any of these fail anyways, + or handle the error better, it is indicated either way, key group 2 */ +groups.push([2, ['NanNew(<(?:v8\\:\\:)?(', ['Date', 'String', 'RegExp'].join('|'), ')>)(\\([^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]); + +/* v8::Value::Equals now returns a v8::Maybe, key group 3 */ +groups.push([3, '([\\s\\(\\)])([^\\s\\(\\)]+)->(Equals)\\(([^\\s\\)]+)']); + +/* NanPersistent makes this unnecessary, key group 1 */ +groups.push([1, '(NanAssignPersistent)(?:]+>)?\\(([^,]+),\\s*']); + +/* args has been renamed to info, key group 2 */ +groups.push([2, '(\\W)(args)(\\W)']) + +/* node::ObjectWrap was replaced with NanObjectWrap, key group 2 */ +groups.push([2, '(\\W)(?:node\\:\\:)?(ObjectWrap)(\\W)']); + +/* v8::Persistent was replaced with NanPersistent, key group 2 */ +groups.push([2, '(\\W)(?:v8\\:\\:)?(Persistent)(\\W)']); + +/* counts the number of capturing groups in a well-formed regular expression, + ignoring non-capturing groups and escaped parentheses */ +function groupcount(s) { + var positive = s.match(/\((?!\?)/g), + negative = s.match(/\\\(/g); + return (positive ? positive.length : 0) - (negative ? negative.length : 0); +} + +/* compute the absolute position of each key group in the joined master RegExp */ +for (i = 1, length = groups.length; i < length; i++) { + total += groupcount(groups[i - 1][1]); + groups[i][0] += total; +} + +/* create the master RegExp, whis is the union of all the groups' expressions */ +master = new RegExp(groups.map(function (a) { return a[1]; }).join('|'), 'gm'); + +/* replacement function for String.replace, receives 21 arguments */ +function replace() { + /* simple expressions */ + switch (arguments[groups[0][0]]) { + case '_NAN_': + return 'NAN_'; + case 'NODE_SET_METHOD': + return 'NanSetMethod'; + case 'NODE_SET_PROTOTYPE_METHOD': + return 'NanSetPrototypeMethod'; + case 'NanAsciiString': + return 'NanUtf8String'; + case 'NanEscapeScope': + return 'scope.Escape'; + case 'NanReturnNull': + return 'info.GetReturnValue().SetNull'; + case 'NanReturnValue': + return 'info.GetReturnValue().Set'; + case 'NanUcs2String': + return 'v8::String::Value'; + default: + } + + /* macros without arguments */ + switch (arguments[groups[1][0]]) { + case 'NanEscapableScope': + return 'NanEscapableScope scope' + case 'NanReturnUndefined': + return 'return'; + case 'NanScope': + return 'NanScope scope'; + default: + } + + /* TryCatch, emulate negative backref */ + if (arguments[groups[2][0]] === 'TryCatch') { + return arguments[groups[2][0] - 1] ? arguments[0] : 'NanTryCatch'; + } + + /* NanNew("foo") --> NanNew("foo").ToLocalChecked() */ + if (arguments[groups[3][0]] === 'NanNew') { + return [arguments[0], '.ToLocalChecked()'].join(''); + } + + /* insert warning for removed functions as comment on new line above */ + switch (arguments[groups[4][0]]) { + case 'GetIndexedPropertiesExternalArrayData': + case 'GetIndexedPropertiesExternalArrayDataLength': + case 'GetIndexedPropertiesExternalArrayDataType': + case 'GetIndexedPropertiesPixelData': + case 'GetIndexedPropertiesPixelDataLength': + case 'HasIndexedPropertiesInExternalArrayData': + case 'HasIndexedPropertiesInPixelData': + case 'SetIndexedPropertiesToExternalArrayData': + case 'SetIndexedPropertiesToPixelData': + return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join(''); + default: + } + + /* remove unnecessary NanScope() */ + switch (arguments[groups[5][0]]) { + case 'NAN_GETTER': + case 'NAN_METHOD': + case 'NAN_SETTER': + case 'NAN_INDEX_DELETER': + case 'NAN_INDEX_ENUMERATOR': + case 'NAN_INDEX_GETTER': + case 'NAN_INDEX_QUERY': + case 'NAN_INDEX_SETTER': + case 'NAN_PROPERTY_DELETER': + case 'NAN_PROPERTY_ENUMERATOR': + case 'NAN_PROPERTY_GETTER': + case 'NAN_PROPERTY_QUERY': + case 'NAN_PROPERTY_SETTER': + return arguments[groups[5][0] - 1]; + default: + } + + /* Value conversion */ + switch (arguments[groups[6][0]]) { + case 'Boolean': + case 'Int32': + case 'Integer': + case 'Number': + case 'Object': + case 'String': + case 'Uint32': + return [arguments[groups[6][0] - 2], 'NanTo(', arguments[groups[6][0] - 1]].join(''); + default: + } + + /* other value conversion */ + switch (arguments[groups[7][0]]) { + case 'BooleanValue': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'Int32Value': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'IntegerValue': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'Uint32Value': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + default: + } + + /* NAN_WEAK_CALLBACK */ + if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') { + return ['template\nvoid ', + arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo &data)'].join(''); + } + + /* use methods on NAN classes instead */ + switch (arguments[groups[9][0]]) { + case 'NanDisposePersistent': + return [arguments[groups[9][0] + 1], '.Reset('].join(''); + case 'NanObjectWrapHandle': + return [arguments[groups[9][0] + 1], '->handle('].join(''); + default: + } + + /* use method on NanPersistent instead */ + if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') { + return arguments[groups[10][0] + 1] + '.SetWeak('; + } + + /* These return Maybes, the upper ones take no arguments */ + switch (arguments[groups[11][0]]) { + case 'GetEndColumn': + case 'GetFunction': + case 'GetLineNumber': + case 'GetOwnPropertyNames': + case 'GetPropertyNames': + case 'GetSourceLine': + case 'GetStartColumn': + case 'NewInstance': + case 'ObjectProtoToString': + case 'ToArrayIndex': + case 'ToDetailString': + return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join(''); + case 'CallAsConstructor': + case 'CallAsFunction': + case 'CloneElementAt': + case 'Delete': + case 'ForceSet': + case 'Get': + case 'GetPropertyAttributes': + case 'GetRealNamedProperty': + case 'GetRealNamedPropertyInPrototypeChain': + case 'Has': + case 'HasOwnProperty': + case 'HasRealIndexedProperty': + case 'HasRealNamedCallbackProperty': + case 'HasRealNamedProperty': + case 'Set': + case 'SetAccessor': + case 'SetIndexedPropertyHandler': + case 'SetNamedPropertyHandler': + case 'SetPrototype': + return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join(''); + default: + } + + /* Automatic ToLocalChecked(), take it or leave it */ + switch (arguments[groups[12][0]]) { + case 'Date': + case 'String': + case 'RegExp': + return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join(''); + default: + } + + /* NanEquals is now required for uniformity */ + if (arguments[groups[13][0]] === 'Equals') { + return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join(''); + } + + /* use method on replacement class instead */ + if (arguments[groups[14][0]] === 'NanAssignPersistent') { + return [arguments[groups[14][0] + 1], '.Reset('].join(''); + } + + /* args --> info */ + if (arguments[groups[15][0]] === 'args') { + return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join(''); + } + + /* ObjectWrap --> NanObjectWrap */ + if (arguments[groups[16][0]] === 'ObjectWrap') { + return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join(''); + } + + /* Persistent --> NanPersistent */ + if (arguments[groups[17][0]] === 'Persistent') { + return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join(''); + } + + /* This should not happen. A switch is probably missing a case if it does. */ + throw 'Unhandled match: ' + arguments[0]; +} + +/* reads a file, runs replacement and writes it back */ +function processFile(file) { + fs.readFile(file, {encoding: 'utf8'}, function (err, data) { + if (err) { + throw err; + } + + /* run replacement twice, might need more runs */ + fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) { + if (err) { + throw err; + } + }); + }); +} + +/* process file names from command line and process the identified files */ +for (i = 2, length = process.argv.length; i < length; i++) { + glob(process.argv[i], function (err, matches) { + if (err) { + throw err; + } + matches.forEach(processFile); + }); +} diff --git a/legacy-libs/grpc-cloned/node_modules/nan/tools/README.md b/legacy-libs/grpc-cloned/node_modules/nan/tools/README.md new file mode 100644 index 0000000..7f07e4b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/tools/README.md @@ -0,0 +1,14 @@ +1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, +false positives and missed opportunities. The input files are rewritten in place. Make sure that +you have backups. You will have to manually review the changes afterwards and do some touchups. + +```sh +$ tools/1to2.js + + Usage: 1to2 [options] + + Options: + + -h, --help output usage information + -V, --version output the version number +``` diff --git a/legacy-libs/grpc-cloned/node_modules/nan/tools/package.json b/legacy-libs/grpc-cloned/node_modules/nan/tools/package.json new file mode 100644 index 0000000..2dcdd78 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/nan/tools/package.json @@ -0,0 +1,19 @@ +{ + "name": "1to2", + "version": "1.0.0", + "description": "NAN 1 -> 2 Migration Script", + "main": "1to2.js", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/nan.git" + }, + "contributors": [ + "Benjamin Byholm (https://github.com/kkoopa/)", + "Mathias Küsel (https://github.com/mathiask88/)" + ], + "dependencies": { + "glob": "~5.0.10", + "commander": "~2.8.1" + }, + "license": "MIT" +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/LICENSE b/legacy-libs/grpc-cloned/node_modules/protobufjs/LICENSE new file mode 100644 index 0000000..75b5248 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/LICENSE @@ -0,0 +1,202 @@ + + 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/legacy-libs/grpc-cloned/node_modules/protobufjs/README.md b/legacy-libs/grpc-cloned/node_modules/protobufjs/README.md new file mode 100644 index 0000000..1cf6661 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/README.md @@ -0,0 +1,184 @@ +protobuf.js 5 [![Build Status](https://travis-ci.org/dcodeIO/protobuf.js.svg?branch=ProtoBuf5)](https://travis-ci.org/dcodeIO/protobuf.js) [![Donate](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=dcode%40dcode.io&item_name=%3C3%20protobuf.js) +===================================== +**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/docs/overview)). + +**protobuf.js** is a pure JavaScript implementation on top of [bytebuffer.js](https://github.com/dcodeIO/bytebuffer.js) +including a .proto parser, message class building and simple encoding and decoding. There is no compilation step +required, it's super easy to use and it works out of the box on .proto files! + +Getting started +--------------- +* **Step 1:** Become familar with [Google's Protocol Buffers (protobuf)](https://developers.google.com/protocol-buffers/docs/overview) +* **Step 2:** Read on or head straight to [our wiki](https://github.com/dcodeIO/protobuf.js/wiki) for additional information +* **Step 3:** Build something cool! :-) + +Features +-------- +* [RequireJS](http://requirejs.org/)/AMD compatible +* [node.js](http://nodejs.org)/CommonJS compatible, also available via [npm](https://npmjs.org/package/protobufjs) +* Browser compatible +* [Closure Compiler](https://developers.google.com/closure/compiler/) compatible (fully annotated, [externs](https://github.com/dcodeIO/protobuf.js/tree/master/externs)) +* Fully documented using [jsdoc3](https://github.com/jsdoc3/jsdoc) +* Well tested through [test.js](https://github.com/dcodeIO/test.js) +* [bytebuffer.js](https://github.com/dcodeIO/bytebuffer.js) is the only production dependency +* Fully compatible to the official implementation including advanced features +* proto2js command line utility + +Installation +------------ + +### node.js / CommonJS + +``` +$> npm install protobufjs +``` + +```js +var ProtoBuf = require("protobufjs"); +... +``` + +### RequireJS / AMD + +Requires [bytebuffer.js](http://github.com/dcodeIO/bytebuffer.js). Optionally depends on [long.js](https://github.com/dcodeIO/long.js) for long (int64) support. If you do not require long support, you can skip the Long.js config. RequireJS example: + +```js +require(["protobuf"], function(ProtoBuf) { + ... +}); +``` + +Or as a module dependency: + +```js +define("MyModule", ["protobuf"], function(ProtoBuf) { + ... +}); +``` + +### Browser + +Requires [bytebuffer.js](http://github.com/dcodeIO/bytebuffer.js). Optionally depends on [long.js](https://github.com/dcodeIO/long.js) for long (int64) support. If you do not require long support, you can skip the Long.js include. + +```html + + + + +``` + +```js +var ProtoBuf = dcodeIO.ProtoBuf; +... +``` + +Getting started +--------------- + +*Note:* You'll need the full build to load .proto data. light builds are able to load JSON only. + +### Loading .proto files + +To load a .proto file, use: + +**API:** `ProtoBuf.loadProtoFile(source[, callback[, builder]]):Builder|undefined` + +```js +// Synchronously +var builder = ProtoBuf.loadProtoFile("path/to/file.proto"); + +// Asynchronously +ProtoBuf.loadProtoFile("path/to/file.proto", function(err, builder) { + ... +}); +``` + +`ProtoBuf.loadProtoFile` also accepts an object specifying the import root directory and the file to load as its first parameter: `{root: string, file: string}`. Additionally, an already created and then reused builder can be specified as the last argument, which is useful if all the definitions shall reside in a single namespace. + +### Loading .proto strings + +**API:** `ProtoBuf.loadProto(source[, builder][, filename]):Builder` + +```js +var builder = ProtoBuf.loadProto(...protoString..., "myproto.proto"); +``` + +### Loading JSON files and strings + +To load the (raw) JSON counterpart generated through pbjs, use `ProtoBuf.loadJsonFile` respectively `ProtoBuf.loadJson`. It's the same API. + +If you generated classes or modules with it, loading is done just by including respectively requiring the resulting file. Loading is handled transparently in this case. + +When using JSON only, you can use protobuf-light.js or protobuf-light.min.js instead, which do NOT include the ProtoBuf.DotProto package for parsing and are therefore smaller. + +Command line +------------ +Since ProtoBuf.js 4.0.0 the library ships with the `pbjs` command line utility. With it it's possible to convert between .proto and JSON descriptors and even to generate the code required to access runtime structures as pure JS (classes), an AMD module or a CommonJS module. + +``` + + _ |_ . _ +|_)|_)|_) ProtoBuf.js v4.0.0-b3 https://github.com/dcodeIO/ProtoBuf.js +| ' + +CLI utility to convert between .proto and JSON syntax / to generate classes. + +Usage: pbjs [options] [> outFile] + +Options: + --help, -h Show help [boolean] + --version, -v Show version number [boolean] + --source, -s Specifies the source format. Valid formats are: + + json Plain JSON descriptor + proto Plain .proto descriptor + + --target, -t Specifies the target format. Valid formats are: + + amd Runtime structures as AMD module + commonjs Runtime structures as CommonJS module + js Runtime structures + json Plain JSON descriptor + proto Plain .proto descriptor + + --using, -u Specifies an option to apply to the volatile builder + loading the source, e.g. convertFieldsToCamelCase. + --min, -m Minifies the output. [default: false] + --path, -p Adds a directory to the include path. + --legacy, -l Includes legacy descriptors from google/protobuf/ if + explicitly referenced. [default: false] + --quiet, -q Suppresses any informatory output to stderr. [default: false] + --use, -i Specifies an option to apply to the emitted builder + utilized by your program, e.g. populateAccessors. + --exports, -e Specifies the namespace to export. Defaults to export + the root namespace. + --dependency, -d Library dependency to use when generating classes. + Defaults to 'protobufjs' for CommonJS, 'ProtoBuf' for + AMD modules and 'dcodeIO.ProtoBuf' for classes. +``` + +Documentation +------------- +* [Read the official protobuf guide](https://developers.google.com/protocol-buffers/docs/overview) +* [Read the API docs](http://htmlpreview.github.io/?https://raw.githubusercontent.com/dcodeIO/protobuf.js/ProtoBuf5/docs/ProtoBuf.html) +* [Check out the examples](https://github.com/dcodeIO/protobuf.js/tree/ProtoBuf5/examples) + +Tests +----- +* [View source](https://github.com/dcodeIO/protobuf.js/blob/ProtoBuf5/tests/suite.js) + +Downloads +--------- +* [Distributions](https://github.com/dcodeIO/protobuf.js/tree/ProtoBuf5/dist) +* [ZIP-Archive](https://github.com/dcodeIO/protobuf.js/archive/ProtoBuf5.zip) +* [Tarball](https://github.com/dcodeIO/protobuf.js/tarball/ProtoBuf5) + +CDN usage +--------- +```html + +``` +With the version pointing to the exact [release](https://github.com/dcodeIO/protobuf.js/releases) your project depends upon. + +**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/bin/pbjs b/legacy-libs/grpc-cloned/node_modules/protobufjs/bin/pbjs new file mode 100644 index 0000000..73ebc4a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/bin/pbjs @@ -0,0 +1,2 @@ +#!/usr/bin/env node +process.exit(require(__dirname+"/../cli/pbjs.js").main(process.argv)); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/bower.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/bower.json new file mode 100644 index 0000000..30f074c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/bower.json @@ -0,0 +1,19 @@ +{ + "name": "protobuf", + "description": "Protocol Buffers for JavaScript. Finally.", + "version": "5.0.3", + "main": "dist/protobuf.js", + "license": "Apache-2.0", + "homepage": "http://dcode.io/", + "dependencies": { + "bytebuffer": "~5" + }, + "keywords": ["net", "buffer", "protobuf", "serialization", "bytebuffer", "websocket", "webrtc"], + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs.js new file mode 100644 index 0000000..e90798b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs.js @@ -0,0 +1,281 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 ProtoBuf = require(__dirname+"/../index.js"), + fs = require("fs"), + path = require("path"), + cli = require("ascli")("pbjs"), + yargs = require("yargs"), + util = require("./pbjs/util.js"), + glob = require("glob"), + pkg = require("../package.json"); + +/** + * pbjs namespace. + * @exports pbjs + * @namespace + */ +var pbjs = module.exports = {}; + +/** + * @alias pbjs/util + */ +pbjs.util = util; + +/** + * Source formats. + * @type {!Object.)>} + */ +pbjs.sources = {}; +fs.readdirSync(__dirname+"/pbjs/sources").forEach(function(source) { + if (/\.js$/.test(source)) { + var src = require(__dirname + "/pbjs/sources/" + source); + if (!src.exclude) + pbjs.sources[source.substring(0, source.lastIndexOf("."))] = src; + } +}); + +/** + * Target formats. + * @type {!Object.)>} + */ +pbjs.targets = {}; +fs.readdirSync(__dirname+"/pbjs/targets").forEach(function(target) { + if (/\.js$/.test(target)) + pbjs.targets[target.substring(0, target.lastIndexOf("."))] = require(__dirname + "/pbjs/targets/" + target); +}); + +/** + * Status code: Operation successful + * @type {number} + */ +pbjs.STATUS_OK = 0; + +/** + * Status code: Displaying usage information + * @type {number} + */ +pbjs.STATUS_USAGE = 1; + +/** + * Status code: No such include directory + * @type {number} + */ +pbjs.STATUS_ERR_INCLUDE_DIR = 2; + +/** + * Status code: No such source format + * @type {number} + */ +pbjs.STATUS_ERR_SOURCE_FORMAT = 3; + +/** + * Status code: No such target format + * @type {number} + */ +pbjs.STATUS_ERR_TARGET_FORMAT = 4; + +/** + * Status code: No such namespace + * @type {number} + */ +pbjs.STATUS_ERR_NAMESPACE = 5; + +/** + * Status code: Illegal dependency + * @type {number} + */ +pbjs.STATUS_ERR_DEPENDENCY = 6; + +/** + * Status code: No matching source files + * @type {number} + */ +pbjs.STATUS_ERR_NOSOURCE = 7; + +// Makes a table of available source or target formats +function mkOptions(obj) { + var str = ''; + Object.keys(obj).forEach(function(key) { + str += "\n "+util.pad(key, 10)+" "+obj[key].description; + }); + return str; +} + +/** + * Executes the program. + * @param {!Array.} argv Command line arguments + * @returns {number} Status code + */ +pbjs.main = function(argv) { + var options = yargs + .usage(cli("pb".white.bold+"js".green.bold, util.pad("ProtoBuf.js v"+pkg['version'], 31, true)+" "+pkg['homepage'].grey) + "\n" + + "CLI utility to convert between .proto and JSON syntax / to generate classes.\n\n" + + "Usage: ".white.bold+path.basename(argv[1]).green.bold+" [options] [> outFile]") + .help("help") + .version(pkg["version"]) + .wrap(null) + .options({ + source: { + alias: "s", + describe: "Specifies the source format. Valid formats are:\n" + mkOptions(pbjs.sources)+"\n" + }, + target: { + alias: "t", + describe: "Specifies the target format. Valid formats are:\n" + mkOptions(pbjs.targets)+"\n" + }, + using: { + alias: "u", + describe: "Specifies an option to apply to the volatile builder\nloading the source, e.g. convertFieldsToCamelCase.", + type: "array" + }, + min: { + alias: "m", + describe: "Minifies the output.", + default: false + }, + path: { + alias: "p", + describe: "Adds a directory to the include path." + }, + legacy: { + alias: "l", + describe: "Includes legacy descriptors from google/protobuf/ if\nexplicitly referenced.", + default: false + }, + quiet: { + alias: "q", + describe: "Suppresses any informatory output to stderr.", + default: false + }, + out: { + alias: "o", + describe: "Send output to file instead of stdout.", + }, + use: { + alias: "i", + describe: "Specifies an option to apply to the emitted builder\nutilized by your program, e.g. populateAccessors.", + type: "array" + }, + exports: { + alias: "e", + describe: "Specifies the namespace to export. Defaults to export\nthe root namespace." + }, + dependency: { + alias: "d", + describe: "Library dependency to use when generating classes.\nDefaults to 'protobufjs' for CommonJS, 'protobuf' for\nAMD modules and 'dcodeIO.ProtoBuf' for classes." + } + }) + .alias("help", "h") + .alias("version", "v") + .check(function (args) { + if (args.source && typeof pbjs.sources[args.source] !== "function") { + return "Unrecognized source format: '" + args.source + "'"; + } + + if (args.target && typeof pbjs.targets[args.target] !== "function") { + return "Unrecognized target format: '" + args.target + "'"; + } + + if (args._.length < 3) { + return "The filename to parse is required."; + } + + return true; + }) + .parse(argv); + + var start = Date.now(), + sourceFiles = options._.slice(2); + + // Expand glob expressions + var sourceFilesExpand = []; + for (var i=0; i + + 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 description = "Binary descriptor set"; + +var ProtoBuf = require(__dirname+"/../../../index.js"), + util = require(__dirname+"/../util.js"), + node_path = require("path"), + fs = require("fs"); + +/** + * pbjs source: Binary descriptor + * @exports pbjs/sources/binary + * @function + * @param {!Array.} filenames Source files + * @param {!Object.=} options Options + * @returns {!ProtoBuf.Builder} + */ +var binary = module.exports = function(filenames, options) { + options = options || []; + var builder = ProtoBuf.newBuilder(util.getBuilderOptions(options, "using")), + loaded = []; + filenames.forEach(function(filename) { + var data = binary.load(filename, options, loaded); + builder["import"](data, filename); + }); + builder.resolveAll(); + return builder; +}; + +/** + * Module description. + * @type {string} + */ +binary.description = description; + +binary.exclude = true; // Unfinished + +/** + * Loads a binary descriptor. + * @param {string} filename Source file + * @param {!Object.} options Options + * @param {!Array.=} loaded An array of already loaded filenames + * @returns {*} JSON descriptor + */ +binary.load = function(filename, options, loaded) { + filename = node_path.resolve(filename); + loaded = loaded || []; + if (loaded.indexOf(filename) >= 0) + return {}; + var data = fs.readFileSync(filename); + loaded.push(filename); + var builder = ProtoBuf.loadProtoFile(node_path.join("..", "..", "..", "src", "google", "protobuf", "descriptor.proto")), + FileDescriptorSet = builder.build("google.protobuf.FileDescriptorSet"); + var fds = FileDescriptorSet.decode(data), + imports = []; + var json = { + "package": null, + "imports": imports + }; + fds.file.forEach(function(fdp) { + imports.push(buildFileDescriptorProto(fdp)); + }); + return json; +}; + +function buildFileDescriptorProto(fdp) { + var pkg = fdp.package, + messages = [], + enums = [], + services = [], + extensions = [], + options = {}, + imports = []; + fdp.message_type.forEach(function(dp) { + messages.push(buildMessageDescriptorProto(dp)); + }); + fdp.enum_type.forEach(function(edp) { + enums.push(buildEnumDescriptorProto(edp)); + }); + fdp.service.forEach(function(sdp) { + enums.push(buildServiceDescriptorProto(sdp)); + }); + fdp.extension.forEach(function(fdp) { + extensions.push(buildFieldDescriptorProtoAsExtension(fdp)); + }); + fdp.options.forEach(function(fo) { + // TODO + }); + fdp.dependency.forEach(function(filename) { + // TODO + }); + return { + "package": pkg, + "messages": messages, + "enums": enums, + "services": services, + "extensions": extensions, + "options": options, + "imports": imports + }; +} + +function buildMessageDescriptorProto(mdp) { + +} + +function buildEnumDescriptorProto(edp) { + +} + +function buildServiceDescriptorProto(sdp) { + +} + +function buildFieldDescriptorProtoAsExtension(fdp) { + +} \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/sources/json.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/sources/json.js new file mode 100644 index 0000000..86df60f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/sources/json.js @@ -0,0 +1,84 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 description = "Plain JSON descriptor"; + +var ProtoBuf = require(__dirname+"/../../../index.js"), + util = require(__dirname+"/../util.js"), + node_path = require("path"), + fs = require("fs"); + +/** + * pbjs source: Plain JSON descriptor + * @exports pbjs/sources/json + * @function + * @param {!Array.} filenames Source files + * @param {!Object.=} options Options + * @returns {!ProtoBuf.Builder} + */ +var json = module.exports = function(filenames, options) { + options = options || []; + var builder = ProtoBuf.newBuilder(util.getBuilderOptions(options, "using")), + loaded = []; + filenames.forEach(function(filename) { + var data = json.load(filename, options, loaded); + builder["import"](data, filename); + }); + builder.resolveAll(); + return builder; +}; + +/** + * Module description. + * @type {string} + */ +json.description = description; + +/** + * Loads a JSON descriptor including imports. + * @param {string} filename Source file + * @param {!Object.} options Options + * @param {!Array.=} loaded An array of already loaded filenames + * @returns {*} JSON descriptor + */ +json.load = function(filename, options, loaded) { + filename = node_path.resolve(filename); + loaded = loaded || []; + if (loaded.indexOf(filename) >= 0) + return {}; + var data = JSON.parse(fs.readFileSync(filename).toString("utf8")), + imports = data['imports']; + loaded.push(filename); + if (Array.isArray(imports)) { + for (var i=0; i + + 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 description = "Plain .proto descriptor"; + +var ProtoBuf = require(__dirname+"/../../../index.js"), + util = require(__dirname+"/../util.js"), + fs = require("fs"), + node_path = require("path"); + +/** + * pbjs source: Plain .proto descriptor + * @exports pbjs/sources/proto + * @function + * @param {!Array.} filenames Source files + * @param {!Object.=} options Options + * @returns {!ProtoBuf.Builder} + */ +var proto = module.exports = function(filenames, options) { + options = options || []; + var builder = ProtoBuf.newBuilder(util.getBuilderOptions(options, "using")), + loaded = []; + filenames.forEach(function(filename) { + var data = proto.load(filename, options, loaded); + builder["import"](data, filename); + }); + builder.resolveAll(); + return builder; +}; + +/** + * Module description. + * @type {string} + */ +proto.description = description; + +/** + * Loads a .proto descriptor including imports. + * @param {string} filename Source file + * @param {!Object.} options Options + * @param {!Array.=} loaded An array of already loaded filenames + * @returns {*} JSON descriptor + */ +proto.load = function(filename, options, loaded) { + filename = node_path.resolve(filename); + loaded = loaded || []; + if (loaded.indexOf(filename) >= 0) + return {}; + var data = ProtoBuf.DotProto.Parser.parse(fs.readFileSync(filename).toString("utf8")); + loaded.push(filename); + if (Array.isArray(data['imports'])) { + var imports = data['imports']; + for (var i=0; i + + 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 description = "Runtime structures as AMD module"; + +var ProtoBuf = require("../../../index.js"), + util = require("../util.js"), + js = require("./js.js"); + +/** + * pbjs target: Runtime structures as an AMD module + * @exports pbjs/targets/amd + * @function + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +var amd = module.exports = function(builder, options) { + options = options || {}; + return [ + "define([", JSON.stringify(options.dependency || "protobuf"), "]", options.min ? "," : ", ", + "function(ProtoBuf)", options.min ? "{" : " {\n ", + "return ProtoBuf", + util.indent(js.build(builder, options), options.min ? "" : " "), options.min ? "" : "\n", + "});" + ].join(''); +}; + +/** + * Module description. + * @type {string} + */ +amd.description = description; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/commonjs.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/commonjs.js new file mode 100644 index 0000000..11d1cfd --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/commonjs.js @@ -0,0 +1,42 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 description = "Runtime structures as CommonJS module"; + +var util = require("../util.js"), + js = require("./js.js"); + +/** + * pbjs target: Runtime structures as a CommonJS module + * @exports pbjs/targets/commonjs + * @function + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +var commonjs = module.exports = function(builder, options) { + options = options || {}; + return [ + "module.exports", options.min ? "=" : " = ", + "require(", JSON.stringify(options.dependency || "protobufjs"), ")", + js.build(builder, options) + ].join(''); +}; + +/** + * Module description. + * @type {string} + */ +commonjs.description = description; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/js.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/js.js new file mode 100644 index 0000000..4f9ee12 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/js.js @@ -0,0 +1,63 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 description = "Runtime structures"; + +var util = require("../util.js"), + json = require("./json.js"); + +/** + * pbjs target: Runtime structures + * @exports pbjs/targets/js + * @function + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +var js = module.exports = function(builder, options) { + options = options || {}; + var varName = "_root"; + if (options.exports) + varName = options.exports.substring(options.exports.lastIndexOf(".")+1); + return [ + "var ", varName, options.min ? "=" : " = ", options.dependency || "dcodeIO.ProtoBuf", + js.build(builder, options) + ].join(''); +}; + +/** + * Builds the core js target. + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +js.build = function(builder, options) { + options = options || {}; + return [ + ".newBuilder(", + JSON.stringify(util.getBuilderOptions(options, "use"), null, options.min ? 0 : 4), + ")['import'](", + json(builder, options), + ").build(", + typeof options.exports === 'string' ? JSON.stringify(options.exports.split(".")) : "", + ");" + ].join(''); +}; + +/** + * Module description. + * @type {string} + */ +js.description = description; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/json.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/json.js new file mode 100644 index 0000000..39e4c6d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/json.js @@ -0,0 +1,260 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 description = "Plain JSON descriptor"; + +var ProtoBuf = require(__dirname+"/../../../index.js"), + util = require("../util.js"); + +/** + * pbjs target: Plain JSON descriptor + * @exports pbjs/targets/json + * @function + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +var json = module.exports = function(builder, options) { + options = options || {}; + builder.resolveAll(); + + // Set the pointer to the lowest common namespace (with options) + var ptr = builder.ns; + while (ptr.children.length === 1 && Object.keys(ptr.options).length === 0 && ptr.children[0].className === "Namespace") + ptr = ptr.children[0]; + + // Start by building the package namespace + var pkg = ptr.fqn().substring(1), + out = { + "package": pkg !== "" ? pkg : null + }; + buildNamespace(ptr, out); + return JSON.stringify(out, null, options.min ? 0 : 4); +}; + +/** + * Module description. + * @type {string} + */ +json.description = description; + +/** + * Builds all structures in a namespace. + * @param {!ProtoBuf.Reflect.Namespace} ns Namespace to build + * @param {!Object.} out Extended output object + */ +function buildNamespace(ns, out) { + var messages, enums, services; + util.extend(out, { + "syntax" : ns.syntax || 'proto2', + "options" : out.options || {}, + "messages" : messages = [], + "enums" : enums = [], + "services" : services = [] + }); + if (!(ns instanceof ProtoBuf.Reflect.Message)) + out['isNamespace'] = true; + util.extend(out["options"], buildOptions(ns.options)); + ns.getChildren(ProtoBuf.Reflect.Enum).forEach(function(enm) { + enums.push(buildEnum(enm)); + }); + if (enums.length === 0) + delete out["enums"]; + ns.getChildren(ProtoBuf.Reflect.Message).forEach(function(msg) { + messages.push(buildMessage(msg)); + }); + ns.getChildren(ProtoBuf.Reflect.Service).forEach(function(svc) { + services.push(buildService(svc)); + }); + if (services.length === 0) + delete out["services"]; + Array.prototype.push.apply(messages, buildExtensions(ns)); + ns.getChildren(ProtoBuf.Reflect.Namespace).forEach(function(innerNs) { + if (innerNs.className !== "Namespace") + return; + var emptyMessage = { + "name": innerNs.name, + "fields": [] + }; + buildNamespace(innerNs, emptyMessage); + messages.push(emptyMessage); + }); + if (messages.length === 0) + delete out["messages"]; + if (Object.keys(out["options"]).length === 0) + delete out["options"]; +} + +/** + * Builds extensions declared in the specified namespace. + * @param {!ProtoBuf.Reflect.Namespace} ns Namespace + * @returns {!Array.} + */ +function buildExtensions(ns) { + var exts = util.groupExtensions(ns); + if (exts === null) + return []; + var messages = []; + Object.keys(exts).forEach(function(extFqn) { + var extMsg = ns.resolve(extFqn), + extFields = exts[extFqn]; + var fields, ext = { + "ref" : ns.qn(extMsg), + "fields" : fields = [] + }; + extFields.forEach(function(extField) { + fields.push(buildMessageField(extField)); + }); + messages.push(ext); + }); + return messages; +} + +/** + * Builds block-level options. + * @param {!Object.} options Options + * @returns {!Object.} + */ +function buildOptions(options) { + Object.keys(options = options || {}).forEach(function(key) { + var val = options[key]; + switch (typeof val) { + case 'string': + case 'number': + case 'boolean': + case 'object': + break; + default: + throw Error("Illegal option type: "+typeof(val)); + } + }); + return options; +} + +/** + * Builds a message. + * @param {!ProtoBuf.Reflect.Message} msg Message + * @returns {!*} + */ +function buildMessage(msg) { + var fields, oneofs; + var out = { + "name" : msg.name, + "syntax" : msg.syntax || 'proto2', + "options" : {}, + "fields" : fields = [], + "oneofs" : oneofs = {} + }; + msg.getChildren(ProtoBuf.Reflect.Message.Field).forEach(function(fld) { + if (fld instanceof ProtoBuf.Reflect.Message.ExtensionField) + return; + fields.push(buildMessageField(fld)); + }); + msg.getChildren(ProtoBuf.Reflect.Message.OneOf).forEach(function(oneof) { + oneofs[oneof.name] = buildMessageOneof(oneof); + }); + if (msg.extensions) + out["extensions"] = msg.extensions; + if (Object.keys(oneofs).length === 0) + delete out["oneofs"]; + buildNamespace(msg, out); + return out; +} + +/** + * Builds a message field. + * @param {!ProtoBuf.Reflect.Message.Field} fld Message field + * @returns {!*} + */ +function buildMessageField(fld) { + return { + "rule" : fld.map ? "map" : (fld.repeated ? "repeated" : (fld.required ? "required" : "optional")), + "type" : fld.resolvedType ? fld.parent.qn(fld.resolvedType) : fld.type['name'], + "keytype" : (typeof(fld.keyType) === 'string') ? fld.keyType : (fld.keyType !== null ? fld.keyType.name : undefined), + "name" : fld instanceof ProtoBuf.Reflect.Message.ExtensionField ? fld.name.substring(fld.name.lastIndexOf(".")+1): fld.name, + "id" : fld.id, + "options" : Object.keys(fld.options).length > 0 ? buildOptions(fld.options) : undefined, + "oneof" : fld.oneof ? fld.oneof.name : undefined + }; +} + +/** + * Builds a message oneof. + * @param {!ProtoBuf.Reflect.message.OneOf} oneof Message oneof + * @returns {!Array.} + */ +function buildMessageOneof(oneof) { + var out = []; + oneof.fields.forEach(function(fld) { + out.push(fld.id); + }); + return out; +} + +/** + * Builds an enum. + * @param {!ProtoBuf.Reflect.Enum} enm Enum + * @returns {!*} + */ +function buildEnum(enm) { + var values; + var out = { + "name" : enm.name, + "syntax" : enm.syntax || 'proto2', + "values" : values = [] + }; + enm.getChildren(ProtoBuf.Reflect.Enum.Value).forEach(function(val) { + values.push(buildEnumValue(val)); + }); + if (Object.keys(enm.options).length > 0) + out["options"] = buildOptions(enm.options); + return out; +} + +/** + * Builds an enum value. + * @param {!ProtoBuf.Reflect.Enum.Value} val Enum value + * @returns {!*} + */ +function buildEnumValue(val) { + return { + "name" : val.name, + "id" : val.id + }; +} + +/** + * Builds a service. + * @param {!ProtoBuf.Reflect.Service} svc Service + * @returns {!*} + */ +function buildService(svc) { + var rpc; + var out = { + "name": svc.name, + "options": buildOptions(svc.options), + "rpc": rpc = {} + }; + svc.getChildren(ProtoBuf.Reflect.Service.RPCMethod).forEach(function(mtd) { + rpc[mtd.name] = { + "request": svc.qn(mtd.resolvedRequestType), + "request_stream": mtd.requestStream, + "response": svc.qn(mtd.resolvedResponseType), + "response_stream": mtd.responseStream, + "options": buildOptions(mtd.options) + }; + }); + return out; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/proto.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/proto.js new file mode 100644 index 0000000..abfce36 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/proto.js @@ -0,0 +1,267 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 description = "Plain .proto descriptor"; + +var ProtoBuf = require(__dirname+"/../../../index.js"), + util = require("../util.js"); + +/** + * pbjs target: Plain .proto descriptor + * @exports pbjs/targets/proto + * @function + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +var proto = module.exports = function(builder, options) { + options = options || {}; + builder.resolveAll(); + + // Set the pointer to the lowest common namespace (with options) + var ptr = builder.ns; + while (ptr.children.length === 1 && Object.keys(ptr.options).length === 0 && ptr.children[0].className === "Namespace") + ptr = ptr.children[0]; + + var out = []; + + function trim() { + out[out.length-1] = out[out.length-1].replace(/\n{2,}$/, "\n"); + } + + // Builds a set of top level options + function buildOptions(opt, indent) { + var keys; + if ((keys = Object.keys(opt)).length === 0) + return; + keys.forEach(function(key) { + if (!options.min) + out.push(indent); + out.push("option ", key, options.min ? "=" : " = ", value(opt[key]), options.min ? ";" : ";\n"); + }); + if (!options.min) + out[out.length-1] += "\n"; + } + + // Builds everything within a namespace + function buildNamespace(ns, indent) { + ns.getChildren(ProtoBuf.Reflect.Enum).forEach(function(enm) { + buildEnum(enm, indent); + }); + ns.getChildren(ProtoBuf.Reflect.Message).forEach(function(msg) { + if (!msg.isGroup) // legacy groups are build within the respective field + buildMessage(msg, indent); + }); + var exts = util.groupExtensions(ns); + if (exts !== null) { + Object.keys(exts).forEach(function(extFqn) { + var extMsg = ns.resolve(extFqn), + extFields = exts[extFqn]; + if (!options.min) + out.push(indent); + out.push("extend ", ns.qn(extMsg), options.min ? "{" : " {\n"); + extFields.forEach(function(extField) { + buildMessageField(ns, extField, indent+" ", false); + }); + if (!options.min) + out.push(indent); + out.push(options.min ? "}" : "}\n\n"); + }); + } + ns.getChildren(ProtoBuf.Reflect.Service).forEach(function(svc) { + buildService(svc, indent); + }); + ns.getChildren(ProtoBuf.Reflect.Namespace).forEach(function(innerNs) { + if (innerNs.className !== "Namespace") + return; + if (!options.min) + out.push(indent); + out.push("message ", innerNs.name, options.min ? "{" : " {\n"); + buildNamespace(innerNs, indent+" "); + if (!options.min) + out.push(indent); + out.push(options.min ? "}" : "}\n"); + }); + trim(); + } + + // Builds a message + function buildMessage(msg, indent) { + if (!msg.isGroup) { + if (!options.min) + out.push(indent); + out.push("message ", msg.name); + } + out.push(options.min ? "{" : " {\n"); + buildOptions(msg.options, indent+" "); + var n = 0, oneofFields = []; + msg.getChildren(ProtoBuf.Reflect.Message.OneOf).forEach(function(oneof) { + if (!options.min) + out.push(indent, " "); + out.push("oneof ", oneof.name, options.min ? "{" : " {\n"); + oneof.fields.forEach(function(fld) { + buildMessageField(msg, fld, indent+" ", true); + oneofFields.push(fld); + }); + if (!options.min) + out.push(indent, " "); + out.push(options.min ? "}" : "}\n"); + }); + msg.getChildren(ProtoBuf.Reflect.Message.Field).forEach(function(fld) { + if (fld instanceof ProtoBuf.Reflect.Message.ExtensionField) + return; + if (oneofFields.indexOf(fld) >= 0) + return; + buildMessageField(msg, fld, indent+" ", false); + n++; + }); + if (n > 0 && !options.min) + out[out.length-1] += "\n"; + if (msg.extensions) { // array of ranges + if (!options.min) + out.push(indent, " "); + out.push("extensions "); + msg.extensions.forEach(function(range, index) { + if (index > 0) + out.push(options.min ? "," : ", "); + out.push(value(range[0])); + if (range[1] !== range[0]) + out.push(" to ", range[1] === ProtoBuf.ID_MAX ? "max" : value(range[1])); + }); + out.push(options.min ? ";" : ";\n\n"); + } + buildNamespace(msg, indent+" "); + if (!options.min) + out.push(indent); + out.push(options.min ? "}" : "}\n\n"); + } + + // Builds a message field + function buildMessageField(msg, fld, indent, isOneOf) { + var isGroup = false; + if (!options.min) + out.push(indent); + if (!isOneOf) + out.push(fld.required ? "required " : (fld.repeated ? "repeated " : "optional ")); + if (fld.resolvedType !== null) { + if (fld.resolvedType instanceof ProtoBuf.Reflect.Message && fld.resolvedType.isGroup) { + // inline legacy groups + out.push("group "); + isGroup = true; + } + out.push(msg.qn(fld.resolvedType)); + } else + out.push(fld.type['name']); + if (!isGroup) + out.push(" ", fld instanceof ProtoBuf.Reflect.Message.ExtensionField ? fld.name.substring(fld.name.lastIndexOf(".")+1) : fld.name); + out.push(options.min ? "=" : " = ", fld.id); + if (isGroup) // inline + buildMessage(fld.resolvedType, indent); + else { + var keys = Object.keys(fld.options); + if (keys.length > 0) { + out.push(options.min ? "[" : " ["); + var n = 0; + keys.forEach(function (key) { + if (n > 0) + out.push(options.min ? "," : ", "); + out.push(key, options.min ? "=" : " = ", + // BEWARE: Monkey patch for string enum defaults + key === "default" && fld.type === ProtoBuf.TYPES["enum"] && typeof fld.options[key] === 'string' ? fld.options[key] : value(fld.options[key]) + ); + n++; + }); + out.push("]"); + } + out.push(options.min ? ";" : ";\n"); + } + } + + // Builds an enum + function buildEnum(enm, indent) { + if (!options.min) + out.push(indent); + out.push("enum ", enm.name, options.min ? "{" : " {\n"); + buildOptions(enm.options, indent+" "); + enm.getChildren(ProtoBuf.Reflect.Enum.Value).forEach(function(val) { + if (!options.min) + out.push(indent, " "); + out.push(val.name, options.min ? "=" : " = ", val.id, options.min? ";" : ";\n"); + }); + if (!options.min) + out.push(indent); + out.push(options.min ? "}" : "}\n\n"); + } + + // Builds a service + function buildService(svc, indent) { + if (!options.min) + out.push(indent); + out.push("service ", svc.name, options.min ? "{" : " {\n"); + buildOptions(svc.options, indent+" "); + svc.getChildren(ProtoBuf.Reflect.Service.RPCMethod).forEach(function(rpc) { + if (!options.min) + out.push(indent+" "); + out.push("rpc ", rpc.name, "(", svc.qn(rpc.resolvedRequestType), ") returns(", svc.qn(rpc.resolvedResponseType), ")"); + var keys = Object.keys(rpc.options); + if (keys.length === 0) { + out.push(options.min ? ";" : ";\n") + } else { + out.push(options.min ? "{" : " {\n"); + buildOptions(rpc.options, indent+" "); + trim(); + if (!options.min) + out.push(indent+" "); + out.push(options.min ? "}" : "}\n"); + } + if (!options.min) + out[out.length-1] += "\n"; + }); + trim(); + out.push(options.min ? "}" : "}\n"); + } + + // Start by building the package namespace + var pkg = ptr.fqn().substring(1); + if (pkg !== "") + out.push("package ", pkg, options.min ? ";" : ";\n\n"); + buildOptions(ptr.options, ""); + buildNamespace(ptr, ""); + return out.join(''); +}; + +/** + * Module description. + * @type {string} + */ +proto.description = description; + +/** + * Converts a JavaScript value to a .proto value. + * @param {*} v Value + * @returns {string} Dot proto value + */ +function value(v) { + switch (typeof v) { + case 'boolean': + return v ? 'true' : 'false'; + case 'number': + return v.toString(); + case 'string': + return '"'+v.replace(/"/g, '\\"')+'"'; + default: + throw new Error("illegal value type: "+typeof(v)); + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/util.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/util.js new file mode 100644 index 0000000..26715c1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/util.js @@ -0,0 +1,128 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 ProtoBuf = require("../../index.js"); + +/** + * Utility namespace. + * @exports pbjs/util + * @namespace + */ +var util = module.exports = {}; + +/** + * Extracts builder options with the specified prefix from a set of CLI options. + * @param {!Object.} options CLI options + * @param {string} prefix Prefix + * @returns {!Object.} + */ +util.getBuilderOptions = function(options, prefix) { + if (!options[prefix]) + return {}; + var builderOptions = {}; + options[prefix].forEach(function(kv) { + var key, val; + var p = kv.indexOf("="); + if (p < 0) { + key = kv; + val = true; + } else { + key = kv.substring(0, p); + val = kv.substring(p+1); + if (val === "true") + val = true; + else if (val === "false") + val = false; + else { + var intval = parseInt(val, 10); + if (intval == val) + val = intval; + } + } + builderOptions[key] = val; + }); + return builderOptions; +}; + +/** + * Pads a string to the specified length. + * @param {string} str String to pad + * @param {number} len Pad length + * @param {boolean=} left Whether to pad to the left, defaults to `false` + * @returns {string} + */ +util.pad = function(str, len, left) { + while (str.length < len) + left ? str = " "+str : str += " "; + return str; +}; + +/** + * Indents a string by the specified whitespace. + * @param {string} str String to indent + * @param {string|number} ws Whitespace string or number of whitespaces + * @returns {string} + */ +util.indent = function(str, ws) { + if (ws === 0 || ws === "") + return str; + var lines = str.split(/\r?\n/); + if (typeof ws === 'number') { + var n = ws; ws = ""; + while (ws.length < n) ws += " "; + } + for (var i=1; i} subject Subject to extend + * @param {!Object.} extension Extensions to apply + */ +util.extend = function(subject, extension) { + Object.keys(extension).forEach(function(key) { + subject[key] = extension[key]; + }); +}; + +/** + * Groups extensions by extended message. + * @param {!ProtoBuf.Reflect.Namespace} ns Namespace + * @returns {?Object.>} + */ +util.groupExtensions = function(ns) { + var exts = {}, + n = 0; + ns.getChildren(ProtoBuf.Reflect.Extension).forEach(function(ext) { + var msg = ext.field.parent, + fqn = msg.fqn(); + if (!exts[fqn]) + exts[fqn] = []; + exts[fqn].push(ext.field); + n++; + }); + return n > 0 ? exts : null; +}; + +/** + * Tests if the specified import name is referencing an internal descriptor. + * @param {string} name Import name + * @returns {boolean} + */ +util.isDescriptor = function(name) { + return /^google\/protobuf\/descriptor/.test(name); +}; \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Builder.Message.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Builder.Message.html new file mode 100644 index 0000000..c129b8e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Builder.Message.html @@ -0,0 +1,5815 @@ + + + + + JSDoc: Class: Message + + + + + + + + + + +

+ +

Class: Message

+ + + + + + +
+ +
+ +

+ ProtoBuf.Builder. + + Message +

+ +

Barebone of all runtime messages.

+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Message(values, …var_args)

+ + + + + +
+

Constructs a new runtime Message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
values + + +!Object.<string, *> +| + +string + + + + + + + + + +

Preset values

var_args + + +string + + + + + + + + + + <repeatable>
+ +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be created

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static) $options :Object.<string, *>

+ + + + +
+

Message options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, non-null) $type :ProtoBuf.Reflect.Message

+ + + + +
+

Reflection type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

$options :Object.<string, *>

+ + + + +
+

Message options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) $type :ProtoBuf.Reflect.Message

+ + + + +
+

Reflection type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buffer, lengthopt, encopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes a message from the specified buffer or string.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buffer + + +ByteBuffer +| + +ArrayBuffer +| + +Buffer +| + +string + + + + + + + + + +

Buffer to decode from

length + + +number +| + +string + + + + + + <optional>
+ + + + + +

Message length. Defaults to decode all the remainig data.

enc + + +string + + + + + + <optional>
+ + + + + +

Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded or if required fields are missing. The later still + returns the decoded message with missing fields in the decoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(static) decode64(str) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes the message from the specified base64 encoded string.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
str + + +string + + + +

String to decode from

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded or if required fields are missing. The later still + returns the decoded message with missing fields in the decoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(static) decodeDelimited(buffer, encopt) → {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes a varint32 length-delimited message from the specified buffer or string.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buffer + + +ByteBuffer +| + +ArrayBuffer +| + +Buffer +| + +string + + + + + + + + + +

Buffer to decode from

enc + + +string + + + + + + <optional>
+ + + + + +

Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded or if required fields are missing. The later still + returns the decoded message with missing fields in the decoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message or null if not enough bytes are available yet

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(static) decodeHex(str) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes the message from the specified hex encoded string.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
str + + +string + + + +

String to decode from

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded or if required fields are missing. The later still + returns the decoded message with missing fields in the decoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(static) decodeJSON(str) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes the message from a JSON string.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
str + + +string + + + +

String to decode from

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded or if required fields are +missing.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

$add(key, value, noAssertopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Adds a value to a repeated field. This is an alias for ProtoBuf.Builder.Message#add.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
key + + +string + + + + + + + + + +

Field name

value + + +* + + + + + + + + + +

Value to add

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to assert the value or not (asserts by default)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be added

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

$encode(bufferopt, noVerifyopt) → (non-null) {ByteBuffer}

+ + + + + +
+

Encodes the message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buffer + + +ByteBuffer +| + +boolean + + + + + + <optional>
+ + + + + +

ByteBuffer to encode to. Will create a new one and flip it if omitted.

noVerify + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not verify field values, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded ByteBuffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Encoded message as a ByteBuffer

+
+ + + +
+
+ Type +
+
+ +ByteBuffer + + +
+
+ + + + + + + + + + +

$get(key) → {*}

+ + + + + +
+

Gets a field's value. This is an alias for ProtoBuf.Builder.Message#$get.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
key + + +string + + + +

Key

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If there is no such field

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

$set(keyOrObj, valueopt, noAssertopt)

+ + + + + +
+

Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
keyOrObj + + +string +| + +!Object.<string, *> + + + + + + + + + +

String key or plain object holding multiple values

value + + +* +| + +boolean + + + + + + <optional>
+ + + + + +

Value to set if key is a string, otherwise omitted

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not assert the value, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

add(key, value, noAssertopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Adds a value to a repeated field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
key + + +string + + + + + + + + + +

Field name

value + + +* + + + + + + + + + +

Value to add

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to assert the value or not (asserts by default)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be added

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

calculate() → {number}

+ + + + + +
+

Calculates the byte length of the message.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be calculated or if required fields are missing.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Byte length

+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + +

encode64() → {string}

+ + + + + +
+

Directly encodes the message to a base64 encoded string.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the underlying buffer cannot be encoded or if required fields are missing. The later + still returns the encoded base64 string in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Base64 encoded string

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

encodeAB() → {ArrayBuffer}

+ + + + + +
+

Directly encodes the message to an ArrayBuffer.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded ArrayBuffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Encoded message as ArrayBuffer

+
+ + + +
+
+ Type +
+
+ +ArrayBuffer + + +
+
+ + + + + + + + + + +

encodeDelimited(bufferopt, noVerifyopt) → (non-null) {ByteBuffer}

+ + + + + +
+

Encodes the varint32 length-delimited message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buffer + + +ByteBuffer +| + +boolean + + + + + + <optional>
+ + + + + +

ByteBuffer to encode to. Will create a new one and flip it if omitted.

noVerify + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not verify field values, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded ByteBuffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Encoded message as a ByteBuffer

+
+ + + +
+
+ Type +
+
+ +ByteBuffer + + +
+
+ + + + + + + + + + +

encodeHex() → {string}

+ + + + + +
+

Directly encodes the message to a hex encoded string.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the underlying buffer cannot be encoded or if required fields are missing. The later + still returns the encoded hex string in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Hex encoded string

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

encodeJSON() → {string}

+ + + + + +
+

Encodes a message to JSON.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

JSON string

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

encodeNB() → (non-null) {Buffer}

+ + + + + +
+

Directly encodes the message to a node Buffer.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded, not running under node.js or if required fields are + missing. The later still returns the encoded node Buffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

get(key, noAssertopt) → {*}

+ + + + + +
+

Gets a field's value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
key + + +string + + + + + + + + + +

Key

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not assert for an actual field, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If there is no such field

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

(abstract) get[SomeField]() → {*}

+ + + + + +
+

Gets a value. This method is present for each field, but only if there is no name conflict with + another field.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

(abstract) get_[some_field]() → {*}

+ + + + + +
+

Gets a value. This method is present for each field, but only if there is no name conflict with + another field.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

set(keyOrObj, valueopt, noAssertopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Sets a field's value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
keyOrObj + + +string +| + +!Object.<string, *> + + + + + + + + + +

String key or plain object holding multiple values

value + + +* +| + +boolean + + + + + + <optional>
+ + + + + +

Value to set if key is a string, otherwise omitted

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not assert for an actual field / proper value type, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(abstract) set[SomeField](value, noAssertopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Sets a value. This method is present for each field, but only if there is no name conflict with + another field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
value + + +* + + + + + + + + + +

Value to set

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not assert the value, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(abstract) set_[some_field](value, noAssertopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Sets a value. This method is present for each field, but only if there is no name conflict with + another field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
value + + +* + + + + + + + + + +

Value to set

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not assert the value, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

toArrayBuffer() → {ArrayBuffer}

+ + + + + +
+

Returns the message as an ArrayBuffer. This is an alias for ProtoBuf.Builder.Message#encodeAB.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded ArrayBuffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Encoded message as ArrayBuffer

+
+ + + +
+
+ Type +
+
+ +ArrayBuffer + + +
+
+ + + + + + + + + + +

toBase64() → {string}

+ + + + + +
+

Returns the message as a base64 encoded string. This is an alias for ProtoBuf.Builder.Message#encode64.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded base64 string in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Base64 encoded string

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toBuffer() → (non-null) {Buffer}

+ + + + + +
+

Returns the message as a node Buffer. This is an alias for ProtoBuf.Builder.Message#encodeNB.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded node Buffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

toHex() → {string}

+ + + + + +
+

Returns the message as a hex encoded string. This is an alias for ProtoBuf.Builder.Message#encodeHex.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded hex string in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Hex encoded string

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toRaw(binaryAsBase64opt, longsAsStrings) → {Object.<string, *>}

+ + + + + +
+

Returns the message's raw payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
binaryAsBase64 + + +boolean + + + + + + <optional>
+ + + + + +

Whether to include binary data as base64 strings instead of Buffers, defaults to false

longsAsStrings + + +boolean + + + + + + + + + +

Whether to encode longs as strings

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Raw payload

+
+ + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

toString() → {string}

+ + + + + +
+

Returns a string representation of this Message.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation as of ".Fully.Qualified.MessageName"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Builder.Service.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Builder.Service.html new file mode 100644 index 0000000..85a5262 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Builder.Service.html @@ -0,0 +1,961 @@ + + + + + JSDoc: Class: Service + + + + + + + + + + +
+ +

Class: Service

+ + + + + + +
+ +
+ +

+ ProtoBuf.Builder. + + Service +

+ +

Barebone of all runtime services.

+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Service(rpcImplopt)

+ + + + + +
+

Constructs a new runtime Service.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
rpcImpl + + +function + + + + + + <optional>
+ + + + + +

RPC implementation receiving the method name and the message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the service cannot be created

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static) $options :Object.<string, *>

+ + + + +
+

Service options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, non-null) $type :ProtoBuf.Reflect.Service

+ + + + +
+

Reflection type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

$options :Object.<string, *>

+ + + + +
+

Service options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) $type :ProtoBuf.Reflect.Service

+ + + + +
+

Reflection type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) rpcImpl :function

+ + + + +
+

Service implementation.

+
+ + + +
Type:
+
    +
  • + +function + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(abstract, static) [Method](rpcImplnon-null, req, callback)

+ + + + + +
+

Asynchronously performs an RPC call using the given RPC implementation.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rpcImpl + + +function + + + +

RPC implementation

req + + +ProtoBuf.Builder.Message + + + +

Request

callback + + +function + + + +

Callback receiving + the error if any and the response either as a pre-parsed message or as its raw bytes

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(abstract) [Method](req, callback)

+ + + + + +
+

Asynchronously performs an RPC call using the instance's RPC implementation.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
req + + +ProtoBuf.Builder.Message + + + +

Request

callback + + +function + + + +

Callback receiving + the error if any and the response either as a pre-parsed message or as its raw bytes

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Builder.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Builder.html new file mode 100644 index 0000000..9a5a4ee --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Builder.html @@ -0,0 +1,2800 @@ + + + + + JSDoc: Class: Builder + + + + + + + + + + +
+ +

Class: Builder

+ + + + + + +
+ +
+ +

+ ProtoBuf. + + Builder +

+ +

Provides the functionality to build protocol messages.

+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Builder(optionsopt)

+ + + + + +
+

Constructs a new Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + +

Classes

+ +
+
Message
+
+ +
Service
+
+
+ + + + + + + +

Members

+ + + +

files :Array.<string>

+ + + + +
+

Imported files.

+
+ + + +
Type:
+
    +
  • + +Array.<string> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) importRoot :string

+ + + + +
+

Import root override.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

ns :ProtoBuf.Reflect.Namespace

+ + + + +
+

Namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

ptr :ProtoBuf.Reflect.T

+ + + + +
+

Namespace pointer.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolved :boolean

+ + + + +
+

Resolved flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

result :Object.<string, (ProtoBuf.Builder.Message|Object)>|null

+ + + + +
+

The current building result.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) isEnum(defnon-null) → {boolean}

+ + + + + +
+

Tests if a definition most likely describes an enum.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
def + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) isExtend(defnon-null) → {boolean}

+ + + + + +
+

Tests if a definition most likely describes an extended message

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
def + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) isMessage(defnon-null) → {boolean}

+ + + + + +
+

Tests if a definition most likely describes a message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
def + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) isMessageField(defnon-null) → {boolean}

+ + + + + +
+

Tests if a definition most likely describes a message field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
def + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) isService(defnon-null) → {boolean}

+ + + + + +
+

Tests if a definition most likely describes a service.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
def + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

"import"](json, filenameopt) → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Imports another definition into this builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
json + + +Object.<string, *> + + + + + + + + + +

Parsed import

filename + + +string +| + +Object + + + + + + <optional>
+ + + + + +

Imported file name

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the definition or file cannot be imported

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

build(pathopt) → {ProtoBuf.Builder.Message|!Object.<string, *>}

+ + + + + +
+

Builds the protocol. This will first try to resolve all definitions and, if this has been successful, +return the built package.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
path + + +string +| + +Array.<string> + + + + + + <optional>
+ + + + + +

Specifies what to return. If omitted, the entire namespace will be returned.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If a type could not be resolved

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message +| + +!Object.<string, *> + + +
+
+ + + + + + + + + + +

create(defsnon-null) → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Creates the specified definitions at the current pointer position.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
defs + + +Array.<!Object> + + + +

Messages, enums or services to create

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If a message definition is invalid

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

define(namespace) → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Defines a namespace on top of the current pointer position and places the pointer on it.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
namespace + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

lookup(pathopt, excludeNonNamespaceopt) → (nullable) {ProtoBuf.Reflect.T}

+ + + + + +
+

Similar to ProtoBuf.Builder#build, but looks up the internal reflection descriptor.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
path + + +string + + + + + + <optional>
+ + + + + +

Specifies what to return. If omitted, the entire namespace wiil be returned.

excludeNonNamespace + + +boolean + + + + + + <optional>
+ + + + + +

Excludes non-namespace types like fields, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Reflection descriptor or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.T + + +
+
+ + + + + + + + + + +

reset() → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Resets the pointer to the root namespace.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

resolveAll() → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Resolves all namespace objects.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If a type cannot be resolved

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

toString() → {string}

+ + + + + +
+

Returns a string representation of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation as of "Builder"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.DotProto.Parser.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.DotProto.Parser.html new file mode 100644 index 0000000..81cdf38 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.DotProto.Parser.html @@ -0,0 +1,729 @@ + + + + + JSDoc: Class: Parser + + + + + + + + + + +
+ +

Class: Parser

+ + + + + + +
+ +
+ +

+ ProtoBuf.DotProto. + + Parser +

+ +

prototype parser

+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Parser(source)

+ + + + + +
+

Constructs a new Parser.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
source + + +string + + + +

Source

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

proto3 :boolean

+ + + + +
+

Whether parsing proto3 or not.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) tn :ProtoBuf.DotProto.Tokenizer

+ + + + +
+

Tokenizer.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) parse() → (non-null) {Object}

+ + + + + +
+

Parses the specified source.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the source cannot be parsed

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

parse() → (non-null) {Object}

+ + + + + +
+

Parses the source.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the source cannot be parsed

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

toString() → {string}

+ + + + + +
+

Returns a string representation of this parser.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.DotProto.Tokenizer.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.DotProto.Tokenizer.html new file mode 100644 index 0000000..8ad8727 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.DotProto.Tokenizer.html @@ -0,0 +1,1140 @@ + + + + + JSDoc: Class: Tokenizer + + + + + + + + + + +
+ +

Class: Tokenizer

+ + + + + + +
+ +
+ +

+ ProtoBuf.DotProto. + + Tokenizer +

+ +

prototype tokenizer

+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Tokenizer(proto)

+ + + + + +
+

Constructs a new Tokenizer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
proto + + +string + + + +

Proto to tokenize

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

index :number

+ + + + +
+

Current index.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

line :number

+ + + + +
+

Current line.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

source :string

+ + + + +
+

Source to parse.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) stack :Array.<string>

+ + + + +
+

Token stack.

+
+ + + +
Type:
+
    +
  • + +Array.<string> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

next() → (nullable) {string}

+ + + + + +
+

Gets the next token and advances by one.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Token or null on EOF

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

omit(expected) → {boolean}

+ + + + + +
+

Omits an optional token.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
expected + + +string + + + +

Expected optional token

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

true if the token exists

+
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

peek() → (nullable) {string}

+ + + + + +
+

Peeks for the next token.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Token or null on EOF

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

skip(expected)

+ + + + + +
+

Skips a specific token and throws if it differs.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
expected + + +string + + + +

Expected token

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the actual token differs

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

toString() → {string}

+ + + + + +
+

Returns a string representation of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation as of "Tokenizer(index/length)"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.DotProto.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.DotProto.html new file mode 100644 index 0000000..744f956 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.DotProto.html @@ -0,0 +1,144 @@ + + + + + JSDoc: Namespace: DotProto + + + + + + + + + + +
+ +

Namespace: DotProto

+ + + + + + +
+ +
+ +

+ ProtoBuf. + + DotProto +

+ + +
+ +
+
+ + +

Utilities to parse .proto files.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + +

Classes

+ +
+
Parser
+
+ +
Tokenizer
+
+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Element.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Element.html new file mode 100644 index 0000000..24ef9bb --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Element.html @@ -0,0 +1,555 @@ + + + + + JSDoc: Class: Element + + + + + + + + + + +
+ +

Class: Element

+ + + + + +
+ +
+

+ ProtoBuf. + + Element +

+ +
+ +
+
+ + + + +
+

new Element(type, resolvedType, isMapKey, syntax)

+ + +
+
+ + +
+

Constructs a new Element implementation that checks and converts values for a +particular field type, as appropriate.

+

An Element represents a single value: either the value of a singular field, +or a value contained in one entry of a repeated field or map field. This +class does not implement these higher-level concepts; it only encapsulates +the low-level typechecking and conversion.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +Object + + + +

Resolved data type

resolvedType + + +ProtoBuf.Reflect.T +| + +null + + + +

Resolved type, if relevant +(e.g. submessage field).

isMapKey + + +boolean + + + +

Is this element a Map key? The value will be +converted to string form if so.

syntax + + +string + + + +

Syntax level of defining message type, e.g., +proto2 or proto3.

+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Members

+ +
+ +
+

isMapKey :boolean

+ + +
+
+ +
+

Element is a map key.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + +
+ + + +
+

resolvedType :ProtoBuf.Reflect.T|null

+ + +
+
+ +
+

Element type reference to submessage or enum definition, if needed.

+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + +
+ + + +
+

syntax :string

+ + +
+
+ +
+

Syntax level of defining message type, e.g., proto2 or proto3.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + +
+ + + +
+

type :Object

+ + +
+
+ +
+

Element type, as a string (e.g., int32).

+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + +
+ +
+ + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.0-alpha9 on Mon Jun 01 2015 01:15:14 GMT+0200 (Mitteleuropäische Sommerzeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Map.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Map.html new file mode 100644 index 0000000..bf81c46 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Map.html @@ -0,0 +1,561 @@ + + + + + JSDoc: Class: Map + + + + + + + + + + +
+ +

Class: Map

+ + + + + + +
+ +
+ +

+ ProtoBuf. + + Map +

+ + +
+ +
+
+ + + + + +

new Map(fieldnon-null, contentsopt)

+ + + + + +
+

Constructs a new Map. A Map is a container that is used to implement map +fields on message objects. It closely follows the ES6 Map API; however, +it is distinct because we do not want to depend on external polyfills or +on ES6 itself.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
field + + +ProtoBuf.Reflect.Field + + + + + + + + + +

Map field

contents + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Initial contents

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(non-null) field :ProtoBuf.Reflect.Field

+ + + + +
+

The field corresponding to this map.

+
+ + + +
Type:
+
    +
  • + +ProtoBuf.Reflect.Field + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) keyElem :ProtoBuf.Reflect.Element

+ + + + +
+

Element instance corresponding to key type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) map :Object.<string, {key: *, value: *}>

+ + + + +
+

Internal map: stores mapping of (string form of key) -> (key, value) +pair.

+

We provide map semantics for arbitrary key types, but we build on top +of an Object, which has only string keys. In order to avoid the need +to convert a string key back to its native type in many situations, +we store the native key value alongside the value. Thus, we only need +a one-way mapping from a key type to its string form that guarantees +uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1 +=== K2).

+
+ + + +
Type:
+
    +
  • + +Object.<string, {key: *, value: *}> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) valueElem :ProtoBuf.Reflect.Element

+ + + + +
+

Element instance corresponding to value type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Element.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Element.html new file mode 100644 index 0000000..b1ab780 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Element.html @@ -0,0 +1,846 @@ + + + + + JSDoc: Class: Element + + + + + + + + + + +
+ +

Class: Element

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Element +

+ + +
+ +
+
+ + + + + +

new Element(type, resolvedType, isMapKey, syntax, name)

+ + + + + +
+

Constructs a new Element implementation that checks and converts values for a +particular field type, as appropriate.

+

An Element represents a single value: either the value of a singular field, +or a value contained in one entry of a repeated field or map field. This +class does not implement these higher-level concepts; it only encapsulates +the low-level typechecking and conversion.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +Object + + + +

Resolved data type

resolvedType + + +ProtoBuf.Reflect.T +| + +null + + + +

Resolved type, if relevant +(e.g. submessage field).

isMapKey + + +boolean + + + +

Is this element a Map key? The value will be +converted to string form if so.

syntax + + +string + + + +

Syntax level of defining message type, e.g., +proto2 or proto3.

name + + +string + + + +

Name of the field containing this element (for error +messages)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

isMapKey :boolean

+ + + + +
+

Element is a map key.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Name of the field containing this element (for error messages)

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolvedType :ProtoBuf.Reflect.T|null

+ + + + +
+

Element type reference to submessage or enum definition, if needed.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

syntax :string

+ + + + +
+

Syntax level of defining message type, e.g., proto2 or proto3.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

type :Object

+ + + + +
+

Element type, as a string (e.g., int32).

+
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) defaultFieldValue(type) → {*}

+ + + + + +
+

Returns the default value for this field in proto3.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string +| + +Object + + + +

the field type

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Default value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.Value.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.Value.html new file mode 100644 index 0000000..a88498f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.Value.html @@ -0,0 +1,1066 @@ + + + + + JSDoc: Class: Value + + + + + + + + + + +
+ +

Class: Value

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Enum. + + Value +

+ + +
+ +
+
+ + + + + +

new Value(buildernon-null, enmnon-null, name, id)

+ + + + + +
+

Constructs a new Enum Value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
builder + + +ProtoBuf.Builder + + + +

Builder reference

enm + + +ProtoBuf.Reflect.Enum + + + +

Enum reference

name + + +string + + + +

Field name

id + + +number + + + +

Unique field id

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

id :number

+ + + + +
+

Unique enum value id.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.html new file mode 100644 index 0000000..366a0ab --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.html @@ -0,0 +1,2722 @@ + + + + + JSDoc: Class: Enum + + + + + + + + + + +
+ +

Class: Enum

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Enum +

+ + +
+ +
+
+ + + + + +

new Enum(buildernon-null, parentnon-null, name, optionsopt, syntaxnullable)

+ + + + + +
+

Constructs a new Enum.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

parent + + +ProtoBuf.Reflect.T + + + + + + + + + +

Parent Reflect object

name + + +string + + + + + + + + + +

Enum name

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Enum options

syntax + + +string + + + + + + + + <nullable>
+ + + +

The syntax level (e.g., proto3)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + +

Classes

+ +
+
Value
+
+
+ + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) children :Array.<ProtoBuf.Reflect.T>

+ + + + +
+

Children inside the namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

object :Object.<string, number>|null

+ + + + +
+

Runtime enum object.

+
+ + + +
Type:
+
    +
  • + +Object.<string, number> +| + +null + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) syntax :string

+ + + + +
+

Syntax level (e.g., proto2 or proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) getName(enmnon-null, value) → (nullable) {string}

+ + + + + +
+

Gets the string name of an enum value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
enm + + +ProtoBuf.Builder.Enum + + + +

Runtime enum

value + + +number + + + +

Enum value

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Name or null if not present

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

addChild(child)

+ + + + + +
+

Adds a child to the namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
child + + +ProtoBuf.Reflect.T + + + +

Child

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the child cannot be added (duplicate)

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

build(rebuild) → (non-null) {Object.<string, number>}

+ + + + + +
+

Builds this enum and returns the runtime counterpart.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rebuild + + +boolean + + + +

Whether to rebuild or not, defaults to false

+ + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, number> + + +
+
+ + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the namespace's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

getChild(nameOrId) → (nullable) {ProtoBuf.Reflect.T}

+ + + + + +
+

Gets a child by its name or id.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nameOrId + + +string +| + +number + + + +

Child name or id

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The child or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.T + + +
+
+ + + + + + + + + + +

getChildren(typeopt) → {Array.<ProtoBuf.Reflect.T>}

+ + + + + +
+

Returns an array of the namespace's children.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
type + + +ProtoBuf.Reflect.T + + + + + + <optional>
+ + + + + +

Filter type (returns instances of this type only). Defaults to null (all children).

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<ProtoBuf.Reflect.T> + + +
+
+ + + + + + + + + + +

getOption(nameopt) → {*|Object.<string, *>}

+ + + + + +
+

Gets the value assigned to the option with the specified name.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
name + + +string + + + + + + <optional>
+ + + + + +

Returns the option value if specified, otherwise all options are returned.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

null} Option value or NULL if there is no such option

+
+ + + +
+
+ Type +
+
+ +* +| + +Object.<string, *> + + +
+
+ + + + + + + + + + +

qn(tnon-null) → {string}

+ + + + + +
+

Determines the shortest qualified name of the specified type, if any, relative to this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
t + + +ProtoBuf.Reflect.T + + + +

Reflection type

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The shortest qualified name or, if there is none, the fqn

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

resolve(qn, excludeNonNamespaceopt) → (nullable) {ProtoBuf.Reflect.Namespace}

+ + + + + +
+

Resolves a reflect object inside of this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
qn + + +string +| + +!Array.<string> + + + + + + + + + +

Qualified name to resolve

excludeNonNamespace + + +boolean + + + + + + <optional>
+ + + + + +

Excludes non-namespace types, defaults to false

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The resolved type or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.Namespace + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Extension.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Extension.html new file mode 100644 index 0000000..29afcb1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Extension.html @@ -0,0 +1,360 @@ + + + + + JSDoc: Class: Extension + + + + + + + + + + +
+ +

Class: Extension

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Extension +

+ + +
+ +
+
+ + + + + +

new Extension(buildernon-null, parentnon-null, name, fieldnon-null)

+ + + + + +
+

An extension (field).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
builder + + +ProtoBuf.Builder + + + +

Builder reference

parent + + +ProtoBuf.Reflect.T + + + +

Parent object

name + + +string + + + +

Object name

field + + +ProtoBuf.Reflect.Message.Field + + + +

Extension field

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(non-null) field :ProtoBuf.Reflect.Message.Field

+ + + + +
+

Extended message field.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.ExtensionField.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.ExtensionField.html new file mode 100644 index 0000000..259cc9c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.ExtensionField.html @@ -0,0 +1,3376 @@ + + + + + JSDoc: Class: ExtensionField + + + + + + + + + + +
+ +

Class: ExtensionField

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Message. + + ExtensionField +

+ + +
+ +
+
+ + + + + +

new ExtensionField(buildernon-null, messagenon-null, rule, type, name, id, optionsopt, non-null)

+ + + + + +
+

Constructs a new Message ExtensionField.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

message + + +ProtoBuf.Reflect.Message + + + + + + + + + +

Message reference

rule + + +string + + + + + + + + + +

Rule, one of requried, optional, repeated

type + + +string + + + + + + + + + +

Data type, e.g. int32

name + + +string + + + + + + + + + +

Field name

id + + +number + + + + + + + + + +

Unique field id

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

defaultValue :*

+ + + + +
+

Default value.

+
+ + + +
Type:
+
    +
  • + +* + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

element :ProtoBuf.Element

+ + + + +
+

Element implementation. Created in build() after types are resolved.

+
+ + + +
Type:
+
    +
  • + +ProtoBuf.Element + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) extension :ProtoBuf.Reflect.Extension

+ + + + +
+

Extension reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

id :number

+ + + + +
+

Unique message field id.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

keyElement :ProtoBuf.Element

+ + + + +
+

Key element implementation, for map fields. Created in build() after +types are resolved.

+
+ + + +
Type:
+
    +
  • + +ProtoBuf.Element + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

keyType :string|Object|null

+ + + + +
+

Message field key type. Type reference string if unresolved, protobuf +type if resolved. Valid only if this.map === true, null otherwise.

+
+ + + +
Type:
+
    +
  • + +string +| + +Object +| + +null + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

map :boolean

+ + + + +
+

Message field map flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) oneof :ProtoBuf.Reflect.Message.OneOf

+ + + + +
+

Enclosing OneOf.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Message field options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

originalName :string

+ + + + +
+

Original field name.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

repeated :boolean

+ + + + +
+

Message field repeated flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

required :boolean

+ + + + +
+

Message field required flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolvedType :ProtoBuf.Reflect.T|null

+ + + + +
+

Resolved type reference inside the global namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

syntax :string

+ + + + +
+

Syntax level of this definition (e.g., proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

type :string|Object

+ + + + +
+

Message field type. Type reference string if unresolved, protobuf type if +resolved. In a map field, this is the value type.

+
+ + + +
Type:
+
    +
  • + +string +| + +Object + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

calculate(value, messagenon-null) → {number}

+ + + + + +
+

Calculates the length of this field's value on the network level.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Field value

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Byte length

+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + +

decode(wireType, buffer, skipRepeatedopt) → {*}

+ + + + + +
+

Decode the field value from the specified buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
wireType + + +number + + + + + + + + + +

Leading wire type

buffer + + +ByteBuffer + + + + + + + + + +

ByteBuffer to decode from

skipRepeated + + +boolean + + + + + + <optional>
+ + + + + +

Whether to skip the repeated check or not. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the field cannot be decoded

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded value: array for packed repeated fields, [key, value] for + map fields, or an individual value otherwise.

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

encode(value, buffer, messagenon-null) → {ByteBuffer}

+ + + + + +
+

Encodes the specified field value to the specified buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Verified field value

buffer + + +ByteBuffer + + + +

ByteBuffer to encode to

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the field cannot be encoded

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

The ByteBuffer for chaining

+
+ + + +
+
+ Type +
+
+ +ByteBuffer + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

hasWirePresence(value, messagenon-null) → {boolean}

+ + + + + +
+

Determines whether the field will have a presence on the wire given its +value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Verified field value

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Whether the field will be present on the wire

+
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + +

verifyValue(value, skipRepeatedopt) → {*}

+ + + + + +
+

Checks if the given value can be set for this field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
value + + +* + + + + + + + + + +

Value to check

skipRepeated + + +boolean + + + + + + <optional>
+ + + + + +

Whether to skip the repeated value check or not. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set for this field

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Verified, maybe adjusted, value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.Field.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.Field.html new file mode 100644 index 0000000..f9c678b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.Field.html @@ -0,0 +1,3308 @@ + + + + + JSDoc: Class: Field + + + + + + + + + + +
+ +

Class: Field

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Message. + + Field +

+ + +
+ +
+
+ + + + + +

new Field(buildernon-null, messagenon-null, rule, keytypenullable, type, name, id, optionsopt, oneofopt, non-null, syntaxnullable)

+ + + + + +
+

Constructs a new Message Field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

message + + +ProtoBuf.Reflect.Message + + + + + + + + + +

Message reference

rule + + +string + + + + + + + + + +

Rule, one of requried, optional, repeated

keytype + + +string + + + + + + + + <nullable>
+ + + +

Key data type, if any.

type + + +string + + + + + + + + + +

Data type, e.g. int32

name + + +string + + + + + + + + + +

Field name

id + + +number + + + + + + + + + +

Unique field id

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

oneof + + +ProtoBuf.Reflect.Message.OneOf + + + + + + <optional>
+ + + + + +

Enclosing OneOf

syntax + + +string + + + + + + + + <nullable>
+ + + +

The syntax level of this definition (e.g., proto3)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

defaultValue :*

+ + + + +
+

Default value.

+
+ + + +
Type:
+
    +
  • + +* + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

element :ProtoBuf.Element

+ + + + +
+

Element implementation. Created in build() after types are resolved.

+
+ + + +
Type:
+
    +
  • + +ProtoBuf.Element + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

id :number

+ + + + +
+

Unique message field id.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

keyElement :ProtoBuf.Element

+ + + + +
+

Key element implementation, for map fields. Created in build() after +types are resolved.

+
+ + + +
Type:
+
    +
  • + +ProtoBuf.Element + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

keyType :string|Object|null

+ + + + +
+

Message field key type. Type reference string if unresolved, protobuf +type if resolved. Valid only if this.map === true, null otherwise.

+
+ + + +
Type:
+
    +
  • + +string +| + +Object +| + +null + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

map :boolean

+ + + + +
+

Message field map flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) oneof :ProtoBuf.Reflect.Message.OneOf

+ + + + +
+

Enclosing OneOf.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Message field options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

originalName :string

+ + + + +
+

Original field name.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

repeated :boolean

+ + + + +
+

Message field repeated flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

required :boolean

+ + + + +
+

Message field required flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolvedType :ProtoBuf.Reflect.T|null

+ + + + +
+

Resolved type reference inside the global namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

syntax :string

+ + + + +
+

Syntax level of this definition (e.g., proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

type :string|Object

+ + + + +
+

Message field type. Type reference string if unresolved, protobuf type if +resolved. In a map field, this is the value type.

+
+ + + +
Type:
+
    +
  • + +string +| + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

calculate(value, messagenon-null) → {number}

+ + + + + +
+

Calculates the length of this field's value on the network level.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Field value

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Byte length

+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + +

decode(wireType, buffer, skipRepeatedopt) → {*}

+ + + + + +
+

Decode the field value from the specified buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
wireType + + +number + + + + + + + + + +

Leading wire type

buffer + + +ByteBuffer + + + + + + + + + +

ByteBuffer to decode from

skipRepeated + + +boolean + + + + + + <optional>
+ + + + + +

Whether to skip the repeated check or not. Defaults to false.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the field cannot be decoded

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded value: array for packed repeated fields, [key, value] for + map fields, or an individual value otherwise.

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

encode(value, buffer, messagenon-null) → {ByteBuffer}

+ + + + + +
+

Encodes the specified field value to the specified buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Verified field value

buffer + + +ByteBuffer + + + +

ByteBuffer to encode to

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the field cannot be encoded

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

The ByteBuffer for chaining

+
+ + + +
+
+ Type +
+
+ +ByteBuffer + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

hasWirePresence(value, messagenon-null) → {boolean}

+ + + + + +
+

Determines whether the field will have a presence on the wire given its +value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Verified field value

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Whether the field will be present on the wire

+
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + +

verifyValue(value, skipRepeatedopt) → {*}

+ + + + + +
+

Checks if the given value can be set for this field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
value + + +* + + + + + + + + + +

Value to check

skipRepeated + + +boolean + + + + + + <optional>
+ + + + + +

Whether to skip the repeated value check or not. Defaults to false.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set for this field

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Verified, maybe adjusted, value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.OneOf.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.OneOf.html new file mode 100644 index 0000000..9c8d042 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.OneOf.html @@ -0,0 +1,1043 @@ + + + + + JSDoc: Class: OneOf + + + + + + + + + + +
+ +

Class: OneOf

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Message. + + OneOf +

+ + +
+ +
+
+ + + + + +

new OneOf(buildernon-null, messagenon-null, name)

+ + + + + +
+

Constructs a new Message OneOf.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
builder + + +ProtoBuf.Builder + + + +

Builder reference

message + + +ProtoBuf.Reflect.Message + + + +

Message reference

name + + +string + + + +

OneOf name

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) fields :Array.<!ProtoBuf.Reflect.Message.Field>

+ + + + +
+

Enclosed fields.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.html new file mode 100644 index 0000000..48292bc --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.html @@ -0,0 +1,3477 @@ + + + + + JSDoc: Class: Message + + + + + + + + + + +
+ +

Class: Message

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Message +

+ + +
+ +
+
+ + + + + +

new Message(buildernon-null, parentnon-null, name, optionsopt, isGroupopt, syntaxnullable)

+ + + + + +
+

Constructs a new Message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

parent + + +ProtoBuf.Reflect.Namespace + + + + + + + + + +

Parent message or namespace

name + + +string + + + + + + + + + +

Message name

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Message options

isGroup + + +boolean + + + + + + <optional>
+ + + + + +

true if this is a legacy group

syntax + + +string + + + + + + + + <nullable>
+ + + +

The syntax level of this definition (e.g., proto3)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + +

Classes

+ +
+
ExtensionField
+
+ +
Field
+
+ +
OneOf
+
+
+ + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) children :Array.<ProtoBuf.Reflect.T>

+ + + + +
+

Children inside the namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) clazz :function

+ + + + +
+

Runtime message class.

+
+ + + +
Type:
+
    +
  • + +function + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

extensions :!Array.<number>|undefined

+ + + + +
+

Extensions range.

+
+ + + +
Type:
+
    +
  • + +!Array.<number> +| + +undefined + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

isGroup :boolean

+ + + + +
+

Whether this is a legacy group or not.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) syntax :string

+ + + + +
+

Syntax level (e.g., proto2 or proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

addChild(child)

+ + + + + +
+

Adds a child to the namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
child + + +ProtoBuf.Reflect.T + + + +

Child

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the child cannot be added (duplicate)

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

build(rebuildopt) → {ProtoBuf.Reflect.Message}

+ + + + + +
+

Builds the message and returns the runtime counterpart, which is a fully functional class.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
rebuild + + +boolean + + + + + + <optional>
+ + + + + +

Whether to rebuild or not, defaults to false

+ + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be built

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Message class

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.Message + + +
+
+ + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the namespace's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

calculate(messagenon-null) → {number}

+ + + + + +
+

Calculates a runtime message's byte length.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
message + + +ProtoBuf.Builder.Message + + + +

Runtime message to encode

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If required fields are missing or the message cannot be calculated for another reason

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Byte length

+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + +

decode(buffer, lengthopt, expectedGroupEndIdopt) → {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes an encoded message and returns the decoded message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buffer + + +ByteBuffer + + + + + + + + + +

ByteBuffer to decode from

length + + +number + + + + + + <optional>
+ + + + + +

Message length. Defaults to decode all remaining data.

expectedGroupEndId + + +number + + + + + + <optional>
+ + + + + +

Expected GROUPEND id if this is a legacy group

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

encode(messagenon-null, buffer, noVerifyopt) → {ByteBuffer}

+ + + + + +
+

Encodes a runtime message's contents to the specified buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
message + + +ProtoBuf.Builder.Message + + + + + + + + + +

Runtime message to encode

buffer + + +ByteBuffer + + + + + + + + + +

ByteBuffer to write to

noVerify + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not verify field values, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If required fields are missing or the message cannot be encoded for another reason

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

The ByteBuffer for chaining

+
+ + + +
+
+ Type +
+
+ +ByteBuffer + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

getChild(nameOrId) → (nullable) {ProtoBuf.Reflect.T}

+ + + + + +
+

Gets a child by its name or id.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nameOrId + + +string +| + +number + + + +

Child name or id

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The child or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.T + + +
+
+ + + + + + + + + + +

getChildren(typeopt) → {Array.<ProtoBuf.Reflect.T>}

+ + + + + +
+

Returns an array of the namespace's children.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
type + + +ProtoBuf.Reflect.T + + + + + + <optional>
+ + + + + +

Filter type (returns instances of this type only). Defaults to null (all children).

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<ProtoBuf.Reflect.T> + + +
+
+ + + + + + + + + + +

getOption(nameopt) → {*|Object.<string, *>}

+ + + + + +
+

Gets the value assigned to the option with the specified name.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
name + + +string + + + + + + <optional>
+ + + + + +

Returns the option value if specified, otherwise all options are returned.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

null} Option value or NULL if there is no such option

+
+ + + +
+
+ Type +
+
+ +* +| + +Object.<string, *> + + +
+
+ + + + + + + + + + +

qn(tnon-null) → {string}

+ + + + + +
+

Determines the shortest qualified name of the specified type, if any, relative to this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
t + + +ProtoBuf.Reflect.T + + + +

Reflection type

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The shortest qualified name or, if there is none, the fqn

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

resolve(qn, excludeNonNamespaceopt) → (nullable) {ProtoBuf.Reflect.Namespace}

+ + + + + +
+

Resolves a reflect object inside of this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
qn + + +string +| + +!Array.<string> + + + + + + + + + +

Qualified name to resolve

excludeNonNamespace + + +boolean + + + + + + <optional>
+ + + + + +

Excludes non-namespace types, defaults to false

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The resolved type or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.Namespace + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Namespace.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Namespace.html new file mode 100644 index 0000000..6fce414 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Namespace.html @@ -0,0 +1,2371 @@ + + + + + JSDoc: Class: Namespace + + + + + + + + + + +
+ +

Class: Namespace

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Namespace +

+ + +
+ +
+
+ + + + + +

new Namespace(buildernon-null, parentnullable, name, optionsopt, syntaxnullable)

+ + + + + +
+

Constructs a new Namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

parent + + +ProtoBuf.Reflect.Namespace + + + + + + + + <nullable>
+ + + +

Namespace parent

name + + +string + + + + + + + + + +

Namespace name

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Namespace options

syntax + + +string + + + + + + + + <nullable>
+ + + +

The syntax level of this definition (e.g., proto3)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) children :Array.<ProtoBuf.Reflect.T>

+ + + + +
+

Children inside the namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) syntax :string

+ + + + +
+

Syntax level (e.g., proto2 or proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

addChild(child)

+ + + + + +
+

Adds a child to the namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
child + + +ProtoBuf.Reflect.T + + + +

Child

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the child cannot be added (duplicate)

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

build() → {Object.<string, (function()|Object)>}

+ + + + + +
+

Builds the namespace and returns the runtime counterpart.

+
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Runtime namespace

+
+ + + +
+
+ Type +
+
+ +Object.<string, (function()|Object)> + + +
+
+ + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the namespace's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

getChild(nameOrId) → (nullable) {ProtoBuf.Reflect.T}

+ + + + + +
+

Gets a child by its name or id.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nameOrId + + +string +| + +number + + + +

Child name or id

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The child or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.T + + +
+
+ + + + + + + + + + +

getChildren(typeopt) → {Array.<ProtoBuf.Reflect.T>}

+ + + + + +
+

Returns an array of the namespace's children.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
type + + +ProtoBuf.Reflect.T + + + + + + <optional>
+ + + + + +

Filter type (returns instances of this type only). Defaults to null (all children).

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<ProtoBuf.Reflect.T> + + +
+
+ + + + + + + + + + +

getOption(nameopt) → {*|Object.<string, *>}

+ + + + + +
+

Gets the value assigned to the option with the specified name.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
name + + +string + + + + + + <optional>
+ + + + + +

Returns the option value if specified, otherwise all options are returned.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

null} Option value or NULL if there is no such option

+
+ + + +
+
+ Type +
+
+ +* +| + +Object.<string, *> + + +
+
+ + + + + + + + + + +

qn(tnon-null) → {string}

+ + + + + +
+

Determines the shortest qualified name of the specified type, if any, relative to this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
t + + +ProtoBuf.Reflect.T + + + +

Reflection type

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The shortest qualified name or, if there is none, the fqn

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

resolve(qn, excludeNonNamespaceopt) → (nullable) {ProtoBuf.Reflect.Namespace}

+ + + + + +
+

Resolves a reflect object inside of this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
qn + + +string +| + +!Array.<string> + + + + + + + + + +

Qualified name to resolve

excludeNonNamespace + + +boolean + + + + + + <optional>
+ + + + + +

Excludes non-namespace types, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The resolved type or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.Namespace + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.Method.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.Method.html new file mode 100644 index 0000000..72a5ed3 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.Method.html @@ -0,0 +1,1202 @@ + + + + + JSDoc: Class: Method + + + + + + + + + + +
+ +

Class: Method

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Service. + + Method +

+ + +
+ +
+
+ + + + + +

new Method(buildernon-null, svcnon-null, name, optionsopt)

+ + + + + +
+

Abstract service method.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

svc + + +ProtoBuf.Reflect.Service + + + + + + + + + +

Service

name + + +string + + + + + + + + + +

Method name

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the method's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.RPCMethod.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.RPCMethod.html new file mode 100644 index 0000000..e58dc69 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.RPCMethod.html @@ -0,0 +1,1768 @@ + + + + + JSDoc: Class: RPCMethod + + + + + + + + + + +
+ +

Class: RPCMethod

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Service. + + RPCMethod +

+ + +
+ +
+
+ + + + + +

new RPCMethod(buildernon-null, svcnon-null, name, request, response, request_stream, response_stream, optionsopt)

+ + + + + +
+

RPC service method.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

svc + + +ProtoBuf.Reflect.Service + + + + + + + + + +

Service

name + + +string + + + + + + + + + +

Method name

request + + +string + + + + + + + + + +

Request message name

response + + +string + + + + + + + + + +

Response message name

request_stream + + +boolean + + + + + + + + + +

Whether requests are streamed

response_stream + + +boolean + + + + + + + + + +

Whether responses are streamed

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

requestName :string

+ + + + +
+

Request message name.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

requestStream :bool

+ + + + +
+

Whether requests are streamed

+
+ + + +
Type:
+
    +
  • + +bool + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolvedRequestType :ProtoBuf.Reflect.Message

+ + + + +
+

Resolved request message type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolvedResponseType :ProtoBuf.Reflect.Message

+ + + + +
+

Resolved response message type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

responseName :string

+ + + + +
+

Response message name.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

responseStream :bool

+ + + + +
+

Whether responses are streamed

+
+ + + +
Type:
+
    +
  • + +bool + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the method's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.html new file mode 100644 index 0000000..8cb30c6 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.html @@ -0,0 +1,2565 @@ + + + + + JSDoc: Class: Service + + + + + + + + + + +
+ +

Class: Service

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Service +

+ + +
+ +
+
+ + + + + +

new Service(buildernon-null, rootnon-null, name, optionsopt)

+ + + + + +
+

Constructs a new Service.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

root + + +ProtoBuf.Reflect.Namespace + + + + + + + + + +

Root

name + + +string + + + + + + + + + +

Service name

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + +

Classes

+ +
+
Method
+
+ +
RPCMethod
+
+
+ + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) children :Array.<ProtoBuf.Reflect.T>

+ + + + +
+

Children inside the namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) clazz :function

+ + + + +
+

Built runtime service class.

+
+ + + +
Type:
+
    +
  • + +function + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) syntax :string

+ + + + +
+

Syntax level (e.g., proto2 or proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

addChild(child)

+ + + + + +
+

Adds a child to the namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
child + + +ProtoBuf.Reflect.T + + + +

Child

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the child cannot be added (duplicate)

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

build(rebuildopt) → {function}

+ + + + + +
+

Builds the service and returns the runtime counterpart, which is a fully functional class.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
rebuild + + +boolean + + + + + + <optional>
+ + + + + +

Whether to rebuild or not

+ + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be built

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Service class

+
+ + + +
+
+ Type +
+
+ +function + + +
+
+ + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the namespace's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

getChild(nameOrId) → (nullable) {ProtoBuf.Reflect.T}

+ + + + + +
+

Gets a child by its name or id.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nameOrId + + +string +| + +number + + + +

Child name or id

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The child or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.T + + +
+
+ + + + + + + + + + +

getChildren(typeopt) → {Array.<ProtoBuf.Reflect.T>}

+ + + + + +
+

Returns an array of the namespace's children.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
type + + +ProtoBuf.Reflect.T + + + + + + <optional>
+ + + + + +

Filter type (returns instances of this type only). Defaults to null (all children).

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<ProtoBuf.Reflect.T> + + +
+
+ + + + + + + + + + +

getOption(nameopt) → {*|Object.<string, *>}

+ + + + + +
+

Gets the value assigned to the option with the specified name.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
name + + +string + + + + + + <optional>
+ + + + + +

Returns the option value if specified, otherwise all options are returned.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

null} Option value or NULL if there is no such option

+
+ + + +
+
+ Type +
+
+ +* +| + +Object.<string, *> + + +
+
+ + + + + + + + + + +

qn(tnon-null) → {string}

+ + + + + +
+

Determines the shortest qualified name of the specified type, if any, relative to this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
t + + +ProtoBuf.Reflect.T + + + +

Reflection type

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The shortest qualified name or, if there is none, the fqn

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

resolve(qn, excludeNonNamespaceopt) → (nullable) {ProtoBuf.Reflect.Namespace}

+ + + + + +
+

Resolves a reflect object inside of this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
qn + + +string +| + +!Array.<string> + + + + + + + + + +

Qualified name to resolve

excludeNonNamespace + + +boolean + + + + + + <optional>
+ + + + + +

Excludes non-namespace types, defaults to false

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The resolved type or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.Namespace + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.T.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.T.html new file mode 100644 index 0000000..bf94703 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.T.html @@ -0,0 +1,953 @@ + + + + + JSDoc: Class: T + + + + + + + + + + +
+ +

Class: T

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + T +

+ + +
+ +
+
+ + + + + +

(abstract) new T(buildernon-null, parentnullable, name)

+ + + + + +
+

Constructs a Reflect base class.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

parent + + +ProtoBuf.Reflect.T + + + + + + + + <nullable>
+ + + +

Parent object

name + + +string + + + + + + + + + +

Object name

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.html new file mode 100644 index 0000000..7bc4751 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Reflect.html @@ -0,0 +1,159 @@ + + + + + JSDoc: Namespace: Reflect + + + + + + + + + + +
+ +

Namespace: Reflect

+ + + + + + +
+ +
+ +

+ ProtoBuf. + + Reflect +

+ + +
+ + + +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Util.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Util.html new file mode 100644 index 0000000..46a958c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.Util.html @@ -0,0 +1,692 @@ + + + + + JSDoc: Namespace: Util + + + + + + + + + + +
+ +

Namespace: Util

+ + + + + + +
+ +
+ +

+ ProtoBuf. + + Util +

+ + +
+ +
+
+ + +

ProtoBuf utilities.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static, constant) IS_NODE :boolean

+ + + + +
+

Flag if running in node or not.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) fetch(path, callbackopt) → {string|undefined}

+ + + + + +
+

Fetches a resource.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
path + + +string + + + + + + + + + +

Resource path

callback + + +function + + + + + + <optional>
+ + + + + +

Callback receiving the resource's contents. If omitted the resource will + be fetched synchronously. If the request failed, contents will be null.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resource contents if callback is omitted (null if the request failed), else undefined.

+
+ + + +
+
+ Type +
+
+ +string +| + +undefined + + +
+
+ + + + + + + + + + +

(static) toCamelCase(str) → {string}

+ + + + + +
+

Converts a string to camel case.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
str + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

(static) XHR() → {XMLHttpRequest}

+ + + + + +
+

Constructs a XMLHttpRequest object.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If XMLHttpRequest is not supported

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +XMLHttpRequest + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.html new file mode 100644 index 0000000..855809c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.html @@ -0,0 +1,3209 @@ + + + + + JSDoc: Namespace: ProtoBuf + + + + + + + + + + +
+ +

Namespace: ProtoBuf

+ + + + + + +
+ +
+ +

+ ProtoBuf +

+ + +
+ +
+
+ + +

The ProtoBuf namespace.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + +

Classes

+ +
+
Builder
+
+ +
Map
+
+
+ + + + + +

Namespaces

+ +
+
DotProto
+
+ +
Reflect
+
+ +
Util
+
+
+ + + +

Members

+ + + +

(static, non-null) ByteBuffer :function

+ + + + + + +
Type:
+
    +
  • + +function + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) convertFieldsToCamelCase :boolean

+ + + + +
+

If set to true, field names will be converted from underscore notation to camel case. Defaults to false. + Must be set prior to parsing.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) ID_MAX :number

+ + + + +
+

Maximum field id.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) ID_MIN :number

+ + + + +
+

Minimum field id.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, non-null) Lang :Object.<string, !RegExp>

+ + + + +
+

Language expressions.

+
+ + + +
Type:
+
    +
  • + +Object.<string, !RegExp> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, nullable) Long :function

+ + + + + + +
Type:
+
    +
  • + +function + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant, non-null) MAP_KEY_TYPES :Array.<!Object.<string, {name: string, wireType: number, defaultValue: *}>>

+ + + + +
+

Valid map key types.

+
+ + + +
Type:
+
    +
  • + +Array.<!Object.<string, {name: string, wireType: number, defaultValue: *}>> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant, non-null) PACKABLE_WIRE_TYPES :Array.<number>

+ + + + +
+

Packable wire types.

+
+ + + +
Type:
+
    +
  • + +Array.<number> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) populateAccessors :boolean

+ + + + +
+

By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by + setting this to false prior to building messages.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) populateDefaults :boolean

+ + + + +
+

By default, messages are populated with default values if a field is not present on the wire. To disable + this behavior, set this setting to false.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant, non-null) TYPES :Object.<string, {name: string, wireType: number, defaultValue: *}>

+ + + + +
+

Types.

+
+ + + +
Type:
+
    +
  • + +Object.<string, {name: string, wireType: number, defaultValue: *}> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) VERSION :string

+ + + + +
+

ProtoBuf.js version.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES :Object.<string, number>

+ + + + +
+

Wire types.

+
+ + + +
Type:
+
    +
  • + +Object.<string, number> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES.BITS32 :number

+ + + + +
+

Fixed 32 bits wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES.BITS64 :number

+ + + + +
+

Fixed 64 bits wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES.ENDGROUP :number

+ + + + +
+

End group wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES.LDELIM :number

+ + + + +
+

Length delimited wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES.STARTGROUP :number

+ + + + +
+

Start group wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) WIRE_TYPES.VARINT :number

+ + + + +
+

Varint wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) loadJson(json, builderopt, filenameopt) → {ProtoBuf.Builder}

+ + + + + +
+

Loads a .json definition and returns the Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
json + + +* +| + +string + + + + + + + + + +

JSON definition

builder + + +ProtoBuf.Builder +| + +string +| + +Object + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

filename + + +string +| + +Object + + + + + + <optional>
+ + + + + +

The corresponding file name if known. Must be specified for imports.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the definition cannot be parsed or built

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Builder to create new messages

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

(static) loadJsonFile(filename, callbackopt, builderopt) → {ProtoBuf.Builder|undefined}

+ + + + + +
+

Loads a .json file and returns the Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
filename + + +string +| + +Object + + + + + + + + + +

Path to json file or an object specifying 'file' with + an overridden 'root' path for all imported files.

callback + + +function + + + + + + <optional>
+ + + + + +

Callback that will receive null as the first and + the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + file will be read synchronously and this function will return the Builder.

builder + + +ProtoBuf.Builder + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The Builder if synchronous (no callback specified, will be NULL if the + request has failed), else undefined

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder +| + +undefined + + +
+
+ + + + + + + + + + +

(static) loadProto(proto, builderopt, filenameopt) → {ProtoBuf.Builder}

+ + + + + +
+

Loads a .proto string and returns the Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
proto + + +string + + + + + + + + + +

.proto file contents

builder + + +ProtoBuf.Builder +| + +string +| + +Object + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

filename + + +string +| + +Object + + + + + + <optional>
+ + + + + +

The corresponding file name if known. Must be specified for imports.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the definition cannot be parsed or built

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Builder to create new messages

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

(static) loadProtoFile(filename, callbackopt, builderopt) → {ProtoBuf.Builder|undefined}

+ + + + + +
+

Loads a .proto file and returns the Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
filename + + +string +| + +Object + + + + + + + + + +

Path to proto file or an object specifying 'file' with + an overridden 'root' path for all imported files.

callback + + +function + + + + + + <optional>
+ + + + + +

Callback that will receive null as the first and + the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + file will be read synchronously and this function will return the Builder.

builder + + +ProtoBuf.Builder + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The Builder if synchronous (no callback specified, will be NULL if the + request has failed), else undefined

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder +| + +undefined + + +
+
+ + + + + + + + + + +

(static) newBuilder(optionsopt) → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Constructs a new empty Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Builder options, defaults to global options set on ProtoBuf

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Builder

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

(static) protoFromFile(filename, callbackopt, builderopt) → {ProtoBuf.Builder|undefined}

+ + + + + +
+

Loads a .proto file and returns the Builder. This is an alias of ProtoBuf.loadProtoFile.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
filename + + +string +| + +Object + + + + + + + + + +

Path to proto file or an object specifying 'file' with + an overridden 'root' path for all imported files.

callback + + +function + + + + + + <optional>
+ + + + + +

Callback that will receive null as the first and + the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + file will be read synchronously and this function will return the Builder.

builder + + +ProtoBuf.Builder + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The Builder if synchronous (no callback specified, will be NULL if the + request has failed), else undefined

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder +| + +undefined + + +
+
+ + + + + + + + + + +

(static) protoFromString(proto, builderopt, filenameopt) → {ProtoBuf.Builder}

+ + + + + +
+

Loads a .proto string and returns the Builder. This is an alias of ProtoBuf.loadProto.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
proto + + +string + + + + + + + + + +

.proto file contents

builder + + +ProtoBuf.Builder +| + +string + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

filename + + +string +| + +Object + + + + + + <optional>
+ + + + + +

The corresponding file name if known. Must be specified for imports.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the definition cannot be parsed or built

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Builder to create new messages

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.js.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.js.html new file mode 100644 index 0000000..c2f28a9 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/ProtoBuf.js.html @@ -0,0 +1,5316 @@ + + + + + JSDoc: Source: protobuf.js + + + + + + + + + + +
+ +

Source: protobuf.js

+ + + + + + +
+
+
/*
+ Copyright 2013 Daniel Wirtz <dcode@dcode.io>
+
+ 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.
+ */
+
+/**
+ * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
+ * Released under the Apache License, Version 2.0
+ * see: https://github.com/dcodeIO/protobuf.js for details
+ */
+(function(global, factory) {
+
+    /* AMD */ if (typeof define === 'function' && define["amd"])
+        define(["bytebuffer"], factory);
+    /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
+        module["exports"] = factory(require("bytebuffer"), true);
+    /* Global */ else
+        (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
+
+})(this, function(ByteBuffer, isCommonJS) {
+    "use strict";
+
+    /**
+     * The ProtoBuf namespace.
+     * @exports ProtoBuf
+     * @namespace
+     * @expose
+     */
+    var ProtoBuf = {};
+
+    /**
+     * @type {!function(new: ByteBuffer, ...[*])}
+     * @expose
+     */
+    ProtoBuf.ByteBuffer = ByteBuffer;
+
+    /**
+     * @type {?function(new: Long, ...[*])}
+     * @expose
+     */
+    ProtoBuf.Long = ByteBuffer.Long || null;
+
+    /**
+     * ProtoBuf.js version.
+     * @type {string}
+     * @const
+     * @expose
+     */
+    ProtoBuf.VERSION = "5.0.2";
+
+    /**
+     * Wire types.
+     * @type {Object.<string,number>}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES = {};
+
+    /**
+     * Varint wire type.
+     * @type {number}
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.VARINT = 0;
+
+    /**
+     * Fixed 64 bits wire type.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.BITS64 = 1;
+
+    /**
+     * Length delimited wire type.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.LDELIM = 2;
+
+    /**
+     * Start group wire type.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
+
+    /**
+     * End group wire type.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
+
+    /**
+     * Fixed 32 bits wire type.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.BITS32 = 5;
+
+    /**
+     * Packable wire types.
+     * @type {!Array.<number>}
+     * @const
+     * @expose
+     */
+    ProtoBuf.PACKABLE_WIRE_TYPES = [
+        ProtoBuf.WIRE_TYPES.VARINT,
+        ProtoBuf.WIRE_TYPES.BITS64,
+        ProtoBuf.WIRE_TYPES.BITS32
+    ];
+
+    /**
+     * Types.
+     * @dict
+     * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
+     * @const
+     * @expose
+     */
+    ProtoBuf.TYPES = {
+        // According to the protobuf spec.
+        "int32": {
+            name: "int32",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: 0
+        },
+        "uint32": {
+            name: "uint32",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: 0
+        },
+        "sint32": {
+            name: "sint32",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: 0
+        },
+        "int64": {
+            name: "int64",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
+        },
+        "uint64": {
+            name: "uint64",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
+        },
+        "sint64": {
+            name: "sint64",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
+        },
+        "bool": {
+            name: "bool",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: false
+        },
+        "double": {
+            name: "double",
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,
+            defaultValue: 0
+        },
+        "string": {
+            name: "string",
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,
+            defaultValue: ""
+        },
+        "bytes": {
+            name: "bytes",
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,
+            defaultValue: null // overridden in the code, must be a unique instance
+        },
+        "fixed32": {
+            name: "fixed32",
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,
+            defaultValue: 0
+        },
+        "sfixed32": {
+            name: "sfixed32",
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,
+            defaultValue: 0
+        },
+        "fixed64": {
+            name: "fixed64",
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,
+            defaultValue:  ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
+        },
+        "sfixed64": {
+            name: "sfixed64",
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
+        },
+        "float": {
+            name: "float",
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,
+            defaultValue: 0
+        },
+        "enum": {
+            name: "enum",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: 0
+        },
+        "message": {
+            name: "message",
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,
+            defaultValue: null
+        },
+        "group": {
+            name: "group",
+            wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
+            defaultValue: null
+        }
+    };
+
+    /**
+     * Valid map key types.
+     * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
+     * @const
+     * @expose
+     */
+    ProtoBuf.MAP_KEY_TYPES = [
+        ProtoBuf.TYPES["int32"],
+        ProtoBuf.TYPES["sint32"],
+        ProtoBuf.TYPES["sfixed32"],
+        ProtoBuf.TYPES["uint32"],
+        ProtoBuf.TYPES["fixed32"],
+        ProtoBuf.TYPES["int64"],
+        ProtoBuf.TYPES["sint64"],
+        ProtoBuf.TYPES["sfixed64"],
+        ProtoBuf.TYPES["uint64"],
+        ProtoBuf.TYPES["fixed64"],
+        ProtoBuf.TYPES["bool"],
+        ProtoBuf.TYPES["string"],
+        ProtoBuf.TYPES["bytes"]
+    ];
+
+    /**
+     * Minimum field id.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.ID_MIN = 1;
+
+    /**
+     * Maximum field id.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.ID_MAX = 0x1FFFFFFF;
+
+    /**
+     * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
+     *  Must be set prior to parsing.
+     * @type {boolean}
+     * @expose
+     */
+    ProtoBuf.convertFieldsToCamelCase = false;
+
+    /**
+     * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
+     *  setting this to `false` prior to building messages.
+     * @type {boolean}
+     * @expose
+     */
+    ProtoBuf.populateAccessors = true;
+
+    /**
+     * By default, messages are populated with default values if a field is not present on the wire. To disable
+     *  this behavior, set this setting to `false`.
+     * @type {boolean}
+     * @expose
+     */
+    ProtoBuf.populateDefaults = true;
+
+    /**
+     * @alias ProtoBuf.Util
+     * @expose
+     */
+    ProtoBuf.Util = (function() {
+        "use strict";
+
+        /**
+         * ProtoBuf utilities.
+         * @exports ProtoBuf.Util
+         * @namespace
+         */
+        var Util = {};
+
+        /**
+         * Flag if running in node or not.
+         * @type {boolean}
+         * @const
+         * @expose
+         */
+        Util.IS_NODE = !!(
+            typeof process === 'object' && process+'' === '[object process]' && !process['browser']
+        );
+
+        /**
+         * Constructs a XMLHttpRequest object.
+         * @return {XMLHttpRequest}
+         * @throws {Error} If XMLHttpRequest is not supported
+         * @expose
+         */
+        Util.XHR = function() {
+            // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
+            var XMLHttpFactories = [
+                function () {return new XMLHttpRequest()},
+                function () {return new ActiveXObject("Msxml2.XMLHTTP")},
+                function () {return new ActiveXObject("Msxml3.XMLHTTP")},
+                function () {return new ActiveXObject("Microsoft.XMLHTTP")}
+            ];
+            /** @type {?XMLHttpRequest} */
+            var xhr = null;
+            for (var i=0;i<XMLHttpFactories.length;i++) {
+                try { xhr = XMLHttpFactories[i](); }
+                catch (e) { continue; }
+                break;
+            }
+            if (!xhr)
+                throw Error("XMLHttpRequest is not supported");
+            return xhr;
+        };
+
+        /**
+         * Fetches a resource.
+         * @param {string} path Resource path
+         * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
+         *   be fetched synchronously. If the request failed, contents will be null.
+         * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
+         * @expose
+         */
+        Util.fetch = function(path, callback) {
+            if (callback && typeof callback != 'function')
+                callback = null;
+            if (Util.IS_NODE) {
+                var fs = require("fs");
+                if (callback) {
+                    fs.readFile(path, function(err, data) {
+                        if (err)
+                            callback(null);
+                        else
+                            callback(""+data);
+                    });
+                } else
+                    try {
+                        return fs.readFileSync(path);
+                    } catch (e) {
+                        return null;
+                    }
+            } else {
+                var xhr = Util.XHR();
+                xhr.open('GET', path, callback ? true : false);
+                // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
+                xhr.setRequestHeader('Accept', 'text/plain');
+                if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
+                if (callback) {
+                    xhr.onreadystatechange = function() {
+                        if (xhr.readyState != 4) return;
+                        if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
+                            callback(xhr.responseText);
+                        else
+                            callback(null);
+                    };
+                    if (xhr.readyState == 4)
+                        return;
+                    xhr.send(null);
+                } else {
+                    xhr.send(null);
+                    if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
+                        return xhr.responseText;
+                    return null;
+                }
+            }
+        };
+
+        /**
+         * Converts a string to camel case.
+         * @param {string} str
+         * @returns {string}
+         * @expose
+         */
+        Util.toCamelCase = function(str) {
+            return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
+                return $1.toUpperCase();
+            });
+        };
+
+        return Util;
+    })();
+
+    /**
+     * Language expressions.
+     * @type {!Object.<string,!RegExp>}
+     * @expose
+     */
+    ProtoBuf.Lang = {
+
+        // Characters always ending a statement
+        DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
+
+        // Field rules
+        RULE: /^(?:required|optional|repeated|map)$/,
+
+        // Field types
+        TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
+
+        // Names
+        NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
+
+        // Type definitions
+        TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
+
+        // Type references
+        TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,
+
+        // Fully qualified type references
+        FQTYPEREF: /^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,
+
+        // All numbers
+        NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
+
+        // Decimal numbers
+        NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
+
+        // Hexadecimal numbers
+        NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
+
+        // Octal numbers
+        NUMBER_OCT: /^0[0-7]+$/,
+
+        // Floating point numbers
+        NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
+
+        // Booleans
+        BOOL: /^(?:true|false)$/i,
+
+        // Id numbers
+        ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
+
+        // Negative id numbers (enum values)
+        NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
+
+        // Whitespaces
+        WHITESPACE: /\s/,
+
+        // All strings
+        STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
+
+        // Double quoted strings
+        STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
+
+        // Single quoted strings
+        STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
+    };
+
+    /**
+     * @alias ProtoBuf.DotProto
+     * @expose
+     */
+    ProtoBuf.DotProto = (function(ProtoBuf, Lang) {
+        "use strict";
+
+        /**
+         * Utilities to parse .proto files.
+         * @exports ProtoBuf.DotProto
+         * @namespace
+         */
+        var DotProto = {};
+
+        /**
+         * Constructs a new Tokenizer.
+         * @exports ProtoBuf.DotProto.Tokenizer
+         * @class prototype tokenizer
+         * @param {string} proto Proto to tokenize
+         * @constructor
+         */
+        var Tokenizer = function(proto) {
+
+            /**
+             * Source to parse.
+             * @type {string}
+             * @expose
+             */
+            this.source = proto+"";
+
+            /**
+             * Current index.
+             * @type {number}
+             * @expose
+             */
+            this.index = 0;
+
+            /**
+             * Current line.
+             * @type {number}
+             * @expose
+             */
+            this.line = 1;
+
+            /**
+             * Token stack.
+             * @type {!Array.<string>}
+             * @expose
+             */
+            this.stack = [];
+
+            /**
+             * Opening character of the current string read, if any.
+             * @type {?string}
+             * @private
+             */
+            this._stringOpen = null;
+        };
+
+        /**
+         * @alias ProtoBuf.DotProto.Tokenizer.prototype
+         * @inner
+         */
+        var TokenizerPrototype = Tokenizer.prototype;
+
+        /**
+         * Reads a string beginning at the current index.
+         * @return {string}
+         * @private
+         */
+        TokenizerPrototype._readString = function() {
+            var re = this._stringOpen === '"'
+                ? Lang.STRING_DQ
+                : Lang.STRING_SQ;
+            re.lastIndex = this.index - 1; // Include the open quote
+            var match = re.exec(this.source);
+            if (!match)
+                throw Error("unterminated string");
+            this.index = re.lastIndex;
+            this.stack.push(this._stringOpen);
+            this._stringOpen = null;
+            return match[1];
+        };
+
+        /**
+         * Gets the next token and advances by one.
+         * @return {?string} Token or `null` on EOF
+         * @expose
+         */
+        TokenizerPrototype.next = function() {
+            if (this.stack.length > 0)
+                return this.stack.shift();
+            if (this.index >= this.source.length)
+                return null;
+            if (this._stringOpen !== null)
+                return this._readString();
+
+            var repeat,
+                prev,
+                next;
+            do {
+                repeat = false;
+
+                // Strip white spaces
+                while (Lang.WHITESPACE.test(next = this.source.charAt(this.index))) {
+                    if (next === '\n')
+                        ++this.line;
+                    if (++this.index === this.source.length)
+                        return null;
+                }
+
+                // Strip comments
+                if (this.source.charAt(this.index) === '/') {
+                    ++this.index;
+                    if (this.source.charAt(this.index) === '/') { // Line
+                        while (this.source.charAt(++this.index) !== '\n')
+                            if (this.index == this.source.length)
+                                return null;
+                        ++this.index;
+                        ++this.line;
+                        repeat = true;
+                    } else if ((next = this.source.charAt(this.index)) === '*') { /* Block */
+                        do {
+                            if (next === '\n')
+                                ++this.line;
+                            if (++this.index === this.source.length)
+                                return null;
+                            prev = next;
+                            next = this.source.charAt(this.index);
+                        } while (prev !== '*' || next !== '/');
+                        ++this.index;
+                        repeat = true;
+                    } else
+                        return '/';
+                }
+            } while (repeat);
+
+            if (this.index === this.source.length)
+                return null;
+
+            // Read the next token
+            var end = this.index;
+            Lang.DELIM.lastIndex = 0;
+            var delim = Lang.DELIM.test(this.source.charAt(end++));
+            if (!delim)
+                while(end < this.source.length && !Lang.DELIM.test(this.source.charAt(end)))
+                    ++end;
+            var token = this.source.substring(this.index, this.index = end);
+            if (token === '"' || token === "'")
+                this._stringOpen = token;
+            return token;
+        };
+
+        /**
+         * Peeks for the next token.
+         * @return {?string} Token or `null` on EOF
+         * @expose
+         */
+        TokenizerPrototype.peek = function() {
+            if (this.stack.length === 0) {
+                var token = this.next();
+                if (token === null)
+                    return null;
+                this.stack.push(token);
+            }
+            return this.stack[0];
+        };
+
+        /**
+         * Skips a specific token and throws if it differs.
+         * @param {string} expected Expected token
+         * @throws {Error} If the actual token differs
+         */
+        TokenizerPrototype.skip = function(expected) {
+            var actual = this.next();
+            if (actual !== expected)
+                throw Error("illegal '"+actual+"', '"+expected+"' expected");
+        };
+
+        /**
+         * Omits an optional token.
+         * @param {string} expected Expected optional token
+         * @returns {boolean} `true` if the token exists
+         */
+        TokenizerPrototype.omit = function(expected) {
+            if (this.peek() === expected) {
+                this.next();
+                return true;
+            }
+            return false;
+        };
+
+        /**
+         * Returns a string representation of this object.
+         * @return {string} String representation as of "Tokenizer(index/length)"
+         * @expose
+         */
+        TokenizerPrototype.toString = function() {
+            return "Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")";
+        };
+
+        /**
+         * @alias ProtoBuf.DotProto.Tokenizer
+         * @expose
+         */
+        DotProto.Tokenizer = Tokenizer;
+
+        /**
+         * Constructs a new Parser.
+         * @exports ProtoBuf.DotProto.Parser
+         * @class prototype parser
+         * @param {string} source Source
+         * @constructor
+         */
+        var Parser = function(source) {
+
+            /**
+             * Tokenizer.
+             * @type {!ProtoBuf.DotProto.Tokenizer}
+             * @expose
+             */
+            this.tn = new Tokenizer(source);
+
+            /**
+             * Whether parsing proto3 or not.
+             * @type {boolean}
+             */
+            this.proto3 = false;
+        };
+
+        /**
+         * @alias ProtoBuf.DotProto.Parser.prototype
+         * @inner
+         */
+        var ParserPrototype = Parser.prototype;
+
+        /**
+         * Parses the source.
+         * @returns {!Object}
+         * @throws {Error} If the source cannot be parsed
+         * @expose
+         */
+        ParserPrototype.parse = function() {
+            var topLevel = {
+                "name": "[ROOT]", // temporary
+                "package": null,
+                "messages": [],
+                "enums": [],
+                "imports": [],
+                "options": {},
+                "services": []
+                // "syntax": undefined
+            };
+            var token,
+                head = true,
+                weak;
+            try {
+                while (token = this.tn.next()) {
+                    switch (token) {
+                        case 'package':
+                            if (!head || topLevel["package"] !== null)
+                                throw Error("unexpected 'package'");
+                            token = this.tn.next();
+                            if (!Lang.TYPEREF.test(token))
+                                throw Error("illegal package name: " + token);
+                            this.tn.skip(";");
+                            topLevel["package"] = token;
+                            break;
+                        case 'import':
+                            if (!head)
+                                throw Error("unexpected 'import'");
+                            token = this.tn.peek();
+                            if (token === "public" || (weak = token === "weak")) // token ignored
+                                this.tn.next();
+                            token = this._readString();
+                            this.tn.skip(";");
+                            if (!weak) // import ignored
+                                topLevel["imports"].push(token);
+                            break;
+                        case 'syntax':
+                            if (!head)
+                                throw Error("unexpected 'syntax'");
+                            this.tn.skip("=");
+                            if ((topLevel["syntax"] = this._readString()) === "proto3")
+                                this.proto3 = true;
+                            this.tn.skip(";");
+                            break;
+                        case 'message':
+                            this._parseMessage(topLevel, null);
+                            head = false;
+                            break;
+                        case 'enum':
+                            this._parseEnum(topLevel);
+                            head = false;
+                            break;
+                        case 'option':
+                            this._parseOption(topLevel);
+                            break;
+                        case 'service':
+                            this._parseService(topLevel);
+                            break;
+                        case 'extend':
+                            this._parseExtend(topLevel);
+                            break;
+                        default:
+                            throw Error("unexpected '" + token + "'");
+                    }
+                }
+            } catch (e) {
+                e.message = "Parse error at line "+this.tn.line+": " + e.message;
+                throw e;
+            }
+            delete topLevel["name"];
+            return topLevel;
+        };
+
+        /**
+         * Parses the specified source.
+         * @returns {!Object}
+         * @throws {Error} If the source cannot be parsed
+         * @expose
+         */
+        Parser.parse = function(source) {
+            return new Parser(source).parse();
+        };
+
+        // ----- Conversion ------
+
+        /**
+         * Converts a numerical string to an id.
+         * @param {string} value
+         * @param {boolean=} mayBeNegative
+         * @returns {number}
+         * @inner
+         */
+        function mkId(value, mayBeNegative) {
+            var id = -1,
+                sign = 1;
+            if (value.charAt(0) == '-') {
+                sign = -1;
+                value = value.substring(1);
+            }
+            if (Lang.NUMBER_DEC.test(value))
+                id = parseInt(value);
+            else if (Lang.NUMBER_HEX.test(value))
+                id = parseInt(value.substring(2), 16);
+            else if (Lang.NUMBER_OCT.test(value))
+                id = parseInt(value.substring(1), 8);
+            else
+                throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value);
+            id = (sign*id)|0; // Force to 32bit
+            if (!mayBeNegative && id < 0)
+                throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value);
+            return id;
+        }
+
+        /**
+         * Converts a numerical string to a number.
+         * @param {string} val
+         * @returns {number}
+         * @inner
+         */
+        function mkNumber(val) {
+            var sign = 1;
+            if (val.charAt(0) == '-') {
+                sign = -1;
+                val = val.substring(1);
+            }
+            if (Lang.NUMBER_DEC.test(val))
+                return sign * parseInt(val, 10);
+            else if (Lang.NUMBER_HEX.test(val))
+                return sign * parseInt(val.substring(2), 16);
+            else if (Lang.NUMBER_OCT.test(val))
+                return sign * parseInt(val.substring(1), 8);
+            else if (val === 'inf')
+                return sign * Infinity;
+            else if (val === 'nan')
+                return NaN;
+            else if (Lang.NUMBER_FLT.test(val))
+                return sign * parseFloat(val);
+            throw Error("illegal number value: " + (sign < 0 ? '-' : '') + val);
+        }
+
+        // ----- Reading ------
+
+        /**
+         * Reads a string.
+         * @returns {string}
+         * @private
+         */
+        ParserPrototype._readString = function() {
+            var value = "",
+                token,
+                delim;
+            do {
+                delim = this.tn.next();
+                if (delim !== "'" && delim !== '"')
+                    throw Error("illegal string delimiter: "+delim);
+                value += this.tn.next();
+                this.tn.skip(delim);
+                token = this.tn.peek();
+            } while (token === '"' || token === '"'); // multi line?
+            return value;
+        };
+
+        /**
+         * Reads a value.
+         * @param {boolean=} mayBeTypeRef
+         * @returns {number|boolean|string}
+         * @private
+         */
+        ParserPrototype._readValue = function(mayBeTypeRef) {
+            var token = this.tn.peek(),
+                value;
+            if (token === '"' || token === "'")
+                return this._readString();
+            this.tn.next();
+            if (Lang.NUMBER.test(token))
+                return mkNumber(token);
+            if (Lang.BOOL.test(token))
+                return (token.toLowerCase() === 'true');
+            if (mayBeTypeRef && Lang.TYPEREF.test(token))
+                return token;
+            throw Error("illegal value: "+token);
+
+        };
+
+        // ----- Parsing constructs -----
+
+        /**
+         * Parses a namespace option.
+         * @param {!Object} parent Parent definition
+         * @param {boolean=} isList
+         * @private
+         */
+        ParserPrototype._parseOption = function(parent, isList) {
+            var token = this.tn.next(),
+                custom = false;
+            if (token === '(') {
+                custom = true;
+                token = this.tn.next();
+            }
+            if (!Lang.TYPEREF.test(token))
+                // we can allow options of the form google.protobuf.* since they will just get ignored anyways
+                // if (!/google\.protobuf\./.test(token)) // FIXME: Why should that not be a valid typeref?
+                    throw Error("illegal option name: "+token);
+            var name = token;
+            if (custom) { // (my_method_option).foo, (my_method_option), some_method_option, (foo.my_option).bar
+                this.tn.skip(')');
+                name = '('+name+')';
+                token = this.tn.peek();
+                if (Lang.FQTYPEREF.test(token)) {
+                    name += token;
+                    this.tn.next();
+                }
+            }
+            this.tn.skip('=');
+            this._parseOptionValue(parent, name);
+            if (!isList)
+                this.tn.skip(";");
+        };
+
+        /**
+         * Sets an option on the specified options object.
+         * @param {!Object.<string,*>} options
+         * @param {string} name
+         * @param {string|number|boolean} value
+         * @inner
+         */
+        function setOption(options, name, value) {
+            if (typeof options[name] === 'undefined')
+                options[name] = value;
+            else {
+                if (!Array.isArray(options[name]))
+                    options[name] = [ options[name] ];
+                options[name].push(value);
+            }
+        }
+
+        /**
+         * Parses an option value.
+         * @param {!Object} parent
+         * @param {string} name
+         * @private
+         */
+        ParserPrototype._parseOptionValue = function(parent, name) {
+            var token = this.tn.peek();
+            if (token !== '{') { // Plain value
+                setOption(parent["options"], name, this._readValue(true));
+            } else { // Aggregate options
+                this.tn.skip("{");
+                while ((token = this.tn.next()) !== '}') {
+                    if (!Lang.NAME.test(token))
+                        throw Error("illegal option name: " + name + "." + token);
+                    if (this.tn.omit(":"))
+                        setOption(parent["options"], name + "." + token, this._readValue(true));
+                    else
+                        this._parseOptionValue(parent, name + "." + token);
+                }
+            }
+        };
+
+        /**
+         * Parses a service definition.
+         * @param {!Object} parent Parent definition
+         * @private
+         */
+        ParserPrototype._parseService = function(parent) {
+            var token = this.tn.next();
+            if (!Lang.NAME.test(token))
+                throw Error("illegal service name at line "+this.tn.line+": "+token);
+            var name = token;
+            var svc = {
+                "name": name,
+                "rpc": {},
+                "options": {}
+            };
+            this.tn.skip("{");
+            while ((token = this.tn.next()) !== '}') {
+                if (token === "option")
+                    this._parseOption(svc);
+                else if (token === 'rpc')
+                    this._parseServiceRPC(svc);
+                else
+                    throw Error("illegal service token: "+token);
+            }
+            this.tn.omit(";");
+            parent["services"].push(svc);
+        };
+
+        /**
+         * Parses a RPC service definition of the form ['rpc', name, (request), 'returns', (response)].
+         * @param {!Object} svc Service definition
+         * @private
+         */
+        ParserPrototype._parseServiceRPC = function(svc) {
+            var type = "rpc",
+                token = this.tn.next();
+            if (!Lang.NAME.test(token))
+                throw Error("illegal rpc service method name: "+token);
+            var name = token;
+            var method = {
+                "request": null,
+                "response": null,
+                "request_stream": false,
+                "response_stream": false,
+                "options": {}
+            };
+            this.tn.skip("(");
+            token = this.tn.next();
+            if (token.toLowerCase() === "stream") {
+              method["request_stream"] = true;
+              token = this.tn.next();
+            }
+            if (!Lang.TYPEREF.test(token))
+                throw Error("illegal rpc service request type: "+token);
+            method["request"] = token;
+            this.tn.skip(")");
+            token = this.tn.next();
+            if (token.toLowerCase() !== "returns")
+                throw Error("illegal rpc service request type delimiter: "+token);
+            this.tn.skip("(");
+            token = this.tn.next();
+            if (token.toLowerCase() === "stream") {
+              method["response_stream"] = true;
+              token = this.tn.next();
+            }
+            method["response"] = token;
+            this.tn.skip(")");
+            token = this.tn.peek();
+            if (token === '{') {
+                this.tn.next();
+                while ((token = this.tn.next()) !== '}') {
+                    if (token === 'option')
+                        this._parseOption(method);
+                    else
+                        throw Error("illegal rpc service token: " + token);
+                }
+                this.tn.omit(";");
+            } else
+                this.tn.skip(";");
+            if (typeof svc[type] === 'undefined')
+                svc[type] = {};
+            svc[type][name] = method;
+        };
+
+        /**
+         * Parses a message definition.
+         * @param {!Object} parent Parent definition
+         * @param {!Object=} fld Field definition if this is a group
+         * @returns {!Object}
+         * @private
+         */
+        ParserPrototype._parseMessage = function(parent, fld) {
+            var isGroup = !!fld,
+                token = this.tn.next();
+            var msg = {
+                "name": "",
+                "fields": [],
+                "enums": [],
+                "messages": [],
+                "options": {},
+                "services": [],
+                "oneofs": {}
+                // "extensions": undefined
+            };
+            if (!Lang.NAME.test(token))
+                throw Error("illegal "+(isGroup ? "group" : "message")+" name: "+token);
+            msg["name"] = token;
+            if (isGroup) {
+                this.tn.skip("=");
+                fld["id"] = mkId(this.tn.next());
+                msg["isGroup"] = true;
+            }
+            token = this.tn.peek();
+            if (token === '[' && fld)
+                this._parseFieldOptions(fld);
+            this.tn.skip("{");
+            while ((token = this.tn.next()) !== '}') {
+                if (Lang.RULE.test(token))
+                    this._parseMessageField(msg, token);
+                else if (token === "oneof")
+                    this._parseMessageOneOf(msg);
+                else if (token === "enum")
+                    this._parseEnum(msg);
+                else if (token === "message")
+                    this._parseMessage(msg);
+                else if (token === "option")
+                    this._parseOption(msg);
+                else if (token === "service")
+                    this._parseService(msg);
+                else if (token === "extensions")
+                    if (msg.hasOwnProperty("extensions")) {
+                        msg["extensions"] = msg["extensions"].concat(this._parseExtensionRanges())
+                    } else {
+                        msg["extensions"] = this._parseExtensionRanges();
+                    }
+                else if (token === "reserved")
+                    this._parseIgnored(); // TODO
+                else if (token === "extend")
+                    this._parseExtend(msg);
+                else if (Lang.TYPEREF.test(token)) {
+                    if (!this.proto3)
+                        throw Error("illegal field rule: "+token);
+                    this._parseMessageField(msg, "optional", token);
+                } else
+                    throw Error("illegal message token: "+token);
+            }
+            this.tn.omit(";");
+            parent["messages"].push(msg);
+            return msg;
+        };
+
+        /**
+         * Parses an ignored statement.
+         * @private
+         */
+        ParserPrototype._parseIgnored = function() {
+            while (this.tn.peek() !== ';')
+                this.tn.next();
+            this.tn.skip(";");
+        };
+
+        /**
+         * Parses a message field.
+         * @param {!Object} msg Message definition
+         * @param {string} rule Field rule
+         * @param {string=} type Field type if already known (never known for maps)
+         * @returns {!Object} Field descriptor
+         * @private
+         */
+        ParserPrototype._parseMessageField = function(msg, rule, type) {
+            if (!Lang.RULE.test(rule))
+                throw Error("illegal message field rule: "+rule);
+            var fld = {
+                "rule": rule,
+                "type": "",
+                "name": "",
+                "options": {},
+                "id": 0
+            };
+            var token;
+            if (rule === "map") {
+
+                if (type)
+                    throw Error("illegal type: " + type);
+                this.tn.skip('<');
+                token = this.tn.next();
+                if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token))
+                    throw Error("illegal message field type: " + token);
+                fld["keytype"] = token;
+                this.tn.skip(',');
+                token = this.tn.next();
+                if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token))
+                    throw Error("illegal message field: " + token);
+                fld["type"] = token;
+                this.tn.skip('>');
+                token = this.tn.next();
+                if (!Lang.NAME.test(token))
+                    throw Error("illegal message field name: " + token);
+                fld["name"] = token;
+                this.tn.skip("=");
+                fld["id"] = mkId(this.tn.next());
+                token = this.tn.peek();
+                if (token === '[')
+                    this._parseFieldOptions(fld);
+                this.tn.skip(";");
+
+            } else {
+
+                type = typeof type !== 'undefined' ? type : this.tn.next();
+
+                if (type === "group") {
+
+                    // "A [legacy] group simply combines a nested message type and a field into a single declaration. In your
+                    // code, you can treat this message just as if it had a Result type field called result (the latter name is
+                    // converted to lower-case so that it does not conflict with the former)."
+                    var grp = this._parseMessage(msg, fld);
+                    if (!/^[A-Z]/.test(grp["name"]))
+                        throw Error('illegal group name: '+grp["name"]);
+                    fld["type"] = grp["name"];
+                    fld["name"] = grp["name"].toLowerCase();
+                    this.tn.omit(";");
+
+                } else {
+
+                    if (!Lang.TYPE.test(type) && !Lang.TYPEREF.test(type))
+                        throw Error("illegal message field type: " + type);
+                    fld["type"] = type;
+                    token = this.tn.next();
+                    if (!Lang.NAME.test(token))
+                        throw Error("illegal message field name: " + token);
+                    fld["name"] = token;
+                    this.tn.skip("=");
+                    fld["id"] = mkId(this.tn.next());
+                    token = this.tn.peek();
+                    if (token === "[")
+                        this._parseFieldOptions(fld);
+                    this.tn.skip(";");
+
+                }
+            }
+            msg["fields"].push(fld);
+            return fld;
+        };
+
+        /**
+         * Parses a message oneof.
+         * @param {!Object} msg Message definition
+         * @private
+         */
+        ParserPrototype._parseMessageOneOf = function(msg) {
+            var token = this.tn.next();
+            if (!Lang.NAME.test(token))
+                throw Error("illegal oneof name: "+token);
+            var name = token,
+                fld;
+            var fields = [];
+            this.tn.skip("{");
+            while ((token = this.tn.next()) !== "}") {
+                fld = this._parseMessageField(msg, "optional", token);
+                fld["oneof"] = name;
+                fields.push(fld["id"]);
+            }
+            this.tn.omit(";");
+            msg["oneofs"][name] = fields;
+        };
+
+        /**
+         * Parses a set of field option definitions.
+         * @param {!Object} fld Field definition
+         * @private
+         */
+        ParserPrototype._parseFieldOptions = function(fld) {
+            this.tn.skip("[");
+            var token,
+                first = true;
+            while ((token = this.tn.peek()) !== ']') {
+                if (!first)
+                    this.tn.skip(",");
+                this._parseOption(fld, true);
+                first = false;
+            }
+            this.tn.next();
+        };
+
+        /**
+         * Parses an enum.
+         * @param {!Object} msg Message definition
+         * @private
+         */
+        ParserPrototype._parseEnum = function(msg) {
+            var enm = {
+                "name": "",
+                "values": [],
+                "options": {}
+            };
+            var token = this.tn.next();
+            if (!Lang.NAME.test(token))
+                throw Error("illegal name: "+token);
+            enm["name"] = token;
+            this.tn.skip("{");
+            while ((token = this.tn.next()) !== '}') {
+                if (token === "option")
+                    this._parseOption(enm);
+                else {
+                    if (!Lang.NAME.test(token))
+                        throw Error("illegal name: "+token);
+                    this.tn.skip("=");
+                    var val = {
+                        "name": token,
+                        "id": mkId(this.tn.next(), true)
+                    };
+                    token = this.tn.peek();
+                    if (token === "[")
+                        this._parseFieldOptions({ "options": {} });
+                    this.tn.skip(";");
+                    enm["values"].push(val);
+                }
+            }
+            this.tn.omit(";");
+            msg["enums"].push(enm);
+        };
+
+        /**
+         * Parses extension / reserved ranges.
+         * @returns {!Array.<!Array.<number>>}
+         * @private
+         */
+        ParserPrototype._parseExtensionRanges = function() {
+            var ranges = [];
+            var token,
+                range,
+                value;
+            do {
+                range = [];
+                while (true) {
+                    token = this.tn.next();
+                    switch (token) {
+                        case "min":
+                            value = ProtoBuf.ID_MIN;
+                            break;
+                        case "max":
+                            value = ProtoBuf.ID_MAX;
+                            break;
+                        default:
+                            value = mkNumber(token);
+                            break;
+                    }
+                    range.push(value);
+                    if (range.length === 2)
+                        break;
+                    if (this.tn.peek() !== "to") {
+                        range.push(value);
+                        break;
+                    }
+                    this.tn.next();
+                }
+                ranges.push(range);
+            } while (this.tn.omit(","));
+            this.tn.skip(";");
+            return ranges;
+        };
+
+        /**
+         * Parses an extend block.
+         * @param {!Object} parent Parent object
+         * @private
+         */
+        ParserPrototype._parseExtend = function(parent) {
+            var token = this.tn.next();
+            if (!Lang.TYPEREF.test(token))
+                throw Error("illegal extend reference: "+token);
+            var ext = {
+                "ref": token,
+                "fields": []
+            };
+            this.tn.skip("{");
+            while ((token = this.tn.next()) !== '}') {
+                if (Lang.RULE.test(token))
+                    this._parseMessageField(ext, token);
+                else if (Lang.TYPEREF.test(token)) {
+                    if (!this.proto3)
+                        throw Error("illegal field rule: "+token);
+                    this._parseMessageField(ext, "optional", token);
+                } else
+                    throw Error("illegal extend token: "+token);
+            }
+            this.tn.omit(";");
+            parent["messages"].push(ext);
+            return ext;
+        };
+
+        // ----- General -----
+
+        /**
+         * Returns a string representation of this parser.
+         * @returns {string}
+         */
+        ParserPrototype.toString = function() {
+            return "Parser at line "+this.tn.line;
+        };
+
+        /**
+         * @alias ProtoBuf.DotProto.Parser
+         * @expose
+         */
+        DotProto.Parser = Parser;
+
+        return DotProto;
+
+    })(ProtoBuf, ProtoBuf.Lang);
+
+    /**
+     * @alias ProtoBuf.Reflect
+     * @expose
+     */
+    ProtoBuf.Reflect = (function(ProtoBuf) {
+        "use strict";
+
+        /**
+         * Reflection types.
+         * @exports ProtoBuf.Reflect
+         * @namespace
+         */
+        var Reflect = {};
+
+        /**
+         * Constructs a Reflect base class.
+         * @exports ProtoBuf.Reflect.T
+         * @constructor
+         * @abstract
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {?ProtoBuf.Reflect.T} parent Parent object
+         * @param {string} name Object name
+         */
+        var T = function(builder, parent, name) {
+
+            /**
+             * Builder reference.
+             * @type {!ProtoBuf.Builder}
+             * @expose
+             */
+            this.builder = builder;
+
+            /**
+             * Parent object.
+             * @type {?ProtoBuf.Reflect.T}
+             * @expose
+             */
+            this.parent = parent;
+
+            /**
+             * Object name in namespace.
+             * @type {string}
+             * @expose
+             */
+            this.name = name;
+
+            /**
+             * Fully qualified class name
+             * @type {string}
+             * @expose
+             */
+            this.className;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.T.prototype
+         * @inner
+         */
+        var TPrototype = T.prototype;
+
+        /**
+         * Returns the fully qualified name of this object.
+         * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
+         * @expose
+         */
+        TPrototype.fqn = function() {
+            var name = this.name,
+                ptr = this;
+            do {
+                ptr = ptr.parent;
+                if (ptr == null)
+                    break;
+                name = ptr.name+"."+name;
+            } while (true);
+            return name;
+        };
+
+        /**
+         * Returns a string representation of this Reflect object (its fully qualified name).
+         * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
+         * @return String representation
+         * @expose
+         */
+        TPrototype.toString = function(includeClass) {
+            return (includeClass ? this.className + " " : "") + this.fqn();
+        };
+
+        /**
+         * Builds this type.
+         * @throws {Error} If this type cannot be built directly
+         * @expose
+         */
+        TPrototype.build = function() {
+            throw Error(this.toString(true)+" cannot be built directly");
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.T
+         * @expose
+         */
+        Reflect.T = T;
+
+        /**
+         * Constructs a new Namespace.
+         * @exports ProtoBuf.Reflect.Namespace
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
+         * @param {string} name Namespace name
+         * @param {Object.<string,*>=} options Namespace options
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)
+         * @constructor
+         * @extends ProtoBuf.Reflect.T
+         */
+        var Namespace = function(builder, parent, name, options, syntax) {
+            T.call(this, builder, parent, name);
+
+            /**
+             * @override
+             */
+            this.className = "Namespace";
+
+            /**
+             * Children inside the namespace.
+             * @type {!Array.<ProtoBuf.Reflect.T>}
+             */
+            this.children = [];
+
+            /**
+             * Options.
+             * @type {!Object.<string, *>}
+             */
+            this.options = options || {};
+
+            /**
+             * Syntax level (e.g., proto2 or proto3).
+             * @type {!string}
+             */
+            this.syntax = syntax || "proto2";
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Namespace.prototype
+         * @inner
+         */
+        var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
+
+        /**
+         * Returns an array of the namespace's children.
+         * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
+         * @return {Array.<ProtoBuf.Reflect.T>}
+         * @expose
+         */
+        NamespacePrototype.getChildren = function(type) {
+            type = type || null;
+            if (type == null)
+                return this.children.slice();
+            var children = [];
+            for (var i=0, k=this.children.length; i<k; ++i)
+                if (this.children[i] instanceof type)
+                    children.push(this.children[i]);
+            return children;
+        };
+
+        /**
+         * Adds a child to the namespace.
+         * @param {ProtoBuf.Reflect.T} child Child
+         * @throws {Error} If the child cannot be added (duplicate)
+         * @expose
+         */
+        NamespacePrototype.addChild = function(child) {
+            var other;
+            if (other = this.getChild(child.name)) {
+                // Try to revert camelcase transformation on collision
+                if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
+                    other.name = other.originalName; // Revert previous first (effectively keeps both originals)
+                else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
+                    child.name = child.originalName;
+                else
+                    throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
+            }
+            this.children.push(child);
+        };
+
+        /**
+         * Gets a child by its name or id.
+         * @param {string|number} nameOrId Child name or id
+         * @return {?ProtoBuf.Reflect.T} The child or null if not found
+         * @expose
+         */
+        NamespacePrototype.getChild = function(nameOrId) {
+            var key = typeof nameOrId === 'number' ? 'id' : 'name';
+            for (var i=0, k=this.children.length; i<k; ++i)
+                if (this.children[i][key] === nameOrId)
+                    return this.children[i];
+            return null;
+        };
+
+        /**
+         * Resolves a reflect object inside of this namespace.
+         * @param {string|!Array.<string>} qn Qualified name to resolve
+         * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
+         * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
+         * @expose
+         */
+        NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
+            var part = typeof qn === 'string' ? qn.split(".") : qn,
+                ptr = this,
+                i = 0;
+            if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
+                while (ptr.parent !== null)
+                    ptr = ptr.parent;
+                i++;
+            }
+            var child;
+            do {
+                do {
+                    if (!(ptr instanceof Reflect.Namespace)) {
+                        ptr = null;
+                        break;
+                    }
+                    child = ptr.getChild(part[i]);
+                    if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
+                        ptr = null;
+                        break;
+                    }
+                    ptr = child; i++;
+                } while (i < part.length);
+                if (ptr != null)
+                    break; // Found
+                // Else search the parent
+                if (this.parent !== null)
+                    return this.parent.resolve(qn, excludeNonNamespace);
+            } while (ptr != null);
+            return ptr;
+        };
+
+        /**
+         * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
+         * @param {!ProtoBuf.Reflect.T} t Reflection type
+         * @returns {string} The shortest qualified name or, if there is none, the fqn
+         * @expose
+         */
+        NamespacePrototype.qn = function(t) {
+            var part = [], ptr = t;
+            do {
+                part.unshift(ptr.name);
+                ptr = ptr.parent;
+            } while (ptr !== null);
+            for (var len=1; len <= part.length; len++) {
+                var qn = part.slice(part.length-len);
+                if (t === this.resolve(qn, t instanceof Reflect.Namespace))
+                    return qn.join(".");
+            }
+            return t.fqn();
+        };
+
+        /**
+         * Builds the namespace and returns the runtime counterpart.
+         * @return {Object.<string,Function|Object>} Runtime namespace
+         * @expose
+         */
+        NamespacePrototype.build = function() {
+            /** @dict */
+            var ns = {};
+            var children = this.children;
+            for (var i=0, k=children.length, child; i<k; ++i) {
+                child = children[i];
+                if (child instanceof Namespace)
+                    ns[child.name] = child.build();
+            }
+            if (Object.defineProperty)
+                Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
+            return ns;
+        };
+
+        /**
+         * Builds the namespace's '$options' property.
+         * @return {Object.<string,*>}
+         */
+        NamespacePrototype.buildOpt = function() {
+            var opt = {},
+                keys = Object.keys(this.options);
+            for (var i=0, k=keys.length; i<k; ++i) {
+                var key = keys[i],
+                    val = this.options[keys[i]];
+                // TODO: Options are not resolved, yet.
+                // if (val instanceof Namespace) {
+                //     opt[key] = val.build();
+                // } else {
+                opt[key] = val;
+                // }
+            }
+            return opt;
+        };
+
+        /**
+         * Gets the value assigned to the option with the specified name.
+         * @param {string=} name Returns the option value if specified, otherwise all options are returned.
+         * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
+         */
+        NamespacePrototype.getOption = function(name) {
+            if (typeof name === 'undefined')
+                return this.options;
+            return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Namespace
+         * @expose
+         */
+        Reflect.Namespace = Namespace;
+
+        /**
+         * Constructs a new Element implementation that checks and converts values for a
+         * particular field type, as appropriate.
+         *
+         * An Element represents a single value: either the value of a singular field,
+         * or a value contained in one entry of a repeated field or map field. This
+         * class does not implement these higher-level concepts; it only encapsulates
+         * the low-level typechecking and conversion.
+         *
+         * @exports ProtoBuf.Reflect.Element
+         * @param {{name: string, wireType: number}} type Resolved data type
+         * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
+         * (e.g. submessage field).
+         * @param {boolean} isMapKey Is this element a Map key? The value will be
+         * converted to string form if so.
+         * @param {string} syntax Syntax level of defining message type, e.g.,
+         * proto2 or proto3.
+         * @param {string} name Name of the field containing this element (for error
+         * messages)
+         * @constructor
+         */
+        var Element = function(type, resolvedType, isMapKey, syntax, name) {
+
+            /**
+             * Element type, as a string (e.g., int32).
+             * @type {{name: string, wireType: number}}
+             */
+            this.type = type;
+
+            /**
+             * Element type reference to submessage or enum definition, if needed.
+             * @type {ProtoBuf.Reflect.T|null}
+             */
+            this.resolvedType = resolvedType;
+
+            /**
+             * Element is a map key.
+             * @type {boolean}
+             */
+            this.isMapKey = isMapKey;
+
+            /**
+             * Syntax level of defining message type, e.g., proto2 or proto3.
+             * @type {string}
+             */
+            this.syntax = syntax;
+
+            /**
+             * Name of the field containing this element (for error messages)
+             * @type {string}
+             */
+            this.name = name;
+
+            if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
+                throw Error("Invalid map key type: " + type.name);
+        };
+
+        var ElementPrototype = Element.prototype;
+
+        /**
+         * Obtains a (new) default value for the specified type.
+         * @param type {string|{name: string, wireType: number}} Field type
+         * @returns {*} Default value
+         * @inner
+         */
+        function mkDefault(type) {
+            if (typeof type === 'string')
+                type = ProtoBuf.TYPES[type];
+            if (typeof type.defaultValue === 'undefined')
+                throw Error("default value for type "+type.name+" is not supported");
+            if (type == ProtoBuf.TYPES["bytes"])
+                return new ByteBuffer(0);
+            return type.defaultValue;
+        }
+
+        /**
+         * Returns the default value for this field in proto3.
+         * @function
+         * @param type {string|{name: string, wireType: number}} the field type
+         * @returns {*} Default value
+         */
+        Element.defaultFieldValue = mkDefault;
+
+        /**
+         * Makes a Long from a value.
+         * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
+         * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
+         *  strings and numbers
+         * @returns {!Long}
+         * @throws {Error} If the value cannot be converted to a Long
+         * @inner
+         */
+        function mkLong(value, unsigned) {
+            if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
+                && value.low === value.low && value.high === value.high)
+                return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
+            if (typeof value === 'string')
+                return ProtoBuf.Long.fromString(value, unsigned || false, 10);
+            if (typeof value === 'number')
+                return ProtoBuf.Long.fromNumber(value, unsigned || false);
+            throw Error("not convertible to Long");
+        }
+
+        ElementPrototype.toString = function() {
+            return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';
+        }
+
+        /**
+         * Checks if the given value can be set for an element of this type (singular
+         * field or one element of a repeated field or map).
+         * @param {*} value Value to check
+         * @return {*} Verified, maybe adjusted, value
+         * @throws {Error} If the value cannot be verified for this element slot
+         * @expose
+         */
+        ElementPrototype.verifyValue = function(value) {
+            var self = this;
+            function fail(val, msg) {
+                throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
+            }
+            switch (this.type) {
+                // Signed 32bit
+                case ProtoBuf.TYPES["int32"]:
+                case ProtoBuf.TYPES["sint32"]:
+                case ProtoBuf.TYPES["sfixed32"]:
+                    // Account for !NaN: value === value
+                    if (typeof value !== 'number' || (value === value && value % 1 !== 0))
+                        fail(typeof value, "not an integer");
+                    return value > 4294967295 ? value | 0 : value;
+
+                // Unsigned 32bit
+                case ProtoBuf.TYPES["uint32"]:
+                case ProtoBuf.TYPES["fixed32"]:
+                    if (typeof value !== 'number' || (value === value && value % 1 !== 0))
+                        fail(typeof value, "not an integer");
+                    return value < 0 ? value >>> 0 : value;
+
+                // Signed 64bit
+                case ProtoBuf.TYPES["int64"]:
+                case ProtoBuf.TYPES["sint64"]:
+                case ProtoBuf.TYPES["sfixed64"]: {
+                    if (ProtoBuf.Long)
+                        try {
+                            return mkLong(value, false);
+                        } catch (e) {
+                            fail(typeof value, e.message);
+                        }
+                    else
+                        fail(typeof value, "requires Long.js");
+                }
+
+                // Unsigned 64bit
+                case ProtoBuf.TYPES["uint64"]:
+                case ProtoBuf.TYPES["fixed64"]: {
+                    if (ProtoBuf.Long)
+                        try {
+                            return mkLong(value, true);
+                        } catch (e) {
+                            fail(typeof value, e.message);
+                        }
+                    else
+                        fail(typeof value, "requires Long.js");
+                }
+
+                // Bool
+                case ProtoBuf.TYPES["bool"]:
+                    if (typeof value !== 'boolean')
+                        fail(typeof value, "not a boolean");
+                    return value;
+
+                // Float
+                case ProtoBuf.TYPES["float"]:
+                case ProtoBuf.TYPES["double"]:
+                    if (typeof value !== 'number')
+                        fail(typeof value, "not a number");
+                    return value;
+
+                // Length-delimited string
+                case ProtoBuf.TYPES["string"]:
+                    if (typeof value !== 'string' && !(value && value instanceof String))
+                        fail(typeof value, "not a string");
+                    return ""+value; // Convert String object to string
+
+                // Length-delimited bytes
+                case ProtoBuf.TYPES["bytes"]:
+                    if (ByteBuffer.isByteBuffer(value))
+                        return value;
+                    return ByteBuffer.wrap(value, "base64");
+
+                // Constant enum value
+                case ProtoBuf.TYPES["enum"]: {
+                    var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
+                    for (i=0; i<values.length; i++)
+                        if (values[i].name == value)
+                            return values[i].id;
+                        else if (values[i].id == value)
+                            return values[i].id;
+
+                    if (this.syntax === 'proto3') {
+                        // proto3: just make sure it's an integer.
+                        if (typeof value !== 'number' || (value === value && value % 1 !== 0))
+                            fail(typeof value, "not an integer");
+                        if (value > 4294967295 || value < 0)
+                            fail(typeof value, "not in range for uint32")
+                        return value;
+                    } else {
+                        // proto2 requires enum values to be valid.
+                        fail(value, "not a valid enum value");
+                    }
+                }
+                // Embedded message
+                case ProtoBuf.TYPES["group"]:
+                case ProtoBuf.TYPES["message"]: {
+                    if (!value || typeof value !== 'object')
+                        fail(typeof value, "object expected");
+                    if (value instanceof this.resolvedType.clazz)
+                        return value;
+                    if (value instanceof ProtoBuf.Builder.Message) {
+                        // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
+                        var obj = {};
+                        for (var i in value)
+                            if (value.hasOwnProperty(i))
+                                obj[i] = value[i];
+                        value = obj;
+                    }
+                    // Else let's try to construct one from a key-value object
+                    return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
+                }
+            }
+
+            // We should never end here
+            throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
+        };
+
+        /**
+         * Calculates the byte length of an element on the wire.
+         * @param {number} id Field number
+         * @param {*} value Field value
+         * @returns {number} Byte length
+         * @throws {Error} If the value cannot be calculated
+         * @expose
+         */
+        ElementPrototype.calculateLength = function(id, value) {
+            if (value === null) return 0; // Nothing to encode
+            // Tag has already been written
+            var n;
+            switch (this.type) {
+                case ProtoBuf.TYPES["int32"]:
+                    return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
+                case ProtoBuf.TYPES["uint32"]:
+                    return ByteBuffer.calculateVarint32(value);
+                case ProtoBuf.TYPES["sint32"]:
+                    return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
+                case ProtoBuf.TYPES["fixed32"]:
+                case ProtoBuf.TYPES["sfixed32"]:
+                case ProtoBuf.TYPES["float"]:
+                    return 4;
+                case ProtoBuf.TYPES["int64"]:
+                case ProtoBuf.TYPES["uint64"]:
+                    return ByteBuffer.calculateVarint64(value);
+                case ProtoBuf.TYPES["sint64"]:
+                    return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
+                case ProtoBuf.TYPES["fixed64"]:
+                case ProtoBuf.TYPES["sfixed64"]:
+                    return 8;
+                case ProtoBuf.TYPES["bool"]:
+                    return 1;
+                case ProtoBuf.TYPES["enum"]:
+                    return ByteBuffer.calculateVarint32(value);
+                case ProtoBuf.TYPES["double"]:
+                    return 8;
+                case ProtoBuf.TYPES["string"]:
+                    n = ByteBuffer.calculateUTF8Bytes(value);
+                    return ByteBuffer.calculateVarint32(n) + n;
+                case ProtoBuf.TYPES["bytes"]:
+                    if (value.remaining() < 0)
+                        throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
+                    return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
+                case ProtoBuf.TYPES["message"]:
+                    n = this.resolvedType.calculate(value);
+                    return ByteBuffer.calculateVarint32(n) + n;
+                case ProtoBuf.TYPES["group"]:
+                    n = this.resolvedType.calculate(value);
+                    return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
+            }
+            // We should never end here
+            throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
+        };
+
+        /**
+         * Encodes a value to the specified buffer. Does not encode the key.
+         * @param {number} id Field number
+         * @param {*} value Field value
+         * @param {ByteBuffer} buffer ByteBuffer to encode to
+         * @return {ByteBuffer} The ByteBuffer for chaining
+         * @throws {Error} If the value cannot be encoded
+         * @expose
+         */
+        ElementPrototype.encodeValue = function(id, value, buffer) {
+            if (value === null) return buffer; // Nothing to encode
+            // Tag has already been written
+
+            switch (this.type) {
+                // 32bit signed varint
+                case ProtoBuf.TYPES["int32"]:
+                    // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
+                    // long – it is, effectively, treated like a very large unsigned integer." (see #122)
+                    if (value < 0)
+                        buffer.writeVarint64(value);
+                    else
+                        buffer.writeVarint32(value);
+                    break;
+
+                // 32bit unsigned varint
+                case ProtoBuf.TYPES["uint32"]:
+                    buffer.writeVarint32(value);
+                    break;
+
+                // 32bit varint zig-zag
+                case ProtoBuf.TYPES["sint32"]:
+                    buffer.writeVarint32ZigZag(value);
+                    break;
+
+                // Fixed unsigned 32bit
+                case ProtoBuf.TYPES["fixed32"]:
+                    buffer.writeUint32(value);
+                    break;
+
+                // Fixed signed 32bit
+                case ProtoBuf.TYPES["sfixed32"]:
+                    buffer.writeInt32(value);
+                    break;
+
+                // 64bit varint as-is
+                case ProtoBuf.TYPES["int64"]:
+                case ProtoBuf.TYPES["uint64"]:
+                    buffer.writeVarint64(value); // throws
+                    break;
+
+                // 64bit varint zig-zag
+                case ProtoBuf.TYPES["sint64"]:
+                    buffer.writeVarint64ZigZag(value); // throws
+                    break;
+
+                // Fixed unsigned 64bit
+                case ProtoBuf.TYPES["fixed64"]:
+                    buffer.writeUint64(value); // throws
+                    break;
+
+                // Fixed signed 64bit
+                case ProtoBuf.TYPES["sfixed64"]:
+                    buffer.writeInt64(value); // throws
+                    break;
+
+                // Bool
+                case ProtoBuf.TYPES["bool"]:
+                    if (typeof value === 'string')
+                        buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
+                    else
+                        buffer.writeVarint32(value ? 1 : 0);
+                    break;
+
+                // Constant enum value
+                case ProtoBuf.TYPES["enum"]:
+                    buffer.writeVarint32(value);
+                    break;
+
+                // 32bit float
+                case ProtoBuf.TYPES["float"]:
+                    buffer.writeFloat32(value);
+                    break;
+
+                // 64bit float
+                case ProtoBuf.TYPES["double"]:
+                    buffer.writeFloat64(value);
+                    break;
+
+                // Length-delimited string
+                case ProtoBuf.TYPES["string"]:
+                    buffer.writeVString(value);
+                    break;
+
+                // Length-delimited bytes
+                case ProtoBuf.TYPES["bytes"]:
+                    if (value.remaining() < 0)
+                        throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
+                    var prevOffset = value.offset;
+                    buffer.writeVarint32(value.remaining());
+                    buffer.append(value);
+                    value.offset = prevOffset;
+                    break;
+
+                // Embedded message
+                case ProtoBuf.TYPES["message"]:
+                    var bb = new ByteBuffer().LE();
+                    this.resolvedType.encode(value, bb);
+                    buffer.writeVarint32(bb.offset);
+                    buffer.append(bb.flip());
+                    break;
+
+                // Legacy group
+                case ProtoBuf.TYPES["group"]:
+                    this.resolvedType.encode(value, buffer);
+                    buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
+                    break;
+
+                default:
+                    // We should never end here
+                    throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
+            }
+            return buffer;
+        };
+
+        /**
+         * Decode one element value from the specified buffer.
+         * @param {ByteBuffer} buffer ByteBuffer to decode from
+         * @param {number} wireType The field wire type
+         * @param {number} id The field number
+         * @return {*} Decoded value
+         * @throws {Error} If the field cannot be decoded
+         * @expose
+         */
+        ElementPrototype.decode = function(buffer, wireType, id) {
+            if (wireType != this.type.wireType)
+                throw Error("Unexpected wire type for element");
+
+            var value, nBytes;
+            switch (this.type) {
+                // 32bit signed varint
+                case ProtoBuf.TYPES["int32"]:
+                    return buffer.readVarint32() | 0;
+
+                // 32bit unsigned varint
+                case ProtoBuf.TYPES["uint32"]:
+                    return buffer.readVarint32() >>> 0;
+
+                // 32bit signed varint zig-zag
+                case ProtoBuf.TYPES["sint32"]:
+                    return buffer.readVarint32ZigZag() | 0;
+
+                // Fixed 32bit unsigned
+                case ProtoBuf.TYPES["fixed32"]:
+                    return buffer.readUint32() >>> 0;
+
+                case ProtoBuf.TYPES["sfixed32"]:
+                    return buffer.readInt32() | 0;
+
+                // 64bit signed varint
+                case ProtoBuf.TYPES["int64"]:
+                    return buffer.readVarint64();
+
+                // 64bit unsigned varint
+                case ProtoBuf.TYPES["uint64"]:
+                    return buffer.readVarint64().toUnsigned();
+
+                // 64bit signed varint zig-zag
+                case ProtoBuf.TYPES["sint64"]:
+                    return buffer.readVarint64ZigZag();
+
+                // Fixed 64bit unsigned
+                case ProtoBuf.TYPES["fixed64"]:
+                    return buffer.readUint64();
+
+                // Fixed 64bit signed
+                case ProtoBuf.TYPES["sfixed64"]:
+                    return buffer.readInt64();
+
+                // Bool varint
+                case ProtoBuf.TYPES["bool"]:
+                    return !!buffer.readVarint32();
+
+                // Constant enum value (varint)
+                case ProtoBuf.TYPES["enum"]:
+                    // The following Builder.Message#set will already throw
+                    return buffer.readVarint32();
+
+                // 32bit float
+                case ProtoBuf.TYPES["float"]:
+                    return buffer.readFloat();
+
+                // 64bit float
+                case ProtoBuf.TYPES["double"]:
+                    return buffer.readDouble();
+
+                // Length-delimited string
+                case ProtoBuf.TYPES["string"]:
+                    return buffer.readVString();
+
+                // Length-delimited bytes
+                case ProtoBuf.TYPES["bytes"]: {
+                    nBytes = buffer.readVarint32();
+                    if (buffer.remaining() < nBytes)
+                        throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
+                    value = buffer.clone(); // Offset already set
+                    value.limit = value.offset+nBytes;
+                    buffer.offset += nBytes;
+                    return value;
+                }
+
+                // Length-delimited embedded message
+                case ProtoBuf.TYPES["message"]: {
+                    nBytes = buffer.readVarint32();
+                    return this.resolvedType.decode(buffer, nBytes);
+                }
+
+                // Legacy group
+                case ProtoBuf.TYPES["group"]:
+                    return this.resolvedType.decode(buffer, -1, id);
+            }
+
+            // We should never end here
+            throw Error("[INTERNAL] Illegal decode type");
+        };
+
+        /**
+         * Converts a value from a string to the canonical element type.
+         *
+         * Legal only when isMapKey is true.
+         *
+         * @param {string} str The string value
+         * @returns {*} The value
+         */
+        ElementPrototype.valueFromString = function(str) {
+            if (!this.isMapKey) {
+                throw Error("valueFromString() called on non-map-key element");
+            }
+
+            switch (this.type) {
+                case ProtoBuf.TYPES["int32"]:
+                case ProtoBuf.TYPES["sint32"]:
+                case ProtoBuf.TYPES["sfixed32"]:
+                case ProtoBuf.TYPES["uint32"]:
+                case ProtoBuf.TYPES["fixed32"]:
+                    return this.verifyValue(parseInt(str));
+
+                case ProtoBuf.TYPES["int64"]:
+                case ProtoBuf.TYPES["sint64"]:
+                case ProtoBuf.TYPES["sfixed64"]:
+                case ProtoBuf.TYPES["uint64"]:
+                case ProtoBuf.TYPES["fixed64"]:
+                      // Long-based fields support conversions from string already.
+                      return this.verifyValue(str);
+
+                case ProtoBuf.TYPES["bool"]:
+                      return str === "true";
+
+                case ProtoBuf.TYPES["string"]:
+                      return this.verifyValue(str);
+
+                case ProtoBuf.TYPES["bytes"]:
+                      return ByteBuffer.fromBinary(str);
+            }
+        };
+
+        /**
+         * Converts a value from the canonical element type to a string.
+         *
+         * It should be the case that `valueFromString(valueToString(val))` returns
+         * a value equivalent to `verifyValue(val)` for every legal value of `val`
+         * according to this element type.
+         *
+         * This may be used when the element must be stored or used as a string,
+         * e.g., as a map key on an Object.
+         *
+         * Legal only when isMapKey is true.
+         *
+         * @param {*} val The value
+         * @returns {string} The string form of the value.
+         */
+        ElementPrototype.valueToString = function(value) {
+            if (!this.isMapKey) {
+                throw Error("valueToString() called on non-map-key element");
+            }
+
+            if (this.type === ProtoBuf.TYPES["bytes"]) {
+                return value.toString("binary");
+            } else {
+                return value.toString();
+            }
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Element
+         * @expose
+         */
+        Reflect.Element = Element;
+
+        /**
+         * Constructs a new Message.
+         * @exports ProtoBuf.Reflect.Message
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
+         * @param {string} name Message name
+         * @param {Object.<string,*>=} options Message options
+         * @param {boolean=} isGroup `true` if this is a legacy group
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)
+         * @constructor
+         * @extends ProtoBuf.Reflect.Namespace
+         */
+        var Message = function(builder, parent, name, options, isGroup, syntax) {
+            Namespace.call(this, builder, parent, name, options, syntax);
+
+            /**
+             * @override
+             */
+            this.className = "Message";
+
+            /**
+             * Extensions range.
+             * @type {!Array.<number>|undefined}
+             * @expose
+             */
+            this.extensions = undefined;
+
+            /**
+             * Runtime message class.
+             * @type {?function(new:ProtoBuf.Builder.Message)}
+             * @expose
+             */
+            this.clazz = null;
+
+            /**
+             * Whether this is a legacy group or not.
+             * @type {boolean}
+             * @expose
+             */
+            this.isGroup = !!isGroup;
+
+            // The following cached collections are used to efficiently iterate over or look up fields when decoding.
+
+            /**
+             * Cached fields.
+             * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
+             * @private
+             */
+            this._fields = null;
+
+            /**
+             * Cached fields by id.
+             * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
+             * @private
+             */
+            this._fieldsById = null;
+
+            /**
+             * Cached fields by name.
+             * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
+             * @private
+             */
+            this._fieldsByName = null;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Message.prototype
+         * @inner
+         */
+        var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
+
+        /**
+         * Builds the message and returns the runtime counterpart, which is a fully functional class.
+         * @see ProtoBuf.Builder.Message
+         * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
+         * @return {ProtoBuf.Reflect.Message} Message class
+         * @throws {Error} If the message cannot be built
+         * @expose
+         */
+        MessagePrototype.build = function(rebuild) {
+            if (this.clazz && !rebuild)
+                return this.clazz;
+
+            // Create the runtime Message class in its own scope
+            var clazz = (function(ProtoBuf, T) {
+
+                var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
+                    oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
+
+                /**
+                 * Constructs a new runtime Message.
+                 * @name ProtoBuf.Builder.Message
+                 * @class Barebone of all runtime messages.
+                 * @param {!Object.<string,*>|string} values Preset values
+                 * @param {...string} var_args
+                 * @constructor
+                 * @throws {Error} If the message cannot be created
+                 */
+                var Message = function(values, var_args) {
+                    ProtoBuf.Builder.Message.call(this);
+
+                    // Create virtual oneof properties
+                    for (var i=0, k=oneofs.length; i<k; ++i)
+                        this[oneofs[i].name] = null;
+                    // Create fields and set default values
+                    for (i=0, k=fields.length; i<k; ++i) {
+                        var field = fields[i];
+                        this[field.name] =
+                            field.repeated ? [] :
+                            (field.map ? new ProtoBuf.Map(field) : null);
+                        if ((field.required || T.syntax === 'proto3') &&
+                            field.defaultValue !== null)
+                            this[field.name] = field.defaultValue;
+                    }
+
+                    if (arguments.length > 0) {
+                        var value;
+                        // Set field values from a values object
+                        if (arguments.length === 1 && values !== null && typeof values === 'object' &&
+                            /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
+                            /* not a repeated field */ !Array.isArray(values) &&
+                            /* not a Map */ !(values instanceof ProtoBuf.Map) &&
+                            /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
+                            /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
+                            /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
+                            this.$set(values);
+                        } else // Set field values from arguments, in declaration order
+                            for (i=0, k=arguments.length; i<k; ++i)
+                                if (typeof (value = arguments[i]) !== 'undefined')
+                                    this.$set(fields[i].name, value); // May throw
+                    }
+                };
+
+                /**
+                 * @alias ProtoBuf.Builder.Message.prototype
+                 * @inner
+                 */
+                var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
+
+                /**
+                 * Adds a value to a repeated field.
+                 * @name ProtoBuf.Builder.Message#add
+                 * @function
+                 * @param {string} key Field name
+                 * @param {*} value Value to add
+                 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
+                 * @returns {!ProtoBuf.Builder.Message} this
+                 * @throws {Error} If the value cannot be added
+                 * @expose
+                 */
+                MessagePrototype.add = function(key, value, noAssert) {
+                    var field = T._fieldsByName[key];
+                    if (!noAssert) {
+                        if (!field)
+                            throw Error(this+"#"+key+" is undefined");
+                        if (!(field instanceof ProtoBuf.Reflect.Message.Field))
+                            throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
+                        if (!field.repeated)
+                            throw Error(this+"#"+key+" is not a repeated field");
+                        value = field.verifyValue(value, true);
+                    }
+                    if (this[key] === null)
+                        this[key] = [];
+                    this[key].push(value);
+                    return this;
+                };
+
+                /**
+                 * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
+                 * @name ProtoBuf.Builder.Message#$add
+                 * @function
+                 * @param {string} key Field name
+                 * @param {*} value Value to add
+                 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
+                 * @returns {!ProtoBuf.Builder.Message} this
+                 * @throws {Error} If the value cannot be added
+                 * @expose
+                 */
+                MessagePrototype.$add = MessagePrototype.add;
+
+                /**
+                 * Sets a field's value.
+                 * @name ProtoBuf.Builder.Message#set
+                 * @function
+                 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
+                 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
+                 * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
+                 * @returns {!ProtoBuf.Builder.Message} this
+                 * @throws {Error} If the value cannot be set
+                 * @expose
+                 */
+                MessagePrototype.set = function(keyOrObj, value, noAssert) {
+                    if (keyOrObj && typeof keyOrObj === 'object') {
+                        noAssert = value;
+                        for (var ikey in keyOrObj) {
+                            // Check if virtual oneof field - don't set these
+                            if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)
+                                this.$set(ikey, value, noAssert);
+                        }
+                        return this;
+                    }
+                    var field = T._fieldsByName[keyOrObj];
+                    if (!noAssert) {
+                        if (!field)
+                            throw Error(this+"#"+keyOrObj+" is not a field: undefined");
+                        if (!(field instanceof ProtoBuf.Reflect.Message.Field))
+                            throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
+                        this[field.name] = (value = field.verifyValue(value)); // May throw
+                    } else
+                        this[keyOrObj] = value;
+                    if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
+                        var currentField = this[field.oneof.name]; // Virtual field references currently set field
+                        if (value !== null) {
+                            if (currentField !== null && currentField !== field.name)
+                                this[currentField] = null; // Clear currently set field
+                            this[field.oneof.name] = field.name; // Point virtual field at this field
+                        } else if (/* value === null && */currentField === keyOrObj)
+                            this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
+                    }
+                    return this;
+                };
+
+                /**
+                 * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
+                 * @name ProtoBuf.Builder.Message#$set
+                 * @function
+                 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
+                 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
+                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
+                 * @throws {Error} If the value cannot be set
+                 * @expose
+                 */
+                MessagePrototype.$set = MessagePrototype.set;
+
+                /**
+                 * Gets a field's value.
+                 * @name ProtoBuf.Builder.Message#get
+                 * @function
+                 * @param {string} key Key
+                 * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
+                 * @return {*} Value
+                 * @throws {Error} If there is no such field
+                 * @expose
+                 */
+                MessagePrototype.get = function(key, noAssert) {
+                    if (noAssert)
+                        return this[key];
+                    var field = T._fieldsByName[key];
+                    if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
+                        throw Error(this+"#"+key+" is not a field: undefined");
+                    if (!(field instanceof ProtoBuf.Reflect.Message.Field))
+                        throw Error(this+"#"+key+" is not a field: "+field.toString(true));
+                    return this[field.name];
+                };
+
+                /**
+                 * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
+                 * @name ProtoBuf.Builder.Message#$get
+                 * @function
+                 * @param {string} key Key
+                 * @return {*} Value
+                 * @throws {Error} If there is no such field
+                 * @expose
+                 */
+                MessagePrototype.$get = MessagePrototype.get;
+
+                // Getters and setters
+
+                for (var i=0; i<fields.length; i++) {
+                    var field = fields[i];
+                    // no setters for extension fields as these are named by their fqn
+                    if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
+                        continue;
+
+                    if (T.builder.options['populateAccessors'])
+                        (function(field) {
+                            // set/get[SomeValue]
+                            var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
+                                return match.toUpperCase().replace('_','');
+                            });
+                            Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
+
+                            // set/get_[some_value] FIXME: Do we really need these?
+                            var name = field.originalName.replace(/([A-Z])/g, function(match) {
+                                return "_"+match;
+                            });
+
+                            /**
+                             * The current field's unbound setter function.
+                             * @function
+                             * @param {*} value
+                             * @param {boolean=} noAssert
+                             * @returns {!ProtoBuf.Builder.Message}
+                             * @inner
+                             */
+                            var setter = function(value, noAssert) {
+                                this[field.name] = noAssert ? value : field.verifyValue(value);
+                                return this;
+                            };
+
+                            /**
+                             * The current field's unbound getter function.
+                             * @function
+                             * @returns {*}
+                             * @inner
+                             */
+                            var getter = function() {
+                                return this[field.name];
+                            };
+
+                            if (T.getChild("set"+Name) === null)
+                                /**
+                                 * Sets a value. This method is present for each field, but only if there is no name conflict with
+                                 *  another field.
+                                 * @name ProtoBuf.Builder.Message#set[SomeField]
+                                 * @function
+                                 * @param {*} value Value to set
+                                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
+                                 * @returns {!ProtoBuf.Builder.Message} this
+                                 * @abstract
+                                 * @throws {Error} If the value cannot be set
+                                 */
+                                MessagePrototype["set"+Name] = setter;
+
+                            if (T.getChild("set_"+name) === null)
+                                /**
+                                 * Sets a value. This method is present for each field, but only if there is no name conflict with
+                                 *  another field.
+                                 * @name ProtoBuf.Builder.Message#set_[some_field]
+                                 * @function
+                                 * @param {*} value Value to set
+                                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
+                                 * @returns {!ProtoBuf.Builder.Message} this
+                                 * @abstract
+                                 * @throws {Error} If the value cannot be set
+                                 */
+                                MessagePrototype["set_"+name] = setter;
+
+                            if (T.getChild("get"+Name) === null)
+                                /**
+                                 * Gets a value. This method is present for each field, but only if there is no name conflict with
+                                 *  another field.
+                                 * @name ProtoBuf.Builder.Message#get[SomeField]
+                                 * @function
+                                 * @abstract
+                                 * @return {*} The value
+                                 */
+                                MessagePrototype["get"+Name] = getter;
+
+                            if (T.getChild("get_"+name) === null)
+                                /**
+                                 * Gets a value. This method is present for each field, but only if there is no name conflict with
+                                 *  another field.
+                                 * @name ProtoBuf.Builder.Message#get_[some_field]
+                                 * @function
+                                 * @return {*} The value
+                                 * @abstract
+                                 */
+                                MessagePrototype["get_"+name] = getter;
+
+                        })(field);
+                }
+
+                // En-/decoding
+
+                /**
+                 * Encodes the message.
+                 * @name ProtoBuf.Builder.Message#$encode
+                 * @function
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded ByteBuffer in the `encoded` property on the error.
+                 * @expose
+                 * @see ProtoBuf.Builder.Message#encode64
+                 * @see ProtoBuf.Builder.Message#encodeHex
+                 * @see ProtoBuf.Builder.Message#encodeAB
+                 */
+                MessagePrototype.encode = function(buffer, noVerify) {
+                    if (typeof buffer === 'boolean')
+                        noVerify = buffer,
+                        buffer = undefined;
+                    var isNew = false;
+                    if (!buffer)
+                        buffer = new ByteBuffer(),
+                        isNew = true;
+                    var le = buffer.littleEndian;
+                    try {
+                        T.encode(this, buffer.LE(), noVerify);
+                        return (isNew ? buffer.flip() : buffer).LE(le);
+                    } catch (e) {
+                        buffer.LE(le);
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Encodes a message using the specified data payload.
+                 * @param {!Object.<string,*>} data Data payload
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer
+                 * @expose
+                 */
+                Message.encode = function(data, buffer, noVerify) {
+                    return new Message(data).encode(buffer, noVerify);
+                };
+
+                /**
+                 * Calculates the byte length of the message.
+                 * @name ProtoBuf.Builder.Message#calculate
+                 * @function
+                 * @returns {number} Byte length
+                 * @throws {Error} If the message cannot be calculated or if required fields are missing.
+                 * @expose
+                 */
+                MessagePrototype.calculate = function() {
+                    return T.calculate(this);
+                };
+
+                /**
+                 * Encodes the varint32 length-delimited message.
+                 * @name ProtoBuf.Builder.Message#encodeDelimited
+                 * @function
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded ByteBuffer in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.encodeDelimited = function(buffer, noVerify) {
+                    var isNew = false;
+                    if (!buffer)
+                        buffer = new ByteBuffer(),
+                        isNew = true;
+                    var enc = new ByteBuffer().LE();
+                    T.encode(this, enc, noVerify).flip();
+                    buffer.writeVarint32(enc.remaining());
+                    buffer.append(enc);
+                    return isNew ? buffer.flip() : buffer;
+                };
+
+                /**
+                 * Directly encodes the message to an ArrayBuffer.
+                 * @name ProtoBuf.Builder.Message#encodeAB
+                 * @function
+                 * @return {ArrayBuffer} Encoded message as ArrayBuffer
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded ArrayBuffer in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.encodeAB = function() {
+                    try {
+                        return this.encode().toArrayBuffer();
+                    } catch (e) {
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
+                 * @name ProtoBuf.Builder.Message#toArrayBuffer
+                 * @function
+                 * @return {ArrayBuffer} Encoded message as ArrayBuffer
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded ArrayBuffer in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
+
+                /**
+                 * Directly encodes the message to a node Buffer.
+                 * @name ProtoBuf.Builder.Message#encodeNB
+                 * @function
+                 * @return {!Buffer}
+                 * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
+                 *  missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.encodeNB = function() {
+                    try {
+                        return this.encode().toBuffer();
+                    } catch (e) {
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
+                 * @name ProtoBuf.Builder.Message#toBuffer
+                 * @function
+                 * @return {!Buffer}
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded node Buffer in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.toBuffer = MessagePrototype.encodeNB;
+
+                /**
+                 * Directly encodes the message to a base64 encoded string.
+                 * @name ProtoBuf.Builder.Message#encode64
+                 * @function
+                 * @return {string} Base64 encoded string
+                 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
+                 *  still returns the encoded base64 string in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.encode64 = function() {
+                    try {
+                        return this.encode().toBase64();
+                    } catch (e) {
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
+                 * @name ProtoBuf.Builder.Message#toBase64
+                 * @function
+                 * @return {string} Base64 encoded string
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded base64 string in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.toBase64 = MessagePrototype.encode64;
+
+                /**
+                 * Directly encodes the message to a hex encoded string.
+                 * @name ProtoBuf.Builder.Message#encodeHex
+                 * @function
+                 * @return {string} Hex encoded string
+                 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
+                 *  still returns the encoded hex string in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.encodeHex = function() {
+                    try {
+                        return this.encode().toHex();
+                    } catch (e) {
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
+                 * @name ProtoBuf.Builder.Message#toHex
+                 * @function
+                 * @return {string} Hex encoded string
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded hex string in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.toHex = MessagePrototype.encodeHex;
+
+                /**
+                 * Clones a message object or field value to a raw object.
+                 * @param {*} obj Object to clone
+                 * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
+                 * @param {boolean} longsAsStrings Whether to encode longs as strings
+                 * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
+                 * @returns {*} Cloned object
+                 * @inner
+                 */
+                function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
+                    if (obj === null || typeof obj !== 'object') {
+                        // Convert enum values to their respective names
+                        if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
+                            var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
+                            if (name !== null)
+                                return name;
+                        }
+                        // Pass-through string, number, boolean, null...
+                        return obj;
+                    }
+                    // Convert ByteBuffers to raw buffer or strings
+                    if (ByteBuffer.isByteBuffer(obj))
+                        return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
+                    // Convert Longs to proper objects or strings
+                    if (ProtoBuf.Long.isLong(obj))
+                        return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
+                    var clone;
+                    // Clone arrays
+                    if (Array.isArray(obj)) {
+                        clone = [];
+                        obj.forEach(function(v, k) {
+                            clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
+                        });
+                        return clone;
+                    }
+                    clone = {};
+                    // Convert maps to objects
+                    if (obj instanceof ProtoBuf.Map) {
+                        var it = obj.entries();
+                        for (var e = it.next(); !e.done; e = it.next())
+                            clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
+                        return clone;
+                    }
+                    // Everything else is a non-null object
+                    var type = obj.$type,
+                        field = undefined;
+                    for (var i in obj)
+                        if (obj.hasOwnProperty(i)) {
+                            if (type && (field = type.getChild(i)))
+                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
+                            else
+                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
+                        }
+                    return clone;
+                }
+
+                /**
+                 * Returns the message's raw payload.
+                 * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
+                 * @param {boolean} longsAsStrings Whether to encode longs as strings
+                 * @returns {Object.<string,*>} Raw payload
+                 * @expose
+                 */
+                MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
+                    return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
+                };
+
+                /**
+                 * Encodes a message to JSON.
+                 * @returns {string} JSON string
+                 * @expose
+                 */
+                MessagePrototype.encodeJSON = function() {
+                    return JSON.stringify(
+                        cloneRaw(this,
+                             /* binary-as-base64 */ true,
+                             /* longs-as-strings */ true,
+                             this.$type
+                        )
+                    );
+                };
+
+                /**
+                 * Decodes a message from the specified buffer or string.
+                 * @name ProtoBuf.Builder.Message.decode
+                 * @function
+                 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
+                 * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
+                 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
+                 * @return {!ProtoBuf.Builder.Message} Decoded message
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.
+                 * @expose
+                 * @see ProtoBuf.Builder.Message.decode64
+                 * @see ProtoBuf.Builder.Message.decodeHex
+                 */
+                Message.decode = function(buffer, length, enc) {
+                    if (typeof length === 'string')
+                        enc = length,
+                        length = -1;
+                    if (typeof buffer === 'string')
+                        buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
+                    else if (!ByteBuffer.isByteBuffer(buffer))
+                        buffer = ByteBuffer.wrap(buffer); // May throw
+                    var le = buffer.littleEndian;
+                    try {
+                        var msg = T.decode(buffer.LE(), length);
+                        buffer.LE(le);
+                        return msg;
+                    } catch (e) {
+                        buffer.LE(le);
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Decodes a varint32 length-delimited message from the specified buffer or string.
+                 * @name ProtoBuf.Builder.Message.decodeDelimited
+                 * @function
+                 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
+                 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
+                 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.
+                 * @expose
+                 */
+                Message.decodeDelimited = function(buffer, enc) {
+                    if (typeof buffer === 'string')
+                        buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
+                    else if (!ByteBuffer.isByteBuffer(buffer))
+                        buffer = ByteBuffer.wrap(buffer); // May throw
+                    if (buffer.remaining() < 1)
+                        return null;
+                    var off = buffer.offset,
+                        len = buffer.readVarint32();
+                    if (buffer.remaining() < len) {
+                        buffer.offset = off;
+                        return null;
+                    }
+                    try {
+                        var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
+                        buffer.offset += len;
+                        return msg;
+                    } catch (err) {
+                        buffer.offset += len;
+                        throw err;
+                    }
+                };
+
+                /**
+                 * Decodes the message from the specified base64 encoded string.
+                 * @name ProtoBuf.Builder.Message.decode64
+                 * @function
+                 * @param {string} str String to decode from
+                 * @return {!ProtoBuf.Builder.Message} Decoded message
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.
+                 * @expose
+                 */
+                Message.decode64 = function(str) {
+                    return Message.decode(str, "base64");
+                };
+
+                /**
+                 * Decodes the message from the specified hex encoded string.
+                 * @name ProtoBuf.Builder.Message.decodeHex
+                 * @function
+                 * @param {string} str String to decode from
+                 * @return {!ProtoBuf.Builder.Message} Decoded message
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.
+                 * @expose
+                 */
+                Message.decodeHex = function(str) {
+                    return Message.decode(str, "hex");
+                };
+
+                /**
+                 * Decodes the message from a JSON string.
+                 * @name ProtoBuf.Builder.Message.decodeJSON
+                 * @function
+                 * @param {string} str String to decode from
+                 * @return {!ProtoBuf.Builder.Message} Decoded message
+                 * @throws {Error} If the message cannot be decoded or if required fields are
+                 * missing.
+                 * @expose
+                 */
+                Message.decodeJSON = function(str) {
+                    return new Message(JSON.parse(str));
+                };
+
+                // Utility
+
+                /**
+                 * Returns a string representation of this Message.
+                 * @name ProtoBuf.Builder.Message#toString
+                 * @function
+                 * @return {string} String representation as of ".Fully.Qualified.MessageName"
+                 * @expose
+                 */
+                MessagePrototype.toString = function() {
+                    return T.toString();
+                };
+
+                // Properties
+
+                /**
+                 * Message options.
+                 * @name ProtoBuf.Builder.Message.$options
+                 * @type {Object.<string,*>}
+                 * @expose
+                 */
+                var $optionsS; // cc needs this
+
+                /**
+                 * Message options.
+                 * @name ProtoBuf.Builder.Message#$options
+                 * @type {Object.<string,*>}
+                 * @expose
+                 */
+                var $options;
+
+                /**
+                 * Reflection type.
+                 * @name ProtoBuf.Builder.Message.$type
+                 * @type {!ProtoBuf.Reflect.Message}
+                 * @expose
+                 */
+                var $typeS;
+
+                /**
+                 * Reflection type.
+                 * @name ProtoBuf.Builder.Message#$type
+                 * @type {!ProtoBuf.Reflect.Message}
+                 * @expose
+                 */
+                var $type;
+
+                if (Object.defineProperty)
+                    Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
+                    Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
+                    Object.defineProperty(Message, "$type", { "value": T }),
+                    Object.defineProperty(MessagePrototype, "$type", { "value": T });
+
+                return Message;
+
+            })(ProtoBuf, this);
+
+            // Static enums and prototyped sub-messages / cached collections
+            this._fields = [];
+            this._fieldsById = {};
+            this._fieldsByName = {};
+            this._oneofsByName = {};
+            for (var i=0, k=this.children.length, child; i<k; i++) {
+                child = this.children[i];
+                if (child instanceof Enum || child instanceof Message || child instanceof Service) {
+                    if (clazz.hasOwnProperty(child.name))
+                        throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
+                    clazz[child.name] = child.build();
+                } else if (child instanceof Message.Field)
+                    child.build(),
+                    this._fields.push(child),
+                    this._fieldsById[child.id] = child,
+                    this._fieldsByName[child.name] = child;
+                else if (child instanceof Message.OneOf) {
+                    this._oneofsByName[child.name] = child;
+                }
+                else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
+                    throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
+            }
+
+            return this.clazz = clazz;
+        };
+
+        /**
+         * Encodes a runtime message's contents to the specified buffer.
+         * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
+         * @param {ByteBuffer} buffer ByteBuffer to write to
+         * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+         * @return {ByteBuffer} The ByteBuffer for chaining
+         * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
+         * @expose
+         */
+        MessagePrototype.encode = function(message, buffer, noVerify) {
+            var fieldMissing = null,
+                field;
+            for (var i=0, k=this._fields.length, val; i<k; ++i) {
+                field = this._fields[i];
+                val = message[field.name];
+                if (field.required && val === null) {
+                    if (fieldMissing === null)
+                        fieldMissing = field;
+                } else
+                    field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
+            }
+            if (fieldMissing !== null) {
+                var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
+                err["encoded"] = buffer; // Still expose what we got
+                throw(err);
+            }
+            return buffer;
+        };
+
+        /**
+         * Calculates a runtime message's byte length.
+         * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
+         * @returns {number} Byte length
+         * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
+         * @expose
+         */
+        MessagePrototype.calculate = function(message) {
+            for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
+                field = this._fields[i];
+                val = message[field.name];
+                if (field.required && val === null)
+                   throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
+                else
+                    n += field.calculate(val, message);
+            }
+            return n;
+        };
+
+        /**
+         * Skips all data until the end of the specified group has been reached.
+         * @param {number} expectedId Expected GROUPEND id
+         * @param {!ByteBuffer} buf ByteBuffer
+         * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
+         * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
+         * @inner
+         */
+        function skipTillGroupEnd(expectedId, buf) {
+            var tag = buf.readVarint32(), // Throws on OOB
+                wireType = tag & 0x07,
+                id = tag >>> 3;
+            switch (wireType) {
+                case ProtoBuf.WIRE_TYPES.VARINT:
+                    do tag = buf.readUint8();
+                    while ((tag & 0x80) === 0x80);
+                    break;
+                case ProtoBuf.WIRE_TYPES.BITS64:
+                    buf.offset += 8;
+                    break;
+                case ProtoBuf.WIRE_TYPES.LDELIM:
+                    tag = buf.readVarint32(); // reads the varint
+                    buf.offset += tag;        // skips n bytes
+                    break;
+                case ProtoBuf.WIRE_TYPES.STARTGROUP:
+                    skipTillGroupEnd(id, buf);
+                    break;
+                case ProtoBuf.WIRE_TYPES.ENDGROUP:
+                    if (id === expectedId)
+                        return false;
+                    else
+                        throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
+                case ProtoBuf.WIRE_TYPES.BITS32:
+                    buf.offset += 4;
+                    break;
+                default:
+                    throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
+            }
+            return true;
+        }
+
+        /**
+         * Decodes an encoded message and returns the decoded message.
+         * @param {ByteBuffer} buffer ByteBuffer to decode from
+         * @param {number=} length Message length. Defaults to decode all remaining data.
+         * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
+         * @return {ProtoBuf.Builder.Message} Decoded message
+         * @throws {Error} If the message cannot be decoded
+         * @expose
+         */
+        MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
+            if (typeof length !== 'number')
+                length = -1;
+            var start = buffer.offset,
+                msg = new (this.clazz)(),
+                tag, wireType, id, field;
+            while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
+                tag = buffer.readVarint32();
+                wireType = tag & 0x07;
+                id = tag >>> 3;
+                if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
+                    if (id !== expectedGroupEndId)
+                        throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
+                    break;
+                }
+                if (!(field = this._fieldsById[id])) {
+                    // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
+                    switch (wireType) {
+                        case ProtoBuf.WIRE_TYPES.VARINT:
+                            buffer.readVarint32();
+                            break;
+                        case ProtoBuf.WIRE_TYPES.BITS32:
+                            buffer.offset += 4;
+                            break;
+                        case ProtoBuf.WIRE_TYPES.BITS64:
+                            buffer.offset += 8;
+                            break;
+                        case ProtoBuf.WIRE_TYPES.LDELIM:
+                            var len = buffer.readVarint32();
+                            buffer.offset += len;
+                            break;
+                        case ProtoBuf.WIRE_TYPES.STARTGROUP:
+                            while (skipTillGroupEnd(id, buffer)) {}
+                            break;
+                        default:
+                            throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
+                    }
+                    continue;
+                }
+                if (field.repeated && !field.options["packed"]) {
+                    msg[field.name].push(field.decode(wireType, buffer));
+                } else if (field.map) {
+                    var keyval = field.decode(wireType, buffer);
+                    msg[field.name].set(keyval[0], keyval[1]);
+                } else {
+                    msg[field.name] = field.decode(wireType, buffer);
+                    if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
+                        var currentField = msg[field.oneof.name]; // Virtual field references currently set field
+                        if (currentField !== null && currentField !== field.name)
+                            msg[currentField] = null; // Clear currently set field
+                        msg[field.oneof.name] = field.name; // Point virtual field at this field
+                    }
+                }
+            }
+
+            // Check if all required fields are present and set default values for optional fields that are not
+            for (var i=0, k=this._fields.length; i<k; ++i) {
+                field = this._fields[i];
+                if (msg[field.name] === null) {
+                    if (this.syntax === "proto3") { // Proto3 sets default values by specification
+                        msg[field.name] = field.defaultValue;
+                    } else if (field.required) {
+                        var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
+                        err["decoded"] = msg; // Still expose what we got
+                        throw(err);
+                    } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
+                        msg[field.name] = field.defaultValue;
+                }
+            }
+            return msg;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Message
+         * @expose
+         */
+        Reflect.Message = Message;
+
+        /**
+         * Constructs a new Message Field.
+         * @exports ProtoBuf.Reflect.Message.Field
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Message} message Message reference
+         * @param {string} rule Rule, one of requried, optional, repeated
+         * @param {string?} keytype Key data type, if any.
+         * @param {string} type Data type, e.g. int32
+         * @param {string} name Field name
+         * @param {number} id Unique field id
+         * @param {Object.<string,*>=} options Options
+         * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)
+         * @constructor
+         * @extends ProtoBuf.Reflect.T
+         */
+        var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
+            T.call(this, builder, message, name);
+
+            /**
+             * @override
+             */
+            this.className = "Message.Field";
+
+            /**
+             * Message field required flag.
+             * @type {boolean}
+             * @expose
+             */
+            this.required = rule === "required";
+
+            /**
+             * Message field repeated flag.
+             * @type {boolean}
+             * @expose
+             */
+            this.repeated = rule === "repeated";
+
+            /**
+             * Message field map flag.
+             * @type {boolean}
+             * @expose
+             */
+            this.map = rule === "map";
+
+            /**
+             * Message field key type. Type reference string if unresolved, protobuf
+             * type if resolved. Valid only if this.map === true, null otherwise.
+             * @type {string|{name: string, wireType: number}|null}
+             * @expose
+             */
+            this.keyType = keytype || null;
+
+            /**
+             * Message field type. Type reference string if unresolved, protobuf type if
+             * resolved. In a map field, this is the value type.
+             * @type {string|{name: string, wireType: number}}
+             * @expose
+             */
+            this.type = type;
+
+            /**
+             * Resolved type reference inside the global namespace.
+             * @type {ProtoBuf.Reflect.T|null}
+             * @expose
+             */
+            this.resolvedType = null;
+
+            /**
+             * Unique message field id.
+             * @type {number}
+             * @expose
+             */
+            this.id = id;
+
+            /**
+             * Message field options.
+             * @type {!Object.<string,*>}
+             * @dict
+             * @expose
+             */
+            this.options = options || {};
+
+            /**
+             * Default value.
+             * @type {*}
+             * @expose
+             */
+            this.defaultValue = null;
+
+            /**
+             * Enclosing OneOf.
+             * @type {?ProtoBuf.Reflect.Message.OneOf}
+             * @expose
+             */
+            this.oneof = oneof || null;
+
+            /**
+             * Syntax level of this definition (e.g., proto3).
+             * @type {string}
+             * @expose
+             */
+            this.syntax = syntax || 'proto2';
+
+            /**
+             * Original field name.
+             * @type {string}
+             * @expose
+             */
+            this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
+
+            /**
+             * Element implementation. Created in build() after types are resolved.
+             * @type {ProtoBuf.Element}
+             * @expose
+             */
+            this.element = null;
+
+            /**
+             * Key element implementation, for map fields. Created in build() after
+             * types are resolved.
+             * @type {ProtoBuf.Element}
+             * @expose
+             */
+            this.keyElement = null;
+
+            // Convert field names to camel case notation if the override is set
+            if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
+                this.name = ProtoBuf.Util.toCamelCase(this.name);
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Message.Field.prototype
+         * @inner
+         */
+        var FieldPrototype = Field.prototype = Object.create(T.prototype);
+
+        /**
+         * Builds the field.
+         * @override
+         * @expose
+         */
+        FieldPrototype.build = function() {
+            this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);
+            if (this.map)
+                this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);
+
+            // In proto3, fields do not have field presence, and every field is set to
+            // its type's default value ("", 0, 0.0, or false).
+            if (this.syntax === 'proto3' && !this.repeated && !this.map)
+                this.defaultValue = Element.defaultFieldValue(this.type);
+
+            // Otherwise, default values are present when explicitly specified
+            else if (typeof this.options['default'] !== 'undefined')
+                this.defaultValue = this.verifyValue(this.options['default']);
+        };
+
+        /**
+         * Checks if the given value can be set for this field.
+         * @param {*} value Value to check
+         * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
+         * @return {*} Verified, maybe adjusted, value
+         * @throws {Error} If the value cannot be set for this field
+         * @expose
+         */
+        FieldPrototype.verifyValue = function(value, skipRepeated) {
+            skipRepeated = skipRepeated || false;
+            var self = this;
+            function fail(val, msg) {
+                throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
+            }
+            if (value === null) { // NULL values for optional fields
+                if (this.required)
+                    fail(typeof value, "required");
+                if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
+                    fail(typeof value, "proto3 field without field presence cannot be null");
+                return null;
+            }
+            var i;
+            if (this.repeated && !skipRepeated) { // Repeated values as arrays
+                if (!Array.isArray(value))
+                    value = [value];
+                var res = [];
+                for (i=0; i<value.length; i++)
+                    res.push(this.element.verifyValue(value[i]));
+                return res;
+            }
+            if (this.map && !skipRepeated) { // Map values as objects
+                if (!(value instanceof ProtoBuf.Map)) {
+                    // If not already a Map, attempt to convert.
+                    if (!(value instanceof Object)) {
+                        fail(typeof value,
+                             "expected ProtoBuf.Map or raw object for map field");
+                    }
+                    return new ProtoBuf.Map(this, value);
+                } else {
+                    return value;
+                }
+            }
+            // All non-repeated fields expect no array
+            if (!this.repeated && Array.isArray(value))
+                fail(typeof value, "no array expected");
+
+            return this.element.verifyValue(value);
+        };
+
+        /**
+         * Determines whether the field will have a presence on the wire given its
+         * value.
+         * @param {*} value Verified field value
+         * @param {!ProtoBuf.Builder.Message} message Runtime message
+         * @return {boolean} Whether the field will be present on the wire
+         */
+        FieldPrototype.hasWirePresence = function(value, message) {
+            if (this.syntax !== 'proto3')
+                return (value !== null);
+            if (this.oneof && message[this.oneof.name] === this.name)
+                return true;
+            switch (this.type) {
+                case ProtoBuf.TYPES["int32"]:
+                case ProtoBuf.TYPES["sint32"]:
+                case ProtoBuf.TYPES["sfixed32"]:
+                case ProtoBuf.TYPES["uint32"]:
+                case ProtoBuf.TYPES["fixed32"]:
+                    return value !== 0;
+
+                case ProtoBuf.TYPES["int64"]:
+                case ProtoBuf.TYPES["sint64"]:
+                case ProtoBuf.TYPES["sfixed64"]:
+                case ProtoBuf.TYPES["uint64"]:
+                case ProtoBuf.TYPES["fixed64"]:
+                    return value.low !== 0 || value.high !== 0;
+
+                case ProtoBuf.TYPES["bool"]:
+                    return value;
+
+                case ProtoBuf.TYPES["float"]:
+                case ProtoBuf.TYPES["double"]:
+                    return value !== 0.0;
+
+                case ProtoBuf.TYPES["string"]:
+                    return value.length > 0;
+
+                case ProtoBuf.TYPES["bytes"]:
+                    return value.remaining() > 0;
+
+                case ProtoBuf.TYPES["enum"]:
+                    return value !== 0;
+
+                case ProtoBuf.TYPES["message"]:
+                    return value !== null;
+                default:
+                    return true;
+            }
+        };
+
+        /**
+         * Encodes the specified field value to the specified buffer.
+         * @param {*} value Verified field value
+         * @param {ByteBuffer} buffer ByteBuffer to encode to
+         * @param {!ProtoBuf.Builder.Message} message Runtime message
+         * @return {ByteBuffer} The ByteBuffer for chaining
+         * @throws {Error} If the field cannot be encoded
+         * @expose
+         */
+        FieldPrototype.encode = function(value, buffer, message) {
+            if (this.type === null || typeof this.type !== 'object')
+                throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
+            if (value === null || (this.repeated && value.length == 0))
+                return buffer; // Optional omitted
+            try {
+                if (this.repeated) {
+                    var i;
+                    // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
+                    // types) can be declared 'packed'."
+                    if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
+                        // "All of the elements of the field are packed into a single key-value pair with wire type 2
+                        // (length-delimited). Each element is encoded the same way it would be normally, except without a
+                        // tag preceding it."
+                        buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+                        buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
+                        var start = buffer.offset; // Remember where the contents begin
+                        for (i=0; i<value.length; i++)
+                            this.element.encodeValue(this.id, value[i], buffer);
+                        var len = buffer.offset-start,
+                            varintLen = ByteBuffer.calculateVarint32(len);
+                        if (varintLen > 1) { // We need to move the contents
+                            var contents = buffer.slice(start, buffer.offset);
+                            start += varintLen-1;
+                            buffer.offset = start;
+                            buffer.append(contents);
+                        }
+                        buffer.writeVarint32(len, start-varintLen);
+                    } else {
+                        // "If your message definition has repeated elements (without the [packed=true] option), the encoded
+                        // message has zero or more key-value pairs with the same tag number"
+                        for (i=0; i<value.length; i++)
+                            buffer.writeVarint32((this.id << 3) | this.type.wireType),
+                            this.element.encodeValue(this.id, value[i], buffer);
+                    }
+                } else if (this.map) {
+                    // Write out each map entry as a submessage.
+                    value.forEach(function(val, key, m) {
+                        // Compute the length of the submessage (key, val) pair.
+                        var length =
+                            ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
+                            this.keyElement.calculateLength(1, key) +
+                            ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
+                            this.element.calculateLength(2, val);
+
+                        // Submessage with wire type of length-delimited.
+                        buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+                        buffer.writeVarint32(length);
+
+                        // Write out the key and val.
+                        buffer.writeVarint32((1 << 3) | this.keyType.wireType);
+                        this.keyElement.encodeValue(1, key, buffer);
+                        buffer.writeVarint32((2 << 3) | this.type.wireType);
+                        this.element.encodeValue(2, val, buffer);
+                    }, this);
+                } else {
+                    if (this.hasWirePresence(value, message)) {
+                        buffer.writeVarint32((this.id << 3) | this.type.wireType);
+                        this.element.encodeValue(this.id, value, buffer);
+                    }
+                }
+            } catch (e) {
+                throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
+            }
+            return buffer;
+        };
+
+        /**
+         * Calculates the length of this field's value on the network level.
+         * @param {*} value Field value
+         * @param {!ProtoBuf.Builder.Message} message Runtime message
+         * @returns {number} Byte length
+         * @expose
+         */
+        FieldPrototype.calculate = function(value, message) {
+            value = this.verifyValue(value); // May throw
+            if (this.type === null || typeof this.type !== 'object')
+                throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
+            if (value === null || (this.repeated && value.length == 0))
+                return 0; // Optional omitted
+            var n = 0;
+            try {
+                if (this.repeated) {
+                    var i, ni;
+                    if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+                        ni = 0;
+                        for (i=0; i<value.length; i++)
+                            ni += this.element.calculateLength(this.id, value[i]);
+                        n += ByteBuffer.calculateVarint32(ni);
+                        n += ni;
+                    } else {
+                        for (i=0; i<value.length; i++)
+                            n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
+                            n += this.element.calculateLength(this.id, value[i]);
+                    }
+                } else if (this.map) {
+                    // Each map entry becomes a submessage.
+                    value.forEach(function(val, key, m) {
+                        // Compute the length of the submessage (key, val) pair.
+                        var length =
+                            ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
+                            this.keyElement.calculateLength(1, key) +
+                            ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
+                            this.element.calculateLength(2, val);
+
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+                        n += ByteBuffer.calculateVarint32(length);
+                        n += length;
+                    }, this);
+                } else {
+                    if (this.hasWirePresence(value, message)) {
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
+                        n += this.element.calculateLength(this.id, value);
+                    }
+                }
+            } catch (e) {
+                throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
+            }
+            return n;
+        };
+
+        /**
+         * Decode the field value from the specified buffer.
+         * @param {number} wireType Leading wire type
+         * @param {ByteBuffer} buffer ByteBuffer to decode from
+         * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
+         * @return {*} Decoded value: array for packed repeated fields, [key, value] for
+         *             map fields, or an individual value otherwise.
+         * @throws {Error} If the field cannot be decoded
+         * @expose
+         */
+        FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
+            var value, nBytes;
+
+            // We expect wireType to match the underlying type's wireType unless we see
+            // a packed repeated field, or unless this is a map field.
+            var wireTypeOK =
+                (!this.map && wireType == this.type.wireType) ||
+                (!skipRepeated && this.repeated && this.options["packed"] &&
+                 wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
+                (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
+            if (!wireTypeOK)
+                throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
+
+            // Handle packed repeated fields.
+            if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
+                if (!skipRepeated) {
+                    nBytes = buffer.readVarint32();
+                    nBytes = buffer.offset + nBytes; // Limit
+                    var values = [];
+                    while (buffer.offset < nBytes)
+                        values.push(this.decode(this.type.wireType, buffer, true));
+                    return values;
+                }
+                // Read the next value otherwise...
+            }
+
+            // Handle maps.
+            if (this.map) {
+                // Read one (key, value) submessage, and return [key, value]
+                var key = Element.defaultFieldValue(this.keyType);
+                value = Element.defaultFieldValue(this.type);
+
+                // Read the length
+                nBytes = buffer.readVarint32();
+                if (buffer.remaining() < nBytes)
+                    throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
+
+                // Get a sub-buffer of this key/value submessage
+                var msgbuf = buffer.clone();
+                msgbuf.limit = msgbuf.offset + nBytes;
+                buffer.offset += nBytes;
+
+                while (msgbuf.remaining() > 0) {
+                    var tag = msgbuf.readVarint32();
+                    wireType = tag & 0x07;
+                    var id = tag >>> 3;
+                    if (id === 1) {
+                        key = this.keyElement.decode(msgbuf, wireType, id);
+                    } else if (id === 2) {
+                        value = this.element.decode(msgbuf, wireType, id);
+                    } else {
+                        throw Error("Unexpected tag in map field key/value submessage");
+                    }
+                }
+
+                return [key, value];
+            }
+
+            // Handle singular and non-packed repeated field values.
+            return this.element.decode(buffer, wireType, this.id);
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Message.Field
+         * @expose
+         */
+        Reflect.Message.Field = Field;
+
+        /**
+         * Constructs a new Message ExtensionField.
+         * @exports ProtoBuf.Reflect.Message.ExtensionField
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Message} message Message reference
+         * @param {string} rule Rule, one of requried, optional, repeated
+         * @param {string} type Data type, e.g. int32
+         * @param {string} name Field name
+         * @param {number} id Unique field id
+         * @param {!Object.<string,*>=} options Options
+         * @constructor
+         * @extends ProtoBuf.Reflect.Message.Field
+         */
+        var ExtensionField = function(builder, message, rule, type, name, id, options) {
+            Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
+
+            /**
+             * Extension reference.
+             * @type {!ProtoBuf.Reflect.Extension}
+             * @expose
+             */
+            this.extension;
+        };
+
+        // Extends Field
+        ExtensionField.prototype = Object.create(Field.prototype);
+
+        /**
+         * @alias ProtoBuf.Reflect.Message.ExtensionField
+         * @expose
+         */
+        Reflect.Message.ExtensionField = ExtensionField;
+
+        /**
+         * Constructs a new Message OneOf.
+         * @exports ProtoBuf.Reflect.Message.OneOf
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Message} message Message reference
+         * @param {string} name OneOf name
+         * @constructor
+         * @extends ProtoBuf.Reflect.T
+         */
+        var OneOf = function(builder, message, name) {
+            T.call(this, builder, message, name);
+
+            /**
+             * Enclosed fields.
+             * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
+             * @expose
+             */
+            this.fields = [];
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Message.OneOf
+         * @expose
+         */
+        Reflect.Message.OneOf = OneOf;
+
+        /**
+         * Constructs a new Enum.
+         * @exports ProtoBuf.Reflect.Enum
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
+         * @param {string} name Enum name
+         * @param {Object.<string,*>=} options Enum options
+         * @param {string?} syntax The syntax level (e.g., proto3)
+         * @constructor
+         * @extends ProtoBuf.Reflect.Namespace
+         */
+        var Enum = function(builder, parent, name, options, syntax) {
+            Namespace.call(this, builder, parent, name, options, syntax);
+
+            /**
+             * @override
+             */
+            this.className = "Enum";
+
+            /**
+             * Runtime enum object.
+             * @type {Object.<string,number>|null}
+             * @expose
+             */
+            this.object = null;
+        };
+
+        /**
+         * Gets the string name of an enum value.
+         * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
+         * @param {number} value Enum value
+         * @returns {?string} Name or `null` if not present
+         * @expose
+         */
+        Enum.getName = function(enm, value) {
+            var keys = Object.keys(enm);
+            for (var i=0, key; i<keys.length; ++i)
+                if (enm[key = keys[i]] === value)
+                    return key;
+            return null;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Enum.prototype
+         * @inner
+         */
+        var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
+
+        /**
+         * Builds this enum and returns the runtime counterpart.
+         * @param {boolean} rebuild Whether to rebuild or not, defaults to false
+         * @returns {!Object.<string,number>}
+         * @expose
+         */
+        EnumPrototype.build = function(rebuild) {
+            if (this.object && !rebuild)
+                return this.object;
+            var enm = new ProtoBuf.Builder.Enum(),
+                values = this.getChildren(Enum.Value);
+            for (var i=0, k=values.length; i<k; ++i)
+                enm[values[i]['name']] = values[i]['id'];
+            if (Object.defineProperty)
+                Object.defineProperty(enm, '$options', {
+                    "value": this.buildOpt(),
+                    "enumerable": false
+                });
+            return this.object = enm;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Enum
+         * @expose
+         */
+        Reflect.Enum = Enum;
+
+        /**
+         * Constructs a new Enum Value.
+         * @exports ProtoBuf.Reflect.Enum.Value
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
+         * @param {string} name Field name
+         * @param {number} id Unique field id
+         * @constructor
+         * @extends ProtoBuf.Reflect.T
+         */
+        var Value = function(builder, enm, name, id) {
+            T.call(this, builder, enm, name);
+
+            /**
+             * @override
+             */
+            this.className = "Enum.Value";
+
+            /**
+             * Unique enum value id.
+             * @type {number}
+             * @expose
+             */
+            this.id = id;
+        };
+
+        // Extends T
+        Value.prototype = Object.create(T.prototype);
+
+        /**
+         * @alias ProtoBuf.Reflect.Enum.Value
+         * @expose
+         */
+        Reflect.Enum.Value = Value;
+
+        /**
+         * An extension (field).
+         * @exports ProtoBuf.Reflect.Extension
+         * @constructor
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.T} parent Parent object
+         * @param {string} name Object name
+         * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
+         */
+        var Extension = function(builder, parent, name, field) {
+            T.call(this, builder, parent, name);
+
+            /**
+             * Extended message field.
+             * @type {!ProtoBuf.Reflect.Message.Field}
+             * @expose
+             */
+            this.field = field;
+        };
+
+        // Extends T
+        Extension.prototype = Object.create(T.prototype);
+
+        /**
+         * @alias ProtoBuf.Reflect.Extension
+         * @expose
+         */
+        Reflect.Extension = Extension;
+
+        /**
+         * Constructs a new Service.
+         * @exports ProtoBuf.Reflect.Service
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Namespace} root Root
+         * @param {string} name Service name
+         * @param {Object.<string,*>=} options Options
+         * @constructor
+         * @extends ProtoBuf.Reflect.Namespace
+         */
+        var Service = function(builder, root, name, options) {
+            Namespace.call(this, builder, root, name, options);
+
+            /**
+             * @override
+             */
+            this.className = "Service";
+
+            /**
+             * Built runtime service class.
+             * @type {?function(new:ProtoBuf.Builder.Service)}
+             */
+            this.clazz = null;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Service.prototype
+         * @inner
+         */
+        var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
+
+        /**
+         * Builds the service and returns the runtime counterpart, which is a fully functional class.
+         * @see ProtoBuf.Builder.Service
+         * @param {boolean=} rebuild Whether to rebuild or not
+         * @return {Function} Service class
+         * @throws {Error} If the message cannot be built
+         * @expose
+         */
+        ServicePrototype.build = function(rebuild) {
+            if (this.clazz && !rebuild)
+                return this.clazz;
+
+            // Create the runtime Service class in its own scope
+            return this.clazz = (function(ProtoBuf, T) {
+
+                /**
+                 * Constructs a new runtime Service.
+                 * @name ProtoBuf.Builder.Service
+                 * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
+                 * @class Barebone of all runtime services.
+                 * @constructor
+                 * @throws {Error} If the service cannot be created
+                 */
+                var Service = function(rpcImpl) {
+                    ProtoBuf.Builder.Service.call(this);
+
+                    /**
+                     * Service implementation.
+                     * @name ProtoBuf.Builder.Service#rpcImpl
+                     * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
+                     * @expose
+                     */
+                    this.rpcImpl = rpcImpl || function(name, msg, callback) {
+                        // This is what a user has to implement: A function receiving the method name, the actual message to
+                        // send (type checked) and the callback that's either provided with the error as its first
+                        // argument or null and the actual response message.
+                        setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
+                    };
+                };
+
+                /**
+                 * @alias ProtoBuf.Builder.Service.prototype
+                 * @inner
+                 */
+                var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
+
+                /**
+                 * Asynchronously performs an RPC call using the given RPC implementation.
+                 * @name ProtoBuf.Builder.Service.[Method]
+                 * @function
+                 * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
+                 * @param {ProtoBuf.Builder.Message} req Request
+                 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
+                 *  the error if any and the response either as a pre-parsed message or as its raw bytes
+                 * @abstract
+                 */
+
+                /**
+                 * Asynchronously performs an RPC call using the instance's RPC implementation.
+                 * @name ProtoBuf.Builder.Service#[Method]
+                 * @function
+                 * @param {ProtoBuf.Builder.Message} req Request
+                 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
+                 *  the error if any and the response either as a pre-parsed message or as its raw bytes
+                 * @abstract
+                 */
+
+                var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
+                for (var i=0; i<rpc.length; i++) {
+                    (function(method) {
+
+                        // service#Method(message, callback)
+                        ServicePrototype[method.name] = function(req, callback) {
+                            try {
+                                try {
+                                    // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
+                                    req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
+                                } catch (err) {
+                                    if (!(err instanceof TypeError))
+                                        throw err;
+                                }
+                                if (req === null || typeof req !== 'object')
+                                    throw Error("Illegal arguments");
+                                if (!(req instanceof method.resolvedRequestType.clazz))
+                                    req = new method.resolvedRequestType.clazz(req);
+                                this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
+                                    if (err) {
+                                        callback(err);
+                                        return;
+                                    }
+                                    // Coalesce to empty string when service response has empty content
+                                    if (res === null)
+                                        res = ''
+                                    try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
+                                    if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
+                                        callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
+                                        return;
+                                    }
+                                    callback(null, res);
+                                });
+                            } catch (err) {
+                                setTimeout(callback.bind(this, err), 0);
+                            }
+                        };
+
+                        // Service.Method(rpcImpl, message, callback)
+                        Service[method.name] = function(rpcImpl, req, callback) {
+                            new Service(rpcImpl)[method.name](req, callback);
+                        };
+
+                        if (Object.defineProperty)
+                            Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
+                            Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
+                    })(rpc[i]);
+                }
+
+                // Properties
+
+                /**
+                 * Service options.
+                 * @name ProtoBuf.Builder.Service.$options
+                 * @type {Object.<string,*>}
+                 * @expose
+                 */
+                var $optionsS; // cc needs this
+
+                /**
+                 * Service options.
+                 * @name ProtoBuf.Builder.Service#$options
+                 * @type {Object.<string,*>}
+                 * @expose
+                 */
+                var $options;
+
+                /**
+                 * Reflection type.
+                 * @name ProtoBuf.Builder.Service.$type
+                 * @type {!ProtoBuf.Reflect.Service}
+                 * @expose
+                 */
+                var $typeS;
+
+                /**
+                 * Reflection type.
+                 * @name ProtoBuf.Builder.Service#$type
+                 * @type {!ProtoBuf.Reflect.Service}
+                 * @expose
+                 */
+                var $type;
+
+                if (Object.defineProperty)
+                    Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
+                    Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
+                    Object.defineProperty(Service, "$type", { "value": T }),
+                    Object.defineProperty(ServicePrototype, "$type", { "value": T });
+
+                return Service;
+
+            })(ProtoBuf, this);
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Service
+         * @expose
+         */
+        Reflect.Service = Service;
+
+        /**
+         * Abstract service method.
+         * @exports ProtoBuf.Reflect.Service.Method
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Service} svc Service
+         * @param {string} name Method name
+         * @param {Object.<string,*>=} options Options
+         * @constructor
+         * @extends ProtoBuf.Reflect.T
+         */
+        var Method = function(builder, svc, name, options) {
+            T.call(this, builder, svc, name);
+
+            /**
+             * @override
+             */
+            this.className = "Service.Method";
+
+            /**
+             * Options.
+             * @type {Object.<string, *>}
+             * @expose
+             */
+            this.options = options || {};
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Service.Method.prototype
+         * @inner
+         */
+        var MethodPrototype = Method.prototype = Object.create(T.prototype);
+
+        /**
+         * Builds the method's '$options' property.
+         * @name ProtoBuf.Reflect.Service.Method#buildOpt
+         * @function
+         * @return {Object.<string,*>}
+         */
+        MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
+
+        /**
+         * @alias ProtoBuf.Reflect.Service.Method
+         * @expose
+         */
+        Reflect.Service.Method = Method;
+
+        /**
+         * RPC service method.
+         * @exports ProtoBuf.Reflect.Service.RPCMethod
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Service} svc Service
+         * @param {string} name Method name
+         * @param {string} request Request message name
+         * @param {string} response Response message name
+         * @param {boolean} request_stream Whether requests are streamed
+         * @param {boolean} response_stream Whether responses are streamed
+         * @param {Object.<string,*>=} options Options
+         * @constructor
+         * @extends ProtoBuf.Reflect.Service.Method
+         */
+        var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
+            Method.call(this, builder, svc, name, options);
+
+            /**
+             * @override
+             */
+            this.className = "Service.RPCMethod";
+
+            /**
+             * Request message name.
+             * @type {string}
+             * @expose
+             */
+            this.requestName = request;
+
+            /**
+             * Response message name.
+             * @type {string}
+             * @expose
+             */
+            this.responseName = response;
+
+            /**
+             * Whether requests are streamed
+             * @type {bool}
+             * @expose
+             */
+            this.requestStream = request_stream;
+
+            /**
+             * Whether responses are streamed
+             * @type {bool}
+             * @expose
+             */
+            this.responseStream = response_stream;
+
+            /**
+             * Resolved request message type.
+             * @type {ProtoBuf.Reflect.Message}
+             * @expose
+             */
+            this.resolvedRequestType = null;
+
+            /**
+             * Resolved response message type.
+             * @type {ProtoBuf.Reflect.Message}
+             * @expose
+             */
+            this.resolvedResponseType = null;
+        };
+
+        // Extends Method
+        RPCMethod.prototype = Object.create(Method.prototype);
+
+        /**
+         * @alias ProtoBuf.Reflect.Service.RPCMethod
+         * @expose
+         */
+        Reflect.Service.RPCMethod = RPCMethod;
+
+        return Reflect;
+
+    })(ProtoBuf);
+
+    /**
+     * @alias ProtoBuf.Builder
+     * @expose
+     */
+    ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
+        "use strict";
+
+        /**
+         * Constructs a new Builder.
+         * @exports ProtoBuf.Builder
+         * @class Provides the functionality to build protocol messages.
+         * @param {Object.<string,*>=} options Options
+         * @constructor
+         */
+        var Builder = function(options) {
+
+            /**
+             * Namespace.
+             * @type {ProtoBuf.Reflect.Namespace}
+             * @expose
+             */
+            this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
+
+            /**
+             * Namespace pointer.
+             * @type {ProtoBuf.Reflect.T}
+             * @expose
+             */
+            this.ptr = this.ns;
+
+            /**
+             * Resolved flag.
+             * @type {boolean}
+             * @expose
+             */
+            this.resolved = false;
+
+            /**
+             * The current building result.
+             * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
+             * @expose
+             */
+            this.result = null;
+
+            /**
+             * Imported files.
+             * @type {Array.<string>}
+             * @expose
+             */
+            this.files = {};
+
+            /**
+             * Import root override.
+             * @type {?string}
+             * @expose
+             */
+            this.importRoot = null;
+
+            /**
+             * Options.
+             * @type {!Object.<string, *>}
+             * @expose
+             */
+            this.options = options || {};
+        };
+
+        /**
+         * @alias ProtoBuf.Builder.prototype
+         * @inner
+         */
+        var BuilderPrototype = Builder.prototype;
+
+        // ----- Definition tests -----
+
+        /**
+         * Tests if a definition most likely describes a message.
+         * @param {!Object} def
+         * @returns {boolean}
+         * @expose
+         */
+        Builder.isMessage = function(def) {
+            // Messages require a string name
+            if (typeof def["name"] !== 'string')
+                return false;
+            // Messages do not contain values (enum) or rpc methods (service)
+            if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
+                return false;
+            return true;
+        };
+
+        /**
+         * Tests if a definition most likely describes a message field.
+         * @param {!Object} def
+         * @returns {boolean}
+         * @expose
+         */
+        Builder.isMessageField = function(def) {
+            // Message fields require a string rule, name and type and an id
+            if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
+                return false;
+            return true;
+        };
+
+        /**
+         * Tests if a definition most likely describes an enum.
+         * @param {!Object} def
+         * @returns {boolean}
+         * @expose
+         */
+        Builder.isEnum = function(def) {
+            // Enums require a string name
+            if (typeof def["name"] !== 'string')
+                return false;
+            // Enums require at least one value
+            if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
+                return false;
+            return true;
+        };
+
+        /**
+         * Tests if a definition most likely describes a service.
+         * @param {!Object} def
+         * @returns {boolean}
+         * @expose
+         */
+        Builder.isService = function(def) {
+            // Services require a string name and an rpc object
+            if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
+                return false;
+            return true;
+        };
+
+        /**
+         * Tests if a definition most likely describes an extended message
+         * @param {!Object} def
+         * @returns {boolean}
+         * @expose
+         */
+        Builder.isExtend = function(def) {
+            // Extends rquire a string ref
+            if (typeof def["ref"] !== 'string')
+                return false;
+            return true;
+        };
+
+        // ----- Building -----
+
+        /**
+         * Resets the pointer to the root namespace.
+         * @returns {!ProtoBuf.Builder} this
+         * @expose
+         */
+        BuilderPrototype.reset = function() {
+            this.ptr = this.ns;
+            return this;
+        };
+
+        /**
+         * Defines a namespace on top of the current pointer position and places the pointer on it.
+         * @param {string} namespace
+         * @return {!ProtoBuf.Builder} this
+         * @expose
+         */
+        BuilderPrototype.define = function(namespace) {
+            if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
+                throw Error("illegal namespace: "+namespace);
+            namespace.split(".").forEach(function(part) {
+                var ns = this.ptr.getChild(part);
+                if (ns === null) // Keep existing
+                    this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
+                this.ptr = ns;
+            }, this);
+            return this;
+        };
+
+        /**
+         * Creates the specified definitions at the current pointer position.
+         * @param {!Array.<!Object>} defs Messages, enums or services to create
+         * @returns {!ProtoBuf.Builder} this
+         * @throws {Error} If a message definition is invalid
+         * @expose
+         */
+        BuilderPrototype.create = function(defs) {
+            if (!defs)
+                return this; // Nothing to create
+            if (!Array.isArray(defs))
+                defs = [defs];
+            else {
+                if (defs.length === 0)
+                    return this;
+                defs = defs.slice();
+            }
+
+            // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
+            var stack = [defs];
+            while (stack.length > 0) {
+                defs = stack.pop();
+
+                if (!Array.isArray(defs)) // Stack always contains entire namespaces
+                    throw Error("not a valid namespace: "+JSON.stringify(defs));
+
+                while (defs.length > 0) {
+                    var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
+
+                    if (Builder.isMessage(def)) {
+                        var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
+
+                        // Create OneOfs
+                        var oneofs = {};
+                        if (def["oneofs"])
+                            Object.keys(def["oneofs"]).forEach(function(name) {
+                                obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
+                            }, this);
+
+                        // Create fields
+                        if (def["fields"])
+                            def["fields"].forEach(function(fld) {
+                                if (obj.getChild(fld["id"]|0) !== null)
+                                    throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
+                                if (fld["options"] && typeof fld["options"] !== 'object')
+                                    throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
+                                var oneof = null;
+                                if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
+                                    throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
+                                fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
+                                if (oneof)
+                                    oneof.fields.push(fld);
+                                obj.addChild(fld);
+                            }, this);
+
+                        // Push children to stack
+                        var subObj = [];
+                        if (def["enums"])
+                            def["enums"].forEach(function(enm) {
+                                subObj.push(enm);
+                            });
+                        if (def["messages"])
+                            def["messages"].forEach(function(msg) {
+                                subObj.push(msg);
+                            });
+                        if (def["services"])
+                            def["services"].forEach(function(svc) {
+                                subObj.push(svc);
+                            });
+
+                        // Set extension ranges
+                        if (def["extensions"]) {
+                            if (typeof def["extensions"][0] === 'number') // pre 5.0.1
+                                obj.extensions = [ def["extensions"] ];
+                            else
+                                obj.extensions = def["extensions"];
+                        }
+
+                        // Create on top of current namespace
+                        this.ptr.addChild(obj);
+                        if (subObj.length > 0) {
+                            stack.push(defs); // Push the current level back
+                            defs = subObj; // Continue processing sub level
+                            subObj = null;
+                            this.ptr = obj; // And move the pointer to this namespace
+                            obj = null;
+                            continue;
+                        }
+                        subObj = null;
+
+                    } else if (Builder.isEnum(def)) {
+
+                        obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
+                        def["values"].forEach(function(val) {
+                            obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
+                        }, this);
+                        this.ptr.addChild(obj);
+
+                    } else if (Builder.isService(def)) {
+
+                        obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
+                        Object.keys(def["rpc"]).forEach(function(name) {
+                            var mtd = def["rpc"][name];
+                            obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
+                        }, this);
+                        this.ptr.addChild(obj);
+
+                    } else if (Builder.isExtend(def)) {
+
+                        obj = this.ptr.resolve(def["ref"], true);
+                        if (obj) {
+                            def["fields"].forEach(function(fld) {
+                                if (obj.getChild(fld['id']|0) !== null)
+                                    throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
+                                // Check if field id is allowed to be extended
+                                if (obj.extensions) {
+                                    var valid = false;
+                                    obj.extensions.forEach(function(range) {
+                                        if (fld["id"] >= range[0] && fld["id"] <= range[1])
+                                            valid = true;
+                                    });
+                                    if (!valid)
+                                        throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
+                                }
+                                // Convert extension field names to camel case notation if the override is set
+                                var name = fld["name"];
+                                if (this.options['convertFieldsToCamelCase'])
+                                    name = ProtoBuf.Util.toCamelCase(name);
+                                // see #161: Extensions use their fully qualified name as their runtime key and...
+                                var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
+                                // ...are added on top of the current namespace as an extension which is used for
+                                // resolving their type later on (the extension always keeps the original name to
+                                // prevent naming collisions)
+                                var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
+                                field.extension = ext;
+                                this.ptr.addChild(ext);
+                                obj.addChild(field);
+                            }, this);
+
+                        } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
+                            throw Error("extended message "+def["ref"]+" is not defined");
+
+                    } else
+                        throw Error("not a valid definition: "+JSON.stringify(def));
+
+                    def = null;
+                    obj = null;
+                }
+                // Break goes here
+                defs = null;
+                this.ptr = this.ptr.parent; // Namespace done, continue at parent
+            }
+            this.resolved = false; // Require re-resolve
+            this.result = null; // Require re-build
+            return this;
+        };
+
+        /**
+         * Propagates syntax to all children.
+         * @param {!Object} parent
+         * @inner
+         */
+        function propagateSyntax(parent) {
+            if (parent['messages']) {
+                parent['messages'].forEach(function(child) {
+                    child["syntax"] = parent["syntax"];
+                    propagateSyntax(child);
+                });
+            }
+            if (parent['enums']) {
+                parent['enums'].forEach(function(child) {
+                    child["syntax"] = parent["syntax"];
+                });
+            }
+        }
+
+        /**
+         * Imports another definition into this builder.
+         * @param {Object.<string,*>} json Parsed import
+         * @param {(string|{root: string, file: string})=} filename Imported file name
+         * @returns {!ProtoBuf.Builder} this
+         * @throws {Error} If the definition or file cannot be imported
+         * @expose
+         */
+        BuilderPrototype["import"] = function(json, filename) {
+            var delim = '/';
+
+            // Make sure to skip duplicate imports
+
+            if (typeof filename === 'string') {
+
+                if (ProtoBuf.Util.IS_NODE)
+                    filename = require("path")['resolve'](filename);
+                if (this.files[filename] === true)
+                    return this.reset();
+                this.files[filename] = true;
+
+            } else if (typeof filename === 'object') { // Object with root, file.
+
+                var root = filename.root;
+                if (ProtoBuf.Util.IS_NODE)
+                    root = require("path")['resolve'](root);
+                if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
+                    delim = '\\';
+                var fname;
+                if (ProtoBuf.Util.IS_NODE)
+                    fname = require("path")['join'](root, filename.file);
+                else
+                    fname = root + delim + filename.file;
+                if (this.files[fname] === true)
+                    return this.reset();
+                this.files[fname] = true;
+            }
+
+            // Import imports
+
+            if (json['imports'] && json['imports'].length > 0) {
+                var importRoot,
+                    resetRoot = false;
+
+                if (typeof filename === 'object') { // If an import root is specified, override
+
+                    this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
+                    importRoot = this.importRoot;
+                    filename = filename["file"];
+                    if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
+                        delim = '\\';
+
+                } else if (typeof filename === 'string') {
+
+                    if (this.importRoot) // If import root is overridden, use it
+                        importRoot = this.importRoot;
+                    else { // Otherwise compute from filename
+                        if (filename.indexOf("/") >= 0) { // Unix
+                            importRoot = filename.replace(/\/[^\/]*$/, "");
+                            if (/* /file.proto */ importRoot === "")
+                                importRoot = "/";
+                        } else if (filename.indexOf("\\") >= 0) { // Windows
+                            importRoot = filename.replace(/\\[^\\]*$/, "");
+                            delim = '\\';
+                        } else
+                            importRoot = ".";
+                    }
+
+                } else
+                    importRoot = null;
+
+                for (var i=0; i<json['imports'].length; i++) {
+                    if (typeof json['imports'][i] === 'string') { // Import file
+                        if (!importRoot)
+                            throw Error("cannot determine import root");
+                        var importFilename = json['imports'][i];
+                        if (importFilename === "google/protobuf/descriptor.proto")
+                            continue; // Not needed and therefore not used
+                        if (ProtoBuf.Util.IS_NODE)
+                            importFilename = require("path")['join'](importRoot, importFilename);
+                        else
+                            importFilename = importRoot + delim + importFilename;
+                        if (this.files[importFilename] === true)
+                            continue; // Already imported
+                        if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto)       // If this is a light build
+                            importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
+                        var contents = ProtoBuf.Util.fetch(importFilename);
+                        if (contents === null)
+                            throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
+                        if (/\.json$/i.test(importFilename)) // Always possible
+                            this["import"](JSON.parse(contents+""), importFilename); // May throw
+                        else
+                            this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
+                    } else // Import structure
+                        if (!filename)
+                            this["import"](json['imports'][i]);
+                        else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
+                            this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
+                        else // Without extension: Append _importN to make it unique
+                            this["import"](json['imports'][i], filename+"_import"+i);
+                }
+                if (resetRoot) // Reset import root override when all imports are done
+                    this.importRoot = null;
+            }
+
+            // Import structures
+
+            if (json['package'])
+                this.define(json['package']);
+            if (json['syntax'])
+                propagateSyntax(json);
+            var base = this.ptr;
+            if (json['options'])
+                Object.keys(json['options']).forEach(function(key) {
+                    base.options[key] = json['options'][key];
+                });
+            if (json['messages'])
+                this.create(json['messages']),
+                this.ptr = base;
+            if (json['enums'])
+                this.create(json['enums']),
+                this.ptr = base;
+            if (json['services'])
+                this.create(json['services']),
+                this.ptr = base;
+            if (json['extends'])
+                this.create(json['extends']);
+
+            return this.reset();
+        };
+
+        /**
+         * Resolves all namespace objects.
+         * @throws {Error} If a type cannot be resolved
+         * @returns {!ProtoBuf.Builder} this
+         * @expose
+         */
+        BuilderPrototype.resolveAll = function() {
+            // Resolve all reflected objects
+            var res;
+            if (this.ptr == null || typeof this.ptr.type === 'object')
+                return this; // Done (already resolved)
+
+            if (this.ptr instanceof Reflect.Namespace) { // Resolve children
+
+                this.ptr.children.forEach(function(child) {
+                    this.ptr = child;
+                    this.resolveAll();
+                }, this);
+
+            } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
+
+                if (!Lang.TYPE.test(this.ptr.type)) {
+                    if (!Lang.TYPEREF.test(this.ptr.type))
+                        throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
+                    res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
+                    if (!res)
+                        throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
+                    this.ptr.resolvedType = res;
+                    if (res instanceof Reflect.Enum) {
+                        this.ptr.type = ProtoBuf.TYPES["enum"];
+                        if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
+                            throw Error("proto3 message cannot reference proto2 enum");
+                    }
+                    else if (res instanceof Reflect.Message)
+                        this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
+                    else
+                        throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
+                } else
+                    this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
+
+                // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
+                // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
+                if (this.ptr.map) {
+                    if (!Lang.TYPE.test(this.ptr.keyType))
+                        throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
+                    this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
+                }
+
+                // If it's a repeated and packable field then proto3 mandates it should be packed by
+                // default
+                if (
+                  this.ptr.syntax === 'proto3' &&
+                  this.ptr.repeated && this.ptr.options.packed === undefined &&
+                  ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1
+                ) {
+                  this.ptr.options.packed = true;
+                }
+
+            } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
+
+                if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
+                    res = this.ptr.parent.resolve(this.ptr.requestName, true);
+                    if (!res || !(res instanceof ProtoBuf.Reflect.Message))
+                        throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
+                    this.ptr.resolvedRequestType = res;
+                    res = this.ptr.parent.resolve(this.ptr.responseName, true);
+                    if (!res || !(res instanceof ProtoBuf.Reflect.Message))
+                        throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
+                    this.ptr.resolvedResponseType = res;
+                } else // Should not happen as nothing else is implemented
+                    throw Error("illegal service type in "+this.ptr.toString(true));
+
+            } else if (
+                !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
+                !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
+                !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
+            )
+                throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
+
+            return this.reset();
+        };
+
+        /**
+         * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
+         * return the built package.
+         * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
+         * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
+         * @throws {Error} If a type could not be resolved
+         * @expose
+         */
+        BuilderPrototype.build = function(path) {
+            this.reset();
+            if (!this.resolved)
+                this.resolveAll(),
+                this.resolved = true,
+                this.result = null; // Require re-build
+            if (this.result === null) // (Re-)Build
+                this.result = this.ns.build();
+            if (!path)
+                return this.result;
+            var part = typeof path === 'string' ? path.split(".") : path,
+                ptr = this.result; // Build namespace pointer (no hasChild etc.)
+            for (var i=0; i<part.length; i++)
+                if (ptr[part[i]])
+                    ptr = ptr[part[i]];
+                else {
+                    ptr = null;
+                    break;
+                }
+            return ptr;
+        };
+
+        /**
+         * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
+         * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
+         * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
+         * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
+         */
+        BuilderPrototype.lookup = function(path, excludeNonNamespace) {
+            return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
+        };
+
+        /**
+         * Returns a string representation of this object.
+         * @return {string} String representation as of "Builder"
+         * @expose
+         */
+        BuilderPrototype.toString = function() {
+            return "Builder";
+        };
+
+        // ----- Base classes -----
+        // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
+
+        /**
+         * @alias ProtoBuf.Builder.Message
+         */
+        Builder.Message = function() {};
+
+        /**
+         * @alias ProtoBuf.Builder.Enum
+         */
+        Builder.Enum = function() {};
+
+        /**
+         * @alias ProtoBuf.Builder.Message
+         */
+        Builder.Service = function() {};
+
+        return Builder;
+
+    })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
+
+    /**
+     * @alias ProtoBuf.Map
+     * @expose
+     */
+    ProtoBuf.Map = (function(ProtoBuf, Reflect) {
+        "use strict";
+
+        /**
+         * Constructs a new Map. A Map is a container that is used to implement map
+         * fields on message objects. It closely follows the ES6 Map API; however,
+         * it is distinct because we do not want to depend on external polyfills or
+         * on ES6 itself.
+         *
+         * @exports ProtoBuf.Map
+         * @param {!ProtoBuf.Reflect.Field} field Map field
+         * @param {Object.<string,*>=} contents Initial contents
+         * @constructor
+         */
+        var Map = function(field, contents) {
+            if (!field.map)
+                throw Error("field is not a map");
+
+            /**
+             * The field corresponding to this map.
+             * @type {!ProtoBuf.Reflect.Field}
+             */
+            this.field = field;
+
+            /**
+             * Element instance corresponding to key type.
+             * @type {!ProtoBuf.Reflect.Element}
+             */
+            this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
+
+            /**
+             * Element instance corresponding to value type.
+             * @type {!ProtoBuf.Reflect.Element}
+             */
+            this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
+
+            /**
+             * Internal map: stores mapping of (string form of key) -> (key, value)
+             * pair.
+             *
+             * We provide map semantics for arbitrary key types, but we build on top
+             * of an Object, which has only string keys. In order to avoid the need
+             * to convert a string key back to its native type in many situations,
+             * we store the native key value alongside the value. Thus, we only need
+             * a one-way mapping from a key type to its string form that guarantees
+             * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
+             * === K2).
+             *
+             * @type {!Object<string, {key: *, value: *}>}
+             */
+            this.map = {};
+
+            /**
+             * Returns the number of elements in the map.
+             */
+            Object.defineProperty(this, "size", {
+                get: function() { return Object.keys(this.map).length; }
+            });
+
+            // Fill initial contents from a raw object.
+            if (contents) {
+                var keys = Object.keys(contents);
+                for (var i = 0; i < keys.length; i++) {
+                    var key = this.keyElem.valueFromString(keys[i]);
+                    var val = this.valueElem.verifyValue(contents[keys[i]]);
+                    this.map[this.keyElem.valueToString(key)] =
+                        { key: key, value: val };
+                }
+            }
+        };
+
+        var MapPrototype = Map.prototype;
+
+        /**
+         * Helper: return an iterator over an array.
+         * @param {!Array<*>} arr the array
+         * @returns {!Object} an iterator
+         * @inner
+         */
+        function arrayIterator(arr) {
+            var idx = 0;
+            return {
+                next: function() {
+                    if (idx < arr.length)
+                        return { done: false, value: arr[idx++] };
+                    return { done: true };
+                }
+            }
+        }
+
+        /**
+         * Clears the map.
+         */
+        MapPrototype.clear = function() {
+            this.map = {};
+        };
+
+        /**
+         * Deletes a particular key from the map.
+         * @returns {boolean} Whether any entry with this key was deleted.
+         */
+        MapPrototype["delete"] = function(key) {
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
+            var hadKey = keyValue in this.map;
+            delete this.map[keyValue];
+            return hadKey;
+        };
+
+        /**
+         * Returns an iterator over [key, value] pairs in the map.
+         * @returns {Object} The iterator
+         */
+        MapPrototype.entries = function() {
+            var entries = [];
+            var strKeys = Object.keys(this.map);
+            for (var i = 0, entry; i < strKeys.length; i++)
+                entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
+            return arrayIterator(entries);
+        };
+
+        /**
+         * Returns an iterator over keys in the map.
+         * @returns {Object} The iterator
+         */
+        MapPrototype.keys = function() {
+            var keys = [];
+            var strKeys = Object.keys(this.map);
+            for (var i = 0; i < strKeys.length; i++)
+                keys.push(this.map[strKeys[i]].key);
+            return arrayIterator(keys);
+        };
+
+        /**
+         * Returns an iterator over values in the map.
+         * @returns {!Object} The iterator
+         */
+        MapPrototype.values = function() {
+            var values = [];
+            var strKeys = Object.keys(this.map);
+            for (var i = 0; i < strKeys.length; i++)
+                values.push(this.map[strKeys[i]].value);
+            return arrayIterator(values);
+        };
+
+        /**
+         * Iterates over entries in the map, calling a function on each.
+         * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
+         * @param {Object=} thisArg The `this` value for the callback
+         */
+        MapPrototype.forEach = function(cb, thisArg) {
+            var strKeys = Object.keys(this.map);
+            for (var i = 0, entry; i < strKeys.length; i++)
+                cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
+        };
+
+        /**
+         * Sets a key in the map to the given value.
+         * @param {*} key The key
+         * @param {*} value The value
+         * @returns {!ProtoBuf.Map} The map instance
+         */
+        MapPrototype.set = function(key, value) {
+            var keyValue = this.keyElem.verifyValue(key);
+            var valValue = this.valueElem.verifyValue(value);
+            this.map[this.keyElem.valueToString(keyValue)] =
+                { key: keyValue, value: valValue };
+            return this;
+        };
+
+        /**
+         * Gets the value corresponding to a key in the map.
+         * @param {*} key The key
+         * @returns {*|undefined} The value, or `undefined` if key not present
+         */
+        MapPrototype.get = function(key) {
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
+            if (!(keyValue in this.map))
+                return undefined;
+            return this.map[keyValue].value;
+        };
+
+        /**
+         * Determines whether the given key is present in the map.
+         * @param {*} key The key
+         * @returns {boolean} `true` if the key is present
+         */
+        MapPrototype.has = function(key) {
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
+            return (keyValue in this.map);
+        };
+
+        return Map;
+    })(ProtoBuf, ProtoBuf.Reflect);
+
+
+    /**
+     * Loads a .proto string and returns the Builder.
+     * @param {string} proto .proto file contents
+     * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
+     * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
+     * @return {ProtoBuf.Builder} Builder to create new messages
+     * @throws {Error} If the definition cannot be parsed or built
+     * @expose
+     */
+    ProtoBuf.loadProto = function(proto, builder, filename) {
+        if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
+            filename = builder,
+            builder = undefined;
+        return ProtoBuf.loadJson(ProtoBuf.DotProto.Parser.parse(proto), builder, filename);
+    };
+
+    /**
+     * Loads a .proto string and returns the Builder. This is an alias of {@link ProtoBuf.loadProto}.
+     * @function
+     * @param {string} proto .proto file contents
+     * @param {(ProtoBuf.Builder|string)=} builder Builder to append to. Will create a new one if omitted.
+     * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
+     * @return {ProtoBuf.Builder} Builder to create new messages
+     * @throws {Error} If the definition cannot be parsed or built
+     * @expose
+     */
+    ProtoBuf.protoFromString = ProtoBuf.loadProto; // Legacy
+
+    /**
+     * Loads a .proto file and returns the Builder.
+     * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with
+     *  an overridden 'root' path for all imported files.
+     * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
+     *  the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
+     *  file will be read synchronously and this function will return the Builder.
+     * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
+     * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
+     *   request has failed), else undefined
+     * @expose
+     */
+    ProtoBuf.loadProtoFile = function(filename, callback, builder) {
+        if (callback && typeof callback === 'object')
+            builder = callback,
+            callback = null;
+        else if (!callback || typeof callback !== 'function')
+            callback = null;
+        if (callback)
+            return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
+                if (contents === null) {
+                    callback(Error("Failed to fetch file"));
+                    return;
+                }
+                try {
+                    callback(null, ProtoBuf.loadProto(contents, builder, filename));
+                } catch (e) {
+                    callback(e);
+                }
+            });
+        var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
+        return contents === null ? null : ProtoBuf.loadProto(contents, builder, filename);
+    };
+
+    /**
+     * Loads a .proto file and returns the Builder. This is an alias of {@link ProtoBuf.loadProtoFile}.
+     * @function
+     * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with
+     *  an overridden 'root' path for all imported files.
+     * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
+     *  the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
+     *  file will be read synchronously and this function will return the Builder.
+     * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
+     * @return {!ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
+     *   request has failed), else undefined
+     * @expose
+     */
+    ProtoBuf.protoFromFile = ProtoBuf.loadProtoFile; // Legacy
+
+
+    /**
+     * Constructs a new empty Builder.
+     * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
+     * @return {!ProtoBuf.Builder} Builder
+     * @expose
+     */
+    ProtoBuf.newBuilder = function(options) {
+        options = options || {};
+        if (typeof options['convertFieldsToCamelCase'] === 'undefined')
+            options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
+        if (typeof options['populateAccessors'] === 'undefined')
+            options['populateAccessors'] = ProtoBuf.populateAccessors;
+        return new ProtoBuf.Builder(options);
+    };
+
+    /**
+     * Loads a .json definition and returns the Builder.
+     * @param {!*|string} json JSON definition
+     * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
+     * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
+     * @return {ProtoBuf.Builder} Builder to create new messages
+     * @throws {Error} If the definition cannot be parsed or built
+     * @expose
+     */
+    ProtoBuf.loadJson = function(json, builder, filename) {
+        if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
+            filename = builder,
+            builder = null;
+        if (!builder || typeof builder !== 'object')
+            builder = ProtoBuf.newBuilder();
+        if (typeof json === 'string')
+            json = JSON.parse(json);
+        builder["import"](json, filename);
+        builder.resolveAll();
+        return builder;
+    };
+
+    /**
+     * Loads a .json file and returns the Builder.
+     * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
+     *  an overridden 'root' path for all imported files.
+     * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
+     *  the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
+     *  file will be read synchronously and this function will return the Builder.
+     * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
+     * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
+     *   request has failed), else undefined
+     * @expose
+     */
+    ProtoBuf.loadJsonFile = function(filename, callback, builder) {
+        if (callback && typeof callback === 'object')
+            builder = callback,
+            callback = null;
+        else if (!callback || typeof callback !== 'function')
+            callback = null;
+        if (callback)
+            return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
+                if (contents === null) {
+                    callback(Error("Failed to fetch file"));
+                    return;
+                }
+                try {
+                    callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
+                } catch (e) {
+                    callback(e);
+                }
+            });
+        var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
+        return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
+    };
+
+    return ProtoBuf;
+});
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.eot b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.eot new file mode 100644 index 0000000..5d20d91 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.eot differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.svg b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.svg new file mode 100644 index 0000000..3ed7be4 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.woff b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.woff new file mode 100644 index 0000000..1205787 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.woff differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.eot b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.eot new file mode 100644 index 0000000..1f639a1 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.eot differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.svg b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.svg new file mode 100644 index 0000000..6a2607b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.woff b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.woff new file mode 100644 index 0000000..ed760c0 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.woff differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.eot b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.eot new file mode 100644 index 0000000..0c8a0ae Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.eot differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.svg b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.svg new file mode 100644 index 0000000..e1075dc --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.woff b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.woff new file mode 100644 index 0000000..ff652e6 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.woff differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.eot b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.eot new file mode 100644 index 0000000..1486840 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.eot differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.svg b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.svg new file mode 100644 index 0000000..11a472c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.woff b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.woff new file mode 100644 index 0000000..e786074 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.woff differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.eot b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.eot new file mode 100644 index 0000000..8f44592 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.eot differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.svg b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.svg new file mode 100644 index 0000000..431d7e3 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.svg @@ -0,0 +1,1835 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.woff b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.woff new file mode 100644 index 0000000..43e8b9e Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.woff differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.eot b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.eot new file mode 100644 index 0000000..6bbc3cf Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.eot differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.svg b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.svg new file mode 100644 index 0000000..25a3952 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.woff b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.woff new file mode 100644 index 0000000..e231183 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.woff differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/index.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/index.html new file mode 100644 index 0000000..3493d2f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/index.html @@ -0,0 +1,65 @@ + + + + + JSDoc: Home + + + + + + + + + + +
+ +

Home

+ + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/linenumber.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/linenumber.js new file mode 100644 index 0000000..8d52f7e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/linenumber.js @@ -0,0 +1,25 @@ +/*global document */ +(function() { + var source = document.getElementsByClassName('prettyprint source linenums'); + var i = 0; + var lineNumber = 0; + var lineId; + var lines; + var totalLines; + var anchorHash; + + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; + + for (; i < totalLines; i++) { + lineNumber++; + lineId = 'line' + lineNumber; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } + } +})(); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/prettify/Apache-License-2.0.txt b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + 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/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/prettify/lang-css.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/prettify/lang-css.js new file mode 100644 index 0000000..041e1f5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/prettify/lang-css.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", +/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/prettify/prettify.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/prettify/prettify.js new file mode 100644 index 0000000..eef5ad7 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/scripts/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"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"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"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"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"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"], +J=[v,"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"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"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"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["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"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["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"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"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",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"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", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p p:first-child, +.props td.description > p:first-child +{ + margin-top: 0; + padding-top: 0; +} + +.params td.description > p:last-child, +.props td.description > p:last-child +{ + margin-bottom: 0; + padding-bottom: 0; +} + +.disabled { + color: #454545; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/styles/prettify-jsdoc.css b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/styles/prettify-jsdoc.css new file mode 100644 index 0000000..5a2526e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/styles/prettify-tomorrow.css b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/styles/prettify-tomorrow.css new file mode 100644 index 0000000..b6f92a7 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/docs/styles/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@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; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/donate.png b/legacy-libs/grpc-cloned/node_modules/protobufjs/donate.png new file mode 100644 index 0000000..207d001 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/donate.png differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/README.md b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/README.md new file mode 100644 index 0000000..e82333b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/README.md @@ -0,0 +1,28 @@ +ProtoBuf.js protoify example +============================ +This example shows the general usage of ProtoBuf.js by converting JSON structures to protocol buffers and vice versa +using a definition describing JSON itself. While this works as an example, it does not provide any real world benefits +(well, this is if you are not building a protobuf-backed database for JSON data, using inter-field substitution to +minimize redundancy - nevermind, forget that). + +Instructions +------------ +1. Set up dependencies: `npm install` +2. Run: `npm test` + +Now you know no more and no less than that it works and you might want to inspect the following files to get the 'how': + +* **[index.js](https://github.com/dcodeIO/ProtoBuf.js/blob/master/examples/protoify/index.js)** + contains the sample's source code + +* **[json.proto](https://github.com/dcodeIO/ProtoBuf.js/blob/master/examples/protoify/json.proto)** + contains the protobuf definition used + +* **[json.json](https://github.com/dcodeIO/ProtoBuf.js/blob/master/examples/protoify/json.json)** + contains the protobuf definition converted through `proto2js json.proto > json.json` + +* **[json.js](https://github.com/dcodeIO/ProtoBuf.js/blob/master/examples/protoify/json.js)** + contains the protobuf definition converted through `proto2js json.proto -commonjs=js > json.js` + +* **[test.js](https://github.com/dcodeIO/ProtoBuf.js/blob/master/examples/protoify/test.js)** + contains our simple test suite diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/index.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/index.js new file mode 100644 index 0000000..94f066a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/index.js @@ -0,0 +1,147 @@ +var ProtoBuf = require("protobufjs"), + ByteBuffer = ProtoBuf.ByteBuffer, // ProtoBuf.js uses and also exposes ByteBuffer.js + Long = ProtoBuf.Long; // as well as Long.js (not used in this example) + +// Option 1: Loading the .proto file directly +var builder = ProtoBuf.loadProtoFile("./json.proto"), // Creates the Builder + JS = builder.build("js"); // Returns just the 'js' namespace if that's all we need + +// Option 2: Loading the .json file generated through 'proto2js json.proto > json.json' +var root = ProtoBuf.loadJsonFile("./json.json").build(), // Here we make the Builder return the root namespace + JS = root.js; // then we reference 'js' inside. Both is possible. + +// Option 3: Loading the module generated through 'proto2js json.proto -commonjs=js > json.js' +var JS = require("./json.js"); // Returns what is specified with -commonjs[=XX] (omitted=root) + +// `JS` now contains the js namespace from json.proto: Value, Array and Object + +// This is how we use these classes: + +/** + * Converts a JSON-like structure to JS-Namespace values. + * @param {*} val JSON + * @returns {!JS.Value} JS-Namespace value + * @inner + */ +function _protoify(val) { + switch (typeof val) { + case 'number': + if (val%1 === 0 && val >= (0x80000000|0) && val <= (0x7fffffff|0)) + return new JS.Value(val); // sets the first field declared in .js.Value + else + return new JS.Value(null, val); // sets the second field + case 'string': + return new JS.Value({ 'string': val }); // uses object notation instead + case 'boolean': + return new JS.Value({ 'boolean': val }); + case 'object': + if (val === null) + return new JS.Value({ 'null': true }); + if (Object.prototype.toString.call(val) === "[object Array]") { + var arr = new JS.Array(); + for (var i=0; i 2048) + tempBuffer = ByteBuffer.allocate(1024); + // In case this module is running inside of a daemon, we'd just call this + // method every now and then to discard the tempBuffer if it becomes too + // large. This is just an example on how to reuse ByteBuffers effectively. + // You may consider something like this for the performance benefit, which + // is decreasing the memory allocation footprint of your app. +}; + +// Have a nice day! diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/json.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/json.js new file mode 100644 index 0000000..3f78846 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/json.js @@ -0,0 +1,123 @@ +module.exports = require("protobufjs").newBuilder({})["import"]({ + "package": "js", + "messages": [ + { + "name": "Value", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "sint32", + "name": "integer", + "id": 1, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "double", + "name": "double", + "id": 2, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "string", + "id": 3, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "boolean", + "id": 4, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "null", + "id": 5, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "Array", + "name": "array", + "id": 6, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "Object", + "name": "object", + "id": 7, + "oneof": "type" + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": { + "type": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ] + } + }, + { + "name": "Array", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "values", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Object", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "keys", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "values", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] +}).build("js"); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/json.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/json.json new file mode 100644 index 0000000..26ed18f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/json.json @@ -0,0 +1,123 @@ +{ + "package": "js", + "messages": [ + { + "name": "Value", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "sint32", + "name": "integer", + "id": 1, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "double", + "name": "double", + "id": 2, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "string", + "id": 3, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "boolean", + "id": 4, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "null", + "id": 5, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "Array", + "name": "array", + "id": 6, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "Object", + "name": "object", + "id": 7, + "oneof": "type" + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": { + "type": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ] + } + }, + { + "name": "Array", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "values", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Object", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "keys", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "values", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/json.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/json.proto new file mode 100644 index 0000000..d543392 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/json.proto @@ -0,0 +1,30 @@ +// Everything below is located in the js-namespace +package js; + +// Represents a JavaScript value. +// Contains exactly one or zero fields. +message Value { + oneof type { + sint32 integer = 1; + double double = 2; + string string = 3; + bool boolean = 4; + bool null = 5; + Array array = 6; + Object object = 7; + // if none is set: undefined + } +} + +// Represents a JavaScript array. +// Contains zero to N values. +message Array { + repeated Value values = 1; +} + +// Represents a JavaScript object. +// Contains zero to N keys with associated values. +message Object { + repeated Value keys = 1; + repeated Value values = 2; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/package.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/package.json new file mode 100644 index 0000000..f03b843 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/package.json @@ -0,0 +1,15 @@ +{ + "name": "protobufjs-protoify-example", + "version": "1.0.0", + "main": "index.js", + "dependencies": { + "protobufjs": "~3.7" + }, + "engines": { + "node": ">=0.8" + }, + "scripts": { + "test": "node test.js" + }, + "private": true +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/test.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/test.js new file mode 100644 index 0000000..c6c9e0d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/protoify/test.js @@ -0,0 +1,56 @@ +var protoify = require("./index.js"), + ByteBuffer = require("protobufjs").ByteBuffer, + assert = require("assert"); + +// Array of samples to test +var samples = [ + 1, -1, 0x80000000|0, 0x7fffffff|0, // Integers + 0.1, 0.2, 1.234, // Doubles + "John", // String + true, false, // Booleans + null, // null + [], // Array + {}, // Object + undefined, // undefined + [ // Array holding each data type + 1, + 0.1, + "John", + true, + false, + null, + [], + {}, + undefined + ], + { // Object holding each data type + 1: 1, + 0.1: 0.1, + "John": "John", + true: true, + false: false, + null: null, + array: [], + object: {}, + undefined: undefined + } +]; + +samples.forEach(function(sample) { + // Encode each sample to a Buffer + var buf = protoify(sample); + + // Print some nice debugging information + console.log(JSON.stringify(sample)); + console.log("-------------------------------------------------------------------"); + console.log(ByteBuffer.wrap(buf).toDebug(true)); + + // Decode the Buffer back to JSON + var decodedSample = protoify.parse(buf); + + // And assert that it's actually equal + assert.deepEqual(decodedSample, sample); +}); + +// If no assertion errors are thrown, print +console.log("OK"); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/websocket/README.md b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/websocket/README.md new file mode 100644 index 0000000..6a2c403 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/websocket/README.md @@ -0,0 +1,9 @@ +ProtoBuf.js WebSocket example +============================= +This example shows how to use binary websockets to transfer protocol buffers. + +Instructions +------------ +1. Set up dependencies: `npm install` +2. Run: `node server.js` +3. Open [http://localhost:8080/](http://localhost:8080/) in a recent browser diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/websocket/package.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/websocket/package.json new file mode 100644 index 0000000..3090d31 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/websocket/package.json @@ -0,0 +1,16 @@ +{ + "name": "protobufjs-websocket-example", + "version": "1.1.0", + "dependencies": { + "protobufjs": "~3", + "ws": "~0.4", + "open": "0.0.3" + }, + "engines": { + "node": ">=0.8" + }, + "scripts": { + "run": "node server.js" + }, + "private": true +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/websocket/server.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/websocket/server.js new file mode 100644 index 0000000..514cb15 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/examples/websocket/server.js @@ -0,0 +1,97 @@ +// Set up: npm install +var http = require("http"), + fs = require("fs"), + path = require("path"), + ws = require("ws"), + open = require("open"), + ProtoBuf = require("protobufjs"); + +// Copy dependencies to "www/" (example specific, you usually don't have to care +var deps = [ + ["Long.min.js", "./node_modules/long/dist/Long.min.js"], + ["ByteBufferAB.min.js", "./node_modules/bytebuffer/dist/ByteBufferAB.min.js"], + ["ProtoBuf.min.js", "./node_modules/protobufjs/dist/ProtoBuf.min.js"] +]; +for (var i=0, dep, data; i + + + + + + + + +
+ + + + + diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/externs/fs.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/externs/fs.js new file mode 100644 index 0000000..04b422d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/externs/fs.js @@ -0,0 +1,644 @@ +/* + * Copyright 2012 The Closure Compiler 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. + */ + +/** + * @fileoverview Definitions for node's "fs" module. + * @see http://nodejs.org/api/fs.html + * @externs + * @author Daniel Wirtz + */ + +/** + BEGIN_NODE_INCLUDE + var fs = require('fs'); + END_NODE_INCLUDE + */ + +var fs = {}; + +/** + * @param {string} oldPath + * @param {string} newPath + * @param {function(...)=} callback + */ +fs.rename = function(oldPath, newPath, callback) {}; + +/** + * @param {string} oldPath + * @param {string} newPath + */ +fs.renameSync = function(oldPath, newPath) {}; + +/** + * @param {*} fd + * @param {number} len + * @param {function(...)=} callback + */ +fs.truncate = function(fd, len, callback) {}; + +/** + * @param {*} fd + * @param {number} len + */ +fs.truncateSync = function(fd, len) {}; + +/** + * @param {string} path + * @param {number} uid + * @param {number} gid + * @param {function(...)=} callback + */ +fs.chown = function(path, uid, gid, callback) {}; + +/** + * @param {string} path + * @param {number} uid + * @param {number} gid + */ +fs.chownSync = function(path, uid, gid) {}; + +/** + * @param {*} fd + * @param {number} uid + * @param {number} gid + * @param {function(...)=} callback + */ +fs.fchown = function(fd, uid, gid, callback) {}; + +/** + * @param {*} fd + * @param {number} uid + * @param {number} gid + */ +fs.fchownSync = function(fd, uid, gid) {}; + +/** + * @param {string} path + * @param {number} uid + * @param {number} gid + * @param {function(...)=} callback + */ +fs.lchown = function(path, uid, gid, callback) {}; + +/** + * @param {string} path + * @param {number} uid + * @param {number} gid + */ +fs.lchownSync = function(path, uid, gid) {}; + +/** + * @param {string} path + * @param {number} mode + * @param {function(...)=} callback + */ +fs.chmod = function(path, mode, callback) {}; + +/** + * @param {string} path + * @param {number} mode + */ +fs.chmodSync = function(path, mode) {}; + +/** + * @param {*} fd + * @param {number} mode + * @param {function(...)=} callback + */ +fs.fchmod = function(fd, mode, callback) {}; + +/** + * @param {*} fd + * @param {number} mode + */ +fs.fchmodSync = function(fd, mode) {}; + +/** + * @param {string} path + * @param {number} mode + * @param {function(...)=} callback + */ +fs.lchmod = function(path, mode, callback) {}; + +/** + * @param {string} path + * @param {number} mode + */ +fs.lchmodSync = function(path, mode) {}; + +/** + * @param {string} path + * @param {function(string, fs.Stats)=} callback + * @nosideeffects + */ +fs.stat = function(path, callback) {}; + +/** + * @param {string} path + * @return {fs.Stats} + * @nosideeffects + */ +fs.statSync = function(path) {} + +/** + * @param {*} fd + * @param {function(string, fs.Stats)=} callback + * @nosideeffects + */ +fs.fstat = function(fd, callback) {}; + +/** + * @param {*} fd + * @return {fs.Stats} + * @nosideeffects + */ +fs.fstatSync = function(fd) {} + +/** + * @param {string} path + * @param {function(string, fs.Stats)=} callback + * @nosideeffects + */ +fs.lstat = function(path, callback) {}; + +/** + * @param {string} path + * @return {fs.Stats} + * @nosideeffects + */ +fs.lstatSync = function(path) {} + +/** + * @param {string} srcpath + * @param {string} dstpath + * @param {function(...)=} callback + */ +fs.link = function(srcpath, dstpath, callback) {}; + +/** + * @param {string} srcpath + * @param {string} dstpath + */ +fs.linkSync = function(srcpath, dstpath) {}; + +/** + * @param {string} srcpath + * @param {string} dstpath + * @param {string=} type + * @param {function(...)=} callback + */ +fs.symlink = function(srcpath, dstpath, type, callback) {}; + +/** + * @param {string} srcpath + * @param {string} dstpath + * @param {string=} type + */ +fs.symlinkSync = function(srcpath, dstpath, type) {}; + +/** + * @param {string} path + * @param {function(string, string)=} callback + * @nosideeffects + */ +fs.readlink = function(path, callback) {}; + +/** + * @param {string} path + * @return {string} + * @nosideeffects + */ +fs.readlinkSync = function(path) {}; + +/** + * @param {string} path + * @param {object.=|function(string, string)=} cache + * @param {function(string, string)=} callback + * @nosideeffects + */ +fs.realpath = function(path, cache, callback) {}; + +/** + * @param {string} path + * @param {object.=} cache + * @return {string} + * @nosideeffects + */ +fs.realpathSync = function(path, cache) {}; + +/** + * @param {string} path + * @param {function(...)=} callback + */ +fs.unlink = function(path, callback) {}; + +/** + * @param {string} path + */ +fs.unlinkSync = function(path) {}; + +/** + * @param {string} path + * @param {function(...)=} callback + */ +fs.rmdir = function(path, callback) {}; + +/** + * @param {string} path + */ +fs.rmdirSync = function(path) {}; + +/** + * @param {string} path + * @param {number=} mode + * @param {function(...)=} callback + */ +fs.mkdir = function(path, mode, callback) {}; + +/** + * @param {string} path + * @param {number=} mode + */ +fs.mkdirSync = function(path, mode) {}; + +/** + * @param {string} path + * @param {function(string,array.)=} callback + * @nosideeffects + */ +fs.readdir = function(path, callback) {}; + +/** + * @param {string} path + * @return {array.} + * @nosideeffects + */ +fs.readdirSync = function(path) {}; + +/** + * @param {*} fd + * @param {function(...)=} callback + */ +fs.close = function(fd, callback) {}; + +/** + * @param {*} fd + */ +fs.closeSync = function(fd) {}; + +/** + * @param {string} path + * @param {string} flags + * @param {number=} mode + * @param {function(string, *)=} callback + * @nosideeffects + */ +fs.open = function(path, flags, mode, callback) {}; + +/** + * @param {string} path + * @param {string} flags + * @param {number=} mode + * @return {*} + * @nosideeffects + */ +fs.openSync = function(path, flags, mode) {}; + +/** + * @param {string} path + * @param {number} atime + * @param {number} mtime + * @param {function(...)=} callback + * @nosideeffects + */ +fs.utimes = function(path, atime, mtime, callback) {}; + +/** + * @param {string} path + * @param {number} atime + * @param {number} mtime + * @nosideeffects + */ +fs.utimesSync = function(path, atime, mtime) {}; + +/** + * @param {*} fd + * @param {number} atime + * @param {number} mtime + * @param {function(...)=} callback + * @nosideeffects + */ +fs.futimes = function(fd, atime, mtime, callback) {}; + +/** + * @param {*} fd + * @param {number} atime + * @param {number} mtime + * @nosideeffects + */ +fs.futimesSync = function(fd, atime, mtime) {}; + +/** + * @param {*} fd + * @param {function(...)=} callback + */ +fs.fsync = function(fd, callback) {}; + +/** + * @param {*} fd + */ +fs.fsyncSync = function(fd) {}; + +/** + * @param {*} fd + * @param {*} buffer + * @param {number} offset + * @param {number} length + * @param {number} position + * @param {function(string, number, *)=} callback + */ +fs.write = function(fd, buffer, offset, length, position, callback) {}; + +/** + * @param {*} fd + * @param {*} buffer + * @param {number} offset + * @param {number} length + * @param {number} position + * @return {number} + */ +fs.writeSync = function(fd, buffer, offset, length, position) {}; + +/** + * @param {*} fd + * @param {*} buffer + * @param {number} offset + * @param {number} length + * @param {number} position + * @param {function(string, number, *)=} callback + * @nosideeffects + */ +fs.read = function(fd, buffer, offset, length, position, callback) {}; + +/** + * @param {*} fd + * @param {*} buffer + * @param {number} offset + * @param {number} length + * @param {number} position + * @return {number} + * @nosideeffects + */ +fs.readSync = function(fd, buffer, offset, length, position) {}; + +/** + * @param {string} filename + * @param {string=|function(string, *)=}encoding + * @param {function(string, *)=} callback + * @nosideeffects + */ +fs.readFile = function(filename, encoding, callback) {}; + +/** + * @param {string} filename + * @param {string=} encoding + * @nosideeffects + */ +fs.readFileSync = function(filename, encoding) {}; + +/** + * @param {string} filename + * @param {*} data + * @param {string=|function(string)=} encoding + * @param {function(string)=} callback + */ +fs.writeFile = function(filename, data, encoding, callback) {}; + +/** + * @param {string} filename + * @param {*} data + * @param {string=} encoding + */ +fs.writeFileSync = function(filename, data, encoding) {}; + +/** + * @param {string} filename + * @param {*} data + * @param {string=|function(string)=} encoding + * @param {function(string)=} callback + */ +fs.appendFile = function(filename, data, encoding, callback) {}; + +/** + * @param {string} filename + * @param {*} data + * @param {string=|function(string)=} encoding + */ +fs.appendFileSync = function(filename, data, encoding) {}; + +/** + * @param {string} filename + * @param {{persistent: boolean, interval: number}=|function(*,*)} options + * @param {function(*,*)=} listener + */ +fs.watchFile = function(filename, options, listener) {}; + +/** + * @param {string} filename + * @param {function=} listener + */ +fs.unwatchFile = function(filename, listener) {}; + +/** + * + * @param {string} filename + * @param {{persistent: boolean}=|function(string, string)} options + * @param {function(string, string)=} listener + * @return {fs.FSWatcher} + */ +fs.watch = function(filename, options, listener) {}; + +/** + * @param {string} path + * @param {function(boolean)} callback + * @nosideeffects + */ +fs.exists = function(path, callback) {}; + +/** + * @param {string} path + * @nosideeffects + */ +fs.existsSync = function(path) {}; + +/** + * @constructor + */ +fs.Stats = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isFile = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isDirectory = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isBlockDevice = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isCharacterDevice = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isSymbolicLink = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isFIFO = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isSocket = function() {}; + +/** + * @type {number} + */ +fs.Stats.prototype.dev = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.ino = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.mode = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.nlink = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.uid = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.gid = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.rdev = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.size = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.blkSize = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.blocks = 0; + +/** + * @type {Date} + */ +fs.Stats.prototype.atime = 0; + +/** + * @type {Date} + */ +fs.Stats.prototype.mtime = 0; + +/** + * @type {Date} + */ +fs.Stats.prototype.ctime = 0; + +/** + * @param {string} path + * @param {{flags: string, encoding: ?string, fd: *, mode: number, bufferSize: number}=} options + * @nosideeffects + */ +fs.createReadStream = function(path, options) {}; + +/** + * @constructor + * @extends {stream.ReadableStream} + */ +fs.ReadStream = function() {}; + +/** + * @param {string} path + * @param {{flags: string, encoding: ?string, mode: number}=} options + * @nosideeffects + */ +fs.createWriteStream = function(path, options) {}; + +/** + * @constructor + * @extends {stream.WritableStream} + */ +fs.WriteStream = function() {}; + +/** + * @param {string} event + * @param {function(...)} callback + */ +fs.WriteStream.prototype.on = function(event, callback) {}; + +/** + * @constructor + */ +fs.FSWatcher = function() {}; + +/** + */ +fs.FSWatcher.prototype.close = function() {}; + +/** + * @param {string} event + * @param {function(...)} callback + */ +fs.FSWatcher.prototype.on = function(event, callback) {}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/externs/protobuf.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/externs/protobuf.js new file mode 100644 index 0000000..a2ad4d1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/externs/protobuf.js @@ -0,0 +1,933 @@ +/* + * Copyright 2012 The Closure Compiler 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. + */ + +/** + * @fileoverview Externs for ProtoBuf.js. + * @see https://github.com/dcodeIO/ProtoBuf.js + * @externs + */ + +/** + BEGIN_NODE_INCLUDE + var ProtoBuf = require('protobufjs'); + END_NODE_INCLUDE + */ + +/** + * @typedef {Array} + */ +var Buffer; + +/** + * @typedef {Object} + */ +var dcodeIO; + +/** + * {@type Object.} + */ +var ProtoBuf = {}; + +/** + * @type {string} + * @const + */ +ProtoBuf.VERSION; + +/** + * @type {!Object.} + * @const + */ +ProtoBuf.WIRE_TYPES = {}; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.VARINT; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.BITS64; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.LDELIM; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.STARTGROUP; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.ENDGROUP; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.BITS32; + +/** + * @type {!Array.} + * @const + */ +ProtoBuf.PACKABLE_WIRE_TYPES; + +/** + * @type {boolean} + */ +ProtoBuf.convertFieldsToCamelCase; + +/** + * @type {boolean} + */ +ProtoBuf.populateAccessors; + +/** + * @dict + * @type {!Object} + * @const + */ +ProtoBuf.TYPES; + +/** + * @type {number} + */ +ProtoBuf.ID_MIN; + +/** + * @type {number} + */ +ProtoBuf.ID_MAX; + +/** + * @type {!function(new: ByteBuffer, ...*)} + */ +ProtoBuf.ByteBuffer; + +/** + * @type {?function(new: Long, ...*)} + */ +ProtoBuf.Long; + +/** + * @type {!Object} + */ +ProtoBuf.Lang; + +/** + * @type {Object} + */ +ProtoBuf.DotProto; + +/** + * @param {string} proto + * @constructor + */ +ProtoBuf.DotProto.Tokenizer = function(proto) {}; + +/** + * @type {string} + */ +ProtoBuf.DotProto.Tokenizer.prototype.source; + +/** + * @type {number} + */ +ProtoBuf.DotProto.Tokenizer.prototype.index; + +/** + * @type {number} + */ +ProtoBuf.DotProto.Tokenizer.prototype.line; + +/** + * @type {Array.} + */ +ProtoBuf.DotProto.Tokenizer.prototype.stack; + +/** + * @type {boolean} + */ +ProtoBuf.DotProto.Tokenizer.prototype.readingString; + +/** + * @return {?string} + * @throws {Error} + */ +ProtoBuf.DotProto.Tokenizer.prototype.next = function() {}; + +/** + * @return {?string} + * @throws {Error} + */ +ProtoBuf.DotProto.Tokenizer.prototype.peek = function() {}; + +/** + * @return {string} + * @nosideeffects + */ +ProtoBuf.DotProto.Tokenizer.prototype.toString = function() {}; + +/** + * @param {string} proto + * @constructor + */ +ProtoBuf.DotProto.Parser = function(proto) {}; + +/** + * @type {!ProtoBuf.DotProto.Tokenizer} + */ +ProtoBuf.DotProto.Parser.prototype.tn; + +/** + * @return {{package: (string|null), messages: Array., enums: Array., imports: Array., options: Object}} + * @throws {Error} + */ +ProtoBuf.DotProto.Parser.prototype.parse = function() {}; + +/** + * @return {string} + * @nosideeffects + */ +ProtoBuf.DotProto.Parser.prototype.toString = function() {}; + +/** + * @type {Object} + */ +ProtoBuf.Reflect.Reflect = {}; + +/** + * @constructor + * @param {ProtoBuf.Reflect.T} parent + * @param {string} name Object name + */ +ProtoBuf.Reflect.T = function(parent, name) {}; + +/** + * @type {?ProtoBuf.Reflect.T} + */ +ProtoBuf.Reflect.T.prototype.parent; + +/** + * @type {string} + */ +ProtoBuf.Reflect.T.prototype.name; + +/** + * @returns {string} + * @nosideeffects + */ +ProtoBuf.Reflect.T.prototype.fqn = function() {}; + +/** + * @param {boolean=} includeClass + * @returns {string} + * @nosideeffects + */ +ProtoBuf.Reflect.T.prototype.toString = function(includeClass) {}; + +/** + * @throws {Error} + */ +ProtoBuf.Reflect.T.prototype.build = function() {}; + +/** + * @param {?ProtoBuf.Reflect.Namespace} parent + * @param {string} name + * @constructor + * @extends ProtoBuf.Reflect.T + */ +ProtoBuf.Reflect.Namespace = function(parent, name) {}; + +/** + * @type {Array.} + */ +ProtoBuf.Reflect.Namespace.prototype.children; + +/** + * @param {ProtoBuf.Reflect.T=} type + * @return {Array.} + * @nosideeffects + */ +ProtoBuf.Reflect.Namespace.prototype.getChildren = function(type) {}; + +/** + * @param {ProtoBuf.Reflect.T} child + * @throws {Error} + */ +ProtoBuf.Reflect.Namespace.prototype.addChild = function(child) {}; + +/** + * @param {string|number} nameOrId + * @returns {boolean} + * @nosideeffects + */ +ProtoBuf.Reflect.Namespace.prototype.hasChild = function(nameOrId) {}; + +/** + * @param {string|number} nameOrId + * @return {?ProtoBuf.Reflect.T} + * @nosideeffects + */ +ProtoBuf.Reflect.Namespace.prototype.getChild = function(nameOrId) {}; + +/** + * @param {string} qn + * @param {boolean=} excludeFields + * @return {?ProtoBuf.Reflect.Namespace} + * @nosideeffects + */ +ProtoBuf.Reflect.Namespace.prototype.resolve = function(qn, excludeFields) {}; + +/** + * @return {Object.} + */ +ProtoBuf.Reflect.Namespace.prototype.build = function() {}; + +/** + * @param {!ProtoBuf.Reflect.Namespace} parent + * @param {string} name + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +ProtoBuf.Reflect.Message = function(parent, name) {}; + +/** + * @type {?Array.} + */ +ProtoBuf.Reflect.Message.prototype.extensions; + +/** + * @type {?ProtoBuf.Builder.Message} + */ +ProtoBuf.Reflect.Message.prototype.clazz; + +/** + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.build = function() {}; + +/** + * @param {!ProtoBuf.Builder.Message} message + * @param {!ByteBuffer} buffer + * @return {!ByteBuffer} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.encode = function(message, buffer) {}; + +/** + * @param {!ProtoBuf.Builder.Message} message + * @return {number} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.calculate = function(message) {}; + +/** + * @param {!ProtoBuf.Builder.Message} message + * @param {!ByteBuffer} buffer + * @param {boolean} noVerify + * @return {!ByteBuffer} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.encodeDelimited = function(message, buffer, noVerify) {}; + +/** + * @param {!ByteBuffer} buffer + * @param {number=} length + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.decode = function(buffer, length) {}; + +/** + * @param {!ByteBuffer} buffer + * @param {number=} length + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.decodeDelimited = function(buffer, length) {}; + +/** + * @param {!ProtoBuf.Reflect.Message} message + * @param {string} rule + * @param {string} type + * @param {string} name + * @param {number} id + * @param {Object=} options + * @constructor + * @extends ProtoBuf.Reflect.T + */ +ProtoBuf.Reflect.Message.Field = function(message, rule, type, name, id, options) {}; + +/** + * @type {boolean} + */ +ProtoBuf.Reflect.Message.Field.prototype.required; + +/** + * @type {boolean} + */ +ProtoBuf.Reflect.Message.Field.prototype.repeated; + +/** + * @type {string|{name: string, wireType: number}} + */ +ProtoBuf.Reflect.Message.Field.prototype.type; + +/** + * @type {number} + */ +ProtoBuf.Reflect.Message.Field.prototype.id; + +/** + * @type {!Object.} + */ +ProtoBuf.Reflect.Message.Field.prototype.options; + +/** + * @type {?ProtoBuf.Reflect.T} + */ +ProtoBuf.Reflect.Message.Field.prototype.resolvedType; + +/** + * @type {string} + */ +ProtoBuf.Reflect.Message.Field.prototype.originalName; + +/** + * @param {*} value + * @param {boolean=} skipRepeated + * @return {*} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Reflect.Message.Field.prototype.verifyValue = function(value, skipRepeated) {}; + +/** + * @param {*} value + * @param {!ByteBuffer} buffer + * @return {!ByteBuffer} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.Field.prototype.encode = function(value, buffer) {}; + +/** + * @param {*} value + * @return {number} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Reflect.Message.Field.prototype.calculate = function(value) {}; + +/** + * @param {number} wireType + * @param {!ByteBuffer} buffer + * @return {*} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.Field.prototype.decode = function(wireType, buffer) {}; + +/** + * @param {*} value + * @param {!ByteBuffer} buffer + * @return {!ByteBuffer} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.Field.prototype.encodeValue = function(value, buffer) {}; + +/** + * @param {!ProtoBuf.Reflect.T} parent + * @param {string} name + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +ProtoBuf.Reflect.Enum = function(parent, name) {}; + +/** + * @return {Object} + */ +ProtoBuf.Reflect.Enum.prototype.build = function() {}; + +/** + * @type {?Object.} + */ +ProtoBuf.Reflect.Enum.prototype.object; + +/** + * @param {!ProtoBuf.Reflect.Enum} enm + * @param {string} name + * @param {number} id + * @constructor + * @extends ProtoBuf.Reflect.T + */ +ProtoBuf.Reflect.Enum.Value = function(enm, name, id) {}; + +/** + * @type {number} + */ +ProtoBuf.Reflect.Enum.Value.prototype.id; + +/** + * @param {!ProtoBuf.Reflect.Namespace} root + * @param {string} name Service name + * @param {Object.=} options + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +ProtoBuf.Reflect.Service = function(root, name, options) {}; + +/** + * @type {ProtoBuf.Builder.Service} + */ +ProtoBuf.Reflect.Service.prototype.clazz; + +/** + * @return {!ProtoBuf.Builder.Service} + * @throws {Error} + */ +ProtoBuf.Reflect.Service.prototype.build = function() {}; + +/** + * @param {!ProtoBuf.Reflect.Service} svc + * @param {string} name + * @param {Object.=} options + * @constructor + * @extends ProtoBuf.Reflect.T + */ +ProtoBuf.Reflect.Service.Method = function(svc, name, options) {}; + +/** + * @return {Object.} + */ +ProtoBuf.Reflect.Service.Method.prototype.buildOpt = function() {}; + +/** + * @param {!ProtoBuf.Reflect.Service} svc + * @param {string} name + * @param {string} request + * @param {string} response + * @param {Object.=} options + * @constructor + * @extends ProtoBuf.Reflect.Service.Method + */ +ProtoBuf.Reflect.Service.RPCMethod = function(svc, name, request, response, options) {}; + +/** + * @type {string} + */ +ProtoBuf.Reflect.Service.RPCMethod.prototype.requestName; + +/** + * @type {string} + */ +ProtoBuf.Reflect.Service.RPCMethod.prototype.responseName; + +/** + * @type {ProtoBuf.Reflect.Message} + */ +ProtoBuf.Reflect.Service.RPCMethod.prototype.resolvedRequestType; + +/** + * @type {ProtoBuf.Reflect.Message} + */ +ProtoBuf.Reflect.Service.RPCMethod.prototype.resolvedResponseType; + +/** + * @constructor + */ +ProtoBuf.Builder = function() {}; + +/** + * @type {!ProtoBuf.Reflect.Namespace} + */ +ProtoBuf.Builder.prototype.ns; + +/** + * @type {?ProtoBuf.Reflect.T} + */ +ProtoBuf.Builder.prototype.ptr; + +/** + * @type {boolean} + */ +ProtoBuf.Builder.prototype.resolved; + +/** + * @type {Object.|null} + */ +ProtoBuf.Builder.prototype.result; + +/** + * @type {Array.} + */ +ProtoBuf.Builder.prototype.files; + +/** + * @type {?string} + */ +ProtoBuf.Builder.prototype.importRoot; + +/** + */ +ProtoBuf.Builder.prototype.reset = function() {}; + +/** + * @param {string} pkg + * @return {!ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.Builder.prototype.define = function(pkg) {}; + +/** + * @param {Object.} def + * @return {boolean} + * @nosideeffects + */ +ProtoBuf.Builder.isValidMessage = function(def) {}; + +/** + * @param {Object.} def + * @return {boolean} + * @nosideeffects + */ +ProtoBuf.Builder.isValidMessageField = function(def) {}; + +/** + * @param {Object.} def + * @return {boolean} + */ +ProtoBuf.Builder.isValidEnum = function(def) {}; + +/** + * @param {Object.} def + * @return {boolean} + */ +ProtoBuf.Builder.isValidService = function(def) {}; + +/** + * @param {Object.} def + * @return {boolean} + */ +ProtoBuf.Builder.isValidExtend = function(def) {}; + +/** + * @param {Array.>} messages + * @return {ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.Builder.prototype.create = function(messages) {}; + +/** + * @name ProtoBuf.Builder.prototype.import + * @function + * @param {ProtoBuf.Builder} builder + * @param {(string|{root: string, file: string})=} filename + * @return {!ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.Builder.prototype["import"] = function(builder, filename) {}; + +/** + * @throws {Error} + */ +ProtoBuf.Builder.prototype.resolveAll = function() {}; + +/** + * @param {string=} path + * @return {ProtoBuf.Builder.Message|Object.} + * @throws {Error} + */ +ProtoBuf.Builder.prototype.build = function(path) {}; + +/** + * @param {string=} path + * @return {?ProtoBuf.Reflect.T} + */ +ProtoBuf.Builder.prototype.lookup = function(path) {}; + +/** + * @return {string} + * @nosideeffects + */ +ProtoBuf.Builder.prototype.toString = function() {}; + +/** + * @param {Object.} values + * @constructor + * @throws {Error} + */ +ProtoBuf.Builder.Message = function(values) {}; + +/** + * @param {string} key + * @param {*} value + * @param {boolean=} noAssert + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.add = function(key, value, noAssert) {}; + +/** + * @param {string} key + * @param {*} value + * @param {boolean=} noAssert + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.$add = function(key, value, noAssert) {}; + +/** + * @param {string} key + * @param {*} value + * @param {boolean=} noAssert + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.set = function(key, value, noAssert) {}; + +/** + * @param {string} key + * @param {*} value + * @param {boolean=} noAssert + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.$set = function(key, value, noAssert) {}; + +/** + * @param {string} key + * @return {*} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.get = function(key) {}; + +/** + * @param {string} key + * @return {*} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.$get = function(key) {}; + +/** + * @param {ByteBuffer=} buffer + * @return {!ByteBuffer} + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.encode = function(buffer) {}; + +/** + * @return {number} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.calculate = function() {}; + +/** + * @return {!ArrayBuffer} + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.encodeAB = function() {}; + +/** + * @return {!ArrayBuffer} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toArrayBuffer = function() {}; + +/** + * @return {!Buffer} + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.encodeNB = function() {}; + +/** + * @return {!Buffer} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toBuffer = function() {}; + +/** + * @return {string} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.encode64 = function() {}; + +/** + * @return {string} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toBase64 = function() {}; + +/** + * @return {string} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.encodeHex = function() {}; + +/** + * @return {string} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toHex = function() {}; + +/** + * @param {boolean=} includeBuffers + * @return {Object.} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toRaw = function(includeBuffers) {}; + +/** + * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer + * @param {string=} enc + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.decode = function(buffer, enc) {}; + +/** + * @param {string} str + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.decode64 = function(str) {}; + +/** + * @param {string} str + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.decodeHex = function(str) {}; + +/** + * @return {string} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toString = function() {}; + +/** + * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl + * @constructor + */ +ProtoBuf.Builder.Service = function(rpcImpl) {}; + +/** + * @type {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} + */ +ProtoBuf.Builder.prototype.rpcImpl; + +/** + * @param {string} proto + * @param {(ProtoBuf.Builder|string)=} builder + * @param {(string|{root: string, file: string})=} filename + * @return {!ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.loadProto = function(proto, builder, filename) {}; + +/** + * @param {string} proto + * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder + * @param {(string|{root: string, file: string})=} filename + * @return {!ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.protoFromString = function(proto, builder, filename) {}; + +/** + * @param {string|{root: string, file: string}} filename + * @param {(function(ProtoBuf.Builder)|ProtoBuf.Builder)=} callback + * @param {ProtoBuf.Builder=} builder + * @return {ProtoBuf.Builder|undefined} + * @throws {Error} + */ +ProtoBuf.loadProtoFile = function(filename, callback, builder) {}; + +/** + * @param {string|{root: string, file: string}} filename + * @param {(function(ProtoBuf.Builder)|ProtoBuf.Builder)=} callback + * @param {ProtoBuf.Builder=} builder + * @return {ProtoBuf.Builder|undefined} + * @throws {Error} + */ +ProtoBuf.protoFromFile = function(filename, callback, builder) {}; + +/** + * @param {!*|string} json + * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder + * @param {(string|{root: string, file: string})=} filename + * @return {!ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.loadJson = function(json, builder, filename) {}; + +/** + * @param {string|{root: string, file: string}} filename + * @param {(function(ProtoBuf.Builder)|ProtoBuf.Builder)=} callback + * @param {ProtoBuf.Builder=} builder + * @return {ProtoBuf.Builder|undefined} + * @throws {Error} + */ +ProtoBuf.loadJsonFile = function(filename, callback, builder) {}; + +/** + * @param {string=} pkg + * @return {!ProtoBuf.Builder} + */ +ProtoBuf.newBuilder = function(pkg) {}; + +ProtoBuf.Util = {}; + +/** + * @type {boolean} + */ +ProtoBuf.Util.IS_NODE; + +/** + * @return {XMLHttpRequest} + */ +ProtoBuf.Util.XHR = function() {}; + +/** + * @param {string} path + * @param {function(?string)=} callback + * @return {?string|undefined} + */ +ProtoBuf.Util.fetch = function(path, callback) {}; + +/** + * @param {*} obj + * @return {boolean} + */ +ProtoBuf.Util.isArray = function(obj) {}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/index.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/index.js new file mode 100644 index 0000000..989d3b0 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/index.js @@ -0,0 +1 @@ +module.exports = require("./dist/protobuf.js"); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/jsdoc.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/jsdoc.json new file mode 100644 index 0000000..5527efd --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/jsdoc.json @@ -0,0 +1,12 @@ +{ + "tags": { + "allowUnknownTags": true + }, + "source": { + "include": ["dist/protobuf.js"] + }, + "opts": { + "destination": "docs" + }, + "plugins": ["plugins/markdown"] +} \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/package.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/package.json new file mode 100644 index 0000000..0b6a196 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/package.json @@ -0,0 +1,135 @@ +{ + "_args": [ + [ + { + "raw": "protobufjs@^5.0.3", + "scope": null, + "escapedName": "protobufjs", + "name": "protobufjs", + "rawSpec": "^5.0.3", + "spec": ">=5.0.3 <6.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/grpc" + ] + ], + "_from": "protobufjs@>=5.0.3 <6.0.0", + "_id": "protobufjs@5.0.3", + "_inCache": true, + "_location": "/grpc/protobufjs", + "_nodeVersion": "8.9.1", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/protobufjs_5.0.3_1526462497935_0.23118861557345283" + }, + "_npmUser": { + "name": "dcode", + "email": "dcode+npm@dcode.io" + }, + "_npmVersion": "5.5.1", + "_phantomChildren": {}, + "_requested": { + "raw": "protobufjs@^5.0.3", + "scope": null, + "escapedName": "protobufjs", + "name": "protobufjs", + "rawSpec": "^5.0.3", + "spec": ">=5.0.3 <6.0.0", + "type": "range" + }, + "_requiredBy": [ + "/grpc" + ], + "_resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz", + "_shasum": "e4dfe9fb67c90b2630d15868249bcc4961467a17", + "_shrinkwrap": null, + "_spec": "protobufjs@^5.0.3", + "_where": "/var/opt/motion2/node_modules/grpc", + "author": { + "name": "Daniel Wirtz", + "email": "dcode@dcode.io" + }, + "bin": { + "pbjs": "./bin/pbjs" + }, + "browser": { + "fs": false, + "path": false + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "contributors": [ + { + "name": "Frank Xu", + "email": "yyfrankyy@gmail.com" + } + ], + "dependencies": { + "ascli": "~1", + "bytebuffer": "~5", + "glob": "^7.0.5", + "yargs": "^3.10.0" + }, + "description": "Protocol Buffers for JavaScript. Finally.", + "devDependencies": { + "closurecompiler": "~1", + "fixture-stdout": "^0.2.1", + "jsdoc": "~3.3.0-alpha10", + "metascript": ">=0.18 <1", + "testjs": "~1 >=1.0.4" + }, + "directories": {}, + "dist": { + "integrity": "sha512-55Kcx1MhPZX0zTbVosMQEO5R6/rikNXd9b6RQK4KSPcrSIIwoXTtebIczUrXlwaSrbz4x8XUVThGPob1n8I4QA==", + "shasum": "e4dfe9fb67c90b2630d15868249bcc4961467a17", + "tarball": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz", + "fileCount": 189, + "unpackedSize": 3128808, + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa+/gjCRA9TVsSAnZWagAA4lAQAIQu/R1fQv2iN0SAWNaR\nDe6nwKeB3BTkxeIB/HNfwzhVEmSepbskJrzx4ZSGlnSKLI/R/RPjh1yvx6dG\nQ1+1ddWcSTbAj85enFcR1WIb3/rV92W+61sba8vh8+yYlPs/HO2aXc7RqjuH\nnWAHJ/WgQItMdiOLbXxtm1s0oFiK2/l9tLVU+xzIIjADzNjPSD/tHZkc4S1a\n7b+6AX0lviG2A9AxyQgF/WLoY8sY7xEHiukE6mFfu0l8c9u0IeM9zx/wtzyB\nPKaBjzjDgEkqbrLGVARuYTOT5oFd/DNESLfkpYRJWsYgTHluY+RUyxCM2n61\nRRSqNedYavPi602su160AQnANLH8wyQG+KSdaPPR9TmCYE+5+B1TZU77jYKL\nyCmwoNi/SV8U9HNESFrgh/lMqizYOyLjfmhdeegEw4+p6fDBcW6//JWRBo2k\no5hQgsgmcSDV3wPrZoRMOC5z1x0hm9DlojZ7lJk5fuoVYjT1/K4BhcM4OFFu\ndy77gZl9MSEQWxMDp8VHPYVCsnEjJtKdqPJgiB9sD9qqM+b9BxC2eiGjh5rw\n5/3zecpFTtdJ0zn4XlFk/JrBTF9+WNTI4akHqWmzOkFmrqdn8d+JgPD+FJph\nfPHLENcZ+AqwDhZhMxV4LKHZ8t2XlhCfvFu26nQ6sfXmpPUfo/Qj5gj5DIcS\nUf1W\r\n=4WLx\r\n-----END PGP SIGNATURE-----\r\n" + }, + "engines": { + "node": ">=0.8" + }, + "gitHead": "2c2ffbc084cb36c971885707c559cccdb242d08f", + "homepage": "https://github.com/dcodeIO/protobuf.js", + "keywords": [ + "net", + "buffer", + "protobuf", + "serialization", + "bytebuffer", + "websocket", + "webrtc" + ], + "license": "Apache-2.0", + "main": "./dist/protobuf.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode@dcode.io" + } + ], + "name": "protobufjs", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/dcodeIO/protobuf.js.git" + }, + "scripts": { + "build": "node scripts/build.js", + "compile": "npm run-script compile-full && npm run-script compile-light", + "compile-full": "ccjs dist/protobuf.js --create_source_map=dist/protobuf.min.map --compilation_level=SIMPLE_OPTIMIZATIONS > dist/protobuf.min.js", + "compile-light": "ccjs dist/protobuf-light.js --create_source_map=dist/protobuf-light.min.map --compilation_level=SIMPLE_OPTIMIZATIONS > dist/protobuf-light.min.js", + "compress": "npm run-script compress-full && npm run-script compress-light", + "compress-full": "gzip -c -9 dist/protobuf.min.js > dist/protobuf.min.js.gz", + "compress-light": "gzip -c -9 dist/protobuf-light.min.js > dist/protobuf-light.min.js.gz", + "descriptor2json": "node bin/pbjs src/google/protobuf/descriptor.proto --target=json > src/google/protobuf/descriptor.json", + "jsdoc": "node node_modules/jsdoc/jsdoc.js -c jsdoc.json", + "make": "npm run-script build && npm run-script compile && npm run-script descriptor2json && npm run-script compress && npm test && npm run-script jsdoc", + "prepublish": "npm test", + "test": "node bin/pbjs tests/complex.proto --target=json > tests/complex.json && node node_modules/testjs/bin/testjs tests/suite.js" + }, + "version": "5.0.3" +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/protobuf.png b/legacy-libs/grpc-cloned/node_modules/protobufjs/protobuf.png new file mode 100644 index 0000000..7569a93 Binary files /dev/null and b/legacy-libs/grpc-cloned/node_modules/protobufjs/protobuf.png differ diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/scripts/build.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/scripts/build.js new file mode 100644 index 0000000..db3ab95 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/scripts/build.js @@ -0,0 +1,53 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 MetaScript = require("metascript"), + path = require("path"), + fs = require("fs"); + +var rootDir = path.join(__dirname, ".."), + srcDir = path.join(rootDir, "src"), + distDir = path.join(rootDir, "dist"), + pkg = require(path.join(rootDir, "package.json")), + filename; + +var scope = { + VERSION: pkg.version, // Version + DOTPROTO: true // Whether to include the ProtoBuf.DotProto package for .proto syntax support +}; + +// Make full build +console.log("Building protobuf.js with scope", JSON.stringify(scope, null, 2)); +fs.writeFileSync( + path.join(distDir, "protobuf.js"), + MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap.js")), filename, scope, srcDir) +); + +// Make light build +scope.DOTPROTO = false; +console.log("Building protobuf-light.js with scope", JSON.stringify(scope, null, 2)); +fs.writeFileSync( + path.join(distDir, "protobuf-light.js"), + MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap.js")), filename, scope, srcDir) +); + +// Update bower.json +scope = { VERSION: pkg.version }; +console.log("Updating bower.json with scope", JSON.stringify(scope, null, 2)); +fs.writeFileSync( + path.join(rootDir, "bower.json"), + MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "bower.json.in")), filename, scope, srcDir) +); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Builder.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Builder.js new file mode 100644 index 0000000..18eeba8 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Builder.js @@ -0,0 +1,634 @@ +/** + * @alias ProtoBuf.Builder + * @expose + */ +ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) { + "use strict"; + + /** + * Constructs a new Builder. + * @exports ProtoBuf.Builder + * @class Provides the functionality to build protocol messages. + * @param {Object.=} options Options + * @constructor + */ + var Builder = function(options) { + + /** + * Namespace. + * @type {ProtoBuf.Reflect.Namespace} + * @expose + */ + this.ns = new Reflect.Namespace(this, null, ""); // Global namespace + + /** + * Namespace pointer. + * @type {ProtoBuf.Reflect.T} + * @expose + */ + this.ptr = this.ns; + + /** + * Resolved flag. + * @type {boolean} + * @expose + */ + this.resolved = false; + + /** + * The current building result. + * @type {Object.|null} + * @expose + */ + this.result = null; + + /** + * Imported files. + * @type {Array.} + * @expose + */ + this.files = {}; + + /** + * Import root override. + * @type {?string} + * @expose + */ + this.importRoot = null; + + /** + * Options. + * @type {!Object.} + * @expose + */ + this.options = options || {}; + }; + + /** + * @alias ProtoBuf.Builder.prototype + * @inner + */ + var BuilderPrototype = Builder.prototype; + + // ----- Definition tests ----- + + /** + * Tests if a definition most likely describes a message. + * @param {!Object} def + * @returns {boolean} + * @expose + */ + Builder.isMessage = function(def) { + // Messages require a string name + if (typeof def["name"] !== 'string') + return false; + // Messages do not contain values (enum) or rpc methods (service) + if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined') + return false; + return true; + }; + + /** + * Tests if a definition most likely describes a message field. + * @param {!Object} def + * @returns {boolean} + * @expose + */ + Builder.isMessageField = function(def) { + // Message fields require a string rule, name and type and an id + if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined') + return false; + return true; + }; + + /** + * Tests if a definition most likely describes an enum. + * @param {!Object} def + * @returns {boolean} + * @expose + */ + Builder.isEnum = function(def) { + // Enums require a string name + if (typeof def["name"] !== 'string') + return false; + // Enums require at least one value + if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0) + return false; + return true; + }; + + /** + * Tests if a definition most likely describes a service. + * @param {!Object} def + * @returns {boolean} + * @expose + */ + Builder.isService = function(def) { + // Services require a string name and an rpc object + if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"]) + return false; + return true; + }; + + /** + * Tests if a definition most likely describes an extended message + * @param {!Object} def + * @returns {boolean} + * @expose + */ + Builder.isExtend = function(def) { + // Extends rquire a string ref + if (typeof def["ref"] !== 'string') + return false; + return true; + }; + + // ----- Building ----- + + /** + * Resets the pointer to the root namespace. + * @returns {!ProtoBuf.Builder} this + * @expose + */ + BuilderPrototype.reset = function() { + this.ptr = this.ns; + return this; + }; + + /** + * Defines a namespace on top of the current pointer position and places the pointer on it. + * @param {string} namespace + * @return {!ProtoBuf.Builder} this + * @expose + */ + BuilderPrototype.define = function(namespace) { + if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace)) + throw Error("illegal namespace: "+namespace); + namespace.split(".").forEach(function(part) { + var ns = this.ptr.getChild(part); + if (ns === null) // Keep existing + this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part)); + this.ptr = ns; + }, this); + return this; + }; + + /** + * Creates the specified definitions at the current pointer position. + * @param {!Array.} defs Messages, enums or services to create + * @returns {!ProtoBuf.Builder} this + * @throws {Error} If a message definition is invalid + * @expose + */ + BuilderPrototype.create = function(defs) { + if (!defs) + return this; // Nothing to create + if (!Array.isArray(defs)) + defs = [defs]; + else { + if (defs.length === 0) + return this; + defs = defs.slice(); + } + + // It's quite hard to keep track of scopes and memory here, so let's do this iteratively. + var stack = [defs]; + while (stack.length > 0) { + defs = stack.pop(); + + if (!Array.isArray(defs)) // Stack always contains entire namespaces + throw Error("not a valid namespace: "+JSON.stringify(defs)); + + while (defs.length > 0) { + var def = defs.shift(); // Namespaces always contain an array of messages, enums and services + + if (Builder.isMessage(def)) { + var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]); + + // Create OneOfs + var oneofs = {}; + if (def["oneofs"]) + Object.keys(def["oneofs"]).forEach(function(name) { + obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name)); + }, this); + + // Create fields + if (def["fields"]) + def["fields"].forEach(function(fld) { + if (obj.getChild(fld["id"]|0) !== null) + throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']); + if (fld["options"] && typeof fld["options"] !== 'object') + throw Error("illegal field options in "+obj.name+"#"+fld["name"]); + var oneof = null; + if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]])) + throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]); + fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]); + if (oneof) + oneof.fields.push(fld); + obj.addChild(fld); + }, this); + + // Push children to stack + var subObj = []; + if (def["enums"]) + def["enums"].forEach(function(enm) { + subObj.push(enm); + }); + if (def["messages"]) + def["messages"].forEach(function(msg) { + subObj.push(msg); + }); + if (def["services"]) + def["services"].forEach(function(svc) { + subObj.push(svc); + }); + + // Set extension ranges + if (def["extensions"]) { + if (typeof def["extensions"][0] === 'number') // pre 5.0.1 + obj.extensions = [ def["extensions"] ]; + else + obj.extensions = def["extensions"]; + } + + // Create on top of current namespace + this.ptr.addChild(obj); + if (subObj.length > 0) { + stack.push(defs); // Push the current level back + defs = subObj; // Continue processing sub level + subObj = null; + this.ptr = obj; // And move the pointer to this namespace + obj = null; + continue; + } + subObj = null; + + } else if (Builder.isEnum(def)) { + + obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]); + def["values"].forEach(function(val) { + obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"])); + }, this); + this.ptr.addChild(obj); + + } else if (Builder.isService(def)) { + + obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]); + Object.keys(def["rpc"]).forEach(function(name) { + var mtd = def["rpc"][name]; + obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"])); + }, this); + this.ptr.addChild(obj); + + } else if (Builder.isExtend(def)) { + + obj = this.ptr.resolve(def["ref"], true); + if (obj) { + def["fields"].forEach(function(fld) { + if (obj.getChild(fld['id']|0) !== null) + throw Error("duplicate extended field id in "+obj.name+": "+fld['id']); + // Check if field id is allowed to be extended + if (obj.extensions) { + var valid = false; + obj.extensions.forEach(function(range) { + if (fld["id"] >= range[0] && fld["id"] <= range[1]) + valid = true; + }); + if (!valid) + throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)"); + } + // Convert extension field names to camel case notation if the override is set + var name = fld["name"]; + if (this.options['convertFieldsToCamelCase']) + name = ProtoBuf.Util.toCamelCase(name); + // see #161: Extensions use their fully qualified name as their runtime key and... + var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]); + // ...are added on top of the current namespace as an extension which is used for + // resolving their type later on (the extension always keeps the original name to + // prevent naming collisions) + var ext = new Reflect.Extension(this, this.ptr, fld["name"], field); + field.extension = ext; + this.ptr.addChild(ext); + obj.addChild(field); + }, this); + + } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions + throw Error("extended message "+def["ref"]+" is not defined"); + + } else + throw Error("not a valid definition: "+JSON.stringify(def)); + + def = null; + obj = null; + } + // Break goes here + defs = null; + this.ptr = this.ptr.parent; // Namespace done, continue at parent + } + this.resolved = false; // Require re-resolve + this.result = null; // Require re-build + return this; + }; + + /** + * Propagates syntax to all children. + * @param {!Object} parent + * @inner + */ + function propagateSyntax(parent) { + if (parent['messages']) { + parent['messages'].forEach(function(child) { + child["syntax"] = parent["syntax"]; + propagateSyntax(child); + }); + } + if (parent['enums']) { + parent['enums'].forEach(function(child) { + child["syntax"] = parent["syntax"]; + }); + } + } + + /** + * Imports another definition into this builder. + * @param {Object.} json Parsed import + * @param {(string|{root: string, file: string})=} filename Imported file name + * @returns {!ProtoBuf.Builder} this + * @throws {Error} If the definition or file cannot be imported + * @expose + */ + BuilderPrototype["import"] = function(json, filename) { + var delim = '/'; + + // Make sure to skip duplicate imports + + if (typeof filename === 'string') { + + if (ProtoBuf.Util.IS_NODE) + filename = require("path")['resolve'](filename); + if (this.files[filename] === true) + return this.reset(); + this.files[filename] = true; + + } else if (typeof filename === 'object') { // Object with root, file. + + var root = filename.root; + if (ProtoBuf.Util.IS_NODE) + root = require("path")['resolve'](root); + if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0) + delim = '\\'; + var fname; + if (ProtoBuf.Util.IS_NODE) + fname = require("path")['join'](root, filename.file); + else + fname = root + delim + filename.file; + if (this.files[fname] === true) + return this.reset(); + this.files[fname] = true; + } + + // Import imports + + if (json['imports'] && json['imports'].length > 0) { + var importRoot, + resetRoot = false; + + if (typeof filename === 'object') { // If an import root is specified, override + + this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards + importRoot = this.importRoot; + filename = filename["file"]; + if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0) + delim = '\\'; + + } else if (typeof filename === 'string') { + + if (this.importRoot) // If import root is overridden, use it + importRoot = this.importRoot; + else { // Otherwise compute from filename + if (filename.indexOf("/") >= 0) { // Unix + importRoot = filename.replace(/\/[^\/]*$/, ""); + if (/* /file.proto */ importRoot === "") + importRoot = "/"; + } else if (filename.indexOf("\\") >= 0) { // Windows + importRoot = filename.replace(/\\[^\\]*$/, ""); + delim = '\\'; + } else + importRoot = "."; + } + + } else + importRoot = null; + + for (var i=0; i)=} path Specifies what to return. If omitted, the entire namespace will be returned. + * @returns {!ProtoBuf.Builder.Message|!Object.} + * @throws {Error} If a type could not be resolved + * @expose + */ + BuilderPrototype.build = function(path) { + this.reset(); + if (!this.resolved) + this.resolveAll(), + this.resolved = true, + this.result = null; // Require re-build + if (this.result === null) // (Re-)Build + this.result = this.ns.build(); + if (!path) + return this.result; + var part = typeof path === 'string' ? path.split(".") : path, + ptr = this.result; // Build namespace pointer (no hasChild etc.) + for (var i=0; i|string} values Preset values + * @param {...string} var_args + * @constructor + * @throws {Error} If the message cannot be created + */ +var Message = function(values, var_args) { + ProtoBuf.Builder.Message.call(this); + + // Create virtual oneof properties + for (var i=0, k=oneofs.length; i 0) { + var value; + // Set field values from a values object + if (arguments.length === 1 && values !== null && typeof values === 'object' && + /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) && + /* not a repeated field */ !Array.isArray(values) && + /* not a Map */ !(values instanceof ProtoBuf.Map) && + /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) && + /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) && + /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) { + this.$set(values); + } else // Set field values from arguments, in declaration order + for (i=0, k=arguments.length; i} keyOrObj String key or plain object holding multiple values + * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted + * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false` + * @returns {!ProtoBuf.Builder.Message} this + * @throws {Error} If the value cannot be set + * @expose + */ +MessagePrototype.set = function(keyOrObj, value, noAssert) { + if (keyOrObj && typeof keyOrObj === 'object') { + noAssert = value; + for (var ikey in keyOrObj) { + // Check if virtual oneof field - don't set these + if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined) + this.$set(ikey, value, noAssert); + } + return this; + } + var field = T._fieldsByName[keyOrObj]; + if (!noAssert) { + if (!field) + throw Error(this+"#"+keyOrObj+" is not a field: undefined"); + if (!(field instanceof ProtoBuf.Reflect.Message.Field)) + throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true)); + this[field.name] = (value = field.verifyValue(value)); // May throw + } else + this[keyOrObj] = value; + if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field) + var currentField = this[field.oneof.name]; // Virtual field references currently set field + if (value !== null) { + if (currentField !== null && currentField !== field.name) + this[currentField] = null; // Clear currently set field + this[field.oneof.name] = field.name; // Point virtual field at this field + } else if (/* value === null && */currentField === keyOrObj) + this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared) + } + return this; +}; + +/** + * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}. + * @name ProtoBuf.Builder.Message#$set + * @function + * @param {string|!Object.} keyOrObj String key or plain object holding multiple values + * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted + * @param {boolean=} noAssert Whether to not assert the value, defaults to `false` + * @throws {Error} If the value cannot be set + * @expose + */ +MessagePrototype.$set = MessagePrototype.set; + +/** + * Gets a field's value. + * @name ProtoBuf.Builder.Message#get + * @function + * @param {string} key Key + * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false` + * @return {*} Value + * @throws {Error} If there is no such field + * @expose + */ +MessagePrototype.get = function(key, noAssert) { + if (noAssert) + return this[key]; + var field = T._fieldsByName[key]; + if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field)) + throw Error(this+"#"+key+" is not a field: undefined"); + if (!(field instanceof ProtoBuf.Reflect.Message.Field)) + throw Error(this+"#"+key+" is not a field: "+field.toString(true)); + return this[field.name]; +}; + +/** + * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}. + * @name ProtoBuf.Builder.Message#$get + * @function + * @param {string} key Key + * @return {*} Value + * @throws {Error} If there is no such field + * @expose + */ +MessagePrototype.$get = MessagePrototype.get; + +// Getters and setters + +for (var i=0; i} data Data payload + * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted. + * @param {boolean=} noVerify Whether to not verify field values, defaults to `false` + * @return {!ByteBuffer} Encoded message as a ByteBuffer + * @expose + */ +Message.encode = function(data, buffer, noVerify) { + return new Message(data).encode(buffer, noVerify); +}; + +/** + * Calculates the byte length of the message. + * @name ProtoBuf.Builder.Message#calculate + * @function + * @returns {number} Byte length + * @throws {Error} If the message cannot be calculated or if required fields are missing. + * @expose + */ +MessagePrototype.calculate = function() { + return T.calculate(this); +}; + +/** + * Encodes the varint32 length-delimited message. + * @name ProtoBuf.Builder.Message#encodeDelimited + * @function + * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted. + * @param {boolean=} noVerify Whether to not verify field values, defaults to `false` + * @return {!ByteBuffer} Encoded message as a ByteBuffer + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded ByteBuffer in the `encoded` property on the error. + * @expose + */ +MessagePrototype.encodeDelimited = function(buffer, noVerify) { + var isNew = false; + if (!buffer) + buffer = new ByteBuffer(), + isNew = true; + var enc = new ByteBuffer().LE(); + T.encode(this, enc, noVerify).flip(); + buffer.writeVarint32(enc.remaining()); + buffer.append(enc); + return isNew ? buffer.flip() : buffer; +}; + +/** + * Directly encodes the message to an ArrayBuffer. + * @name ProtoBuf.Builder.Message#encodeAB + * @function + * @return {ArrayBuffer} Encoded message as ArrayBuffer + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded ArrayBuffer in the `encoded` property on the error. + * @expose + */ +MessagePrototype.encodeAB = function() { + try { + return this.encode().toArrayBuffer(); + } catch (e) { + if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer(); + throw(e); + } +}; + +/** + * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}. + * @name ProtoBuf.Builder.Message#toArrayBuffer + * @function + * @return {ArrayBuffer} Encoded message as ArrayBuffer + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded ArrayBuffer in the `encoded` property on the error. + * @expose + */ +MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB; + +/** + * Directly encodes the message to a node Buffer. + * @name ProtoBuf.Builder.Message#encodeNB + * @function + * @return {!Buffer} + * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are + * missing. The later still returns the encoded node Buffer in the `encoded` property on the error. + * @expose + */ +MessagePrototype.encodeNB = function() { + try { + return this.encode().toBuffer(); + } catch (e) { + if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer(); + throw(e); + } +}; + +/** + * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}. + * @name ProtoBuf.Builder.Message#toBuffer + * @function + * @return {!Buffer} + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded node Buffer in the `encoded` property on the error. + * @expose + */ +MessagePrototype.toBuffer = MessagePrototype.encodeNB; + +/** + * Directly encodes the message to a base64 encoded string. + * @name ProtoBuf.Builder.Message#encode64 + * @function + * @return {string} Base64 encoded string + * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later + * still returns the encoded base64 string in the `encoded` property on the error. + * @expose + */ +MessagePrototype.encode64 = function() { + try { + return this.encode().toBase64(); + } catch (e) { + if (e["encoded"]) e["encoded"] = e["encoded"].toBase64(); + throw(e); + } +}; + +/** + * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}. + * @name ProtoBuf.Builder.Message#toBase64 + * @function + * @return {string} Base64 encoded string + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded base64 string in the `encoded` property on the error. + * @expose + */ +MessagePrototype.toBase64 = MessagePrototype.encode64; + +/** + * Directly encodes the message to a hex encoded string. + * @name ProtoBuf.Builder.Message#encodeHex + * @function + * @return {string} Hex encoded string + * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later + * still returns the encoded hex string in the `encoded` property on the error. + * @expose + */ +MessagePrototype.encodeHex = function() { + try { + return this.encode().toHex(); + } catch (e) { + if (e["encoded"]) e["encoded"] = e["encoded"].toHex(); + throw(e); + } +}; + +/** + * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}. + * @name ProtoBuf.Builder.Message#toHex + * @function + * @return {string} Hex encoded string + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded hex string in the `encoded` property on the error. + * @expose + */ +MessagePrototype.toHex = MessagePrototype.encodeHex; + +/** + * Clones a message object or field value to a raw object. + * @param {*} obj Object to clone + * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise + * @param {boolean} longsAsStrings Whether to encode longs as strings + * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field + * @returns {*} Cloned object + * @inner + */ +function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) { + if (obj === null || typeof obj !== 'object') { + // Convert enum values to their respective names + if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) { + var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj); + if (name !== null) + return name; + } + // Pass-through string, number, boolean, null... + return obj; + } + // Convert ByteBuffers to raw buffer or strings + if (ByteBuffer.isByteBuffer(obj)) + return binaryAsBase64 ? obj.toBase64() : obj.toBuffer(); + // Convert Longs to proper objects or strings + if (ProtoBuf.Long.isLong(obj)) + return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj); + var clone; + // Clone arrays + if (Array.isArray(obj)) { + clone = []; + obj.forEach(function(v, k) { + clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType); + }); + return clone; + } + clone = {}; + // Convert maps to objects + if (obj instanceof ProtoBuf.Map) { + var it = obj.entries(); + for (var e = it.next(); !e.done; e = it.next()) + clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType); + return clone; + } + // Everything else is a non-null object + var type = obj.$type, + field = undefined; + for (var i in obj) + if (obj.hasOwnProperty(i)) { + if (type && (field = type.getChild(i))) + clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType); + else + clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings); + } + return clone; +} + +/** + * Returns the message's raw payload. + * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false` + * @param {boolean} longsAsStrings Whether to encode longs as strings + * @returns {Object.} Raw payload + * @expose + */ +MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) { + return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type); +}; + +/** + * Encodes a message to JSON. + * @returns {string} JSON string + * @expose + */ +MessagePrototype.encodeJSON = function() { + return JSON.stringify( + cloneRaw(this, + /* binary-as-base64 */ true, + /* longs-as-strings */ true, + this.$type + ) + ); +}; + +/** + * Decodes a message from the specified buffer or string. + * @name ProtoBuf.Builder.Message.decode + * @function + * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from + * @param {(number|string)=} length Message length. Defaults to decode all the remainig data. + * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64 + * @return {!ProtoBuf.Builder.Message} Decoded message + * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still + * returns the decoded message with missing fields in the `decoded` property on the error. + * @expose + * @see ProtoBuf.Builder.Message.decode64 + * @see ProtoBuf.Builder.Message.decodeHex + */ +Message.decode = function(buffer, length, enc) { + if (typeof length === 'string') + enc = length, + length = -1; + if (typeof buffer === 'string') + buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64"); + else if (!ByteBuffer.isByteBuffer(buffer)) + buffer = ByteBuffer.wrap(buffer); // May throw + var le = buffer.littleEndian; + try { + var msg = T.decode(buffer.LE(), length); + buffer.LE(le); + return msg; + } catch (e) { + buffer.LE(le); + throw(e); + } +}; + +/** + * Decodes a varint32 length-delimited message from the specified buffer or string. + * @name ProtoBuf.Builder.Message.decodeDelimited + * @function + * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from + * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64 + * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet + * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still + * returns the decoded message with missing fields in the `decoded` property on the error. + * @expose + */ +Message.decodeDelimited = function(buffer, enc) { + if (typeof buffer === 'string') + buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64"); + else if (!ByteBuffer.isByteBuffer(buffer)) + buffer = ByteBuffer.wrap(buffer); // May throw + if (buffer.remaining() < 1) + return null; + var off = buffer.offset, + len = buffer.readVarint32(); + if (buffer.remaining() < len) { + buffer.offset = off; + return null; + } + try { + var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE()); + buffer.offset += len; + return msg; + } catch (err) { + buffer.offset += len; + throw err; + } +}; + +/** + * Decodes the message from the specified base64 encoded string. + * @name ProtoBuf.Builder.Message.decode64 + * @function + * @param {string} str String to decode from + * @return {!ProtoBuf.Builder.Message} Decoded message + * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still + * returns the decoded message with missing fields in the `decoded` property on the error. + * @expose + */ +Message.decode64 = function(str) { + return Message.decode(str, "base64"); +}; + +/** + * Decodes the message from the specified hex encoded string. + * @name ProtoBuf.Builder.Message.decodeHex + * @function + * @param {string} str String to decode from + * @return {!ProtoBuf.Builder.Message} Decoded message + * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still + * returns the decoded message with missing fields in the `decoded` property on the error. + * @expose + */ +Message.decodeHex = function(str) { + return Message.decode(str, "hex"); +}; + +/** + * Decodes the message from a JSON string. + * @name ProtoBuf.Builder.Message.decodeJSON + * @function + * @param {string} str String to decode from + * @return {!ProtoBuf.Builder.Message} Decoded message + * @throws {Error} If the message cannot be decoded or if required fields are + * missing. + * @expose + */ +Message.decodeJSON = function(str) { + return new Message(JSON.parse(str)); +}; + +// Utility + +/** + * Returns a string representation of this Message. + * @name ProtoBuf.Builder.Message#toString + * @function + * @return {string} String representation as of ".Fully.Qualified.MessageName" + * @expose + */ +MessagePrototype.toString = function() { + return T.toString(); +}; + +// Properties + +/** + * Message options. + * @name ProtoBuf.Builder.Message.$options + * @type {Object.} + * @expose + */ +var $optionsS; // cc needs this + +/** + * Message options. + * @name ProtoBuf.Builder.Message#$options + * @type {Object.} + * @expose + */ +var $options; + +/** + * Reflection type. + * @name ProtoBuf.Builder.Message.$type + * @type {!ProtoBuf.Reflect.Message} + * @expose + */ +var $typeS; + +/** + * Reflection type. + * @name ProtoBuf.Builder.Message#$type + * @type {!ProtoBuf.Reflect.Message} + * @expose + */ +var $type; + +if (Object.defineProperty) + Object.defineProperty(Message, '$options', { "value": T.buildOpt() }), + Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }), + Object.defineProperty(Message, "$type", { "value": T }), + Object.defineProperty(MessagePrototype, "$type", { "value": T }); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Builder/Service.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Builder/Service.js new file mode 100644 index 0000000..43de942 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Builder/Service.js @@ -0,0 +1,144 @@ +/*? + // --- Scope ------------------ + // T : Reflect.Service instance + */ +/** + * Constructs a new runtime Service. + * @name ProtoBuf.Builder.Service + * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message + * @class Barebone of all runtime services. + * @constructor + * @throws {Error} If the service cannot be created + */ +var Service = function(rpcImpl) { + ProtoBuf.Builder.Service.call(this); + + /** + * Service implementation. + * @name ProtoBuf.Builder.Service#rpcImpl + * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} + * @expose + */ + this.rpcImpl = rpcImpl || function(name, msg, callback) { + // This is what a user has to implement: A function receiving the method name, the actual message to + // send (type checked) and the callback that's either provided with the error as its first + // argument or null and the actual response message. + setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async! + }; +}; + +/** + * @alias ProtoBuf.Builder.Service.prototype + * @inner + */ +var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype); + +/** + * Asynchronously performs an RPC call using the given RPC implementation. + * @name ProtoBuf.Builder.Service.[Method] + * @function + * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation + * @param {ProtoBuf.Builder.Message} req Request + * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving + * the error if any and the response either as a pre-parsed message or as its raw bytes + * @abstract + */ + +/** + * Asynchronously performs an RPC call using the instance's RPC implementation. + * @name ProtoBuf.Builder.Service#[Method] + * @function + * @param {ProtoBuf.Builder.Message} req Request + * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving + * the error if any and the response either as a pre-parsed message or as its raw bytes + * @abstract + */ + +var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod); +for (var i=0; i} + * @expose + */ +var $optionsS; // cc needs this + +/** + * Service options. + * @name ProtoBuf.Builder.Service#$options + * @type {Object.} + * @expose + */ +var $options; + +/** + * Reflection type. + * @name ProtoBuf.Builder.Service.$type + * @type {!ProtoBuf.Reflect.Service} + * @expose + */ +var $typeS; + +/** + * Reflection type. + * @name ProtoBuf.Builder.Service#$type + * @type {!ProtoBuf.Reflect.Service} + * @expose + */ +var $type; + +if (Object.defineProperty) + Object.defineProperty(Service, "$options", { "value": T.buildOpt() }), + Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }), + Object.defineProperty(Service, "$type", { "value": T }), + Object.defineProperty(ServicePrototype, "$type", { "value": T }); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/DotProto.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/DotProto.js new file mode 100644 index 0000000..f3cea78 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/DotProto.js @@ -0,0 +1,33 @@ +/** + * @alias ProtoBuf.DotProto + * @expose + */ +ProtoBuf.DotProto = (function(ProtoBuf, Lang) { + "use strict"; + + /** + * Utilities to parse .proto files. + * @exports ProtoBuf.DotProto + * @namespace + */ + var DotProto = {}; + + //? include("DotProto/Tokenizer.js"); + + /** + * @alias ProtoBuf.DotProto.Tokenizer + * @expose + */ + DotProto.Tokenizer = Tokenizer; + + //? include("DotProto/Parser.js"); + + /** + * @alias ProtoBuf.DotProto.Parser + * @expose + */ + DotProto.Parser = Parser; + + return DotProto; + +})(ProtoBuf, ProtoBuf.Lang); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/DotProto/Parser.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/DotProto/Parser.js new file mode 100644 index 0000000..36595ee --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/DotProto/Parser.js @@ -0,0 +1,700 @@ +/*? + // --- Scope ---------------------- + // Lang : Language expressions + // Tokenizer : DotProto Tokenizer + */ +/** + * Constructs a new Parser. + * @exports ProtoBuf.DotProto.Parser + * @class prototype parser + * @param {string} source Source + * @constructor + */ +var Parser = function(source) { + + /** + * Tokenizer. + * @type {!ProtoBuf.DotProto.Tokenizer} + * @expose + */ + this.tn = new Tokenizer(source); + + /** + * Whether parsing proto3 or not. + * @type {boolean} + */ + this.proto3 = false; +}; + +/** + * @alias ProtoBuf.DotProto.Parser.prototype + * @inner + */ +var ParserPrototype = Parser.prototype; + +/** + * Parses the source. + * @returns {!Object} + * @throws {Error} If the source cannot be parsed + * @expose + */ +ParserPrototype.parse = function() { + var topLevel = { + "name": "[ROOT]", // temporary + "package": null, + "messages": [], + "enums": [], + "imports": [], + "options": {}, + "services": [] + // "syntax": undefined + }; + var token, + head = true, + weak; + try { + while (token = this.tn.next()) { + switch (token) { + case 'package': + if (!head || topLevel["package"] !== null) + throw Error("unexpected 'package'"); + token = this.tn.next(); + if (!Lang.TYPEREF.test(token)) + throw Error("illegal package name: " + token); + this.tn.skip(";"); + topLevel["package"] = token; + break; + case 'import': + if (!head) + throw Error("unexpected 'import'"); + token = this.tn.peek(); + if (token === "public" || (weak = token === "weak")) // token ignored + this.tn.next(); + token = this._readString(); + this.tn.skip(";"); + if (!weak) // import ignored + topLevel["imports"].push(token); + break; + case 'syntax': + if (!head) + throw Error("unexpected 'syntax'"); + this.tn.skip("="); + if ((topLevel["syntax"] = this._readString()) === "proto3") + this.proto3 = true; + this.tn.skip(";"); + break; + case 'message': + this._parseMessage(topLevel, null); + head = false; + break; + case 'enum': + this._parseEnum(topLevel); + head = false; + break; + case 'option': + this._parseOption(topLevel); + break; + case 'service': + this._parseService(topLevel); + break; + case 'extend': + this._parseExtend(topLevel); + break; + default: + throw Error("unexpected '" + token + "'"); + } + } + } catch (e) { + e.message = "Parse error at line "+this.tn.line+": " + e.message; + throw e; + } + delete topLevel["name"]; + return topLevel; +}; + +/** + * Parses the specified source. + * @returns {!Object} + * @throws {Error} If the source cannot be parsed + * @expose + */ +Parser.parse = function(source) { + return new Parser(source).parse(); +}; + +// ----- Conversion ------ + +/** + * Converts a numerical string to an id. + * @param {string} value + * @param {boolean=} mayBeNegative + * @returns {number} + * @inner + */ +function mkId(value, mayBeNegative) { + var id = -1, + sign = 1; + if (value.charAt(0) == '-') { + sign = -1; + value = value.substring(1); + } + if (Lang.NUMBER_DEC.test(value)) + id = parseInt(value); + else if (Lang.NUMBER_HEX.test(value)) + id = parseInt(value.substring(2), 16); + else if (Lang.NUMBER_OCT.test(value)) + id = parseInt(value.substring(1), 8); + else + throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value); + id = (sign*id)|0; // Force to 32bit + if (!mayBeNegative && id < 0) + throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value); + return id; +} + +/** + * Converts a numerical string to a number. + * @param {string} val + * @returns {number} + * @inner + */ +function mkNumber(val) { + var sign = 1; + if (val.charAt(0) == '-') { + sign = -1; + val = val.substring(1); + } + if (Lang.NUMBER_DEC.test(val)) + return sign * parseInt(val, 10); + else if (Lang.NUMBER_HEX.test(val)) + return sign * parseInt(val.substring(2), 16); + else if (Lang.NUMBER_OCT.test(val)) + return sign * parseInt(val.substring(1), 8); + else if (val === 'inf') + return sign * Infinity; + else if (val === 'nan') + return NaN; + else if (Lang.NUMBER_FLT.test(val)) + return sign * parseFloat(val); + throw Error("illegal number value: " + (sign < 0 ? '-' : '') + val); +} + +// ----- Reading ------ + +/** + * Reads a string. + * @returns {string} + * @private + */ +ParserPrototype._readString = function() { + var value = "", + token, + delim; + do { + delim = this.tn.next(); + if (delim !== "'" && delim !== '"') + throw Error("illegal string delimiter: "+delim); + value += this.tn.next(); + this.tn.skip(delim); + token = this.tn.peek(); + } while (token === '"' || token === '"'); // multi line? + return value; +}; + +/** + * Reads a value. + * @param {boolean=} mayBeTypeRef + * @returns {number|boolean|string} + * @private + */ +ParserPrototype._readValue = function(mayBeTypeRef) { + var token = this.tn.peek(), + value; + if (token === '"' || token === "'") + return this._readString(); + this.tn.next(); + if (Lang.NUMBER.test(token)) + return mkNumber(token); + if (Lang.BOOL.test(token)) + return (token.toLowerCase() === 'true'); + if (mayBeTypeRef && Lang.TYPEREF.test(token)) + return token; + throw Error("illegal value: "+token); + +}; + +// ----- Parsing constructs ----- + +/** + * Parses a namespace option. + * @param {!Object} parent Parent definition + * @param {boolean=} isList + * @private + */ +ParserPrototype._parseOption = function(parent, isList) { + var token = this.tn.next(), + custom = false; + if (token === '(') { + custom = true; + token = this.tn.next(); + } + if (!Lang.TYPEREF.test(token)) + // we can allow options of the form google.protobuf.* since they will just get ignored anyways + // if (!/google\.protobuf\./.test(token)) // FIXME: Why should that not be a valid typeref? + throw Error("illegal option name: "+token); + var name = token; + if (custom) { // (my_method_option).foo, (my_method_option), some_method_option, (foo.my_option).bar + this.tn.skip(')'); + name = '('+name+')'; + token = this.tn.peek(); + if (Lang.FQTYPEREF.test(token)) { + name += token; + this.tn.next(); + } + } + this.tn.skip('='); + this._parseOptionValue(parent, name); + if (!isList) + this.tn.skip(";"); +}; + +/** + * Sets an option on the specified options object. + * @param {!Object.} options + * @param {string} name + * @param {string|number|boolean} value + * @inner + */ +function setOption(options, name, value) { + if (typeof options[name] === 'undefined') + options[name] = value; + else { + if (!Array.isArray(options[name])) + options[name] = [ options[name] ]; + options[name].push(value); + } +} + +/** + * Parses an option value. + * @param {!Object} parent + * @param {string} name + * @private + */ +ParserPrototype._parseOptionValue = function(parent, name) { + var token = this.tn.peek(); + if (token !== '{') { // Plain value + setOption(parent["options"], name, this._readValue(true)); + } else { // Aggregate options + this.tn.skip("{"); + while ((token = this.tn.next()) !== '}') { + if (!Lang.NAME.test(token)) + throw Error("illegal option name: " + name + "." + token); + if (this.tn.omit(":")) + setOption(parent["options"], name + "." + token, this._readValue(true)); + else + this._parseOptionValue(parent, name + "." + token); + } + } +}; + +/** + * Parses a service definition. + * @param {!Object} parent Parent definition + * @private + */ +ParserPrototype._parseService = function(parent) { + var token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal service name at line "+this.tn.line+": "+token); + var name = token; + var svc = { + "name": name, + "rpc": {}, + "options": {} + }; + this.tn.skip("{"); + while ((token = this.tn.next()) !== '}') { + if (token === "option") + this._parseOption(svc); + else if (token === 'rpc') + this._parseServiceRPC(svc); + else + throw Error("illegal service token: "+token); + } + this.tn.omit(";"); + parent["services"].push(svc); +}; + +/** + * Parses a RPC service definition of the form ['rpc', name, (request), 'returns', (response)]. + * @param {!Object} svc Service definition + * @private + */ +ParserPrototype._parseServiceRPC = function(svc) { + var type = "rpc", + token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal rpc service method name: "+token); + var name = token; + var method = { + "request": null, + "response": null, + "request_stream": false, + "response_stream": false, + "options": {} + }; + this.tn.skip("("); + token = this.tn.next(); + if (token.toLowerCase() === "stream") { + method["request_stream"] = true; + token = this.tn.next(); + } + if (!Lang.TYPEREF.test(token)) + throw Error("illegal rpc service request type: "+token); + method["request"] = token; + this.tn.skip(")"); + token = this.tn.next(); + if (token.toLowerCase() !== "returns") + throw Error("illegal rpc service request type delimiter: "+token); + this.tn.skip("("); + token = this.tn.next(); + if (token.toLowerCase() === "stream") { + method["response_stream"] = true; + token = this.tn.next(); + } + method["response"] = token; + this.tn.skip(")"); + token = this.tn.peek(); + if (token === '{') { + this.tn.next(); + while ((token = this.tn.next()) !== '}') { + if (token === 'option') + this._parseOption(method); + else + throw Error("illegal rpc service token: " + token); + } + this.tn.omit(";"); + } else + this.tn.skip(";"); + if (typeof svc[type] === 'undefined') + svc[type] = {}; + svc[type][name] = method; +}; + +/** + * Parses a message definition. + * @param {!Object} parent Parent definition + * @param {!Object=} fld Field definition if this is a group + * @returns {!Object} + * @private + */ +ParserPrototype._parseMessage = function(parent, fld) { + var isGroup = !!fld, + token = this.tn.next(); + var msg = { + "name": "", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "services": [], + "oneofs": {} + // "extensions": undefined + }; + if (!Lang.NAME.test(token)) + throw Error("illegal "+(isGroup ? "group" : "message")+" name: "+token); + msg["name"] = token; + if (isGroup) { + this.tn.skip("="); + fld["id"] = mkId(this.tn.next()); + msg["isGroup"] = true; + } + token = this.tn.peek(); + if (token === '[' && fld) + this._parseFieldOptions(fld); + this.tn.skip("{"); + while ((token = this.tn.next()) !== '}') { + if (Lang.RULE.test(token)) + this._parseMessageField(msg, token); + else if (token === "oneof") + this._parseMessageOneOf(msg); + else if (token === "enum") + this._parseEnum(msg); + else if (token === "message") + this._parseMessage(msg); + else if (token === "option") + this._parseOption(msg); + else if (token === "service") + this._parseService(msg); + else if (token === "extensions") + if (msg.hasOwnProperty("extensions")) { + msg["extensions"] = msg["extensions"].concat(this._parseExtensionRanges()) + } else { + msg["extensions"] = this._parseExtensionRanges(); + } + else if (token === "reserved") + this._parseIgnored(); // TODO + else if (token === "extend") + this._parseExtend(msg); + else if (Lang.TYPEREF.test(token)) { + if (!this.proto3) + throw Error("illegal field rule: "+token); + this._parseMessageField(msg, "optional", token); + } else + throw Error("illegal message token: "+token); + } + this.tn.omit(";"); + parent["messages"].push(msg); + return msg; +}; + +/** + * Parses an ignored statement. + * @private + */ +ParserPrototype._parseIgnored = function() { + while (this.tn.peek() !== ';') + this.tn.next(); + this.tn.skip(";"); +}; + +/** + * Parses a message field. + * @param {!Object} msg Message definition + * @param {string} rule Field rule + * @param {string=} type Field type if already known (never known for maps) + * @returns {!Object} Field descriptor + * @private + */ +ParserPrototype._parseMessageField = function(msg, rule, type) { + if (!Lang.RULE.test(rule)) + throw Error("illegal message field rule: "+rule); + var fld = { + "rule": rule, + "type": "", + "name": "", + "options": {}, + "id": 0 + }; + var token; + if (rule === "map") { + + if (type) + throw Error("illegal type: " + type); + this.tn.skip('<'); + token = this.tn.next(); + if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token)) + throw Error("illegal message field type: " + token); + fld["keytype"] = token; + this.tn.skip(','); + token = this.tn.next(); + if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token)) + throw Error("illegal message field: " + token); + fld["type"] = token; + this.tn.skip('>'); + token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal message field name: " + token); + fld["name"] = token; + this.tn.skip("="); + fld["id"] = mkId(this.tn.next()); + token = this.tn.peek(); + if (token === '[') + this._parseFieldOptions(fld); + this.tn.skip(";"); + + } else { + + type = typeof type !== 'undefined' ? type : this.tn.next(); + + if (type === "group") { + + // "A [legacy] group simply combines a nested message type and a field into a single declaration. In your + // code, you can treat this message just as if it had a Result type field called result (the latter name is + // converted to lower-case so that it does not conflict with the former)." + var grp = this._parseMessage(msg, fld); + if (!/^[A-Z]/.test(grp["name"])) + throw Error('illegal group name: '+grp["name"]); + fld["type"] = grp["name"]; + fld["name"] = grp["name"].toLowerCase(); + this.tn.omit(";"); + + } else { + + if (!Lang.TYPE.test(type) && !Lang.TYPEREF.test(type)) + throw Error("illegal message field type: " + type); + fld["type"] = type; + token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal message field name: " + token); + fld["name"] = token; + this.tn.skip("="); + fld["id"] = mkId(this.tn.next()); + token = this.tn.peek(); + if (token === "[") + this._parseFieldOptions(fld); + this.tn.skip(";"); + + } + } + msg["fields"].push(fld); + return fld; +}; + +/** + * Parses a message oneof. + * @param {!Object} msg Message definition + * @private + */ +ParserPrototype._parseMessageOneOf = function(msg) { + var token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal oneof name: "+token); + var name = token, + fld; + var fields = []; + this.tn.skip("{"); + while ((token = this.tn.next()) !== "}") { + fld = this._parseMessageField(msg, "optional", token); + fld["oneof"] = name; + fields.push(fld["id"]); + } + this.tn.omit(";"); + msg["oneofs"][name] = fields; +}; + +/** + * Parses a set of field option definitions. + * @param {!Object} fld Field definition + * @private + */ +ParserPrototype._parseFieldOptions = function(fld) { + this.tn.skip("["); + var token, + first = true; + while ((token = this.tn.peek()) !== ']') { + if (!first) + this.tn.skip(","); + this._parseOption(fld, true); + first = false; + } + this.tn.next(); +}; + +/** + * Parses an enum. + * @param {!Object} msg Message definition + * @private + */ +ParserPrototype._parseEnum = function(msg) { + var enm = { + "name": "", + "values": [], + "options": {} + }; + var token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal name: "+token); + enm["name"] = token; + this.tn.skip("{"); + while ((token = this.tn.next()) !== '}') { + if (token === "option") + this._parseOption(enm); + else { + if (!Lang.NAME.test(token)) + throw Error("illegal name: "+token); + this.tn.skip("="); + var val = { + "name": token, + "id": mkId(this.tn.next(), true) + }; + token = this.tn.peek(); + if (token === "[") + this._parseFieldOptions({ "options": {} }); + this.tn.skip(";"); + enm["values"].push(val); + } + } + this.tn.omit(";"); + msg["enums"].push(enm); +}; + +/** + * Parses extension / reserved ranges. + * @returns {!Array.>} + * @private + */ +ParserPrototype._parseExtensionRanges = function() { + var ranges = []; + var token, + range, + value; + do { + range = []; + while (true) { + token = this.tn.next(); + switch (token) { + case "min": + value = ProtoBuf.ID_MIN; + break; + case "max": + value = ProtoBuf.ID_MAX; + break; + default: + value = mkNumber(token); + break; + } + range.push(value); + if (range.length === 2) + break; + if (this.tn.peek() !== "to") { + range.push(value); + break; + } + this.tn.next(); + } + ranges.push(range); + } while (this.tn.omit(",")); + this.tn.skip(";"); + return ranges; +}; + +/** + * Parses an extend block. + * @param {!Object} parent Parent object + * @private + */ +ParserPrototype._parseExtend = function(parent) { + var token = this.tn.next(); + if (!Lang.TYPEREF.test(token)) + throw Error("illegal extend reference: "+token); + var ext = { + "ref": token, + "fields": [] + }; + this.tn.skip("{"); + while ((token = this.tn.next()) !== '}') { + if (Lang.RULE.test(token)) + this._parseMessageField(ext, token); + else if (Lang.TYPEREF.test(token)) { + if (!this.proto3) + throw Error("illegal field rule: "+token); + this._parseMessageField(ext, "optional", token); + } else + throw Error("illegal extend token: "+token); + } + this.tn.omit(";"); + parent["messages"].push(ext); + return ext; +}; + +// ----- General ----- + +/** + * Returns a string representation of this parser. + * @returns {string} + */ +ParserPrototype.toString = function() { + return "Parser at line "+this.tn.line; +}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/DotProto/Tokenizer.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/DotProto/Tokenizer.js new file mode 100644 index 0000000..10c1a1d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/DotProto/Tokenizer.js @@ -0,0 +1,190 @@ +/*? + // --- Scope ----------------- + // Lang : Language expressions +*/ +/** + * Constructs a new Tokenizer. + * @exports ProtoBuf.DotProto.Tokenizer + * @class prototype tokenizer + * @param {string} proto Proto to tokenize + * @constructor + */ +var Tokenizer = function(proto) { + + /** + * Source to parse. + * @type {string} + * @expose + */ + this.source = proto+""; + + /** + * Current index. + * @type {number} + * @expose + */ + this.index = 0; + + /** + * Current line. + * @type {number} + * @expose + */ + this.line = 1; + + /** + * Token stack. + * @type {!Array.} + * @expose + */ + this.stack = []; + + /** + * Opening character of the current string read, if any. + * @type {?string} + * @private + */ + this._stringOpen = null; +}; + +/** + * @alias ProtoBuf.DotProto.Tokenizer.prototype + * @inner + */ +var TokenizerPrototype = Tokenizer.prototype; + +/** + * Reads a string beginning at the current index. + * @return {string} + * @private + */ +TokenizerPrototype._readString = function() { + var re = this._stringOpen === '"' + ? Lang.STRING_DQ + : Lang.STRING_SQ; + re.lastIndex = this.index - 1; // Include the open quote + var match = re.exec(this.source); + if (!match) + throw Error("unterminated string"); + this.index = re.lastIndex; + this.stack.push(this._stringOpen); + this._stringOpen = null; + return match[1]; +}; + +/** + * Gets the next token and advances by one. + * @return {?string} Token or `null` on EOF + * @expose + */ +TokenizerPrototype.next = function() { + if (this.stack.length > 0) + return this.stack.shift(); + if (this.index >= this.source.length) + return null; + if (this._stringOpen !== null) + return this._readString(); + + var repeat, + prev, + next; + do { + repeat = false; + + // Strip white spaces + while (Lang.WHITESPACE.test(next = this.source.charAt(this.index))) { + if (next === '\n') + ++this.line; + if (++this.index === this.source.length) + return null; + } + + // Strip comments + if (this.source.charAt(this.index) === '/') { + ++this.index; + if (this.source.charAt(this.index) === '/') { // Line + while (this.source.charAt(++this.index) !== '\n') + if (this.index == this.source.length) + return null; + ++this.index; + ++this.line; + repeat = true; + } else if ((next = this.source.charAt(this.index)) === '*') { /* Block */ + do { + if (next === '\n') + ++this.line; + if (++this.index === this.source.length) + return null; + prev = next; + next = this.source.charAt(this.index); + } while (prev !== '*' || next !== '/'); + ++this.index; + repeat = true; + } else + return '/'; + } + } while (repeat); + + if (this.index === this.source.length) + return null; + + // Read the next token + var end = this.index; + Lang.DELIM.lastIndex = 0; + var delim = Lang.DELIM.test(this.source.charAt(end++)); + if (!delim) + while(end < this.source.length && !Lang.DELIM.test(this.source.charAt(end))) + ++end; + var token = this.source.substring(this.index, this.index = end); + if (token === '"' || token === "'") + this._stringOpen = token; + return token; +}; + +/** + * Peeks for the next token. + * @return {?string} Token or `null` on EOF + * @expose + */ +TokenizerPrototype.peek = function() { + if (this.stack.length === 0) { + var token = this.next(); + if (token === null) + return null; + this.stack.push(token); + } + return this.stack[0]; +}; + +/** + * Skips a specific token and throws if it differs. + * @param {string} expected Expected token + * @throws {Error} If the actual token differs + */ +TokenizerPrototype.skip = function(expected) { + var actual = this.next(); + if (actual !== expected) + throw Error("illegal '"+actual+"', '"+expected+"' expected"); +}; + +/** + * Omits an optional token. + * @param {string} expected Expected optional token + * @returns {boolean} `true` if the token exists + */ +TokenizerPrototype.omit = function(expected) { + if (this.peek() === expected) { + this.next(); + return true; + } + return false; +}; + +/** + * Returns a string representation of this object. + * @return {string} String representation as of "Tokenizer(index/length)" + * @expose + */ +TokenizerPrototype.toString = function() { + return "Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"; +}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Lang.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Lang.js new file mode 100644 index 0000000..a0fb768 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Lang.js @@ -0,0 +1,64 @@ +/** + * Language expressions. + * @type {!Object.} + * @expose + */ +ProtoBuf.Lang = { + + // Characters always ending a statement + DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g, + + // Field rules + RULE: /^(?:required|optional|repeated|map)$/, + + // Field types + TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/, + + // Names + NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/, + + // Type definitions + TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/, + + // Type references + TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/, + + // Fully qualified type references + FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/, + + // All numbers + NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/, + + // Decimal numbers + NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/, + + // Hexadecimal numbers + NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/, + + // Octal numbers + NUMBER_OCT: /^0[0-7]+$/, + + // Floating point numbers + NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/, + + // Booleans + BOOL: /^(?:true|false)$/i, + + // Id numbers + ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/, + + // Negative id numbers (enum values) + NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/, + + // Whitespaces + WHITESPACE: /\s/, + + // All strings + STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g, + + // Double quoted strings + STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g, + + // Single quoted strings + STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g +}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Map.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Map.js new file mode 100644 index 0000000..ca2e88a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Map.js @@ -0,0 +1,197 @@ +/** + * @alias ProtoBuf.Map + * @expose + */ +ProtoBuf.Map = (function(ProtoBuf, Reflect) { + "use strict"; + + /** + * Constructs a new Map. A Map is a container that is used to implement map + * fields on message objects. It closely follows the ES6 Map API; however, + * it is distinct because we do not want to depend on external polyfills or + * on ES6 itself. + * + * @exports ProtoBuf.Map + * @param {!ProtoBuf.Reflect.Field} field Map field + * @param {Object.=} contents Initial contents + * @constructor + */ + var Map = function(field, contents) { + if (!field.map) + throw Error("field is not a map"); + + /** + * The field corresponding to this map. + * @type {!ProtoBuf.Reflect.Field} + */ + this.field = field; + + /** + * Element instance corresponding to key type. + * @type {!ProtoBuf.Reflect.Element} + */ + this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax); + + /** + * Element instance corresponding to value type. + * @type {!ProtoBuf.Reflect.Element} + */ + this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax); + + /** + * Internal map: stores mapping of (string form of key) -> (key, value) + * pair. + * + * We provide map semantics for arbitrary key types, but we build on top + * of an Object, which has only string keys. In order to avoid the need + * to convert a string key back to its native type in many situations, + * we store the native key value alongside the value. Thus, we only need + * a one-way mapping from a key type to its string form that guarantees + * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1 + * === K2). + * + * @type {!Object} + */ + this.map = {}; + + /** + * Returns the number of elements in the map. + */ + Object.defineProperty(this, "size", { + get: function() { return Object.keys(this.map).length; } + }); + + // Fill initial contents from a raw object. + if (contents) { + var keys = Object.keys(contents); + for (var i = 0; i < keys.length; i++) { + var key = this.keyElem.valueFromString(keys[i]); + var val = this.valueElem.verifyValue(contents[keys[i]]); + this.map[this.keyElem.valueToString(key)] = + { key: key, value: val }; + } + } + }; + + var MapPrototype = Map.prototype; + + /** + * Helper: return an iterator over an array. + * @param {!Array<*>} arr the array + * @returns {!Object} an iterator + * @inner + */ + function arrayIterator(arr) { + var idx = 0; + return { + next: function() { + if (idx < arr.length) + return { done: false, value: arr[idx++] }; + return { done: true }; + } + } + } + + /** + * Clears the map. + */ + MapPrototype.clear = function() { + this.map = {}; + }; + + /** + * Deletes a particular key from the map. + * @returns {boolean} Whether any entry with this key was deleted. + */ + MapPrototype["delete"] = function(key) { + var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key)); + var hadKey = keyValue in this.map; + delete this.map[keyValue]; + return hadKey; + }; + + /** + * Returns an iterator over [key, value] pairs in the map. + * @returns {Object} The iterator + */ + MapPrototype.entries = function() { + var entries = []; + var strKeys = Object.keys(this.map); + for (var i = 0, entry; i < strKeys.length; i++) + entries.push([(entry=this.map[strKeys[i]]).key, entry.value]); + return arrayIterator(entries); + }; + + /** + * Returns an iterator over keys in the map. + * @returns {Object} The iterator + */ + MapPrototype.keys = function() { + var keys = []; + var strKeys = Object.keys(this.map); + for (var i = 0; i < strKeys.length; i++) + keys.push(this.map[strKeys[i]].key); + return arrayIterator(keys); + }; + + /** + * Returns an iterator over values in the map. + * @returns {!Object} The iterator + */ + MapPrototype.values = function() { + var values = []; + var strKeys = Object.keys(this.map); + for (var i = 0; i < strKeys.length; i++) + values.push(this.map[strKeys[i]].value); + return arrayIterator(values); + }; + + /** + * Iterates over entries in the map, calling a function on each. + * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments. + * @param {Object=} thisArg The `this` value for the callback + */ + MapPrototype.forEach = function(cb, thisArg) { + var strKeys = Object.keys(this.map); + for (var i = 0, entry; i < strKeys.length; i++) + cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this); + }; + + /** + * Sets a key in the map to the given value. + * @param {*} key The key + * @param {*} value The value + * @returns {!ProtoBuf.Map} The map instance + */ + MapPrototype.set = function(key, value) { + var keyValue = this.keyElem.verifyValue(key); + var valValue = this.valueElem.verifyValue(value); + this.map[this.keyElem.valueToString(keyValue)] = + { key: keyValue, value: valValue }; + return this; + }; + + /** + * Gets the value corresponding to a key in the map. + * @param {*} key The key + * @returns {*|undefined} The value, or `undefined` if key not present + */ + MapPrototype.get = function(key) { + var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key)); + if (!(keyValue in this.map)) + return undefined; + return this.map[keyValue].value; + }; + + /** + * Determines whether the given key is present in the map. + * @param {*} key The key + * @returns {boolean} `true` if the key is present + */ + MapPrototype.has = function(key) { + var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key)); + return (keyValue in this.map); + }; + + return Map; +})(ProtoBuf, ProtoBuf.Reflect); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect.js new file mode 100644 index 0000000..8172bb9 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect.js @@ -0,0 +1,121 @@ +/** + * @alias ProtoBuf.Reflect + * @expose + */ +ProtoBuf.Reflect = (function(ProtoBuf) { + "use strict"; + + /** + * Reflection types. + * @exports ProtoBuf.Reflect + * @namespace + */ + var Reflect = {}; + + //? include("Reflect/T.js"); + + /** + * @alias ProtoBuf.Reflect.T + * @expose + */ + Reflect.T = T; + + //? include("Reflect/Namespace.js"); + + /** + * @alias ProtoBuf.Reflect.Namespace + * @expose + */ + Reflect.Namespace = Namespace; + + //? include("Reflect/Element.js"); + + /** + * @alias ProtoBuf.Reflect.Element + * @expose + */ + Reflect.Element = Element; + + //? include("Reflect/Message.js"); + + /** + * @alias ProtoBuf.Reflect.Message + * @expose + */ + Reflect.Message = Message; + + //? include("Reflect/Message/Field.js"); + + /** + * @alias ProtoBuf.Reflect.Message.Field + * @expose + */ + Reflect.Message.Field = Field; + + //? include("Reflect/Message/ExtensionField.js"); + + /** + * @alias ProtoBuf.Reflect.Message.ExtensionField + * @expose + */ + Reflect.Message.ExtensionField = ExtensionField; + + //? include("Reflect/Message/OneOf.js"); + + /** + * @alias ProtoBuf.Reflect.Message.OneOf + * @expose + */ + Reflect.Message.OneOf = OneOf; + + //? include("Reflect/Enum.js"); + + /** + * @alias ProtoBuf.Reflect.Enum + * @expose + */ + Reflect.Enum = Enum; + + //? include("Reflect/Enum/Value.js"); + + /** + * @alias ProtoBuf.Reflect.Enum.Value + * @expose + */ + Reflect.Enum.Value = Value; + + //? include("Reflect/Extension.js"); + + /** + * @alias ProtoBuf.Reflect.Extension + * @expose + */ + Reflect.Extension = Extension; + + //? include("Reflect/Service.js"); + + /** + * @alias ProtoBuf.Reflect.Service + * @expose + */ + Reflect.Service = Service; + + //? include("Reflect/Service/Method.js"); + + /** + * @alias ProtoBuf.Reflect.Service.Method + * @expose + */ + Reflect.Service.Method = Method; + + //? include("Reflect/Service/RPCMethod.js"); + + /** + * @alias ProtoBuf.Reflect.Service.RPCMethod + * @expose + */ + Reflect.Service.RPCMethod = RPCMethod; + + return Reflect; + +})(ProtoBuf); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Element.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Element.js new file mode 100644 index 0000000..0e7b8ee --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Element.js @@ -0,0 +1,580 @@ +/** + * Constructs a new Element implementation that checks and converts values for a + * particular field type, as appropriate. + * + * An Element represents a single value: either the value of a singular field, + * or a value contained in one entry of a repeated field or map field. This + * class does not implement these higher-level concepts; it only encapsulates + * the low-level typechecking and conversion. + * + * @exports ProtoBuf.Reflect.Element + * @param {{name: string, wireType: number}} type Resolved data type + * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant + * (e.g. submessage field). + * @param {boolean} isMapKey Is this element a Map key? The value will be + * converted to string form if so. + * @param {string} syntax Syntax level of defining message type, e.g., + * proto2 or proto3. + * @param {string} name Name of the field containing this element (for error + * messages) + * @constructor + */ +var Element = function(type, resolvedType, isMapKey, syntax, name) { + + /** + * Element type, as a string (e.g., int32). + * @type {{name: string, wireType: number}} + */ + this.type = type; + + /** + * Element type reference to submessage or enum definition, if needed. + * @type {ProtoBuf.Reflect.T|null} + */ + this.resolvedType = resolvedType; + + /** + * Element is a map key. + * @type {boolean} + */ + this.isMapKey = isMapKey; + + /** + * Syntax level of defining message type, e.g., proto2 or proto3. + * @type {string} + */ + this.syntax = syntax; + + /** + * Name of the field containing this element (for error messages) + * @type {string} + */ + this.name = name; + + if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0) + throw Error("Invalid map key type: " + type.name); +}; + +var ElementPrototype = Element.prototype; + +/** + * Obtains a (new) default value for the specified type. + * @param type {string|{name: string, wireType: number}} Field type + * @returns {*} Default value + * @inner + */ +function mkDefault(type) { + if (typeof type === 'string') + type = ProtoBuf.TYPES[type]; + if (typeof type.defaultValue === 'undefined') + throw Error("default value for type "+type.name+" is not supported"); + if (type == ProtoBuf.TYPES["bytes"]) + return new ByteBuffer(0); + return type.defaultValue; +} + +/** + * Returns the default value for this field in proto3. + * @function + * @param type {string|{name: string, wireType: number}} the field type + * @returns {*} Default value + */ +Element.defaultFieldValue = mkDefault; + +/** + * Makes a Long from a value. + * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value + * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for + * strings and numbers + * @returns {!Long} + * @throws {Error} If the value cannot be converted to a Long + * @inner + */ +function mkLong(value, unsigned) { + if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean' + && value.low === value.low && value.high === value.high) + return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned); + if (typeof value === 'string') + return ProtoBuf.Long.fromString(value, unsigned || false, 10); + if (typeof value === 'number') + return ProtoBuf.Long.fromNumber(value, unsigned || false); + throw Error("not convertible to Long"); +} + +ElementPrototype.toString = function() { + return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element'; +} + +/** + * Checks if the given value can be set for an element of this type (singular + * field or one element of a repeated field or map). + * @param {*} value Value to check + * @return {*} Verified, maybe adjusted, value + * @throws {Error} If the value cannot be verified for this element slot + * @expose + */ +ElementPrototype.verifyValue = function(value) { + var self = this; + function fail(val, msg) { + throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")"); + } + switch (this.type) { + // Signed 32bit + case ProtoBuf.TYPES["int32"]: + case ProtoBuf.TYPES["sint32"]: + case ProtoBuf.TYPES["sfixed32"]: + // Account for !NaN: value === value + if (typeof value !== 'number' || (value === value && value % 1 !== 0)) + fail(typeof value, "not an integer"); + return value > 4294967295 ? value | 0 : value; + + // Unsigned 32bit + case ProtoBuf.TYPES["uint32"]: + case ProtoBuf.TYPES["fixed32"]: + if (typeof value !== 'number' || (value === value && value % 1 !== 0)) + fail(typeof value, "not an integer"); + return value < 0 ? value >>> 0 : value; + + // Signed 64bit + case ProtoBuf.TYPES["int64"]: + case ProtoBuf.TYPES["sint64"]: + case ProtoBuf.TYPES["sfixed64"]: { + if (ProtoBuf.Long) + try { + return mkLong(value, false); + } catch (e) { + fail(typeof value, e.message); + } + else + fail(typeof value, "requires Long.js"); + } + + // Unsigned 64bit + case ProtoBuf.TYPES["uint64"]: + case ProtoBuf.TYPES["fixed64"]: { + if (ProtoBuf.Long) + try { + return mkLong(value, true); + } catch (e) { + fail(typeof value, e.message); + } + else + fail(typeof value, "requires Long.js"); + } + + // Bool + case ProtoBuf.TYPES["bool"]: + if (typeof value !== 'boolean') + fail(typeof value, "not a boolean"); + return value; + + // Float + case ProtoBuf.TYPES["float"]: + case ProtoBuf.TYPES["double"]: + if (typeof value !== 'number') + fail(typeof value, "not a number"); + return value; + + // Length-delimited string + case ProtoBuf.TYPES["string"]: + if (typeof value !== 'string' && !(value && value instanceof String)) + fail(typeof value, "not a string"); + return ""+value; // Convert String object to string + + // Length-delimited bytes + case ProtoBuf.TYPES["bytes"]: + if (ByteBuffer.isByteBuffer(value)) + return value; + return ByteBuffer.wrap(value, "base64"); + + // Constant enum value + case ProtoBuf.TYPES["enum"]: { + var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value); + for (i=0; i 4294967295 || value < 0) + fail(typeof value, "not in range for uint32") + return value; + } else { + // proto2 requires enum values to be valid. + fail(value, "not a valid enum value"); + } + } + // Embedded message + case ProtoBuf.TYPES["group"]: + case ProtoBuf.TYPES["message"]: { + if (!value || typeof value !== 'object') + fail(typeof value, "object expected"); + if (value instanceof this.resolvedType.clazz) + return value; + if (value instanceof ProtoBuf.Builder.Message) { + // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180) + var obj = {}; + for (var i in value) + if (value.hasOwnProperty(i)) + obj[i] = value[i]; + value = obj; + } + // Else let's try to construct one from a key-value object + return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons + } + } + + // We should never end here + throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")"); +}; + +/** + * Calculates the byte length of an element on the wire. + * @param {number} id Field number + * @param {*} value Field value + * @returns {number} Byte length + * @throws {Error} If the value cannot be calculated + * @expose + */ +ElementPrototype.calculateLength = function(id, value) { + if (value === null) return 0; // Nothing to encode + // Tag has already been written + var n; + switch (this.type) { + case ProtoBuf.TYPES["int32"]: + return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value); + case ProtoBuf.TYPES["uint32"]: + return ByteBuffer.calculateVarint32(value); + case ProtoBuf.TYPES["sint32"]: + return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value)); + case ProtoBuf.TYPES["fixed32"]: + case ProtoBuf.TYPES["sfixed32"]: + case ProtoBuf.TYPES["float"]: + return 4; + case ProtoBuf.TYPES["int64"]: + case ProtoBuf.TYPES["uint64"]: + return ByteBuffer.calculateVarint64(value); + case ProtoBuf.TYPES["sint64"]: + return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value)); + case ProtoBuf.TYPES["fixed64"]: + case ProtoBuf.TYPES["sfixed64"]: + return 8; + case ProtoBuf.TYPES["bool"]: + return 1; + case ProtoBuf.TYPES["enum"]: + return ByteBuffer.calculateVarint32(value); + case ProtoBuf.TYPES["double"]: + return 8; + case ProtoBuf.TYPES["string"]: + n = ByteBuffer.calculateUTF8Bytes(value); + return ByteBuffer.calculateVarint32(n) + n; + case ProtoBuf.TYPES["bytes"]: + if (value.remaining() < 0) + throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining"); + return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining(); + case ProtoBuf.TYPES["message"]: + n = this.resolvedType.calculate(value); + return ByteBuffer.calculateVarint32(n) + n; + case ProtoBuf.TYPES["group"]: + n = this.resolvedType.calculate(value); + return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP); + } + // We should never end here + throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)"); +}; + +/** + * Encodes a value to the specified buffer. Does not encode the key. + * @param {number} id Field number + * @param {*} value Field value + * @param {ByteBuffer} buffer ByteBuffer to encode to + * @return {ByteBuffer} The ByteBuffer for chaining + * @throws {Error} If the value cannot be encoded + * @expose + */ +ElementPrototype.encodeValue = function(id, value, buffer) { + if (value === null) return buffer; // Nothing to encode + // Tag has already been written + + switch (this.type) { + // 32bit signed varint + case ProtoBuf.TYPES["int32"]: + // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes + // long – it is, effectively, treated like a very large unsigned integer." (see #122) + if (value < 0) + buffer.writeVarint64(value); + else + buffer.writeVarint32(value); + break; + + // 32bit unsigned varint + case ProtoBuf.TYPES["uint32"]: + buffer.writeVarint32(value); + break; + + // 32bit varint zig-zag + case ProtoBuf.TYPES["sint32"]: + buffer.writeVarint32ZigZag(value); + break; + + // Fixed unsigned 32bit + case ProtoBuf.TYPES["fixed32"]: + buffer.writeUint32(value); + break; + + // Fixed signed 32bit + case ProtoBuf.TYPES["sfixed32"]: + buffer.writeInt32(value); + break; + + // 64bit varint as-is + case ProtoBuf.TYPES["int64"]: + case ProtoBuf.TYPES["uint64"]: + buffer.writeVarint64(value); // throws + break; + + // 64bit varint zig-zag + case ProtoBuf.TYPES["sint64"]: + buffer.writeVarint64ZigZag(value); // throws + break; + + // Fixed unsigned 64bit + case ProtoBuf.TYPES["fixed64"]: + buffer.writeUint64(value); // throws + break; + + // Fixed signed 64bit + case ProtoBuf.TYPES["sfixed64"]: + buffer.writeInt64(value); // throws + break; + + // Bool + case ProtoBuf.TYPES["bool"]: + if (typeof value === 'string') + buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value); + else + buffer.writeVarint32(value ? 1 : 0); + break; + + // Constant enum value + case ProtoBuf.TYPES["enum"]: + buffer.writeVarint32(value); + break; + + // 32bit float + case ProtoBuf.TYPES["float"]: + buffer.writeFloat32(value); + break; + + // 64bit float + case ProtoBuf.TYPES["double"]: + buffer.writeFloat64(value); + break; + + // Length-delimited string + case ProtoBuf.TYPES["string"]: + buffer.writeVString(value); + break; + + // Length-delimited bytes + case ProtoBuf.TYPES["bytes"]: + if (value.remaining() < 0) + throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining"); + var prevOffset = value.offset; + buffer.writeVarint32(value.remaining()); + buffer.append(value); + value.offset = prevOffset; + break; + + // Embedded message + case ProtoBuf.TYPES["message"]: + var bb = new ByteBuffer().LE(); + this.resolvedType.encode(value, bb); + buffer.writeVarint32(bb.offset); + buffer.append(bb.flip()); + break; + + // Legacy group + case ProtoBuf.TYPES["group"]: + this.resolvedType.encode(value, buffer); + buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP); + break; + + default: + // We should never end here + throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)"); + } + return buffer; +}; + +/** + * Decode one element value from the specified buffer. + * @param {ByteBuffer} buffer ByteBuffer to decode from + * @param {number} wireType The field wire type + * @param {number} id The field number + * @return {*} Decoded value + * @throws {Error} If the field cannot be decoded + * @expose + */ +ElementPrototype.decode = function(buffer, wireType, id) { + if (wireType != this.type.wireType) + throw Error("Unexpected wire type for element"); + + var value, nBytes; + switch (this.type) { + // 32bit signed varint + case ProtoBuf.TYPES["int32"]: + return buffer.readVarint32() | 0; + + // 32bit unsigned varint + case ProtoBuf.TYPES["uint32"]: + return buffer.readVarint32() >>> 0; + + // 32bit signed varint zig-zag + case ProtoBuf.TYPES["sint32"]: + return buffer.readVarint32ZigZag() | 0; + + // Fixed 32bit unsigned + case ProtoBuf.TYPES["fixed32"]: + return buffer.readUint32() >>> 0; + + case ProtoBuf.TYPES["sfixed32"]: + return buffer.readInt32() | 0; + + // 64bit signed varint + case ProtoBuf.TYPES["int64"]: + return buffer.readVarint64(); + + // 64bit unsigned varint + case ProtoBuf.TYPES["uint64"]: + return buffer.readVarint64().toUnsigned(); + + // 64bit signed varint zig-zag + case ProtoBuf.TYPES["sint64"]: + return buffer.readVarint64ZigZag(); + + // Fixed 64bit unsigned + case ProtoBuf.TYPES["fixed64"]: + return buffer.readUint64(); + + // Fixed 64bit signed + case ProtoBuf.TYPES["sfixed64"]: + return buffer.readInt64(); + + // Bool varint + case ProtoBuf.TYPES["bool"]: + return !!buffer.readVarint32(); + + // Constant enum value (varint) + case ProtoBuf.TYPES["enum"]: + // The following Builder.Message#set will already throw + return buffer.readVarint32(); + + // 32bit float + case ProtoBuf.TYPES["float"]: + return buffer.readFloat(); + + // 64bit float + case ProtoBuf.TYPES["double"]: + return buffer.readDouble(); + + // Length-delimited string + case ProtoBuf.TYPES["string"]: + return buffer.readVString(); + + // Length-delimited bytes + case ProtoBuf.TYPES["bytes"]: { + nBytes = buffer.readVarint32(); + if (buffer.remaining() < nBytes) + throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining()); + value = buffer.clone(); // Offset already set + value.limit = value.offset+nBytes; + buffer.offset += nBytes; + return value; + } + + // Length-delimited embedded message + case ProtoBuf.TYPES["message"]: { + nBytes = buffer.readVarint32(); + return this.resolvedType.decode(buffer, nBytes); + } + + // Legacy group + case ProtoBuf.TYPES["group"]: + return this.resolvedType.decode(buffer, -1, id); + } + + // We should never end here + throw Error("[INTERNAL] Illegal decode type"); +}; + +/** + * Converts a value from a string to the canonical element type. + * + * Legal only when isMapKey is true. + * + * @param {string} str The string value + * @returns {*} The value + */ +ElementPrototype.valueFromString = function(str) { + if (!this.isMapKey) { + throw Error("valueFromString() called on non-map-key element"); + } + + switch (this.type) { + case ProtoBuf.TYPES["int32"]: + case ProtoBuf.TYPES["sint32"]: + case ProtoBuf.TYPES["sfixed32"]: + case ProtoBuf.TYPES["uint32"]: + case ProtoBuf.TYPES["fixed32"]: + return this.verifyValue(parseInt(str)); + + case ProtoBuf.TYPES["int64"]: + case ProtoBuf.TYPES["sint64"]: + case ProtoBuf.TYPES["sfixed64"]: + case ProtoBuf.TYPES["uint64"]: + case ProtoBuf.TYPES["fixed64"]: + // Long-based fields support conversions from string already. + return this.verifyValue(str); + + case ProtoBuf.TYPES["bool"]: + return str === "true"; + + case ProtoBuf.TYPES["string"]: + return this.verifyValue(str); + + case ProtoBuf.TYPES["bytes"]: + return ByteBuffer.fromBinary(str); + } +}; + +/** + * Converts a value from the canonical element type to a string. + * + * It should be the case that `valueFromString(valueToString(val))` returns + * a value equivalent to `verifyValue(val)` for every legal value of `val` + * according to this element type. + * + * This may be used when the element must be stored or used as a string, + * e.g., as a map key on an Object. + * + * Legal only when isMapKey is true. + * + * @param {*} val The value + * @returns {string} The string form of the value. + */ +ElementPrototype.valueToString = function(value) { + if (!this.isMapKey) { + throw Error("valueToString() called on non-map-key element"); + } + + if (this.type === ProtoBuf.TYPES["bytes"]) { + return value.toString("binary"); + } else { + return value.toString(); + } +}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Enum.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Enum.js new file mode 100644 index 0000000..87c05e6 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Enum.js @@ -0,0 +1,68 @@ +/** + * Constructs a new Enum. + * @exports ProtoBuf.Reflect.Enum + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object + * @param {string} name Enum name + * @param {Object.=} options Enum options + * @param {string?} syntax The syntax level (e.g., proto3) + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +var Enum = function(builder, parent, name, options, syntax) { + Namespace.call(this, builder, parent, name, options, syntax); + + /** + * @override + */ + this.className = "Enum"; + + /** + * Runtime enum object. + * @type {Object.|null} + * @expose + */ + this.object = null; +}; + +/** + * Gets the string name of an enum value. + * @param {!ProtoBuf.Builder.Enum} enm Runtime enum + * @param {number} value Enum value + * @returns {?string} Name or `null` if not present + * @expose + */ +Enum.getName = function(enm, value) { + var keys = Object.keys(enm); + for (var i=0, key; i} + * @expose + */ +EnumPrototype.build = function(rebuild) { + if (this.object && !rebuild) + return this.object; + var enm = new ProtoBuf.Builder.Enum(), + values = this.getChildren(Enum.Value); + for (var i=0, k=values.length; i=} options Message options + * @param {boolean=} isGroup `true` if this is a legacy group + * @param {string?} syntax The syntax level of this definition (e.g., proto3) + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +var Message = function(builder, parent, name, options, isGroup, syntax) { + Namespace.call(this, builder, parent, name, options, syntax); + + /** + * @override + */ + this.className = "Message"; + + /** + * Extensions range. + * @type {!Array.|undefined} + * @expose + */ + this.extensions = undefined; + + /** + * Runtime message class. + * @type {?function(new:ProtoBuf.Builder.Message)} + * @expose + */ + this.clazz = null; + + /** + * Whether this is a legacy group or not. + * @type {boolean} + * @expose + */ + this.isGroup = !!isGroup; + + // The following cached collections are used to efficiently iterate over or look up fields when decoding. + + /** + * Cached fields. + * @type {?Array.} + * @private + */ + this._fields = null; + + /** + * Cached fields by id. + * @type {?Object.} + * @private + */ + this._fieldsById = null; + + /** + * Cached fields by name. + * @type {?Object.} + * @private + */ + this._fieldsByName = null; +}; + +/** + * @alias ProtoBuf.Reflect.Message.prototype + * @inner + */ +var MessagePrototype = Message.prototype = Object.create(Namespace.prototype); + +/** + * Builds the message and returns the runtime counterpart, which is a fully functional class. + * @see ProtoBuf.Builder.Message + * @param {boolean=} rebuild Whether to rebuild or not, defaults to false + * @return {ProtoBuf.Reflect.Message} Message class + * @throws {Error} If the message cannot be built + * @expose + */ +MessagePrototype.build = function(rebuild) { + if (this.clazz && !rebuild) + return this.clazz; + + // Create the runtime Message class in its own scope + var clazz = (function(ProtoBuf, T) { + + //? include("../Builder/Message.js"); + + return Message; + + })(ProtoBuf, this); + + // Static enums and prototyped sub-messages / cached collections + this._fields = []; + this._fieldsById = {}; + this._fieldsByName = {}; + this._oneofsByName = {}; + for (var i=0, k=this.children.length, child; i>> 3; + switch (wireType) { + case ProtoBuf.WIRE_TYPES.VARINT: + do tag = buf.readUint8(); + while ((tag & 0x80) === 0x80); + break; + case ProtoBuf.WIRE_TYPES.BITS64: + buf.offset += 8; + break; + case ProtoBuf.WIRE_TYPES.LDELIM: + tag = buf.readVarint32(); // reads the varint + buf.offset += tag; // skips n bytes + break; + case ProtoBuf.WIRE_TYPES.STARTGROUP: + skipTillGroupEnd(id, buf); + break; + case ProtoBuf.WIRE_TYPES.ENDGROUP: + if (id === expectedId) + return false; + else + throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)"); + case ProtoBuf.WIRE_TYPES.BITS32: + buf.offset += 4; + break; + default: + throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType); + } + return true; +} + +/** + * Decodes an encoded message and returns the decoded message. + * @param {ByteBuffer} buffer ByteBuffer to decode from + * @param {number=} length Message length. Defaults to decode all remaining data. + * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group + * @return {ProtoBuf.Builder.Message} Decoded message + * @throws {Error} If the message cannot be decoded + * @expose + */ +MessagePrototype.decode = function(buffer, length, expectedGroupEndId) { + if (typeof length !== 'number') + length = -1; + var start = buffer.offset, + msg = new (this.clazz)(), + tag, wireType, id, field; + while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) { + tag = buffer.readVarint32(); + wireType = tag & 0x07; + id = tag >>> 3; + if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) { + if (id !== expectedGroupEndId) + throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")"); + break; + } + if (!(field = this._fieldsById[id])) { + // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing." + switch (wireType) { + case ProtoBuf.WIRE_TYPES.VARINT: + buffer.readVarint32(); + break; + case ProtoBuf.WIRE_TYPES.BITS32: + buffer.offset += 4; + break; + case ProtoBuf.WIRE_TYPES.BITS64: + buffer.offset += 8; + break; + case ProtoBuf.WIRE_TYPES.LDELIM: + var len = buffer.readVarint32(); + buffer.offset += len; + break; + case ProtoBuf.WIRE_TYPES.STARTGROUP: + while (skipTillGroupEnd(id, buffer)) {} + break; + default: + throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType); + } + continue; + } + if (field.repeated && !field.options["packed"]) { + msg[field.name].push(field.decode(wireType, buffer)); + } else if (field.map) { + var keyval = field.decode(wireType, buffer); + msg[field.name].set(keyval[0], keyval[1]); + } else { + msg[field.name] = field.decode(wireType, buffer); + if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field) + var currentField = msg[field.oneof.name]; // Virtual field references currently set field + if (currentField !== null && currentField !== field.name) + msg[currentField] = null; // Clear currently set field + msg[field.oneof.name] = field.name; // Point virtual field at this field + } + } + } + + // Check if all required fields are present and set default values for optional fields that are not + for (var i=0, k=this._fields.length; i=} options Options + * @constructor + * @extends ProtoBuf.Reflect.Message.Field + */ +var ExtensionField = function(builder, message, rule, type, name, id, options) { + Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options); + + /** + * Extension reference. + * @type {!ProtoBuf.Reflect.Extension} + * @expose + */ + this.extension; +}; + +// Extends Field +ExtensionField.prototype = Object.create(Field.prototype); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/Field.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/Field.js new file mode 100644 index 0000000..d7c3b64 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/Field.js @@ -0,0 +1,458 @@ +/** + * Constructs a new Message Field. + * @exports ProtoBuf.Reflect.Message.Field + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.Message} message Message reference + * @param {string} rule Rule, one of requried, optional, repeated + * @param {string?} keytype Key data type, if any. + * @param {string} type Data type, e.g. int32 + * @param {string} name Field name + * @param {number} id Unique field id + * @param {Object.=} options Options + * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf + * @param {string?} syntax The syntax level of this definition (e.g., proto3) + * @constructor + * @extends ProtoBuf.Reflect.T + */ +var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) { + T.call(this, builder, message, name); + + /** + * @override + */ + this.className = "Message.Field"; + + /** + * Message field required flag. + * @type {boolean} + * @expose + */ + this.required = rule === "required"; + + /** + * Message field repeated flag. + * @type {boolean} + * @expose + */ + this.repeated = rule === "repeated"; + + /** + * Message field map flag. + * @type {boolean} + * @expose + */ + this.map = rule === "map"; + + /** + * Message field key type. Type reference string if unresolved, protobuf + * type if resolved. Valid only if this.map === true, null otherwise. + * @type {string|{name: string, wireType: number}|null} + * @expose + */ + this.keyType = keytype || null; + + /** + * Message field type. Type reference string if unresolved, protobuf type if + * resolved. In a map field, this is the value type. + * @type {string|{name: string, wireType: number}} + * @expose + */ + this.type = type; + + /** + * Resolved type reference inside the global namespace. + * @type {ProtoBuf.Reflect.T|null} + * @expose + */ + this.resolvedType = null; + + /** + * Unique message field id. + * @type {number} + * @expose + */ + this.id = id; + + /** + * Message field options. + * @type {!Object.} + * @dict + * @expose + */ + this.options = options || {}; + + /** + * Default value. + * @type {*} + * @expose + */ + this.defaultValue = null; + + /** + * Enclosing OneOf. + * @type {?ProtoBuf.Reflect.Message.OneOf} + * @expose + */ + this.oneof = oneof || null; + + /** + * Syntax level of this definition (e.g., proto3). + * @type {string} + * @expose + */ + this.syntax = syntax || 'proto2'; + + /** + * Original field name. + * @type {string} + * @expose + */ + this.originalName = this.name; // Used to revert camelcase transformation on naming collisions + + /** + * Element implementation. Created in build() after types are resolved. + * @type {ProtoBuf.Element} + * @expose + */ + this.element = null; + + /** + * Key element implementation, for map fields. Created in build() after + * types are resolved. + * @type {ProtoBuf.Element} + * @expose + */ + this.keyElement = null; + + // Convert field names to camel case notation if the override is set + if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField)) + this.name = ProtoBuf.Util.toCamelCase(this.name); +}; + +/** + * @alias ProtoBuf.Reflect.Message.Field.prototype + * @inner + */ +var FieldPrototype = Field.prototype = Object.create(T.prototype); + +/** + * Builds the field. + * @override + * @expose + */ +FieldPrototype.build = function() { + this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name); + if (this.map) + this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name); + + // In proto3, fields do not have field presence, and every field is set to + // its type's default value ("", 0, 0.0, or false). + if (this.syntax === 'proto3' && !this.repeated && !this.map) + this.defaultValue = Element.defaultFieldValue(this.type); + + // Otherwise, default values are present when explicitly specified + else if (typeof this.options['default'] !== 'undefined') + this.defaultValue = this.verifyValue(this.options['default']); +}; + +/** + * Checks if the given value can be set for this field. + * @param {*} value Value to check + * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false. + * @return {*} Verified, maybe adjusted, value + * @throws {Error} If the value cannot be set for this field + * @expose + */ +FieldPrototype.verifyValue = function(value, skipRepeated) { + skipRepeated = skipRepeated || false; + var self = this; + function fail(val, msg) { + throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")"); + } + if (value === null) { // NULL values for optional fields + if (this.required) + fail(typeof value, "required"); + if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"]) + fail(typeof value, "proto3 field without field presence cannot be null"); + return null; + } + var i; + if (this.repeated && !skipRepeated) { // Repeated values as arrays + if (!Array.isArray(value)) + value = [value]; + var res = []; + for (i=0; i 0; + + case ProtoBuf.TYPES["bytes"]: + return value.remaining() > 0; + + case ProtoBuf.TYPES["enum"]: + return value !== 0; + + case ProtoBuf.TYPES["message"]: + return value !== null; + default: + return true; + } +}; + +/** + * Encodes the specified field value to the specified buffer. + * @param {*} value Verified field value + * @param {ByteBuffer} buffer ByteBuffer to encode to + * @param {!ProtoBuf.Builder.Message} message Runtime message + * @return {ByteBuffer} The ByteBuffer for chaining + * @throws {Error} If the field cannot be encoded + * @expose + */ +FieldPrototype.encode = function(value, buffer, message) { + if (this.type === null || typeof this.type !== 'object') + throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type); + if (value === null || (this.repeated && value.length == 0)) + return buffer; // Optional omitted + try { + if (this.repeated) { + var i; + // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire + // types) can be declared 'packed'." + if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) { + // "All of the elements of the field are packed into a single key-value pair with wire type 2 + // (length-delimited). Each element is encoded the same way it would be normally, except without a + // tag preceding it." + buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM); + buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1 + var start = buffer.offset; // Remember where the contents begin + for (i=0; i 1) { // We need to move the contents + var contents = buffer.slice(start, buffer.offset); + start += varintLen-1; + buffer.offset = start; + buffer.append(contents); + } + buffer.writeVarint32(len, start-varintLen); + } else { + // "If your message definition has repeated elements (without the [packed=true] option), the encoded + // message has zero or more key-value pairs with the same tag number" + for (i=0; i= 0) { + n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM); + ni = 0; + for (i=0; i= 0) { + if (!skipRepeated) { + nBytes = buffer.readVarint32(); + nBytes = buffer.offset + nBytes; // Limit + var values = []; + while (buffer.offset < nBytes) + values.push(this.decode(this.type.wireType, buffer, true)); + return values; + } + // Read the next value otherwise... + } + + // Handle maps. + if (this.map) { + // Read one (key, value) submessage, and return [key, value] + var key = Element.defaultFieldValue(this.keyType); + value = Element.defaultFieldValue(this.type); + + // Read the length + nBytes = buffer.readVarint32(); + if (buffer.remaining() < nBytes) + throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining()); + + // Get a sub-buffer of this key/value submessage + var msgbuf = buffer.clone(); + msgbuf.limit = msgbuf.offset + nBytes; + buffer.offset += nBytes; + + while (msgbuf.remaining() > 0) { + var tag = msgbuf.readVarint32(); + wireType = tag & 0x07; + var id = tag >>> 3; + if (id === 1) { + key = this.keyElement.decode(msgbuf, wireType, id); + } else if (id === 2) { + value = this.element.decode(msgbuf, wireType, id); + } else { + throw Error("Unexpected tag in map field key/value submessage"); + } + } + + return [key, value]; + } + + // Handle singular and non-packed repeated field values. + return this.element.decode(buffer, wireType, this.id); +}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/OneOf.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/OneOf.js new file mode 100644 index 0000000..07a896f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/OneOf.js @@ -0,0 +1,19 @@ +/** + * Constructs a new Message OneOf. + * @exports ProtoBuf.Reflect.Message.OneOf + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.Message} message Message reference + * @param {string} name OneOf name + * @constructor + * @extends ProtoBuf.Reflect.T + */ +var OneOf = function(builder, message, name) { + T.call(this, builder, message, name); + + /** + * Enclosed fields. + * @type {!Array.} + * @expose + */ + this.fields = []; +}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Namespace.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Namespace.js new file mode 100644 index 0000000..b5c96c9 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Namespace.js @@ -0,0 +1,203 @@ +/** + * Constructs a new Namespace. + * @exports ProtoBuf.Reflect.Namespace + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent + * @param {string} name Namespace name + * @param {Object.=} options Namespace options + * @param {string?} syntax The syntax level of this definition (e.g., proto3) + * @constructor + * @extends ProtoBuf.Reflect.T + */ +var Namespace = function(builder, parent, name, options, syntax) { + T.call(this, builder, parent, name); + + /** + * @override + */ + this.className = "Namespace"; + + /** + * Children inside the namespace. + * @type {!Array.} + */ + this.children = []; + + /** + * Options. + * @type {!Object.} + */ + this.options = options || {}; + + /** + * Syntax level (e.g., proto2 or proto3). + * @type {!string} + */ + this.syntax = syntax || "proto2"; +}; + +/** + * @alias ProtoBuf.Reflect.Namespace.prototype + * @inner + */ +var NamespacePrototype = Namespace.prototype = Object.create(T.prototype); + +/** + * Returns an array of the namespace's children. + * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children). + * @return {Array.} + * @expose + */ +NamespacePrototype.getChildren = function(type) { + type = type || null; + if (type == null) + return this.children.slice(); + var children = []; + for (var i=0, k=this.children.length; i} qn Qualified name to resolve + * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false` + * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found + * @expose + */ +NamespacePrototype.resolve = function(qn, excludeNonNamespace) { + var part = typeof qn === 'string' ? qn.split(".") : qn, + ptr = this, + i = 0; + if (part[i] === "") { // Fully qualified name, e.g. ".My.Message' + while (ptr.parent !== null) + ptr = ptr.parent; + i++; + } + var child; + do { + do { + if (!(ptr instanceof Reflect.Namespace)) { + ptr = null; + break; + } + child = ptr.getChild(part[i]); + if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) { + ptr = null; + break; + } + ptr = child; i++; + } while (i < part.length); + if (ptr != null) + break; // Found + // Else search the parent + if (this.parent !== null) + return this.parent.resolve(qn, excludeNonNamespace); + } while (ptr != null); + return ptr; +}; + +/** + * Determines the shortest qualified name of the specified type, if any, relative to this namespace. + * @param {!ProtoBuf.Reflect.T} t Reflection type + * @returns {string} The shortest qualified name or, if there is none, the fqn + * @expose + */ +NamespacePrototype.qn = function(t) { + var part = [], ptr = t; + do { + part.unshift(ptr.name); + ptr = ptr.parent; + } while (ptr !== null); + for (var len=1; len <= part.length; len++) { + var qn = part.slice(part.length-len); + if (t === this.resolve(qn, t instanceof Reflect.Namespace)) + return qn.join("."); + } + return t.fqn(); +}; + +/** + * Builds the namespace and returns the runtime counterpart. + * @return {Object.} Runtime namespace + * @expose + */ +NamespacePrototype.build = function() { + /** @dict */ + var ns = {}; + var children = this.children; + for (var i=0, k=children.length, child; i} + */ +NamespacePrototype.buildOpt = function() { + var opt = {}, + keys = Object.keys(this.options); + for (var i=0, k=keys.length; i}null} Option value or NULL if there is no such option + */ +NamespacePrototype.getOption = function(name) { + if (typeof name === 'undefined') + return this.options; + return typeof this.options[name] !== 'undefined' ? this.options[name] : null; +}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Service.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Service.js new file mode 100644 index 0000000..025df11 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Service.js @@ -0,0 +1,52 @@ +/** + * Constructs a new Service. + * @exports ProtoBuf.Reflect.Service + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.Namespace} root Root + * @param {string} name Service name + * @param {Object.=} options Options + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +var Service = function(builder, root, name, options) { + Namespace.call(this, builder, root, name, options); + + /** + * @override + */ + this.className = "Service"; + + /** + * Built runtime service class. + * @type {?function(new:ProtoBuf.Builder.Service)} + */ + this.clazz = null; +}; + +/** + * @alias ProtoBuf.Reflect.Service.prototype + * @inner + */ +var ServicePrototype = Service.prototype = Object.create(Namespace.prototype); + +/** + * Builds the service and returns the runtime counterpart, which is a fully functional class. + * @see ProtoBuf.Builder.Service + * @param {boolean=} rebuild Whether to rebuild or not + * @return {Function} Service class + * @throws {Error} If the message cannot be built + * @expose + */ +ServicePrototype.build = function(rebuild) { + if (this.clazz && !rebuild) + return this.clazz; + + // Create the runtime Service class in its own scope + return this.clazz = (function(ProtoBuf, T) { + + //? include("../Builder/Service.js"); + + return Service; + + })(ProtoBuf, this); +}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/Method.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/Method.js new file mode 100644 index 0000000..9d56ef6 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/Method.js @@ -0,0 +1,39 @@ +/** + * Abstract service method. + * @exports ProtoBuf.Reflect.Service.Method + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.Service} svc Service + * @param {string} name Method name + * @param {Object.=} options Options + * @constructor + * @extends ProtoBuf.Reflect.T + */ +var Method = function(builder, svc, name, options) { + T.call(this, builder, svc, name); + + /** + * @override + */ + this.className = "Service.Method"; + + /** + * Options. + * @type {Object.} + * @expose + */ + this.options = options || {}; +}; + +/** + * @alias ProtoBuf.Reflect.Service.Method.prototype + * @inner + */ +var MethodPrototype = Method.prototype = Object.create(T.prototype); + +/** + * Builds the method's '$options' property. + * @name ProtoBuf.Reflect.Service.Method#buildOpt + * @function + * @return {Object.} + */ +MethodPrototype.buildOpt = NamespacePrototype.buildOpt; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/RPCMethod.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/RPCMethod.js new file mode 100644 index 0000000..3c12b02 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/RPCMethod.js @@ -0,0 +1,67 @@ +/** + * RPC service method. + * @exports ProtoBuf.Reflect.Service.RPCMethod + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.Service} svc Service + * @param {string} name Method name + * @param {string} request Request message name + * @param {string} response Response message name + * @param {boolean} request_stream Whether requests are streamed + * @param {boolean} response_stream Whether responses are streamed + * @param {Object.=} options Options + * @constructor + * @extends ProtoBuf.Reflect.Service.Method + */ +var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) { + Method.call(this, builder, svc, name, options); + + /** + * @override + */ + this.className = "Service.RPCMethod"; + + /** + * Request message name. + * @type {string} + * @expose + */ + this.requestName = request; + + /** + * Response message name. + * @type {string} + * @expose + */ + this.responseName = response; + + /** + * Whether requests are streamed + * @type {bool} + * @expose + */ + this.requestStream = request_stream; + + /** + * Whether responses are streamed + * @type {bool} + * @expose + */ + this.responseStream = response_stream; + + /** + * Resolved request message type. + * @type {ProtoBuf.Reflect.Message} + * @expose + */ + this.resolvedRequestType = null; + + /** + * Resolved response message type. + * @type {ProtoBuf.Reflect.Message} + * @expose + */ + this.resolvedResponseType = null; +}; + +// Extends Method +RPCMethod.prototype = Object.create(Method.prototype); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/T.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/T.js new file mode 100644 index 0000000..12d2b13 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Reflect/T.js @@ -0,0 +1,81 @@ +/** + * Constructs a Reflect base class. + * @exports ProtoBuf.Reflect.T + * @constructor + * @abstract + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {?ProtoBuf.Reflect.T} parent Parent object + * @param {string} name Object name + */ +var T = function(builder, parent, name) { + + /** + * Builder reference. + * @type {!ProtoBuf.Builder} + * @expose + */ + this.builder = builder; + + /** + * Parent object. + * @type {?ProtoBuf.Reflect.T} + * @expose + */ + this.parent = parent; + + /** + * Object name in namespace. + * @type {string} + * @expose + */ + this.name = name; + + /** + * Fully qualified class name + * @type {string} + * @expose + */ + this.className; +}; + +/** + * @alias ProtoBuf.Reflect.T.prototype + * @inner + */ +var TPrototype = T.prototype; + +/** + * Returns the fully qualified name of this object. + * @returns {string} Fully qualified name as of ".PATH.TO.THIS" + * @expose + */ +TPrototype.fqn = function() { + var name = this.name, + ptr = this; + do { + ptr = ptr.parent; + if (ptr == null) + break; + name = ptr.name+"."+name; + } while (true); + return name; +}; + +/** + * Returns a string representation of this Reflect object (its fully qualified name). + * @param {boolean=} includeClass Set to true to include the class name. Defaults to false. + * @return String representation + * @expose + */ +TPrototype.toString = function(includeClass) { + return (includeClass ? this.className + " " : "") + this.fqn(); +}; + +/** + * Builds this type. + * @throws {Error} If this type cannot be built directly + * @expose + */ +TPrototype.build = function() { + throw Error(this.toString(true)+" cannot be built directly"); +}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Util.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Util.js new file mode 100644 index 0000000..d8dc06e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/ProtoBuf/Util.js @@ -0,0 +1,116 @@ +/** + * @alias ProtoBuf.Util + * @expose + */ +ProtoBuf.Util = (function() { + "use strict"; + + /** + * ProtoBuf utilities. + * @exports ProtoBuf.Util + * @namespace + */ + var Util = {}; + + /** + * Flag if running in node or not. + * @type {boolean} + * @const + * @expose + */ + Util.IS_NODE = !!( + typeof process === 'object' && process+'' === '[object process]' && !process['browser'] + ); + + /** + * Constructs a XMLHttpRequest object. + * @return {XMLHttpRequest} + * @throws {Error} If XMLHttpRequest is not supported + * @expose + */ + Util.XHR = function() { + // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html + var XMLHttpFactories = [ + function () {return new XMLHttpRequest()}, + function () {return new ActiveXObject("Msxml2.XMLHTTP")}, + function () {return new ActiveXObject("Msxml3.XMLHTTP")}, + function () {return new ActiveXObject("Microsoft.XMLHTTP")} + ]; + /** @type {?XMLHttpRequest} */ + var xhr = null; + for (var i=0;i 1) + throw Error('illegal number of arguments'); + function F() {} + F.prototype = o; + return new F(); + }; + +// ref: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray +if (!Array.isArray) + /** @expose */ + Array.isArray = function(o) { + return Object.prototype.toString.call(o) === "[object Array]"; + }; + +// ref: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach +if (!Array.prototype.forEach) + /** @expose */ + Array.prototype.forEach = function(callback, thisArg) { + var T, k; + if (this == null) + throw new TypeError('this is null or not defined'); + var O = Object(this); + var len = O.length >>> 0; + if (typeof callback !== "function") + throw new TypeError(callback + ' is not a function'); + if (arguments.length > 1) + T = thisArg; + k = 0; + while (k < len) { + var kValue; + if (k in O) + kValue = O[k], + callback.call(T, kValue, k, O); + k++; + } + }; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/google/protobuf/README.md b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/google/protobuf/README.md new file mode 100644 index 0000000..9f0c426 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/google/protobuf/README.md @@ -0,0 +1,13 @@ +These files are by default not used by ProtoBuf.js and are here for the purpose of completeness. The library does not +need and therefore does not use these files by design. In most use cases including the descriptor isn't even required +and would just add about 10KB (minified JSON) to your application. + +### Though it's possible to include them: + +1. You may explicitly reference them by providing a relative or absolute path in your .proto files. E.g. use + `./google/protobuf/descriptor.proto` and bundle the file with your application. + +2. If you use the `proto2js` command line utility with the `-legacy` option and the descriptor namespace is explicitly + referenced, it is included in the generated output. + +You are then able to work with it as if it'd be no more and no less than a standard import. diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/google/protobuf/descriptor.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/google/protobuf/descriptor.json new file mode 100644 index 0000000..2cb3cc1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/google/protobuf/descriptor.json @@ -0,0 +1,849 @@ +{ + "package": "google.protobuf", + "syntax": "proto2", + "options": { + "java_package": "com.google.protobuf", + "java_outer_classname": "DescriptorProtos", + "optimize_for": "SPEED" + }, + "messages": [ + { + "name": "FileDescriptorSet", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "FileDescriptorProto", + "name": "file", + "id": 1 + } + ] + }, + { + "name": "FileDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "type": "string", + "name": "package", + "id": 2 + }, + { + "rule": "repeated", + "type": "string", + "name": "dependency", + "id": 3 + }, + { + "rule": "repeated", + "type": "int32", + "name": "public_dependency", + "id": 10 + }, + { + "rule": "repeated", + "type": "int32", + "name": "weak_dependency", + "id": 11 + }, + { + "rule": "repeated", + "type": "DescriptorProto", + "name": "message_type", + "id": 4 + }, + { + "rule": "repeated", + "type": "EnumDescriptorProto", + "name": "enum_type", + "id": 5 + }, + { + "rule": "repeated", + "type": "ServiceDescriptorProto", + "name": "service", + "id": 6 + }, + { + "rule": "repeated", + "type": "FieldDescriptorProto", + "name": "extension", + "id": 7 + }, + { + "rule": "optional", + "type": "FileOptions", + "name": "options", + "id": 8 + }, + { + "rule": "optional", + "type": "SourceCodeInfo", + "name": "source_code_info", + "id": 9 + } + ] + }, + { + "name": "DescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "repeated", + "type": "FieldDescriptorProto", + "name": "field", + "id": 2 + }, + { + "rule": "repeated", + "type": "FieldDescriptorProto", + "name": "extension", + "id": 6 + }, + { + "rule": "repeated", + "type": "DescriptorProto", + "name": "nested_type", + "id": 3 + }, + { + "rule": "repeated", + "type": "EnumDescriptorProto", + "name": "enum_type", + "id": 4 + }, + { + "rule": "repeated", + "type": "ExtensionRange", + "name": "extension_range", + "id": 5 + }, + { + "rule": "optional", + "type": "MessageOptions", + "name": "options", + "id": 7 + } + ], + "messages": [ + { + "name": "ExtensionRange", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "int32", + "name": "start", + "id": 1 + }, + { + "rule": "optional", + "type": "int32", + "name": "end", + "id": 2 + } + ] + } + ] + }, + { + "name": "FieldDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "type": "int32", + "name": "number", + "id": 3 + }, + { + "rule": "optional", + "type": "Label", + "name": "label", + "id": 4 + }, + { + "rule": "optional", + "type": "Type", + "name": "type", + "id": 5 + }, + { + "rule": "optional", + "type": "string", + "name": "type_name", + "id": 6 + }, + { + "rule": "optional", + "type": "string", + "name": "extendee", + "id": 2 + }, + { + "rule": "optional", + "type": "string", + "name": "default_value", + "id": 7 + }, + { + "rule": "optional", + "type": "FieldOptions", + "name": "options", + "id": 8 + } + ], + "enums": [ + { + "name": "Type", + "syntax": "proto2", + "values": [ + { + "name": "TYPE_DOUBLE", + "id": 1 + }, + { + "name": "TYPE_FLOAT", + "id": 2 + }, + { + "name": "TYPE_INT64", + "id": 3 + }, + { + "name": "TYPE_UINT64", + "id": 4 + }, + { + "name": "TYPE_INT32", + "id": 5 + }, + { + "name": "TYPE_FIXED64", + "id": 6 + }, + { + "name": "TYPE_FIXED32", + "id": 7 + }, + { + "name": "TYPE_BOOL", + "id": 8 + }, + { + "name": "TYPE_STRING", + "id": 9 + }, + { + "name": "TYPE_GROUP", + "id": 10 + }, + { + "name": "TYPE_MESSAGE", + "id": 11 + }, + { + "name": "TYPE_BYTES", + "id": 12 + }, + { + "name": "TYPE_UINT32", + "id": 13 + }, + { + "name": "TYPE_ENUM", + "id": 14 + }, + { + "name": "TYPE_SFIXED32", + "id": 15 + }, + { + "name": "TYPE_SFIXED64", + "id": 16 + }, + { + "name": "TYPE_SINT32", + "id": 17 + }, + { + "name": "TYPE_SINT64", + "id": 18 + } + ] + }, + { + "name": "Label", + "syntax": "proto2", + "values": [ + { + "name": "LABEL_OPTIONAL", + "id": 1 + }, + { + "name": "LABEL_REQUIRED", + "id": 2 + }, + { + "name": "LABEL_REPEATED", + "id": 3 + } + ] + } + ] + }, + { + "name": "EnumDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "repeated", + "type": "EnumValueDescriptorProto", + "name": "value", + "id": 2 + }, + { + "rule": "optional", + "type": "EnumOptions", + "name": "options", + "id": 3 + } + ] + }, + { + "name": "EnumValueDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "type": "int32", + "name": "number", + "id": 2 + }, + { + "rule": "optional", + "type": "EnumValueOptions", + "name": "options", + "id": 3 + } + ] + }, + { + "name": "ServiceDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "repeated", + "type": "MethodDescriptorProto", + "name": "method", + "id": 2 + }, + { + "rule": "optional", + "type": "ServiceOptions", + "name": "options", + "id": 3 + } + ] + }, + { + "name": "MethodDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "type": "string", + "name": "input_type", + "id": 2 + }, + { + "rule": "optional", + "type": "string", + "name": "output_type", + "id": 3 + }, + { + "rule": "optional", + "type": "MethodOptions", + "name": "options", + "id": 4 + } + ] + }, + { + "name": "FileOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "java_package", + "id": 1 + }, + { + "rule": "optional", + "type": "string", + "name": "java_outer_classname", + "id": 8 + }, + { + "rule": "optional", + "type": "bool", + "name": "java_multiple_files", + "id": 10, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "bool", + "name": "java_generate_equals_and_hash", + "id": 20, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "OptimizeMode", + "name": "optimize_for", + "id": 9, + "options": { + "default": "SPEED" + } + }, + { + "rule": "optional", + "type": "string", + "name": "go_package", + "id": 11 + }, + { + "rule": "optional", + "type": "bool", + "name": "cc_generic_services", + "id": 16, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "bool", + "name": "java_generic_services", + "id": 17, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "bool", + "name": "py_generic_services", + "id": 18, + "options": { + "default": false + } + }, + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "enums": [ + { + "name": "OptimizeMode", + "syntax": "proto2", + "values": [ + { + "name": "SPEED", + "id": 1 + }, + { + "name": "CODE_SIZE", + "id": 2 + }, + { + "name": "LITE_RUNTIME", + "id": 3 + } + ] + } + ] + }, + { + "name": "MessageOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "bool", + "name": "message_set_wire_format", + "id": 1, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "bool", + "name": "no_standard_descriptor_accessor", + "id": 2, + "options": { + "default": false + } + }, + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + { + "name": "FieldOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "CType", + "name": "ctype", + "id": 1, + "options": { + "default": "STRING" + } + }, + { + "rule": "optional", + "type": "bool", + "name": "packed", + "id": 2 + }, + { + "rule": "optional", + "type": "bool", + "name": "lazy", + "id": 5, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "bool", + "name": "deprecated", + "id": 3, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "string", + "name": "experimental_map_key", + "id": 9 + }, + { + "rule": "optional", + "type": "bool", + "name": "weak", + "id": 10, + "options": { + "default": false + } + }, + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "enums": [ + { + "name": "CType", + "syntax": "proto2", + "values": [ + { + "name": "STRING", + "id": 0 + }, + { + "name": "CORD", + "id": 1 + }, + { + "name": "STRING_PIECE", + "id": 2 + } + ] + } + ] + }, + { + "name": "EnumOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "bool", + "name": "allow_alias", + "id": 2, + "options": { + "default": true + } + }, + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + { + "name": "EnumValueOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + { + "name": "ServiceOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + { + "name": "MethodOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + { + "name": "UninterpretedOption", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "NamePart", + "name": "name", + "id": 2 + }, + { + "rule": "optional", + "type": "string", + "name": "identifier_value", + "id": 3 + }, + { + "rule": "optional", + "type": "uint64", + "name": "positive_int_value", + "id": 4 + }, + { + "rule": "optional", + "type": "int64", + "name": "negative_int_value", + "id": 5 + }, + { + "rule": "optional", + "type": "double", + "name": "double_value", + "id": 6 + }, + { + "rule": "optional", + "type": "bytes", + "name": "string_value", + "id": 7 + }, + { + "rule": "optional", + "type": "string", + "name": "aggregate_value", + "id": 8 + } + ], + "messages": [ + { + "name": "NamePart", + "syntax": "proto2", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "name_part", + "id": 1 + }, + { + "rule": "required", + "type": "bool", + "name": "is_extension", + "id": 2 + } + ] + } + ] + }, + { + "name": "SourceCodeInfo", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "Location", + "name": "location", + "id": 1 + } + ], + "messages": [ + { + "name": "Location", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "int32", + "name": "path", + "id": 1, + "options": { + "packed": true + } + }, + { + "rule": "repeated", + "type": "int32", + "name": "span", + "id": 2, + "options": { + "packed": true + } + }, + { + "rule": "optional", + "type": "string", + "name": "leading_comments", + "id": 3 + }, + { + "rule": "optional", + "type": "string", + "name": "trailing_comments", + "id": 4 + } + ] + } + ] + } + ], + "isNamespace": true +} \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/google/protobuf/descriptor.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/google/protobuf/descriptor.proto new file mode 100644 index 0000000..83fe2e1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/google/protobuf/descriptor.proto @@ -0,0 +1,620 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + + + +package google.protobuf; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field whithout harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; + optional int32 end = 2; + } + repeated ExtensionRange extension_range = 5; + + optional MessageOptions options = 7; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + TYPE_GROUP = 10; // Tag-delimited aggregate. + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + }; + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + // TODO(sanjay): Should we add LABEL_MAP? + }; + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be either TYPE_ENUM or TYPE_MESSAGE. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + optional string default_value = 7; + + optional FieldOptions options = 8; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; +} + + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Object-C plugin) and your porject website (if available) -- there's no need +// to explain how you intend to use them. Usually you only need one extension +// number. You can declare multiple options with only one extension number by +// putting them in a sub-message. See the Custom Options section of the docs +// for examples: +// http://code.google.com/apis/protocolbuffers/docs/proto.html#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default=false]; + + // If set true, then the Java code generator will generate equals() and + // hashCode() methods for all messages defined in the .proto file. This is + // purely a speed optimization, as the AbstractMessage base class includes + // reflection-based implementations of these methods. + optional bool java_generate_equals_and_hash = 20 [default=false]; + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default=SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. There is no default. + optional string go_package = 11; + + + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of proto2. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default=false]; + optional bool java_generic_services = 17 [default=false]; + optional bool py_generic_services = 18 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default=false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. + optional bool packed = 2; + + + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outher message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default=false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default=false]; + + // EXPERIMENTAL. DO NOT USE. + // For "map" fields, the name of the field in the enclosed type that + // is the key for this map. For example, suppose we have: + // message Item { + // required string name = 1; + // required string value = 2; + // } + // message Config { + // repeated Item items = 1 [experimental_map_key="name"]; + // } + // In this situation, the map key for Item will be set to "name". + // TODO: Fully-implement this, then remove the "experimental_" prefix. + optional string experimental_map_key = 9; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // Set this option to false to disallow mapping different tag names to a same + // value. + optional bool allow_alias = 2 [default=true]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + 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; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed=true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed=true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + optional string leading_comments = 3; + optional string trailing_comments = 4; + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/protobuf.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/protobuf.js new file mode 100644 index 0000000..6efc681 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/protobuf.js @@ -0,0 +1,421 @@ +/** + * The ProtoBuf namespace. + * @exports ProtoBuf + * @namespace + * @expose + */ +var ProtoBuf = {}; + +/** + * @type {!function(new: ByteBuffer, ...[*])} + * @expose + */ +ProtoBuf.ByteBuffer = ByteBuffer; + +/** + * @type {?function(new: Long, ...[*])} + * @expose + */ +ProtoBuf.Long = ByteBuffer.Long || null; + +/** + * ProtoBuf.js version. + * @type {string} + * @const + * @expose + */ +ProtoBuf.VERSION = "/*?= VERSION */"; + +/** + * Wire types. + * @type {Object.} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES = {}; + +/** + * Varint wire type. + * @type {number} + * @expose + */ +ProtoBuf.WIRE_TYPES.VARINT = 0; + +/** + * Fixed 64 bits wire type. + * @type {number} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES.BITS64 = 1; + +/** + * Length delimited wire type. + * @type {number} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES.LDELIM = 2; + +/** + * Start group wire type. + * @type {number} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES.STARTGROUP = 3; + +/** + * End group wire type. + * @type {number} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES.ENDGROUP = 4; + +/** + * Fixed 32 bits wire type. + * @type {number} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES.BITS32 = 5; + +/** + * Packable wire types. + * @type {!Array.} + * @const + * @expose + */ +ProtoBuf.PACKABLE_WIRE_TYPES = [ + ProtoBuf.WIRE_TYPES.VARINT, + ProtoBuf.WIRE_TYPES.BITS64, + ProtoBuf.WIRE_TYPES.BITS32 +]; + +/** + * Types. + * @dict + * @type {!Object.} + * @const + * @expose + */ +ProtoBuf.TYPES = { + // According to the protobuf spec. + "int32": { + name: "int32", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: 0 + }, + "uint32": { + name: "uint32", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: 0 + }, + "sint32": { + name: "sint32", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: 0 + }, + "int64": { + name: "int64", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined + }, + "uint64": { + name: "uint64", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined + }, + "sint64": { + name: "sint64", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined + }, + "bool": { + name: "bool", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: false + }, + "double": { + name: "double", + wireType: ProtoBuf.WIRE_TYPES.BITS64, + defaultValue: 0 + }, + "string": { + name: "string", + wireType: ProtoBuf.WIRE_TYPES.LDELIM, + defaultValue: "" + }, + "bytes": { + name: "bytes", + wireType: ProtoBuf.WIRE_TYPES.LDELIM, + defaultValue: null // overridden in the code, must be a unique instance + }, + "fixed32": { + name: "fixed32", + wireType: ProtoBuf.WIRE_TYPES.BITS32, + defaultValue: 0 + }, + "sfixed32": { + name: "sfixed32", + wireType: ProtoBuf.WIRE_TYPES.BITS32, + defaultValue: 0 + }, + "fixed64": { + name: "fixed64", + wireType: ProtoBuf.WIRE_TYPES.BITS64, + defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined + }, + "sfixed64": { + name: "sfixed64", + wireType: ProtoBuf.WIRE_TYPES.BITS64, + defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined + }, + "float": { + name: "float", + wireType: ProtoBuf.WIRE_TYPES.BITS32, + defaultValue: 0 + }, + "enum": { + name: "enum", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: 0 + }, + "message": { + name: "message", + wireType: ProtoBuf.WIRE_TYPES.LDELIM, + defaultValue: null + }, + "group": { + name: "group", + wireType: ProtoBuf.WIRE_TYPES.STARTGROUP, + defaultValue: null + } +}; + +/** + * Valid map key types. + * @type {!Array.>} + * @const + * @expose + */ +ProtoBuf.MAP_KEY_TYPES = [ + ProtoBuf.TYPES["int32"], + ProtoBuf.TYPES["sint32"], + ProtoBuf.TYPES["sfixed32"], + ProtoBuf.TYPES["uint32"], + ProtoBuf.TYPES["fixed32"], + ProtoBuf.TYPES["int64"], + ProtoBuf.TYPES["sint64"], + ProtoBuf.TYPES["sfixed64"], + ProtoBuf.TYPES["uint64"], + ProtoBuf.TYPES["fixed64"], + ProtoBuf.TYPES["bool"], + ProtoBuf.TYPES["string"], + ProtoBuf.TYPES["bytes"] +]; + +/** + * Minimum field id. + * @type {number} + * @const + * @expose + */ +ProtoBuf.ID_MIN = 1; + +/** + * Maximum field id. + * @type {number} + * @const + * @expose + */ +ProtoBuf.ID_MAX = 0x1FFFFFFF; + +/** + * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`. + * Must be set prior to parsing. + * @type {boolean} + * @expose + */ +ProtoBuf.convertFieldsToCamelCase = false; + +/** + * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by + * setting this to `false` prior to building messages. + * @type {boolean} + * @expose + */ +ProtoBuf.populateAccessors = true; + +/** + * By default, messages are populated with default values if a field is not present on the wire. To disable + * this behavior, set this setting to `false`. + * @type {boolean} + * @expose + */ +ProtoBuf.populateDefaults = true; + +//? include("ProtoBuf/Util.js"); + +//? include("ProtoBuf/Lang.js"); + +//? if (DOTPROTO) include("ProtoBuf/DotProto.js"); + +//? include("ProtoBuf/Reflect.js"); + +//? include("ProtoBuf/Builder.js"); + +//? include("ProtoBuf/Map.js"); + +//? if (DOTPROTO) { + +/** + * Loads a .proto string and returns the Builder. + * @param {string} proto .proto file contents + * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted. + * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports. + * @return {ProtoBuf.Builder} Builder to create new messages + * @throws {Error} If the definition cannot be parsed or built + * @expose + */ +ProtoBuf.loadProto = function(proto, builder, filename) { + if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string')) + filename = builder, + builder = undefined; + return ProtoBuf.loadJson(ProtoBuf.DotProto.Parser.parse(proto), builder, filename); +}; + +/** + * Loads a .proto string and returns the Builder. This is an alias of {@link ProtoBuf.loadProto}. + * @function + * @param {string} proto .proto file contents + * @param {(ProtoBuf.Builder|string)=} builder Builder to append to. Will create a new one if omitted. + * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports. + * @return {ProtoBuf.Builder} Builder to create new messages + * @throws {Error} If the definition cannot be parsed or built + * @expose + */ +ProtoBuf.protoFromString = ProtoBuf.loadProto; // Legacy + +/** + * Loads a .proto file and returns the Builder. + * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with + * an overridden 'root' path for all imported files. + * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and + * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + * file will be read synchronously and this function will return the Builder. + * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted. + * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the + * request has failed), else undefined + * @expose + */ +ProtoBuf.loadProtoFile = function(filename, callback, builder) { + if (callback && typeof callback === 'object') + builder = callback, + callback = null; + else if (!callback || typeof callback !== 'function') + callback = null; + if (callback) + return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) { + if (contents === null) { + callback(Error("Failed to fetch file")); + return; + } + try { + callback(null, ProtoBuf.loadProto(contents, builder, filename)); + } catch (e) { + callback(e); + } + }); + var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename); + return contents === null ? null : ProtoBuf.loadProto(contents, builder, filename); +}; + +/** + * Loads a .proto file and returns the Builder. This is an alias of {@link ProtoBuf.loadProtoFile}. + * @function + * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with + * an overridden 'root' path for all imported files. + * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and + * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + * file will be read synchronously and this function will return the Builder. + * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted. + * @return {!ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the + * request has failed), else undefined + * @expose + */ +ProtoBuf.protoFromFile = ProtoBuf.loadProtoFile; // Legacy + +//? } // DOTPROTO + +/** + * Constructs a new empty Builder. + * @param {Object.=} options Builder options, defaults to global options set on ProtoBuf + * @return {!ProtoBuf.Builder} Builder + * @expose + */ +ProtoBuf.newBuilder = function(options) { + options = options || {}; + if (typeof options['convertFieldsToCamelCase'] === 'undefined') + options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase; + if (typeof options['populateAccessors'] === 'undefined') + options['populateAccessors'] = ProtoBuf.populateAccessors; + return new ProtoBuf.Builder(options); +}; + +/** + * Loads a .json definition and returns the Builder. + * @param {!*|string} json JSON definition + * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted. + * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports. + * @return {ProtoBuf.Builder} Builder to create new messages + * @throws {Error} If the definition cannot be parsed or built + * @expose + */ +ProtoBuf.loadJson = function(json, builder, filename) { + if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string')) + filename = builder, + builder = null; + if (!builder || typeof builder !== 'object') + builder = ProtoBuf.newBuilder(); + if (typeof json === 'string') + json = JSON.parse(json); + builder["import"](json, filename); + builder.resolveAll(); + return builder; +}; + +/** + * Loads a .json file and returns the Builder. + * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with + * an overridden 'root' path for all imported files. + * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and + * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + * file will be read synchronously and this function will return the Builder. + * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted. + * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the + * request has failed), else undefined + * @expose + */ +ProtoBuf.loadJsonFile = function(filename, callback, builder) { + if (callback && typeof callback === 'object') + builder = callback, + callback = null; + else if (!callback || typeof callback !== 'function') + callback = null; + if (callback) + return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) { + if (contents === null) { + callback(Error("Failed to fetch file")); + return; + } + try { + callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename)); + } catch (e) { + callback(e); + } + }); + var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename); + return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename); +}; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/src/wrap.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/wrap.js new file mode 100644 index 0000000..3fabafd --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/src/wrap.js @@ -0,0 +1,37 @@ +/* + Copyright 2013 Daniel Wirtz + + 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. + */ + +/** + * @license protobuf.js (c) 2013 Daniel Wirtz + * Released under the Apache License, Version 2.0 + * see: https://github.com/dcodeIO/protobuf.js for details + */ +(function(global, factory) { + + /* AMD */ if (typeof define === 'function' && define["amd"]) + define(["bytebuffer"], factory); + /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"]) + module["exports"] = factory(require("bytebuffer"), true); + /* Global */ else + (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]); + +})(this, function(ByteBuffer, isCommonJS) { + "use strict"; + + //? include("protobuf.js"); + + return ProtoBuf; +}); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/PingExample.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/PingExample.proto new file mode 100644 index 0000000..013c362 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/PingExample.proto @@ -0,0 +1,12 @@ +message Message { + optional Ping ping = 1; + optional Pong pong = 2; + + message Ping { + required uint32 time = 1; + } + + message Pong { + required uint32 time = 1; + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/T139.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/T139.proto new file mode 100644 index 0000000..d0c0599 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/T139.proto @@ -0,0 +1,4 @@ +message T139 { + required int32 a = 1; + required uint32 b = 2; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/T263.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/T263.proto new file mode 100644 index 0000000..db0c4eb --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/T263.proto @@ -0,0 +1,13 @@ +package services; + +message resume { + message Resume { + repeated string experience = 1; + } +} + +message profile { + message Profile { + optional services.resume.Resume resume = 1; + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/annotations.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/annotations.proto new file mode 100644 index 0000000..d7d2896 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/annotations.proto @@ -0,0 +1,29 @@ +// Copyright (c) 2015, Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +// import "google/api/http.proto"; +// import "google/protobuf/descriptor.proto"; + +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.api"; + +extend google.protobuf.MethodOptions { + // See `HttpRule`. + HttpRule http = 72295728; +} \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/bench.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/bench.js new file mode 100644 index 0000000..7f3c0cd --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/bench.js @@ -0,0 +1,48 @@ +var ProtoBuf = require("../index.js"); + +var sample = { + id: 1, + name: "John123", + password: "helloworld" +}; + +console.log("Sample: `"+JSON.stringify(sample, null, 4)); +console.log("\n"); + +var proto = " message Sample {" + + "required uint32 id = 1;" + + "required string name = 2;" + + "required string password = 3;" + + "}"; + +var builder = ProtoBuf.loadProto(proto, "bench.proto"), + Sample = builder.build("Sample"); + +// Compare size +console.log("Encoding size"); +console.log("-------------"); +var jsonData = new Buffer(JSON.stringify(sample), "utf8"), + protoData = new Sample(sample).toBuffer(); +console.log("* Encoded sample size as JSON: "+jsonData.length+" bytes"); +console.log("* Encoded sample size as protocol buffer: "+protoData.length+" bytes"); +console.log(""); + +// Compare encoding speed +console.log("Encoding speed"); +console.log("--------------"); +(function() { + // Assuming that a receive buffer is used + var buf = ProtoBuf.ByteBuffer.allocate(64); + var protoSample = new Sample(sample), + n = 100000, k = (n/1000)+'k'; + console.time("* ProtoBuf encode "+k); + for (var i=0; i native string.js:36 + 15 1.0% 1.0% LazyCompile: *module.exports.ByteBuffer.readVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1932 + 11 0.7% 0.7% Stub: InstanceofStub + 11 0.7% 0.7% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 11 0.7% 0.7% KeyedLoadIC: A keyed load IC from the snapshot + 10 0.6% 0.6% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 9 0.6% 0.6% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 9 0.6% 0.6% LazyCompile: *module.exports.ByteBuffer.flip x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2252 + 8 0.5% 0.5% LazyCompile: ~NativeModule.compile node.js:892 + 7 0.5% 0.5% Stub: KeyedLoadElementStub + 6 0.4% 0.4% Stub: CompareICStub {2} + 6 0.4% 0.4% LazyCompile: *module.exports.ByteBuffer.LE x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2299 + 6 0.4% 0.4% LazyCompile: *isFinite native v8natives.js:103 + 5 0.3% 0.3% Stub: ToBooleanStub_UndefinedSpecObject + 5 0.3% 0.3% LazyCompile: ~Module._compile module.js:374 + 5 0.3% 0.3% Builtin: A builtin from the snapshot {3} + 4 0.3% 0.3% Stub: ToBooleanStub + 4 0.3% 0.3% Stub: KeyedLoadElementStub {1} + 4 0.3% 0.3% LazyCompile: *module.exports.ByteBuffer.remaining x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2397 + 3 0.2% 0.2% KeyedStoreIC: A keyed store IC from the snapshot + 2 0.1% 0.1% Stub: BinaryOpStub_SHR_Alloc_SMI + 2 0.1% 0.1% Stub: BinaryOpStub_SHL_Alloc_SMI + 2 0.1% 0.1% LazyCompile: ~ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 2 0.1% 0.1% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 2 0.1% 0.1% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferAB.js:23 + 2 0.1% 0.1% Function: ~ x:\public\ProtoBuf\dist\ProtoBuf.js:22 + 2 0.1% 0.1% Function: ~ net.js:1 + 1 0.1% 0.1% Stub: ToBooleanStub {1} + 1 0.1% 0.1% Stub: CompareICStub {1} + 1 0.1% 0.1% Stub: CallConstructStub + 1 0.1% 0.1% Stub: BinaryOpStub_MUL_Alloc_SMI + 1 0.1% 0.1% Stub: BinaryOpStub_BIT_OR_OverwriteLeft_SMI + 1 0.1% 0.1% LazyCompile: ~tryFile module.js:138 + 1 0.1% 0.1% LazyCompile: ~nextTick node.js:334 + 1 0.1% 0.1% LazyCompile: ~module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 1 0.1% 0.1% LazyCompile: ~join native array.js:410 + 1 0.1% 0.1% LazyCompile: ~fs.statSync fs.js:687 + 1 0.1% 0.1% LazyCompile: ~fs.openSync fs.js:429 + 1 0.1% 0.1% LazyCompile: ~fs.fstatSync fs.js:678 + 1 0.1% 0.1% LazyCompile: ~filter native array.js:1036 + 1 0.1% 0.1% LazyCompile: ~exec native regexp.js:168 + 1 0.1% 0.1% LazyCompile: ~createWriteReq net.js:658 + 1 0.1% 0.1% LazyCompile: ~createWritableStdioStream node.js:550 + 1 0.1% 0.1% LazyCompile: ~bind native v8natives.js:1578 + 1 0.1% 0.1% LazyCompile: ~StringSplitOnRegExp native string.js:591 + 1 0.1% 0.1% LazyCompile: ~ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 1 0.1% 0.1% LazyCompile: ~ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 1 0.1% 0.1% LazyCompile: ~ProtoBuf.Reflect.Field x:\public\ProtoBuf\dist\ProtoBuf.js:2401 + 1 0.1% 0.1% LazyCompile: ~ProtoBuf.DotProto.Parser._parseId x:\public\ProtoBuf\dist\ProtoBuf.js:724 + 1 0.1% 0.1% LazyCompile: ~Message x:\public\ProtoBuf\dist\ProtoBuf.js:1629 + 1 0.1% 0.1% LazyCompile: ~Buffer.write buffer.js:315 + 1 0.1% 0.1% LazyCompile: ~Buffer buffer.js:156 + 1 0.1% 0.1% LazyCompile: statPath module.js:88 + 1 0.1% 0.1% KeyedLoadIC: args_count: 0 + 1 0.1% 0.1% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 1 0.1% 0.1% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\node_modules\long\dist\Long.js:23 + 1 0.1% 0.1% Function: ~ fs.js:1 + 1 0.1% 0.1% Builtin: A builtin from the snapshot {2} + 1 0.1% 0.1% Builtin: A builtin from the snapshot {1} + + [C++]: + ticks total nonlib name + + [GC]: + ticks total nonlib name + 2 0.1% + + [Bottom up (heavy) profile]: + Note: percentage shows a share of a particular caller in the total + amount of its parent calls. + Callers occupying less than 2.0% are not shown. + + ticks parent name + 248 16.1% LazyCompile: *Buffer.write buffer.js:315 + 247 99.6% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 247 100.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 247 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 247 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 247 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + + 190 12.3% LazyCompile: *Message x:\public\ProtoBuf\dist\ProtoBuf.js:1629 + 190 100.0% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 190 100.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 182 95.8% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 182 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 182 100.0% LazyCompile: ~Module._compile module.js:374 + 8 4.2% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 8 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 8 100.0% LazyCompile: ~Module._compile module.js:374 + + 189 12.2% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 189 100.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 183 96.8% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 183 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 183 100.0% LazyCompile: ~Module._compile module.js:374 + 183 100.0% LazyCompile: ~Module._extensions..js module.js:472 + 6 3.2% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 6 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 6 100.0% LazyCompile: ~Module._compile module.js:374 + 6 100.0% LazyCompile: ~Module._extensions..js module.js:472 + + 188 12.2% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 188 100.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 188 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 187 99.5% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 187 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 178 95.2% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 9 4.8% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + + 142 9.2% LazyCompile: *Buffer.toString buffer.js:392 + 142 100.0% LazyCompile: *module.exports.ByteBuffer.readVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1932 + 141 99.3% LazyCompile: ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 141 100.0% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 141 100.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 132 93.6% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 9 6.4% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + + 84 5.4% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 82 97.6% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 82 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 82 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 79 96.3% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 79 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 3 3.7% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 3 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 2 2.4% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 2 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 2 100.0% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 2 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 2 100.0% LazyCompile: ~Module._compile module.js:374 + + 62 4.0% LazyCompile: *toLowerCase native string.js:739 + 36 58.1% LazyCompile: *Buffer.write buffer.js:315 + 36 100.0% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 36 100.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 36 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 36 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 23 37.1% LazyCompile: *Buffer.toString buffer.js:392 + 23 100.0% LazyCompile: *module.exports.ByteBuffer.readVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1932 + 23 100.0% LazyCompile: ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 23 100.0% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 23 100.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 2 3.2% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 2 100.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 2 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 2 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 2 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + + 47 3.0% LazyCompile: ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 46 97.9% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 46 100.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 44 95.7% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 44 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 44 100.0% LazyCompile: ~Module._compile module.js:374 + 2 4.3% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 2 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 2 100.0% LazyCompile: ~Module._compile module.js:374 + + 38 2.5% LazyCompile: *module.exports.ByteBuffer.writeVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1193 + 26 68.4% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 26 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 26 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 26 100.0% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 26 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 6 15.8% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 6 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 6 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 6 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 6 100.0% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 6 15.8% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 6 100.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 6 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 6 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 6 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + + 36 2.3% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 35 97.2% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 32 91.4% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 32 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 32 100.0% LazyCompile: ~Module._compile module.js:374 + 32 100.0% LazyCompile: ~Module._extensions..js module.js:472 + 3 8.6% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 3 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 3 100.0% LazyCompile: ~Module._compile module.js:374 + 3 100.0% LazyCompile: ~Module._extensions..js module.js:472 + + + [Top down (heavy) profile]: + Note: callees occupying less than 0.1% are not shown. + + inclusive self name + ticks total ticks total + 1533 99.3% 0 0.0% Function: ~ node.js:27 + 1533 99.3% 0 0.0% LazyCompile: ~startup node.js:30 + 1527 98.9% 0 0.0% LazyCompile: ~Module.runMain module.js:495 + 1527 98.9% 0 0.0% LazyCompile: Module._load module.js:275 + 1524 98.7% 0 0.0% LazyCompile: ~Module.load module.js:346 + 1523 98.6% 0 0.0% LazyCompile: ~Module._extensions..js module.js:472 + 1523 98.6% 0 0.0% LazyCompile: ~Module._compile module.js:374 + 1523 98.6% 1 0.1% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 1413 91.5% 11 0.7% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 701 45.4% 9 0.6% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 681 44.1% 32 2.1% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 631 40.9% 22 1.4% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 576 37.3% 79 5.1% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 473 30.6% 178 11.5% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 286 18.5% 236 15.3% LazyCompile: *Buffer.write buffer.js:315 + 37 2.4% 35 2.3% LazyCompile: *toLowerCase native string.js:739 + 2 0.1% 2 0.1% Stub: CEntryStub + 5 0.3% 5 0.3% LazyCompile: *isFinite native v8natives.js:103 + 3 0.2% 3 0.2% Stub: CompareICStub {2} + 3 0.2% 2 0.1% LazyCompile: native string.js:36 + 6 0.4% 6 0.4% LazyCompile: *module.exports.ByteBuffer.writeVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1193 + 2 0.1% 2 0.1% LazyCompile: *toLowerCase native string.js:739 + 13 0.8% 13 0.8% Stub: CompareICStub + 6 0.4% 6 0.4% LazyCompile: *module.exports.ByteBuffer.writeVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1193 + 4 0.3% 4 0.3% Builtin: A builtin from the snapshot + 26 1.7% 26 1.7% LazyCompile: *module.exports.ByteBuffer.writeVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1193 + 3 0.2% 3 0.2% Builtin: A builtin from the snapshot + 2 0.1% 2 0.1% Stub: BinaryOpStub_SHL_Alloc_SMI + 8 0.5% 8 0.5% Stub: InstanceofStub + 6 0.4% 6 0.4% KeyedLoadIC: A keyed load IC from the snapshot + 2 0.1% 2 0.1% Stub: CEntryStub + 2 0.1% 2 0.1% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 5 0.3% 5 0.3% Stub: ToBooleanStub_UndefinedSpecObject + 3 0.2% 3 0.2% LazyCompile: *module.exports.ByteBuffer.LE x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2299 + 2 0.1% 2 0.1% Stub: ToBooleanStub + 697 45.1% 10 0.6% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 679 44.0% 183 11.9% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 257 16.6% 44 2.8% LazyCompile: ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 199 12.9% 15 1.0% LazyCompile: *module.exports.ByteBuffer.readVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1932 + 173 11.2% 132 8.5% LazyCompile: *Buffer.toString buffer.js:392 + 23 1.5% 21 1.4% LazyCompile: *toLowerCase native string.js:739 + 2 0.1% 2 0.1% Stub: CEntryStub + 13 0.8% 13 0.8% LazyCompile: native string.js:36 + 3 0.2% 3 0.2% Stub: CompareICStub {2} + 10 0.6% 10 0.6% LazyCompile: *module.exports.ByteBuffer.readVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1272 + 9 0.6% 9 0.6% Stub: CompareICStub + 3 0.2% 3 0.2% Builtin: A builtin from the snapshot + 183 11.9% 182 11.8% LazyCompile: *Message x:\public\ProtoBuf\dist\ProtoBuf.js:1629 + 14 0.9% 14 0.9% LazyCompile: *module.exports.ByteBuffer.readVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1272 + 8 0.5% 8 0.5% Builtin: A builtin from the snapshot + 7 0.5% 7 0.5% Stub: KeyedLoadElementStub + 5 0.3% 5 0.3% Builtin: A builtin from the snapshot {3} + 4 0.3% 4 0.3% Stub: KeyedLoadElementStub {1} + 4 0.3% 4 0.3% Stub: CEntryStub + 4 0.3% 4 0.3% LazyCompile: *module.exports.ByteBuffer.remaining x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2397 + 4 0.3% 4 0.3% KeyedLoadIC: A keyed load IC from the snapshot + 2 0.1% 2 0.1% KeyedStoreIC: A keyed store IC from the snapshot + 3 0.2% 3 0.2% Stub: InstanceofStub + 3 0.2% 3 0.2% Builtin: A builtin from the snapshot + 2 0.1% 2 0.1% LazyCompile: *module.exports.ByteBuffer.LE x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2299 + 3 0.2% 3 0.2% LazyCompile: *module.exports.ByteBuffer.flip x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2252 + 77 5.0% 2 0.1% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 37 2.4% 0 0.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 32 2.1% 3 0.2% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 29 1.9% 4 0.3% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 25 1.6% 3 0.2% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 21 1.4% 9 0.6% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 12 0.8% 11 0.7% LazyCompile: *Buffer.write buffer.js:315 + 5 0.3% 1 0.1% LazyCompile: ~ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 4 0.3% 0 0.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 2 0.1% 0 0.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 37 2.4% 0 0.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 34 2.2% 6 0.4% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 16 1.0% 2 0.1% LazyCompile: ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 12 0.8% 0 0.0% LazyCompile: *module.exports.ByteBuffer.readVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1932 + 12 0.8% 9 0.6% LazyCompile: *Buffer.toString buffer.js:392 + 3 0.2% 2 0.1% LazyCompile: *toLowerCase native string.js:739 + 9 0.6% 8 0.5% LazyCompile: *Message x:\public\ProtoBuf\dist\ProtoBuf.js:1629 + 2 0.1% 1 0.1% LazyCompile: ~ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 17 1.1% 0 0.0% LazyCompile: ~require module.js:379 + 17 1.1% 0 0.0% LazyCompile: ~Module.require module.js:361 + 17 1.1% 0 0.0% LazyCompile: Module._load module.js:275 + 17 1.1% 0 0.0% LazyCompile: ~Module.load module.js:346 + 17 1.1% 0 0.0% LazyCompile: ~Module._extensions..js module.js:472 + 17 1.1% 0 0.0% LazyCompile: ~Module._compile module.js:374 + 17 1.1% 0 0.0% Function: ~ x:\public\ProtoBuf\index.js:1 + 17 1.1% 0 0.0% LazyCompile: ~require module.js:379 + 17 1.1% 0 0.0% LazyCompile: ~Module.require module.js:361 + 17 1.1% 0 0.0% LazyCompile: Module._load module.js:275 + 17 1.1% 0 0.0% LazyCompile: ~Module.load module.js:346 + 17 1.1% 0 0.0% LazyCompile: ~Module._extensions..js module.js:472 + 16 1.0% 2 0.1% LazyCompile: ~Module._compile module.js:374 + 14 0.9% 0 0.0% Function: ~ x:\public\ProtoBuf\dist\ProtoBuf.js:1 + 14 0.9% 2 0.1% Function: ~ x:\public\ProtoBuf\dist\ProtoBuf.js:22 + 12 0.8% 0 0.0% LazyCompile: ~require module.js:379 + 12 0.8% 0 0.0% LazyCompile: ~Module.require module.js:361 + 12 0.8% 0 0.0% LazyCompile: Module._load module.js:275 + 11 0.7% 0 0.0% LazyCompile: ~Module.load module.js:346 + 11 0.7% 0 0.0% LazyCompile: ~Module._extensions..js module.js:472 + 11 0.7% 0 0.0% LazyCompile: ~Module._compile module.js:374 + 11 0.7% 0 0.0% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\index.js:1 + 11 0.7% 0 0.0% LazyCompile: ~require module.js:379 + 11 0.7% 0 0.0% LazyCompile: ~Module.require module.js:361 + 11 0.7% 0 0.0% LazyCompile: Module._load module.js:275 + 10 0.6% 0 0.0% LazyCompile: ~Module.load module.js:346 + 10 0.6% 0 0.0% LazyCompile: ~Module._extensions..js module.js:472 + 9 0.6% 3 0.2% LazyCompile: ~Module._compile module.js:374 + 4 0.3% 0 0.0% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1 + 4 0.3% 0 0.0% Function: x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:23 + 4 0.3% 0 0.0% LazyCompile: ~require module.js:379 + 4 0.3% 0 0.0% LazyCompile: ~Module.require module.js:361 + 4 0.3% 0 0.0% LazyCompile: Module._load module.js:275 + 3 0.2% 0 0.0% LazyCompile: ~Module._resolveFilename module.js:323 + 3 0.2% 0 0.0% LazyCompile: ~Module._findPath module.js:160 + 2 0.1% 0 0.0% LazyCompile: ~tryExtensions module.js:148 + 2 0.1% 0 0.0% LazyCompile: ~tryFile module.js:138 + 2 0.1% 1 0.1% LazyCompile: statPath module.js:88 + 2 0.1% 0 0.0% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferAB.js:1 + 2 0.1% 2 0.1% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferAB.js:23 + 6 0.4% 0 0.0% LazyCompile: ~ node.js:204 + 6 0.4% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 6 0.4% 1 0.1% LazyCompile: ~NativeModule.compile node.js:892 + 5 0.3% 0 0.0% Function: ~ console.js:1 + 4 0.3% 0 0.0% LazyCompile: ~ node.js:615 + 4 0.3% 1 0.1% LazyCompile: ~createWritableStdioStream node.js:550 + 3 0.2% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 3 0.2% 0 0.0% LazyCompile: ~NativeModule.compile node.js:892 + 3 0.2% 0 0.0% Function: ~ tty.js:1 + 3 0.2% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 3 0.2% 1 0.1% LazyCompile: ~NativeModule.compile node.js:892 + 2 0.1% 2 0.1% Function: ~ net.js:1 + 2 0.1% 0 0.0% LazyCompile: ~b native v8natives.js:1582 + 2 0.1% 0 0.0% LazyCompile: ~Console.log console.js:52 + 2 0.1% 0 0.0% LazyCompile: ~Socket.write net.js:612 + 2 0.1% 0 0.0% LazyCompile: ~Writable.write _stream_writable.js:162 + 2 0.1% 0 0.0% LazyCompile: ~writeOrBuffer _stream_writable.js:199 + 2 0.1% 0 0.0% LazyCompile: ~doWrite _stream_writable.js:220 + 2 0.1% 0 0.0% LazyCompile: ~Socket._write net.js:619 + 2 0.1% 0 0.0% LazyCompile: ~ProtoBuf.loadProto x:\public\ProtoBuf\dist\ProtoBuf.js:3983 + 2 0.1% 2 0.1% LazyCompile: *module.exports.ByteBuffer.flip x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2252 + 2 0.1% 2 0.1% Builtin: A builtin from the snapshot + 3 0.2% 0 0.0% LazyCompile: ~Module._resolveFilename module.js:323 + 3 0.2% 0 0.0% LazyCompile: ~Module._findPath module.js:160 + 3 0.2% 0 0.0% LazyCompile: ~tryFile module.js:138 + 3 0.2% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 3 0.2% 1 0.1% LazyCompile: ~NativeModule.compile node.js:892 + 2 0.1% 1 0.1% Function: ~ fs.js:1 + 3 0.2% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 3 0.2% 2 0.1% LazyCompile: ~NativeModule.compile node.js:892 + 2 0.1% 0 0.0% LazyCompile: ~startup.globalVariables node.js:160 + 2 0.1% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 2 0.1% 1 0.1% LazyCompile: ~NativeModule.compile node.js:892 + + 3 0.2% 3 0.2% LazyCompile: *module.exports.ByteBuffer.flip x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2252 + diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/camelcase.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/camelcase.proto new file mode 100644 index 0000000..03de070 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/camelcase.proto @@ -0,0 +1,14 @@ +message Test { + + // Case 1: Revert 1st + required int32 some_field = 1; // -> someField, reverted + required int32 someField = 2; // kept + + // Case 2: Revert 2nd + required int32 aField = 3; // kept + required int32 a_field = 4; // -> aField, reverted + + // No revert + required int32 its_a_field = 5; // -> itsAField + +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/comments.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/comments.proto new file mode 100644 index 0000000..9f808f7 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/comments.proto @@ -0,0 +1,10 @@ +// single line comment + +/** + * Naranjas. + */ +message TestC { // one more + required /***** uncommon block ****/int32 a = 1; // another more +} + +// the end. \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/complex.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/complex.json new file mode 100644 index 0000000..534f1ba --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/complex.json @@ -0,0 +1,114 @@ +{ + "package": "Game.Cars", + "syntax": "proto2", + "messages": [ + { + "name": "Car", + "syntax": "proto2", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "model", + "id": 1 + }, + { + "rule": "required", + "type": "Vendor", + "name": "vendor", + "id": 2 + }, + { + "rule": "optional", + "type": "Speed", + "name": "speed", + "id": 3, + "options": { + "default": "FAST" + } + } + ], + "messages": [ + { + "name": "Vendor", + "syntax": "proto2", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "type": "Address", + "name": "address", + "id": 2 + }, + { + "rule": "repeated", + "type": "string", + "name": "models", + "id": 3 + } + ], + "messages": [ + { + "name": "Address", + "syntax": "proto2", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "country", + "id": 1 + } + ] + } + ] + }, + { + "name": "Holder", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "first_name", + "id": 1 + }, + { + "rule": "required", + "type": "string", + "name": "last_name", + "id": 2 + }, + { + "rule": "optional", + "type": "Vendor.Address", + "name": "address", + "id": 3 + } + ] + } + ], + "enums": [ + { + "name": "Speed", + "syntax": "proto2", + "values": [ + { + "name": "FAST", + "id": 1 + }, + { + "name": "SUPERFAST", + "id": 2 + } + ] + } + ] + } + ], + "isNamespace": true +} \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/complex.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/complex.proto new file mode 100644 index 0000000..4e55c59 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/complex.proto @@ -0,0 +1,35 @@ +package Game.Cars; + +// Car +message Car { + + // Car Vendor + message Vendor { + required string name = 1; + + // Car Vendor Address + message Address { + required string country = 1; + } + + optional Address address = 2; + repeated string models = 3; // The models sold here. + } + + required string model = 1; // Model name + required Vendor vendor = 2; // Vendor information + optional Speed speed = 3 [default=FAST]; // Car speed + + // Car speed enum + enum Speed { + FAST = 1; + SUPERFAST = 2; + } + + // Car Holder + message Holder { + optional string first_name = 1; + required string last_name = 2; + optional Vendor.Address address = 3; + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/custom-options.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/custom-options.json new file mode 100644 index 0000000..d60c0ba --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/custom-options.json @@ -0,0 +1,169 @@ +{ + "package": null, + "messages": [ + { + "ref": "google.protobuf.FileOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "my_file_option", + "id": 50000 + } + ] + }, + { + "ref": "google.protobuf.MessageOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "int32", + "name": "my_message_option", + "id": 50001 + } + ] + }, + { + "ref": "google.protobuf.FieldOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "float", + "name": "my_field_option", + "id": 50002 + } + ] + }, + { + "ref": "google.protobuf.EnumOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "my_enum_option", + "id": 50003 + } + ] + }, + { + "ref": "google.protobuf.EnumValueOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "my_enum_value_option", + "id": 50004 + } + ] + }, + { + "ref": "google.protobuf.ServiceOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "MyEnum", + "name": "my_service_option", + "id": 50005 + } + ] + }, + { + "ref": "google.protobuf.MethodOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "MyMessage", + "name": "my_method_option", + "id": 50006 + } + ] + }, + { + "name": "MyMessage", + "fields": [ + { + "rule": "optional", + "options": { + "(my_field_option)": 4.5 + }, + "type": "int32", + "name": "foo", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "bar", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": { + "(my_message_option)": 1234 + } + }, + { + "name": "RequestType", + "fields": [], + "enums": [], + "messages": [], + "options": {} + }, + { + "name": "ResponseType", + "fields": [], + "enums": [], + "messages": [], + "options": {} + } + ], + "enums": [ + { + "name": "MyEnum", + "values": [ + { + "name": "FOO", + "id": 1 + }, + { + "name": "BAR", + "id": 2 + } + ], + "options": { + "(my_enum_option)": true + } + } + ], + "imports": [], + "options": { + "(my_file_option)": "Hello world!" + }, + "services": [ + { + "name": "MyService", + "rpc": { + "MyMethod": { + "request": "RequestType", + "response": "ResponseType", + "options": { + "(my_method_option).foo": 567, + "(my_method_option).bar": "Some string" + } + } + }, + "options": { + "(my_service_option)": "FOO" + } + } + ] +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/custom-options.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/custom-options.proto new file mode 100644 index 0000000..01f9773 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/custom-options.proto @@ -0,0 +1,53 @@ +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FileOptions { + optional string my_file_option = 50000; +} +extend google.protobuf.MessageOptions { + optional int32 my_message_option = 50001; +} +extend google.protobuf.FieldOptions { + optional float my_field_option = 50002; +} +extend google.protobuf.EnumOptions { + optional bool my_enum_option = 50003; +} +extend google.protobuf.EnumValueOptions { + optional uint32 my_enum_value_option = 50004; +} +extend google.protobuf.ServiceOptions { + optional MyEnum my_service_option = 50005; +} +extend google.protobuf.MethodOptions { + optional MyMessage my_method_option = 50006; +} + +option (my_file_option) = "Hello world!"; + +message MyMessage { + option (my_message_option) = 1234; + + optional int32 foo = 1 [(my_field_option) = 4.5]; + optional string bar = 2; +} + +enum MyEnum { + option (my_enum_option) = true; + + FOO = 1 [(my_enum_value_option) = 321]; + BAR = 2; +} + +message RequestType {} +message ResponseType {} + +service MyService { + option (my_service_option) = FOO; + + rpc MyMethod(RequestType) returns(ResponseType) { + // Note: my_method_option has type MyMessage. We can set each field + // within it using a separate "option" line. + option (my_method_option).foo = 567; + option (my_method_option).bar = "Some string"; + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/common.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/common.proto new file mode 100644 index 0000000..7845c1d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/common.proto @@ -0,0 +1,5 @@ +package main; + +message Common { + optional string commonField = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/dep1.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/dep1.proto new file mode 100644 index 0000000..897916f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/dep1.proto @@ -0,0 +1,7 @@ +package main; + +import "common.proto"; + +message Dep1 { + optional main.Common test1 = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/dep2.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/dep2.proto new file mode 100644 index 0000000..5f6ff6b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/dep2.proto @@ -0,0 +1,8 @@ +package main; + +import "dep1.proto"; + +message Dep2 { + optional main.Dep1 test1 = 1; + optional main.Common test2 = 2; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/main.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/main.proto new file mode 100644 index 0000000..fc2c7b5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/dupimport/main.proto @@ -0,0 +1,11 @@ +package main; + +import "dep1.proto"; +import "dep2.proto"; +import "common.proto"; + +message MainMessage { + optional main.Dep1 test1 = 1; + optional main.Dep2 test2 = 2; + optional main.Common test3 = 3; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example1.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example1.proto new file mode 100644 index 0000000..dd3c96e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example1.proto @@ -0,0 +1,5 @@ +message Test1 { + required int32 a = 1; +} + +// Test1 should encode to "08 96 01" with Test1#a=150 diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example1u.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example1u.proto new file mode 100644 index 0000000..2b91e8b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example1u.proto @@ -0,0 +1,3 @@ +message Test1u { + required uint32 a = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example2.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example2.proto new file mode 100644 index 0000000..e00c4d2 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example2.proto @@ -0,0 +1,5 @@ +message Test2 { + required string b = 2; +} + +// Test2 should encode to "12 07 74 65 73 74 69 6e 67" with Test2#b="testing" diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example3.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example3.proto new file mode 100644 index 0000000..2ec5a97 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example3.proto @@ -0,0 +1,9 @@ +message Test1 { + required int32 a = 1; +} + +message Test3 { + required Test1 c = 3; +} + +// Test3 should encode to "1a 03 08 96 01" with Test1#a=150 diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example4.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example4.proto new file mode 100644 index 0000000..455ae94 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example4.proto @@ -0,0 +1,5 @@ +message Test4 { + repeated int32 d = 4 [packed=true]; +} + +// Test4 should encode to "<22 06 03 8E 02 9E A7 05>" with d=[3, 270, 86942] diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example5.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example5.proto new file mode 100644 index 0000000..22a8156 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/example5.proto @@ -0,0 +1,29 @@ +package Datastore; + +message LookupRequest { + repeated string key = 1; +} + +message LookupResponse { + repeated string results = 1; +} + +message RunQueryRequest { + required string query = 1; +} + +message RunQueryResponse { + repeated string results = 1; +} + +service LookupService { + // Look up some entities by key. + rpc Lookup(LookupRequest) returns (LookupResponse) { + } +} + +service RunQueryService { + // Query for entities. + rpc RunQuery(RunQueryRequest) returns (RunQueryResponse) { + }; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/extend.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/extend.json new file mode 100644 index 0000000..5027fd5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/extend.json @@ -0,0 +1,71 @@ +{ + "package": null, + "messages": [ + { + "ref": "google.protobuf.MessageOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "int32", + "name": "foo", + "id": 1001 + } + ] + }, + { + "name": "Foo", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "extensions": [ + 2, + 536870911 + ] + }, + { + "ref": "Foo", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "bar", + "id": 2 + } + ] + }, + { + "name": "Bar", + "fields": [], + "enums": [], + "messages": [ + { + "name": "Foo", + "fields": [], + "enums": [], + "messages": [], + "options": {} + }, + { + "ref": "Foo", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "Foo", + "name": "foo", + "id": 3 + } + ] + } + ], + "options": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/extend.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/extend.proto new file mode 100644 index 0000000..20ea830 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/extend.proto @@ -0,0 +1,23 @@ +import "google/protobuf/descriptor.proto"; // Ignored +// import "./google/protobuf/descriptor.proto"; // Not ignored + +extend google.protobuf.MessageOptions { + optional int32 foo = 1001; +} + +message Foo { + extensions 2 to max; +} + +extend Foo { + optional string bar = 2; +} + +message Bar { + message Foo { + } + + extend .Foo { + optional Foo foo = 3; // references Bar.Foo + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/field_name_same_as_package/main.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/field_name_same_as_package/main.proto new file mode 100644 index 0000000..6be8ba4 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/field_name_same_as_package/main.proto @@ -0,0 +1,7 @@ +package main; + +import "sub.proto"; + +message MainMessage { + optional main.sub.Sub sub = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/field_name_same_as_package/sub.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/field_name_same_as_package/sub.proto new file mode 100644 index 0000000..1c7ba4f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/field_name_same_as_package/sub.proto @@ -0,0 +1,5 @@ +package main.sub; + +message Sub { + optional string test1 = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/google/protobuf/descriptor.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/google/protobuf/descriptor.proto new file mode 100644 index 0000000..83fe2e1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/google/protobuf/descriptor.proto @@ -0,0 +1,620 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + + + +package google.protobuf; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field whithout harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; + optional int32 end = 2; + } + repeated ExtensionRange extension_range = 5; + + optional MessageOptions options = 7; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + TYPE_GROUP = 10; // Tag-delimited aggregate. + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + }; + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + // TODO(sanjay): Should we add LABEL_MAP? + }; + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be either TYPE_ENUM or TYPE_MESSAGE. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + optional string default_value = 7; + + optional FieldOptions options = 8; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; +} + + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Object-C plugin) and your porject website (if available) -- there's no need +// to explain how you intend to use them. Usually you only need one extension +// number. You can declare multiple options with only one extension number by +// putting them in a sub-message. See the Custom Options section of the docs +// for examples: +// http://code.google.com/apis/protocolbuffers/docs/proto.html#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default=false]; + + // If set true, then the Java code generator will generate equals() and + // hashCode() methods for all messages defined in the .proto file. This is + // purely a speed optimization, as the AbstractMessage base class includes + // reflection-based implementations of these methods. + optional bool java_generate_equals_and_hash = 20 [default=false]; + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default=SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. There is no default. + optional string go_package = 11; + + + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of proto2. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default=false]; + optional bool java_generic_services = 17 [default=false]; + optional bool py_generic_services = 18 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default=false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. + optional bool packed = 2; + + + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outher message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default=false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default=false]; + + // EXPERIMENTAL. DO NOT USE. + // For "map" fields, the name of the field in the enclosed type that + // is the key for this map. For example, suppose we have: + // message Item { + // required string name = 1; + // required string value = 2; + // } + // message Config { + // repeated Item items = 1 [experimental_map_key="name"]; + // } + // In this situation, the map key for Item will be set to "name". + // TODO: Fully-implement this, then remove the "experimental_" prefix. + optional string experimental_map_key = 9; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // Set this option to false to disallow mapping different tag names to a same + // value. + optional bool allow_alias = 2 [default=true]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + 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; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed=true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed=true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + optional string leading_comments = 3; + optional string trailing_comments = 4; + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/groups.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/groups.proto new file mode 100644 index 0000000..9e96720 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/groups.proto @@ -0,0 +1,13 @@ +message Outer { + required string before = 1; + repeated group MyInner = 2 [deprecated=true] { + required string a = 3; + } + required string after = 4; + optional MyInner myInner2 = 5; +} + +message OuterSparse { + required string before = 1; + required string after = 4; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/importRoot/file1.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/importRoot/file1.proto new file mode 100644 index 0000000..eaf02ee --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/importRoot/file1.proto @@ -0,0 +1 @@ +import "importRoot/file2.proto"; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/importRoot/file2.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/importRoot/file2.proto new file mode 100644 index 0000000..44c7794 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/importRoot/file2.proto @@ -0,0 +1 @@ +import "importRoot/file3.proto"; diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/importRoot/file3.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/importRoot/file3.proto new file mode 100644 index 0000000..24377d9 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/importRoot/file3.proto @@ -0,0 +1 @@ +message Test {} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_a.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_a.proto new file mode 100644 index 0000000..f50242f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_a.proto @@ -0,0 +1,5 @@ +import "import_common.proto"; + +message A { + optional Common common = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_a_single_quote.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_a_single_quote.proto new file mode 100644 index 0000000..6ea6844 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_a_single_quote.proto @@ -0,0 +1,5 @@ +import 'import_common.proto'; + +message A { + optional Common common = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_b.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_b.proto new file mode 100644 index 0000000..4809bfd --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_b.proto @@ -0,0 +1,5 @@ +import "import_common.proto"; + +message B { + optional Common common = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_common.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_common.proto new file mode 100644 index 0000000..ad9bfe7 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/import_common.proto @@ -0,0 +1,2 @@ +message Common { +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports-toplevel.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports-toplevel.proto new file mode 100644 index 0000000..ebca0ff --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports-toplevel.proto @@ -0,0 +1,13 @@ +import "toplevel.proto"; + +package My; + +enum MyEnum1 { + ONE = 1; + TWO = 2; +} + +message Test1 { + required MyEnum num = 1 [default=ONE]; + required MyEnum1 num1 = 2 [default=ONE]; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports-weak.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports-weak.proto new file mode 100644 index 0000000..a5986f1 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports-weak.proto @@ -0,0 +1,7 @@ +package My; + +import weak "example1.proto"; + +message Test2 { + required Test1 test1 = 1; +} \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports.json new file mode 100644 index 0000000..c92a99c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports.json @@ -0,0 +1,83 @@ +{ + "package": "My", + "messages": [ + { + "name": "Test3", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "Test1", + "name": "test1", + "id": 1 + }, + { + "rule": "required", + "options": {}, + "type": ".Test2", + "name": "test2", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "enums": [], + "imports": [ + { + "package": null, + "messages": [ + { + "name": "Test1", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "int32", + "name": "a", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] + }, + { + "package": null, + "messages": [ + { + "name": "Test2", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "string", + "name": "b", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] + } + ], + "options": {}, + "services": [] +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports.proto new file mode 100644 index 0000000..e604dac --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/imports.proto @@ -0,0 +1,9 @@ +package My; + +import public "example1.proto"; +import "example2.proto"; + +message Test3 { + required Test1 test1 = 1; + required .Test2 test2 = 2; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/inner.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/inner.proto new file mode 100644 index 0000000..c750f28 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/inner.proto @@ -0,0 +1,10 @@ +message Foo { + required Bar bar = 1; + required Baz baz = 2; +} +message Bar { + required string blah = 1; +} +message Baz { + required string blah = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/negid.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/negid.proto new file mode 100644 index 0000000..9b6a2ec --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/negid.proto @@ -0,0 +1,9 @@ +message Test { + required LobbyType type = 1 [default=INVALID]; + + enum LobbyType { + INVALID = -1; + MATCH = 0; + PRACTICE = 1; + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/nodeunit-browser/LICENSE b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/nodeunit-browser/LICENSE new file mode 100644 index 0000000..5dfdc43 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/nodeunit-browser/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2010 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/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.css b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.css new file mode 100644 index 0000000..4c3f20c --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.css @@ -0,0 +1,70 @@ +/*! + * Styles taken from qunit.css + */ + +h1#nodeunit-header, h1.nodeunit-header { + padding: 15px; + font-size: large; + background-color: #06b; + color: white; + font-family: 'trebuchet ms', verdana, arial; + margin: 0; +} + +h1#nodeunit-header a { + color: white; +} + +h2#nodeunit-banner { + height: 2em; + border-bottom: 1px solid white; + background-color: #eee; + margin: 0; + font-family: 'trebuchet ms', verdana, arial; +} +h2#nodeunit-banner.pass { + background-color: green; +} +h2#nodeunit-banner.fail { + background-color: red; +} + +h2#nodeunit-userAgent, h2.nodeunit-userAgent { + padding: 10px; + background-color: #eee; + color: black; + margin: 0; + font-size: small; + font-weight: normal; + font-family: 'trebuchet ms', verdana, arial; + font-size: 10pt; +} + +div#nodeunit-testrunner-toolbar { + background: #eee; + border-top: 1px solid black; + padding: 10px; + font-family: 'trebuchet ms', verdana, arial; + margin: 0; + font-size: 10pt; +} + +ol#nodeunit-tests { + font-family: 'trebuchet ms', verdana, arial; + font-size: 10pt; +} +ol#nodeunit-tests li strong { + cursor:pointer; +} +ol#nodeunit-tests .pass { + color: green; +} +ol#nodeunit-tests .fail { + color: red; +} + +p#nodeunit-testresult { + margin-left: 1em; + font-size: 10pt; + font-family: 'trebuchet ms', verdana, arial; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.js new file mode 100644 index 0000000..2f8f20d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.js @@ -0,0 +1,2108 @@ +/*! + * Nodeunit + * https://github.com/caolan/nodeunit + * Copyright (c) 2010 Caolan McMahon + * MIT Licensed + * + * json2.js + * http://www.JSON.org/json2.js + * Public Domain. + * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. + */ +nodeunit = (function(){ +/* + http://www.JSON.org/json2.js + 2010-11-17 + + 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, strict: false, regexp: false */ + +/*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 = {}; + +(function () { + "use strict"; + + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + if (typeof Date.prototype.toJSON !== 'function') { + + Date.prototype.toJSON = function (key) { + + return isFinite(this.valueOf()) ? + this.getUTCFullYear() + '-' + + f(this.getUTCMonth() + 1) + '-' + + f(this.getUTCDate()) + 'T' + + f(this.getUTCHours()) + ':' + + f(this.getUTCMinutes()) + ':' + + f(this.getUTCSeconds()) + 'Z' : null; + }; + + String.prototype.toJSON = + Number.prototype.toJSON = + Boolean.prototype.toJSON = function (key) { + return this.valueOf(); + }; + } + + 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]; + +// 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': + 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': + +// 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) { + k = rep[i]; + if (typeof k === 'string') { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + +// Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.hasOwnProperty.call(value, k)) { + 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}); + }; + } + + +// If the JSON object does not yet have a parse method, give it one. + + if (typeof JSON.parse !== 'function') { + JSON.parse = function (text, reviver) { + +// The parse method takes a text and an optional reviver function, and returns +// a JavaScript value if the text is a valid JSON text. + + var j; + + function walk(holder, key) { + +// The walk method is used to recursively walk the resulting structure so +// that modifications can be made. + + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + +// Parsing happens in four stages. In the first stage, we replace certain +// Unicode characters with escape sequences. JavaScript handles many characters +// incorrectly, either silently deleting them, or treating them as line endings. + + text = String(text); + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function (a) { + return '\\u' + + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + +// In the second stage, we run the text against regular expressions that look +// for non-JSON patterns. We are especially concerned with '()' and 'new' +// because they can cause invocation, and '=' because it can cause mutation. +// But just to be safe, we want to reject all unexpected forms. + +// We split the second stage into 4 regexp operations in order to work around +// crippling inefficiencies in IE's and Safari's regexp engines. First we +// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we +// replace all simple value tokens with ']' characters. Third, we delete all +// open brackets that follow a colon or comma or that begin the text. Finally, +// we look to see that the remaining characters are only whitespace or ']' or +// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. + + if (/^[\],:{}\s]*$/ +.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') +.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') +.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + +// In the third stage we use the eval function to compile the text into a +// JavaScript structure. The '{' operator is subject to a syntactic ambiguity +// in JavaScript: it can begin a block or an object literal. We wrap the text +// in parens to eliminate the ambiguity. + + j = eval('(' + text + ')'); + +// In the optional fourth stage, we recursively walk the new structure, passing +// each name/value pair to a reviver function for possible transformation. + + return typeof reviver === 'function' ? + walk({'': j}, '') : j; + } + +// If the text is not JSON parseable, then a SyntaxError is thrown. + + throw new SyntaxError('JSON.parse'); + }; + } +}()); +var assert = this.assert = {}; +var types = {}; +var core = {}; +var nodeunit = {}; +var reporter = {}; +/*global setTimeout: false, console: false */ +(function () { + + var async = {}; + + // global on the server, window in the browser + var root = this, + previous_async = root.async; + + if (typeof module !== 'undefined' && module.exports) { + module.exports = async; + } + else { + root.async = async; + } + + async.noConflict = function () { + root.async = previous_async; + return async; + }; + + //// cross-browser compatiblity functions //// + + var _forEach = function (arr, iterator) { + if (arr.forEach) { + return arr.forEach(iterator); + } + for (var i = 0; i < arr.length; i += 1) { + iterator(arr[i], i, arr); + } + }; + + var _map = function (arr, iterator) { + if (arr.map) { + return arr.map(iterator); + } + var results = []; + _forEach(arr, function (x, i, a) { + results.push(iterator(x, i, a)); + }); + return results; + }; + + var _reduce = function (arr, iterator, memo) { + if (arr.reduce) { + return arr.reduce(iterator, memo); + } + _forEach(arr, function (x, i, a) { + memo = iterator(memo, x, i, a); + }); + return memo; + }; + + var _keys = function (obj) { + if (Object.keys) { + return Object.keys(obj); + } + var keys = []; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + keys.push(k); + } + } + return keys; + }; + + var _indexOf = function (arr, item) { + if (arr.indexOf) { + return arr.indexOf(item); + } + for (var i = 0; i < arr.length; i += 1) { + if (arr[i] === item) { + return i; + } + } + return -1; + }; + + //// exported async module functions //// + + //// nextTick implementation with browser-compatible fallback //// + if (typeof process === 'undefined' || !(process.nextTick)) { + async.nextTick = function (fn) { + setTimeout(fn, 0); + }; + } + else { + async.nextTick = process.nextTick; + } + + async.forEach = function (arr, iterator, callback) { + if (!arr.length) { + return callback(); + } + var completed = 0; + _forEach(arr, function (x) { + iterator(x, function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + completed += 1; + if (completed === arr.length) { + callback(); + } + } + }); + }); + }; + + async.forEachSeries = function (arr, iterator, callback) { + if (!arr.length) { + return callback(); + } + var completed = 0; + var iterate = function () { + iterator(arr[completed], function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + completed += 1; + if (completed === arr.length) { + callback(); + } + else { + iterate(); + } + } + }); + }; + iterate(); + }; + + + var doParallel = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + return fn.apply(null, [async.forEach].concat(args)); + }; + }; + var doSeries = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + return fn.apply(null, [async.forEachSeries].concat(args)); + }; + }; + + + var _asyncMap = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (err, v) { + results[x.index] = v; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + }; + async.map = doParallel(_asyncMap); + async.mapSeries = doSeries(_asyncMap); + + + // reduce only has a series version, as doing reduce in parallel won't + // work in many situations. + async.reduce = function (arr, memo, iterator, callback) { + async.forEachSeries(arr, function (x, callback) { + iterator(memo, x, function (err, v) { + memo = v; + callback(err); + }); + }, function (err) { + callback(err, memo); + }); + }; + // inject alias + async.inject = async.reduce; + // foldl alias + async.foldl = async.reduce; + + async.reduceRight = function (arr, memo, iterator, callback) { + var reversed = _map(arr, function (x) { + return x; + }).reverse(); + async.reduce(reversed, memo, iterator, callback); + }; + // foldr alias + async.foldr = async.reduceRight; + + var _filter = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (v) { + if (v) { + results.push(x); + } + callback(); + }); + }, function (err) { + callback(_map(results.sort(function (a, b) { + return a.index - b.index; + }), function (x) { + return x.value; + })); + }); + }; + async.filter = doParallel(_filter); + async.filterSeries = doSeries(_filter); + // select alias + async.select = async.filter; + async.selectSeries = async.filterSeries; + + var _reject = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (v) { + if (!v) { + results.push(x); + } + callback(); + }); + }, function (err) { + callback(_map(results.sort(function (a, b) { + return a.index - b.index; + }), function (x) { + return x.value; + })); + }); + }; + async.reject = doParallel(_reject); + async.rejectSeries = doSeries(_reject); + + var _detect = function (eachfn, arr, iterator, main_callback) { + eachfn(arr, function (x, callback) { + iterator(x, function (result) { + if (result) { + main_callback(x); + } + else { + callback(); + } + }); + }, function (err) { + main_callback(); + }); + }; + async.detect = doParallel(_detect); + async.detectSeries = doSeries(_detect); + + async.some = function (arr, iterator, main_callback) { + async.forEach(arr, function (x, callback) { + iterator(x, function (v) { + if (v) { + main_callback(true); + main_callback = function () {}; + } + callback(); + }); + }, function (err) { + main_callback(false); + }); + }; + // any alias + async.any = async.some; + + async.every = function (arr, iterator, main_callback) { + async.forEach(arr, function (x, callback) { + iterator(x, function (v) { + if (!v) { + main_callback(false); + main_callback = function () {}; + } + callback(); + }); + }, function (err) { + main_callback(true); + }); + }; + // all alias + async.all = async.every; + + async.sortBy = function (arr, iterator, callback) { + async.map(arr, function (x, callback) { + iterator(x, function (err, criteria) { + if (err) { + callback(err); + } + else { + callback(null, {value: x, criteria: criteria}); + } + }); + }, function (err, results) { + if (err) { + return callback(err); + } + else { + var fn = function (left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }; + callback(null, _map(results.sort(fn), function (x) { + return x.value; + })); + } + }); + }; + + async.auto = function (tasks, callback) { + callback = callback || function () {}; + var keys = _keys(tasks); + if (!keys.length) { + return callback(null); + } + + var completed = []; + + var listeners = []; + var addListener = function (fn) { + listeners.unshift(fn); + }; + var removeListener = function (fn) { + for (var i = 0; i < listeners.length; i += 1) { + if (listeners[i] === fn) { + listeners.splice(i, 1); + return; + } + } + }; + var taskComplete = function () { + _forEach(listeners, function (fn) { + fn(); + }); + }; + + addListener(function () { + if (completed.length === keys.length) { + callback(null); + } + }); + + _forEach(keys, function (k) { + var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; + var taskCallback = function (err) { + if (err) { + callback(err); + // stop subsequent errors hitting callback multiple times + callback = function () {}; + } + else { + completed.push(k); + taskComplete(); + } + }; + var requires = task.slice(0, Math.abs(task.length - 1)) || []; + var ready = function () { + return _reduce(requires, function (a, x) { + return (a && _indexOf(completed, x) !== -1); + }, true); + }; + if (ready()) { + task[task.length - 1](taskCallback); + } + else { + var listener = function () { + if (ready()) { + removeListener(listener); + task[task.length - 1](taskCallback); + } + }; + addListener(listener); + } + }); + }; + + async.waterfall = function (tasks, callback) { + if (!tasks.length) { + return callback(); + } + callback = callback || function () {}; + var wrapIterator = function (iterator) { + return function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + var args = Array.prototype.slice.call(arguments, 1); + var next = iterator.next(); + if (next) { + args.push(wrapIterator(next)); + } + else { + args.push(callback); + } + async.nextTick(function () { + iterator.apply(null, args); + }); + } + }; + }; + wrapIterator(async.iterator(tasks))(); + }; + + async.parallel = function (tasks, callback) { + callback = callback || function () {}; + if (tasks.constructor === Array) { + async.map(tasks, function (fn, callback) { + if (fn) { + fn(function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + callback.call(null, err, args || null); + }); + } + }, callback); + } + else { + var results = {}; + async.forEach(_keys(tasks), function (k, callback) { + tasks[k](function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + results[k] = args; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + + async.series = function (tasks, callback) { + callback = callback || function () {}; + if (tasks.constructor === Array) { + async.mapSeries(tasks, function (fn, callback) { + if (fn) { + fn(function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + callback.call(null, err, args || null); + }); + } + }, callback); + } + else { + var results = {}; + async.forEachSeries(_keys(tasks), function (k, callback) { + tasks[k](function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + results[k] = args; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + + async.iterator = function (tasks) { + var makeCallback = function (index) { + var fn = function () { + if (tasks.length) { + tasks[index].apply(null, arguments); + } + return fn.next(); + }; + fn.next = function () { + return (index < tasks.length - 1) ? makeCallback(index + 1): null; + }; + return fn; + }; + return makeCallback(0); + }; + + async.apply = function (fn) { + var args = Array.prototype.slice.call(arguments, 1); + return function () { + return fn.apply( + null, args.concat(Array.prototype.slice.call(arguments)) + ); + }; + }; + + var _concat = function (eachfn, arr, fn, callback) { + var r = []; + eachfn(arr, function (x, cb) { + fn(x, function (err, y) { + r = r.concat(y || []); + cb(err); + }); + }, function (err) { + callback(err, r); + }); + }; + async.concat = doParallel(_concat); + async.concatSeries = doSeries(_concat); + + async.whilst = function (test, iterator, callback) { + if (test()) { + iterator(function (err) { + if (err) { + return callback(err); + } + async.whilst(test, iterator, callback); + }); + } + else { + callback(); + } + }; + + async.until = function (test, iterator, callback) { + if (!test()) { + iterator(function (err) { + if (err) { + return callback(err); + } + async.until(test, iterator, callback); + }); + } + else { + callback(); + } + }; + + async.queue = function (worker, concurrency) { + var workers = 0; + var tasks = []; + var q = { + concurrency: concurrency, + push: function (data, callback) { + tasks.push({data: data, callback: callback}); + async.nextTick(q.process); + }, + process: function () { + if (workers < q.concurrency && tasks.length) { + var task = tasks.splice(0, 1)[0]; + workers += 1; + worker(task.data, function () { + workers -= 1; + if (task.callback) { + task.callback.apply(task, arguments); + } + q.process(); + }); + } + }, + length: function () { + return tasks.length; + } + }; + return q; + }; + + var _console_fn = function (name) { + return function (fn) { + var args = Array.prototype.slice.call(arguments, 1); + fn.apply(null, args.concat([function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (typeof console !== 'undefined') { + if (err) { + if (console.error) { + console.error(err); + } + } + else if (console[name]) { + _forEach(args, function (x) { + console[name](x); + }); + } + } + }])); + }; + }; + async.log = _console_fn('log'); + async.dir = _console_fn('dir'); + /*async.info = _console_fn('info'); + async.warn = _console_fn('warn'); + async.error = _console_fn('error');*/ + + async.memoize = function (fn, hasher) { + var memo = {}; + hasher = hasher || function (x) { + return x; + }; + return function () { + var args = Array.prototype.slice.call(arguments); + var callback = args.pop(); + var key = hasher.apply(null, args); + if (key in memo) { + callback.apply(null, memo[key]); + } + else { + fn.apply(null, args.concat([function () { + memo[key] = arguments; + callback.apply(null, arguments); + }])); + } + }; + }; + +}()); +(function(exports){ +/** + * This file is based on the node.js assert module, but with some small + * changes for browser-compatibility + * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! + */ + + +/** + * Added for browser compatibility + */ + +var _keys = function(obj){ + if(Object.keys) return Object.keys(obj); + if (typeof obj != 'object' && typeof obj != 'function') { + throw new TypeError('-'); + } + var keys = []; + for(var k in obj){ + if(obj.hasOwnProperty(k)) keys.push(k); + } + return keys; +}; + + + +// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 +// +// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! +// +// Originally from narwhal.js (http://narwhaljs.org) +// Copyright (c) 2009 Thomas Robinson <280north.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 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 pSlice = Array.prototype.slice; + +// 1. The assert module provides functions that throw +// AssertionError's when particular conditions are not met. The +// assert module must conform to the following interface. + +var assert = exports; + +// 2. The AssertionError is defined in assert. +// new assert.AssertionError({message: message, actual: actual, expected: expected}) + +assert.AssertionError = function AssertionError (options) { + this.name = "AssertionError"; + this.message = options.message; + this.actual = options.actual; + this.expected = options.expected; + this.operator = options.operator; + var stackStartFunction = options.stackStartFunction || fail; + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, stackStartFunction); + } +}; +// code from util.inherits in node +assert.AssertionError.super_ = Error; + + +// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call +// TODO: test what effect this may have +var ctor = function () { this.constructor = assert.AssertionError; }; +ctor.prototype = Error.prototype; +assert.AssertionError.prototype = new ctor(); + + +assert.AssertionError.prototype.toString = function() { + if (this.message) { + return [this.name+":", this.message].join(' '); + } else { + return [ this.name+":" + , JSON.stringify(this.expected ) + , this.operator + , JSON.stringify(this.actual) + ].join(" "); + } +}; + +// assert.AssertionError instanceof Error + +assert.AssertionError.__proto__ = Error.prototype; + +// At present only the three keys mentioned above are used and +// understood by the spec. Implementations or sub modules can pass +// other keys to the AssertionError's constructor - they will be +// ignored. + +// 3. All of the following functions must throw an AssertionError +// when a corresponding condition is not met, with a message that +// may be undefined if not provided. All assertion methods provide +// both the actual and expected values to the assertion error for +// display purposes. + +function fail(actual, expected, message, operator, stackStartFunction) { + throw new assert.AssertionError({ + message: message, + actual: actual, + expected: expected, + operator: operator, + stackStartFunction: stackStartFunction + }); +} + +// EXTENSION! allows for well behaved errors defined elsewhere. +assert.fail = fail; + +// 4. Pure assertion tests whether a value is truthy, as determined +// by !!guard. +// assert.ok(guard, message_opt); +// This statement is equivalent to assert.equal(true, guard, +// message_opt);. To test strictly for the value true, use +// assert.strictEqual(true, guard, message_opt);. + +assert.ok = function ok(value, message) { + if (!!!value) fail(value, true, message, "==", assert.ok); +}; + +// 5. The equality assertion tests shallow, coercive equality with +// ==. +// assert.equal(actual, expected, message_opt); + +assert.equal = function equal(actual, expected, message) { + if (actual != expected) fail(actual, expected, message, "==", assert.equal); +}; + +// 6. The non-equality assertion tests for whether two objects are not equal +// with != assert.notEqual(actual, expected, message_opt); + +assert.notEqual = function notEqual(actual, expected, message) { + if (actual == expected) { + fail(actual, expected, message, "!=", assert.notEqual); + } +}; + +// 7. The equivalence assertion tests a deep equality relation. +// assert.deepEqual(actual, expected, message_opt); + +assert.deepEqual = function deepEqual(actual, expected, message) { + if (!_deepEqual(actual, expected)) { + fail(actual, expected, message, "deepEqual", assert.deepEqual); + } +}; + +var Buffer = null; +if (typeof require !== 'undefined' && typeof process !== 'undefined') { + try { + Buffer = require('buffer').Buffer; + } + catch (e) { + // May be a CommonJS environment other than Node.js + Buffer = null; + } +} + +function _deepEqual(actual, expected) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.2.1 If the expcted value is a RegExp object, the actual value is + // equivalent if it is also a RegExp object that refers to the same source and options + } else if (actual instanceof RegExp && expected instanceof RegExp) { + return actual.source === expected.source && + actual.global === expected.global && + actual.ignoreCase === expected.ignoreCase && + actual.multiline === expected.multiline; + + } else if (Buffer && actual instanceof Buffer && expected instanceof Buffer) { + return (function() { + var i, len; + + for (i = 0, len = expected.length; i < len; i++) { + if (actual[i] !== expected[i]) { + return false; + } + } + return actual.length === expected.length; + })(); + // 7.3. Other pairs that do not both pass typeof value == "object", + // equivalence is determined by ==. + } else if (typeof actual != 'object' && typeof expected != 'object') { + return actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical "prototype" property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected); + } +} + +function isUndefinedOrNull (value) { + return value === null || value === undefined; +} + +function isArguments (object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +} + +function objEquiv (a, b) { + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical "prototype" property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return _deepEqual(a, b); + } + try{ + var ka = _keys(a), + kb = _keys(b), + key, i; + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!_deepEqual(a[key], b[key] )) + return false; + } + return true; +} + +// 8. The non-equivalence assertion tests for any deep inequality. +// assert.notDeepEqual(actual, expected, message_opt); + +assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (_deepEqual(actual, expected)) { + fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual); + } +}; + +// 9. The strict equality assertion tests strict equality, as determined by ===. +// assert.strictEqual(actual, expected, message_opt); + +assert.strictEqual = function strictEqual(actual, expected, message) { + if (actual !== expected) { + fail(actual, expected, message, "===", assert.strictEqual); + } +}; + +// 10. The strict non-equality assertion tests for strict inequality, as determined by !==. +// assert.notStrictEqual(actual, expected, message_opt); + +assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (actual === expected) { + fail(actual, expected, message, "!==", assert.notStrictEqual); + } +}; + +function expectedException(actual, expected) { + if (!actual || !expected) { + return false; + } + + if (expected instanceof RegExp) { + return expected.test(actual.message || actual); + } else if (actual instanceof expected) { + return true; + } else if (expected.call({}, actual) === true) { + return true; + } + + return false; +} + +function _throws(shouldThrow, block, expected, message) { + var actual; + + if (typeof expected === 'string') { + message = expected; + expected = null; + } + + try { + block(); + } catch (e) { + actual = e; + } + + message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + + (message ? ' ' + message : '.'); + + if (shouldThrow && !actual) { + fail('Missing expected exception' + message); + } + + if (!shouldThrow && expectedException(actual, expected)) { + fail('Got unwanted exception' + message); + } + + if ((shouldThrow && actual && expected && + !expectedException(actual, expected)) || (!shouldThrow && actual)) { + throw actual; + } +} + +// 11. Expected to throw an error: +// assert.throws(block, Error_opt, message_opt); + +assert.throws = function(block, /*optional*/error, /*optional*/message) { + _throws.apply(this, [true].concat(pSlice.call(arguments))); +}; + +// EXTENSION! This is annoying to write outside this module. +assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { + _throws.apply(this, [false].concat(pSlice.call(arguments))); +}; + +assert.ifError = function (err) { if (err) {throw err;}}; +})(assert); +(function(exports){ +/*! + * Nodeunit + * Copyright (c) 2010 Caolan McMahon + * MIT Licensed + * + * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! + * Only code on that line will be removed, it's mostly to avoid requiring code + * that is node specific + */ + +/** + * Module dependencies + */ + + + +/** + * Creates assertion objects representing the result of an assert call. + * Accepts an object or AssertionError as its argument. + * + * @param {object} obj + * @api public + */ + +exports.assertion = function (obj) { + return { + method: obj.method || '', + message: obj.message || (obj.error && obj.error.message) || '', + error: obj.error, + passed: function () { + return !this.error; + }, + failed: function () { + return Boolean(this.error); + } + }; +}; + +/** + * Creates an assertion list object representing a group of assertions. + * Accepts an array of assertion objects. + * + * @param {Array} arr + * @param {Number} duration + * @api public + */ + +exports.assertionList = function (arr, duration) { + var that = arr || []; + that.failures = function () { + var failures = 0; + for (var i = 0; i < this.length; i += 1) { + if (this[i].failed()) { + failures += 1; + } + } + return failures; + }; + that.passes = function () { + return that.length - that.failures(); + }; + that.duration = duration || 0; + return that; +}; + +/** + * Create a wrapper function for assert module methods. Executes a callback + * after it's complete with an assertion object representing the result. + * + * @param {Function} callback + * @api private + */ + +var assertWrapper = function (callback) { + return function (new_method, assert_method, arity) { + return function () { + var message = arguments[arity - 1]; + var a = exports.assertion({method: new_method, message: message}); + try { + assert[assert_method].apply(null, arguments); + } + catch (e) { + a.error = e; + } + callback(a); + }; + }; +}; + +/** + * Creates the 'test' object that gets passed to every test function. + * Accepts the name of the test function as its first argument, followed by + * the start time in ms, the options object and a callback function. + * + * @param {String} name + * @param {Number} start + * @param {Object} options + * @param {Function} callback + * @api public + */ + +exports.test = function (name, start, options, callback) { + var expecting; + var a_list = []; + + var wrapAssert = assertWrapper(function (a) { + a_list.push(a); + if (options.log) { + async.nextTick(function () { + options.log(a); + }); + } + }); + + var test = { + done: function (err) { + if (expecting !== undefined && expecting !== a_list.length) { + var e = new Error( + 'Expected ' + expecting + ' assertions, ' + + a_list.length + ' ran' + ); + var a1 = exports.assertion({method: 'expect', error: e}); + a_list.push(a1); + if (options.log) { + async.nextTick(function () { + options.log(a1); + }); + } + } + if (err) { + var a2 = exports.assertion({error: err}); + a_list.push(a2); + if (options.log) { + async.nextTick(function () { + options.log(a2); + }); + } + } + var end = new Date().getTime(); + async.nextTick(function () { + var assertion_list = exports.assertionList(a_list, end - start); + options.testDone(name, assertion_list); + callback(null, a_list); + }); + }, + ok: wrapAssert('ok', 'ok', 2), + same: wrapAssert('same', 'deepEqual', 3), + equals: wrapAssert('equals', 'equal', 3), + expect: function (num) { + expecting = num; + }, + _assertion_list: a_list + }; + // add all functions from the assert module + for (var k in assert) { + if (assert.hasOwnProperty(k)) { + test[k] = wrapAssert(k, k, assert[k].length); + } + } + return test; +}; + +/** + * Ensures an options object has all callbacks, adding empty callback functions + * if any are missing. + * + * @param {Object} opt + * @return {Object} + * @api public + */ + +exports.options = function (opt) { + var optionalCallback = function (name) { + opt[name] = opt[name] || function () {}; + }; + + optionalCallback('moduleStart'); + optionalCallback('moduleDone'); + optionalCallback('testStart'); + optionalCallback('testDone'); + //optionalCallback('log'); + + // 'done' callback is not optional. + + return opt; +}; +})(types); +(function(exports){ +/*! + * Nodeunit + * Copyright (c) 2010 Caolan McMahon + * MIT Licensed + * + * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! + * Only code on that line will be removed, it's mostly to avoid requiring code + * that is node specific + */ + +/** + * Module dependencies + */ + + + +/** + * Added for browser compatibility + */ + +var _keys = function (obj) { + if (Object.keys) { + return Object.keys(obj); + } + var keys = []; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + keys.push(k); + } + } + return keys; +}; + + +var _copy = function (obj) { + var nobj = {}; + var keys = _keys(obj); + for (var i = 0; i < keys.length; i += 1) { + nobj[keys[i]] = obj[keys[i]]; + } + return nobj; +}; + + +/** + * Runs a test function (fn) from a loaded module. After the test function + * calls test.done(), the callback is executed with an assertionList as its + * second argument. + * + * @param {String} name + * @param {Function} fn + * @param {Object} opt + * @param {Function} callback + * @api public + */ + +exports.runTest = function (name, fn, opt, callback) { + var options = types.options(opt); + + options.testStart(name); + var start = new Date().getTime(); + var test = types.test(name, start, options, callback); + + try { + fn(test); + } + catch (e) { + test.done(e); + } +}; + +/** + * Takes an object containing test functions or other test suites as properties + * and runs each in series. After all tests have completed, the callback is + * called with a list of all assertions as the second argument. + * + * If a name is passed to this function it is prepended to all test and suite + * names that run within it. + * + * @param {String} name + * @param {Object} suite + * @param {Object} opt + * @param {Function} callback + * @api public + */ + +exports.runSuite = function (name, suite, opt, callback) { + suite = wrapGroup(suite); + var keys = _keys(suite); + + async.concatSeries(keys, function (k, cb) { + var prop = suite[k], _name; + + _name = name ? [].concat(name, k) : [k]; + _name.toString = function () { + // fallback for old one + return this.join(' - '); + }; + + if (typeof prop === 'function') { + var in_name = false, + in_specific_test = (_name.toString() === opt.testFullSpec) ? true : false; + for (var i = 0; i < _name.length; i += 1) { + if (_name[i] === opt.testspec) { + in_name = true; + } + } + + if ((!opt.testFullSpec || in_specific_test) && (!opt.testspec || in_name)) { + if (opt.moduleStart) { + opt.moduleStart(); + } + exports.runTest(_name, suite[k], opt, cb); + } + else { + return cb(); + } + } + else { + exports.runSuite(_name, suite[k], opt, cb); + } + }, callback); +}; + +/** + * Run each exported test function or test suite from a loaded module. + * + * @param {String} name + * @param {Object} mod + * @param {Object} opt + * @param {Function} callback + * @api public + */ + +exports.runModule = function (name, mod, opt, callback) { + var options = _copy(types.options(opt)); + + var _run = false; + var _moduleStart = options.moduleStart; + + mod = wrapGroup(mod); + + function run_once() { + if (!_run) { + _run = true; + _moduleStart(name); + } + } + options.moduleStart = run_once; + + var start = new Date().getTime(); + + exports.runSuite(null, mod, options, function (err, a_list) { + var end = new Date().getTime(); + var assertion_list = types.assertionList(a_list, end - start); + options.moduleDone(name, assertion_list); + if (nodeunit.complete) { + nodeunit.complete(name, assertion_list); + } + callback(null, a_list); + }); +}; + +/** + * Treats an object literal as a list of modules keyed by name. Runs each + * module and finished with calling 'done'. You can think of this as a browser + * safe alternative to runFiles in the nodeunit module. + * + * @param {Object} modules + * @param {Object} opt + * @api public + */ + +// TODO: add proper unit tests for this function +exports.runModules = function (modules, opt) { + var all_assertions = []; + var options = types.options(opt); + var start = new Date().getTime(); + + async.concatSeries(_keys(modules), function (k, cb) { + exports.runModule(k, modules[k], options, cb); + }, + function (err, all_assertions) { + var end = new Date().getTime(); + options.done(types.assertionList(all_assertions, end - start)); + }); +}; + + +/** + * Wraps a test function with setUp and tearDown functions. + * Used by testCase. + * + * @param {Function} setUp + * @param {Function} tearDown + * @param {Function} fn + * @api private + */ + +var wrapTest = function (setUp, tearDown, fn) { + return function (test) { + var context = {}; + if (tearDown) { + var done = test.done; + test.done = function (err) { + try { + tearDown.call(context, function (err2) { + if (err && err2) { + test._assertion_list.push( + types.assertion({error: err}) + ); + return done(err2); + } + done(err || err2); + }); + } + catch (e) { + done(e); + } + }; + } + if (setUp) { + setUp.call(context, function (err) { + if (err) { + return test.done(err); + } + fn.call(context, test); + }); + } + else { + fn.call(context, test); + } + }; +}; + + +/** + * Returns a serial callback from two functions. + * + * @param {Function} funcFirst + * @param {Function} funcSecond + * @api private + */ + +var getSerialCallback = function (fns) { + if (!fns.length) { + return null; + } + return function (callback) { + var that = this; + var bound_fns = []; + for (var i = 0, len = fns.length; i < len; i++) { + (function (j) { + bound_fns.push(function () { + return fns[j].apply(that, arguments); + }); + })(i); + } + return async.series(bound_fns, callback); + }; +}; + + +/** + * Wraps a group of tests with setUp and tearDown functions. + * Used by testCase. + * + * @param {Object} group + * @param {Array} setUps - parent setUp functions + * @param {Array} tearDowns - parent tearDown functions + * @api private + */ + +var wrapGroup = function (group, setUps, tearDowns) { + var tests = {}; + + var setUps = setUps ? setUps.slice(): []; + var tearDowns = tearDowns ? tearDowns.slice(): []; + + if (group.setUp) { + setUps.push(group.setUp); + delete group.setUp; + } + if (group.tearDown) { + tearDowns.unshift(group.tearDown); + delete group.tearDown; + } + + var keys = _keys(group); + + for (var i = 0; i < keys.length; i += 1) { + var k = keys[i]; + if (typeof group[k] === 'function') { + tests[k] = wrapTest( + getSerialCallback(setUps), + getSerialCallback(tearDowns), + group[k] + ); + } + else if (typeof group[k] === 'object') { + tests[k] = wrapGroup(group[k], setUps, tearDowns); + } + } + return tests; +}; + + +/** + * Backwards compatibility for test suites using old testCase API + */ + +exports.testCase = function (suite) { + return suite; +}; +})(core); +(function(exports){ +/*! + * Nodeunit + * Copyright (c) 2010 Caolan McMahon + * MIT Licensed + * + * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! + * Only code on that line will be removed, its mostly to avoid requiring code + * that is node specific + */ + + +/** + * NOTE: this test runner is not listed in index.js because it cannot be + * used with the command-line tool, only inside the browser. + */ + + +/** + * Reporter info string + */ + +exports.info = "Browser-based test reporter"; + + +/** + * Run all tests within each module, reporting the results + * + * @param {Array} files + * @api public + */ + +exports.run = function (modules, options) { + var start = new Date().getTime(), div; + options = options || {}; + div = options.div || document.body; + + function setText(el, txt) { + if ('innerText' in el) { + el.innerText = txt; + } + else if ('textContent' in el){ + el.textContent = txt; + } + } + + function getOrCreate(tag, id) { + var el = document.getElementById(id); + if (!el) { + el = document.createElement(tag); + el.id = id; + div.appendChild(el); + } + return el; + }; + + var header = getOrCreate('h1', 'nodeunit-header'); + var banner = getOrCreate('h2', 'nodeunit-banner'); + var userAgent = getOrCreate('h2', 'nodeunit-userAgent'); + var tests = getOrCreate('ol', 'nodeunit-tests'); + var result = getOrCreate('p', 'nodeunit-testresult'); + + setText(userAgent, navigator.userAgent); + + nodeunit.runModules(modules, { + moduleStart: function (name) { + /*var mheading = document.createElement('h2'); + mheading.innerText = name; + results.appendChild(mheading); + module = document.createElement('ol'); + results.appendChild(module);*/ + }, + testDone: function (name, assertions) { + var test = document.createElement('li'); + var strong = document.createElement('strong'); + strong.innerHTML = name + ' (' + + '' + assertions.failures() + ', ' + + '' + assertions.passes() + ', ' + + assertions.length + + ')'; + test.className = assertions.failures() ? 'fail': 'pass'; + test.appendChild(strong); + + var aList = document.createElement('ol'); + aList.style.display = 'none'; + test.onclick = function () { + var d = aList.style.display; + aList.style.display = (d == 'none') ? 'block': 'none'; + }; + for (var i=0; i' + (a.error.stack || a.error) + ''; + li.className = 'fail'; + } + else { + li.innerHTML = a.message || a.method || 'no message'; + li.className = 'pass'; + } + aList.appendChild(li); + } + test.appendChild(aList); + tests.appendChild(test); + }, + done: function (assertions) { + var end = new Date().getTime(); + var duration = end - start; + + var failures = assertions.failures(); + banner.className = failures ? 'fail': 'pass'; + + result.innerHTML = 'Tests completed in ' + duration + + ' milliseconds.
' + + assertions.passes() + ' assertions of ' + + '' + assertions.length + ' passed, ' + + assertions.failures() + ' failed.'; + } + }); +}; +})(reporter); +nodeunit = core; +nodeunit.assert = assert; +nodeunit.reporter = reporter; +nodeunit.run = reporter.run; +return nodeunit; })(); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/numberformats.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/numberformats.proto new file mode 100644 index 0000000..79a07f8 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/numberformats.proto @@ -0,0 +1,18 @@ +enum Formats { + DEC = 1; + HEX = 0x1F; + OCT = 017; +} + +message Msg { + required int32 dec = 1 [default=-1]; + required int32 hex = 2 [default=-0x1F]; + required int32 oct = 3 [default=-017]; + required double exp = 4 [default=0.1e5]; + required double nod = 5 [default=1.]; + required double exn = 6 [default=1e8]; + required double sp1 = 7 [default=inf]; + required double sp2 = 8 [default=-inf]; + required double sp3 = 9 [default=nan]; + required int32 hexUC = 10 [default=0X209]; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/oneof.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/oneof.proto new file mode 100644 index 0000000..52a618b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/oneof.proto @@ -0,0 +1,6 @@ +message MyOneOf { + oneof my_oneof { + uint32 id = 1; + string name = 2; + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/optional.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/optional.proto new file mode 100644 index 0000000..92fbfc5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/optional.proto @@ -0,0 +1,12 @@ +message Test1 { + optional int32 a = 1; + optional Test2 b = 2; +} + +message Test2 { + optional int32 c = 1; + optional Test3 d = 2; +} + +message Test3 { +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/options.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/options.json new file mode 100644 index 0000000..405450e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/options.json @@ -0,0 +1,32 @@ +{ + "package": "My", + "messages": [ + { + "name": "Test", + "fields": [ + { + "rule": "optional", + "options": { + "default": "Max" + }, + "type": "string", + "name": "name", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": { + "(inmessage)": "My.Test", + "(foo.my_option).bar": false + } + } + ], + "enums": [], + "imports": [], + "options": { + "(toplevel_1)": 10, + "(toplevel_2)": "Hello world!" + }, + "services": [] +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/options.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/options.proto new file mode 100644 index 0000000..f96da6d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/options.proto @@ -0,0 +1,13 @@ +option (toplevel_1) = 10; +package My; +option (toplevel_2) = "Hello world!"; + +message Test { + optional string name = 1 [default="Max"]; + optional string desc1 = 2 [default="Shouldn't mix quotes"]; + optional string desc2 = 3 [default='Shouldn"t mix quotes']; + optional string desc3 = 4 [(foo_options) = { opt1: 123 opt2: "baz" }]; + optional string desc4 = 5 [(foo_options) = {options { opt1: 1234 opt2: "baz" } options { opt1: 4321 opt2: "foo" }} ]; + option (inmessage) = My.Test; + option (foo.my_option).bar = false; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/packed.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/packed.proto new file mode 100644 index 0000000..b9ee7a0 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/packed.proto @@ -0,0 +1,4 @@ +message Message { + repeated int32 a = 1 [packed = true]; + repeated int32 b = 2; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto2js/Bar.json b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto2js/Bar.json new file mode 100644 index 0000000..3c4712a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto2js/Bar.json @@ -0,0 +1,46 @@ +{ + "package": null, + "messages": [ + { + "ref": "Foo", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "buzz", + "id": 2, + "options": {} + } + ] + } + ], + "enums": [], + "imports": [ + { + "package": null, + "messages": [ + { + "name": "Foo", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "fizz", + "id": 1, + "options": {} + } + ], + "enums": [], + "messages": [], + "options": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] + } + ], + "options": {}, + "services": [] +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto2js/Bar.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto2js/Bar.proto new file mode 100644 index 0000000..309157b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto2js/Bar.proto @@ -0,0 +1,7 @@ +// Bar.proto +import "Foo.proto"; + +// really extend Bar but that produces an empty constructor. +extend Foo { + required string buzz = 2; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto2js/Foo.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto2js/Foo.proto new file mode 100644 index 0000000..f56944a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto2js/Foo.proto @@ -0,0 +1,4 @@ +// Foo.proto +message Foo { + required string fizz = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto3.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto3.proto new file mode 100644 index 0000000..9f99fbb --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/proto3.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package test; + +message Foo { + int32 optional_int32 = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/protobufnet.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/protobufnet.proto new file mode 100644 index 0000000..1d255c2 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/protobufnet.proto @@ -0,0 +1,19 @@ +message IMeshImp { +} +message Mesh { + optional IMeshImp _meshImp = 1; + repeated float3 _vertices = 2; + repeated uint32 _colors = 3; + repeated float3 _normals = 4; + repeated float2 _uvs = 5; + repeated int32 _triangles = 6; +} +message float2 { + optional float x = 1 [default = 0]; + optional float y = 2 [default = 0]; +} +message float3 { + optional float x = 1 [default = 0]; + optional float y = 2 [default = 0]; + optional float z = 3 [default = 0]; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/repeated.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/repeated.proto new file mode 100644 index 0000000..4ed169b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/repeated.proto @@ -0,0 +1,12 @@ +message Outer { + // As of: https://developers.google.com/protocol-buffers/docs/encoding#optional + + repeated Inner inner = 1; + // "If your message definition has repeated elements (without the [packed=true] option), the encoded message has + // zero or more key-value pairs with the same tag number." + +} + +message Inner { + optional uint32 inner_value = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/services.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/services.js new file mode 100644 index 0000000..c59995d --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/services.js @@ -0,0 +1,39 @@ +var root = require("..").newBuilder({ + "convertFieldsToCamelCase": true, + "populateAccessors": false +})['import']({ + "package": "my.namespace", + "messages": [ + { + "name": "something", + "fields": [], + "messages": [ + { + "name": "v1", + "fields": [], + "messages": [ + { + "name": "GetRequest", + "fields": [] + }, + { + "name": "GetResponse", + "fields": [] + } + ], + "enums": [], + "services": [{ + "name": "SomeService", + "rpc": { + "get": { + "request": "GetRequest", + "response": "GetResponse" + } + } + }] + } + ] + } + ] +}).build(); +console.log(require("util").inspect(root, { depth: 10})); \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/setarray.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/setarray.proto new file mode 100644 index 0000000..8bbcc32 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/setarray.proto @@ -0,0 +1,7 @@ +message Outer { + repeated Inner inners = 4; +} + +message Inner { + required string str = 1; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/string_single_quote.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/string_single_quote.proto new file mode 100644 index 0000000..082cff8 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/string_single_quote.proto @@ -0,0 +1,3 @@ +message TestSingleQuoteString { + required string a = 1 [ default = 'hello world' ]; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/suite.html b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/suite.html new file mode 100644 index 0000000..ed15eaa --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/suite.html @@ -0,0 +1,16 @@ + + + + ProtoBuf.js Test Suite + + + + + + + + +

ProtoBuf.js Test Suite

+ + + diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/suite.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/suite.js new file mode 100644 index 0000000..da0b087 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/suite.js @@ -0,0 +1,2267 @@ +/* + Copyright 2013 Daniel Wirtz + + 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. + */ + +/** + * ProtoBuf.js Test Suite. + * @author Daniel Wirtz + */ +(function(global) { + + var FILE = "protobuf.js"; + var BROWSER = !!global.window; + var StdOutFixture = require('fixture-stdout'); + var fixture = new StdOutFixture(); + + var ProtoBuf = BROWSER ? global.dcodeIO.ProtoBuf : require(__dirname+"/../dist/"+FILE), + ByteBuffer = BROWSER ? global.dcodeIO.ByteBuffer : ByteBuffer || require("bytebuffer"), + util = BROWSER ? null : require("util"), + fs = BROWSER ? null : require("fs"); + + if (typeof __dirname == 'undefined') { + __dirname = document.location.href.replace(/[\/\\][^\/\\]*$/, ""); + } + + /** + * Constructs a new Sandbox for module loaders and shim testing. + * @param {Object.} properties Additional properties to set + * @constructor + */ + var Sandbox = function(properties) { + this.ByteBuffer = function() {}; + for (var i in properties) { + this[i] = properties[i]; + } + this.console = { + log: function(s) { + console.log(s); + } + }; + }; + + function fail(e) { + throw(e); + } + + /** + * Validates the complexDotProto and complexInline tests. + * @param {*} test Nodeunit test + * @param {Object} Game Game namespace + */ + function validateComplex(test, Game) { + var Car = Game.Cars.Car, + Vendor = Car.Vendor, + Speed = Car.Speed; + + var vendor; + // Car from class with argument list properties + var car = new Car( + "Rusty", + // Vendor from class with object properties + vendor = new Vendor({ + "name": "Iron Inc.", + // Address from object + "address": { + "country": "US" + }, + "models": ["m1"] + }), + // Speed from enum object + Speed.SUPERFAST + ); + test.equal(car.model, "Rusty"); + test.equal(car.vendor.name, "Iron Inc."); + test.equal(car.vendor.address.country, "US"); + test.equal(car.vendor.address.country, car.getVendor().get_address().country); + var bb = new ByteBuffer(32); + car.encode(bb); + test.equal(bb.flip().toString("debug"), "<0A 05 52 75 73 74 79 12 15 0A 09 49 72 6F 6E 20 49 6E 63 2E 12 04 0A 02 55 53 1A 02 6D 31 18 02>"); + var carDec = Car.decode(bb); + test.equal(carDec.model, "Rusty"); + test.equal(carDec.vendor.name, "Iron Inc."); + test.equal(carDec.vendor.address.country, "US"); + test.equal(carDec.vendor.address.country, carDec.getVendor().get_address().country); + test.equal(carDec.vendor.models[0], "m1"); + } + + /** + * Test suite. + * @type {Object.} + */ + var suite = { + + "init": function(test) { + test.ok(typeof ProtoBuf == "object"); + test.ok(typeof ProtoBuf.Reflect == 'object'); + test.ok(typeof ProtoBuf.loadProto == "function"); + test.ok(typeof ProtoBuf.loadProtoFile == "function"); + test.strictEqual(ProtoBuf.loadProto, ProtoBuf.protoFromString); + test.strictEqual(ProtoBuf.loadProtoFile, ProtoBuf.protoFromFile); + test.ok(ProtoBuf.ByteBuffer); + test.done(); + }, + + "IS_NODE": function(test) { + test.ok(ProtoBuf.Util.IS_NODE); + test.done(); + }, + + // Example "A Simple Message" from the protobuf docs + // https://developers.google.com/protocol-buffers/docs/encoding#simple + "example1": function(test) { + try{ + var builder = ProtoBuf.loadProtoFile(__dirname+"/example1.proto"); + var Test1 = builder.build("Test1"); + test.ok(typeof Test1 == 'function'); + var inst = new Test1(150); + test.ok(inst instanceof ProtoBuf.Builder.Message); + test.equal(inst.a, 150); + test.equal(inst.getA(), 150); + test.equal(inst.get_a(), 150); + inst.setA(151); + test.equal(inst.a, 151); + test.equal(inst.getA(), 151); + test.equal(inst.get_a(), 151); + inst.set_a(152); + test.equal(inst.a, 152); + test.equal(inst.toString(), ".Test1"); + test.throws(function() { + inst.setA(null); // required + }); + test.throws(function() { + inst.setA([]); + }); + var size = inst.calculate(); + var bb = new ByteBuffer(3); + inst.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<08 98 01>"); + var instDec = Test1.decode(bb); + test.equal(instDec.a, 152); + + } catch (e) { + fail(e); + } + test.done(); + }, + + // Basically the same as example1, but with an unsigned value. + "example1u": function(test) { + try{ + var builder = ProtoBuf.loadProtoFile(__dirname+"/example1u.proto"); + var Test1u = builder.build("Test1u"); + test.ok(typeof Test1u == 'function'); + var inst = new Test1u(-1); + test.strictEqual(inst.a, 4294967295); + var bb = new ByteBuffer(6); + var size = inst.calculate(); + inst.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<08 FF FF FF FF 0F>"); + var instDec = Test1u.decode(bb); + test.strictEqual(instDec.a, 4294967295); + + } catch (e) { + fail(e); + } + test.done(); + }, + + // Example "Strings" from the protobuf docs + // https://developers.google.com/protocol-buffers/docs/encoding#types + "example2": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example2.proto"); + var Test2 = builder.build("Test2"); + var inst = new Test2("testing"); + var bb = new ByteBuffer(9); + var size = inst.calculate(); + inst.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<12 07 74 65 73 74 69 6E 67>"); + var instDec = Test2.decode(bb); + test.equal(instDec.b, "testing"); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Example "Embedded Messages" from the protobuf docs + // https://developers.google.com/protocol-buffers/docs/encoding#embedded + "example3": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example3.proto"); + var root = builder.build(); + var Test1 = root.Test1; + var Test3 = root.Test3; + var inst = new Test3(new Test1(150)); + var bb = new ByteBuffer(5); + test.equal(inst.c.a, 150); + var size = inst.calculate(); + inst.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<1A 03 08 96 01>"); + var instDec = Test3.decode(bb); + test.equal(instDec.c.a, 150); + } catch(e) { + fail(e); + } + test.done(); + }, + + "example4": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example4.proto"); + var Test4 = builder.build("Test4"); + var inst = new Test4([3, 270, 86942]); + var bb = new ByteBuffer(8); + test.equal(inst.d.length, 3); + var size = inst.calculate(); + inst.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<22 06 03 8E 02 9E A7 05>"); + var instDec = Test4.decode(bb); + test.equal(bb.toString("debug"), "22 06 03 8E 02 9E A7 05|"); + test.equal(instDec.d.length, 3); + test.equal(instDec.d[2], 86942); + } catch(e) { + fail(e); + } + test.done(); + }, + + "example5": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example5.proto"); + builder.build(); + } catch(e) { + fail(e); + } + test.done(); + }, + + "constructor": function(test) { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example1.proto"); + var Test1 = builder.build("Test1"); + var t1 = new Test1(123), + t2 = new Test1({a: 123}), + t3 = new Test1(t1); + test.deepEqual(t1, t2); + test.deepEqual(t2, t3); + test.done(); + }, + + "constructorWithOneofs": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/oneof.proto"), + MyOneOf = builder.build("MyOneOf"), + TOneOf = builder.lookup(".MyOneOf"); + test.ok(TOneOf.getChild("my_oneof")); + + var myOneOf = new MyOneOf(); + test.strictEqual(myOneOf.my_oneof, null); + myOneOf.set("id", 1); + test.strictEqual(myOneOf.my_oneof, "id"); + myOneOf.set("name", "me"); + test.strictEqual(myOneOf.my_oneof, "name"); + test.strictEqual(myOneOf.id, null); + + var copy = new MyOneOf(myOneOf); // this line is what was failing + // Error: .MyOneOf#my_oneof is not a field: undefined + + test.deepEqual(myOneOf, copy); + + // Test same things are there + test.strictEqual(copy.my_oneof, "name"); + test.strictEqual(copy.name, "me"); + test.strictEqual(copy.id, null); + } catch (e) { + fail(e); + } + test.done(); + }, + + "numberFormats": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/numberformats.proto"); + var Formats = builder.build("Formats"); + test.strictEqual(Formats.DEC, 1); + test.strictEqual(Formats.HEX, 31); + test.strictEqual(Formats.OCT, 15); + var Msg = builder.build("Msg"); + var msg = new Msg(); + test.strictEqual(msg.dec, -1); + test.strictEqual(msg.hex, -31); + test.strictEqual(msg.hexUC, 521); + test.strictEqual(msg.oct, -15); + test.strictEqual(msg.exp, 0.1e5); + test.strictEqual(msg.nod, 1.); + test.strictEqual(msg.exn, 1e8); + test.strictEqual(msg.sp1, Infinity); + test.strictEqual(msg.sp2, -Infinity); + test.ok(isNaN(msg.sp3)); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Check encode/decode against a table of known correct pairs. + // Note that javascript ArrayBuffer does not support signed Zero or NaN + // bertdouglas (https://github.com/bertdouglas) + "float": function(test) { + try { + var str_proto = "message Float {" + + " required float f = 1;" + + "}"; + var builder = ProtoBuf.loadProto(str_proto); + var root = builder.build(); + var Float = root.Float; + + var in_tolerance = function (reference,actual) { + var tol = 1e-6; + var scale = 1.0; + if (reference != 0.0 ) { + scale = reference; + }; + var err = Math.abs(reference - actual)/scale; + return err < tol; + }; + + var f_vals = [ + // hex values are shown here in big-endian following IEEE754 notation + // protobuf is little-endian + // { f: -0.0 , b: "80 00 00 00" }, + { f: +0.0 , b: "00 00 00 00" }, + { f: -1e-10 , b: "AE DB E6 FF" }, + { f: +1e-10 , b: "2E DB E6 FF" }, + { f: -2e+10 , b: "D0 95 02 F9" }, + { f: +2e+10 , b: "50 95 02 F9" }, + { f: -3e-30 , b: "8E 73 63 90" }, + { f: +3e-30 , b: "0E 73 63 90" }, + { f: -4e+30 , b: "F2 49 F2 CA" }, + { f: +4e+30 , b: "72 49 F2 CA" }, + { f: -123456789.0 , b: "CC EB 79 A3" }, + { f: +123456789.0 , b: "4C EB 79 A3" }, + { f: -0.987654321 , b: "BF 7C D6 EA" }, + { f: +0.987654321 , b: "3F 7C D6 EA" }, + { f: -Infinity , b: "FF 80 00 00" }, + { f: +Infinity , b: "7F 80 00 00" } + // { f: -NaN , b: "FF C0 00 00>" }, + // { f: +NaN , b: "7F C0 00 00" } + ]; + + f_vals.map( function(x) { + // check encode + var m1 = new Float(); + var b1 = new ByteBuffer(); + m1.f = x.f; + m1.encode(b1); + var q1 = b1.slice(1,5).compact().reverse(); + test.strictEqual('<' + x.b + '>', q1.toString("debug")); + + // check decode + var b2 = new ByteBuffer(); + var s1 = x.b + ' 0D'; + var s2 = s1.split(" "); + var s3 = s2.reverse(); + var i1 = s3.map(function(y) { return parseInt(y,16) } ); + i1.map(function(y) { b2.writeUint8(y) }); + b2.limit = b2.offset; + b2.offset = 0; + var m2 = Float.decode(b2); + + var s4 = "" + x.f +" " + m2.f; + if ( isNaN(x.f) ) { + test.ok( isNaN(m2.f), s4 ); + } + else if ( ! isFinite( x.f) ) { + test.ok( x.f === m2.f, s4 ); + } + else { + test.ok( in_tolerance(x.f, m2.f), s4 ); + } + }); + } catch(e) { + fail(e); + } + test.done(); + }, + + "bytes": function(test) { + try { + var str_proto = "message Test { required bytes b = 1; }"; + var builder = ProtoBuf.loadProto(str_proto); + var Test = builder.build("Test"); + var bb = new ByteBuffer(4).writeUint32(0x12345678).flip(); + var myTest = new Test(bb); + test.strictEqual(myTest.b.array, bb.array); + var bb2 = new ByteBuffer(6); + var size = myTest.calculate(); + myTest.encode(bb2); + test.strictEqual(bb2.offset, size); + test.equal(bb2.flip().toString("debug"), "<0A 04 12 34 56 78>"); + myTest = Test.decode(bb2); + test.equal(myTest.b.BE().readUint32(), 0x12345678); + } catch (e) { + fail(e); + } + test.done(); + }, + + "bytesFromFile": function(test) { + try { + var builder = ProtoBuf.loadProto("message Image { required bytes data = 1; }"), + Image = builder.build("Image"), + data = fs.readFileSync(__dirname+"/../protobuf.png"), + image = new Image({ data: data }), + bb = image.encode(), + imageDec = Image.decode(bb), + dataDec = imageDec.data.toBuffer(); + test.strictEqual(data.length, dataDec.length); + test.deepEqual(data, dataDec); + } catch (e) { + fail(e); + } + test.done(); + }, + + "notEnoughBytes": function(test) { + var builder = ProtoBuf.loadProto("message Test { required bytes b = 1; }"); + var Test = builder.build("Test"); + var bb = new ByteBuffer().writeUint32(0x12345678).flip(); + var encoded = new ByteBuffer(6); + new Test(bb).encode(encoded); + test.equal(encoded.flip().toString("debug"), "<0A 04 12 34 56 78>"); + encoded = encoded.slice(0, 5); // chop off the last byte + var err = null; + try { + Test.decode(encoded); + } catch (caught) { + err = caught; + } + test.ok(err && err.message && err.message.indexOf(": 4 required but got only 3") >= 0); + test.done(); + }, + + "bool": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test { optional bool ok = 1 [ default = false ]; }"), + Test = builder.build("Test"), + t = new Test(); + test.strictEqual(t.ok, null); // Not set as it is optional + t.setOk(true); + test.strictEqual(t.ok, true); + test.strictEqual(Test.decode(t.encode()).ok, true); + t.setOk(false); + test.strictEqual(t.ok, false); + t.setOk(null); // Not set + test.strictEqual(Test.decode(t.encode()).ok, false); // = default when missing + } catch (err) { + fail(err); + } + test.done(); + }, + + // As mentioned by Bill Katz + "T139": function(test) { + try{ + var builder = ProtoBuf.loadProtoFile(__dirname+"/T139.proto"); + var T139 = builder.build("T139"); + test.ok(typeof T139 == 'function'); + var inst = new T139(139,139); + test.equal(inst.a, 139); + test.equal(inst.b, 139); + inst.setA(139); + inst.setB(139); + test.equal(inst.a, 139); + test.equal(inst.b, 139); + var bb = new ByteBuffer(3); + inst.encode(bb); + test.equal(bb.flip().toString("debug"), "<08 8B 01 10 8B 01>"); + var instDec = T139.decode(bb); + test.equal(instDec.a, 139); + test.equal(instDec.b, 139); + } catch (e) { + fail(e); + } + test.done(); + }, + + "emptyDefaultString": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test1 { required string test = 1 [default = \"\"]; }"); + var Test1; + test.doesNotThrow(function() { + Test1 = builder.build("Test1"); + }); + var test1 = new Test1(); + test.strictEqual(test1.test, ""); + } catch (e) { + fail(e); + } + test.done(); + }, + + "trailingSemicolon": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test1 { optional string test = 1; };"); + test.doesNotThrow(function() { + var Test1 = builder.build("Test1"); + }); + } catch (e) { + fail(e); + } + test.done(); + }, + + "inner": { + + "longstr": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test { required Inner a = 1; message Inner { required string b = 1; } }"); + var Test = builder.build("Test"); + var t = new Test(); + var data = "0123456789"; // 10: 20, 40, 80, 160, 320 bytes + for (var i=0; i<5; i++) data += data; + test.equal(data.length, 320); + t.a = new Test.Inner(data); + var bb = t.encode(); + var t2 = Test.decode(bb); + test.equal(t2.a.b.length, 320); + test.equal(data, t2.a.b); + } catch (e) { + fail(e); + } + test.done(); + }, + + "multiple": function(test) { + try { + var str = ""; + for (var i=0; i<200; i++) str += 'a'; + var builder = ProtoBuf.loadProtoFile(__dirname+"/inner.proto"); + var fooCls = builder.build("Foo"); + var barCls = builder.build("Bar"); + var bazCls = builder.build("Baz"); + var foo = new fooCls(new barCls(str), new bazCls(str)); + var fooEncoded = foo.encode(); + test.doesNotThrow(function() { + fooCls.decode(fooEncoded); + }); + } catch (e) { + fail(e); + } + test.done(); + }, + + "float": function(test) { + try { + var builder = ProtoBuf.loadProto("message Foo { required Bar bar = 1; } message Bar { required float baz = 1; }"); + var root = builder.build(); + var foo = new root.Foo(new root.Bar(4)); + var bb = foo.encode(); + var foo2 = root.Foo.decode(bb); + test.equal(foo.bar.baz, 4); + test.equal(foo2.bar.baz, foo.bar.baz); + } catch (e) { + fail(e); + } + test.done(); + } + + }, + + "truncated": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test { required int32 a = 1; required int32 b = 2; }"); + var Test = builder.build("Test"); + var t = new Test(), bb = new ByteBuffer(2); + t.setA(1); + try { + bb = t.encode(bb).flip(); + test.ok(false); + } catch (e) { + test.ok(e.encoded); + bb = e.encoded.flip(); + test.equal(bb.toString("debug"), "<08 01>"); + } + var t2; + try /* to decode truncated message */ { + t2 = Test.decode(bb); + test.ok(false); // ^ throws + } catch (e) { + // But still be able to access the rest + var t3 = e.decoded; + test.strictEqual(t3.a, 1); + test.strictEqual(t3.b, null); + } + test.strictEqual(t2, undefined); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Options on all levels + "options": { + + "parse": function(test) { + try { + var parser = new ProtoBuf.DotProto.Parser(ProtoBuf.Util.fetch(__dirname+"/options.proto")); + var root = parser.parse(); + test.equal(root["package"], "My"); + test.strictEqual(root["options"]["(toplevel_1)"], 10); + test.equal(root["options"]["(toplevel_2)"], "Hello world!"); + var opt = root["messages"][0]["fields"][0]["options"]; + test.equal(opt["default"], "Max"); + opt = root["messages"][0]["options"]; + test.strictEqual(opt["(inmessage)"], "My.Test"); + test.strictEqual(opt["(foo.my_option).bar"], false); + opt = root["messages"][0]["fields"][1]["options"]; + test.strictEqual(opt["default"], "Shouldn't mix quotes"); + opt = root["messages"][0]["fields"][2]["options"]; + test.strictEqual(opt["default"], 'Shouldn"t mix quotes'); + opt = root["messages"][0]["fields"][3]["options"]; + test.strictEqual(opt["(foo_options).opt1"], 123); + test.strictEqual(opt["(foo_options).opt2"], "baz"); + } catch (e) { + fail(e); + } + test.done(); + }, + + "export": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/options.proto"); + var My = builder.build("My"); + test.deepEqual(My.$options, { + "(toplevel_1)": 10, + "(toplevel_2)": "Hello world!" + }); + test.strictEqual(My.$options['(toplevel_1)'], 10); + test.deepEqual(My.Test.$options, { + "(inmessage)": "My.Test", + "(foo.my_option).bar": false + }); + } catch (e) { + fail(e); + } + test.done(); + } + }, + + // Comments + "comments": function(test) { + try { + var tn = new ProtoBuf.DotProto.Tokenizer(ProtoBuf.Util.fetch(__dirname+'/comments.proto')); + var token, tokens = []; + do { + token = tn.next(); + tokens.push(token); + } while (token !== null); + test.deepEqual(tokens, ['message', 'TestC', '{', 'required', 'int32', 'a', '=', '1', ';', '}', null]); + } catch (e) { + fail(e); + } + test.done(); + }, + + // A more or less complex proto with type references + "complexProto": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/complex.proto"); + validateComplex(test, builder.build("Game")); + var TCars = builder.lookup("Game.Cars"); + test.strictEqual(TCars.fqn(), ".Game.Cars"); + } catch(e) { + fail(e); + } + test.done(); + }, + + // The same created without calling upon the parser to do so + "complexJSON": function(test) { + try { + var builder = ProtoBuf.loadJsonFile(__dirname+"/complex.json"); + validateComplex(test, builder.build("Game")); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Test error messages + "errorMessage": function(test) { + test.throws(function() { + var builder = ProtoBuf.loadJsonFile(__dirname+"/complex.json"); + var Game = builder.build("Game"); + var car = new Game.Cars.Car(); + car.speed = "hello"; + car.encode(); + }, /Illegal value for speed/); + test.done(); + }, + + // Builder reused to add definitions from multiple sources + "multiBuilder": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example1.proto"); + ProtoBuf.loadProtoFile(__dirname+"/example2.proto", builder); + var ns = builder.build(); + test.ok(!!ns.Test1); + test.ok(!!ns.Test2); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Inner messages test + "inner": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/repeated.proto"); + var root = builder.build(), + Outer = root.Outer, + Inner = root.Inner; + // Empty + var outer = new Outer(); + var bb = new ByteBuffer(1).fill(0).flip(); + outer.encode(bb); + test.equal(bb.flip().toString("debug"), "|00"); + var douter = Outer.decode(bb); + test.ok(douter.inner instanceof Array); + test.equal(douter.inner.length, 0); + // Multiple + outer = new Outer({ inner: [new Inner(1), new Inner(2)] }); + bb = new ByteBuffer(8); + var size = outer.calculate(); + outer.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<0A 02 08 01 0A 02 08 02>"); + douter = Outer.decode(bb); + test.ok(douter.inner instanceof Array); + test.equal(douter.inner.length, 2); + test.equal(douter.inner[0].inner_value, 1); + test.equal(douter.inner[1].inner_value, 2); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Packed vs. not packed repeated fields test + "packed": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/packed.proto"); + var Message = builder.build("Message"); + // Both empty + var message = new Message(); + var bb = new ByteBuffer(1).fill(0).flip(); + var size = message.calculate(); + message.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "|00"); + message = Message.decode(bb); + test.ok(message.a instanceof Array); + test.equal(message.a.length, 0); + test.ok(message.b instanceof Array); + test.equal(message.b.length, 0); + // Both non-empty + message = new Message([1,2,3], [1,2,3]); + size = message.calculate(); + message.encode(bb.resize(11)); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<0A 03 01 02 03 10 01 10 02 10 03>"); + message = Message.decode(bb); + test.ok(message.a instanceof Array); + test.equal(message.a.length, 3); + test.deepEqual(message.a, [1,2,3]); + test.ok(message.b instanceof Array); + test.equal(message.b.length, 3); + test.deepEqual(message.b, [1,2,3]); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Legacy groups test + "groups": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/groups.proto"); + var root = builder.build(); + var Outer = root.Outer; + var TOuter = builder.ns.getChild("Outer"); + var TInner = TOuter.getChild("MyInner"); + test.ok(TInner instanceof ProtoBuf.Reflect.Message); + test.strictEqual(TInner.isGroup, true); + var Tinner = TOuter.getChild("myinner"); + test.ok(Tinner instanceof ProtoBuf.Reflect.Message.Field); + test.strictEqual(Tinner.id, 2); + test.deepEqual(Tinner.options, { "deprecated": true }); + var Inner = root.Outer.MyInner; + var outer = new Outer("a", [new Inner("hello")], "b", new Inner("world")); + var bb = new ByteBuffer(); + var size = outer.calculate(); + outer.encode(bb); + test.strictEqual(bb.offset, size); + bb.flip().compact(); + var wiredMsg = [ + "0A", // 1|010 = id 1, wire type 2 (ldelim) + "01", // length 1 + "61", // "a" + "13", // 10|011 = id 2, wire type 3 (start group) + "1A", // 11|010 = id 3, wire type 2 (ldelim) + "05", // length 5 + "68 65 6C 6C 6F", // "hello" + "14", // 10|100 = id 2, wire type 4 (end group) + "22", // 100|010 = id 4, wire type 2 (ldelim) + "01", // length 1 + "62", // "b" + "2B", // 101|011 = id 5, wire type = 3 (start group) + "1A", // 11|010 = id 3, wire type = 2 (ldelim) + "05", // length 5 + "77 6F 72 6C 64", // "world" + "2C" // 101|100 = id 5, wire type = 4 (end group) + ]; + test.equal(bb.toString("debug"), "<" +wiredMsg.join(" ") + ">"); + var douter = Outer.decode(bb); + test.strictEqual(douter.before, "a"); + test.strictEqual(douter.myinner.length, 1); + test.strictEqual(douter.myinner[0].a, "hello"); + test.strictEqual(douter.after, "b"); + bb.offset = 0; + douter = root.OuterSparse.decode(bb); + test.strictEqual(bb.offset, bb.limit); + test.strictEqual(douter.before, "a"); + test.strictEqual(douter.after, "b"); + } catch (e) { + fail(e); + } + test.done(); + }, + + "x64Fixed": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/x64.proto"); + var Test = builder.build("Test"); + var myTest = new Test(); + test.ok(myTest.val instanceof ByteBuffer.Long); + test.equal(myTest.val.unsigned, false); + test.equal(myTest.val.toNumber(), -1); + test.ok(myTest.uval instanceof ByteBuffer.Long); + test.equal(myTest.uval.unsigned, true); + test.equal(myTest.uval.toNumber(), 1); + myTest.setVal(-2); + myTest.setUval(2); + var bb = new ByteBuffer(18); // 2x tag + 2x 64bit + var size = myTest.calculate(); + myTest.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<09 FE FF FF FF FF FF FF FF 11 02 00 00 00 00 00 00 00>"); + // ^ wireType=1, id=1 ^ wireType=1, id=2 + myTest = Test.decode(bb); + test.ok(myTest.val instanceof ByteBuffer.Long); + test.equal(myTest.val.unsigned, false); + test.equal(myTest.val.toNumber(), -2); + test.ok(myTest.uval instanceof ByteBuffer.Long); + test.equal(myTest.uval.unsigned, true); + test.equal(myTest.uval.toNumber(), 2); + } catch (e) { + fail(e); + } + test.done(); + }, + + "x64Varint": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/x64.proto"); + var Test = builder.build("Test2"); + var Test = builder.build("Test2"); + var myTest = new Test(); + test.ok(myTest.val instanceof ByteBuffer.Long); + test.equal(myTest.val.unsigned, false); + test.equal(myTest.val.toNumber(), -1); + test.ok(myTest.uval instanceof ByteBuffer.Long); + test.equal(myTest.uval.unsigned, true); + test.equal(myTest.uval.toNumber(), 1); + test.ok(myTest.sval instanceof ByteBuffer.Long); + test.equal(myTest.sval.unsigned, false); + test.equal(myTest.sval.toNumber(), -2); + + myTest.setVal(-2); + myTest.setUval(2); + myTest.setSval(-3); + var bb = new ByteBuffer(3+10+2); // 3x tag + 1x varint 10byte + 2x varint 1byte + var size = myTest.calculate(); + myTest.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<08 FE FF FF FF FF FF FF FF FF 01 10 02 18 05>"); + // 08: wireType=0, id=1, 18: wireType=0, id=2, ?: wireType=0, id=3 + myTest = Test.decode(bb); + test.ok(myTest.val instanceof ByteBuffer.Long); + test.equal(myTest.val.unsigned, false); + test.equal(myTest.val.toNumber(), -2); + test.ok(myTest.uval instanceof ByteBuffer.Long); + test.equal(myTest.uval.unsigned, true); + test.equal(myTest.uval.toNumber(), 2); + test.ok(myTest.sval instanceof ByteBuffer.Long); + test.equal(myTest.sval.unsigned, false); + test.equal(myTest.sval.toNumber(), -3); + } catch (e) { + fail(e); + } + test.done(); + }, + + "keywords": function(test) { + try { + var builder = ProtoBuf.loadProto("message Reserved { optional string get = 1; }"); + var My = builder.build(); + var myTest = new My.Reserved("a"); + test.doesNotThrow(function() { + myTest.encode(); + }); + } catch (e) { + fail(e); + } + test.done(); + }, + + "imports": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/imports.proto"); + var root = builder.build(); + test.ok(!!root.Test1); + test.ok(!!root.Test2); + test.ok(!!root.My.Test3); + test.notEqual(root.Test2, root.My.Test2); + } catch (e) { + fail(e); + } + test.done(); + }, + + "weakImports": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/imports-weak.proto"); + var root = builder.build(); + } catch (e) { + test.ok(e.message.indexOf("unresolvable type reference") >= 0); + test.done(); + return; + } + var e = new Error("Weak import was imported."); + fail(e); + }, + + "importExtensions": function(test) { + var x = "package x; \ + message Test { \ + extensions 1 to 10; \ + } \ + extend Test { \ + optional int32 first_val = 1; \ + }"; + var y = "package y; \ + extend x.Test { \ + optional int32 second_val = 2; \ + }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(x, builder); + ProtoBuf.loadProto(y, builder); + var Test = builder.build('x.Test'); + var inst = new Test(); + test.strictEqual(inst[".x.first_val"], null); + test.strictEqual(inst[".y.second_val"], null); + test.done(); + }, + + "toplevel": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/toplevel.proto"); + var My = builder.build("My"); + test.ok(!!My.MyEnum); + test.equal(My.MyEnum.ONE, 1); + test.equal(My.MyEnum.TWO, 2); + test.ok(!!My.Test); + var myTest = new My.Test(); + test.equal(myTest.num, My.MyEnum.ONE); + } catch (e) { + fail(e); + } + test.done(); + }, + + "importsToplevel": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/imports-toplevel.proto"); + var My = builder.build("My"); + test.ok(!!My.MyEnum); + test.equal(My.MyEnum1.ONE, 1); + test.equal(My.MyEnum1.TWO, 2); + test.ok(!!My.Test1); + var myTest = new My.Test1(); + test.equal(myTest.num, My.MyEnum.ONE); + test.equal(myTest.num1, My.MyEnum1.ONE); + } catch (e) { + fail(e); + } + test.done(); + }, + + "importDuplicate": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/import_a.proto"); + test.doesNotThrow(function() { + ProtoBuf.loadProtoFile(__dirname+"/import_b.proto", builder); + }); + var root = builder.build(); + test.ok(root.A); + test.ok(root.B); + test.ok(root.Common); + } catch (e) { + fail(e); + } + test.done(); + }, + + "importDuplicateDifferentBuilder": function(test) { + try { + var builderA = ProtoBuf.loadProtoFile(__dirname+"/import_a.proto"); + var builderB; + test.doesNotThrow(function() { + builderB = ProtoBuf.loadProtoFile(__dirname+"/import_b.proto"); + }); + var rootA = builderA.build(); + var rootB = builderB.build(); + test.ok(rootA.A); + test.ok(rootB.B); + test.ok(rootA.Common); + test.ok(rootB.Common); + } catch (e) { + fail(e); + } + test.done(); + }, + + "dupimport": function(test) { + try { + // Suppress logging result to stdout + fixture.capture(function() { return false;}); + require(__dirname+"/../cli/pbjs.js").main(["node", "bin/pbjs", __dirname+"/dupimport/main.proto", "--quiet"]); + fixture.release(); + } catch (e) { + fixture.release(); + fail(e); + } + test.done(); + }, + + "field_name_same_as_package": function(test) { + try { + fixture.capture(function() { return false;}); + require(__dirname+"/../cli/pbjs.js").main(["node", "bin/pbjs", __dirname+"/field_name_same_as_package/main.proto", "--quiet"]); + fixture.release(); + } catch (e) { + fixture.release(); + fail(e); + } + test.done(); + }, + + "importRoot": function(test) { + try { + var builder = ProtoBuf.loadProtoFile({ + root: __dirname, + file: "importRoot/file1.proto" + }); + var Test = builder.build("Test"); + test.ok(new Test() instanceof ProtoBuf.Builder.Message); + } catch (e) { + fail(e); + } + test.done(); + }, + + "extend": function(test) { + try { + var ast = new ProtoBuf.DotProto.Parser(fs.readFileSync(__dirname+"/extend.proto")).parse(); + test.deepEqual(ast, { package: null, + messages: + [ { ref: 'google.protobuf.MessageOptions', + fields: + [ { rule: 'optional', + type: 'int32', + name: 'foo', + options: {}, + id: 1001 } ] }, + { name: 'Foo', + fields: [], + enums: [], + messages: [], + options: {}, + services: [], + oneofs: {}, + extensions: [ [ 2, 536870911 ] ] }, + { ref: 'Foo', + fields: + [ { rule: 'optional', + type: 'string', + name: 'bar', + options: {}, + id: 2 } ] }, + { name: 'Bar', + fields: [], + enums: [], + messages: + [ { name: 'Foo', + fields: [], + enums: [], + messages: [], + options: {}, + services: [], + oneofs: {} }, + { ref: '.Foo', + fields: [ { rule: 'optional', type: 'Foo', name: 'foo', options: {}, id: 3 } ] } ], + options: {}, + services: [], + oneofs: {} } ], + enums: [], + imports: [ 'google/protobuf/descriptor.proto' ], + options: {}, + services: [] } + ); + + var builder = ProtoBuf.loadProtoFile(__dirname+"/extend.proto"); + var TFoo = builder.lookup(".Foo"), + TBar = builder.lookup(".Bar"), + TBarFoo = builder.lookup(".Bar.Foo"), + fields = TFoo.getChildren(ProtoBuf.Reflect.Message.Field); + test.strictEqual(fields.length, 2); + test.strictEqual(fields[0].name, ".bar"); + test.strictEqual(fields[0].id, 2); + test.strictEqual(fields[1].name, ".Bar.foo"); + test.strictEqual(fields[1].id, 3); + test.deepEqual(TFoo.extensions, [[2, ProtoBuf.ID_MAX]]); // explicitly defined + test.strictEqual(TBar.extensions, undefined); // none defined + test.deepEqual(TBar.getChild("foo"), { builder: builder, parent: TBar, name: "foo", field: TFoo.getChild('.Bar.foo') }); + test.strictEqual(TBar.getChildren(ProtoBuf.Reflect.Message.Field).length, 0); + var root = builder.build(); + test.strictEqual(TFoo.getChild(".Bar.foo").resolvedType, TBarFoo); // .Bar.Foo, not .Foo + var foo = new root.Foo(), + bar = new root.Bar(); + foo['.bar'] = "123"; + foo['.Bar.foo'] = bar; + test.equal(foo.encode().compact().toString("debug"), "<12 03 31 32 33 1A 00>"); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Custom options on all levels + // victorr (https://github.com/victorr) + "customOptions": function(test) { + try { + var parser = new ProtoBuf.DotProto.Parser(ProtoBuf.Util.fetch(__dirname+"/custom-options.proto")); + var root = parser.parse(); + test.equal(root["options"]["(my_file_option)"], "Hello world!"); + test.equal(root["messages"][7]["options"]["(my_message_option)"], 1234); + test.equal(root["messages"][7]["fields"][0]["options"]["(my_field_option)"], 4.5); + // test.equal(root["services"]["MyService"]["options"]["my_service_option"], "FOO"); + // TODO: add tests for my_enum_option, my_enum_value_option + } catch (e) { + fail(e); + } + test.done(); + }, + + "oneofs": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/oneof.proto"), + MyOneOf = builder.build("MyOneOf"), + TOneOf = builder.lookup(".MyOneOf"); + test.ok(TOneOf.getChild("my_oneof")); + var myOneOf = new MyOneOf(); + test.strictEqual(myOneOf.my_oneof, null); + myOneOf.set("id", 1); + test.strictEqual(myOneOf.my_oneof, "id"); + myOneOf.set("name", "me"); + test.strictEqual(myOneOf.my_oneof, "name"); + test.strictEqual(myOneOf.id, null); + var bb = myOneOf.encode().compact(); + test.strictEqual(bb.toString("debug"), "<12 02 6D 65>"); // id 2, wt 2, len 2 + myOneOf = MyOneOf.decode(bb); + test.strictEqual(myOneOf.my_oneof, "name"); + test.strictEqual(myOneOf.name, "me"); + test.strictEqual(myOneOf.id, null); + } catch (e) { + fail(e); + } + test.done(); + }, + + "services": function(test) { + try { + var parser = new ProtoBuf.DotProto.Parser(ProtoBuf.Util.fetch(__dirname+"/custom-options.proto")); + var root = parser.parse(); + test.deepEqual(root["services"], [{ + "name": "MyService", + "rpc": { + "MyMethod": { + "request": "RequestType", + "response": "ResponseType", + "request_stream": false, + "response_stream": false, + "options": { + "(my_method_option).foo": 567, + "(my_method_option).bar": "Some string" + } + } + }, + "options": { + "(my_service_option)": "FOO" + } + }]); + + var builder = ProtoBuf.loadProtoFile(__dirname+"/custom-options.proto"); + var root = builder.build(), + MyService = root.MyService, + RequestType = root.RequestType, + ResponseType = root.ResponseType, + called = false; + + test.deepEqual(MyService.$options, { + "(my_service_option)": "FOO" + }); + test.deepEqual(MyService.MyMethod.$options, { + "(my_method_option).foo": 567, + "(my_method_option).bar": "Some string" + }); + + // Provide the service with your actual RPC implementation based on whatever framework you like most. + var myService = new MyService(function(method, req, callback) { + test.strictEqual(method, ".MyService.MyMethod"); + test.ok(req instanceof RequestType); + called = true; + + // In this case we just return no error and our pre-built response. This must be properly async! + setTimeout(callback.bind(this, null, (new ResponseType()).encode() /* as raw bytes for debugging */ )); + }); + + test.deepEqual(myService.$options, MyService.$options); + test.deepEqual(myService.MyMethod.$options, MyService.MyMethod.$options); + + // Call the service with your request message and provide a callback. This will call your actual service + // implementation to perform the request and gather a response before calling the callback. If the + // request or response type is invalid i.e. not an instance of RequestType or ResponseType, your + // implementation will not be called as ProtoBuf.js handles this case internally and directly hands the + // error to your callback below. + myService.MyMethod(new RequestType(), function(err, res) { + // We get: err = null, res = our prebuilt response. And that's it. + if (err !== null) { + fail(err); + } + test.strictEqual(called, true); + test.ok(res instanceof ResponseType); + test.done(); + }); + myService.MyMethod(new RequestType().encode(), function(err, res) { + // We get: err = null, res = our prebuilt response. And that's it. + if (err !== null) { + fail(err); + } + test.strictEqual(called, true); + test.ok(res instanceof ResponseType); + test.done(); + }); + } catch (e) { + fail(e); + } + }, + + // Properly ignore "syntax" and "extensions" keywords + // The corresponding .proto file has been removed upon request + /* "gtfs-realtime": function(test) { + try { + test.doesNotThrow(function() { + ProtoBuf.loadProtoFile(__dirname+"/gtfs-realtime.proto"); + }); + } catch (e) { + fail(e); + } + test.done(); + }, */ + + "delimited": function(test) { + try { + var builder = ProtoBuf.loadProto("message Position { required int32 x = 1; required int32 y = 2; }"); + var Position = builder.build("Position"); + var bb = new ByteBuffer(); + for (var i=0; i<2; i++) { + var position = new Position(10,10); + position.encodeDelimited(bb); + } + bb.flip(); + for (i=0; i<2; i++) { + position = Position.decodeDelimited(bb); + test.strictEqual(position.x, 10); + test.strictEqual(position.y, 10); + } + } catch (e) { + fail(e); + } + test.done(); + }, + + "stringify": function(test) { + try { + var builder = ProtoBuf.loadProto("message Position { required int32 x = 1; required int64 y = 2; }"); + var Position = builder.build("Position"); + var position = new Position(1, ProtoBuf.Long.fromNumber(2)); + var json = JSON.stringify(position); + test.strictEqual(json, '{"x":1,"y":{"low":2,"high":0,"unsigned":false}}'); + position = new Position(JSON.parse(json)); + test.strictEqual(position.x, 1); + test.ok(position.y instanceof ProtoBuf.Long); + test.deepEqual(position.y, {"low":2,"high":0,"unsigned":false}); + // Also test if this encodes and decodes properly + position = Position.decode(position.encode()); + test.ok(position.y instanceof ProtoBuf.Long); + test.deepEqual(position.y, {"low": 2, "high": 0, "unsigned": false }); + } catch (e) { + fail(e); + } + test.done(); + }, + + "fields": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/optional.proto"); + var Test1 = builder.build("Test1"); + var test1 = new Test1(); + test.strictEqual(test1.a, null); + test.deepEqual(Object.keys(test1), ['a','b']); + var bb = test1.encode(); + test1 = Test1.decode(bb); + test.strictEqual(test1.a, null); + test.deepEqual(Object.keys(test1), ['a','b']); + } catch (e) { + fail(e); + } + test.done(); + }, + + "fieldsToCamelCase": function(test) { + try { + ProtoBuf.convertFieldsToCamelCase = true; + var builder = ProtoBuf.loadProtoFile(__dirname+"/camelcase.proto"); + var Test = builder.build("Test"), + TTest = builder.lookup("Test"); + var msg = new Test(); + + // Reverted collision on 1st + test.strictEqual(msg.some_field, null); + test.strictEqual(msg.someField, null); + test.equal(TTest.getChild("some_field").id, 1); + test.equal(TTest.getChild("someField").id, 2); + + + // Reverted collision on 2nd + test.strictEqual(msg.aField, null); + test.strictEqual(msg.a_field, null); + test.equal(TTest.getChild("aField").id, 3); + test.equal(TTest.getChild("a_field").id, 4); + + // No collision + test.strictEqual(msg.itsAField, null); + test.equal(TTest.getChild("itsAField").id, 5); + + test.ok(typeof msg.set_its_a_field === "function"); + test.ok(typeof msg.setItsAField === "function"); + + ProtoBuf.convertFieldsToCamelCase = false; + } catch (e) { + ProtoBuf.convertFieldsToCamelCase = false; + fail(e); + } + test.done(); + }, + + "setarray": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/setarray.proto"); + var root = builder.build(), + Outer = root.Outer, + Inner = root.Inner, + inners = []; + + // Array of repeated messages + inners.push(new Inner("a"), new Inner("b"), new Inner("c")); + var outer = new Outer(); + outer.setInners(inners); + test.deepEqual(outer.inners, inners); + + // Array of repeated message objects + inners = []; + inners.push({ str: 'a' }, { str: 'b' }, { str: 'c' }); + outer.setInners(inners); // Converts + test.ok(outer.inners[0] instanceof Inner); + test.deepEqual(outer.inners, inners); + } catch (e) { + fail(e); + } + test.done(); + }, + + + // Make sure that our example at https://github.com/dcodeIO/ProtoBuf.js/wiki is not nonsense + "pingexample": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/PingExample.proto"); + var Message = builder.build("Message"); + var msg = new Message(); + msg.ping = new Message.Ping(123456789); + var bb = msg.encode(); + test.strictEqual(bb.limit, 7); + msg = Message.decode(bb); + test.ok(msg.ping); + test.notOk(msg.pong); + test.strictEqual(msg.ping.time, 123456789); + } catch (e) { + fail(e); + } + test.done(); + }, + + "negInt32": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test { required int32 value = 2; }"); + var Test = builder.build("Test"); + var t = new Test(-1); + var size = t.calculate(); + var bb = t.encode(); // flips + test.strictEqual(bb.remaining(), size); + test.strictEqual(bb.toBase64(), "EP///////////wE="); + t = Test.decode(bb); + test.strictEqual(t.value, -1); + } catch (e) { + fail(e); + } + test.done(); + }, + + "negEnumId": function(test) { + try { + test.doesNotThrow(function() { + var builder = ProtoBuf.loadProtoFile(__dirname+"/negid.proto"); + var Test = builder.build("Test"); + test.strictEqual(Test.LobbyType.INVALID, -1); + var t = new Test(Test.LobbyType.INVALID); + test.strictEqual(t.type, -1); + var size = t.calculate(); + var bb = t.encode(); // flips + test.strictEqual(bb.remaining(), size); + t = Test.decode(bb); + test.strictEqual(t.type, -1); + }); + } catch (e) { + fail(e); + } + test.done(); + }, + + "base64": function(test) { + try { + var Message = ProtoBuf.loadProto("message Message { required string s = 1; }").build("Message"); + var msg = new Message("ProtoBuf.js"); + var b64 = msg.toBase64(); + test.strictEqual(b64, "CgtQcm90b0J1Zi5qcw=="); + var msg2 = Message.decode64(b64); + test.deepEqual(msg, msg2); + msg2 = Message.decode(b64, "base64"); + test.deepEqual(msg, msg2); + } catch (e) { + fail(e); + } + test.done(); + }, + + "hex": function(test) { + try { + var Message = ProtoBuf.loadProto("message Message { required string s = 1; }").build("Message"); + var msg = new Message("ProtoBuf.js"); + var hex = msg.toHex(); + test.strictEqual(hex, "0a0b50726f746f4275662e6a73"); + var msg2 = Message.decodeHex(hex); + test.deepEqual(msg, msg2); + msg2 = Message.decode(hex, "hex"); + test.deepEqual(msg, msg2); + } catch (e) { + fail(e); + } + test.done(); + }, + + "forwardComp": function(test) { + try { + var Message = ProtoBuf.loadProto("message Message { required int32 a = 1; required string b = 2; required float c = 3; }").build("Message"); + var msg = new Message(123, "abc", 0.123); + var bb = msg.encode(); + Message = ProtoBuf.loadProto("message Message {}").build("Message"); + test.doesNotThrow(function() { + Message.decode(bb); + }); + test.strictEqual(bb.offset, bb.limit); + } catch (e) { + fail(e); + } + test.done(); + }, + + "tokenizerLine": function(test) { + try { + var parser = new ProtoBuf.DotProto.Parser("package test;\n\nmessage Message {\n\trequired string invalid = 1;}ERROR\n"), + ast = null, err = null; + try { + ast = parser.parse(); + } catch (caught) { + err = caught; + } + test.ok(err); + test.notOk(ast); + test.ok(err.message.indexOf("line 4:") >= 0); + } catch (e) { + fail(e); + } + test.done(); + }, + + "excludeFields": function(test) { + try { + var builder = ProtoBuf.loadProto("message A { required int32 i = 1; } message B { required A A = 1; }"); + builder.build(); + } catch (e) { + fail(e); + } + test.done(); + }, + + "proto2jsExtend": function(test) { + try { + var builder = ProtoBuf.loadJsonFile(__dirname+"/proto2js/Bar.json"); + builder.build(); + } catch (e) { + fail(e); + } + test.done(); + }, + + "emptyMessage": function(test) { + try { + var builder = ProtoBuf.loadProto("message EmptyMessage {}"), + EmptyMessage = builder.build("EmptyMessage"); + + var msg = new EmptyMessage(), + ab = msg.toArrayBuffer(); + test.strictEqual(ab.byteLength, 0); + } catch (e) { + fail(e); + } + test.done(); + }, + + "toRaw": function(test) { + try { + var builder = ProtoBuf.loadProto("message MyMessage { required int32 a = 1; required int32 b = 2; required bytes c = 3; }"), + MyMessage = builder.build("MyMessage"); + var raw = { a: 1, b: 2, c: "YWJj" }, + myMessage = new MyMessage(raw); + test.deepEqual(myMessage.c.toBase64(), raw.c); + test.deepEqual(myMessage.toRaw(true), raw); + } catch (e) { + fail(e); + } + test.done(); + }, + + "singleQuotedString": function(test) { + try{ + var builder = ProtoBuf.loadProtoFile(__dirname+"/string_single_quote.proto"); + var TestSingleQuoteString = builder.build("TestSingleQuoteString"); + test.ok(typeof TestSingleQuoteString == 'function'); + } catch (e) { + fail(e); + } + test.done(); + }, + + "importDuplicateSingleQuote": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/import_a_single_quote.proto"); + test.doesNotThrow(function() { + ProtoBuf.loadProtoFile(__dirname+"/import_b.proto", builder); + }); + var root = builder.build(); + test.ok(root.A); + test.ok(root.B); + test.ok(root.Common); + } catch (e) { + fail(e); + } + test.done(); + }, + + "importStringSuccessively": function(test) { + try { + var proto1 = "message A { required string a = 1; };"; + var proto2 = "import \"proto1.proto\"; message B { required A a = 1; };"; + var builder = ProtoBuf.loadProto(proto1, "proto1.proto"); + ProtoBuf.loadProto(proto2, builder, "proto2.proto"); + var root = builder.build(); + test.ok(root.A); + test.ok(root.B); + } catch (e) { + fail(e); + } + test.done(); + }, + + "multilineString": function(test) { + try { + var proto = "message TestMessage { required string test = 1 [default = \"1\" \"2\"\n\"3\"];}"; + var builder = ProtoBuf.loadProto(proto, "multilineString.proto"); + var TestMessage = builder.build("TestMessage"), + testMessage = new TestMessage(); + test.strictEqual(testMessage.test, "123"); + test.done(); + } catch (e) { + fail(e); + } + test.done(); + }, + + "packable": function(test) { + try { + var proto = 'message Inner { required int32 id=2; }\nmessage Outer { repeated Inner inner = 1 [packed=true]; }'; + var builder = ProtoBuf.loadProto(proto); + var root = builder.build(); + var inner = new root.Inner(1), + outer = new root.Outer(inner); + var bb = outer.encode().compact(); + test.strictEqual(bb.toDebug(), "<0A 02 10 01>"); + // 0A: wt 2, id 1 + // 02: len 2 + // 10: wt 0, id 2 + // 01: 1 + var outer2 = root.Outer.decode(bb); + test.strictEqual(outer2.inner.id, 1); + } catch (e) { + fail(e); + } + test.done(); + }, + + "$type": function(test) { + var builder = ProtoBuf.loadProto("message Test {}"); + var Test = builder.build("Test"), + TTest = builder.lookup("Test"); + test.strictEqual(new Test().$type, TTest); + test.done(); + }, + + "descriptor": function(test) { + try { + var proto = 'import "./google/protobuf/descriptor.proto";'; + var builder = ProtoBuf.loadProto(proto, "tests/proto.proto"); + var root = builder.build("google.protobuf"); + test.ok(root.FileDescriptorSet); + } catch (e) { + fail(e); + } + test.done(); + }, + + "mismatchedNesting": function(test) { + try { + var proto = "message Child { optional uint32 foo = 1; } message FakeChild { optional uint32 foo = 1; } message Parent { optional Child child = 1; }"; + var builder = ProtoBuf.loadProto(proto, "tests/mismatchedNesting.proto"); + var root = builder.build(); + var foo = new root.Parent({ child: new root.FakeChild({ foo: 1 })}); + } catch (e) { + fail(e); + } + test.done(); + }, + + /* "mismatchedType": function(test) { + try { + var proto = "message Test1 { optional string foo = 1; }"; + proto += "message Test2 { optional int32 foo = 1; }"; + var builder = ProtoBuf.loadProto(proto, "tests/mistmatchedType.proto"); + var root = builder.build(); + var test1 = new root.Test1({ foo: 'bar' }); + var test2 = root.Test2.decode(test1.encode()); + } catch (e) { + fail(e); + } + test.done(); + }, */ + + "builderOptions": function(test) { + try { + var proto = "message Foo { optional uint32 foo_bar = 1; }"; + var builder = ProtoBuf.newBuilder({ + convertFieldsToCamelCase: true + }); + ProtoBuf.loadProto(proto, builder, "tests/builderOptions.proto"); + var Foo = builder.build("Foo"); + test.strictEqual(ProtoBuf.convertFieldsToCamelCase, false); + test.strictEqual(builder.options.convertFieldsToCamelCase, true); + var foo = new Foo(); + test.ok(typeof foo.fooBar !== 'undefined'); + test.ok(typeof foo.foo_bar === 'undefined'); + test.done(); + } catch (e) { + fail(e); + } + test.done(); + }, + + "proto3": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/proto3.proto"); + test.doesNotThrow(function() { + ProtoBuf.loadProtoFile(__dirname+"/proto3.proto", builder); + }); + var root = builder.build(); + test.ok(root.test.Foo.$type.syntax === 'proto3'); + } catch (e) { + fail(e); + } + test.done(); + }, + + // FIXME: This test relied on some bloated builder functionality that has been removed. + // Is it even mandatory to strictly disallow proto2/3 mixing, even if that would be illegal in the official + // implementation? + /* "proto3DisallowedFeatures": function(test) { + try { + // Required field + var proto = "syntax = \"proto3\"; message Foo { required int32 field = 1; }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "tests/proto3DisallowedFeatures.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Not a valid definition/.test(e.message)); + } + + try { + // Field with default value + var proto = "syntax = \"proto3\"; message Foo { int32 field = 1 [default=42]; }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "tests/proto3DisallowedFeatures.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Not a valid definition/.test(e.message)); + } + + try { + // Message with extension range + var proto = "syntax = \"proto3\"; message Foo { extensions 100 to max; } "; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "tests/proto3DisallowedFeatures.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Not a valid definition/.test(e.message)); + } + + try { + // Message with extension + var proto = "syntax = \"proto3\"; message Foo { extensions 100 to max; } " + + "message Bar { extend Foo { optional Bar bar = 100; } }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "tests/proto3DisallowedFeatures.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Not a valid definition/.test(e.message)); + } + + try { + // Enum with non-zero first entry. + var proto = "syntax = \"proto3\"; enum E { A = 1; B = 2; }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "tests/proto3DisallowedFeatures.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Not a valid definition/.test(e.message)); + } + + try { + // Proto3 message referring to proto2 enum. + var proto2 = "syntax = \"proto2\"; enum E { A = 1; B = 2; }"; + var proto3 = "syntax = \"proto3\"; message Test { E enum_field = 1; }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto2, builder, "tests/proto3DisallowedFeatures1.proto"); + ProtoBuf.loadProto(proto3, builder, "tests/proto3DisallowedFeatures3.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Proto3 message refers to proto2 enum/.test(e.message)); + } + + test.done(); + }, */ + + "proto3FieldPresence": function(test) { + var proto = + "syntax = \"proto3\";\n" + + "message Test {\n" + + " int32 field_int32 = 1;\n" + + " int64 field_int64 = 2;\n" + + " string field_str = 3;\n" + + " bytes field_bytes = 4;\n" + + " Test field_msg = 5;\n" + + " Enum field_enum = 6;\n" + + " repeated int32 rpt_int32 = 11;\n" + + " repeated int64 rpt_int64 = 12;\n" + + " repeated string rpt_str = 13;\n" + + " repeated bytes rpt_bytes = 14;\n" + + " repeated Test rpt_msg = 15;\n" + + " repeated Enum rpt_enum = 16;\n" + + " oneof oneof_type { bool oneof_bool = 17; };\n" + + "}\n" + + "enum Enum { Default = 0; A = 1; B = 2; }\n"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "test/proto3FieldPresence.proto"); + var Test = builder.build('Test'), + Enum = builder.build('Enum'); + + var testMsg = new Test(); + test.strictEqual(testMsg.field_int32, 0); + test.strictEqual(testMsg.field_int64.low, 0); + test.strictEqual(testMsg.field_int64.high, 0); + test.strictEqual(testMsg.field_str, ""); + test.strictEqual(testMsg.field_msg, null); + test.ok(testMsg.field_bytes instanceof ByteBuffer); + test.strictEqual(testMsg.field_bytes.remaining(), 0); + test.strictEqual(testMsg.rpt_int32.length, 0); + test.strictEqual(testMsg.oneof_type, null); + test.strictEqual(testMsg.oneof_bool, false); + + // No fields should go on the wire, even though they're set + var encoded = testMsg.encode(); + test.strictEqual(encoded.remaining(), 0); + testMsg.field_int32 = 42; + encoded = testMsg.encode(); + test.strictEqual(encoded.remaining(), 2); + testMsg.field_int32 = 0; + encoded = testMsg.encode(); + test.strictEqual(encoded.remaining(), 0); + + // Enum fields should be able to carry arbitrary values. + testMsg.field_enum = 42; + test.strictEqual(testMsg.field_enum, 42); + encoded = testMsg.encode(); + testMsg = Test.decode(encoded); + test.strictEqual(testMsg.field_enum, 42); + + // Explicitly set fields that are part of an oneof should + // be encoded even if set to their default value + testMsg = new Test(); + testMsg.set("oneof_bool", false); + test.strictEqual(testMsg.oneof_type, "oneof_bool"); + encoded = testMsg.encode().compact(); + test.strictEqual(encoded.toString("debug"), "<88 01 00>"); // 17|varint (0term) + varint 0 + var decoded = Test.decode(encoded); + test.strictEqual(decoded.oneof_type, "oneof_bool"); + test.strictEqual(decoded.oneof_bool, false); + + test.done(); + }, + + "mapContainer": function(test) { + var proto = + "message Test {\n" + + " map map_string_int32 = 1;\n" + + " map map_string_int64 = 2;\n" + + " map map_string_string = 3;\n" + + " map map_string_msg = 4;\n" + + " map map_string_enum = 5;\n" + + " map map_int32_string = 6;\n" + + " map map_int64_string = 7;\n" + + " map map_bool_string = 9;\n" + + "}\n" + + "enum Enum { Default = 0; A = 1; B = 2; }\n"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "test/mapContainer.proto"); + + var map_string_int32 = + new ProtoBuf.Map(builder.lookup("Test.map_string_int32")); + test.strictEqual(map_string_int32.size, 0); + test.strictEqual(map_string_int32.has("asdf"), false); + test.strictEqual(map_string_int32.get("asdf"), undefined); + map_string_int32.set("asdf", 42); + test.strictEqual(map_string_int32.has("asdf"), true); + test.strictEqual(map_string_int32.get("asdf"), 42); + + var it = map_string_int32.keys(); + var itVal = it.next(); + test.strictEqual(itVal.done, false); + test.strictEqual(itVal.value, "asdf"); + itVal = it.next(); + test.strictEqual(itVal.done, true); + + it = map_string_int32.values(); + itVal = it.next(); + test.strictEqual(itVal.done, false); + test.strictEqual(itVal.value, 42); + itVal = it.next(); + test.strictEqual(itVal.done, true); + + it = map_string_int32.entries(); + itVal = it.next(); + test.strictEqual(itVal.done, false); + test.deepEqual(itVal.value, ["asdf", 42]); + itVal = it.next(); + test.strictEqual(itVal.done, true); + + map_string_int32.set("jkl;", 84); + test.strictEqual(map_string_int32.has("jkl;"), true); + test.strictEqual(map_string_int32.has("asdf"), true); + test.strictEqual(map_string_int32.size, 2); + map_string_int32.delete("jkl;"); + test.strictEqual(map_string_int32.has("jkl;"), false); + test.strictEqual(map_string_int32.get("jkl;"), undefined); + test.strictEqual(map_string_int32.size, 1); + + map_string_int32.clear(); + test.strictEqual(map_string_int32.size, 0); + + try { + map_string_int32.set("asdf", 42.1); + test.ok(false); // ^ should throw + } catch(e) { + test.ok(e.message.match(/not an integer/)); + } + + try { + map_string_int32.set(42, 42); + test.ok(false); // ^ should throw + } catch(e) { + test.ok(e.message.match(/not a string/)); + } + + // Test various key types to ensure that value->string->value + // conversion works. + var map_int32_string = + new ProtoBuf.Map(builder.lookup("Test.map_int32_string")); + test.strictEqual(map_int32_string.size, 0); + map_int32_string.set(12345678, "asdf"); + test.strictEqual(map_int32_string.size, 1); + test.strictEqual(map_int32_string.has(12345678), true); + test.strictEqual(map_int32_string.get(12345678), "asdf"); + + var map_int64_string = + new ProtoBuf.Map(builder.lookup("Test.map_int64_string")); + test.strictEqual(map_int64_string.size, 0); + map_int64_string.set("9223372036854775807", "asdf"); + test.strictEqual(map_int64_string.size, 1); + test.strictEqual(map_int64_string.has("9223372036854775807"), true); + test.strictEqual(map_int64_string.get("9223372036854775807"), "asdf"); + + // Ensure that initialization from a raw object works. + var map_int32_string = + new ProtoBuf.Map(builder.lookup("Test.map_int32_string"), + { 42: "asdf" }); + test.strictEqual(map_int32_string.size, 1); + test.strictEqual(map_int32_string.keys().next().value, 42); + + var map_int64_string = + new ProtoBuf.Map(builder.lookup("Test.map_int64_string"), + { "9223372036854775807": "asdf" }); + test.strictEqual(map_int64_string.size, 1); + var i64 = map_int64_string.keys().next().value; + test.ok(i64 instanceof ProtoBuf.Long); + test.strictEqual(i64.toString(), "9223372036854775807"); + + test.done(); + }, + + "mapField": function(test) { + var proto = + "message Test {\n" + + " map map_string_int32 = 1;\n" + + " map map_string_int64 = 2;\n" + + " map map_string_string = 3;\n" + + " map map_string_msg = 4;\n" + + " map map_string_enum = 5;\n" + + " map map_int32_string = 6;\n" + + " map map_int64_string = 7;\n" + + " map map_bool_string = 9;\n" + + "}\n" + + "enum Enum { Default = 0; A = 1; B = 2; }\n"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "test/mapField.proto"); + var Test = builder.build('Test'), + Enum = builder.build('Enum'); + + var testMsg = new Test(); + test.strictEqual(testMsg.map_string_int32.size, 0); + test.strictEqual(testMsg.map_string_int64.size, 0); + test.strictEqual(testMsg.map_string_string.size, 0); + test.strictEqual(testMsg.map_string_msg.size, 0); + test.strictEqual(testMsg.map_string_enum.size, 0); + test.strictEqual(testMsg.map_int32_string.size, 0); + test.strictEqual(testMsg.map_int64_string.size, 0); + test.strictEqual(testMsg.map_bool_string.size, 0); + + testMsg.$set('map_string_int32', { 'asdf': 42 }); + + try { + testMsg.$set('map_string_int32', { 'asdf': 42.1 }); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(e.message.match(/Illegal/)); + } + + test.done(); + }, + + "mapEncodeDecode": function(test) { + var proto = + "message Test {\n" + + " map map_string_int32 = 1;\n" + + " map map_string_int64 = 2;\n" + + " map map_string_string = 3;\n" + + " map map_string_msg = 4;\n" + + " map map_string_enum = 5;\n" + + " map map_int32_string = 6;\n" + + " map map_int64_string = 7;\n" + + " map map_bool_string = 9;\n" + + "}\n" + + "enum Enum { Default = 0; A = 1; B = 2; }\n"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "test/mapField.proto"); + var Test = builder.build('Test'), + Enum = builder.build('Enum'); + + var testMsg = new Test(); + testMsg.map_string_int32.set("a", 1); + testMsg.map_string_int32.set("b", 2); + testMsg.map_string_int64.set("c", "12345678901234"); + testMsg.map_string_int64.set("d", "98765432109876"); + testMsg.map_string_string.set("e", "asdf"); + testMsg.map_string_string.set("f", "jkl;"); + testMsg.map_string_enum.set("g", Enum.A); + testMsg.map_string_enum.set("h", Enum.B); + testMsg.map_int32_string.set(9, "a"); + testMsg.map_int32_string.set(10, "b"); + testMsg.map_int64_string.set("12345678901234", "a"); + testMsg.map_int64_string.set("98765432109876", "b"); + testMsg.map_bool_string.set(false, "a"); + testMsg.map_bool_string.set(true, "b"); + + var encoded = testMsg.encode(); + testMsg = Test.decode(encoded); + + test.strictEqual(testMsg.map_string_int32.get("a"), 1); + test.strictEqual(testMsg.map_string_int32.get("b"), 2); + test.strictEqual(testMsg.map_string_int64.get("c").toString(), "12345678901234"); + test.strictEqual(testMsg.map_string_int64.get("d").toString(), "98765432109876"); + test.strictEqual(testMsg.map_string_string.get("e"), "asdf"); + test.strictEqual(testMsg.map_string_string.get("f"), "jkl;"); + test.strictEqual(testMsg.map_string_enum.get("g"), Enum.A); + test.strictEqual(testMsg.map_string_enum.get("h"), Enum.B); + test.strictEqual(testMsg.map_int32_string.get(9), "a"); + test.strictEqual(testMsg.map_int32_string.get(10), "b"); + test.strictEqual(testMsg.map_int64_string.get("12345678901234"), "a"); + test.strictEqual(testMsg.map_int64_string.get("98765432109876"), "b"); + test.strictEqual(testMsg.map_bool_string.get(false), "a"); + test.strictEqual(testMsg.map_bool_string.get(true), "b"); + + test.done(); + }, + + "proto3Json": function(test) { + var proto = + "syntax = \"proto3\";\n" + + "message Test {\n" + + " int32 optional_int32 = 1;\n" + + " int64 optional_int64 = 2;\n" + + " string optional_string = 3;\n" + + " bytes optional_bytes = 4;\n" + + " bool optional_bool = 5;\n" + + " Enum optional_enum = 6;\n" + + " repeated int32 repeated_int32 = 11;\n" + + " repeated int64 repeated_int64 = 12;\n" + + " repeated string repeated_string = 13;\n" + + " repeated bytes repeated_bytes = 14;\n" + + " repeated bool repeated_bool = 15;\n" + + " repeated Enum repeated_enum = 16;\n" + + " map map_string_int32 = 20;\n" + + " map map_string_int64 = 21;\n" + + " map map_string_string = 22;\n" + + " map map_string_enum = 24;\n" + + " map map_int32_string = 25;\n" + + " map map_int64_string = 26;\n" + + " map map_bool_string = 27;\n" + + "}\n" + + "enum Enum { Default = 0; A = 1; B = 2; }\n"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "test/mapField.proto"); + var Test = builder.build('Test'), + Enum = builder.build('Enum'); + + var testMsg = new Test(); + testMsg.optional_int32 = 1; + testMsg.optional_int64 = "12345678901234"; + testMsg.optional_string = "hello"; + testMsg.optional_bytes = ProtoBuf.ByteBuffer.fromBinary("\x00\xFF\x80"); + testMsg.optional_bool = true; + testMsg.optional_enum = Enum.A; + testMsg.repeated_int32.push(1); + testMsg.repeated_int64.push("12345678901234"); + testMsg.repeated_string.push("hello"); + testMsg.repeated_bytes.push(ProtoBuf.ByteBuffer.fromBinary("\x00\xFF\x80")); + testMsg.repeated_bool.push(true); + testMsg.repeated_enum.push(Enum.A); + testMsg.map_string_int32.set("a", 1); + testMsg.map_string_int32.set("b", 2); + testMsg.map_string_int64.set("c", "12345678901234"); + testMsg.map_string_int64.set("d", "98765432109876"); + testMsg.map_string_string.set("e", "asdf"); + testMsg.map_string_string.set("f", "jkl;"); + testMsg.map_string_enum.set("g", Enum.A); + testMsg.map_string_enum.set("h", Enum.B); + testMsg.map_int32_string.set(9, "a"); + testMsg.map_int32_string.set(10, "b"); + testMsg.map_int64_string.set("12345678901234", "a"); + testMsg.map_int64_string.set("98765432109876", "b"); + testMsg.map_bool_string.set(false, "a"); + testMsg.map_bool_string.set(true, "b"); + + var jsonObj = JSON.parse(testMsg.encodeJSON()); + test.deepEqual(jsonObj, + { + optional_int32: 1, + optional_int64: "12345678901234", + optional_string: "hello", + optional_bytes: "AP+A", // base64 + optional_bool: true, + optional_enum: "A", + repeated_int32: [1], + repeated_int64: ["12345678901234"], + repeated_string: ["hello"], + repeated_bytes: ["AP+A"], // base64 + repeated_bool: [true], + repeated_enum: ["A"], + map_string_int32: { "a": 1, "b": 2 }, + map_string_int64: { "c": "12345678901234", "d": "98765432109876" }, + map_string_string: { "e": "asdf", "f": "jkl;" }, + map_string_enum: { "g": "A", "h": "B" }, + map_int32_string: { "9": "a", "10": "b" }, + map_int64_string: { "12345678901234": "a", "98765432109876": "b" }, + map_bool_string: { "false": "a", "true": "b" }, + }); + + var testMsg2 = Test.decodeJSON(testMsg.encodeJSON()); + test.strictEqual(testMsg2.encodeJSON(), testMsg.encodeJSON()); + + test.done(); + }, + + // Node.js only + "loaders": BROWSER ? {} : { + + "commonjs": function(test) { + var fs = require("fs") + , vm = require("vm") + , util = require('util'); + + var code = fs.readFileSync(__dirname+"/../dist/"+FILE); + var exports = {}; + var sandbox = new Sandbox({ + module: { + exports: exports, + id: "protobufjs" + }, + exports: exports, + require: (function() { + function require(mod) { + if (mod == 'bytebuffer') require.called = true; + return ByteBuffer; + } + require.called = false; + return require; + })() + }); + vm.runInNewContext(code, sandbox, "ProtoBuf.js in CommonJS-VM"); + // console.log(util.inspect(sandbox)); + test.ok(typeof sandbox.module.exports == 'object'); + test.ok(typeof sandbox.require != 'undefined' && sandbox.require.called); + test.done(); + }, + + "amd": function(test) { + var fs = require("fs") + , vm = require("vm") + , util = require('util'); + + var code = fs.readFileSync(__dirname+"/../dist/"+FILE); + var sandbox = new Sandbox({ + define: (function() { + function define() { + define.called = true; + } + define.amd = true; + define.called = false; + return define; + })() + }); + vm.runInNewContext(code, sandbox, "ProtoBuf.js in AMD-VM"); + // console.log(util.inspect(sandbox)); + test.ok(sandbox.define.called == true); + test.done(); + }, + + "shim": function(test) { + var fs = require("fs") + , vm = require("vm") + , util = require('util'); + + var code = fs.readFileSync(__dirname+"/../dist/"+FILE); + var sandbox = new Sandbox({ + dcodeIO: { + ByteBuffer: ByteBuffer + } + }); + vm.runInNewContext(code, sandbox, "ProtoBuf.js in shim-VM"); + // console.log(util.inspect(sandbox)); + test.ok(typeof sandbox.dcodeIO != 'undefined' && typeof sandbox.dcodeIO.ProtoBuf != 'undefined'); + test.done(); + } + } + }; + + if (typeof module != 'undefined' && module.exports) { + module.exports = suite; + } else { + global["suite"] = suite; + } + +})(this); diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/toplevel.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/toplevel.proto new file mode 100644 index 0000000..eec948e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/toplevel.proto @@ -0,0 +1,10 @@ +package My; + +enum MyEnum { + ONE = 1; + TWO = 2; +} + +message Test { + required MyEnum num = 1 [default=ONE]; +} diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/x64.proto b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/x64.proto new file mode 100644 index 0000000..18ea2d3 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/protobufjs/tests/x64.proto @@ -0,0 +1,10 @@ +message Test { + required sfixed64 val = 1 [default=-1]; + required fixed64 uval = 2 [default=1]; +} + +message Test2 { + required int64 val = 1 [default=-1]; + required uint64 uval = 2 [default=1]; + required sint64 sval = 3 [default=-2]; +} diff --git a/legacy-libs/grpc-cloned/node_modules/window-size/LICENSE b/legacy-libs/grpc-cloned/node_modules/window-size/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/window-size/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, Jon Schlinkert. + +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/legacy-libs/grpc-cloned/node_modules/window-size/README.md b/legacy-libs/grpc-cloned/node_modules/window-size/README.md new file mode 100644 index 0000000..0985bd6 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/window-size/README.md @@ -0,0 +1,45 @@ +# window-size [![NPM version](https://badge.fury.io/js/window-size.svg)](http://badge.fury.io/js/window-size) [![Build Status](https://travis-ci.org/jonschlinkert/window-size.svg)](https://travis-ci.org/jonschlinkert/window-size) + +> Reliable way to to get the height and width of the terminal/console in a node.js environment. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i window-size --save +``` + +## Usage + +```js +var size = require('window-size'); +size.height; // "25" (rows) +size.width; // "80" (columns) +``` + +## Other projects + +* [base-cli](https://www.npmjs.com/package/base-cli): Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… [more](https://www.npmjs.com/package/base-cli) | [homepage](https://github.com/jonschlinkert/base-cli) +* [lint-deps](https://www.npmjs.com/package/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://www.npmjs.com/package/lint-deps) | [homepage](https://github.com/jonschlinkert/lint-deps) +* [yargs](https://www.npmjs.com/package/yargs): Light-weight option parsing with an argv hash. No optstrings attached. | [homepage](https://github.com/bcoe/yargs#readme) + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/window-size/issues/new). + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 15, 2015._ \ No newline at end of file diff --git a/legacy-libs/grpc-cloned/node_modules/window-size/cli.js b/legacy-libs/grpc-cloned/node_modules/window-size/cli.js new file mode 100644 index 0000000..dd8d0e5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/window-size/cli.js @@ -0,0 +1,30 @@ +#!/usr/bin/env node +'use strict'; +var helpText = ['Usage', +' $ window-size', +'', +'Example', +' $ window-size', +' height: 40 ', +' width : 145', +''].join('\n'); + +function showSize () { + var size = require('./'); + console.log('height: ' + size.height); + console.log('width : ' + size.width); +} + +if (process.argv.length > 2) { + switch (process.argv[2]) { + case 'help': + case '--help': + case '-h': + console.log(helpText); + break; + default: + showSize(); + } +} else { + showSize(); +} diff --git a/legacy-libs/grpc-cloned/node_modules/window-size/index.js b/legacy-libs/grpc-cloned/node_modules/window-size/index.js new file mode 100644 index 0000000..eba89c9 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/window-size/index.js @@ -0,0 +1,32 @@ +'use strict'; + +/*! + * window-size + * + * Copyright (c) 2014-2015 Jon Schlinkert + * Licensed under the MIT license. + */ + +var tty = require('tty'); + +module.exports = (function () { + var width; + var height; + + if (tty.isatty(1) && tty.isatty(2)) { + if (process.stdout.getWindowSize) { + width = process.stdout.getWindowSize(1)[0]; + height = process.stdout.getWindowSize(1)[1]; + } else if (tty.getWindowSize) { + width = tty.getWindowSize()[1]; + height = tty.getWindowSize()[0]; + } else if (process.stdout.columns && process.stdout.rows) { + height = process.stdout.columns; + width = process.stdout.rows; + } + } else { + Error('window-size could not get size with tty or process.stdout.'); + } + + return {height: height, width: width}; +})(); diff --git a/legacy-libs/grpc-cloned/node_modules/window-size/package.json b/legacy-libs/grpc-cloned/node_modules/window-size/package.json new file mode 100644 index 0000000..adf5ee8 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/window-size/package.json @@ -0,0 +1,117 @@ +{ + "_args": [ + [ + { + "raw": "window-size@^0.1.4", + "scope": null, + "escapedName": "window-size", + "name": "window-size", + "rawSpec": "^0.1.4", + "spec": ">=0.1.4 <0.2.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/grpc/node_modules/yargs" + ] + ], + "_from": "window-size@>=0.1.4 <0.2.0", + "_id": "window-size@0.1.4", + "_inCache": true, + "_location": "/grpc/window-size", + "_nodeVersion": "5.0.0", + "_npmUser": { + "name": "jonschlinkert", + "email": "github@sellside.com" + }, + "_npmVersion": "3.3.6", + "_phantomChildren": {}, + "_requested": { + "raw": "window-size@^0.1.4", + "scope": null, + "escapedName": "window-size", + "name": "window-size", + "rawSpec": "^0.1.4", + "spec": ">=0.1.4 <0.2.0", + "type": "range" + }, + "_requiredBy": [ + "/grpc/yargs" + ], + "_resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", + "_shasum": "f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876", + "_shrinkwrap": null, + "_spec": "window-size@^0.1.4", + "_where": "/var/opt/motion2/node_modules/grpc/node_modules/yargs", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bin": { + "window-size": "cli.js" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/window-size/issues" + }, + "dependencies": {}, + "description": "Reliable way to to get the height and width of the terminal/console in a node.js environment.", + "devDependencies": { + "semistandard": "^7.0.2", + "tap": "^2.2.1" + }, + "directories": {}, + "dist": { + "shasum": "f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876", + "tarball": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz" + }, + "engines": { + "node": ">= 0.10.0" + }, + "files": [ + "index.js", + "cli.js" + ], + "gitHead": "619d0da99254adc5c6059c84e3ec2b24564add46", + "homepage": "https://github.com/jonschlinkert/window-size", + "keywords": [ + "console", + "height", + "resize", + "size", + "terminal", + "tty", + "width", + "window" + ], + "license": "MIT", + "main": "index.js", + "maintainers": [ + { + "name": "jonschlinkert", + "email": "github@sellside.com" + }, + { + "name": "doowb", + "email": "brian.woodward@gmail.com" + } + ], + "name": "window-size", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/window-size.git" + }, + "scripts": { + "pretest": "semistandard", + "test": "tap --coverage test.js" + }, + "verb": { + "related": { + "list": [ + "yargs", + "lint-deps", + "base-cli" + ] + } + }, + "version": "0.1.4" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/CHANGELOG.md b/legacy-libs/grpc-cloned/node_modules/yargs/CHANGELOG.md new file mode 100644 index 0000000..6c0cb51 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/CHANGELOG.md @@ -0,0 +1,508 @@ +## Change Log + +### v3.32.0 (2016/1/14 10:13 +07:00) + +- [#344](https://github.com/bcoe/yargs/pull/344) yargs now has a code of conduct and contributor guidelines (@bcoe) +- [#341](https://github.com/bcoe/yargs/issues/341) Fix edge-case with camel-case arguments (@davibe) +- [#331](https://github.com/bcoe/yargs/pull/331) Handle parsing a raw argument string (@kellyselden) +- [#325](https://github.com/bcoe/yargs/pull/325) Tweaks to make tests pass again on Windows (@isaacs) +- [#321](https://github.com/bcoe/yargs/pull/321) Custom config parsing function (@bcoe) + +### v3.31.0 (2015/12/03 10:15 +07:00) + +- [#239](https://github.com/bcoe/yargs/pull/239) Pass argv to commands (@bcoe) +- [#308](https://github.com/bcoe/yargs/pull/308) Yargs now handles environment variables (@nexdrew) +- [#302](https://github.com/bcoe/yargs/pull/302) Add Indonesian translation (@rilut) +- [#300](https://github.com/bcoe/yargs/pull/300) Add Turkish translation (@feyzo) +- [#298](https://github.com/bcoe/yargs/pull/298) Add Norwegian Bokmål translation (@sindresorhus) +- [#297](https://github.com/bcoe/yargs/pull/297) Fix for layout of cjk characters (@disjukr) +- [#296](https://github.com/bcoe/yargs/pull/296) Add Korean translation (@disjukr) + +### v3.30.0 (2015/11/13 16:29 +07:00) + +- [#293](https://github.com/bcoe/yargs/pull/293) Polish language support (@kamilogorek) +- [#291](https://github.com/bcoe/yargs/pull/291) fix edge-cases with `.alias()` (@bcoe) +- [#289](https://github.com/bcoe/yargs/pull/289) group options in custom groups (@bcoe) + +### v3.29.0 (2015/10/16 21:51 +07:00) + +- [#282](https://github.com/bcoe/yargs/pull/282) completions now accept promises (@LinusU) +- [#281](https://github.com/bcoe/yargs/pull/281) fix parsing issues with dot notation (@bcoe) + +### v3.28.0 (2015/10/16 1:55 +07:00) + +- [#277](https://github.com/bcoe/yargs/pull/277) adds support for ansi escape codes (@bcoe) + +### v3.27.0 (2015/10/08 1:55 +00:00) + +- [#271](https://github.com/bcoe/yargs/pull/273) skips validation for help or version flags with exitProcess(false) (@tepez) +- [#273](https://github.com/bcoe/yargs/pull/273) implements single output for errors with exitProcess(false) (@nexdrew) +- [#269](https://github.com/bcoe/yargs/pull/269) verifies single output for errors with exitProcess(false) (@tepez) +- [#268](https://github.com/bcoe/yargs/pull/268) adds Chinese translation (@qiu8310) +- [#266](https://github.com/bcoe/yargs/pull/266) adds case for -- after -- in parser test (@geophree) + +### v3.26.0 (2015/09/25 2:14 +00:00) + +- [#263](https://github.com/bcoe/yargs/pull/263) document count() and option() object keys (@nexdrew) +- [#259](https://github.com/bcoe/yargs/pull/259) remove util in readme (@38elements) +- [#258](https://github.com/bcoe/yargs/pull/258) node v4 builds, update deps (@nexdrew) +- [#257](https://github.com/bcoe/yargs/pull/257) fix spelling errors (@dkoleary88) + +### v3.25.0 (2015/09/13 7:38 -07:00) + +- [#254](https://github.com/bcoe/yargs/pull/254) adds Japanese translation (@oti) +- [#253](https://github.com/bcoe/yargs/pull/253) fixes for tests on Windows (@bcoe) + +### v3.24.0 (2015/09/04 12:02 +00:00) + +- [#248](https://github.com/bcoe/yargs/pull/248) reinstate os-locale, no spawning (@nexdrew) +- [#249](https://github.com/bcoe/yargs/pull/249) use travis container-based infrastructure (@nexdrew) +- [#247](https://github.com/bcoe/yargs/pull/247) upgrade standard (@nexdrew) + +### v3.23.0 (2015/08/30 23:00 +00:00) + +- [#246](https://github.com/bcoe/yargs/pull/246) detect locale based only on environment variables (@bcoe) +- [#244](https://github.com/bcoe/yargs/pull/244) adds Windows CI testing (@bcoe) +- [#245](https://github.com/bcoe/yargs/pull/245) adds OSX CI testing (@bcoe, @nexdrew) + +### v3.22.0 (2015/08/28 22:26 +00:00) +- [#242](https://github.com/bcoe/yargs/pull/242) adds detectLocale config option (@bcoe) + +### v3.21.1 (2015/08/28 20:58 +00:00) +- [#240](https://github.com/bcoe/yargs/pull/240) hot-fix for Atom on Windows (@bcoe) + +### v3.21.0 (2015/08/21 21:20 +00:00) +- [#238](https://github.com/bcoe/yargs/pull/238) upgrade camelcase, window-size, chai, mocha (@nexdrew) +- [#237](https://github.com/bcoe/yargs/pull/237) adds defaultDescription to option() (@nexdrew) + +### v3.20.0 (2015/08/20 01:29 +00:00) +- [#231](https://github.com/bcoe/yargs/pull/231) Merge pull request #231 from bcoe/detect-locale (@sindresorhus) +- [#235](https://github.com/bcoe/yargs/pull/235) adds german translation to yargs (@maxrimue) + +### v3.19.0 (2015/08/14 05:12 +00:00) +- [#224](https://github.com/bcoe/yargs/pull/224) added Portuguese translation (@codemonkey3045) + +### v3.18.1 (2015/08/12 05:53 +00:00) + +- [#228](https://github.com/bcoe/yargs/pull/228) notes about embedding yargs in Electron (@etiktin) +- [#223](https://github.com/bcoe/yargs/pull/223) make booleans work in config files (@sgentle) + +### v3.18.0 (2015/08/06 20:05 +00:00) +- [#222](https://github.com/bcoe/yargs/pull/222) updates fr locale (@nexdrew) +- [#221](https://github.com/bcoe/yargs/pull/221) adds missing locale strings (@nexdrew) +- [#220](https://github.com/bcoe/yargs/pull/220) adds es locale (@zkat) + +### v3.17.1 (2015/08/02 19:35 +00:00) +- [#218](https://github.com/bcoe/yargs/pull/218) upgrades nyc (@bcoe) + +### v3.17.0 (2015/08/02 18:39 +00:00) +- [#217](https://github.com/bcoe/yargs/pull/217) sort methods in README.md (@nexdrew) +- [#215](https://github.com/bcoe/yargs/pull/215) adds fr locale (@LoicMahieu) + +### v3.16.0 (2015/07/30 04:35 +00:00) +- [#210](https://github.com/bcoe/yargs/pull/210) adds i18n support to yargs (@bcoe) +- [#209](https://github.com/bcoe/yargs/pull/209) adds choices type to yargs (@nexdrew) +- [#207](https://github.com/bcoe/yargs/pull/207) pretty new shields from shields.io (@SimenB) +- [#208](https://github.com/bcoe/yargs/pull/208) improvements to README.md (@nexdrew) +- [#205](https://github.com/bcoe/yargs/pull/205) faster build times on Travis (@ChristianMurphy) + +### v3.15.0 (2015/07/06 06:01 +00:00) +- [#197](https://github.com/bcoe/yargs/pull/197) tweaks to how errors bubble up from parser.js (@bcoe) +- [#193](https://github.com/bcoe/yargs/pull/193) upgraded nyc, reporting now happens by default (@bcoe) + +### v3.14.0 (2015/06/28 02:12 +00:00) + +- [#192](https://github.com/bcoe/yargs/pull/192) standard style nits (@bcoe) +- [#190](https://github.com/bcoe/yargs/pull/190) allow for hidden commands, e.g., + .completion('completion', false) (@tschaub) + +### v3.13.0 (2015/06/24 04:12 +00:00) + +- [#187](https://github.com/bcoe/yargs/pull/187) completion now behaves differently + if it is being run in the context of a command (@tschaub) +- [#186](https://github.com/bcoe/yargs/pull/186) if no matches are found for a completion + default to filename completion (@tschaub) + +### v3.12.0 (2015/06/19 03:23 +00:00) +- [#183](https://github.com/bcoe/yargs/pull/183) don't complete commands if they've already been completed (@tschaub) +- [#181](https://github.com/bcoe/yargs/pull/181) various fixes for completion. (@bcoe, @tschaub) +- [#182](https://github.com/bcoe/yargs/pull/182) you can now set a maximum # of of required arguments (@bcoe) + +### v3.11.0 (2015/06/15 05:15 +00:00) + +- [#173](https://github.com/bcoe/yargs/pull/173) update standard, window-size, chai (@bcoe) +- [#171](https://github.com/bcoe/yargs/pull/171) a description can now be set + when providing a config option. (@5c077yP) + +### v3.10.0 (2015/05/29 04:25 +00:00) + +- [#165](https://github.com/bcoe/yargs/pull/165) expose yargs.terminalWidth() thanks @ensonic (@bcoe) +- [#164](https://github.com/bcoe/yargs/pull/164) better array handling thanks @getify (@bcoe) + +### v3.9.1 (2015/05/20 05:14 +00:00) +- [b6662b6](https://github.com/bcoe/yargs/commit/b6662b6774cfeab4876f41ec5e2f67b7698f4e2f) clarify .config() docs (@linclark) +- [0291360](https://github.com/bcoe/yargs/commit/02913606285ce31ce81d7f12c48d8a3029776ec7) fixed tests, switched to nyc for coverage, fixed security issue, added Lin as collaborator (@bcoe) + +### v3.9.0 (2015/05/10 18:32 +00:00) +- [#157](https://github.com/bcoe/yargs/pull/157) Merge pull request #157 from bcoe/command-yargs. allows handling of command specific arguments. Thanks for the suggestion @ohjames (@bcoe) +- [#158](https://github.com/bcoe/yargs/pull/158) Merge pull request #158 from kemitchell/spdx-license. Update license format (@kemitchell) + +### v3.8.0 (2015/04/24 23:10 +00:00) +- [#154](https://github.com/bcoe/yargs/pull/154) showHelp's method signature was misleading fixes #153 (@bcoe) +- [#151](https://github.com/bcoe/yargs/pull/151) refactor yargs' table layout logic to use new helper library (@bcoe) +- [#150](https://github.com/bcoe/yargs/pull/150) Fix README example in argument requirements (@annonymouse) + +### v3.7.2 (2015/04/13 11:52 -07:00) + +* [679fbbf](https://github.com/bcoe/yargs/commit/679fbbf55904030ccee8a2635e8e5f46551ab2f0) updated yargs to use the [standard](https://github.com/feross/standard) style guide (agokjr) +* [22382ee](https://github.com/bcoe/yargs/commit/22382ee9f5b495bc2586c1758cd1091cec3647f9 various bug fixes for $0 (@nylen) + +### v3.7.1 (2015/04/10 11:06 -07:00) + +* [89e1992](https://github.com/bcoe/yargs/commit/89e1992a004ba73609b5f9ee6890c4060857aba4) detect iojs bin along with node bin. (@bcoe) +* [755509e](https://github.com/bcoe/yargs/commit/755509ea90041e5f7833bba3b8c5deffe56f0aab) improvements to example documentation in README.md (@rstacruz) +* [0d2dfc8](https://github.com/bcoe/yargs/commit/0d2dfc822a43418242908ad97ddd5291a1b35dc6) showHelp() no longer requires that .argv has been called (@bcoe) + +### v3.7.0 (2015/04/04 02:29 -07:00) + +* [56cbe2d](https://github.com/bcoe/yargs/commit/56cbe2ddd33dc176dcbf97ba40559864a9f114e4) make .requiresArg() work with type hints. (@bcoe). +* [2f5d562](https://github.com/bcoe/yargs/commit/2f5d5624f736741deeedf6a664d57bc4d857bdd0) serialize arrays and objects in usage strings. (@bcoe). +* [5126304](https://github.com/bcoe/yargs/commit/5126304dd18351fc28f10530616fdd9361e0af98) be more lenient about alias/primary key ordering in chaining API. (@bcoe) + +### v3.6.0 (2015/03/21 01:00 +00:00) +- [4e24e22](https://github.com/bcoe/yargs/commit/4e24e22e6a195e55ab943ede704a0231ac33b99c) support for .js configuration files. (@pirxpilot) + +### v3.5.4 (2015/03/12 05:56 +00:00) +- [c16cc08](https://github.com/bcoe/yargs/commit/c16cc085501155cf7fd853ccdf8584b05ab92b78) message for non-option arguments is now optional, thanks to (@raine) + +### v3.5.3 (2015/03/09 06:14 +00:00) +- [870b428](https://github.com/bcoe/yargs/commit/870b428cf515d560926ca392555b7ad57dba9e3d) completion script was missing in package.json (@bcoe) + +### v3.5.2 (2015/03/09 06:11 +00:00) +- [58a4b24](https://github.com/bcoe/yargs/commit/58a4b2473ebbb326713d522be53e32d3aabb08d2) parse was being called multiple times, resulting in strange behavior (@bcoe) + +### v3.5.1 (2015/03/09 04:55 +00:00) +- [4e588e0](https://github.com/bcoe/yargs/commit/4e588e055afbeb9336533095f051496e3977f515) accidentally left testing logic in (@bcoe) + +### v3.5.0 (2015/03/09 04:49 +00:00) +- [718bacd](https://github.com/bcoe/yargs/commit/718bacd81b9b44f786af76b2afe491fe06274f19) added support for bash completions see #4 (@bcoe) +- [a192882](https://github.com/bcoe/yargs/commit/a19288270fc431396c42af01125eeb4443664528) downgrade to mocha 2.1.0 until https://github.com/mochajs/mocha/issues/1585 can be sorted out (@bcoe) + +### v3.4.7 (2015/03/09 04:09 +00:00) +- [9845e5c](https://github.com/bcoe/yargs/commit/9845e5c1a9c684ba0be3f0bfb40e7b62ab49d9c8) the Argv singleton was not being updated when manually parsing arguments, fixes #114 (@bcoe) + +### v3.4.6 (2015/03/09 04:01 +00:00) +- [45b4c80](https://github.com/bcoe/yargs/commit/45b4c80b890d02770b0a94f326695a8a566e8fe9) set placeholders for all keys fixes #115 (@bcoe) + +### v3.4.5 (2015/03/01 20:31 +00:00) +- [a758e0b](https://github.com/bcoe/yargs/commit/a758e0b2556184f067cf3d9c4ef886d39817ebd2) fix for count consuming too many arguments (@bcoe) + +### v3.4.4 (2015/02/28 04:52 +00:00) +- [0476af7](https://github.com/bcoe/yargs/commit/0476af757966acf980d998b45108221d4888cfcb) added nargs feature, allowing you to specify the number of arguments after an option (@bcoe) +- [092477d](https://github.com/bcoe/yargs/commit/092477d7ab3efbf0ba11cede57f7d8cfc70b024f) updated README with full example of v3.0 API (@bcoe) + +### v3.3.3 (2015/02/28 04:23 +00:00) +- [0c4b769](https://github.com/bcoe/yargs/commit/0c4b769516cd8d93a7c4e5e675628ae0049aa9a8) remove string dependency, which conflicted with other libraries see #106 (@bcoe) + +### v3.3.2 (2015/02/28 04:11 +00:00) +- [2a98906](https://github.com/bcoe/yargs/commit/2a9890675821c0e7a12f146ce008b0562cb8ec9a) add $0 to epilog (@schnittstabil) + +### v3.3.1 (2015/02/24 03:28 +00:00) +- [ad485ce](https://github.com/bcoe/yargs/commit/ad485ce748ebdfce25b88ef9d6e83d97a2f68987) fix for applying defaults to camel-case args (@bcoe) + +### v3.3.0 (2015/02/24 00:49 +00:00) +- [8bfe36d](https://github.com/bcoe/yargs/commit/8bfe36d7fb0f93a799ea3f4c756a7467c320f8c0) fix and document restart() command, as a tool for building nested CLIs (@bcoe) + +### v3.2.1 (2015/02/22 05:45 +00:00) +- [49a6d18](https://github.com/bcoe/yargs/commit/49a6d1822a4ef9b1ea6f90cc366be60912628885) you can now provide a function that generates a default value (@bcoe) + +### v3.2.0 (2015/02/22 05:24 +00:00) +- [7a55886](https://github.com/bcoe/yargs/commit/7a55886c9343cf71a20744ca5cdd56d2ea7412d5) improvements to yargs two-column text layout (@bcoe) +- [b6ab513](https://github.com/bcoe/yargs/commit/b6ab5136a4c3fa6aa496f6b6360382e403183989) Tweak NPM version badge (@nylen) + +### v3.1.0 (2015/02/19 19:37 +00:00) +- [9bd2379](https://github.com/bcoe/yargs/commit/9bd237921cf1b61fd9f32c0e6d23f572fc225861) version now accepts a function, making it easy to load version #s from a package.json (@bcoe) + +### v3.0.4 (2015/02/14 01:40 +00:00) +- [0b7c19b](https://github.com/bcoe/yargs/commit/0b7c19beaecb747267ca4cc10e5cb2a8550bc4b7) various fixes for dot-notation handling (@bcoe) + +### v3.0.3 (2015/02/14 00:59 +00:00) +- [c3f35e9](https://github.com/bcoe/yargs/commit/c3f35e99bd5a0d278073fcadd95e2d778616cc17) make sure dot-notation is applied to aliases (@bcoe) + +### 3.0.2 (2015/02/13 16:50 +00:00) +- [74c8967](https://github.com/bcoe/yargs/commit/74c8967c340c204a0a7edf8a702b6f46c2705435) document epilog shorthand of epilogue. (@bcoe) +- [670110f](https://github.com/bcoe/yargs/commit/670110fc01bedc4831b6fec6afac54517d5a71bc) any non-truthy value now causes check to fail see #76 (@bcoe) +- [0d8f791](https://github.com/bcoe/yargs/commit/0d8f791a33c11ced4cd431ea8d3d3a337d456b56) finished implementing my wish-list of fetures for yargs 3.0. see #88 (@bcoe) +- [5768447](https://github.com/bcoe/yargs/commit/5768447447c4c8e8304f178846206ce86540f063) fix coverage. (@bcoe) +- [82e793f](https://github.com/bcoe/yargs/commit/82e793f3f61c41259eaacb67f0796aea2cf2aaa0) detect console width and perform word-wrapping. (@bcoe) +- [67476b3](https://github.com/bcoe/yargs/commit/67476b37eea07fee55f23f35b9e0c7d76682b86d) refactor two-column table layout so that we can use it for examples and usage (@bcoe) +- [4724cdf](https://github.com/bcoe/yargs/commit/4724cdfcc8e37ae1ca3dcce9d762f476e9ef4bb4) major refactor of index.js, in prep for 3.x release. (@bcoe) + +### v2.3.0 (2015/02/08 20:41 +00:00) +- [d824620](https://github.com/bcoe/yargs/commit/d824620493df4e63664af1fe320764dd1a9244e6) allow for undefined boolean defaults (@ashi009) + +### v2.2.0 (2015/02/08 20:07 +00:00) +- [d6edd98](https://github.com/bcoe/yargs/commit/d6edd9848826e7389ed1393858c45d03961365fd) in-prep for further refactoring, and a 3.x release I've shuffled some things around and gotten test-coverage to 100%. (@bcoe) + +### v2.1.2 (2015/02/08 06:05 +00:00) +- [d640745](https://github.com/bcoe/yargs/commit/d640745a7b9f8d476e0223879d056d18d9c265c4) switch to path.relative (@bcoe) +- [3bfd41f](https://github.com/bcoe/yargs/commit/3bfd41ff262a041f29d828b88936a79c63cad594) remove mocha.opts. (@bcoe) +- [47a2f35](https://github.com/bcoe/yargs/commit/47a2f357091db70903a402d6765501c1d63f15fe) document using .string('_') for string ids. see #56 (@bcoe) +- [#57](https://github.com/bcoe/yargs/pull/57) Merge pull request #57 from eush77/option-readme (@eush77) + +### v2.1.1 (2015/02/06 08:08 +00:00) +- [01c6c61](https://github.com/bcoe/yargs/commit/01c6c61d67b4ebf88f41f0b32a345ec67f0ac17d) fix for #71, 'newAliases' of undefined (@bcoe) + +### v2.1.0 (2015/02/06 07:59 +00:00) +- [6a1a3fa](https://github.com/bcoe/yargs/commit/6a1a3fa731958e26ccd56885f183dd8985cc828f) try to guess argument types, and apply sensible defaults see #73 (@bcoe) + +### v2.0.1 (2015/02/06 07:54 +00:00) +- [96a06b2](https://github.com/bcoe/yargs/commit/96a06b2650ff1d085a52b7328d8bba614c20cc12) Fix for strange behavior with --sort option, see #51 (@bcoe) + +### v2.0.0 (2015/02/06 07:45 +00:00) +- [0250517](https://github.com/bcoe/yargs/commit/0250517c9643e53f431b824e8ccfa54937414011) - [108fb84](https://github.com/bcoe/yargs/commit/108fb8409a3a63dcaf99d917fe4dfcfaa1de236d) fixed bug with boolean parsing, when bools separated by = see #66 (@bcoe) +- [a465a59](https://github.com/bcoe/yargs/commit/a465a5915f912715738de890982e4f8395958b10) Add `files` field to the package.json (@shinnn) +- [31043de](https://github.com/bcoe/yargs/commit/31043de7a38a17c4c97711f1099f5fb164334db3) fix for yargs.argv having the same keys added multiple times see #63 (@bcoe) +- [2d68c5b](https://github.com/bcoe/yargs/commit/2d68c5b91c976431001c4863ce47c9297850f1ad) Disable process.exit calls using .exitProcess(false) (@cianclarke) +- [45da9ec](https://github.com/bcoe/yargs/commit/45da9ec4c55a7bd394721bc6a1db0dabad7bc52a) Mention .option in README (@eush77) + +### v1.3.2 (2014/10/06 21:56 +00:00) +- [b8d3472](https://github.com/bcoe/yargs/commit/b8d34725482e5821a3cc809c0df71378f282f526) 1.3.2 (@chevex) + +### list (2014/08/30 18:41 +00:00) +- [fbc777f](https://github.com/bcoe/yargs/commit/fbc777f416eeefd37c84e44d27d7dfc7c1925721) Now that yargs is the successor to optimist, I'm changing the README language to be more universal. Pirate speak isn't very accessible to non-native speakers. (@chevex) +- [a54d068](https://github.com/bcoe/yargs/commit/a54d0682ae2efc2394d407ab171cc8a8bbd135ea) version output will not print extra newline (@boneskull) +- [1cef5d6](https://github.com/bcoe/yargs/commit/1cef5d62a9d6d61a3948a49574892e01932cc6ae) Added contributors section to package.json (@chrisn) +- [cc295c0](https://github.com/bcoe/yargs/commit/cc295c0a80a2de267e0155b60d315fc4b6f7c709) Added 'require' and 'required' as synonyms for 'demand' (@chrisn) +- [d0bf951](https://github.com/bcoe/yargs/commit/d0bf951d949066b6280101ed606593d079ee15c8) Updating minimist. (@chevex) +- [c15f8e7](https://github.com/bcoe/yargs/commit/c15f8e7f245b261e542cf205ce4f4313630cbdb4) Fix #31 (bad interaction between camelCase options and strict mode) (@nylen) +- [d991b9b](https://github.com/bcoe/yargs/commit/d991b9be687a68812dee1e3b185ba64b7778b82d) Added .help() and .version() methods (@chrisn) +- [e8c8aa4](https://github.com/bcoe/yargs/commit/e8c8aa46268379357cb11e9fc34b8c403037724b) Added .showHelpOnFail() method (@chrisn) +- [e855af4](https://github.com/bcoe/yargs/commit/e855af4a933ea966b5bbdd3c4c6397a4bac1a053) Allow boolean flag with .demand() (@chrisn) +- [14dbec2](https://github.com/bcoe/yargs/commit/14dbec24fb7380683198e2b20c4deb8423e64bea) Fixes issue #22. Arguments are no longer printed to the console when using .config. (@chevex) +- [bef74fc](https://github.com/bcoe/yargs/commit/bef74fcddc1544598a804f80d0a3728459f196bf) Informing users that Yargs is the official optimist successor. (@chevex) +- [#24](https://github.com/bcoe/yargs/pull/24) Merge pull request #24 from chrisn/strict (@chrisn) +- [889a2b2](https://github.com/bcoe/yargs/commit/889a2b28eb9768801b05163360a470d0fd6c8b79) Added requiresArg option, for options that require values (@chrisn) +- [eb16369](https://github.com/bcoe/yargs/commit/eb163692262be1fe80b992fd8803d5923c5a9b18) Added .strict() method, to report error if unknown arguments are given (@chrisn) +- [0471c3f](https://github.com/bcoe/yargs/commit/0471c3fd999e1ad4e6cded88b8aa02013b66d14f) Changed optimist to yargs in usage-options.js example (@chrisn) +- [5c88f74](https://github.com/bcoe/yargs/commit/5c88f74e3cf031b17c54b4b6606c83e485ff520e) Change optimist to yargs in examples (@chrisn) +- [66f12c8](https://github.com/bcoe/yargs/commit/66f12c82ba3c943e4de8ca862980e835da8ecb3a) Fix a couple of bad interactions between aliases and defaults (@nylen) +- [8fa1d80](https://github.com/bcoe/yargs/commit/8fa1d80f14b03eb1f2898863a61f1d1615bceb50) Document second argument of usage(message, opts) (@Gobie) +- [56e6528](https://github.com/bcoe/yargs/commit/56e6528cf674ff70d63083fb044ff240f608448e) For "--some-option", also set argv.someOption (@nylen) +- [ed5f6d3](https://github.com/bcoe/yargs/commit/ed5f6d33f57ad1086b11c91b51100f7c6c7fa8ee) Finished porting unit tests to Mocha. (@chevex) + +### v1.0.15 (2014/02/05 23:18 +00:00) +- [e2b1fc0](https://github.com/bcoe/yargs/commit/e2b1fc0c4a59cf532ae9b01b275e1ef57eeb64d2) 1.0.15 update to badges (@chevex) + +### v1.0.14 (2014/02/05 23:17 +00:00) +- [f33bbb0](https://github.com/bcoe/yargs/commit/f33bbb0f00fe18960f849cc8e15a7428a4cd59b8) Revert "Fixed issue which caused .demand function not to work correctly." (@chevex) + +### v1.0.13 (2014/02/05 22:13 +00:00) +- [6509e5e](https://github.com/bcoe/yargs/commit/6509e5e7dee6ef1a1f60eea104be0faa1a045075) Fixed issue which caused .demand function not to work correctly. (@chevex) + +### v1.0.12 (2013/12/13 00:09 +00:00) +- [05eb267](https://github.com/bcoe/yargs/commit/05eb26741c9ce446b33ff006e5d33221f53eaceb) 1.0.12 (@chevex) + +### v1.0.11 (2013/12/13 00:07 +00:00) +- [c1bde46](https://github.com/bcoe/yargs/commit/c1bde46e37318a68b87d17a50c130c861d6ce4a9) 1.0.11 (@chevex) + +### v1.0.10 (2013/12/12 23:57 +00:00) +- [dfebf81](https://github.com/bcoe/yargs/commit/dfebf8164c25c650701528ee581ca483a99dc21c) Fixed formatting in README (@chevex) + +### v1.0.9 (2013/12/12 23:47 +00:00) +- [0b4e34a](https://github.com/bcoe/yargs/commit/0b4e34af5e6d84a9dbb3bb6d02cd87588031c182) Update README.md (@chevex) + +### v1.0.8 (2013/12/06 16:36 +00:00) +- [#1](https://github.com/bcoe/yargs/pull/1) fix error caused by check() see #1 (@martinheidegger) + +### v1.0.7 (2013/11/24 18:01 +00:00) +- [a247d88](https://github.com/bcoe/yargs/commit/a247d88d6e46644cbb7303c18b1bb678fc132d72) Modified Pirate Joe image. (@chevex) + +### v1.0.6 (2013/11/23 19:21 +00:00) +- [d7f69e1](https://github.com/bcoe/yargs/commit/d7f69e1d34bc929736a8bdccdc724583e21b7eab) Updated Pirate Joe image. (@chevex) + +### v1.0.5 (2013/11/23 19:09 +00:00) +- [ece809c](https://github.com/bcoe/yargs/commit/ece809cf317cc659175e1d66d87f3ca68c2760be) Updated readme notice again. (@chevex) + +### v1.0.4 (2013/11/23 19:05 +00:00) +- [9e81e81](https://github.com/bcoe/yargs/commit/9e81e81654028f83ba86ffc3ac772a0476084e5e) Updated README with a notice about yargs being a fork of optimist and what that implies. (@chevex) + +### v1.0.3 (2013/11/23 17:43 +00:00) +- [65e7a78](https://github.com/bcoe/yargs/commit/65e7a782c86764944d63d084416aba9ee6019c5f) Changed some small wording in README.md. (@chevex) +- [459e20e](https://github.com/bcoe/yargs/commit/459e20e539b366b85128dd281ccd42221e96c7da) Fix a bug in the options function, when string and boolean options weren't applied to aliases. (@shockone) + +### v1.0.2 (2013/11/23 09:46 +00:00) +- [3d80ebe](https://github.com/bcoe/yargs/commit/3d80ebed866d3799224b6f7d596247186a3898a9) 1.0.2 (@chevex) + +### v1.0.1 (2013/11/23 09:39 +00:00) +- [f80ff36](https://github.com/bcoe/yargs/commit/f80ff3642d580d4b68bf9f5a94277481bd027142) Updated image. (@chevex) + +### v1.0.0 (2013/11/23 09:33 +00:00) +- [54e31d5](https://github.com/bcoe/yargs/commit/54e31d505f820b80af13644e460894b320bf25a3) Rebranded from optimist to yargs in the spirit of the fork :D (@chevex) +- [4ebb6c5](https://github.com/bcoe/yargs/commit/4ebb6c59f44787db7c24c5b8fe2680f01a23f498) Added documentation for demandCount(). (@chevex) +- [4561ce6](https://github.com/bcoe/yargs/commit/4561ce66dcffa95f49e8b4449b25b94cd68acb25) Simplified the error messages returned by .check(). (@chevex) +- [661c678](https://github.com/bcoe/yargs/commit/661c67886f479b16254a830b7e1db3be29e6b7a6) Fixed an issue with demand not accepting a zero value. (@chevex) +- [731dd3c](https://github.com/bcoe/yargs/commit/731dd3c37624790490bd6df4d5f1da8f4348279e) Add .fail(fn) so death isn't the only option. Should fix issue #39. (@chevex) +- [fa15417](https://github.com/bcoe/yargs/commit/fa15417ff9e70dace0d726627a5818654824c1d8) Added a few missing 'return self' (@chevex) +- [e655e4d](https://github.com/bcoe/yargs/commit/e655e4d99d1ae1d3695ef755d51c2de08d669761) Fix showing help in certain JS environments. (@chevex) +- [a746a31](https://github.com/bcoe/yargs/commit/a746a31cd47c87327028e6ea33762d6187ec5c87) Better string representation of default values. (@chevex) +- [6134619](https://github.com/bcoe/yargs/commit/6134619a7e90b911d5443230b644c5d447c1a68c) Implies: conditional demands (@chevex) +- [046b93b](https://github.com/bcoe/yargs/commit/046b93b5d40a27367af4cb29726e4d781d934639) Added support for JSON config files. (@chevex) +- [a677ec0](https://github.com/bcoe/yargs/commit/a677ec0a0ecccd99c75e571d03323f950688da03) Add .example(cmd, desc) feature. (@chevex) +- [1bd4375](https://github.com/bcoe/yargs/commit/1bd4375e11327ba1687d4bb6e5e9f3c30c1be2af) Added 'defaults' as alias to 'default' so as to avoid usage of a reserved keyword. (@chevex) +- [6b753c1](https://github.com/bcoe/yargs/commit/6b753c16ca09e723060e70b773b430323b29c45c) add .normalize(args..) support for normalizing paths (@chevex) +- [33d7d59](https://github.com/bcoe/yargs/commit/33d7d59341d364f03d3a25f0a55cb99004dbbe4b) Customize error messages with demand(key, msg) (@chevex) +- [647d37f](https://github.com/bcoe/yargs/commit/647d37f164c20f4bafbf67dd9db6cd6e2cd3b49f) Merge branch 'rewrite-duplicate-test' of github.com:isbadawi/node-optimist (@chevex) +- [9059d1a](https://github.com/bcoe/yargs/commit/9059d1ad5e8aea686c2a01c89a23efdf929fff2e) Pass aliases object to check functions for greater versatility. (@chevex) +- [623dc26](https://github.com/bcoe/yargs/commit/623dc26c7331abff2465ef8532e3418996d42fe6) Added ability to count boolean options and rolled minimist library back into project. (@chevex) +- [49f0dce](https://github.com/bcoe/yargs/commit/49f0dcef35de4db544c3966350d36eb5838703f6) Fixed small typo. (@chevex) +- [79ec980](https://github.com/bcoe/yargs/commit/79ec9806d9ca6eb0014cfa4b6d1849f4f004baf2) Removed dependency on wordwrap module. (@chevex) +- [ea14630](https://github.com/bcoe/yargs/commit/ea14630feddd69d1de99dd8c0e08948f4c91f00a) Merge branch 'master' of github.com:chbrown/node-optimist (@chevex) +- [2b75da2](https://github.com/bcoe/yargs/commit/2b75da2624061e0f4f3107d20303c06ec9054906) Merge branch 'master' of github.com:seanzhou1023/node-optimist (@chevex) +- [d9bda11](https://github.com/bcoe/yargs/commit/d9bda1116e26f3b40e833ca9ca19263afea53565) Merge branch 'patch-1' of github.com:thefourtheye/node-optimist (@chevex) +- [d6cc606](https://github.com/bcoe/yargs/commit/d6cc6064a4f1bea38a16a4430b8a1334832fbeff) Renamed README. (@chevex) +- [9498d3f](https://github.com/bcoe/yargs/commit/9498d3f59acfb5e102826503e681623c3a64b178) Renamed readme and added .gitignore. (@chevex) +- [bbd1fe3](https://github.com/bcoe/yargs/commit/bbd1fe37fefa366dde0fb3dc44d91fe8b28f57f5) Included examples for ```help``` and ```showHelp``` functions and fixed few formatting issues (@thefourtheye) +- [37fea04](https://github.com/bcoe/yargs/commit/37fea0470a5796a0294c1dcfff68d8041650e622) .alias({}) behaves differently based on mapping direction when generating descriptions (@chbrown) +- [855b20d](https://github.com/bcoe/yargs/commit/855b20d0be567ca121d06b30bea64001b74f3d6d) Documented function signatures are useful for dynamically typed languages. (@chbrown) + +### 0.6.0 (2013/06/25 08:48 +00:00) +- [d37bfe0](https://github.com/bcoe/yargs/commit/d37bfe05ae6d295a0ab481efe4881222412791f4) all tests passing using minimist (@substack) +- [76f1352](https://github.com/bcoe/yargs/commit/76f135270399d01f2bbc621e524a5966e5c422fd) all parse tests now passing (@substack) +- [a7b6754](https://github.com/bcoe/yargs/commit/a7b6754276c38d1565479a5685c3781aeb947816) using minimist, some tests passing (@substack) +- [6655688](https://github.com/bcoe/yargs/commit/66556882aa731cbbbe16cc4d42c85740a2e98099) Give credit where its due (@DeadAlready) +- [602a2a9](https://github.com/bcoe/yargs/commit/602a2a92a459f93704794ad51b115bbb08b535ce) v0.5.3 - Remove wordwrap as dependency (@DeadAlready) + +### 0.5.2 (2013/05/31 03:46 +00:00) +- [4497ca5](https://github.com/bcoe/yargs/commit/4497ca55e332760a37b866ec119ded347ca27a87) fixed the whitespace bug without breaking anything else (@substack) +- [5a3dd1a](https://github.com/bcoe/yargs/commit/5a3dd1a4e0211a38613c6e02f61328e1031953fa) failing test for whitespace arg (@substack) + +### 0.5.1 (2013/05/30 07:17 +00:00) +- [a20228f](https://github.com/bcoe/yargs/commit/a20228f62a454755dd07f628a7c5759113918327) fix parse() to work with functions before it (@substack) +- [b13bd4c](https://github.com/bcoe/yargs/commit/b13bd4cac856a9821d42fa173bdb58f089365a7d) failing test for parse() with modifiers (@substack) + +### 0.5.0 (2013/05/18 21:59 +00:00) +- [c474a64](https://github.com/bcoe/yargs/commit/c474a649231527915c222156e3b40806d365a87c) fixes for dash (@substack) + +### 0.4.0 (2013/04/13 19:03 +00:00) +- [dafe3e1](https://github.com/bcoe/yargs/commit/dafe3e18d7c6e7c2d68e06559df0e5cbea3adb14) failing short test (@substack) + +### 0.3.7 (2013/04/04 04:07 +00:00) +- [6c7a0ec](https://github.com/bcoe/yargs/commit/6c7a0ec94ce4199a505f0518b4d6635d4e47cc81) Fix for windows. On windows there is no _ in environment. (@hdf) + +### 0.3.6 (2013/04/04 04:04 +00:00) +- [e72346a](https://github.com/bcoe/yargs/commit/e72346a727b7267af5aa008b418db89970873f05) Add support for newlines in -a="" arguments (@danielbeardsley) +- [71e1fb5](https://github.com/bcoe/yargs/commit/71e1fb55ea9987110a669ac6ec12338cfff3821c) drop 0.4, add 0.8 to travis (@substack) + +### 0.3.5 (2012/10/10 11:09 +00:00) +- [ee692b3](https://github.com/bcoe/yargs/commit/ee692b37554c70a0bb16389a50a26b66745cbbea) Fix parsing booleans (@vojtajina) +- [5045122](https://github.com/bcoe/yargs/commit/5045122664c3f5b4805addf1be2148d5856f7ce8) set $0 properly in the tests (@substack) + +### 0.3.4 (2012/04/30 06:54 +00:00) +- [f28c0e6](https://github.com/bcoe/yargs/commit/f28c0e62ca94f6e0bb2e6d82fc3d91a55e69b903) bump for string "true" params (@substack) +- [8f44aeb](https://github.com/bcoe/yargs/commit/8f44aeb74121ddd689580e2bf74ef86a605e9bf2) Fix failing test for aliased booleans. (@coderarity) +- [b9f7b61](https://github.com/bcoe/yargs/commit/b9f7b613b1e68e11e6c23fbda9e555a517dcc976) Add failing test for short aliased booleans. (@coderarity) + +### 0.3.3 (2012/04/30 06:45 +00:00) +- [541bac8](https://github.com/bcoe/yargs/commit/541bac8dd787a5f1a5d28f6d8deb1627871705e7) Fixes #37. + +### 0.3.2 (2012/04/12 20:28 +00:00) +- [3a0f014](https://github.com/bcoe/yargs/commit/3a0f014c1451280ac1c9caa1f639d31675586eec) travis badge (@substack) +- [4fb60bf](https://github.com/bcoe/yargs/commit/4fb60bf17845f4ce3293f8ca49c9a1a7c736cfce) Fix boolean aliases. (@coderarity) +- [f14dda5](https://github.com/bcoe/yargs/commit/f14dda546efc4fe06ace04d36919bfbb7634f79b) Adjusted package.json to use tap (@jfhbrook) +- [88e5d32](https://github.com/bcoe/yargs/commit/88e5d32295be6e544c8d355ff84e355af38a1c74) test/usage.js no longer hangs (@jfhbrook) +- [e1e740c](https://github.com/bcoe/yargs/commit/e1e740c27082f3ce84deca2093d9db2ef735d0e5) two tests for combined boolean/alias opts parsing (@jfhbrook) + +### 0.3.1 (2011/12/31 08:44 +00:00) +- [d09b719](https://github.com/bcoe/yargs/commit/d09b71980ef711b6cf3918cd19beec8257e40e82) If "default" is set to false it was not passed on, fixed. (@wolframkriesing) + +### 0.3.0 (2011/12/09 06:03 +00:00) +- [6e74aa7](https://github.com/bcoe/yargs/commit/6e74aa7b46a65773e20c0cb68d2d336d4a0d553d) bump and documented dot notation (@substack) + +### 0.2.7 (2011/10/20 02:25 +00:00) +- [94adee2](https://github.com/bcoe/yargs/commit/94adee20e17b58d0836f80e8b9cdbe9813800916) argv._ can be told 'Hey! argv._! Don't be messing with my args.', and it WILL obey (@colinta) +- [c46fdd5](https://github.com/bcoe/yargs/commit/c46fdd56a05410ae4a1e724a4820c82e77ff5469) optimistic critter image (@substack) +- [5c95c73](https://github.com/bcoe/yargs/commit/5c95c73aedf4c7482bd423e10c545e86d7c8a125) alias options() to option() (@substack) +- [f7692ea](https://github.com/bcoe/yargs/commit/f7692ea8da342850af819367833abb685fde41d8) [fix] Fix for parsing boolean edge case (@indexzero) +- [d1f92d1](https://github.com/bcoe/yargs/commit/d1f92d1425bd7f356055e78621b30cdf9741a3c2) +- [b01bda8](https://github.com/bcoe/yargs/commit/b01bda8d86e455bbf74ce497864cb8ab5b9fb847) [fix test] Update to ensure optimist is aware of default booleans. Associated tests included (@indexzero) +- [aa753e7](https://github.com/bcoe/yargs/commit/aa753e7c54fb3a12f513769a0ff6d54aa0f63943) [dist test] Update devDependencies in package.json. Update test pathing to be more npm and require.paths future-proof (@indexzero) +- [7bfce2f](https://github.com/bcoe/yargs/commit/7bfce2f3b3c98e6539e7549d35fbabced7e9341e) s/sys/util/ (@substack) +- [d420a7a](https://github.com/bcoe/yargs/commit/d420a7a9c890d2cdb11acfaf3ea3f43bc3e39f41) update usage output (@substack) +- [cf86eed](https://github.com/bcoe/yargs/commit/cf86eede2e5fc7495b6ec15e6d137d9ac814f075) some sage readme protips about parsing rules (@substack) +- [5da9f7a](https://github.com/bcoe/yargs/commit/5da9f7a5c0e1758ec7c5801fb3e94d3f6e970513) documented all the methods finally (@substack) +- [8ca6879](https://github.com/bcoe/yargs/commit/8ca6879311224b25933642987300f6a29de5c21b) fenced syntax highlighting (@substack) +- [b72bacf](https://github.com/bcoe/yargs/commit/b72bacf1d02594778c1935405bc8137eb61761dc) right-alignment of wrapped extra params (@substack) +- [2b980bf](https://github.com/bcoe/yargs/commit/2b980bf2656b4ee8fc5134dc5f56a48855c35198) now with .wrap() (@substack) +- [d614f63](https://github.com/bcoe/yargs/commit/d614f639654057d1b7e35e3f5a306e88ec2ad1e4) don't show 'Options:' when there aren't any (@substack) +- [691eda3](https://github.com/bcoe/yargs/commit/691eda354df97b5a86168317abcbcaabdc08a0fb) failing test for multi-aliasing (@substack) +- [0826c9f](https://github.com/bcoe/yargs/commit/0826c9f462109feab2bc7a99346d22e72bf774b7) "Options:" > "options:" (@substack) +- [72f7490](https://github.com/bcoe/yargs/commit/72f749025d01b7f295738ed370a669d885fbada0) [minor] Update formatting for `.showHelp()` (@indexzero) +- [75aecce](https://github.com/bcoe/yargs/commit/75aeccea74329094072f95800e02c275e7d999aa) options works again, too lazy to write a proper test right now (@substack) +- [f742e54](https://github.com/bcoe/yargs/commit/f742e5439817c662dc3bd8734ddd6467e6018cfd) line_count_options example, which breaks (@substack) +- [4ca06b8](https://github.com/bcoe/yargs/commit/4ca06b8b4ea99b5d5714b315a2a8576bee6e5537) line count example (@substack) +- [eeb8423](https://github.com/bcoe/yargs/commit/eeb8423e0a5ecc9dc3eb1e6df9f3f8c1c88f920b) remove self.argv setting in boolean (@substack) +- [6903412](https://github.com/bcoe/yargs/commit/69034126804660af9cc20ea7f4457b50338ee3d7) removed camel case for now (@substack) +- [5a0d88b](https://github.com/bcoe/yargs/commit/5a0d88bf23e9fa79635dd034e2a1aa992acc83cd) remove dead longest checking code (@substack) +- [d782170](https://github.com/bcoe/yargs/commit/d782170babf7284b1aa34f5350df0dd49c373fa8) .help() too (@substack) +- [622ec17](https://github.com/bcoe/yargs/commit/622ec17379bb5374fdbb190404c82bc600975791) rm old help generator (@substack) +- [7c8baac](https://github.com/bcoe/yargs/commit/7c8baac4d66195e9f5158503ea9ebfb61153dab7) nub keys (@substack) +- [8197785](https://github.com/bcoe/yargs/commit/8197785ad4762465084485b041abd722f69bf344) generate help message based on the previous calls, todo: nub (@substack) +- [3ffbdc3](https://github.com/bcoe/yargs/commit/3ffbdc33c8f5e83d4ea2ac60575ce119570c7ede) stub out new showHelp, better checks (@substack) +- [d4e21f5](https://github.com/bcoe/yargs/commit/d4e21f56a4830f7de841900d3c79756fb9886184) let .options() take single options too (@substack) +- [3c4cf29](https://github.com/bcoe/yargs/commit/3c4cf2901a29bac119cca8e983028d8669230ec6) .options() is now heaps simpler (@substack) +- [89f0d04](https://github.com/bcoe/yargs/commit/89f0d043cbccd302f10ab30c2069e05d2bf817c9) defaults work again, all tests pass (@substack) +- [dd87333](https://github.com/bcoe/yargs/commit/dd8733365423006a6e4156372ebb55f98323af58) update test error messages, down to 2 failing tests (@substack) +- [53f7bc6](https://github.com/bcoe/yargs/commit/53f7bc626b9875f2abdfc5dd7a80bde7f14143a3) fix for bools doubling up, passes the parse test again, others fail (@substack) +- [2213e2d](https://github.com/bcoe/yargs/commit/2213e2ddc7263226fba717fb041dc3fde9bc2ee4) refactored for an argv getter, failing several tests (@substack) +- [d1e7379](https://github.com/bcoe/yargs/commit/d1e737970f15c6c006bebdd8917706827ff2f0f2) just rescan for now, alias test passes (@substack) +- [b2f8c99](https://github.com/bcoe/yargs/commit/b2f8c99cc477a8eb0fdf4cf178e1785b63185cfd) failing alias test (@substack) +- [d0c0174](https://github.com/bcoe/yargs/commit/d0c0174daa144bfb6dc7290fdc448c393c475e15) .alias() (@substack) +- [d85f431](https://github.com/bcoe/yargs/commit/d85f431ad7d07b058af3f2a57daa51495576c164) [api] Remove `.describe()` in favor of building upon the existing `.usage()` API (@indexzero) +- [edbd527](https://github.com/bcoe/yargs/commit/edbd5272a8e213e71acd802782135c7f9699913a) [doc api] Add `.describe()`, `.options()`, and `.showHelp()` methods along with example. (@indexzero) +- [be4902f](https://github.com/bcoe/yargs/commit/be4902ff0961ae8feb9093f2c0a4066463ded2cf) updates for coffee since it now does argv the node way (@substack) +- [e24cb23](https://github.com/bcoe/yargs/commit/e24cb23798ee64e53b60815e7fda78b87f42390c) more general coffeescript detection (@substack) +- [78ac753](https://github.com/bcoe/yargs/commit/78ac753e5d0ec32a96d39d893272afe989e42a4d) Don't trigger the CoffeeScript hack when running under node_g. (@papandreou) +- [bcfe973](https://github.com/bcoe/yargs/commit/bcfe9731d7f90d4632281b8a52e8d76eb0195ae6) .string() but failing test (@substack) +- [1987aca](https://github.com/bcoe/yargs/commit/1987aca28c7ba4e8796c07bbc547cb984804c826) test hex strings (@substack) +- [ef36db3](https://github.com/bcoe/yargs/commit/ef36db32259b0b0d62448dc907c760e5554fb7e7) more keywords (@substack) +- [cc53c56](https://github.com/bcoe/yargs/commit/cc53c56329960bed6ab077a79798e991711ba01d) Added camelCase function that converts --multi-word-option to camel case (so it becomes argv.multiWordOption). (@papandreou) +- [60b57da](https://github.com/bcoe/yargs/commit/60b57da36797716e5783a633c6d5c79099016d45) fixed boolean bug by rescanning (@substack) +- [dff6d07](https://github.com/bcoe/yargs/commit/dff6d078d97f8ac503c7d18dcc7b7a8c364c2883) boolean examples (@substack) +- [0e380b9](https://github.com/bcoe/yargs/commit/0e380b92c4ef4e3c8dac1da18b5c31d85b1d02c9) boolean() with passing test (@substack) +- [62644d4](https://github.com/bcoe/yargs/commit/62644d4bffbb8d1bbf0c2baf58a1d14a6359ef07) coffee compatibility with node regex for versions too (@substack) +- [430fafc](https://github.com/bcoe/yargs/commit/430fafcf1683d23774772826581acff84b456827) argv._ fixed by fixing the coffee detection (@substack) +- [343b8af](https://github.com/bcoe/yargs/commit/343b8afefd98af274ebe21b5a16b3a949ec5429f) whichNodeArgs test fails too (@substack) +- [63df2f3](https://github.com/bcoe/yargs/commit/63df2f371f31e63d7f1dec2cbf0022a5f08da9d2) replicated mnot's bug in whichNodeEmpty test (@substack) +- [35473a4](https://github.com/bcoe/yargs/commit/35473a4d93a45e5e7e512af8bb54ebb532997ae1) test for ./bin usage (@substack) +- [13df151](https://github.com/bcoe/yargs/commit/13df151e44228eed10e5441c7cd163e086c458a4) don't coerce booleans to numbers (@substack) +- [85f8007](https://github.com/bcoe/yargs/commit/85f8007e93b8be7124feea64b1f1916d8ba1894a) package bump for automatic number conversion (@substack) +- [8f17014](https://github.com/bcoe/yargs/commit/8f170141cded4ccc0c6d67a849c5bf996aa29643) updated readme and examples with new auto-numberification goodness (@substack) +- [73dc901](https://github.com/bcoe/yargs/commit/73dc9011ac968e39b55e19e916084a839391b506) auto number conversion works yay (@substack) +- [bcec56b](https://github.com/bcoe/yargs/commit/bcec56b3d031e018064cbb691539ccc4f28c14ad) failing test for not-implemented auto numification (@substack) +- [ebd2844](https://github.com/bcoe/yargs/commit/ebd2844d683feeac583df79af0e5124a7a7db04e) odd that eql doesn't check types careflly (@substack) +- [fd854b0](https://github.com/bcoe/yargs/commit/fd854b02e512ce854b76386d395672a7969c1bc4) package author + keywords (@substack) +- [656a1d5](https://github.com/bcoe/yargs/commit/656a1d5a1b7c0e49d72e80cb13f20671d56f76c6) updated readme with .default() stuff (@substack) +- [cd7f8c5](https://github.com/bcoe/yargs/commit/cd7f8c55f0b82b79b690d14c5f806851236998a1) passing tests for new .default() behavior (@substack) +- [932725e](https://github.com/bcoe/yargs/commit/932725e39ce65bc91a0385a5fab659a5fa976ac2) new default() thing for setting default key/values (@substack) +- [4e6c7ab](https://github.com/bcoe/yargs/commit/4e6c7aba6374ac9ebc6259ecf91f13af7bce40e3) test for coffee usage (@substack) +- [d54ffcc](https://github.com/bcoe/yargs/commit/d54ffccf2a5a905f51ed5108f7c647f35d64ae23) new --key value style with passing tests. NOTE: changes existing behavior (@substack) +- [ed2a2d5](https://github.com/bcoe/yargs/commit/ed2a2d5d828100ebeef6385c0fb88d146a5cfe9b) package bump for summatix's coffee script fix (@substack) +- [75a975e](https://github.com/bcoe/yargs/commit/75a975eed8430d28e2a79dc9e6d819ad545f4587) Added support for CoffeeScript (@summatix) +- [56b2b1d](https://github.com/bcoe/yargs/commit/56b2b1de8d11f8a2b91979d8ae2d6db02d8fe64d) test coverage for the falsy check() usage (@substack) +- [a4843a9](https://github.com/bcoe/yargs/commit/a4843a9f0e69ffb4afdf6a671d89eb6f218be35d) check bug fixed plus a handy string (@substack) +- [857bd2d](https://github.com/bcoe/yargs/commit/857bd2db933a5aaa9cfecba0ced2dc9b415f8111) tests for demandCount, back up to 100% coverage (@substack) +- [073b776](https://github.com/bcoe/yargs/commit/073b7768ebd781668ef05c13f9003aceca2f5c35) call demandCount from demand (@substack) +- [4bd4b7a](https://github.com/bcoe/yargs/commit/4bd4b7a085c8b6ce1d885a0f486cc9865cee2db1) add demandCount to check for the number of arguments in the _ list (@marshall) +- [b8689ac](https://github.com/bcoe/yargs/commit/b8689ac68dacf248119d242bba39a41cb0adfa07) Rebase checks. That will be its own module eventually. (@substack) +- [e688370](https://github.com/bcoe/yargs/commit/e688370b576f0aa733c3f46183df69e1b561668e) a $0 like in perl (@substack) +- [2e5e196](https://github.com/bcoe/yargs/commit/2e5e1960fc19afb21fb3293752316eaa8bcd3609) usage test hacking around process and console (@substack) +- [fcc3521](https://github.com/bcoe/yargs/commit/fcc352163fbec6a1dfe8caf47a0df39de24fe016) description pun (@substack) +- [87a1fe2](https://github.com/bcoe/yargs/commit/87a1fe29037ca2ca5fefda85141aaeb13e8ce761) mit/x11 license (@substack) +- [8d089d2](https://github.com/bcoe/yargs/commit/8d089d24cd687c0bde3640a96c09b78f884900dd) bool example is more consistent and also shows off short option grouping (@substack) +- [448d747](https://github.com/bcoe/yargs/commit/448d7473ac68e8e03d8befc9457b0d9e21725be0) start of the readme and examples (@substack) +- [da74dea](https://github.com/bcoe/yargs/commit/da74dea799a9b59dbf022cbb8001bfdb0d52eec9) more tests for long and short captures (@substack) +- [ab6387e](https://github.com/bcoe/yargs/commit/ab6387e6769ca4af82ca94c4c67c7319f0d9fcfa) silly bug in the tests with s/not/no/, all tests pass now (@substack) +- [102496a](https://github.com/bcoe/yargs/commit/102496a319e8e06f6550d828fc2f72992c7d9ecc) hack an instance for process.argv onto Argv so the export can be called to create an instance or used for argv, which is the most common case (@substack) +- [a01caeb](https://github.com/bcoe/yargs/commit/a01caeb532546d19f68f2b2b87f7036cfe1aaedd) divide example (@substack) +- [443da55](https://github.com/bcoe/yargs/commit/443da55736acbaf8ff8b04d1b9ce19ab016ddda2) start of the lib with a package.json (@substack) diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/LICENSE b/legacy-libs/grpc-cloned/node_modules/yargs/LICENSE new file mode 100644 index 0000000..432d1ae --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/LICENSE @@ -0,0 +1,21 @@ +Copyright 2010 James Halliday (mail@substack.net) + +This project is free software released under the MIT/X11 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/legacy-libs/grpc-cloned/node_modules/yargs/README.md b/legacy-libs/grpc-cloned/node_modules/yargs/README.md new file mode 100644 index 0000000..3649538 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/README.md @@ -0,0 +1,1243 @@ +yargs +======== + +Yargs be a node.js library fer hearties tryin' ter parse optstrings. + +With yargs, ye be havin' a map that leads straight to yer treasure! Treasure of course, being a simple option hash. + +[![Build Status][travis-image]][travis-url] +[![Dependency Status][gemnasium-image]][gemnasium-url] +[![Coverage Status][coveralls-image]][coveralls-url] +[![NPM version][npm-image]][npm-url] +[![Windows Tests][windows-image]][windows-url] + +> Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/bcoe/yargs/issues) :) + +examples +======== + +With yargs, the options be just a hash! +------------------------------------------------------------------- + +plunder.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs').argv; + +if (argv.ships > 3 && argv.distance < 53.5) { + console.log('Plunder more riffiwobbles!'); +} +else { + console.log('Retreat from the xupptumblers!'); +} +```` + +*** + + $ ./plunder.js --ships=4 --distance=22 + Plunder more riffiwobbles! + + $ ./plunder.js --ships 12 --distance 98.7 + Retreat from the xupptumblers! + +![Joe was one optimistic pirate.](http://i.imgur.com/4WFGVJ9.png) + +But don't walk the plank just yet! There be more! You can do short options: +------------------------------------------------- + +short.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs').argv; +console.log('(%d,%d)', argv.x, argv.y); +```` + +*** + + $ ./short.js -x 10 -y 21 + (10,21) + +And booleans, both long, short, and even grouped: +---------------------------------- + +bool.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs').argv; + +if (argv.s) { + process.stdout.write(argv.fr ? 'Le perroquet dit: ' : 'The parrot says: '); +} +console.log( + (argv.fr ? 'couac' : 'squawk') + (argv.p ? '!' : '') +); +```` + +*** + + $ ./bool.js -s + The parrot says: squawk + + $ ./bool.js -sp + The parrot says: squawk! + + $ ./bool.js -sp --fr + Le perroquet dit: couac! + +And non-hyphenated options too! Just use `argv._`! +------------------------------------------------- + +nonopt.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs').argv; +console.log('(%d,%d)', argv.x, argv.y); +console.log(argv._); +```` + +*** + + $ ./nonopt.js -x 6.82 -y 3.35 rum + (6.82,3.35) + [ 'rum' ] + + $ ./nonopt.js "me hearties" -x 0.54 yo -y 1.12 ho + (0.54,1.12) + [ 'me hearties', 'yo', 'ho' ] + +Yargs even counts your booleans! +---------------------------------------------------------------------- + +count.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .count('verbose') + .alias('v', 'verbose') + .argv; + +VERBOSE_LEVEL = argv.verbose; + +function WARN() { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); } +function INFO() { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); } +function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); } + +WARN("Showing only important stuff"); +INFO("Showing semi-important stuff too"); +DEBUG("Extra chatty mode"); +```` + +*** + $ node count.js + Showing only important stuff + + $ node count.js -v + Showing only important stuff + Showing semi-important stuff too + + $ node count.js -vv + Showing only important stuff + Showing semi-important stuff too + Extra chatty mode + + $ node count.js -v --verbose + Showing only important stuff + Showing semi-important stuff too + Extra chatty mode + +Tell users how to use yer options and make demands. +------------------------------------------------- + +area.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .usage('Usage: $0 -w [num] -h [num]') + .demand(['w','h']) + .argv; + +console.log("The area is:", argv.w * argv.h); +```` + +*** + + $ ./area.js -w 55 -h 11 + The area is: 605 + + $ node ./area.js -w 4.91 -w 2.51 + Usage: area.js -w [num] -h [num] + + Options: + -w [required] + -h [required] + + Missing required arguments: h + +After yer demands have been met, demand more! Ask for non-hyphenated arguments! +----------------------------------------- + +demand_count.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .demand(2) + .argv; +console.dir(argv); +```` + +*** + + $ ./demand_count.js a + + Not enough non-option arguments: got 1, need at least 2 + + $ ./demand_count.js a b + { _: [ 'a', 'b' ], '$0': 'demand_count.js' } + + $ ./demand_count.js a b c + { _: [ 'a', 'b', 'c' ], '$0': 'demand_count.js' } + +EVEN MORE SHIVER ME TIMBERS! +------------------ + +default_singles.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .default('x', 10) + .default('y', 10) + .argv +; +console.log(argv.x + argv.y); +```` + +*** + + $ ./default_singles.js -x 5 + 15 + +default_hash.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .default({ x : 10, y : 10 }) + .argv +; +console.log(argv.x + argv.y); +```` + +*** + + $ ./default_hash.js -y 7 + 17 + +And if you really want to get all descriptive about it... +--------------------------------------------------------- + +boolean_single.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .boolean('v') + .argv +; +console.dir(argv.v); +console.dir(argv._); +```` + +*** + + $ ./boolean_single.js -v "me hearties" yo ho + true + [ 'me hearties', 'yo', 'ho' ] + + +boolean_double.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .boolean(['x','y','z']) + .argv +; +console.dir([ argv.x, argv.y, argv.z ]); +console.dir(argv._); +```` + +*** + + $ ./boolean_double.js -x -z one two three + [ true, false, true ] + [ 'one', 'two', 'three' ] + +Yargs is here to help you... +--------------------------- + +Ye can describe parameters fer help messages and set aliases. Yargs figures +out how ter format a handy help string automatically. + +line_count.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .usage('Usage: $0 [options]') + .command('count', 'Count the lines in a file') + .demand(1) + .example('$0 count -f foo.js', 'count the lines in the given file') + .demand('f') + .alias('f', 'file') + .nargs('f', 1) + .describe('f', 'Load a file') + .help('h') + .alias('h', 'help') + .epilog('copyright 2015') + .argv; + +var fs = require('fs'); +var s = fs.createReadStream(argv.file); + +var lines = 0; +s.on('data', function (buf) { + lines += buf.toString().match(/\n/g).length; +}); + +s.on('end', function () { + console.log(lines); +}); +```` + +*** + $ node line_count.js count + Usage: line_count.js [options] + + Commands: + count Count the lines in a file + + Options: + -f, --file Load a file [required] + -h, --help Show help [boolean] + + Examples: + line_count.js count -f foo.js count the lines in the given file + + copyright 2015 + + Missing required arguments: f + + $ node line_count.js count --file line_count.js + 26 + + $ node line_count.js count -f line_count.js + 26 + +methods +======= + +By itself, + +````javascript +require('yargs').argv +```` + +will use the `process.argv` array to construct the `argv` object. + +You can pass in the `process.argv` yourself: + +````javascript +require('yargs')([ '-x', '1', '-y', '2' ]).argv +```` + +or use `.parse()` to do the same thing: + +````javascript +require('yargs').parse([ '-x', '1', '-y', '2' ]) +```` + +The rest of these methods below come in just before the terminating `.argv`. + +.alias(key, alias) +------------------ + +Set key names as equivalent such that updates to a key will propagate to aliases +and vice-versa. + +Optionally `.alias()` can take an object that maps keys to aliases. +Each key of this object should be the canonical version of the option, and each +value should be a string or an array of strings. + +.argv +----- + +Get the arguments as a plain old object. + +Arguments without a corresponding flag show up in the `argv._` array. + +The script name or node command is available at `argv.$0` similarly to how `$0` +works in bash or perl. + +If `yargs` is executed in an environment that embeds node and there's no script name (e.g. +[Electron](http://electron.atom.io/) or [nw.js](http://nwjs.io/)), it will ignore the first parameter since it +expects it to be the script name. In order to override this behavior, use `.parse(process.argv.slice(1))` +instead of `.argv` and the first parameter won't be ignored. + +.array(key) +---------- + +Tell the parser to interpret `key` as an array. If `.array('foo')` is set, +`--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`. + +.boolean(key) +------------- + +Interpret `key` as a boolean. If a non-flag option follows `key` in +`process.argv`, that string won't get set as the value of `key`. + +`key` will default to `false`, unless a `default(key, undefined)` is +explicitly set. + +If `key` is an array, interpret all the elements as booleans. + +.check(fn) +---------- + +Check that certain conditions are met in the provided arguments. + +`fn` is called with two arguments, the parsed `argv` hash and an array of options and their aliases. + +If `fn` throws or returns a non-truthy value, show the thrown error, usage information, and +exit. + +.choices(key, choices) +---------------------- + +Limit valid values for `key` to a predefined set of `choices`, given as an array +or as an individual value. + +```js +var argv = require('yargs') + .alias('i', 'ingredient') + .describe('i', 'choose your sandwich ingredients') + .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles']) + .help('help') + .argv +``` + +If this method is called multiple times, all enumerated values will be merged +together. Choices are generally strings or numbers, and value matching is +case-sensitive. + +Optionally `.choices()` can take an object that maps multiple keys to their +choices. + +Choices can also be specified as `choices` in the object given to `option()`. + +```js +var argv = require('yargs') + .option('size', { + alias: 's', + describe: 'choose a size', + choices: ['xs', 's', 'm', 'l', 'xl'] + }) + .argv +``` + +.command(cmd, desc, [fn]) +------------------- + +Document the commands exposed by your application. + +Use `desc` to provide a description for each command your application accepts (the +values stored in `argv._`). Set `desc` to `false` to create a hidden command. +Hidden commands don't show up in the help output and aren't available for +completion. + +Optionally, you can provide a handler `fn` which will be executed when +a given command is provided. The handler will be called with `yargs` and +`argv` as arguments. + +`yargs` is a blank instance of yargs, which can be used to compose a nested +hierarchy of options handlers. + +`argv` represents the arguments parsed prior to the +command being executed (those described in the outer yargs instance). + +Here's an example of top-level and nested commands in action: + +```js +var argv = require('yargs') + .usage('npm ') + .command('install', 'tis a mighty fine package to install') + .command('publish', 'shiver me timbers, should you be sharing all that', function (yargs, argv) { + argv = yargs.option('f', { + alias: 'force', + description: 'yar, it usually be a bad idea' + }) + .help('help') + .argv + }) + .help('help') + .argv; +``` + +.completion(cmd, [description], [fn]); +------------- + +Enable bash-completion shortcuts for commands and options. + +`cmd`: When present in `argv._`, will result in the `.bashrc` completion script +being outputted. To enable bash completions, concat the generated script to your +`.bashrc` or `.bash_profile`. + +`description`: Provide a description in your usage instructions for the command +that generates bash completion scripts. + +`fn`: Rather than relying on yargs' default completion functionality, which +shiver me timbers is pretty awesome, you can provide your own completion +method. + +```js +var argv = require('yargs') + .completion('completion', function(current, argv) { + // 'current' is the current command being completed. + // 'argv' is the parsed arguments so far. + // simply return an array of completions. + return [ + 'foo', + 'bar' + ]; + }) + .argv; +``` + +You can also provide asynchronous completions. + +```js +var argv = require('yargs') + .completion('completion', function(current, argv, done) { + setTimeout(function() { + done([ + 'apple', + 'banana' + ]); + }, 500); + }) + .argv; +``` + +But wait, there's more! You can return an asynchronous promise. + +```js +var argv = require('yargs') + .completion('completion', function(current, argv, done) { + return new Promise(function (resolve, reject) { + setTimeout(function () { + resolve(['apple', 'banana']) + }, 10) + }) + }) + .argv; +``` + +.config(key, [description], [parseFn]) +------------ + +Tells the parser that if the option specified by `key` is passed in, it +should be interpreted as a path to a JSON config file. The file is loaded +and parsed, and its properties are set as arguments. + +An optional `description` can be provided to customize the config (`key`) option +in the usage string. + +An optional `parseFn` can be used to provide a custom parser. The parsing +function must be synchronous, and should return an object containing +key value pairs or an error. + +```js +var argv = require('yargs') + .config('settings', function (configPath) { + return JSON.parse(fs.readFileSync(configPath, 'utf-8')) + }) + .argv +``` + +.count(key) +------------ + +Interpret `key` as a boolean flag, but set its parsed value to the number of +flag occurrences rather than `true` or `false`. Default value is thus `0`. + +.default(key, value, [description]) +-------------------- + +Set `argv[key]` to `value` if no option was specified in `process.argv`. + +Optionally `.default()` can take an object that maps keys to default values. + +But wait, there's more! The default value can be a `function` which returns +a value. The name of the function will be used in the usage string: + +```js +var argv = require('yargs') + .default('random', function randomValue() { + return Math.random() * 256; + }).argv; +``` + +Optionally, `description` can also be provided and will take precedence over +displaying the value in the usage instructions: + +```js +.default('timeout', 60000, '(one-minute)') +``` + +.demand(key, [msg | boolean]) +------------------------------ +.demand(count, [max], [msg]) +------------------------------ + +If `key` is a string, show the usage information and exit if `key` wasn't +specified in `process.argv`. + +If `key` is a number, demand at least as many non-option arguments, which show +up in `argv._`. A second number can also optionally be provided, which indicates +the maximum number of non-option arguments. + +If `key` is an array, demand each element. + +If a `msg` string is given, it will be printed when the argument is missing, +instead of the standard error message. This is especially helpful for the non-option arguments in `argv._`. + +If a `boolean` value is given, it controls whether the option is demanded; +this is useful when using `.options()` to specify command line parameters. + +.describe(key, desc) +-------------------- + +Describe a `key` for the generated usage information. + +Optionally `.describe()` can take an object that maps keys to descriptions. + +.detectLocale(boolean) +----------- + +Should yargs attempt to detect the os' locale? Defaults to `true`. + +.env([prefix]) +-------------- + +Tell yargs to parse environment variables matching the given prefix and apply +them to argv as though they were command line arguments. + +If this method is called with no argument or with an empty string or with `true`, +then all env vars will be applied to argv. + +Program arguments are defined in this order of precedence: + +1. Command line args +2. Config file +3. Env var +4. Configured defaults + +```js +var argv = require('yargs') + .env('MY_PROGRAM') + .option('f', { + alias: 'fruit-thing', + default: 'apple' + }) + .argv +console.log(argv) +``` + +``` +$ node fruity.js +{ _: [], + f: 'apple', + 'fruit-thing': 'apple', + fruitThing: 'apple', + '$0': 'fruity.js' } +``` + +``` +$ MY_PROGRAM_FRUIT_THING=banana node fruity.js +{ _: [], + fruitThing: 'banana', + f: 'banana', + 'fruit-thing': 'banana', + '$0': 'fruity.js' } +``` + +``` +$ MY_PROGRAM_FRUIT_THING=banana node fruity.js -f cat +{ _: [], + f: 'cat', + 'fruit-thing': 'cat', + fruitThing: 'cat', + '$0': 'fruity.js' } +``` + +Env var parsing is disabled by default, but you can also explicitly disable it +by calling `.env(false)`, e.g. if you need to undo previous configuration. + +.epilog(str) +------------ +.epilogue(str) +-------------- + +A message to print at the end of the usage instructions, e.g. + +```js +var argv = require('yargs') + .epilogue('for more information, find our manual at http://example.com'); +``` + +.example(cmd, desc) +------------------- + +Give some example invocations of your program. Inside `cmd`, the string +`$0` will get interpolated to the current script name or node command for the +present script similar to how `$0` works in bash or perl. +Examples will be printed out as part of the help message. + +.exitProcess(enable) +---------------------------------- + +By default, yargs exits the process when the user passes a help flag, uses the +`.version` functionality, or when validation fails. Calling +`.exitProcess(false)` disables this behavior, enabling further actions after +yargs have been validated. + +.fail(fn) +--------- + +Method to execute when a failure occurs, rather than printing the failure message. + +`fn` is called with the failure message that would have been printed. + +.group(key(s), groupName) +-------------------- + +Given a key, or an array of keys, places options under an alternative heading +when displaying usage instructions, e.g., + +```js +var yargs = require('yargs')(['--help']) + .help('help') + .group('batman', 'Heroes:') + .describe('batman', "world's greatest detective") + .wrap(null) + .argv +``` +*** + Heroes: + --batman world's greatest detective + + Options: + --help Show help [boolean] + +.help([option, [description]]) +------------------------------ + +Add an option (e.g. `--help`) that displays the usage string and exits the +process. If present, the `description` parameter customizes the description of +the help option in the usage string. + +If invoked without parameters, `.help()` returns the generated usage string. + +Example: + +```js +var yargs = require("yargs") + .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); +console.log(yargs.help()); +``` + +Later on, `argv` can be retrieved with `yargs.argv`. + +.implies(x, y) +-------------- + +Given the key `x` is set, it is required that the key `y` is set. + +Optionally `.implies()` can accept an object specifying multiple implications. + +.locale() +--------- + +Return the locale that yargs is currently using. + +By default, yargs will auto-detect the operating system's locale so that +yargs-generated help content will display in the user's language. + +To override this behavior with a static locale, pass the desired locale as a +string to this method (see below). + +.locale(locale) +--------------- + +Override the auto-detected locale from the user's operating system with a static +locale. Note that the OS locale can be modified by setting/exporting the `LC_ALL` +environment variable. + +```js +var argv = require('yargs') + .usage('./$0 - follow ye instructions true') + .option('option', { + alias: 'o', + describe: "'tis a mighty fine option", + demand: true + }) + .command('run', "Arrr, ya best be knowin' what yer doin'") + .example('$0 run foo', "shiver me timbers, here's an example for ye") + .help('help') + .wrap(70) + .locale('pirate') + .argv +``` + +*** + +```shell +./test.js - follow ye instructions true + +Choose yer command: + run Arrr, ya best be knowin' what yer doin' + +Options for me hearties! + --option, -o 'tis a mighty fine option [requi-yar-ed] + --help Parlay this here code of conduct [boolean] + +Ex. marks the spot: + test.js run foo shiver me timbers, here's an example for ye + +Ye be havin' to set the followin' argument land lubber: option +``` + +Locales currently supported: + +* **de:** German. +* **en:** American English. +* **es:** Spanish. +* **fr:** French. +* **id:** Indonesian. +* **ja:** Japanese. +* **ko:** Korean. +* **nb:** Norwegian Bokmål. +* **pirate:** American Pirate. +* **pt:** Portuguese. +* **pt_BR:** Brazilian Portuguese. +* **tr:** Turkish. +* **zh:** Chinese. + +To submit a new translation for yargs: + +1. use `./locales/en.json` as a starting point. +2. submit a pull request with the new locale file. + +*The [Microsoft Terminology Search](http://www.microsoft.com/Language/en-US/Search.aspx) can be useful for finding the correct terminology in your locale.* + +.nargs(key, count) +----------- + +The number of arguments that should be consumed after a key. This can be a +useful hint to prevent parsing ambiguity. For example: + +```js +var argv = require('yargs') + .nargs('token', 1) + .parse(['--token', '-my-token']); +``` + +parses as: + +`{ _: [], token: '-my-token', '$0': 'node test' }` + +Optionally `.nargs()` can take an object of `key`/`narg` pairs. + +.option(key, opt) +----------------- +.options(key, opt) +------------------ + +Instead of chaining together `.alias().demand().default().describe().string()`, you can specify +keys in `opt` for each of the chainable methods. + +For example: + +````javascript +var argv = require('yargs') + .option('f', { + alias: 'file', + demand: true, + default: '/etc/passwd', + describe: 'x marks the spot', + type: 'string' + }) + .argv +; +```` + +is the same as + +````javascript +var argv = require('yargs') + .alias('f', 'file') + .demand('f') + .default('f', '/etc/passwd') + .describe('f', 'x marks the spot') + .string('f') + .argv +; +```` + +Optionally `.options()` can take an object that maps keys to `opt` parameters. + +````javascript +var argv = require('yargs') + .options({ + 'f': { + alias: 'file', + demand: true, + default: '/etc/passwd', + describe: 'x marks the spot', + type: 'string' + } + }) + .argv +; +```` + +Valid `opt` keys include: + +- `alias`: string or array of strings, alias(es) for the canonical option key, see [`alias()`](#alias) +- `array`: boolean, interpret option as an array, see [`array()`](#array) +- `boolean`: boolean, interpret option as a boolean flag, see [`boolean()`](#boolean) +- `choices`: value or array of values, limit valid option arguments to a predefined set, see [`choices()`](#choices) +- `config`: boolean, interpret option as a path to a JSON config file, see [`config()`](#config) +- `configParser`: function, provide a custom config parsing function, see [`config()`](#config) +- `count`: boolean, interpret option as a count of boolean flags, see [`count()`](#count) +- `default`: value, set a default value for the option, see [`default()`](#default) +- `defaultDescription`: string, use this description for the default value in help content, see [`default()`](#default) +- `demand`/`require`/`required`: boolean or string, demand the option be given, with optional error message, see [`demand()`](#demand) +- `desc`/`describe`/`description`: string, the option description for help content, see [`describe()`](#describe) +- `group`: string, when displaying usage instructions place the option under an alternative group heading, see [`group()`](#group) +- `nargs`: number, specify how many arguments should be consumed for the option, see [`nargs()`](#nargs) +- `requiresArg`: boolean, require the option be specified with a value, see [`requiresArg()`](#requiresArg) +- `string`: boolean, interpret option as a string, see [`string()`](#string) +- `type`: one of the following strings + - `'array'`: synonymous for `array: true`, see [`array()`](#array) + - `'boolean'`: synonymous for `boolean: true`, see [`boolean()`](#boolean) + - `'count'`: synonymous for `count: true`, see [`count()`](#count) + - `'string'`: synonymous for `string: true`, see [`string()`](#string) + +.parse(args) +------------ + +Parse `args` instead of `process.argv`. Returns the `argv` object. + +`args` may either be a pre-processed argv array, or a raw argument string. + +.require(key, [msg | boolean]) +------------------------------ +.required(key, [msg | boolean]) +------------------------------ + +An alias for [`demand()`](#demand). See docs there. + +.requiresArg(key) +----------------- + +Specifies either a single option key (string), or an array of options that +must be followed by option values. If any option value is missing, show the +usage information and exit. + +The default behavior is to set the value of any key not followed by an +option value to `true`. + +.reset() +-------- + +Reset the argument object built up so far. This is useful for +creating nested command line interfaces. + +```js +var yargs = require('yargs') + .usage('$0 command') + .command('hello', 'hello command') + .command('world', 'world command') + .demand(1, 'must provide a valid command'), + argv = yargs.argv, + command = argv._[0]; + +if (command === 'hello') { + yargs.reset() + .usage('$0 hello') + .help('h') + .example('$0 hello', 'print the hello message!') + .argv + + console.log('hello!'); +} else if (command === 'world'){ + yargs.reset() + .usage('$0 world') + .help('h') + .example('$0 world', 'print the world message!') + .argv + + console.log('world!'); +} else { + yargs.showHelp(); +} +``` + +.showCompletionScript() +---------------------- + +Generate a bash completion script. Users of your application can install this +script in their `.bashrc`, and yargs will provide completion shortcuts for +commands and options. + +.showHelp(consoleLevel='error') +--------------------------- + +Print the usage data using the [`console`](https://nodejs.org/api/console.html) function `consoleLevel` for printing. + +Example: + +```js +var yargs = require("yargs") + .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); +yargs.showHelp(); //prints to stderr using console.error() +``` + +Or, to print the usage data to `stdout` instead, you can specify the use of `console.log`: + +```js +yargs.showHelp("log"); //prints to stdout using console.log() +``` + +Later on, `argv` can be retrieved with `yargs.argv`. + +.showHelpOnFail(enable, [message]) +---------------------------------- + +By default, yargs outputs a usage string if any error is detected. Use the +`.showHelpOnFail()` method to customize this behavior. If `enable` is `false`, +the usage string is not output. If the `message` parameter is present, this +message is output after the error message. + +line_count.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .usage('Count the lines in a file.\nUsage: $0 -f ') + .demand('f') + .alias('f', 'file') + .describe('f', 'Load a file') + .string('f') + .showHelpOnFail(false, 'Specify --help for available options') + .help('help') + .argv; + +// etc. +```` + +*** + +``` +$ node line_count.js +Missing argument value: f + +Specify --help for available options +``` + +.strict() +--------- + +Any command-line argument given that is not demanded, or does not have a +corresponding description, will be reported as an error. + +.string(key) +------------ + +Tell the parser logic not to interpret `key` as a number or boolean. +This can be useful if you need to preserve leading zeros in an input. + +If `key` is an array, interpret all the elements as strings. + +`.string('_')` will result in non-hyphenated arguments being interpreted as strings, +regardless of whether they resemble numbers. + +.updateLocale(obj) +------------------ +.updateStrings(obj) +------------------ + +Override the default strings used by yargs with the key/value +pairs provided in `obj`: + +```js +var argv = require('yargs') + .command('run', 'the run command') + .help('help') + .updateStrings({ + 'Commands:': 'My Commands -->\n' + }) + .wrap(null) + .argv +``` + +*** + +```shell +My Commands --> + + run the run command + +Options: + --help Show help [boolean] +``` + +If you explicitly specify a `locale()`, you should do so *before* calling +`updateStrings()`. + +.usage(message, [opts]) +--------------------- + +Set a usage message to show which commands to use. Inside `message`, the string +`$0` will get interpolated to the current script name or node command for the +present script similar to how `$0` works in bash or perl. + +`opts` is optional and acts like calling `.options(opts)`. + +.version(version, [option], [description]) +---------------------------------------- + +Add an option (e.g. `--version`) that displays the version number (given by the +`version` parameter) and exits the process. If present, the `description` +parameter customizes the description of the version option in the usage string. + +You can provide a `function` for version, rather than a string. +This is useful if you want to use the version from your package.json: + +```js +var argv = require('yargs') + .version(function() { + return require('../package').version; + }) + .argv; +``` + +.wrap(columns) +-------------- + +Format usage output to wrap at `columns` many columns. + +By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to +specify no column limit (no right-align). Use `.wrap(yargs.terminalWidth())` to +maximize the width of yargs' usage instructions. + +parsing tricks +============== + +stop parsing +------------ + +Use `--` to stop parsing flags and stuff the remainder into `argv._`. + + $ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4 + { _: [ '-c', '3', '-d', '4' ], + a: 1, + b: 2, + '$0': 'examples/reflect.js' } + +negate fields +------------- + +If you want to explicitly set a field to false instead of just leaving it +undefined or to override a default you can do `--no-key`. + + $ node examples/reflect.js -a --no-b + { _: [], a: true, b: false, '$0': 'examples/reflect.js' } + +numbers +------- + +Every argument that looks like a number (`!isNaN(Number(arg))`) is converted to +one. This way you can just `net.createConnection(argv.port)` and you can add +numbers out of `argv` with `+` without having that mean concatenation, +which is super frustrating. + +duplicates +---------- + +If you specify a flag multiple times it will get turned into an array containing +all the values in order. + + $ node examples/reflect.js -x 5 -x 8 -x 0 + { _: [], x: [ 5, 8, 0 ], '$0': 'examples/reflect.js' } + +dot notation +------------ + +When you use dots (`.`s) in argument names, an implicit object path is assumed. +This lets you organize arguments into nested objects. + + $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5 + { _: [], + foo: { bar: { baz: 33 }, quux: 5 }, + '$0': 'examples/reflect.js' } + +short numbers +------------- + +Short numeric `-n5` style arguments work too: + + $ node examples/reflect.js -n123 -m456 + { _: [], n: 123, m: 456, '$0': 'examples/reflect.js' } + +installation +============ + +With [npm](https://github.com/npm/npm), just do: + + npm install yargs + +or clone this project on github: + + git clone http://github.com/bcoe/yargs.git + +To run the tests with npm, just do: + + npm test + +inspired by +=========== + +This module is loosely inspired by Perl's +[Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm). + + + +[travis-url]: https://travis-ci.org/bcoe/yargs +[travis-image]: https://img.shields.io/travis/bcoe/yargs.svg +[gemnasium-url]: https://gemnasium.com/bcoe/yargs +[gemnasium-image]: https://img.shields.io/gemnasium/bcoe/yargs.svg +[coveralls-url]: https://coveralls.io/github/bcoe/yargs +[coveralls-image]: https://img.shields.io/coveralls/bcoe/yargs.svg +[npm-url]: https://www.npmjs.com/package/yargs +[npm-image]: https://img.shields.io/npm/v/yargs.svg +[windows-url]: https://ci.appveyor.com/project/bcoe/yargs +[windows-image]: https://img.shields.io/appveyor/ci/bcoe/yargs/master.svg?label=Windows%20Tests diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/completion.sh.hbs b/legacy-libs/grpc-cloned/node_modules/yargs/completion.sh.hbs new file mode 100644 index 0000000..8392ad5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/completion.sh.hbs @@ -0,0 +1,28 @@ +###-begin-{{app_name}}-completions-### +# +# yargs command completion script +# +# Installation: {{app_path}} completion >> ~/.bashrc +# or {{app_path}} completion >> ~/.bash_profile on OSX. +# +_yargs_completions() +{ + local cur_word args type_list + + cur_word="${COMP_WORDS[COMP_CWORD]}" + args=$(printf "%s " "${COMP_WORDS[@]}") + + # ask yargs to generate completions. + type_list=`{{app_path}} --get-yargs-completions $args` + + COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) ) + + # if no match was found, fall back to filename completion + if [ ${#COMPREPLY[@]} -eq 0 ]; then + COMPREPLY=( $(compgen -f -- "${cur_word}" ) ) + fi + + return 0 +} +complete -F _yargs_completions {{app_name}} +###-end-{{app_name}}-completions-### diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/index.js b/legacy-libs/grpc-cloned/node_modules/yargs/index.js new file mode 100644 index 0000000..7b6a343 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/index.js @@ -0,0 +1,665 @@ +var assert = require('assert') +var Completion = require('./lib/completion') +var Parser = require('./lib/parser') +var path = require('path') +var tokenizeArgString = require('./lib/tokenize-arg-string') +var Usage = require('./lib/usage') +var Validation = require('./lib/validation') +var Y18n = require('y18n') + +Argv(process.argv.slice(2)) + +var exports = module.exports = Argv +function Argv (processArgs, cwd) { + processArgs = processArgs || [] // handle calling yargs(). + + var self = {} + var completion = null + var usage = null + var validation = null + var y18n = Y18n({ + directory: path.resolve(__dirname, './locales'), + updateFiles: false + }) + + if (!cwd) cwd = process.cwd() + + self.$0 = process.argv + .slice(0, 2) + .map(function (x, i) { + // ignore the node bin, specify this in your + // bin file with #!/usr/bin/env node + if (i === 0 && /\b(node|iojs)$/.test(x)) return + var b = rebase(cwd, x) + return x.match(/^\//) && b.length < x.length ? b : x + }) + .join(' ').trim() + + if (process.env._ !== undefined && process.argv[1] === process.env._) { + self.$0 = process.env._.replace( + path.dirname(process.execPath) + '/', '' + ) + } + + var options + self.resetOptions = self.reset = function () { + // put yargs back into its initial + // state, this is useful for creating a + // nested CLI. + options = { + array: [], + boolean: [], + string: [], + narg: {}, + key: {}, + alias: {}, + default: {}, + defaultDescription: {}, + choices: {}, + requiresArg: [], + count: [], + normalize: [], + config: {}, + envPrefix: undefined + } + + usage = Usage(self, y18n) // handle usage output. + validation = Validation(self, usage, y18n) // handle arg validation. + completion = Completion(self, usage) + + demanded = {} + groups = {} + + exitProcess = true + strict = false + helpOpt = null + versionOpt = null + commandHandlers = {} + self.parsed = false + + return self + } + self.resetOptions() + + self.boolean = function (bools) { + options.boolean.push.apply(options.boolean, [].concat(bools)) + return self + } + + self.array = function (arrays) { + options.array.push.apply(options.array, [].concat(arrays)) + return self + } + + self.nargs = function (key, n) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.nargs(k, key[k]) + }) + } else { + options.narg[key] = n + } + return self + } + + self.choices = function (key, values) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.choices(k, key[k]) + }) + } else { + options.choices[key] = (options.choices[key] || []).concat(values) + } + return self + } + + self.normalize = function (strings) { + options.normalize.push.apply(options.normalize, [].concat(strings)) + return self + } + + self.config = function (key, msg, parseFn) { + if (typeof msg === 'function') { + parseFn = msg + msg = null + } + self.describe(key, msg || usage.deferY18nLookup('Path to JSON config file')) + ;(Array.isArray(key) ? key : [key]).forEach(function (k) { + options.config[k] = parseFn || true + }) + return self + } + + self.example = function (cmd, description) { + usage.example(cmd, description) + return self + } + + self.command = function (cmd, description, fn) { + if (description !== false) { + usage.command(cmd, description) + } + if (fn) commandHandlers[cmd] = fn + return self + } + + var commandHandlers = {} + self.getCommandHandlers = function () { + return commandHandlers + } + + self.string = function (strings) { + options.string.push.apply(options.string, [].concat(strings)) + return self + } + + self.default = function (key, value, defaultDescription) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.default(k, key[k]) + }) + } else { + if (defaultDescription) options.defaultDescription[key] = defaultDescription + if (typeof value === 'function') { + if (!options.defaultDescription[key]) options.defaultDescription[key] = usage.functionDescription(value) + value = value.call() + } + options.default[key] = value + } + return self + } + + self.alias = function (x, y) { + if (typeof x === 'object') { + Object.keys(x).forEach(function (key) { + self.alias(key, x[key]) + }) + } else { + // perhaps 'x' is already an alias in another list? + // if so we should append to x's list. + var aliases = null + Object.keys(options.alias).forEach(function (key) { + if (~options.alias[key].indexOf(x)) aliases = options.alias[key] + }) + + if (aliases) { // x was an alias itself. + aliases.push(y) + } else { // x is a new alias key. + options.alias[x] = (options.alias[x] || []).concat(y) + } + + // wait! perhaps we've created two lists of aliases + // that reference each other? + if (options.alias[y]) { + Array.prototype.push.apply((options.alias[x] || aliases), options.alias[y]) + delete options.alias[y] + } + } + return self + } + + self.count = function (counts) { + options.count.push.apply(options.count, [].concat(counts)) + return self + } + + var demanded = {} + self.demand = self.required = self.require = function (keys, max, msg) { + // you can optionally provide a 'max' key, + // which will raise an exception if too many '_' + // options are provided. + if (typeof max !== 'number') { + msg = max + max = Infinity + } + + if (typeof keys === 'number') { + if (!demanded._) demanded._ = { count: 0, msg: null, max: max } + demanded._.count = keys + demanded._.msg = msg + } else if (Array.isArray(keys)) { + keys.forEach(function (key) { + self.demand(key, msg) + }) + } else { + if (typeof msg === 'string') { + demanded[keys] = { msg: msg } + } else if (msg === true || typeof msg === 'undefined') { + demanded[keys] = { msg: undefined } + } + } + + return self + } + self.getDemanded = function () { + return demanded + } + + self.requiresArg = function (requiresArgs) { + options.requiresArg.push.apply(options.requiresArg, [].concat(requiresArgs)) + return self + } + + self.implies = function (key, value) { + validation.implies(key, value) + return self + } + + self.usage = function (msg, opts) { + if (!opts && typeof msg === 'object') { + opts = msg + msg = null + } + + usage.usage(msg) + + if (opts) self.options(opts) + + return self + } + + self.epilogue = self.epilog = function (msg) { + usage.epilog(msg) + return self + } + + self.fail = function (f) { + usage.failFn(f) + return self + } + + self.check = function (f) { + validation.check(f) + return self + } + + self.defaults = self.default + + self.describe = function (key, desc) { + options.key[key] = true + usage.describe(key, desc) + return self + } + + self.parse = function (args) { + return parseArgs(args) + } + + self.option = self.options = function (key, opt) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.options(k, key[k]) + }) + } else { + assert(typeof opt === 'object', 'second argument to option must be an object') + + options.key[key] = true // track manually set keys. + + if (opt.alias) self.alias(key, opt.alias) + + var demand = opt.demand || opt.required || opt.require + + if (demand) { + self.demand(key, demand) + } if ('config' in opt) { + self.config(key, opt.configParser) + } if ('default' in opt) { + self.default(key, opt.default) + } if ('nargs' in opt) { + self.nargs(key, opt.nargs) + } if ('choices' in opt) { + self.choices(key, opt.choices) + } if ('group' in opt) { + self.group(key, opt.group) + } if (opt.boolean || opt.type === 'boolean') { + self.boolean(key) + if (opt.alias) self.boolean(opt.alias) + } if (opt.array || opt.type === 'array') { + self.array(key) + if (opt.alias) self.array(opt.alias) + } if (opt.string || opt.type === 'string') { + self.string(key) + if (opt.alias) self.string(opt.alias) + } if (opt.count || opt.type === 'count') { + self.count(key) + } if (opt.defaultDescription) { + options.defaultDescription[key] = opt.defaultDescription + } + + var desc = opt.describe || opt.description || opt.desc + if (desc) { + self.describe(key, desc) + } + + if (opt.requiresArg) { + self.requiresArg(key) + } + } + + return self + } + self.getOptions = function () { + return options + } + + var groups = {} + self.group = function (opts, groupName) { + var seen = {} + groups[groupName] = (groups[groupName] || []).concat(opts).filter(function (key) { + if (seen[key]) return false + return (seen[key] = true) + }) + return self + } + self.getGroups = function () { + return groups + } + + // as long as options.envPrefix is not undefined, + // parser will apply env vars matching prefix to argv + self.env = function (prefix) { + if (prefix === false) options.envPrefix = undefined + else options.envPrefix = prefix || '' + return self + } + + self.wrap = function (cols) { + usage.wrap(cols) + return self + } + + var strict = false + self.strict = function () { + strict = true + return self + } + self.getStrict = function () { + return strict + } + + self.showHelp = function (level) { + if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed. + usage.showHelp(level) + return self + } + + var versionOpt = null + self.version = function (ver, opt, msg) { + versionOpt = opt || 'version' + usage.version(ver) + self.boolean(versionOpt) + self.describe(versionOpt, msg || usage.deferY18nLookup('Show version number')) + return self + } + + var helpOpt = null + self.addHelpOpt = function (opt, msg) { + helpOpt = opt + self.boolean(opt) + self.describe(opt, msg || usage.deferY18nLookup('Show help')) + return self + } + + self.showHelpOnFail = function (enabled, message) { + usage.showHelpOnFail(enabled, message) + return self + } + + var exitProcess = true + self.exitProcess = function (enabled) { + if (typeof enabled !== 'boolean') { + enabled = true + } + exitProcess = enabled + return self + } + self.getExitProcess = function () { + return exitProcess + } + + self.help = function () { + if (arguments.length > 0) return self.addHelpOpt.apply(self, arguments) + + if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed. + + return usage.help() + } + + var completionCommand = null + self.completion = function (cmd, desc, fn) { + // a function to execute when generating + // completions can be provided as the second + // or third argument to completion. + if (typeof desc === 'function') { + fn = desc + desc = null + } + + // register the completion command. + completionCommand = cmd || 'completion' + if (!desc && desc !== false) { + desc = 'generate bash completion script' + } + self.command(completionCommand, desc) + + // a function can be provided + if (fn) completion.registerFunction(fn) + + return self + } + + self.showCompletionScript = function ($0) { + $0 = $0 || self.$0 + console.log(completion.generateCompletionScript($0)) + return self + } + + self.locale = function (locale) { + if (arguments.length === 0) { + guessLocale() + return y18n.getLocale() + } + detectLocale = false + y18n.setLocale(locale) + return self + } + + self.updateStrings = self.updateLocale = function (obj) { + detectLocale = false + y18n.updateLocale(obj) + return self + } + + var detectLocale = true + self.detectLocale = function (detect) { + detectLocale = detect + return self + } + self.getDetectLocale = function () { + return detectLocale + } + + self.getUsageInstance = function () { + return usage + } + + self.getValidationInstance = function () { + return validation + } + + self.terminalWidth = function () { + return require('window-size').width + } + + Object.defineProperty(self, 'argv', { + get: function () { + var args = null + + try { + args = parseArgs(processArgs) + } catch (err) { + usage.fail(err.message) + } + + return args + }, + enumerable: true + }) + + function parseArgs (args) { + args = normalizeArgs(args) + + var parsed = Parser(args, options, y18n) + var argv = parsed.argv + var aliases = parsed.aliases + + argv.$0 = self.$0 + + self.parsed = parsed + + guessLocale() // guess locale lazily, so that it can be turned off in chain. + + // while building up the argv object, there + // are two passes through the parser. If completion + // is being performed short-circuit on the first pass. + if (completionCommand && + (process.argv.join(' ')).indexOf(completion.completionKey) !== -1 && + !argv[completion.completionKey]) { + return argv + } + + // if there's a handler associated with a + // command defer processing to it. + var handlerKeys = Object.keys(self.getCommandHandlers()) + for (var i = 0, command; (command = handlerKeys[i]) !== undefined; i++) { + if (~argv._.indexOf(command)) { + runCommand(command, self, argv) + return self.argv + } + } + + // generate a completion script for adding to ~/.bashrc. + if (completionCommand && ~argv._.indexOf(completionCommand) && !argv[completion.completionKey]) { + self.showCompletionScript() + if (exitProcess) { + process.exit(0) + } + } + + // we must run completions first, a user might + // want to complete the --help or --version option. + if (completion.completionKey in argv) { + // we allow for asynchronous completions, + // e.g., loading in a list of commands from an API. + completion.getCompletion(function (completions) { + ;(completions || []).forEach(function (completion) { + console.log(completion) + }) + + if (exitProcess) { + process.exit(0) + } + }) + return + } + + var helpOrVersion = false + Object.keys(argv).forEach(function (key) { + if (key === helpOpt && argv[key]) { + helpOrVersion = true + self.showHelp('log') + if (exitProcess) { + process.exit(0) + } + } else if (key === versionOpt && argv[key]) { + helpOrVersion = true + usage.showVersion() + if (exitProcess) { + process.exit(0) + } + } + }) + + // If the help or version options where used and exitProcess is false, + // we won't run validations + if (!helpOrVersion) { + if (parsed.error) throw parsed.error + + // if we're executed via bash completion, don't + // bother with validation. + if (!argv[completion.completionKey]) { + validation.nonOptionCount(argv) + validation.missingArgumentValue(argv) + validation.requiredArguments(argv) + if (strict) validation.unknownArguments(argv, aliases) + validation.customChecks(argv, aliases) + validation.limitedChoices(argv) + validation.implications(argv) + } + } + + setPlaceholderKeys(argv) + + return argv + } + + function guessLocale () { + if (!detectLocale) return + + try { + var osLocale = require('os-locale') + self.locale(osLocale.sync({ spawn: false })) + } catch (err) { + // if we explode looking up locale just noop + // we'll keep using the default language 'en'. + } + } + + function runCommand (command, yargs, argv) { + setPlaceholderKeys(argv) + yargs.getCommandHandlers()[command](yargs.reset(), argv) + } + + function setPlaceholderKeys (argv) { + Object.keys(options.key).forEach(function (key) { + // don't set placeholder keys for dot + // notation options 'foo.bar'. + if (~key.indexOf('.')) return + if (typeof argv[key] === 'undefined') argv[key] = undefined + }) + } + + function normalizeArgs (args) { + if (typeof args === 'string') { + return tokenizeArgString(args) + } + return args + } + + singletonify(self) + return self +} + +// rebase an absolute path to a relative one with respect to a base directory +// exported for tests +exports.rebase = rebase +function rebase (base, dir) { + return path.relative(base, dir) +} + +/* Hack an instance of Argv with process.argv into Argv + so people can do + require('yargs')(['--beeble=1','-z','zizzle']).argv + to parse a list of args and + require('yargs').argv + to get a parsed version of process.argv. +*/ +function singletonify (inst) { + Object.keys(inst).forEach(function (key) { + if (key === 'argv') { + Argv.__defineGetter__(key, inst.__lookupGetter__(key)) + } else { + Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key] + } + }) +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/lib/completion.js b/legacy-libs/grpc-cloned/node_modules/yargs/lib/completion.js new file mode 100644 index 0000000..576012f --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/lib/completion.js @@ -0,0 +1,91 @@ +var fs = require('fs') +var path = require('path') + +// add bash completions to your +// yargs-powered applications. +module.exports = function (yargs, usage) { + var self = { + completionKey: 'get-yargs-completions' + } + + // get a list of completion commands. + self.getCompletion = function (done) { + var completions = [] + var current = process.argv[process.argv.length - 1] + var previous = process.argv.slice(process.argv.indexOf('--' + self.completionKey) + 1) + var argv = yargs.parse(previous) + + // a custom completion function can be provided + // to completion(). + if (completionFunction) { + if (completionFunction.length < 3) { + var result = completionFunction(current, argv) + + // promise based completion function. + if (typeof result.then === 'function') { + return result.then(function (list) { + process.nextTick(function () { done(list) }) + }).catch(function (err) { + process.nextTick(function () { throw err }) + }) + } + + // synchronous completion function. + return done(result) + } else { + // asynchronous completion function + return completionFunction(current, argv, function (completions) { + done(completions) + }) + } + } + + var handlers = yargs.getCommandHandlers() + for (var i = 0, ii = previous.length; i < ii; ++i) { + if (handlers[previous[i]]) { + return handlers[previous[i]](yargs.reset()) + } + } + + if (!current.match(/^-/)) { + usage.getCommands().forEach(function (command) { + if (previous.indexOf(command[0]) === -1) { + completions.push(command[0]) + } + }) + } + + if (current.match(/^-/)) { + Object.keys(yargs.getOptions().key).forEach(function (key) { + completions.push('--' + key) + }) + } + + done(completions) + } + + // generate the completion script to add to your .bashrc. + self.generateCompletionScript = function ($0) { + var script = fs.readFileSync( + path.resolve(__dirname, '../completion.sh.hbs'), + 'utf-8' + ) + var name = path.basename($0) + + // add ./to applications not yet installed as bin. + if ($0.match(/\.js$/)) $0 = './' + $0 + + script = script.replace(/{{app_name}}/g, name) + return script.replace(/{{app_path}}/g, $0) + } + + // register a function to perform your own custom + // completions., this function can be either + // synchrnous or asynchronous. + var completionFunction = null + self.registerFunction = function (fn) { + completionFunction = fn + } + + return self +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/lib/parser.js b/legacy-libs/grpc-cloned/node_modules/yargs/lib/parser.js new file mode 100644 index 0000000..f5f68e9 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/lib/parser.js @@ -0,0 +1,520 @@ +// fancy-pants parsing of argv, originally forked +// from minimist: https://www.npmjs.com/package/minimist +var camelCase = require('camelcase') +var path = require('path') + +function increment (orig) { + return orig !== undefined ? orig + 1 : 0 +} + +module.exports = function (args, opts, y18n) { + if (!opts) opts = {} + + var __ = y18n.__ + var error = null + var flags = { arrays: {}, bools: {}, strings: {}, counts: {}, normalize: {}, configs: {}, defaulted: {} } + + ;[].concat(opts['array']).filter(Boolean).forEach(function (key) { + flags.arrays[key] = true + }) + + ;[].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true + }) + + ;[].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true + }) + + ;[].concat(opts.count).filter(Boolean).forEach(function (key) { + flags.counts[key] = true + }) + + ;[].concat(opts.normalize).filter(Boolean).forEach(function (key) { + flags.normalize[key] = true + }) + + Object.keys(opts.config).forEach(function (k) { + flags.configs[k] = opts.config[k] + }) + + var aliases = {} + var newAliases = {} + + extendAliases(opts.key) + extendAliases(opts.alias) + extendAliases(opts.default) + + var defaults = opts['default'] || {} + Object.keys(defaults).forEach(function (key) { + if (/-/.test(key) && !opts.alias[key]) { + aliases[key] = aliases[key] || [] + } + (aliases[key] || []).forEach(function (alias) { + defaults[alias] = defaults[key] + }) + }) + + var argv = { _: [] } + + Object.keys(flags.bools).forEach(function (key) { + setArg(key, !(key in defaults) ? false : defaults[key]) + setDefaulted(key) + }) + + var notFlags = [] + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--') + 1) + args = args.slice(0, args.indexOf('--')) + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i] + var broken + var key + var letters + var m + var next + var value + + // -- seperated by = + if (arg.match(/^--.+=/)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + m = arg.match(/^--([^=]+)=([\s\S]*)$/) + + // nargs format = '--f=monkey washing cat' + if (checkAllAliases(m[1], opts.narg)) { + args.splice(i + 1, m[1], m[2]) + i = eatNargs(i, m[1], args) + // arrays format = '--f=a b c' + } else if (checkAllAliases(m[1], flags.arrays) && args.length > i + 1) { + args.splice(i + 1, m[1], m[2]) + i = eatArray(i, m[1], args) + } else { + setArg(m[1], m[2]) + } + } else if (arg.match(/^--no-.+/)) { + key = arg.match(/^--no-(.+)/)[1] + setArg(key, false) + + // -- seperated by space. + } else if (arg.match(/^--.+/)) { + key = arg.match(/^--(.+)/)[1] + + // nargs format = '--foo a b c' + if (checkAllAliases(key, opts.narg)) { + i = eatNargs(i, key, args) + // array format = '--foo a b c' + } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) { + i = eatArray(i, key, args) + } else { + next = args[i + 1] + + if (next !== undefined && !next.match(/^-/) && + !checkAllAliases(key, flags.bools) && + !checkAllAliases(key, flags.counts)) { + setArg(key, next) + i++ + } else if (/^(true|false)$/.test(next)) { + setArg(key, next) + i++ + } else { + setArg(key, defaultForType(guessType(key, flags))) + } + } + + // dot-notation flag seperated by '='. + } else if (arg.match(/^-.\..+=/)) { + m = arg.match(/^-([^=]+)=([\s\S]*)$/) + setArg(m[1], m[2]) + + // dot-notation flag seperated by space. + } else if (arg.match(/^-.\..+/)) { + next = args[i + 1] + key = arg.match(/^-(.\..+)/)[1] + + if (next !== undefined && !next.match(/^-/) && + !checkAllAliases(key, flags.bools) && + !checkAllAliases(key, flags.counts)) { + setArg(key, next) + i++ + } else { + setArg(key, defaultForType(guessType(key, flags))) + } + } else if (arg.match(/^-[^-]+/)) { + letters = arg.slice(1, -1).split('') + broken = false + + for (var j = 0; j < letters.length; j++) { + next = arg.slice(j + 2) + + if (letters[j + 1] && letters[j + 1] === '=') { + value = arg.slice(j + 3) + key = letters[j] + + // nargs format = '-f=monkey washing cat' + if (checkAllAliases(letters[j], opts.narg)) { + args.splice(i + 1, 0, value) + i = eatNargs(i, key, args) + // array format = '-f=a b c' + } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) { + args.splice(i + 1, 0, value) + i = eatArray(i, key, args) + } else { + setArg(key, value) + } + + broken = true + break + } + + if (next === '-') { + setArg(letters[j], next) + continue + } + + if (/[A-Za-z]/.test(letters[j]) && + /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next) + broken = true + break + } + + if (letters[j + 1] && letters[j + 1].match(/\W/)) { + setArg(letters[j], arg.slice(j + 2)) + broken = true + break + } else { + setArg(letters[j], defaultForType(guessType(letters[j], flags))) + } + } + + key = arg.slice(-1)[0] + + if (!broken && key !== '-') { + // nargs format = '-f a b c' + if (checkAllAliases(key, opts.narg)) { + i = eatNargs(i, key, args) + // array format = '-f a b c' + } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) { + i = eatArray(i, key, args) + } else { + if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && + !checkAllAliases(key, flags.bools) && + !checkAllAliases(key, flags.counts)) { + setArg(key, args[i + 1]) + i++ + } else if (args[i + 1] && /true|false/.test(args[i + 1])) { + setArg(key, args[i + 1]) + i++ + } else { + setArg(key, defaultForType(guessType(key, flags))) + } + } + } + } else { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ) + } + } + + // order of precedence: + // 1. command line arg + // 2. value from config file + // 3. value from env var + // 4. configured default value + applyEnvVars(opts, argv, true) // special case: check env vars that point to config file + setConfig(argv) + applyEnvVars(opts, argv, false) + applyDefaultsAndAliases(argv, aliases, defaults) + + Object.keys(flags.counts).forEach(function (key) { + setArg(key, defaults[key]) + }) + + notFlags.forEach(function (key) { + argv._.push(key) + }) + + // how many arguments should we consume, based + // on the nargs option? + function eatNargs (i, key, args) { + var toEat = checkAllAliases(key, opts.narg) + + if (args.length - (i + 1) < toEat) error = Error(__('Not enough arguments following: %s', key)) + + for (var ii = i + 1; ii < (toEat + i + 1); ii++) { + setArg(key, args[ii]) + } + + return (i + toEat) + } + + // if an option is an array, eat all non-hyphenated arguments + // following it... YUM! + // e.g., --foo apple banana cat becomes ["apple", "banana", "cat"] + function eatArray (i, key, args) { + for (var ii = i + 1; ii < args.length; ii++) { + if (/^-/.test(args[ii])) break + i = ii + setArg(key, args[ii]) + } + + return i + } + + function setArg (key, val) { + unsetDefaulted(key) + + // handle parsing boolean arguments --foo=true --bar false. + if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) { + if (typeof val === 'string') val = val === 'true' + } + + if (/-/.test(key) && !(aliases[key] && aliases[key].length)) { + var c = camelCase(key) + aliases[key] = [c] + newAliases[c] = true + } + + var value = !checkAllAliases(key, flags.strings) && isNumber(val) ? Number(val) : val + + if (checkAllAliases(key, flags.counts)) { + value = increment + } + + var splitKey = key.split('.') + setKey(argv, splitKey, value) + + // alias references an inner-value within + // a dot-notation object. see #279. + if (~key.indexOf('.') && aliases[key]) { + aliases[key].forEach(function (x) { + x = x.split('.') + setKey(argv, x, value) + }) + } + + ;(aliases[splitKey[0]] || []).forEach(function (x) { + x = x.split('.') + + // handle populating dot notation for both + // the key and its aliases. + if (splitKey.length > 1) { + var a = [].concat(splitKey) + a.shift() // nuke the old key. + x = x.concat(a) + } + + setKey(argv, x, value) + }) + + var keys = [key].concat(aliases[key] || []) + for (var i = 0, l = keys.length; i < l; i++) { + if (flags.normalize[keys[i]]) { + keys.forEach(function (key) { + argv.__defineSetter__(key, function (v) { + val = path.normalize(v) + }) + + argv.__defineGetter__(key, function () { + return typeof val === 'string' ? path.normalize(val) : val + }) + }) + break + } + } + } + + // set args from config.json file, this should be + // applied last so that defaults can be applied. + function setConfig (argv) { + var configLookup = {} + + // expand defaults/aliases, in-case any happen to reference + // the config.json file. + applyDefaultsAndAliases(configLookup, aliases, defaults) + + Object.keys(flags.configs).forEach(function (configKey) { + var configPath = argv[configKey] || configLookup[configKey] + if (configPath) { + try { + var config = null + var resolvedConfigPath = path.resolve(process.cwd(), configPath) + + if (typeof flags.configs[configKey] === 'function') { + try { + config = flags.configs[configKey](resolvedConfigPath) + } catch (e) { + config = e + } + if (config instanceof Error) { + error = config + return + } + } else { + config = require(resolvedConfigPath) + } + + Object.keys(config).forEach(function (key) { + // setting arguments via CLI takes precedence over + // values within the config file. + if (argv[key] === undefined || (flags.defaulted[key])) { + delete argv[key] + setArg(key, config[key]) + } + }) + } catch (ex) { + if (argv[configKey]) error = Error(__('Invalid JSON config file: %s', configPath)) + } + } + }) + } + + function applyEnvVars (opts, argv, configOnly) { + if (typeof opts.envPrefix === 'undefined') return + + var prefix = typeof opts.envPrefix === 'string' ? opts.envPrefix : '' + Object.keys(process.env).forEach(function (envVar) { + if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) { + var key = camelCase(envVar.substring(prefix.length)) + if (((configOnly && flags.configs[key]) || !configOnly) && (!(key in argv) || flags.defaulted[key])) { + setArg(key, process.env[envVar]) + } + } + }) + } + + function applyDefaultsAndAliases (obj, aliases, defaults) { + Object.keys(defaults).forEach(function (key) { + if (!hasKey(obj, key.split('.'))) { + setKey(obj, key.split('.'), defaults[key]) + + ;(aliases[key] || []).forEach(function (x) { + if (hasKey(obj, x.split('.'))) return + setKey(obj, x.split('.'), defaults[key]) + }) + } + }) + } + + function hasKey (obj, keys) { + var o = obj + keys.slice(0, -1).forEach(function (key) { + o = (o[key] || {}) + }) + + var key = keys[keys.length - 1] + + if (typeof o !== 'object') return false + else return key in o + } + + function setKey (obj, keys, value) { + var o = obj + keys.slice(0, -1).forEach(function (key) { + if (o[key] === undefined) o[key] = {} + o = o[key] + }) + + var key = keys[keys.length - 1] + if (value === increment) { + o[key] = increment(o[key]) + } else if (o[key] === undefined && checkAllAliases(key, flags.arrays)) { + o[key] = Array.isArray(value) ? value : [value] + } else if (o[key] === undefined || typeof o[key] === 'boolean') { + o[key] = value + } else if (Array.isArray(o[key])) { + o[key].push(value) + } else { + o[key] = [ o[key], value ] + } + } + + // extend the aliases list with inferred aliases. + function extendAliases (obj) { + Object.keys(obj || {}).forEach(function (key) { + // short-circuit if we've already added a key + // to the aliases array, for example it might + // exist in both 'opts.default' and 'opts.key'. + if (aliases[key]) return + + aliases[key] = [].concat(opts.alias[key] || []) + // For "--option-name", also set argv.optionName + aliases[key].concat(key).forEach(function (x) { + if (/-/.test(x)) { + var c = camelCase(x) + aliases[key].push(c) + newAliases[c] = true + } + }) + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y + })) + }) + }) + } + + // check if a flag is set for any of a key's aliases. + function checkAllAliases (key, flag) { + var isSet = false + var toCheck = [].concat(aliases[key] || [], key) + + toCheck.forEach(function (key) { + if (flag[key]) isSet = flag[key] + }) + + return isSet + } + + function setDefaulted (key) { + [].concat(aliases[key] || [], key).forEach(function (k) { + flags.defaulted[k] = true + }) + } + + function unsetDefaulted (key) { + [].concat(aliases[key] || [], key).forEach(function (k) { + delete flags.defaulted[k] + }) + } + + // return a default value, given the type of a flag., + // e.g., key of type 'string' will default to '', rather than 'true'. + function defaultForType (type) { + var def = { + boolean: true, + string: '', + array: [] + } + + return def[type] + } + + // given a flag, enforce a default type. + function guessType (key, flags) { + var type = 'boolean' + + if (flags.strings && flags.strings[key]) type = 'string' + else if (flags.arrays && flags.arrays[key]) type = 'array' + + return type + } + + function isNumber (x) { + if (typeof x === 'number') return true + if (/^0x[0-9a-f]+$/i.test(x)) return true + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x) + } + + return { + argv: argv, + aliases: aliases, + error: error, + newAliases: newAliases + } +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/lib/tokenize-arg-string.js b/legacy-libs/grpc-cloned/node_modules/yargs/lib/tokenize-arg-string.js new file mode 100644 index 0000000..df43fa5 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/lib/tokenize-arg-string.js @@ -0,0 +1,32 @@ +// take an un-split argv string and tokenize it. +module.exports = function (argString) { + var i = 0 + var c = null + var opening = null + var args = [] + + for (var ii = 0; ii < argString.length; ii++) { + c = argString.charAt(ii) + + // split on spaces unless we're in quotes. + if (c === ' ' && !opening) { + i++ + continue + } + + // don't split the string if we're in matching + // opening or closing single and double quotes. + if (c === opening) { + opening = null + continue + } else if ((c === "'" || c === '"') && !opening) { + opening = c + continue + } + + if (!args[i]) args[i] = '' + args[i] += c + } + + return args +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/lib/usage.js b/legacy-libs/grpc-cloned/node_modules/yargs/lib/usage.js new file mode 100644 index 0000000..b1b59bc --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/lib/usage.js @@ -0,0 +1,383 @@ +// this file handles outputting usage instructions, +// failures, etc. keeps logging in one place. +var cliui = require('cliui') +var decamelize = require('decamelize') +var stringWidth = require('string-width') +var wsize = require('window-size') + +module.exports = function (yargs, y18n) { + var __ = y18n.__ + var self = {} + + // methods for ouputting/building failure message. + var fails = [] + self.failFn = function (f) { + fails.push(f) + } + + var failMessage = null + var showHelpOnFail = true + self.showHelpOnFail = function (enabled, message) { + if (typeof enabled === 'string') { + message = enabled + enabled = true + } else if (typeof enabled === 'undefined') { + enabled = true + } + failMessage = message + showHelpOnFail = enabled + return self + } + + var failureOutput = false + self.fail = function (msg) { + if (fails.length) { + fails.forEach(function (f) { + f(msg) + }) + } else { + // don't output failure message more than once + if (!failureOutput) { + failureOutput = true + if (showHelpOnFail) yargs.showHelp('error') + if (msg) console.error(msg) + if (failMessage) { + if (msg) console.error('') + console.error(failMessage) + } + } + if (yargs.getExitProcess()) { + process.exit(1) + } else { + throw new Error(msg) + } + } + } + + // methods for ouputting/building help (usage) message. + var usage + self.usage = function (msg) { + usage = msg + } + + var examples = [] + self.example = function (cmd, description) { + examples.push([cmd, description || '']) + } + + var commands = [] + self.command = function (cmd, description) { + commands.push([cmd, description || '']) + } + self.getCommands = function () { + return commands + } + + var descriptions = {} + self.describe = function (key, desc) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.describe(k, key[k]) + }) + } else { + descriptions[key] = desc + } + } + self.getDescriptions = function () { + return descriptions + } + + var epilog + self.epilog = function (msg) { + epilog = msg + } + + var wrap = windowWidth() + self.wrap = function (cols) { + wrap = cols + } + + var deferY18nLookupPrefix = '__yargsString__:' + self.deferY18nLookup = function (str) { + return deferY18nLookupPrefix + str + } + + var defaultGroup = 'Options:' + self.help = function () { + normalizeAliases() + + var demanded = yargs.getDemanded() + var groups = yargs.getGroups() + var options = yargs.getOptions() + var keys = Object.keys( + Object.keys(descriptions) + .concat(Object.keys(demanded)) + .concat(Object.keys(options.default)) + .reduce(function (acc, key) { + if (key !== '_') acc[key] = true + return acc + }, {}) + ) + var ui = cliui({ + width: wrap, + wrap: !!wrap + }) + + // the usage string. + if (usage) { + var u = usage.replace(/\$0/g, yargs.$0) + ui.div(u + '\n') + } + + // your application's commands, i.e., non-option + // arguments populated in '_'. + if (commands.length) { + ui.div(__('Commands:')) + + commands.forEach(function (command) { + ui.div( + {text: command[0], padding: [0, 2, 0, 2], width: maxWidth(commands) + 4}, + {text: command[1]} + ) + }) + + ui.div() + } + + // perform some cleanup on the keys array, making it + // only include top-level keys not their aliases. + var aliasKeys = (Object.keys(options.alias) || []) + .concat(Object.keys(yargs.parsed.newAliases) || []) + + keys = keys.filter(function (key) { + return !yargs.parsed.newAliases[key] && aliasKeys.every(function (alias) { + return (options.alias[alias] || []).indexOf(key) === -1 + }) + }) + + // populate 'Options:' group with any keys that have not + // explicitly had a group set. + if (!groups[defaultGroup]) groups[defaultGroup] = [] + addUngroupedKeys(keys, options.alias, groups) + + // display 'Options:' table along with any custom tables: + Object.keys(groups).forEach(function (groupName) { + if (!groups[groupName].length) return + + ui.div(__(groupName)) + + // if we've grouped the key 'f', but 'f' aliases 'foobar', + // normalizedKeys should contain only 'foobar'. + var normalizedKeys = groups[groupName].map(function (key) { + if (~aliasKeys.indexOf(key)) return key + for (var i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) { + if (~(options.alias[aliasKey] || []).indexOf(key)) return aliasKey + } + return key + }) + + // actually generate the switches string --foo, -f, --bar. + var switches = normalizedKeys.reduce(function (acc, key) { + acc[key] = [ key ].concat(options.alias[key] || []) + .map(function (sw) { + return (sw.length > 1 ? '--' : '-') + sw + }) + .join(', ') + + return acc + }, {}) + + normalizedKeys.forEach(function (key) { + var kswitch = switches[key] + var desc = descriptions[key] || '' + var type = null + + if (~desc.lastIndexOf(deferY18nLookupPrefix)) desc = __(desc.substring(deferY18nLookupPrefix.length)) + + if (~options.boolean.indexOf(key)) type = '[' + __('boolean') + ']' + if (~options.count.indexOf(key)) type = '[' + __('count') + ']' + if (~options.string.indexOf(key)) type = '[' + __('string') + ']' + if (~options.normalize.indexOf(key)) type = '[' + __('string') + ']' + if (~options.array.indexOf(key)) type = '[' + __('array') + ']' + + var extra = [ + type, + demanded[key] ? '[' + __('required') + ']' : null, + options.choices && options.choices[key] ? '[' + __('choices:') + ' ' + + self.stringifiedValues(options.choices[key]) + ']' : null, + defaultString(options.default[key], options.defaultDescription[key]) + ].filter(Boolean).join(' ') + + ui.span( + {text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches) + 4}, + desc + ) + + if (extra) ui.div({text: extra, padding: [0, 0, 0, 2], align: 'right'}) + else ui.div() + }) + + ui.div() + }) + + // describe some common use-cases for your application. + if (examples.length) { + ui.div(__('Examples:')) + + examples.forEach(function (example) { + example[0] = example[0].replace(/\$0/g, yargs.$0) + }) + + examples.forEach(function (example) { + ui.div( + {text: example[0], padding: [0, 2, 0, 2], width: maxWidth(examples) + 4}, + example[1] + ) + }) + + ui.div() + } + + // the usage string. + if (epilog) { + var e = epilog.replace(/\$0/g, yargs.$0) + ui.div(e + '\n') + } + + return ui.toString() + } + + // return the maximum width of a string + // in the left-hand column of a table. + function maxWidth (table) { + var width = 0 + + // table might be of the form [leftColumn], + // or {key: leftColumn}} + if (!Array.isArray(table)) { + table = Object.keys(table).map(function (key) { + return [table[key]] + }) + } + + table.forEach(function (v) { + width = Math.max(stringWidth(v[0]), width) + }) + + // if we've enabled 'wrap' we should limit + // the max-width of the left-column. + if (wrap) width = Math.min(width, parseInt(wrap * 0.5, 10)) + + return width + } + + // make sure any options set for aliases, + // are copied to the keys being aliased. + function normalizeAliases () { + var demanded = yargs.getDemanded() + var options = yargs.getOptions() + + ;(Object.keys(options.alias) || []).forEach(function (key) { + options.alias[key].forEach(function (alias) { + // copy descriptions. + if (descriptions[alias]) self.describe(key, descriptions[alias]) + // copy demanded. + if (demanded[alias]) yargs.demand(key, demanded[alias].msg) + // type messages. + if (~options.boolean.indexOf(alias)) yargs.boolean(key) + if (~options.count.indexOf(alias)) yargs.count(key) + if (~options.string.indexOf(alias)) yargs.string(key) + if (~options.normalize.indexOf(alias)) yargs.normalize(key) + if (~options.array.indexOf(alias)) yargs.array(key) + }) + }) + } + + // given a set of keys, place any keys that are + // ungrouped under the 'Options:' grouping. + function addUngroupedKeys (keys, aliases, groups) { + var groupedKeys = [] + var toCheck = null + Object.keys(groups).forEach(function (group) { + groupedKeys = groupedKeys.concat(groups[group]) + }) + + keys.forEach(function (key) { + toCheck = [key].concat(aliases[key]) + if (!toCheck.some(function (k) { + return groupedKeys.indexOf(k) !== -1 + })) { + groups[defaultGroup].push(key) + } + }) + return groupedKeys + } + + self.showHelp = function (level) { + level = level || 'error' + console[level](self.help()) + } + + self.functionDescription = function (fn) { + var description = fn.name ? decamelize(fn.name, '-') : __('generated-value') + return ['(', description, ')'].join('') + } + + self.stringifiedValues = function (values, separator) { + var string = '' + var sep = separator || ', ' + var array = [].concat(values) + + if (!values || !array.length) return string + + array.forEach(function (value) { + if (string.length) string += sep + string += JSON.stringify(value) + }) + + return string + } + + // format the default-value-string displayed in + // the right-hand column. + function defaultString (value, defaultDescription) { + var string = '[' + __('default:') + ' ' + + if (value === undefined && !defaultDescription) return null + + if (defaultDescription) { + string += defaultDescription + } else { + switch (typeof value) { + case 'string': + string += JSON.stringify(value) + break + case 'object': + string += JSON.stringify(value) + break + default: + string += value + } + } + + return string + ']' + } + + // guess the width of the console window, max-width 80. + function windowWidth () { + return wsize.width ? Math.min(80, wsize.width) : null + } + + // logic for displaying application version. + var version = null + self.version = function (ver, opt, msg) { + version = ver + } + + self.showVersion = function () { + if (typeof version === 'function') console.log(version()) + else console.log(version) + } + + return self +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/lib/validation.js b/legacy-libs/grpc-cloned/node_modules/yargs/lib/validation.js new file mode 100644 index 0000000..514bbff --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/lib/validation.js @@ -0,0 +1,249 @@ +// validation-type-stuff, missing params, +// bad implications, custom checks. +module.exports = function (yargs, usage, y18n) { + var __ = y18n.__ + var __n = y18n.__n + var self = {} + + // validate appropriate # of non-option + // arguments were provided, i.e., '_'. + self.nonOptionCount = function (argv) { + var demanded = yargs.getDemanded() + var _s = argv._.length + + if (demanded._ && (_s < demanded._.count || _s > demanded._.max)) { + if (demanded._.msg !== undefined) { + usage.fail(demanded._.msg) + } else if (_s < demanded._.count) { + usage.fail( + __('Not enough non-option arguments: got %s, need at least %s', argv._.length, demanded._.count) + ) + } else { + usage.fail( + __('Too many non-option arguments: got %s, maximum of %s', argv._.length, demanded._.max) + ) + } + } + } + + // make sure that any args that require an + // value (--foo=bar), have a value. + self.missingArgumentValue = function (argv) { + var defaultValues = [true, false, ''] + var options = yargs.getOptions() + + if (options.requiresArg.length > 0) { + var missingRequiredArgs = [] + + options.requiresArg.forEach(function (key) { + var value = argv[key] + + // if a value is explicitly requested, + // flag argument as missing if it does not + // look like foo=bar was entered. + if (~defaultValues.indexOf(value) || + (Array.isArray(value) && !value.length)) { + missingRequiredArgs.push(key) + } + }) + + if (missingRequiredArgs.length > 0) { + usage.fail(__n( + 'Missing argument value: %s', + 'Missing argument values: %s', + missingRequiredArgs.length, + missingRequiredArgs.join(', ') + )) + } + } + } + + // make sure all the required arguments are present. + self.requiredArguments = function (argv) { + var demanded = yargs.getDemanded() + var missing = null + + Object.keys(demanded).forEach(function (key) { + if (!argv.hasOwnProperty(key)) { + missing = missing || {} + missing[key] = demanded[key] + } + }) + + if (missing) { + var customMsgs = [] + Object.keys(missing).forEach(function (key) { + var msg = missing[key].msg + if (msg && customMsgs.indexOf(msg) < 0) { + customMsgs.push(msg) + } + }) + + var customMsg = customMsgs.length ? '\n' + customMsgs.join('\n') : '' + + usage.fail(__n( + 'Missing required argument: %s', + 'Missing required arguments: %s', + Object.keys(missing).length, + Object.keys(missing).join(', ') + customMsg + )) + } + } + + // check for unknown arguments (strict-mode). + self.unknownArguments = function (argv, aliases) { + var aliasLookup = {} + var descriptions = usage.getDescriptions() + var demanded = yargs.getDemanded() + var unknown = [] + + Object.keys(aliases).forEach(function (key) { + aliases[key].forEach(function (alias) { + aliasLookup[alias] = key + }) + }) + + Object.keys(argv).forEach(function (key) { + if (key !== '$0' && key !== '_' && + !descriptions.hasOwnProperty(key) && + !demanded.hasOwnProperty(key) && + !aliasLookup.hasOwnProperty(key)) { + unknown.push(key) + } + }) + + if (unknown.length > 0) { + usage.fail(__n( + 'Unknown argument: %s', + 'Unknown arguments: %s', + unknown.length, + unknown.join(', ') + )) + } + } + + // validate arguments limited to enumerated choices + self.limitedChoices = function (argv) { + var options = yargs.getOptions() + var invalid = {} + + if (!Object.keys(options.choices).length) return + + Object.keys(argv).forEach(function (key) { + if (key !== '$0' && key !== '_' && + options.choices.hasOwnProperty(key)) { + [].concat(argv[key]).forEach(function (value) { + // TODO case-insensitive configurability + if (options.choices[key].indexOf(value) === -1) { + invalid[key] = (invalid[key] || []).concat(value) + } + }) + } + }) + + var invalidKeys = Object.keys(invalid) + + if (!invalidKeys.length) return + + var msg = __('Invalid values:') + invalidKeys.forEach(function (key) { + msg += '\n ' + __( + 'Argument: %s, Given: %s, Choices: %s', + key, + usage.stringifiedValues(invalid[key]), + usage.stringifiedValues(options.choices[key]) + ) + }) + usage.fail(msg) + } + + // custom checks, added using the `check` option on yargs. + var checks = [] + self.check = function (f) { + checks.push(f) + } + + self.customChecks = function (argv, aliases) { + checks.forEach(function (f) { + try { + var result = f(argv, aliases) + if (!result) { + usage.fail(__('Argument check failed: %s', f.toString())) + } else if (typeof result === 'string') { + usage.fail(result) + } + } catch (err) { + usage.fail(err.message ? err.message : err) + } + }) + } + + // check implications, argument foo implies => argument bar. + var implied = {} + self.implies = function (key, value) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.implies(k, key[k]) + }) + } else { + implied[key] = value + } + } + self.getImplied = function () { + return implied + } + + self.implications = function (argv) { + var implyFail = [] + + Object.keys(implied).forEach(function (key) { + var num + var origKey = key + var value = implied[key] + + // convert string '1' to number 1 + num = Number(key) + key = isNaN(num) ? key : num + + if (typeof key === 'number') { + // check length of argv._ + key = argv._.length >= key + } else if (key.match(/^--no-.+/)) { + // check if key doesn't exist + key = key.match(/^--no-(.+)/)[1] + key = !argv[key] + } else { + // check if key exists + key = argv[key] + } + + num = Number(value) + value = isNaN(num) ? value : num + + if (typeof value === 'number') { + value = argv._.length >= value + } else if (value.match(/^--no-.+/)) { + value = value.match(/^--no-(.+)/)[1] + value = !argv[value] + } else { + value = argv[value] + } + + if (key && !value) { + implyFail.push(origKey) + } + }) + + if (implyFail.length) { + var msg = __('Implications failed:') + '\n' + + implyFail.forEach(function (key) { + msg += (' ' + key + ' -> ' + implied[key]) + }) + + usage.fail(msg) + } + } + + return self +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/de.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/de.json new file mode 100644 index 0000000..00b3907 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/de.json @@ -0,0 +1,36 @@ +{ + "Commands:": "Kommandos:", + "Options:": "Optionen:", + "Examples:": "Beispiele:", + "boolean": "boolean", + "count": "Zähler", + "string": "string", + "array": "array", + "required": "erforderlich", + "default:": "Standard:", + "choices:": "Möglichkeiten:", + "generated-value": "Generierter-Wert", + "Not enough non-option arguments: got %s, need at least %s": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt", + "Too many non-option arguments: got %s, maximum of %s": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt", + "Missing argument value: %s": { + "one": "Fehlender Argumentwert: %s", + "other": "Fehlende Argumentwerte: %s" + }, + "Missing required argument: %s": { + "one": "Fehlendes Argument: %s", + "other": "Fehlende Argumente: %s" + }, + "Unknown argument: %s": { + "one": "Unbekanntes Argument: %s", + "other": "Unbekannte Argumente: %s" + }, + "Invalid values:": "Unzulässige Werte:", + "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeben: %s, Möglichkeiten: %s", + "Argument check failed: %s": "Argumente-Check fehlgeschlagen: %s", + "Implications failed:": "Implikationen fehlgeschlagen:", + "Not enough arguments following: %s": "Nicht genügend Argumente nach: %s", + "Invalid JSON config file: %s": "Fehlerhafte JSON-Config Datei: %s", + "Path to JSON config file": "Pfad zur JSON-Config Datei", + "Show help": "Hilfe anzeigen", + "Show version number": "Version anzeigen" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/en.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/en.json new file mode 100644 index 0000000..ce19199 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/en.json @@ -0,0 +1,36 @@ +{ + "Commands:": "Commands:", + "Options:": "Options:", + "Examples:": "Examples:", + "boolean": "boolean", + "count": "count", + "string": "string", + "array": "array", + "required": "required", + "default:": "default:", + "choices:": "choices:", + "generated-value": "generated-value", + "Not enough non-option arguments: got %s, need at least %s": "Not enough non-option arguments: got %s, need at least %s", + "Too many non-option arguments: got %s, maximum of %s": "Too many non-option arguments: got %s, maximum of %s", + "Missing argument value: %s": { + "one": "Missing argument value: %s", + "other": "Missing argument values: %s" + }, + "Missing required argument: %s": { + "one": "Missing required argument: %s", + "other": "Missing required arguments: %s" + }, + "Unknown argument: %s": { + "one": "Unknown argument: %s", + "other": "Unknown arguments: %s" + }, + "Invalid values:": "Invalid values:", + "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s", + "Argument check failed: %s": "Argument check failed: %s", + "Implications failed:": "Implications failed:", + "Not enough arguments following: %s": "Not enough arguments following: %s", + "Invalid JSON config file: %s": "Invalid JSON config file: %s", + "Path to JSON config file": "Path to JSON config file", + "Show help": "Show help", + "Show version number": "Show version number" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/es.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/es.json new file mode 100644 index 0000000..c4f1917 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/es.json @@ -0,0 +1,36 @@ +{ + "Commands:": "Comandos:", + "Options:": "Opciones:", + "Examples:": "Ejemplos:", + "boolean": "boolean", + "count": "cuenta", + "string": "cadena de caracteres", + "array": "tabla", + "required": "requisito", + "default:": "defecto:", + "choices:": "selección:", + "generated-value": "valor-generado", + "Not enough non-option arguments: got %s, need at least %s": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s", + "Too many non-option arguments: got %s, maximum of %s": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s", + "Missing argument value: %s": { + "one": "Falta argumento: %s", + "other": "Faltan argumentos: %s" + }, + "Missing required argument: %s": { + "one": "Falta argumento requerido: %s", + "other": "Faltan argumentos requeridos: %s" + }, + "Unknown argument: %s": { + "one": "Argumento desconocido: %s", + "other": "Argumentos desconocidos: %s" + }, + "Invalid values:": "Valores inválidos:", + "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Recibido: %s, Selección: %s", + "Argument check failed: %s": "Verificación de argumento ha fracasado: %s", + "Implications failed:": "Implicaciones fracasadas:", + "Not enough arguments following: %s": "No hay suficientes argumentos después de: %s", + "Invalid JSON config file: %s": "Archivo de configuración JSON inválido: %s", + "Path to JSON config file": "Ruta al archivo de configuración JSON", + "Show help": "Muestra ayuda", + "Show version number": "Muestra número de versión" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/fr.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/fr.json new file mode 100644 index 0000000..49d068b --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/fr.json @@ -0,0 +1,36 @@ +{ + "Commands:": "Commandes:", + "Options:": "Options:", + "Examples:": "Exemples:", + "boolean": "booléen", + "count": "comptage", + "string": "chaine de caractère", + "array": "tableau", + "required": "requis", + "default:": "défaut:", + "choices:": "choix:", + "generated-value": "valeur générée", + "Not enough non-option arguments: got %s, need at least %s": "Pas assez d'arguments non-option: reçu %s, besoin d'au moins %s", + "Too many non-option arguments: got %s, maximum of %s": "Trop d'arguments non-option: reçu %s, maximum %s", + "Missing argument value: %s": { + "one": "Argument manquant: %s", + "other": "Arguments manquants: %s" + }, + "Missing required argument: %s": { + "one": "Argument requis manquant: %s", + "other": "Arguments requis manquants: %s" + }, + "Unknown argument: %s": { + "one": "Argument inconnu: %s", + "other": "Arguments inconnus: %s" + }, + "Invalid values:": "Valeurs invalides:", + "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Donné: %s, Choix: %s", + "Argument check failed: %s": "Echec de la vérification de l'argument: %s", + "Implications failed:": "Implications échouées:", + "Not enough arguments following: %s": "Pas assez d'arguments suivant: %s", + "Invalid JSON config file: %s": "Fichier de configuration JSON invalide: %s", + "Path to JSON config file": "Chemin du fichier de configuration JSON", + "Show help": "Affiche de l'aide", + "Show version number": "Affiche le numéro de version" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/id.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/id.json new file mode 100644 index 0000000..7cb7e56 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/id.json @@ -0,0 +1,37 @@ + +{ + "Commands:": "Perintah:", + "Options:": "Pilihan:", + "Examples:": "Contoh:", + "boolean": "boolean", + "count": "jumlah", + "string": "string", + "array": "larik", + "required": "diperlukan", + "default:": "bawaan:", + "choices:": "pilihan:", + "generated-value": "nilai-yang-dihasilkan", + "Not enough non-option arguments: got %s, need at least %s": "Argumen wajib kurang: hanya %s, minimal %s", + "Too many non-option arguments: got %s, maximum of %s": "Terlalu banyak argumen wajib: ada %s, maksimal %s", + "Missing argument value: %s": { + "one": "Kurang argumen: %s", + "other": "Kurang argumen: %s" + }, + "Missing required argument: %s": { + "one": "Kurang argumen wajib: %s", + "other": "Kurang argumen wajib: %s" + }, + "Unknown argument: %s": { + "one": "Argumen tak diketahui: %s", + "other": "Argumen tak diketahui: %s" + }, + "Invalid values:": "Nilai-nilai tidak valid:", + "Argument: %s, Given: %s, Choices: %s": "Argumen: %s, Diberikan: %s, Pilihan: %s", + "Argument check failed: %s": "Pemeriksaan argument gagal: %s", + "Implications failed:": "Implikasi gagal:", + "Not enough arguments following: %s": "Kurang argumen untuk: %s", + "Invalid JSON config file: %s": "Berkas konfigurasi JSON tidak valid: %s", + "Path to JSON config file": "Alamat berkas konfigurasi JSON", + "Show help": "Lihat bantuan", + "Show version number": "Lihat nomor versi" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/ja.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/ja.json new file mode 100644 index 0000000..21b8e52 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/ja.json @@ -0,0 +1,36 @@ +{ + "Commands:": "コマンド:", + "Options:": "オプション:", + "Examples:": "例:", + "boolean": "真偽", + "count": "カウント", + "string": "文字列", + "array": "配列", + "required": "必須", + "default:": "デフォルト:", + "choices:": "選択してください:", + "generated-value": "生成された値", + "Not enough non-option arguments: got %s, need at least %s": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:", + "Too many non-option arguments: got %s, maximum of %s": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:", + "Missing argument value: %s": { + "one": "引数が見つかりません: %s", + "other": "引数が見つかりません: %s" + }, + "Missing required argument: %s": { + "one": "必須の引数が見つかりません: %s", + "other": "必須の引数が見つかりません: %s" + }, + "Unknown argument: %s": { + "one": "未知の引数です: %s", + "other": "未知の引数です: %s" + }, + "Invalid values:": "不正な値です:", + "Argument: %s, Given: %s, Choices: %s": "引数は %s です。指定できるのは %s つです。選択してください: %s", + "Argument check failed: %s": "引数のチェックに失敗しました: %s", + "Implications failed:": "オプションの組み合わせで不正が生じました:", + "Not enough arguments following: %s": "次の引数が不足しています。: %s", + "Invalid JSON config file: %s": "JSONの設定ファイルが不正です: %s", + "Path to JSON config file": "JSONの設定ファイルまでのpath", + "Show help": "ヘルプを表示", + "Show version number": "バージョンを表示" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/ko.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/ko.json new file mode 100644 index 0000000..a16971a --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/ko.json @@ -0,0 +1,36 @@ +{ + "Commands:": "명령:", + "Options:": "옵션:", + "Examples:": "예시:", + "boolean": "여부", + "count": "개수", + "string": "문자열", + "array": "배열", + "required": "필수", + "default:": "기본:", + "choices:": "선택:", + "generated-value": "생성된 값", + "Not enough non-option arguments: got %s, need at least %s": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다", + "Too many non-option arguments: got %s, maximum of %s": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다", + "Missing argument value: %s": { + "one": "인자값을 받지 못했습니다: %s", + "other": "인자값들을 받지 못했습니다: %s" + }, + "Missing required argument: %s": { + "one": "필수 인자를 받지 못했습니다: %s", + "other": "필수 인자들을 받지 못했습니다: %s" + }, + "Unknown argument: %s": { + "one": "알 수 없는 인자입니다: %s", + "other": "알 수 없는 인자들입니다: %s" + }, + "Invalid values:": "잘못된 값입니다:", + "Argument: %s, Given: %s, Choices: %s": "인자: %s, 입력받은 값: %s, 선택지: %s", + "Argument check failed: %s": "유효하지 않은 인자입니다: %s", + "Implications failed:": "옵션의 조합이 잘못되었습니다:", + "Not enough arguments following: %s": "인자가 충분하게 주어지지 않았습니다: %s", + "Invalid JSON config file: %s": "유효하지 않은 JSON 설정파일입니다: %s", + "Path to JSON config file": "JSON 설정파일 경로", + "Show help": "도움말을 보여줍니다", + "Show version number": "버전 넘버를 보여줍니다" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/nb.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/nb.json new file mode 100644 index 0000000..65fa6ae --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/nb.json @@ -0,0 +1,36 @@ +{ + "Commands:": "Kommandoer:", + "Options:": "Alternativer:", + "Examples:": "Eksempler:", + "boolean": "boolsk", + "count": "antall", + "string": "streng", + "array": "matrise", + "required": "obligatorisk", + "default:": "standard:", + "choices:": "valg:", + "generated-value": "generert-verdi", + "Not enough non-option arguments: got %s, need at least %s": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s", + "Too many non-option arguments: got %s, maximum of %s": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s", + "Missing argument value: %s": { + "one": "Mangler argument verdi: %s", + "other": "Mangler argument verdier: %s" + }, + "Missing required argument: %s": { + "one": "Mangler obligatorisk argument: %s", + "other": "Mangler obligatoriske argumenter: %s" + }, + "Unknown argument: %s": { + "one": "Ukjent argument: %s", + "other": "Ukjente argumenter: %s" + }, + "Invalid values:": "Ugyldige verdier:", + "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gitt: %s, Valg: %s", + "Argument check failed: %s": "Argument sjekk mislyktes: %s", + "Implications failed:": "Konsekvensene mislyktes:", + "Not enough arguments following: %s": "Ikke nok følgende argumenter: %s", + "Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s", + "Path to JSON config file": "Bane til JSON konfigurasjonsfil", + "Show help": "Vis hjelp", + "Show version number": "Vis versjonsnummer" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/pirate.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/pirate.json new file mode 100644 index 0000000..1f4e19e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/pirate.json @@ -0,0 +1,12 @@ +{ + "Commands:": "Choose yer command:", + "Options:": "Options for me hearties!", + "Examples:": "Ex. marks the spot:", + "required": "requi-yar-ed", + "Missing required argument: %s": { + "one": "Ye be havin' to set the followin' argument land lubber: %s", + "other": "Ye be havin' to set the followin' arguments land lubber: %s" + }, + "Show help": "Parlay this here code of conduct", + "Show version number": "'Tis the version ye be askin' fer" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/pl.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/pl.json new file mode 100644 index 0000000..7d4c5be --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/pl.json @@ -0,0 +1,36 @@ +{ + "Commands:": "Polecenia:", + "Options:": "Opcje:", + "Examples:": "Przykłady:", + "boolean": "boolean", + "count": "ilość", + "string": "ciąg znaków", + "array": "tablica", + "required": "wymagany", + "default:": "domyślny:", + "choices:": "dostępne:", + "generated-value": "wygenerowana-wartość", + "Not enough non-option arguments: got %s, need at least %s": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s", + "Too many non-option arguments: got %s, maximum of %s": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s", + "Missing argument value: %s": { + "one": "Brak wartości dla argumentu: %s", + "other": "Brak wartości dla argumentów: %s" + }, + "Missing required argument: %s": { + "one": "Brak wymaganego argumentu: %s", + "other": "Brak wymaganych argumentów: %s" + }, + "Unknown argument: %s": { + "one": "Nieznany argument: %s", + "other": "Nieznane argumenty: %s" + }, + "Invalid values:": "Nieprawidłowe wartości:", + "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Otrzymano: %s, Dostępne: %s", + "Argument check failed: %s": "Weryfikacja argumentów nie powiodła się: %s", + "Implications failed:": "Założenia nie zostały spełnione:", + "Not enough arguments following: %s": "Niewystarczająca ilość argumentów następujących po: %s", + "Invalid JSON config file: %s": "Nieprawidłowy plik konfiguracyjny JSON: %s", + "Path to JSON config file": "Ścieżka do pliku konfiguracyjnego JSON", + "Show help": "Pokaż pomoc", + "Show version number": "Pokaż numer wersji" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/pt.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/pt.json new file mode 100644 index 0000000..6abbcd4 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/pt.json @@ -0,0 +1,36 @@ +{ + "Commands:": "Comandos:", + "Options:": "Opções:", + "Examples:": "Exemplos:", + "boolean": "boolean", + "count": "contagem", + "string": "cadeia de caracteres", + "array": "arranjo", + "required": "requerido", + "default:": "padrão:", + "choices:": "escolhas:", + "generated-value": "valor-gerado", + "Not enough non-option arguments: got %s, need at least %s": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s", + "Too many non-option arguments: got %s, maximum of %s": "Excesso de argumentos não opcionais: recebido %s, máximo de %s", + "Missing argument value: %s": { + "one": "Falta valor de argumento: %s", + "other": "Falta valores de argumento: %s" + }, + "Missing required argument: %s": { + "one": "Falta argumento obrigatório: %s", + "other": "Faltando argumentos obrigatórios: %s" + }, + "Unknown argument: %s": { + "one": "Argumento desconhecido: %s", + "other": "Argumentos desconhecidos: %s" + }, + "Invalid values:": "Valores inválidos:", + "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Escolhas: %s", + "Argument check failed: %s": "Verificação de argumento falhou: %s", + "Implications failed:": "Implicações falharam:", + "Not enough arguments following: %s": "Insuficientes argumentos a seguir: %s", + "Invalid JSON config file: %s": "Arquivo de configuração em JSON esta inválido: %s", + "Path to JSON config file": "Caminho para o arquivo de configuração em JSON", + "Show help": "Mostra ajuda", + "Show version number": "Mostra número de versão" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/pt_BR.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/pt_BR.json new file mode 100644 index 0000000..eb7544e --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/pt_BR.json @@ -0,0 +1,36 @@ +{ + "Commands:": "Comandos:", + "Options:": "Opções:", + "Examples:": "Exemplos:", + "boolean": "boolean", + "count": "contagem", + "string": "string", + "array": "array", + "required": "obrigatório", + "default:": "padrão:", + "choices:": "opções:", + "generated-value": "valor-gerado", + "Not enough non-option arguments: got %s, need at least %s": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s", + "Too many non-option arguments: got %s, maximum of %s": "Excesso de argumentos: recebido %s, máximo de %s", + "Missing argument value: %s": { + "one": "Falta valor de argumento: %s", + "other": "Falta valores de argumento: %s" + }, + "Missing required argument: %s": { + "one": "Falta argumento obrigatório: %s", + "other": "Faltando argumentos obrigatórios: %s" + }, + "Unknown argument: %s": { + "one": "Argumento desconhecido: %s", + "other": "Argumentos desconhecidos: %s" + }, + "Invalid values:": "Valores inválidos:", + "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Opções: %s", + "Argument check failed: %s": "Verificação de argumento falhou: %s", + "Implications failed:": "Implicações falharam:", + "Not enough arguments following: %s": "Argumentos insuficientes a seguir: %s", + "Invalid JSON config file: %s": "Arquivo JSON de configuração inválido: %s", + "Path to JSON config file": "Caminho para o arquivo JSON de configuração", + "Show help": "Exibe ajuda", + "Show version number": "Exibe a versão" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/tr.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/tr.json new file mode 100644 index 0000000..cef09d2 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/tr.json @@ -0,0 +1,36 @@ +{ + "Commands:": "Komutlar:", + "Options:": "Seçenekler:", + "Examples:": "Örnekler:", + "boolean": "boolean", + "count": "sayı", + "string": "string", + "array": "array", + "required": "zorunlu", + "default:": "varsayılan:", + "choices:": "seçimler:", + "generated-value": "oluşturulan-değer", + "Not enough non-option arguments: got %s, need at least %s": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli", + "Too many non-option arguments: got %s, maximum of %s": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s", + "Missing argument value: %s": { + "one": "Eksik argüman değeri: %s", + "other": "Eksik argüman değerleri: %s" + }, + "Missing required argument: %s": { + "one": "Eksik zorunlu argüman: %s", + "other": "Eksik zorunlu argümanlar: %s" + }, + "Unknown argument: %s": { + "one": "Bilinmeyen argüman: %s", + "other": "Bilinmeyen argümanlar: %s" + }, + "Invalid values:": "Geçersiz değerler:", + "Argument: %s, Given: %s, Choices: %s": "Argüman: %s, Verilen: %s, Seçimler: %s", + "Argument check failed: %s": "Argüman kontrolü başarısız oldu: %s", + "Implications failed:": "Sonuçlar başarısız oldu:", + "Not enough arguments following: %s": "%s için yeterli argüman bulunamadı", + "Invalid JSON config file: %s": "Geçersiz JSON yapılandırma dosyası: %s", + "Path to JSON config file": "JSON yapılandırma dosya konumu", + "Show help": "Yardım detaylarını göster", + "Show version number": "Versiyon detaylarını göster" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/locales/zh.json b/legacy-libs/grpc-cloned/node_modules/yargs/locales/zh.json new file mode 100644 index 0000000..7b01d71 --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/locales/zh.json @@ -0,0 +1,36 @@ +{ + "Commands:": "命令:", + "Options:": "选项:", + "Examples:": "示例:", + "boolean": "boolean", + "count": "count", + "string": "string", + "array": "array", + "required": "required", + "default:": "默认值:", + "choices:": "可选值:", + "generated-value": "生成的值", + "Not enough non-option arguments: got %s, need at least %s": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个", + "Too many non-option arguments: got %s, maximum of %s": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个", + "Missing argument value: %s": { + "one": "没有给此选项指定值:%s", + "other": "没有给这些选项指定值:%s" + }, + "Missing required argument: %s": { + "one": "缺少必须的选项:%s", + "other": "缺少这些必须的选项:%s" + }, + "Unknown argument: %s": { + "one": "无法识别的选项:%s", + "other": "无法识别这些选项:%s" + }, + "Invalid values:": "无效的选项值:", + "Argument: %s, Given: %s, Choices: %s": "选项名称: %s, 传入的值: %s, 可选的值:%s", + "Argument check failed: %s": "选项值验证失败:%s", + "Implications failed:": "缺少依赖的选项:", + "Not enough arguments following: %s": "没有提供足够的值给此选项:%s", + "Invalid JSON config file: %s": "无效的 JSON 配置文件:%s", + "Path to JSON config file": "JSON 配置文件的路径", + "Show help": "显示帮助信息", + "Show version number": "显示版本号" +} diff --git a/legacy-libs/grpc-cloned/node_modules/yargs/package.json b/legacy-libs/grpc-cloned/node_modules/yargs/package.json new file mode 100644 index 0000000..953d8bc --- /dev/null +++ b/legacy-libs/grpc-cloned/node_modules/yargs/package.json @@ -0,0 +1,174 @@ +{ + "_args": [ + [ + { + "raw": "yargs@^3.10.0", + "scope": null, + "escapedName": "yargs", + "name": "yargs", + "rawSpec": "^3.10.0", + "spec": ">=3.10.0 <4.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/grpc/node_modules/protobufjs" + ] + ], + "_from": "yargs@>=3.10.0 <4.0.0", + "_id": "yargs@3.32.0", + "_inCache": true, + "_location": "/grpc/yargs", + "_nodeVersion": "3.2.0", + "_npmUser": { + "name": "bcoe", + "email": "ben@npmjs.com" + }, + "_npmVersion": "3.3.0", + "_phantomChildren": {}, + "_requested": { + "raw": "yargs@^3.10.0", + "scope": null, + "escapedName": "yargs", + "name": "yargs", + "rawSpec": "^3.10.0", + "spec": ">=3.10.0 <4.0.0", + "type": "range" + }, + "_requiredBy": [ + "/grpc/protobufjs" + ], + "_resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "_shasum": "03088e9ebf9e756b69751611d2a5ef591482c995", + "_shrinkwrap": null, + "_spec": "yargs@^3.10.0", + "_where": "/var/opt/motion2/node_modules/grpc/node_modules/protobufjs", + "author": { + "name": "Alex Ford", + "email": "Alex.Ford@CodeTunnel.com", + "url": "http://CodeTunnel.com" + }, + "bugs": { + "url": "https://github.com/bcoe/yargs/issues" + }, + "contributors": [ + { + "name": "Benjamin Coe", + "email": "ben@npmjs.com", + "url": "https://github.com/bcoe" + }, + { + "name": "Andrew Goode", + "url": "https://github.com/nexdrew" + }, + { + "name": "Chris Needham", + "email": "chris@chrisneedham.com", + "url": "http://chrisneedham.com" + }, + { + "name": "James Nylen", + "email": "jnylen@gmail.com", + "url": "https://github.com/nylen" + }, + { + "name": "Benjamin Horsleben", + "url": "https://github.com/fizker" + }, + { + "name": "Lin Clark", + "url": "https://github.com/linclark" + }, + { + "name": "Tim Schaub", + "url": "https://github.com/tschaub" + } + ], + "dependencies": { + "camelcase": "^2.0.1", + "cliui": "^3.0.3", + "decamelize": "^1.1.1", + "os-locale": "^1.4.0", + "string-width": "^1.0.1", + "window-size": "^0.1.4", + "y18n": "^3.2.0" + }, + "description": "Light-weight option parsing with an argv hash. No optstrings attached.", + "devDependencies": { + "chai": "^3.4.1", + "chalk": "^1.1.1", + "coveralls": "^2.11.4", + "es6-promise": "^3.0.2", + "hashish": "0.0.4", + "mocha": "^2.3.4", + "nyc": "^5.2.0", + "standard": "^5.4.1", + "which": "^1.1.2", + "win-spawn": "^2.0.0" + }, + "directories": {}, + "dist": { + "shasum": "03088e9ebf9e756b69751611d2a5ef591482c995", + "tarball": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz" + }, + "engine": { + "node": ">=0.10" + }, + "files": [ + "index.js", + "lib", + "locales", + "completion.sh.hbs", + "LICENSE" + ], + "gitHead": "e6eaddf457c27e71a0bbe156f17d2f82087f0d6f", + "homepage": "https://github.com/bcoe/yargs#readme", + "keywords": [ + "argument", + "args", + "option", + "parser", + "parsing", + "cli", + "command" + ], + "license": "MIT", + "main": "./index.js", + "maintainers": [ + { + "name": "bcoe", + "email": "ben@npmjs.com" + }, + { + "name": "chevex", + "email": "alex.ford@codetunnel.com" + }, + { + "name": "nexdrew", + "email": "andrew@npmjs.com" + }, + { + "name": "nylen", + "email": "jnylen@gmail.com" + } + ], + "name": "yargs", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/bcoe/yargs.git" + }, + "scripts": { + "coverage": "nyc report --reporter=text-lcov | coveralls", + "pretest": "standard", + "test": "nyc --cache mocha --timeout=4000 --check-leaks" + }, + "standard": { + "ignore": [ + "**/example/**" + ], + "globals": [ + "it" + ] + }, + "version": "3.32.0" +} diff --git a/legacy-libs/grpc/node_modules/abbrev/LICENSE b/legacy-libs/grpc/node_modules/abbrev/LICENSE new file mode 100644 index 0000000..9bcfa9d --- /dev/null +++ b/legacy-libs/grpc/node_modules/abbrev/LICENSE @@ -0,0 +1,46 @@ +This software is dual-licensed under the ISC and MIT licenses. +You may use this software under EITHER of the following licenses. + +---------- + +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. + +---------- + +Copyright Isaac Z. Schlueter and 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/legacy-libs/grpc/node_modules/abbrev/README.md b/legacy-libs/grpc/node_modules/abbrev/README.md new file mode 100644 index 0000000..99746fe --- /dev/null +++ b/legacy-libs/grpc/node_modules/abbrev/README.md @@ -0,0 +1,23 @@ +# abbrev-js + +Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev). + +Usage: + + var abbrev = require("abbrev"); + abbrev("foo", "fool", "folding", "flop"); + + // returns: + { fl: 'flop' + , flo: 'flop' + , flop: 'flop' + , fol: 'folding' + , fold: 'folding' + , foldi: 'folding' + , foldin: 'folding' + , folding: 'folding' + , foo: 'foo' + , fool: 'fool' + } + +This is handy for command-line scripts, or other cases where you want to be able to accept shorthands. diff --git a/legacy-libs/grpc/node_modules/abbrev/abbrev.js b/legacy-libs/grpc/node_modules/abbrev/abbrev.js new file mode 100644 index 0000000..7b1dc5d --- /dev/null +++ b/legacy-libs/grpc/node_modules/abbrev/abbrev.js @@ -0,0 +1,61 @@ +module.exports = exports = abbrev.abbrev = abbrev + +abbrev.monkeyPatch = monkeyPatch + +function monkeyPatch () { + Object.defineProperty(Array.prototype, 'abbrev', { + value: function () { return abbrev(this) }, + enumerable: false, configurable: true, writable: true + }) + + Object.defineProperty(Object.prototype, 'abbrev', { + value: function () { return abbrev(Object.keys(this)) }, + enumerable: false, configurable: true, writable: true + }) +} + +function abbrev (list) { + if (arguments.length !== 1 || !Array.isArray(list)) { + list = Array.prototype.slice.call(arguments, 0) + } + for (var i = 0, l = list.length, args = [] ; i < l ; i ++) { + args[i] = typeof list[i] === "string" ? list[i] : String(list[i]) + } + + // sort them lexicographically, so that they're next to their nearest kin + args = args.sort(lexSort) + + // walk through each, seeing how much it has in common with the next and previous + var abbrevs = {} + , prev = "" + for (var i = 0, l = args.length ; i < l ; i ++) { + var current = args[i] + , next = args[i + 1] || "" + , nextMatches = true + , prevMatches = true + if (current === next) continue + for (var j = 0, cl = current.length ; j < cl ; j ++) { + var curChar = current.charAt(j) + nextMatches = nextMatches && curChar === next.charAt(j) + prevMatches = prevMatches && curChar === prev.charAt(j) + if (!nextMatches && !prevMatches) { + j ++ + break + } + } + prev = current + if (j === cl) { + abbrevs[current] = current + continue + } + for (var a = current.substr(0, j) ; j <= cl ; j ++) { + abbrevs[a] = current + a += current.charAt(j) + } + } + return abbrevs +} + +function lexSort (a, b) { + return a === b ? 0 : a > b ? 1 : -1 +} diff --git a/legacy-libs/grpc/node_modules/abbrev/package.json b/legacy-libs/grpc/node_modules/abbrev/package.json new file mode 100644 index 0000000..1d5f62d --- /dev/null +++ b/legacy-libs/grpc/node_modules/abbrev/package.json @@ -0,0 +1,64 @@ +{ + "_args": [ + [ + "abbrev@1.1.1", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "abbrev@1.1.1", + "_id": "abbrev@1.1.1", + "_inBundle": false, + "_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "_location": "/grpc/abbrev", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "abbrev@1.1.1", + "name": "abbrev", + "escapedName": "abbrev", + "rawSpec": "1.1.1", + "saveSpec": null, + "fetchSpec": "1.1.1" + }, + "_requiredBy": [ + "/grpc/nopt" + ], + "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "_shrinkwrap": null, + "_spec": "1.1.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me" + }, + "bugs": { + "url": "https://github.com/isaacs/abbrev-js/issues" + }, + "dependencies": {}, + "description": "Like ruby's abbrev module, but in js", + "devDependencies": { + "tap": "^10.1" + }, + "files": [ + "abbrev.js" + ], + "homepage": "https://github.com/isaacs/abbrev-js#readme", + "license": "ISC", + "main": "abbrev.js", + "name": "abbrev", + "optionalDependencies": {}, + "readme": "# abbrev-js\n\nJust like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).\n\nUsage:\n\n var abbrev = require(\"abbrev\");\n abbrev(\"foo\", \"fool\", \"folding\", \"flop\");\n \n // returns:\n { fl: 'flop'\n , flo: 'flop'\n , flop: 'flop'\n , fol: 'folding'\n , fold: 'folding'\n , foldi: 'folding'\n , foldin: 'folding'\n , folding: 'folding'\n , foo: 'foo'\n , fool: 'fool'\n }\n\nThis is handy for command-line scripts, or other cases where you want to be able to accept shorthands.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/isaacs/abbrev-js.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test.js --100" + }, + "version": "1.1.1" +} diff --git a/legacy-libs/grpc/node_modules/ansi-regex/index.js b/legacy-libs/grpc/node_modules/ansi-regex/index.js new file mode 100644 index 0000000..b9574ed --- /dev/null +++ b/legacy-libs/grpc/node_modules/ansi-regex/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = function () { + return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; +}; diff --git a/legacy-libs/grpc/node_modules/ansi-regex/license b/legacy-libs/grpc/node_modules/ansi-regex/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/legacy-libs/grpc/node_modules/ansi-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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/legacy-libs/grpc/node_modules/ansi-regex/package.json b/legacy-libs/grpc/node_modules/ansi-regex/package.json new file mode 100644 index 0000000..cbb8886 --- /dev/null +++ b/legacy-libs/grpc/node_modules/ansi-regex/package.json @@ -0,0 +1,116 @@ +{ + "_args": [ + [ + "ansi-regex@2.1.1", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "ansi-regex@2.1.1", + "_id": "ansi-regex@2.1.1", + "_inBundle": false, + "_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "_location": "/grpc/ansi-regex", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ansi-regex@2.1.1", + "name": "ansi-regex", + "escapedName": "ansi-regex", + "rawSpec": "2.1.1", + "saveSpec": null, + "fetchSpec": "2.1.1" + }, + "_requiredBy": [ + "/grpc/strip-ansi" + ], + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "_shrinkwrap": null, + "_spec": "2.1.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/chalk/ansi-regex/issues" + }, + "dependencies": {}, + "description": "Regular expression for matching ANSI escape codes", + "devDependencies": { + "ava": "0.17.0", + "xo": "0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/chalk/ansi-regex#readme", + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "license": "MIT", + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + { + "name": "Joshua Appelman", + "email": "jappelman@xebia.com", + "url": "jbnicolai.com" + }, + { + "name": "JD Ballard", + "email": "i.am.qix@gmail.com", + "url": "github.com/qix-" + } + ], + "name": "ansi-regex", + "optionalDependencies": {}, + "readme": "# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)\n\n> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)\n\n\n## Install\n\n```\n$ npm install --save ansi-regex\n```\n\n\n## Usage\n\n```js\nconst ansiRegex = require('ansi-regex');\n\nansiRegex().test('\\u001b[4mcake\\u001b[0m');\n//=> true\n\nansiRegex().test('cake');\n//=> false\n\n'\\u001b[4mcake\\u001b[0m'.match(ansiRegex());\n//=> ['\\u001b[4m', '\\u001b[0m']\n```\n\n## FAQ\n\n### Why do you test for codes not in the ECMA 48 standard?\n\nSome of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.\n\nOn the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of \"interrupts\" that can mean different things on certain brands of processors, most of which have been phased out.\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/ansi-regex.git" + }, + "scripts": { + "test": "xo && ava --verbose", + "view-supported": "node fixtures/view-codes.js" + }, + "version": "2.1.1", + "xo": { + "rules": { + "guard-for-in": 0, + "no-loop-func": 0 + } + } +} diff --git a/legacy-libs/grpc/node_modules/ansi-regex/readme.md b/legacy-libs/grpc/node_modules/ansi-regex/readme.md new file mode 100644 index 0000000..6a928ed --- /dev/null +++ b/legacy-libs/grpc/node_modules/ansi-regex/readme.md @@ -0,0 +1,39 @@ +# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) + +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install --save ansi-regex +``` + + +## Usage + +```js +const ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001b[4mcake\u001b[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001b[4mcake\u001b[0m'.match(ansiRegex()); +//=> ['\u001b[4m', '\u001b[0m'] +``` + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/legacy-libs/grpc/node_modules/aproba/LICENSE b/legacy-libs/grpc/node_modules/aproba/LICENSE new file mode 100644 index 0000000..f4be44d --- /dev/null +++ b/legacy-libs/grpc/node_modules/aproba/LICENSE @@ -0,0 +1,14 @@ +Copyright (c) 2015, Rebecca Turner + +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/legacy-libs/grpc/node_modules/aproba/README.md b/legacy-libs/grpc/node_modules/aproba/README.md new file mode 100644 index 0000000..0bfc594 --- /dev/null +++ b/legacy-libs/grpc/node_modules/aproba/README.md @@ -0,0 +1,94 @@ +aproba +====== + +A ridiculously light-weight function argument validator + +``` +var validate = require("aproba") + +function myfunc(a, b, c) { + // `a` must be a string, `b` a number, `c` a function + validate('SNF', arguments) // [a,b,c] is also valid +} + +myfunc('test', 23, function () {}) // ok +myfunc(123, 23, function () {}) // type error +myfunc('test', 23) // missing arg error +myfunc('test', 23, function () {}, true) // too many args error + +``` + +Valid types are: + +| type | description +| :--: | :---------- +| * | matches any type +| A | `Array.isArray` OR an `arguments` object +| S | typeof == string +| N | typeof == number +| F | typeof == function +| O | typeof == object and not type A and not type E +| B | typeof == boolean +| E | `instanceof Error` OR `null` **(special: see below)** +| Z | == `null` + +Validation failures throw one of three exception types, distinguished by a +`code` property of `EMISSINGARG`, `EINVALIDTYPE` or `ETOOMANYARGS`. + +If you pass in an invalid type then it will throw with a code of +`EUNKNOWNTYPE`. + +If an **error** argument is found and is not null then the remaining +arguments are optional. That is, if you say `ESO` then that's like using a +non-magical `E` in: `E|ESO|ZSO`. + +### But I have optional arguments?! + +You can provide more than one signature by separating them with pipes `|`. +If any signature matches the arguments then they'll be considered valid. + +So for example, say you wanted to write a signature for +`fs.createWriteStream`. The docs for it describe it thusly: + +``` +fs.createWriteStream(path[, options]) +``` + +This would be a signature of `SO|S`. That is, a string and and object, or +just a string. + +Now, if you read the full `fs` docs, you'll see that actually path can ALSO +be a buffer. And options can be a string, that is: +``` +path | +options | +``` + +To reproduce this you have to fully enumerate all of the possible +combinations and that implies a signature of `SO|SS|OO|OS|S|O`. The +awkwardness is a feature: It reminds you of the complexity you're adding to +your API when you do this sort of thing. + + +### Browser support + +This has no dependencies and should work in browsers, though you'll have +noisier stack traces. + +### Why this exists + +I wanted a very simple argument validator. It needed to do two things: + +1. Be more concise and easier to use than assertions + +2. Not encourage an infinite bikeshed of DSLs + +This is why types are specified by a single character and there's no such +thing as an optional argument. + +This is not intended to validate user data. This is specifically about +asserting the interface of your functions. + +If you need greater validation, I encourage you to write them by hand or +look elsewhere. + diff --git a/legacy-libs/grpc/node_modules/aproba/index.js b/legacy-libs/grpc/node_modules/aproba/index.js new file mode 100644 index 0000000..6f3f797 --- /dev/null +++ b/legacy-libs/grpc/node_modules/aproba/index.js @@ -0,0 +1,105 @@ +'use strict' + +function isArguments (thingy) { + return thingy != null && typeof thingy === 'object' && thingy.hasOwnProperty('callee') +} + +var types = { + '*': {label: 'any', check: function () { return true }}, + A: {label: 'array', check: function (thingy) { return Array.isArray(thingy) || isArguments(thingy) }}, + S: {label: 'string', check: function (thingy) { return typeof thingy === 'string' }}, + N: {label: 'number', check: function (thingy) { return typeof thingy === 'number' }}, + F: {label: 'function', check: function (thingy) { return typeof thingy === 'function' }}, + O: {label: 'object', check: function (thingy) { return typeof thingy === 'object' && thingy != null && !types.A.check(thingy) && !types.E.check(thingy) }}, + B: {label: 'boolean', check: function (thingy) { return typeof thingy === 'boolean' }}, + E: {label: 'error', check: function (thingy) { return thingy instanceof Error }}, + Z: {label: 'null', check: function (thingy) { return thingy == null }} +} + +function addSchema (schema, arity) { + var group = arity[schema.length] = arity[schema.length] || [] + if (group.indexOf(schema) === -1) group.push(schema) +} + +var validate = module.exports = function (rawSchemas, args) { + if (arguments.length !== 2) throw wrongNumberOfArgs(['SA'], arguments.length) + if (!rawSchemas) throw missingRequiredArg(0, 'rawSchemas') + if (!args) throw missingRequiredArg(1, 'args') + if (!types.S.check(rawSchemas)) throw invalidType(0, ['string'], rawSchemas) + if (!types.A.check(args)) throw invalidType(1, ['array'], args) + var schemas = rawSchemas.split('|') + var arity = {} + + schemas.forEach(function (schema) { + for (var ii = 0; ii < schema.length; ++ii) { + var type = schema[ii] + if (!types[type]) throw unknownType(ii, type) + } + if (/E.*E/.test(schema)) throw moreThanOneError(schema) + addSchema(schema, arity) + if (/E/.test(schema)) { + addSchema(schema.replace(/E.*$/, 'E'), arity) + addSchema(schema.replace(/E/, 'Z'), arity) + if (schema.length === 1) addSchema('', arity) + } + }) + var matching = arity[args.length] + if (!matching) { + throw wrongNumberOfArgs(Object.keys(arity), args.length) + } + for (var ii = 0; ii < args.length; ++ii) { + var newMatching = matching.filter(function (schema) { + var type = schema[ii] + var typeCheck = types[type].check + return typeCheck(args[ii]) + }) + if (!newMatching.length) { + var labels = matching.map(function (schema) { + return types[schema[ii]].label + }).filter(function (schema) { return schema != null }) + throw invalidType(ii, labels, args[ii]) + } + matching = newMatching + } +} + +function missingRequiredArg (num) { + return newException('EMISSINGARG', 'Missing required argument #' + (num + 1)) +} + +function unknownType (num, type) { + return newException('EUNKNOWNTYPE', 'Unknown type ' + type + ' in argument #' + (num + 1)) +} + +function invalidType (num, expectedTypes, value) { + var valueType + Object.keys(types).forEach(function (typeCode) { + if (types[typeCode].check(value)) valueType = types[typeCode].label + }) + return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' + + englishList(expectedTypes) + ' but got ' + valueType) +} + +function englishList (list) { + return list.join(', ').replace(/, ([^,]+)$/, ' or $1') +} + +function wrongNumberOfArgs (expected, got) { + var english = englishList(expected) + var args = expected.every(function (ex) { return ex.length === 1 }) + ? 'argument' + : 'arguments' + return newException('EWRONGARGCOUNT', 'Expected ' + english + ' ' + args + ' but got ' + got) +} + +function moreThanOneError (schema) { + return newException('ETOOMANYERRORTYPES', + 'Only one error type per argument signature is allowed, more than one found in "' + schema + '"') +} + +function newException (code, msg) { + var e = new Error(msg) + e.code = code + if (Error.captureStackTrace) Error.captureStackTrace(e, validate) + return e +} diff --git a/legacy-libs/grpc/node_modules/aproba/package.json b/legacy-libs/grpc/node_modules/aproba/package.json new file mode 100644 index 0000000..5f9d995 --- /dev/null +++ b/legacy-libs/grpc/node_modules/aproba/package.json @@ -0,0 +1,69 @@ +{ + "_args": [ + [ + "aproba@1.2.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "aproba@1.2.0", + "_id": "aproba@1.2.0", + "_inBundle": false, + "_integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "_location": "/grpc/aproba", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "aproba@1.2.0", + "name": "aproba", + "escapedName": "aproba", + "rawSpec": "1.2.0", + "saveSpec": null, + "fetchSpec": "1.2.0" + }, + "_requiredBy": [ + "/grpc/gauge" + ], + "_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "_shrinkwrap": null, + "_spec": "1.2.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Rebecca Turner", + "email": "me@re-becca.org" + }, + "bugs": { + "url": "https://github.com/iarna/aproba/issues" + }, + "dependencies": {}, + "description": "A ridiculously light-weight argument validator (now browser friendly)", + "devDependencies": { + "standard": "^10.0.3", + "tap": "^10.0.2" + }, + "directories": { + "test": "test" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/iarna/aproba", + "keywords": [ + "argument", + "validate" + ], + "license": "ISC", + "main": "index.js", + "name": "aproba", + "optionalDependencies": {}, + "readme": "aproba\n======\n\nA ridiculously light-weight function argument validator\n\n```\nvar validate = require(\"aproba\")\n\nfunction myfunc(a, b, c) {\n // `a` must be a string, `b` a number, `c` a function\n validate('SNF', arguments) // [a,b,c] is also valid\n}\n\nmyfunc('test', 23, function () {}) // ok\nmyfunc(123, 23, function () {}) // type error\nmyfunc('test', 23) // missing arg error\nmyfunc('test', 23, function () {}, true) // too many args error\n\n```\n\nValid types are:\n\n| type | description\n| :--: | :----------\n| * | matches any type\n| A | `Array.isArray` OR an `arguments` object\n| S | typeof == string\n| N | typeof == number\n| F | typeof == function\n| O | typeof == object and not type A and not type E\n| B | typeof == boolean\n| E | `instanceof Error` OR `null` **(special: see below)**\n| Z | == `null`\n\nValidation failures throw one of three exception types, distinguished by a\n`code` property of `EMISSINGARG`, `EINVALIDTYPE` or `ETOOMANYARGS`.\n\nIf you pass in an invalid type then it will throw with a code of\n`EUNKNOWNTYPE`.\n\nIf an **error** argument is found and is not null then the remaining\narguments are optional. That is, if you say `ESO` then that's like using a\nnon-magical `E` in: `E|ESO|ZSO`.\n\n### But I have optional arguments?!\n\nYou can provide more than one signature by separating them with pipes `|`.\nIf any signature matches the arguments then they'll be considered valid.\n\nSo for example, say you wanted to write a signature for\n`fs.createWriteStream`. The docs for it describe it thusly:\n\n```\nfs.createWriteStream(path[, options])\n```\n\nThis would be a signature of `SO|S`. That is, a string and and object, or\njust a string.\n\nNow, if you read the full `fs` docs, you'll see that actually path can ALSO\nbe a buffer. And options can be a string, that is:\n```\npath | \noptions | \n```\n\nTo reproduce this you have to fully enumerate all of the possible\ncombinations and that implies a signature of `SO|SS|OO|OS|S|O`. The\nawkwardness is a feature: It reminds you of the complexity you're adding to\nyour API when you do this sort of thing.\n\n\n### Browser support\n\nThis has no dependencies and should work in browsers, though you'll have\nnoisier stack traces.\n\n### Why this exists\n\nI wanted a very simple argument validator. It needed to do two things:\n\n1. Be more concise and easier to use than assertions\n\n2. Not encourage an infinite bikeshed of DSLs\n\nThis is why types are specified by a single character and there's no such\nthing as an optional argument. \n\nThis is not intended to validate user data. This is specifically about\nasserting the interface of your functions.\n\nIf you need greater validation, I encourage you to write them by hand or\nlook elsewhere.\n\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/aproba.git" + }, + "scripts": { + "test": "standard && tap -j3 test/*.js" + }, + "version": "1.2.0" +} diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/CHANGES.md b/legacy-libs/grpc/node_modules/are-we-there-yet/CHANGES.md new file mode 100644 index 0000000..21f3b1c --- /dev/null +++ b/legacy-libs/grpc/node_modules/are-we-there-yet/CHANGES.md @@ -0,0 +1,37 @@ +Hi, figured we could actually use a changelog now: + +## 1.1.5 2018-05-24 + +* [#92](https://github.com/iarna/are-we-there-yet/pull/92) Fix bug where + `finish` would throw errors when including `TrackerStream` objects in + `TrackerGroup` collections. (@brianloveswords) + +## 1.1.4 2017-04-21 + +* Fix typo in package.json + +## 1.1.3 2017-04-21 + +* Improve documentation and limit files included in the distribution. + +## 1.1.2 2016-03-15 + +* Add tracker group cycle detection and tests for it + +## 1.1.1 2016-01-29 + +* Fix a typo in stream completion tracker + +## 1.1.0 2016-01-29 + +* Rewrote completion percent computation to be low impact– no more walking a + tree of completion groups every time we need this info. Previously, with + medium sized tree of completion groups, even a relatively modest number of + calls to the top level `completed()` method would result in absurd numbers + of calls overall as it walked down the tree. We now, instead, keep track as + we bubble up changes, so the computation is limited to when data changes and + to the depth of that one branch, instead of _every_ node. (Plus, we were already + incurring _this_ cost, since we already bubbled out changes.) +* Moved different tracker types out to their own files. +* Made tests test for TOO MANY events too. +* Standarized the source code formatting diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/LICENSE b/legacy-libs/grpc/node_modules/are-we-there-yet/LICENSE new file mode 100644 index 0000000..af45880 --- /dev/null +++ b/legacy-libs/grpc/node_modules/are-we-there-yet/LICENSE @@ -0,0 +1,5 @@ +Copyright (c) 2015, Rebecca Turner + +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/legacy-libs/grpc/node_modules/are-we-there-yet/README.md b/legacy-libs/grpc/node_modules/are-we-there-yet/README.md new file mode 100644 index 0000000..7e2b42d --- /dev/null +++ b/legacy-libs/grpc/node_modules/are-we-there-yet/README.md @@ -0,0 +1,195 @@ +are-we-there-yet +---------------- + +Track complex hiearchies of asynchronous task completion statuses. This is +intended to give you a way of recording and reporting the progress of the big +recursive fan-out and gather type workflows that are so common in async. + +What you do with this completion data is up to you, but the most common use case is to +feed it to one of the many progress bar modules. + +Most progress bar modules include a rudamentary version of this, but my +needs were more complex. + +Usage +===== + +```javascript +var TrackerGroup = require("are-we-there-yet").TrackerGroup + +var top = new TrackerGroup("program") + +var single = top.newItem("one thing", 100) +single.completeWork(20) + +console.log(top.completed()) // 0.2 + +fs.stat("file", function(er, stat) { + if (er) throw er + var stream = top.newStream("file", stat.size) + console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete + // and 50% * 20% == 10% + fs.createReadStream("file").pipe(stream).on("data", function (chunk) { + // do stuff with chunk + }) + top.on("change", function (name) { + // called each time a chunk is read from "file" + // top.completed() will start at 0.1 and fill up to 0.6 as the file is read + }) +}) +``` + +Shared Methods +============== + +* var completed = tracker.completed() + +Implemented in: `Tracker`, `TrackerGroup`, `TrackerStream` + +Returns the ratio of completed work to work to be done. Range of 0 to 1. + +* tracker.finish() + +Implemented in: `Tracker`, `TrackerGroup` + +Marks the tracker as completed. With a TrackerGroup this marks all of its +components as completed. + +Marks all of the components of this tracker as finished, which in turn means +that `tracker.completed()` for this will now be 1. + +This will result in one or more `change` events being emitted. + +Events +====== + +All tracker objects emit `change` events with the following arguments: + +``` +function (name, completed, tracker) +``` + +`name` is the name of the tracker that originally emitted the event, +or if it didn't have one, the first containing tracker group that had one. + +`completed` is the percent complete (as returned by `tracker.completed()` method). + +`tracker` is the tracker object that you are listening for events on. + +TrackerGroup +============ + +* var tracker = new TrackerGroup(**name**) + + * **name** *(optional)* - The name of this tracker group, used in change + notifications if the component updating didn't have a name. Defaults to undefined. + +Creates a new empty tracker aggregation group. These are trackers whose +completion status is determined by the completion status of other trackers. + +* tracker.addUnit(**otherTracker**, **weight**) + + * **otherTracker** - Any of the other are-we-there-yet tracker objects + * **weight** *(optional)* - The weight to give the tracker, defaults to 1. + +Adds the **otherTracker** to this aggregation group. The weight determines +how long you expect this tracker to take to complete in proportion to other +units. So for instance, if you add one tracker with a weight of 1 and +another with a weight of 2, you're saying the second will take twice as long +to complete as the first. As such, the first will account for 33% of the +completion of this tracker and the second will account for the other 67%. + +Returns **otherTracker**. + +* var subGroup = tracker.newGroup(**name**, **weight**) + +The above is exactly equivalent to: + +```javascript + var subGroup = tracker.addUnit(new TrackerGroup(name), weight) +``` + +* var subItem = tracker.newItem(**name**, **todo**, **weight**) + +The above is exactly equivalent to: + +```javascript + var subItem = tracker.addUnit(new Tracker(name, todo), weight) +``` + +* var subStream = tracker.newStream(**name**, **todo**, **weight**) + +The above is exactly equivalent to: + +```javascript + var subStream = tracker.addUnit(new TrackerStream(name, todo), weight) +``` + +* console.log( tracker.debug() ) + +Returns a tree showing the completion of this tracker group and all of its +children, including recursively entering all of the children. + +Tracker +======= + +* var tracker = new Tracker(**name**, **todo**) + + * **name** *(optional)* The name of this counter to report in change + events. Defaults to undefined. + * **todo** *(optional)* The amount of work todo (a number). Defaults to 0. + +Ordinarily these are constructed as a part of a tracker group (via +`newItem`). + +* var completed = tracker.completed() + +Returns the ratio of completed work to work to be done. Range of 0 to 1. If +total work to be done is 0 then it will return 0. + +* tracker.addWork(**todo**) + + * **todo** A number to add to the amount of work to be done. + +Increases the amount of work to be done, thus decreasing the completion +percentage. Triggers a `change` event. + +* tracker.completeWork(**completed**) + + * **completed** A number to add to the work complete + +Increase the amount of work complete, thus increasing the completion percentage. +Will never increase the work completed past the amount of work todo. That is, +percentages > 100% are not allowed. Triggers a `change` event. + +* tracker.finish() + +Marks this tracker as finished, tracker.completed() will now be 1. Triggers +a `change` event. + +TrackerStream +============= + +* var tracker = new TrackerStream(**name**, **size**, **options**) + + * **name** *(optional)* The name of this counter to report in change + events. Defaults to undefined. + * **size** *(optional)* The number of bytes being sent through this stream. + * **options** *(optional)* A hash of stream options + +The tracker stream object is a pass through stream that updates an internal +tracker object each time a block passes through. It's intended to track +downloads, file extraction and other related activities. You use it by piping +your data source into it and then using it as your data source. + +If your data has a length attribute then that's used as the amount of work +completed when the chunk is passed through. If it does not (eg, object +streams) then each chunk counts as completing 1 unit of work, so your size +should be the total number of objects being streamed. + +* tracker.addWork(**todo**) + + * **todo** Increase the expected overall size by **todo** bytes. + +Increases the amount of work to be done, thus decreasing the completion +percentage. Triggers a `change` event. diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/index.js b/legacy-libs/grpc/node_modules/are-we-there-yet/index.js new file mode 100644 index 0000000..57d8743 --- /dev/null +++ b/legacy-libs/grpc/node_modules/are-we-there-yet/index.js @@ -0,0 +1,4 @@ +'use strict' +exports.TrackerGroup = require('./tracker-group.js') +exports.Tracker = require('./tracker.js') +exports.TrackerStream = require('./tracker-stream.js') diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/package.json b/legacy-libs/grpc/node_modules/are-we-there-yet/package.json new file mode 100644 index 0000000..ddcb7a6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/are-we-there-yet/package.json @@ -0,0 +1,70 @@ +{ + "_args": [ + [ + "are-we-there-yet@1.1.5", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "are-we-there-yet@1.1.5", + "_id": "are-we-there-yet@1.1.5", + "_inBundle": false, + "_integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "_location": "/grpc/are-we-there-yet", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "are-we-there-yet@1.1.5", + "name": "are-we-there-yet", + "escapedName": "are-we-there-yet", + "rawSpec": "1.1.5", + "saveSpec": null, + "fetchSpec": "1.1.5" + }, + "_requiredBy": [ + "/grpc/npmlog" + ], + "_resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "_shrinkwrap": null, + "_spec": "1.1.5", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Rebecca Turner", + "url": "http://re-becca.org" + }, + "bugs": { + "url": "https://github.com/iarna/are-we-there-yet/issues" + }, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + }, + "description": "Keep track of the overall completion of many disparate processes", + "devDependencies": { + "standard": "^11.0.1", + "tap": "^12.0.1" + }, + "files": [ + "index.js", + "tracker-base.js", + "tracker-group.js", + "tracker-stream.js", + "tracker.js", + "CHANGES.md" + ], + "homepage": "https://github.com/iarna/are-we-there-yet", + "license": "ISC", + "main": "index.js", + "name": "are-we-there-yet", + "optionalDependencies": {}, + "readme": "are-we-there-yet\n----------------\n\nTrack complex hiearchies of asynchronous task completion statuses. This is\nintended to give you a way of recording and reporting the progress of the big\nrecursive fan-out and gather type workflows that are so common in async.\n\nWhat you do with this completion data is up to you, but the most common use case is to\nfeed it to one of the many progress bar modules.\n\nMost progress bar modules include a rudamentary version of this, but my\nneeds were more complex.\n\nUsage\n=====\n\n```javascript\nvar TrackerGroup = require(\"are-we-there-yet\").TrackerGroup\n\nvar top = new TrackerGroup(\"program\")\n\nvar single = top.newItem(\"one thing\", 100)\nsingle.completeWork(20)\n\nconsole.log(top.completed()) // 0.2\n\nfs.stat(\"file\", function(er, stat) {\n if (er) throw er \n var stream = top.newStream(\"file\", stat.size)\n console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete\n // and 50% * 20% == 10%\n fs.createReadStream(\"file\").pipe(stream).on(\"data\", function (chunk) {\n // do stuff with chunk\n })\n top.on(\"change\", function (name) {\n // called each time a chunk is read from \"file\"\n // top.completed() will start at 0.1 and fill up to 0.6 as the file is read\n })\n})\n```\n\nShared Methods\n==============\n\n* var completed = tracker.completed()\n\nImplemented in: `Tracker`, `TrackerGroup`, `TrackerStream`\n\nReturns the ratio of completed work to work to be done. Range of 0 to 1.\n\n* tracker.finish()\n\nImplemented in: `Tracker`, `TrackerGroup`\n\nMarks the tracker as completed. With a TrackerGroup this marks all of its\ncomponents as completed.\n\nMarks all of the components of this tracker as finished, which in turn means\nthat `tracker.completed()` for this will now be 1.\n\nThis will result in one or more `change` events being emitted.\n\nEvents\n======\n\nAll tracker objects emit `change` events with the following arguments:\n\n```\nfunction (name, completed, tracker)\n```\n\n`name` is the name of the tracker that originally emitted the event,\nor if it didn't have one, the first containing tracker group that had one.\n\n`completed` is the percent complete (as returned by `tracker.completed()` method).\n\n`tracker` is the tracker object that you are listening for events on.\n\nTrackerGroup\n============\n\n* var tracker = new TrackerGroup(**name**)\n\n * **name** *(optional)* - The name of this tracker group, used in change\n notifications if the component updating didn't have a name. Defaults to undefined.\n\nCreates a new empty tracker aggregation group. These are trackers whose\ncompletion status is determined by the completion status of other trackers.\n\n* tracker.addUnit(**otherTracker**, **weight**)\n\n * **otherTracker** - Any of the other are-we-there-yet tracker objects\n * **weight** *(optional)* - The weight to give the tracker, defaults to 1.\n\nAdds the **otherTracker** to this aggregation group. The weight determines\nhow long you expect this tracker to take to complete in proportion to other\nunits. So for instance, if you add one tracker with a weight of 1 and\nanother with a weight of 2, you're saying the second will take twice as long\nto complete as the first. As such, the first will account for 33% of the\ncompletion of this tracker and the second will account for the other 67%.\n\nReturns **otherTracker**.\n\n* var subGroup = tracker.newGroup(**name**, **weight**)\n\nThe above is exactly equivalent to:\n\n```javascript\n var subGroup = tracker.addUnit(new TrackerGroup(name), weight)\n```\n\n* var subItem = tracker.newItem(**name**, **todo**, **weight**)\n\nThe above is exactly equivalent to:\n\n```javascript\n var subItem = tracker.addUnit(new Tracker(name, todo), weight)\n```\n\n* var subStream = tracker.newStream(**name**, **todo**, **weight**)\n\nThe above is exactly equivalent to:\n\n```javascript\n var subStream = tracker.addUnit(new TrackerStream(name, todo), weight)\n```\n\n* console.log( tracker.debug() )\n\nReturns a tree showing the completion of this tracker group and all of its\nchildren, including recursively entering all of the children.\n\nTracker\n=======\n\n* var tracker = new Tracker(**name**, **todo**)\n\n * **name** *(optional)* The name of this counter to report in change\n events. Defaults to undefined.\n * **todo** *(optional)* The amount of work todo (a number). Defaults to 0.\n\nOrdinarily these are constructed as a part of a tracker group (via\n`newItem`).\n\n* var completed = tracker.completed()\n\nReturns the ratio of completed work to work to be done. Range of 0 to 1. If\ntotal work to be done is 0 then it will return 0.\n\n* tracker.addWork(**todo**)\n\n * **todo** A number to add to the amount of work to be done.\n\nIncreases the amount of work to be done, thus decreasing the completion\npercentage. Triggers a `change` event.\n\n* tracker.completeWork(**completed**)\n\n * **completed** A number to add to the work complete\n\nIncrease the amount of work complete, thus increasing the completion percentage.\nWill never increase the work completed past the amount of work todo. That is,\npercentages > 100% are not allowed. Triggers a `change` event.\n\n* tracker.finish()\n\nMarks this tracker as finished, tracker.completed() will now be 1. Triggers\na `change` event.\n\nTrackerStream\n=============\n\n* var tracker = new TrackerStream(**name**, **size**, **options**)\n\n * **name** *(optional)* The name of this counter to report in change\n events. Defaults to undefined.\n * **size** *(optional)* The number of bytes being sent through this stream.\n * **options** *(optional)* A hash of stream options\n\nThe tracker stream object is a pass through stream that updates an internal\ntracker object each time a block passes through. It's intended to track\ndownloads, file extraction and other related activities. You use it by piping\nyour data source into it and then using it as your data source.\n\nIf your data has a length attribute then that's used as the amount of work\ncompleted when the chunk is passed through. If it does not (eg, object\nstreams) then each chunk counts as completing 1 unit of work, so your size\nshould be the total number of objects being streamed.\n\n* tracker.addWork(**todo**)\n\n * **todo** Increase the expected overall size by **todo** bytes.\n\nIncreases the amount of work to be done, thus decreasing the completion\npercentage. Triggers a `change` event.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/are-we-there-yet.git" + }, + "scripts": { + "test": "standard && tap test/*.js" + }, + "version": "1.1.5" +} diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-base.js b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-base.js new file mode 100644 index 0000000..6f43687 --- /dev/null +++ b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-base.js @@ -0,0 +1,11 @@ +'use strict' +var EventEmitter = require('events').EventEmitter +var util = require('util') + +var trackerId = 0 +var TrackerBase = module.exports = function (name) { + EventEmitter.call(this) + this.id = ++trackerId + this.name = name +} +util.inherits(TrackerBase, EventEmitter) diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-group.js b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-group.js new file mode 100644 index 0000000..9759e12 --- /dev/null +++ b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-group.js @@ -0,0 +1,107 @@ +'use strict' +var util = require('util') +var TrackerBase = require('./tracker-base.js') +var Tracker = require('./tracker.js') +var TrackerStream = require('./tracker-stream.js') + +var TrackerGroup = module.exports = function (name) { + TrackerBase.call(this, name) + this.parentGroup = null + this.trackers = [] + this.completion = {} + this.weight = {} + this.totalWeight = 0 + this.finished = false + this.bubbleChange = bubbleChange(this) +} +util.inherits(TrackerGroup, TrackerBase) + +function bubbleChange (trackerGroup) { + return function (name, completed, tracker) { + trackerGroup.completion[tracker.id] = completed + if (trackerGroup.finished) return + trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup) + } +} + +TrackerGroup.prototype.nameInTree = function () { + var names = [] + var from = this + while (from) { + names.unshift(from.name) + from = from.parentGroup + } + return names.join('/') +} + +TrackerGroup.prototype.addUnit = function (unit, weight) { + if (unit.addUnit) { + var toTest = this + while (toTest) { + if (unit === toTest) { + throw new Error( + 'Attempted to add tracker group ' + + unit.name + ' to tree that already includes it ' + + this.nameInTree(this)) + } + toTest = toTest.parentGroup + } + unit.parentGroup = this + } + this.weight[unit.id] = weight || 1 + this.totalWeight += this.weight[unit.id] + this.trackers.push(unit) + this.completion[unit.id] = unit.completed() + unit.on('change', this.bubbleChange) + if (!this.finished) this.emit('change', unit.name, this.completion[unit.id], unit) + return unit +} + +TrackerGroup.prototype.completed = function () { + if (this.trackers.length === 0) return 0 + var valPerWeight = 1 / this.totalWeight + var completed = 0 + for (var ii = 0; ii < this.trackers.length; ii++) { + var trackerId = this.trackers[ii].id + completed += valPerWeight * this.weight[trackerId] * this.completion[trackerId] + } + return completed +} + +TrackerGroup.prototype.newGroup = function (name, weight) { + return this.addUnit(new TrackerGroup(name), weight) +} + +TrackerGroup.prototype.newItem = function (name, todo, weight) { + return this.addUnit(new Tracker(name, todo), weight) +} + +TrackerGroup.prototype.newStream = function (name, todo, weight) { + return this.addUnit(new TrackerStream(name, todo), weight) +} + +TrackerGroup.prototype.finish = function () { + this.finished = true + if (!this.trackers.length) this.addUnit(new Tracker(), 1, true) + for (var ii = 0; ii < this.trackers.length; ii++) { + var tracker = this.trackers[ii] + tracker.finish() + tracker.removeListener('change', this.bubbleChange) + } + this.emit('change', this.name, 1, this) +} + +var buffer = ' ' +TrackerGroup.prototype.debug = function (depth) { + depth = depth || 0 + var indent = depth ? buffer.substr(0, depth) : '' + var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n' + this.trackers.forEach(function (tracker) { + if (tracker instanceof TrackerGroup) { + output += tracker.debug(depth + 1) + } else { + output += indent + ' ' + tracker.name + ': ' + tracker.completed() + '\n' + } + }) + return output +} diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-stream.js b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-stream.js new file mode 100644 index 0000000..e1cf850 --- /dev/null +++ b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-stream.js @@ -0,0 +1,36 @@ +'use strict' +var util = require('util') +var stream = require('readable-stream') +var delegate = require('delegates') +var Tracker = require('./tracker.js') + +var TrackerStream = module.exports = function (name, size, options) { + stream.Transform.call(this, options) + this.tracker = new Tracker(name, size) + this.name = name + this.id = this.tracker.id + this.tracker.on('change', delegateChange(this)) +} +util.inherits(TrackerStream, stream.Transform) + +function delegateChange (trackerStream) { + return function (name, completion, tracker) { + trackerStream.emit('change', name, completion, trackerStream) + } +} + +TrackerStream.prototype._transform = function (data, encoding, cb) { + this.tracker.completeWork(data.length ? data.length : 1) + this.push(data) + cb() +} + +TrackerStream.prototype._flush = function (cb) { + this.tracker.finish() + cb() +} + +delegate(TrackerStream.prototype, 'tracker') + .method('completed') + .method('addWork') + .method('finish') diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/tracker.js b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker.js new file mode 100644 index 0000000..68c2339 --- /dev/null +++ b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker.js @@ -0,0 +1,30 @@ +'use strict' +var util = require('util') +var TrackerBase = require('./tracker-base.js') + +var Tracker = module.exports = function (name, todo) { + TrackerBase.call(this, name) + this.workDone = 0 + this.workTodo = todo || 0 +} +util.inherits(Tracker, TrackerBase) + +Tracker.prototype.completed = function () { + return this.workTodo === 0 ? 0 : this.workDone / this.workTodo +} + +Tracker.prototype.addWork = function (work) { + this.workTodo += work + this.emit('change', this.name, this.completed(), this) +} + +Tracker.prototype.completeWork = function (work) { + this.workDone += work + if (this.workDone > this.workTodo) this.workDone = this.workTodo + this.emit('change', this.name, this.completed(), this) +} + +Tracker.prototype.finish = function () { + this.workTodo = this.workDone = 1 + this.emit('change', this.name, 1, this) +} diff --git a/legacy-libs/grpc/node_modules/balanced-match/LICENSE.md b/legacy-libs/grpc/node_modules/balanced-match/LICENSE.md new file mode 100644 index 0000000..2cdc8e4 --- /dev/null +++ b/legacy-libs/grpc/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/legacy-libs/grpc/node_modules/balanced-match/README.md b/legacy-libs/grpc/node_modules/balanced-match/README.md new file mode 100644 index 0000000..08e918c --- /dev/null +++ b/legacy-libs/grpc/node_modules/balanced-match/README.md @@ -0,0 +1,91 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ , ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/legacy-libs/grpc/node_modules/balanced-match/index.js b/legacy-libs/grpc/node_modules/balanced-match/index.js new file mode 100644 index 0000000..1685a76 --- /dev/null +++ b/legacy-libs/grpc/node_modules/balanced-match/index.js @@ -0,0 +1,59 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/legacy-libs/grpc/node_modules/balanced-match/package.json b/legacy-libs/grpc/node_modules/balanced-match/package.json new file mode 100644 index 0000000..c35a498 --- /dev/null +++ b/legacy-libs/grpc/node_modules/balanced-match/package.json @@ -0,0 +1,84 @@ +{ + "_args": [ + [ + "balanced-match@1.0.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "balanced-match@1.0.0", + "_id": "balanced-match@1.0.0", + "_inBundle": false, + "_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "_location": "/grpc/balanced-match", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "balanced-match@1.0.0", + "name": "balanced-match", + "escapedName": "balanced-match", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/grpc/brace-expansion" + ], + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "_shrinkwrap": null, + "_spec": "1.0.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/balanced-match/issues" + }, + "dependencies": {}, + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "license": "MIT", + "main": "index.js", + "name": "balanced-match", + "optionalDependencies": {}, + "readme": "# balanced-match\n\nMatch balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well!\n\n[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match)\n[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match)\n\n[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match)\n\n## Example\n\nGet the first matching pair of braces:\n\n```js\nvar balanced = require('balanced-match');\n\nconsole.log(balanced('{', '}', 'pre{in{nested}}post'));\nconsole.log(balanced('{', '}', 'pre{first}between{second}post'));\nconsole.log(balanced(/\\s+\\{\\s+/, /\\s+\\}\\s+/, 'pre { in{nest} } post'));\n```\n\nThe matches are:\n\n```bash\n$ node example.js\n{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }\n{ start: 3,\n end: 9,\n pre: 'pre',\n body: 'first',\n post: 'between{second}post' }\n{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }\n```\n\n## API\n\n### var m = balanced(a, b, str)\n\nFor the first non-nested matching pair of `a` and `b` in `str`, return an\nobject with those keys:\n\n* **start** the index of the first match of `a`\n* **end** the index of the matching `b`\n* **pre** the preamble, `a` and `b` not included\n* **body** the match, `a` and `b` not included\n* **post** the postscript, `a` and `b` not included\n\nIf there's no match, `undefined` will be returned.\n\nIf the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.\n\n### var r = balanced.range(a, b, str)\n\nFor the first non-nested matching pair of `a` and `b` in `str`, return an\narray with indexes: `[ , ]`.\n\nIf there's no match, `undefined` will be returned.\n\nIf the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.\n\n## Installation\n\nWith [npm](https://npmjs.org) do:\n\n```bash\nnpm install balanced-match\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber <julian@juliangruber.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "scripts": { + "bench": "make bench", + "test": "make test" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..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": "1.0.0" +} diff --git a/legacy-libs/grpc/node_modules/brace-expansion/LICENSE b/legacy-libs/grpc/node_modules/brace-expansion/LICENSE new file mode 100644 index 0000000..de32266 --- /dev/null +++ b/legacy-libs/grpc/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +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/legacy-libs/grpc/node_modules/brace-expansion/README.md b/legacy-libs/grpc/node_modules/brace-expansion/README.md new file mode 100644 index 0000000..6b4e0e1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/brace-expansion/README.md @@ -0,0 +1,129 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/legacy-libs/grpc/node_modules/brace-expansion/index.js b/legacy-libs/grpc/node_modules/brace-expansion/index.js new file mode 100644 index 0000000..0478be8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/brace-expansion/index.js @@ -0,0 +1,201 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/legacy-libs/grpc/node_modules/brace-expansion/package.json b/legacy-libs/grpc/node_modules/brace-expansion/package.json new file mode 100644 index 0000000..5256a00 --- /dev/null +++ b/legacy-libs/grpc/node_modules/brace-expansion/package.json @@ -0,0 +1,82 @@ +{ + "_args": [ + [ + "brace-expansion@1.1.11", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "brace-expansion@1.1.11", + "_id": "brace-expansion@1.1.11", + "_inBundle": false, + "_integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "_location": "/grpc/brace-expansion", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "brace-expansion@1.1.11", + "name": "brace-expansion", + "escapedName": "brace-expansion", + "rawSpec": "1.1.11", + "saveSpec": null, + "fetchSpec": "1.1.11" + }, + "_requiredBy": [ + "/grpc/minimatch" + ], + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "_shrinkwrap": null, + "_spec": "1.1.11", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "description": "Brace expansion as known from sh/bash", + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "keywords": [], + "license": "MIT", + "main": "index.js", + "name": "brace-expansion", + "optionalDependencies": {}, + "readme": "# brace-expansion\n\n[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), \nas known from sh/bash, in JavaScript.\n\n[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion)\n[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion)\n[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/)\n\n[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion)\n\n## Example\n\n```js\nvar expand = require('brace-expansion');\n\nexpand('file-{a,b,c}.jpg')\n// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']\n\nexpand('-v{,,}')\n// => ['-v', '-v', '-v']\n\nexpand('file{0..2}.jpg')\n// => ['file0.jpg', 'file1.jpg', 'file2.jpg']\n\nexpand('file-{a..c}.jpg')\n// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']\n\nexpand('file{2..0}.jpg')\n// => ['file2.jpg', 'file1.jpg', 'file0.jpg']\n\nexpand('file{0..4..2}.jpg')\n// => ['file0.jpg', 'file2.jpg', 'file4.jpg']\n\nexpand('file-{a..e..2}.jpg')\n// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']\n\nexpand('file{00..10..5}.jpg')\n// => ['file00.jpg', 'file05.jpg', 'file10.jpg']\n\nexpand('{{A..C},{a..c}}')\n// => ['A', 'B', 'C', 'a', 'b', 'c']\n\nexpand('ppp{,config,oe{,conf}}')\n// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']\n```\n\n## API\n\n```js\nvar expand = require('brace-expansion');\n```\n\n### var expanded = expand(str)\n\nReturn an array of all possible and valid expansions of `str`. If none are\nfound, `[str]` is returned.\n\nValid expansions are:\n\n```js\n/^(.*,)+(.+)?$/\n// {a,b,...}\n```\n\nA comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.\n\n```js\n/^-?\\d+\\.\\.-?\\d+(\\.\\.-?\\d+)?$/\n// {x..y[..incr]}\n```\n\nA numeric sequence from `x` to `y` inclusive, with optional increment.\nIf `x` or `y` start with a leading `0`, all the numbers will be padded\nto have equal length. Negative numbers and backwards iteration work too.\n\n```js\n/^-?\\d+\\.\\.-?\\d+(\\.\\.-?\\d+)?$/\n// {x..y[..incr]}\n```\n\nAn alphabetic sequence from `x` to `y` inclusive, with optional increment.\n`x` and `y` must be exactly one character, and if given, `incr` must be a\nnumber.\n\nFor compatibility reasons, the string `${` is not eligible for brace expansion.\n\n## Installation\n\nWith [npm](https://npmjs.org) do:\n\n```bash\nnpm install brace-expansion\n```\n\n## Contributors\n\n- [Julian Gruber](https://github.com/juliangruber)\n- [Isaac Z. Schlueter](https://github.com/isaacs)\n\n## Sponsors\n\nThis module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!\n\nDo you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber <julian@juliangruber.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "scripts": { + "bench": "matcha test/perf/bench.js", + "gentest": "bash test/generate.sh", + "test": "tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..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": "1.1.11" +} diff --git a/legacy-libs/grpc/node_modules/chownr/LICENSE b/legacy-libs/grpc/node_modules/chownr/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/chownr/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/chownr/README.md b/legacy-libs/grpc/node_modules/chownr/README.md new file mode 100644 index 0000000..70e9a54 --- /dev/null +++ b/legacy-libs/grpc/node_modules/chownr/README.md @@ -0,0 +1,3 @@ +Like `chown -R`. + +Takes the same arguments as `fs.chown()` diff --git a/legacy-libs/grpc/node_modules/chownr/chownr.js b/legacy-libs/grpc/node_modules/chownr/chownr.js new file mode 100644 index 0000000..7e63928 --- /dev/null +++ b/legacy-libs/grpc/node_modules/chownr/chownr.js @@ -0,0 +1,88 @@ +'use strict' +const fs = require('fs') +const path = require('path') + +/* istanbul ignore next */ +const LCHOWN = fs.lchown ? 'lchown' : 'chown' +/* istanbul ignore next */ +const LCHOWNSYNC = fs.lchownSync ? 'lchownSync' : 'chownSync' + +// fs.readdir could only accept an options object as of node v6 +const nodeVersion = process.version +let readdir = (path, options, cb) => fs.readdir(path, options, cb) +let readdirSync = (path, options) => fs.readdirSync(path, options) +/* istanbul ignore next */ +if (/^v4\./.test(nodeVersion)) + readdir = (path, options, cb) => fs.readdir(path, cb) + +const chownrKid = (p, child, uid, gid, cb) => { + if (typeof child === 'string') + return fs.lstat(path.resolve(p, child), (er, stats) => { + if (er) + return cb(er) + stats.name = child + chownrKid(p, stats, uid, gid, cb) + }) + + if (child.isDirectory()) { + chownr(path.resolve(p, child.name), uid, gid, er => { + if (er) + return cb(er) + fs[LCHOWN](path.resolve(p, child.name), uid, gid, cb) + }) + } else + fs[LCHOWN](path.resolve(p, child.name), uid, gid, cb) +} + + +const chownr = (p, uid, gid, cb) => { + readdir(p, { withFileTypes: true }, (er, children) => { + // any error other than ENOTDIR or ENOTSUP means it's not readable, + // or doesn't exist. give up. + if (er && er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') + return cb(er) + if (er || !children.length) return fs[LCHOWN](p, uid, gid, cb) + + let len = children.length + let errState = null + const then = er => { + if (errState) return + if (er) return cb(errState = er) + if (-- len === 0) return fs[LCHOWN](p, uid, gid, cb) + } + + children.forEach(child => chownrKid(p, child, uid, gid, then)) + }) +} + +const chownrKidSync = (p, child, uid, gid) => { + if (typeof child === 'string') { + const stats = fs.lstatSync(path.resolve(p, child)) + stats.name = child + child = stats + } + + if (child.isDirectory()) + chownrSync(path.resolve(p, child.name), uid, gid) + + fs[LCHOWNSYNC](path.resolve(p, child.name), uid, gid) +} + +const chownrSync = (p, uid, gid) => { + let children + try { + children = readdirSync(p, { withFileTypes: true }) + } catch (er) { + if (er && er.code === 'ENOTDIR' && er.code !== 'ENOTSUP') + return fs[LCHOWNSYNC](p, uid, gid) + throw er + } + + if (children.length) + children.forEach(child => chownrKidSync(p, child, uid, gid)) + + return fs[LCHOWNSYNC](p, uid, gid) +} + +module.exports = chownr +chownr.sync = chownrSync diff --git a/legacy-libs/grpc/node_modules/chownr/package.json b/legacy-libs/grpc/node_modules/chownr/package.json new file mode 100644 index 0000000..c6bedef --- /dev/null +++ b/legacy-libs/grpc/node_modules/chownr/package.json @@ -0,0 +1,64 @@ +{ + "_from": "chownr@^1.1.1", + "_id": "chownr@1.1.1", + "_inBundle": false, + "_integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", + "_location": "/grpc/chownr", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "chownr@^1.1.1", + "name": "chownr", + "escapedName": "chownr", + "rawSpec": "^1.1.1", + "saveSpec": null, + "fetchSpec": "^1.1.1" + }, + "_requiredBy": [ + "/grpc/tar" + ], + "_resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", + "_shasum": "54726b8b8fff4df053c42187e801fb4412df1494", + "_shrinkwrap": null, + "_spec": "chownr@^1.1.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/tar", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/chownr/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "like `chown -R`", + "devDependencies": { + "mkdirp": "0.3", + "rimraf": "", + "tap": "^12.0.1" + }, + "files": [ + "chownr.js" + ], + "homepage": "https://github.com/isaacs/chownr#readme", + "license": "ISC", + "main": "chownr.js", + "name": "chownr", + "optionalDependencies": {}, + "readme": "Like `chown -R`.\n\nTakes the same arguments as `fs.chown()`\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/chownr.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --cov" + }, + "version": "1.1.1" +} diff --git a/legacy-libs/grpc/node_modules/code-point-at/index.js b/legacy-libs/grpc/node_modules/code-point-at/index.js new file mode 100644 index 0000000..0432fe6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/code-point-at/index.js @@ -0,0 +1,32 @@ +/* eslint-disable babel/new-cap, xo/throw-new-error */ +'use strict'; +module.exports = function (str, pos) { + if (str === null || str === undefined) { + throw TypeError(); + } + + str = String(str); + + var size = str.length; + var i = pos ? Number(pos) : 0; + + if (Number.isNaN(i)) { + i = 0; + } + + if (i < 0 || i >= size) { + return undefined; + } + + var first = str.charCodeAt(i); + + if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { + var second = str.charCodeAt(i + 1); + + if (second >= 0xDC00 && second <= 0xDFFF) { + return ((first - 0xD800) * 0x400) + second - 0xDC00 + 0x10000; + } + } + + return first; +}; diff --git a/legacy-libs/grpc/node_modules/code-point-at/license b/legacy-libs/grpc/node_modules/code-point-at/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/legacy-libs/grpc/node_modules/code-point-at/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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/legacy-libs/grpc/node_modules/code-point-at/package.json b/legacy-libs/grpc/node_modules/code-point-at/package.json new file mode 100644 index 0000000..0d7150f --- /dev/null +++ b/legacy-libs/grpc/node_modules/code-point-at/package.json @@ -0,0 +1,78 @@ +{ + "_args": [ + [ + "code-point-at@1.1.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "code-point-at@1.1.0", + "_id": "code-point-at@1.1.0", + "_inBundle": false, + "_integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "_location": "/grpc/code-point-at", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "code-point-at@1.1.0", + "name": "code-point-at", + "escapedName": "code-point-at", + "rawSpec": "1.1.0", + "saveSpec": null, + "fetchSpec": "1.1.0" + }, + "_requiredBy": [ + "/grpc/string-width" + ], + "_resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "_shrinkwrap": null, + "_spec": "1.1.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/code-point-at/issues" + }, + "dependencies": {}, + "description": "ES2015 `String#codePointAt()` ponyfill", + "devDependencies": { + "ava": "*", + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/code-point-at#readme", + "keywords": [ + "es2015", + "ponyfill", + "polyfill", + "shim", + "string", + "str", + "code", + "point", + "at", + "codepoint", + "unicode" + ], + "license": "MIT", + "name": "code-point-at", + "optionalDependencies": {}, + "readme": "# code-point-at [![Build Status](https://travis-ci.org/sindresorhus/code-point-at.svg?branch=master)](https://travis-ci.org/sindresorhus/code-point-at)\n\n> ES2015 [`String#codePointAt()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) [ponyfill](https://ponyfill.com)\n\n\n## Install\n\n```\n$ npm install --save code-point-at\n```\n\n\n## Usage\n\n```js\nvar codePointAt = require('code-point-at');\n\ncodePointAt('🐴');\n//=> 128052\n\ncodePointAt('abc', 2);\n//=> 99\n```\n\n## API\n\n### codePointAt(input, [position])\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/code-point-at.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.1.0" +} diff --git a/legacy-libs/grpc/node_modules/code-point-at/readme.md b/legacy-libs/grpc/node_modules/code-point-at/readme.md new file mode 100644 index 0000000..4c97730 --- /dev/null +++ b/legacy-libs/grpc/node_modules/code-point-at/readme.md @@ -0,0 +1,32 @@ +# code-point-at [![Build Status](https://travis-ci.org/sindresorhus/code-point-at.svg?branch=master)](https://travis-ci.org/sindresorhus/code-point-at) + +> ES2015 [`String#codePointAt()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save code-point-at +``` + + +## Usage + +```js +var codePointAt = require('code-point-at'); + +codePointAt('🐴'); +//=> 128052 + +codePointAt('abc', 2); +//=> 99 +``` + +## API + +### codePointAt(input, [position]) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/legacy-libs/grpc/node_modules/concat-map/LICENSE b/legacy-libs/grpc/node_modules/concat-map/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/legacy-libs/grpc/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +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/legacy-libs/grpc/node_modules/concat-map/README.markdown b/legacy-libs/grpc/node_modules/concat-map/README.markdown new file mode 100644 index 0000000..408f70a --- /dev/null +++ b/legacy-libs/grpc/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/legacy-libs/grpc/node_modules/concat-map/example/map.js b/legacy-libs/grpc/node_modules/concat-map/example/map.js new file mode 100644 index 0000000..3365621 --- /dev/null +++ b/legacy-libs/grpc/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/legacy-libs/grpc/node_modules/concat-map/index.js b/legacy-libs/grpc/node_modules/concat-map/index.js new file mode 100644 index 0000000..b29a781 --- /dev/null +++ b/legacy-libs/grpc/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/legacy-libs/grpc/node_modules/concat-map/package.json b/legacy-libs/grpc/node_modules/concat-map/package.json new file mode 100644 index 0000000..5601b9f --- /dev/null +++ b/legacy-libs/grpc/node_modules/concat-map/package.json @@ -0,0 +1,96 @@ +{ + "_args": [ + [ + "concat-map@0.0.1", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "concat-map@0.0.1", + "_id": "concat-map@0.0.1", + "_inBundle": false, + "_integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "_location": "/grpc/concat-map", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "concat-map@0.0.1", + "name": "concat-map", + "escapedName": "concat-map", + "rawSpec": "0.0.1", + "saveSpec": null, + "fetchSpec": "0.0.1" + }, + "_requiredBy": [ + "/grpc/brace-expansion" + ], + "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "_shrinkwrap": null, + "_spec": "0.0.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/node-concat-map/issues" + }, + "dependencies": {}, + "description": "concatenative mapdashery", + "devDependencies": { + "tape": "~2.4.0" + }, + "directories": { + "example": "example", + "test": "test" + }, + "homepage": "https://github.com/substack/node-concat-map#readme", + "keywords": [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "license": "MIT", + "main": "index.js", + "name": "concat-map", + "optionalDependencies": {}, + "readme": "concat-map\n==========\n\nConcatenative mapdashery.\n\n[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map)\n\n[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map)\n\nexample\n=======\n\n``` js\nvar concatMap = require('concat-map');\nvar xs = [ 1, 2, 3, 4, 5, 6 ];\nvar ys = concatMap(xs, function (x) {\n return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];\n});\nconsole.dir(ys);\n```\n\n***\n\n```\n[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]\n```\n\nmethods\n=======\n\n``` js\nvar concatMap = require('concat-map')\n```\n\nconcatMap(xs, fn)\n-----------------\n\nReturn an array of concatenated elements by calling `fn(x, i)` for each element\n`x` and each index `i` in the array `xs`.\n\nWhen `fn(x, i)` returns an array, its result will be concatenated with the\nresult array. If `fn(x, i)` returns anything else, that value will be pushed\nonto the end of the result array.\n\ninstall\n=======\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install concat-map\n```\n\nlicense\n=======\n\nMIT\n\nnotes\n=====\n\nThis module was written while sitting high above the ground in a tree.\n", + "readmeFilename": "README.markdown", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-concat-map.git" + }, + "scripts": { + "test": "tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "version": "0.0.1" +} diff --git a/legacy-libs/grpc/node_modules/concat-map/test/map.js b/legacy-libs/grpc/node_modules/concat-map/test/map.js new file mode 100644 index 0000000..fdbd702 --- /dev/null +++ b/legacy-libs/grpc/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/console-control-strings/LICENSE b/legacy-libs/grpc/node_modules/console-control-strings/LICENSE new file mode 100644 index 0000000..e756052 --- /dev/null +++ b/legacy-libs/grpc/node_modules/console-control-strings/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2014, Rebecca Turner + +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/legacy-libs/grpc/node_modules/console-control-strings/README.md b/legacy-libs/grpc/node_modules/console-control-strings/README.md new file mode 100644 index 0000000..f58cc8d --- /dev/null +++ b/legacy-libs/grpc/node_modules/console-control-strings/README.md @@ -0,0 +1,145 @@ +# Console Control Strings + +A library of cross-platform tested terminal/console command strings for +doing things like color and cursor positioning. This is a subset of both +ansi and vt100. All control codes included work on both Windows & Unix-like +OSes, except where noted. + +## Usage + +```js +var consoleControl = require('console-control-strings') + +console.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset')) +process.stdout.write(consoleControl.goto(75, 10)) +``` + +## Why Another? + +There are tons of libraries similar to this one. I wanted one that was: + +1. Very clear about compatibility goals. +2. Could emit, for instance, a start color code without an end one. +3. Returned strings w/o writing to streams. +4. Was not weighed down with other unrelated baggage. + +## Functions + +### var code = consoleControl.up(_num = 1_) + +Returns the escape sequence to move _num_ lines up. + +### var code = consoleControl.down(_num = 1_) + +Returns the escape sequence to move _num_ lines down. + +### var code = consoleControl.forward(_num = 1_) + +Returns the escape sequence to move _num_ lines righ. + +### var code = consoleControl.back(_num = 1_) + +Returns the escape sequence to move _num_ lines left. + +### var code = consoleControl.nextLine(_num = 1_) + +Returns the escape sequence to move _num_ lines down and to the beginning of +the line. + +### var code = consoleControl.previousLine(_num = 1_) + +Returns the escape sequence to move _num_ lines up and to the beginning of +the line. + +### var code = consoleControl.eraseData() + +Returns the escape sequence to erase everything from the current cursor +position to the bottom right of the screen. This is line based, so it +erases the remainder of the current line and all following lines. + +### var code = consoleControl.eraseLine() + +Returns the escape sequence to erase to the end of the current line. + +### var code = consoleControl.goto(_x_, _y_) + +Returns the escape sequence to move the cursor to the designated position. +Note that the origin is _1, 1_ not _0, 0_. + +### var code = consoleControl.gotoSOL() + +Returns the escape sequence to move the cursor to the beginning of the +current line. (That is, it returns a carriage return, `\r`.) + +### var code = consoleControl.beep() + +Returns the escape sequence to cause the termianl to beep. (That is, it +returns unicode character `\x0007`, a Control-G.) + +### var code = consoleControl.hideCursor() + +Returns the escape sequence to hide the cursor. + +### var code = consoleControl.showCursor() + +Returns the escape sequence to show the cursor. + +### var code = consoleControl.color(_colors = []_) + +### var code = consoleControl.color(_color1_, _color2_, _…_, _colorn_) + +Returns the escape sequence to set the current terminal display attributes +(mostly colors). Arguments can either be a list of attributes or an array +of attributes. The difference between passing in an array or list of colors +and calling `.color` separately for each one, is that in the former case a +single escape sequence will be produced where as in the latter each change +will have its own distinct escape sequence. Each attribute can be one of: + +* Reset: + * **reset** – Reset all attributes to the terminal default. +* Styles: + * **bold** – Display text as bold. In some terminals this means using a + bold font, in others this means changing the color. In some it means + both. + * **italic** – Display text as italic. This is not available in most Windows terminals. + * **underline** – Underline text. This is not available in most Windows Terminals. + * **inverse** – Invert the foreground and background colors. + * **stopBold** – Do not display text as bold. + * **stopItalic** – Do not display text as italic. + * **stopUnderline** – Do not underline text. + * **stopInverse** – Do not invert foreground and background. +* Colors: + * **white** + * **black** + * **blue** + * **cyan** + * **green** + * **magenta** + * **red** + * **yellow** + * **grey** / **brightBlack** + * **brightRed** + * **brightGreen** + * **brightYellow** + * **brightBlue** + * **brightMagenta** + * **brightCyan** + * **brightWhite** +* Background Colors: + * **bgWhite** + * **bgBlack** + * **bgBlue** + * **bgCyan** + * **bgGreen** + * **bgMagenta** + * **bgRed** + * **bgYellow** + * **bgGrey** / **bgBrightBlack** + * **bgBrightRed** + * **bgBrightGreen** + * **bgBrightYellow** + * **bgBrightBlue** + * **bgBrightMagenta** + * **bgBrightCyan** + * **bgBrightWhite** + diff --git a/legacy-libs/grpc/node_modules/console-control-strings/README.md~ b/legacy-libs/grpc/node_modules/console-control-strings/README.md~ new file mode 100644 index 0000000..6eb34e8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/console-control-strings/README.md~ @@ -0,0 +1,140 @@ +# Console Control Strings + +A library of cross-platform tested terminal/console command strings for +doing things like color and cursor positioning. This is a subset of both +ansi and vt100. All control codes included work on both Windows & Unix-like +OSes, except where noted. + +## Usage + +```js +var consoleControl = require('console-control-strings') + +console.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset')) +process.stdout.write(consoleControl.goto(75, 10)) +``` + +## Why Another? + +There are tons of libraries similar to this one. I wanted one that was: + +1. Very clear about compatibility goals. +2. Could emit, for instance, a start color code without an end one. +3. Returned strings w/o writing to streams. +4. Was not weighed down with other unrelated baggage. + +## Functions + +### var code = consoleControl.up(_num = 1_) + +Returns the escape sequence to move _num_ lines up. + +### var code = consoleControl.down(_num = 1_) + +Returns the escape sequence to move _num_ lines down. + +### var code = consoleControl.forward(_num = 1_) + +Returns the escape sequence to move _num_ lines righ. + +### var code = consoleControl.back(_num = 1_) + +Returns the escape sequence to move _num_ lines left. + +### var code = consoleControl.nextLine(_num = 1_) + +Returns the escape sequence to move _num_ lines down and to the beginning of +the line. + +### var code = consoleControl.previousLine(_num = 1_) + +Returns the escape sequence to move _num_ lines up and to the beginning of +the line. + +### var code = consoleControl.eraseData() + +Returns the escape sequence to erase everything from the current cursor +position to the bottom right of the screen. This is line based, so it +erases the remainder of the current line and all following lines. + +### var code = consoleControl.eraseLine() + +Returns the escape sequence to erase to the end of the current line. + +### var code = consoleControl.goto(_x_, _y_) + +Returns the escape sequence to move the cursor to the designated position. +Note that the origin is _1, 1_ not _0, 0_. + +### var code = consoleControl.gotoSOL() + +Returns the escape sequence to move the cursor to the beginning of the +current line. (That is, it returns a carriage return, `\r`.) + +### var code = consoleControl.hideCursor() + +Returns the escape sequence to hide the cursor. + +### var code = consoleControl.showCursor() + +Returns the escape sequence to show the cursor. + +### var code = consoleControl.color(_colors = []_) + +### var code = consoleControl.color(_color1_, _color2_, _…_, _colorn_) + +Returns the escape sequence to set the current terminal display attributes +(mostly colors). Arguments can either be a list of attributes or an array +of attributes. The difference between passing in an array or list of colors +and calling `.color` separately for each one, is that in the former case a +single escape sequence will be produced where as in the latter each change +will have its own distinct escape sequence. Each attribute can be one of: + +* Reset: + * **reset** – Reset all attributes to the terminal default. +* Styles: + * **bold** – Display text as bold. In some terminals this means using a + bold font, in others this means changing the color. In some it means + both. + * **italic** – Display text as italic. This is not available in most Windows terminals. + * **underline** – Underline text. This is not available in most Windows Terminals. + * **inverse** – Invert the foreground and background colors. + * **stopBold** – Do not display text as bold. + * **stopItalic** – Do not display text as italic. + * **stopUnderline** – Do not underline text. + * **stopInverse** – Do not invert foreground and background. +* Colors: + * **white** + * **black** + * **blue** + * **cyan** + * **green** + * **magenta** + * **red** + * **yellow** + * **grey** / **brightBlack** + * **brightRed** + * **brightGreen** + * **brightYellow** + * **brightBlue** + * **brightMagenta** + * **brightCyan** + * **brightWhite** +* Background Colors: + * **bgWhite** + * **bgBlack** + * **bgBlue** + * **bgCyan** + * **bgGreen** + * **bgMagenta** + * **bgRed** + * **bgYellow** + * **bgGrey** / **bgBrightBlack** + * **bgBrightRed** + * **bgBrightGreen** + * **bgBrightYellow** + * **bgBrightBlue** + * **bgBrightMagenta** + * **bgBrightCyan** + * **bgBrightWhite** + diff --git a/legacy-libs/grpc/node_modules/console-control-strings/index.js b/legacy-libs/grpc/node_modules/console-control-strings/index.js new file mode 100644 index 0000000..bf89034 --- /dev/null +++ b/legacy-libs/grpc/node_modules/console-control-strings/index.js @@ -0,0 +1,125 @@ +'use strict' + +// These tables borrowed from `ansi` + +var prefix = '\x1b[' + +exports.up = function up (num) { + return prefix + (num || '') + 'A' +} + +exports.down = function down (num) { + return prefix + (num || '') + 'B' +} + +exports.forward = function forward (num) { + return prefix + (num || '') + 'C' +} + +exports.back = function back (num) { + return prefix + (num || '') + 'D' +} + +exports.nextLine = function nextLine (num) { + return prefix + (num || '') + 'E' +} + +exports.previousLine = function previousLine (num) { + return prefix + (num || '') + 'F' +} + +exports.horizontalAbsolute = function horizontalAbsolute (num) { + if (num == null) throw new Error('horizontalAboslute requires a column to position to') + return prefix + num + 'G' +} + +exports.eraseData = function eraseData () { + return prefix + 'J' +} + +exports.eraseLine = function eraseLine () { + return prefix + 'K' +} + +exports.goto = function (x, y) { + return prefix + y + ';' + x + 'H' +} + +exports.gotoSOL = function () { + return '\r' +} + +exports.beep = function () { + return '\x07' +} + +exports.hideCursor = function hideCursor () { + return prefix + '?25l' +} + +exports.showCursor = function showCursor () { + return prefix + '?25h' +} + +var colors = { + reset: 0, +// styles + bold: 1, + italic: 3, + underline: 4, + inverse: 7, +// resets + stopBold: 22, + stopItalic: 23, + stopUnderline: 24, + stopInverse: 27, +// colors + white: 37, + black: 30, + blue: 34, + cyan: 36, + green: 32, + magenta: 35, + red: 31, + yellow: 33, + bgWhite: 47, + bgBlack: 40, + bgBlue: 44, + bgCyan: 46, + bgGreen: 42, + bgMagenta: 45, + bgRed: 41, + bgYellow: 43, + + grey: 90, + brightBlack: 90, + brightRed: 91, + brightGreen: 92, + brightYellow: 93, + brightBlue: 94, + brightMagenta: 95, + brightCyan: 96, + brightWhite: 97, + + bgGrey: 100, + bgBrightBlack: 100, + bgBrightRed: 101, + bgBrightGreen: 102, + bgBrightYellow: 103, + bgBrightBlue: 104, + bgBrightMagenta: 105, + bgBrightCyan: 106, + bgBrightWhite: 107 +} + +exports.color = function color (colorWith) { + if (arguments.length !== 1 || !Array.isArray(colorWith)) { + colorWith = Array.prototype.slice.call(arguments) + } + return prefix + colorWith.map(colorNameToCode).join(';') + 'm' +} + +function colorNameToCode (color) { + if (colors[color] != null) return colors[color] + throw new Error('Unknown color or style name: ' + color) +} diff --git a/legacy-libs/grpc/node_modules/console-control-strings/package.json b/legacy-libs/grpc/node_modules/console-control-strings/package.json new file mode 100644 index 0000000..85dd604 --- /dev/null +++ b/legacy-libs/grpc/node_modules/console-control-strings/package.json @@ -0,0 +1,69 @@ +{ + "_args": [ + [ + "console-control-strings@1.1.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "console-control-strings@1.1.0", + "_id": "console-control-strings@1.1.0", + "_inBundle": false, + "_integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "_location": "/grpc/console-control-strings", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "console-control-strings@1.1.0", + "name": "console-control-strings", + "escapedName": "console-control-strings", + "rawSpec": "1.1.0", + "saveSpec": null, + "fetchSpec": "1.1.0" + }, + "_requiredBy": [ + "/grpc/gauge", + "/grpc/npmlog" + ], + "_resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "_shrinkwrap": null, + "_spec": "1.1.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Rebecca Turner", + "email": "me@re-becca.org", + "url": "http://re-becca.org/" + }, + "bugs": { + "url": "https://github.com/iarna/console-control-strings/issues" + }, + "dependencies": {}, + "description": "A library of cross-platform tested terminal/console command strings for doing things like color and cursor positioning. This is a subset of both ansi and vt100. All control codes included work on both Windows & Unix-like OSes, except where noted.", + "devDependencies": { + "standard": "^7.1.2", + "tap": "^5.7.2" + }, + "directories": { + "test": "test" + }, + "files": [ + "LICENSE", + "index.js" + ], + "homepage": "https://github.com/iarna/console-control-strings#readme", + "keywords": [], + "license": "ISC", + "main": "index.js", + "name": "console-control-strings", + "optionalDependencies": {}, + "readme": "# Console Control Strings\n\nA library of cross-platform tested terminal/console command strings for\ndoing things like color and cursor positioning. This is a subset of both\nansi and vt100. All control codes included work on both Windows & Unix-like\nOSes, except where noted.\n\n## Usage\n\n```js\nvar consoleControl = require('console-control-strings')\n\nconsole.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset'))\nprocess.stdout.write(consoleControl.goto(75, 10))\n```\n\n## Why Another?\n\nThere are tons of libraries similar to this one. I wanted one that was:\n\n1. Very clear about compatibility goals.\n2. Could emit, for instance, a start color code without an end one.\n3. Returned strings w/o writing to streams.\n4. Was not weighed down with other unrelated baggage.\n\n## Functions\n\n### var code = consoleControl.up(_num = 1_)\n\nReturns the escape sequence to move _num_ lines up.\n\n### var code = consoleControl.down(_num = 1_)\n\nReturns the escape sequence to move _num_ lines down.\n\n### var code = consoleControl.forward(_num = 1_)\n\nReturns the escape sequence to move _num_ lines righ.\n\n### var code = consoleControl.back(_num = 1_)\n\nReturns the escape sequence to move _num_ lines left.\n\n### var code = consoleControl.nextLine(_num = 1_)\n\nReturns the escape sequence to move _num_ lines down and to the beginning of\nthe line.\n\n### var code = consoleControl.previousLine(_num = 1_)\n\nReturns the escape sequence to move _num_ lines up and to the beginning of\nthe line.\n\n### var code = consoleControl.eraseData()\n\nReturns the escape sequence to erase everything from the current cursor\nposition to the bottom right of the screen. This is line based, so it\nerases the remainder of the current line and all following lines.\n\n### var code = consoleControl.eraseLine()\n\nReturns the escape sequence to erase to the end of the current line.\n\n### var code = consoleControl.goto(_x_, _y_)\n\nReturns the escape sequence to move the cursor to the designated position. \nNote that the origin is _1, 1_ not _0, 0_.\n\n### var code = consoleControl.gotoSOL()\n\nReturns the escape sequence to move the cursor to the beginning of the\ncurrent line. (That is, it returns a carriage return, `\\r`.)\n\n### var code = consoleControl.beep()\n\nReturns the escape sequence to cause the termianl to beep. (That is, it\nreturns unicode character `\\x0007`, a Control-G.)\n\n### var code = consoleControl.hideCursor()\n\nReturns the escape sequence to hide the cursor.\n\n### var code = consoleControl.showCursor()\n\nReturns the escape sequence to show the cursor.\n\n### var code = consoleControl.color(_colors = []_)\n\n### var code = consoleControl.color(_color1_, _color2_, _…_, _colorn_)\n\nReturns the escape sequence to set the current terminal display attributes\n(mostly colors). Arguments can either be a list of attributes or an array\nof attributes. The difference between passing in an array or list of colors\nand calling `.color` separately for each one, is that in the former case a\nsingle escape sequence will be produced where as in the latter each change\nwill have its own distinct escape sequence. Each attribute can be one of:\n\n* Reset:\n * **reset** – Reset all attributes to the terminal default.\n* Styles:\n * **bold** – Display text as bold. In some terminals this means using a\n bold font, in others this means changing the color. In some it means\n both.\n * **italic** – Display text as italic. This is not available in most Windows terminals.\n * **underline** – Underline text. This is not available in most Windows Terminals.\n * **inverse** – Invert the foreground and background colors.\n * **stopBold** – Do not display text as bold.\n * **stopItalic** – Do not display text as italic.\n * **stopUnderline** – Do not underline text.\n * **stopInverse** – Do not invert foreground and background.\n* Colors:\n * **white**\n * **black**\n * **blue**\n * **cyan**\n * **green**\n * **magenta**\n * **red**\n * **yellow**\n * **grey** / **brightBlack**\n * **brightRed**\n * **brightGreen**\n * **brightYellow**\n * **brightBlue**\n * **brightMagenta**\n * **brightCyan**\n * **brightWhite**\n* Background Colors:\n * **bgWhite**\n * **bgBlack**\n * **bgBlue**\n * **bgCyan**\n * **bgGreen**\n * **bgMagenta**\n * **bgRed**\n * **bgYellow**\n * **bgGrey** / **bgBrightBlack**\n * **bgBrightRed**\n * **bgBrightGreen**\n * **bgBrightYellow**\n * **bgBrightBlue**\n * **bgBrightMagenta**\n * **bgBrightCyan**\n * **bgBrightWhite**\n\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/console-control-strings.git" + }, + "scripts": { + "test": "standard && tap test/*.js" + }, + "version": "1.1.0" +} diff --git a/legacy-libs/grpc/node_modules/core-util-is/LICENSE b/legacy-libs/grpc/node_modules/core-util-is/LICENSE new file mode 100644 index 0000000..d8d7f94 --- /dev/null +++ b/legacy-libs/grpc/node_modules/core-util-is/LICENSE @@ -0,0 +1,19 @@ +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. diff --git a/legacy-libs/grpc/node_modules/core-util-is/README.md b/legacy-libs/grpc/node_modules/core-util-is/README.md new file mode 100644 index 0000000..5a76b41 --- /dev/null +++ b/legacy-libs/grpc/node_modules/core-util-is/README.md @@ -0,0 +1,3 @@ +# core-util-is + +The `util.is*` functions introduced in Node v0.12. diff --git a/legacy-libs/grpc/node_modules/core-util-is/float.patch b/legacy-libs/grpc/node_modules/core-util-is/float.patch new file mode 100644 index 0000000..a06d5c0 --- /dev/null +++ b/legacy-libs/grpc/node_modules/core-util-is/float.patch @@ -0,0 +1,604 @@ +diff --git a/lib/util.js b/lib/util.js +index a03e874..9074e8e 100644 +--- a/lib/util.js ++++ b/lib/util.js +@@ -19,430 +19,6 @@ + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + +-var formatRegExp = /%[sdj%]/g; +-exports.format = function(f) { +- if (!isString(f)) { +- var objects = []; +- for (var i = 0; i < arguments.length; i++) { +- objects.push(inspect(arguments[i])); +- } +- return objects.join(' '); +- } +- +- var i = 1; +- var args = arguments; +- var len = args.length; +- var str = String(f).replace(formatRegExp, function(x) { +- if (x === '%%') return '%'; +- if (i >= len) return x; +- switch (x) { +- case '%s': return String(args[i++]); +- case '%d': return Number(args[i++]); +- case '%j': +- try { +- return JSON.stringify(args[i++]); +- } catch (_) { +- return '[Circular]'; +- } +- default: +- return x; +- } +- }); +- for (var x = args[i]; i < len; x = args[++i]) { +- if (isNull(x) || !isObject(x)) { +- str += ' ' + x; +- } else { +- str += ' ' + inspect(x); +- } +- } +- return str; +-}; +- +- +-// Mark that a method should not be used. +-// Returns a modified function which warns once by default. +-// If --no-deprecation is set, then it is a no-op. +-exports.deprecate = function(fn, msg) { +- // Allow for deprecating things in the process of starting up. +- if (isUndefined(global.process)) { +- return function() { +- return exports.deprecate(fn, msg).apply(this, arguments); +- }; +- } +- +- if (process.noDeprecation === true) { +- return fn; +- } +- +- var warned = false; +- function deprecated() { +- if (!warned) { +- if (process.throwDeprecation) { +- throw new Error(msg); +- } else if (process.traceDeprecation) { +- console.trace(msg); +- } else { +- console.error(msg); +- } +- warned = true; +- } +- return fn.apply(this, arguments); +- } +- +- return deprecated; +-}; +- +- +-var debugs = {}; +-var debugEnviron; +-exports.debuglog = function(set) { +- if (isUndefined(debugEnviron)) +- debugEnviron = process.env.NODE_DEBUG || ''; +- set = set.toUpperCase(); +- if (!debugs[set]) { +- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { +- var pid = process.pid; +- debugs[set] = function() { +- var msg = exports.format.apply(exports, arguments); +- console.error('%s %d: %s', set, pid, msg); +- }; +- } else { +- debugs[set] = function() {}; +- } +- } +- return debugs[set]; +-}; +- +- +-/** +- * Echos the value of a value. Trys to print the value out +- * in the best way possible given the different types. +- * +- * @param {Object} obj The object to print out. +- * @param {Object} opts Optional options object that alters the output. +- */ +-/* legacy: obj, showHidden, depth, colors*/ +-function inspect(obj, opts) { +- // default options +- var ctx = { +- seen: [], +- stylize: stylizeNoColor +- }; +- // legacy... +- if (arguments.length >= 3) ctx.depth = arguments[2]; +- if (arguments.length >= 4) ctx.colors = arguments[3]; +- if (isBoolean(opts)) { +- // legacy... +- ctx.showHidden = opts; +- } else if (opts) { +- // got an "options" object +- exports._extend(ctx, opts); +- } +- // set default options +- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; +- if (isUndefined(ctx.depth)) ctx.depth = 2; +- if (isUndefined(ctx.colors)) ctx.colors = false; +- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; +- if (ctx.colors) ctx.stylize = stylizeWithColor; +- return formatValue(ctx, obj, ctx.depth); +-} +-exports.inspect = inspect; +- +- +-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +-inspect.colors = { +- 'bold' : [1, 22], +- 'italic' : [3, 23], +- 'underline' : [4, 24], +- 'inverse' : [7, 27], +- 'white' : [37, 39], +- 'grey' : [90, 39], +- 'black' : [30, 39], +- 'blue' : [34, 39], +- 'cyan' : [36, 39], +- 'green' : [32, 39], +- 'magenta' : [35, 39], +- 'red' : [31, 39], +- 'yellow' : [33, 39] +-}; +- +-// Don't use 'blue' not visible on cmd.exe +-inspect.styles = { +- 'special': 'cyan', +- 'number': 'yellow', +- 'boolean': 'yellow', +- 'undefined': 'grey', +- 'null': 'bold', +- 'string': 'green', +- 'date': 'magenta', +- // "name": intentionally not styling +- 'regexp': 'red' +-}; +- +- +-function stylizeWithColor(str, styleType) { +- var style = inspect.styles[styleType]; +- +- if (style) { +- return '\u001b[' + inspect.colors[style][0] + 'm' + str + +- '\u001b[' + inspect.colors[style][1] + 'm'; +- } else { +- return str; +- } +-} +- +- +-function stylizeNoColor(str, styleType) { +- return str; +-} +- +- +-function arrayToHash(array) { +- var hash = {}; +- +- array.forEach(function(val, idx) { +- hash[val] = true; +- }); +- +- return hash; +-} +- +- +-function formatValue(ctx, value, recurseTimes) { +- // Provide a hook for user-specified inspect functions. +- // Check that value is an object with an inspect function on it +- if (ctx.customInspect && +- value && +- isFunction(value.inspect) && +- // Filter out the util module, it's inspect function is special +- value.inspect !== exports.inspect && +- // Also filter out any prototype objects using the circular check. +- !(value.constructor && value.constructor.prototype === value)) { +- var ret = value.inspect(recurseTimes, ctx); +- if (!isString(ret)) { +- ret = formatValue(ctx, ret, recurseTimes); +- } +- return ret; +- } +- +- // Primitive types cannot have properties +- var primitive = formatPrimitive(ctx, value); +- if (primitive) { +- return primitive; +- } +- +- // Look up the keys of the object. +- var keys = Object.keys(value); +- var visibleKeys = arrayToHash(keys); +- +- if (ctx.showHidden) { +- keys = Object.getOwnPropertyNames(value); +- } +- +- // Some type of object without properties can be shortcutted. +- if (keys.length === 0) { +- if (isFunction(value)) { +- var name = value.name ? ': ' + value.name : ''; +- return ctx.stylize('[Function' + name + ']', 'special'); +- } +- if (isRegExp(value)) { +- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); +- } +- if (isDate(value)) { +- return ctx.stylize(Date.prototype.toString.call(value), 'date'); +- } +- if (isError(value)) { +- return formatError(value); +- } +- } +- +- var base = '', array = false, braces = ['{', '}']; +- +- // Make Array say that they are Array +- if (isArray(value)) { +- array = true; +- braces = ['[', ']']; +- } +- +- // Make functions say that they are functions +- if (isFunction(value)) { +- var n = value.name ? ': ' + value.name : ''; +- base = ' [Function' + n + ']'; +- } +- +- // Make RegExps say that they are RegExps +- if (isRegExp(value)) { +- base = ' ' + RegExp.prototype.toString.call(value); +- } +- +- // Make dates with properties first say the date +- if (isDate(value)) { +- base = ' ' + Date.prototype.toUTCString.call(value); +- } +- +- // Make error with message first say the error +- if (isError(value)) { +- base = ' ' + formatError(value); +- } +- +- if (keys.length === 0 && (!array || value.length == 0)) { +- return braces[0] + base + braces[1]; +- } +- +- if (recurseTimes < 0) { +- if (isRegExp(value)) { +- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); +- } else { +- return ctx.stylize('[Object]', 'special'); +- } +- } +- +- ctx.seen.push(value); +- +- var output; +- if (array) { +- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); +- } else { +- output = keys.map(function(key) { +- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); +- }); +- } +- +- ctx.seen.pop(); +- +- return reduceToSingleString(output, base, braces); +-} +- +- +-function formatPrimitive(ctx, value) { +- if (isUndefined(value)) +- return ctx.stylize('undefined', 'undefined'); +- if (isString(value)) { +- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') +- .replace(/'/g, "\\'") +- .replace(/\\"/g, '"') + '\''; +- return ctx.stylize(simple, 'string'); +- } +- if (isNumber(value)) { +- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, +- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . +- if (value === 0 && 1 / value < 0) +- return ctx.stylize('-0', 'number'); +- return ctx.stylize('' + value, 'number'); +- } +- if (isBoolean(value)) +- return ctx.stylize('' + value, 'boolean'); +- // For some reason typeof null is "object", so special case here. +- if (isNull(value)) +- return ctx.stylize('null', 'null'); +-} +- +- +-function formatError(value) { +- return '[' + Error.prototype.toString.call(value) + ']'; +-} +- +- +-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { +- var output = []; +- for (var i = 0, l = value.length; i < l; ++i) { +- if (hasOwnProperty(value, String(i))) { +- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, +- String(i), true)); +- } else { +- output.push(''); +- } +- } +- keys.forEach(function(key) { +- if (!key.match(/^\d+$/)) { +- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, +- key, true)); +- } +- }); +- return output; +-} +- +- +-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { +- var name, str, desc; +- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; +- if (desc.get) { +- if (desc.set) { +- str = ctx.stylize('[Getter/Setter]', 'special'); +- } else { +- str = ctx.stylize('[Getter]', 'special'); +- } +- } else { +- if (desc.set) { +- str = ctx.stylize('[Setter]', 'special'); +- } +- } +- if (!hasOwnProperty(visibleKeys, key)) { +- name = '[' + key + ']'; +- } +- if (!str) { +- if (ctx.seen.indexOf(desc.value) < 0) { +- if (isNull(recurseTimes)) { +- str = formatValue(ctx, desc.value, null); +- } else { +- str = formatValue(ctx, desc.value, recurseTimes - 1); +- } +- if (str.indexOf('\n') > -1) { +- if (array) { +- str = str.split('\n').map(function(line) { +- return ' ' + line; +- }).join('\n').substr(2); +- } else { +- str = '\n' + str.split('\n').map(function(line) { +- return ' ' + line; +- }).join('\n'); +- } +- } +- } else { +- str = ctx.stylize('[Circular]', 'special'); +- } +- } +- if (isUndefined(name)) { +- if (array && key.match(/^\d+$/)) { +- return str; +- } +- name = JSON.stringify('' + key); +- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { +- name = name.substr(1, name.length - 2); +- name = ctx.stylize(name, 'name'); +- } else { +- name = name.replace(/'/g, "\\'") +- .replace(/\\"/g, '"') +- .replace(/(^"|"$)/g, "'"); +- name = ctx.stylize(name, 'string'); +- } +- } +- +- return name + ': ' + str; +-} +- +- +-function reduceToSingleString(output, base, braces) { +- var numLinesEst = 0; +- var length = output.reduce(function(prev, cur) { +- numLinesEst++; +- if (cur.indexOf('\n') >= 0) numLinesEst++; +- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; +- }, 0); +- +- if (length > 60) { +- return braces[0] + +- (base === '' ? '' : base + '\n ') + +- ' ' + +- output.join(',\n ') + +- ' ' + +- braces[1]; +- } +- +- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +-} +- +- + // NOTE: These type checking functions intentionally don't use `instanceof` + // because it is fragile and can be easily faked with `Object.create()`. + function isArray(ar) { +@@ -522,166 +98,10 @@ function isPrimitive(arg) { + exports.isPrimitive = isPrimitive; + + function isBuffer(arg) { +- return arg instanceof Buffer; ++ return Buffer.isBuffer(arg); + } + exports.isBuffer = isBuffer; + + function objectToString(o) { + return Object.prototype.toString.call(o); +-} +- +- +-function pad(n) { +- return n < 10 ? '0' + n.toString(10) : n.toString(10); +-} +- +- +-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', +- 'Oct', 'Nov', 'Dec']; +- +-// 26 Feb 16:19:34 +-function timestamp() { +- var d = new Date(); +- var time = [pad(d.getHours()), +- pad(d.getMinutes()), +- pad(d.getSeconds())].join(':'); +- return [d.getDate(), months[d.getMonth()], time].join(' '); +-} +- +- +-// log is just a thin wrapper to console.log that prepends a timestamp +-exports.log = function() { +- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +-}; +- +- +-/** +- * Inherit the prototype methods from one constructor into another. +- * +- * The Function.prototype.inherits from lang.js rewritten as a standalone +- * function (not on Function.prototype). NOTE: If this file is to be loaded +- * during bootstrapping this function needs to be rewritten using some native +- * functions as prototype setup using normal JavaScript does not work as +- * expected during bootstrapping (see mirror.js in r114903). +- * +- * @param {function} ctor Constructor function which needs to inherit the +- * prototype. +- * @param {function} superCtor Constructor function to inherit prototype from. +- */ +-exports.inherits = function(ctor, superCtor) { +- ctor.super_ = superCtor; +- ctor.prototype = Object.create(superCtor.prototype, { +- constructor: { +- value: ctor, +- enumerable: false, +- writable: true, +- configurable: true +- } +- }); +-}; +- +-exports._extend = function(origin, add) { +- // Don't do anything if add isn't an object +- if (!add || !isObject(add)) return origin; +- +- var keys = Object.keys(add); +- var i = keys.length; +- while (i--) { +- origin[keys[i]] = add[keys[i]]; +- } +- return origin; +-}; +- +-function hasOwnProperty(obj, prop) { +- return Object.prototype.hasOwnProperty.call(obj, prop); +-} +- +- +-// Deprecated old stuff. +- +-exports.p = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- console.error(exports.inspect(arguments[i])); +- } +-}, 'util.p: Use console.error() instead'); +- +- +-exports.exec = exports.deprecate(function() { +- return require('child_process').exec.apply(this, arguments); +-}, 'util.exec is now called `child_process.exec`.'); +- +- +-exports.print = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stdout.write(String(arguments[i])); +- } +-}, 'util.print: Use console.log instead'); +- +- +-exports.puts = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stdout.write(arguments[i] + '\n'); +- } +-}, 'util.puts: Use console.log instead'); +- +- +-exports.debug = exports.deprecate(function(x) { +- process.stderr.write('DEBUG: ' + x + '\n'); +-}, 'util.debug: Use console.error instead'); +- +- +-exports.error = exports.deprecate(function(x) { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stderr.write(arguments[i] + '\n'); +- } +-}, 'util.error: Use console.error instead'); +- +- +-exports.pump = exports.deprecate(function(readStream, writeStream, callback) { +- var callbackCalled = false; +- +- function call(a, b, c) { +- if (callback && !callbackCalled) { +- callback(a, b, c); +- callbackCalled = true; +- } +- } +- +- readStream.addListener('data', function(chunk) { +- if (writeStream.write(chunk) === false) readStream.pause(); +- }); +- +- writeStream.addListener('drain', function() { +- readStream.resume(); +- }); +- +- readStream.addListener('end', function() { +- writeStream.end(); +- }); +- +- readStream.addListener('close', function() { +- call(); +- }); +- +- readStream.addListener('error', function(err) { +- writeStream.end(); +- call(err); +- }); +- +- writeStream.addListener('error', function(err) { +- readStream.destroy(); +- call(err); +- }); +-}, 'util.pump(): Use readableStream.pipe() instead'); +- +- +-var uv; +-exports._errnoException = function(err, syscall) { +- if (isUndefined(uv)) uv = process.binding('uv'); +- var errname = uv.errname(err); +- var e = new Error(syscall + ' ' + errname); +- e.code = errname; +- e.errno = errname; +- e.syscall = syscall; +- return e; +-}; ++} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/core-util-is/lib/util.js b/legacy-libs/grpc/node_modules/core-util-is/lib/util.js new file mode 100644 index 0000000..ff4c851 --- /dev/null +++ b/legacy-libs/grpc/node_modules/core-util-is/lib/util.js @@ -0,0 +1,107 @@ +// 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. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} diff --git a/legacy-libs/grpc/node_modules/core-util-is/package.json b/legacy-libs/grpc/node_modules/core-util-is/package.json new file mode 100644 index 0000000..321b588 --- /dev/null +++ b/legacy-libs/grpc/node_modules/core-util-is/package.json @@ -0,0 +1,70 @@ +{ + "_args": [ + [ + "core-util-is@1.0.2", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "core-util-is@1.0.2", + "_id": "core-util-is@1.0.2", + "_inBundle": false, + "_integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "_location": "/grpc/core-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "core-util-is@1.0.2", + "name": "core-util-is", + "escapedName": "core-util-is", + "rawSpec": "1.0.2", + "saveSpec": null, + "fetchSpec": "1.0.2" + }, + "_requiredBy": [ + "/grpc/readable-stream" + ], + "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "_shrinkwrap": null, + "_spec": "1.0.2", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/core-util-is/issues" + }, + "dependencies": {}, + "description": "The `util.is*` functions introduced in Node v0.12.", + "devDependencies": { + "tap": "^2.3.0" + }, + "homepage": "https://github.com/isaacs/core-util-is#readme", + "keywords": [ + "util", + "isBuffer", + "isArray", + "isNumber", + "isString", + "isRegExp", + "isThis", + "isThat", + "polyfill" + ], + "license": "MIT", + "main": "lib/util.js", + "name": "core-util-is", + "optionalDependencies": {}, + "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/core-util-is.git" + }, + "scripts": { + "test": "tap test.js" + }, + "version": "1.0.2" +} diff --git a/legacy-libs/grpc/node_modules/core-util-is/test.js b/legacy-libs/grpc/node_modules/core-util-is/test.js new file mode 100644 index 0000000..1a490c6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/core-util-is/test.js @@ -0,0 +1,68 @@ +var assert = require('tap'); + +var t = require('./lib/util'); + +assert.equal(t.isArray([]), true); +assert.equal(t.isArray({}), false); + +assert.equal(t.isBoolean(null), false); +assert.equal(t.isBoolean(true), true); +assert.equal(t.isBoolean(false), true); + +assert.equal(t.isNull(null), true); +assert.equal(t.isNull(undefined), false); +assert.equal(t.isNull(false), false); +assert.equal(t.isNull(), false); + +assert.equal(t.isNullOrUndefined(null), true); +assert.equal(t.isNullOrUndefined(undefined), true); +assert.equal(t.isNullOrUndefined(false), false); +assert.equal(t.isNullOrUndefined(), true); + +assert.equal(t.isNumber(null), false); +assert.equal(t.isNumber('1'), false); +assert.equal(t.isNumber(1), true); + +assert.equal(t.isString(null), false); +assert.equal(t.isString('1'), true); +assert.equal(t.isString(1), false); + +assert.equal(t.isSymbol(null), false); +assert.equal(t.isSymbol('1'), false); +assert.equal(t.isSymbol(1), false); +assert.equal(t.isSymbol(Symbol()), true); + +assert.equal(t.isUndefined(null), false); +assert.equal(t.isUndefined(undefined), true); +assert.equal(t.isUndefined(false), false); +assert.equal(t.isUndefined(), true); + +assert.equal(t.isRegExp(null), false); +assert.equal(t.isRegExp('1'), false); +assert.equal(t.isRegExp(new RegExp()), true); + +assert.equal(t.isObject({}), true); +assert.equal(t.isObject([]), true); +assert.equal(t.isObject(new RegExp()), true); +assert.equal(t.isObject(new Date()), true); + +assert.equal(t.isDate(null), false); +assert.equal(t.isDate('1'), false); +assert.equal(t.isDate(new Date()), true); + +assert.equal(t.isError(null), false); +assert.equal(t.isError({ err: true }), false); +assert.equal(t.isError(new Error()), true); + +assert.equal(t.isFunction(null), false); +assert.equal(t.isFunction({ }), false); +assert.equal(t.isFunction(function() {}), true); + +assert.equal(t.isPrimitive(null), true); +assert.equal(t.isPrimitive(''), true); +assert.equal(t.isPrimitive(0), true); +assert.equal(t.isPrimitive(new Date()), false); + +assert.equal(t.isBuffer(null), false); +assert.equal(t.isBuffer({}), false); +assert.equal(t.isBuffer(new Buffer(0)), true); diff --git a/legacy-libs/grpc/node_modules/deep-extend/CHANGELOG.md b/legacy-libs/grpc/node_modules/deep-extend/CHANGELOG.md new file mode 100644 index 0000000..dd13ec1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/deep-extend/CHANGELOG.md @@ -0,0 +1,46 @@ +Changelog +========= + +v0.6.0 +------ + +- Updated "devDependencies" versions to fix vulnerability alerts +- Dropped support of io.js and node.js v0.12.x and lower since new versions of + "devDependencies" couldn't work with those old node.js versions + (minimal supported version of node.js now is v4.0.0) + +v0.5.1 +------ + +- Fix prototype pollution vulnerability (thanks to @mwakerman for the PR) +- Avoid using deprecated Buffer API (thanks to @ChALkeR for the PR) + +v0.5.0 +------ + +- Auto-testing provided by Travis CI; +- Support older Node.JS versions (`v0.11.x` and `v0.10.x`); +- Removed tests files from npm package. + +v0.4.2 +------ + +- Fix for `null` as an argument. + +v0.4.1 +------ + +- Removed test code from npm package + ([see pull request #21](https://github.com/unclechu/node-deep-extend/pull/21)); +- Increased minimal version of Node from `0.4.0` to `0.12.0` + (because can't run tests on lesser version anyway). + +v0.4.0 +------ + +- **WARNING!** Broken backward compatibility with `v0.3.x`; +- Fixed bug with extending arrays instead of cloning; +- Deep cloning for arrays; +- Check for own property; +- Fixed some documentation issues; +- Strict JS mode. diff --git a/legacy-libs/grpc/node_modules/deep-extend/LICENSE b/legacy-libs/grpc/node_modules/deep-extend/LICENSE new file mode 100644 index 0000000..5c58916 --- /dev/null +++ b/legacy-libs/grpc/node_modules/deep-extend/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013-2018, Viacheslav Lotsmanov + +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/legacy-libs/grpc/node_modules/deep-extend/README.md b/legacy-libs/grpc/node_modules/deep-extend/README.md new file mode 100644 index 0000000..67c7fc0 --- /dev/null +++ b/legacy-libs/grpc/node_modules/deep-extend/README.md @@ -0,0 +1,91 @@ +Deep Extend +=========== + +Recursive object extending. + +[![Build Status](https://api.travis-ci.org/unclechu/node-deep-extend.svg?branch=master)](https://travis-ci.org/unclechu/node-deep-extend) + +[![NPM](https://nodei.co/npm/deep-extend.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/deep-extend/) + +Install +------- + +```bash +$ npm install deep-extend +``` + +Usage +----- + +```javascript +var deepExtend = require('deep-extend'); +var obj1 = { + a: 1, + b: 2, + d: { + a: 1, + b: [], + c: { test1: 123, test2: 321 } + }, + f: 5, + g: 123, + i: 321, + j: [1, 2] +}; +var obj2 = { + b: 3, + c: 5, + d: { + b: { first: 'one', second: 'two' }, + c: { test2: 222 } + }, + e: { one: 1, two: 2 }, + f: [], + g: (void 0), + h: /abc/g, + i: null, + j: [3, 4] +}; + +deepExtend(obj1, obj2); + +console.log(obj1); +/* +{ a: 1, + b: 3, + d: + { a: 1, + b: { first: 'one', second: 'two' }, + c: { test1: 123, test2: 222 } }, + f: [], + g: undefined, + c: 5, + e: { one: 1, two: 2 }, + h: /abc/g, + i: null, + j: [3, 4] } +*/ +``` + +Unit testing +------------ + +```bash +$ npm test +``` + +Changelog +--------- + +[CHANGELOG.md](./CHANGELOG.md) + +Any issues? +----------- + +Please, report about issues +[here](https://github.com/unclechu/node-deep-extend/issues). + +License +------- + +[MIT](./LICENSE) diff --git a/legacy-libs/grpc/node_modules/deep-extend/index.js b/legacy-libs/grpc/node_modules/deep-extend/index.js new file mode 100644 index 0000000..762d81e --- /dev/null +++ b/legacy-libs/grpc/node_modules/deep-extend/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/deep-extend'); diff --git a/legacy-libs/grpc/node_modules/deep-extend/lib/deep-extend.js b/legacy-libs/grpc/node_modules/deep-extend/lib/deep-extend.js new file mode 100644 index 0000000..651fd8d --- /dev/null +++ b/legacy-libs/grpc/node_modules/deep-extend/lib/deep-extend.js @@ -0,0 +1,150 @@ +/*! + * @description Recursive object extending + * @author Viacheslav Lotsmanov + * @license MIT + * + * The MIT License (MIT) + * + * Copyright (c) 2013-2018 Viacheslav Lotsmanov + * + * 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'; + +function isSpecificValue(val) { + return ( + val instanceof Buffer + || val instanceof Date + || val instanceof RegExp + ) ? true : false; +} + +function cloneSpecificValue(val) { + if (val instanceof Buffer) { + var x = Buffer.alloc + ? Buffer.alloc(val.length) + : new Buffer(val.length); + val.copy(x); + return x; + } else if (val instanceof Date) { + return new Date(val.getTime()); + } else if (val instanceof RegExp) { + return new RegExp(val); + } else { + throw new Error('Unexpected situation'); + } +} + +/** + * Recursive cloning array. + */ +function deepCloneArray(arr) { + var clone = []; + arr.forEach(function (item, index) { + if (typeof item === 'object' && item !== null) { + if (Array.isArray(item)) { + clone[index] = deepCloneArray(item); + } else if (isSpecificValue(item)) { + clone[index] = cloneSpecificValue(item); + } else { + clone[index] = deepExtend({}, item); + } + } else { + clone[index] = item; + } + }); + return clone; +} + +function safeGetProperty(object, property) { + return property === '__proto__' ? undefined : object[property]; +} + +/** + * Extening object that entered in first argument. + * + * Returns extended object or false if have no target object or incorrect type. + * + * If you wish to clone source object (without modify it), just use empty new + * object as first argument, like this: + * deepExtend({}, yourObj_1, [yourObj_N]); + */ +var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) { + if (arguments.length < 1 || typeof arguments[0] !== 'object') { + return false; + } + + if (arguments.length < 2) { + return arguments[0]; + } + + var target = arguments[0]; + + // convert arguments to array and cut off target object + var args = Array.prototype.slice.call(arguments, 1); + + var val, src, clone; + + args.forEach(function (obj) { + // skip argument if isn't an object, is null, or is an array + if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) { + return; + } + + Object.keys(obj).forEach(function (key) { + src = safeGetProperty(target, key); // source value + val = safeGetProperty(obj, key); // new value + + // recursion prevention + if (val === target) { + return; + + /** + * if new value isn't object then just overwrite by new value + * instead of extending. + */ + } else if (typeof val !== 'object' || val === null) { + target[key] = val; + return; + + // just clone arrays (and recursive clone objects inside) + } else if (Array.isArray(val)) { + target[key] = deepCloneArray(val); + return; + + // custom cloning and overwrite for specific objects + } else if (isSpecificValue(val)) { + target[key] = cloneSpecificValue(val); + return; + + // overwrite by new value if source isn't object or array + } else if (typeof src !== 'object' || src === null || Array.isArray(src)) { + target[key] = deepExtend({}, val); + return; + + // source value and new value is objects both, extending... + } else { + target[key] = deepExtend(src, val); + return; + } + }); + }); + + return target; +}; diff --git a/legacy-libs/grpc/node_modules/deep-extend/package.json b/legacy-libs/grpc/node_modules/deep-extend/package.json new file mode 100644 index 0000000..9e7afc0 --- /dev/null +++ b/legacy-libs/grpc/node_modules/deep-extend/package.json @@ -0,0 +1,100 @@ +{ + "_args": [ + [ + "deep-extend@0.6.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "deep-extend@0.6.0", + "_id": "deep-extend@0.6.0", + "_inBundle": false, + "_integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "_location": "/grpc/deep-extend", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "deep-extend@0.6.0", + "name": "deep-extend", + "escapedName": "deep-extend", + "rawSpec": "0.6.0", + "saveSpec": null, + "fetchSpec": "0.6.0" + }, + "_requiredBy": [ + "/grpc/rc" + ], + "_resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "_shrinkwrap": null, + "_spec": "0.6.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Viacheslav Lotsmanov", + "email": "lotsmanov89@gmail.com" + }, + "bugs": { + "url": "https://github.com/unclechu/node-deep-extend/issues" + }, + "contributors": [ + { + "name": "Romain Prieto", + "url": "https://github.com/rprieto" + }, + { + "name": "Max Maximov", + "url": "https://github.com/maxmaximov" + }, + { + "name": "Marshall Bowers", + "url": "https://github.com/maxdeviant" + }, + { + "name": "Misha Wakerman", + "url": "https://github.com/mwakerman" + } + ], + "dependencies": {}, + "description": "Recursive object extending", + "devDependencies": { + "mocha": "5.2.0", + "should": "13.2.1" + }, + "engines": { + "node": ">=4.0.0" + }, + "files": [ + "index.js", + "lib/" + ], + "homepage": "https://github.com/unclechu/node-deep-extend", + "keywords": [ + "deep-extend", + "extend", + "deep", + "recursive", + "xtend", + "clone", + "merge", + "json" + ], + "license": "MIT", + "licenses": [ + { + "type": "MIT", + "url": "https://raw.githubusercontent.com/unclechu/node-deep-extend/master/LICENSE" + } + ], + "main": "lib/deep-extend.js", + "name": "deep-extend", + "optionalDependencies": {}, + "readme": "Deep Extend\n===========\n\nRecursive object extending.\n\n[![Build Status](https://api.travis-ci.org/unclechu/node-deep-extend.svg?branch=master)](https://travis-ci.org/unclechu/node-deep-extend)\n\n[![NPM](https://nodei.co/npm/deep-extend.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/deep-extend/)\n\nInstall\n-------\n\n```bash\n$ npm install deep-extend\n```\n\nUsage\n-----\n\n```javascript\nvar deepExtend = require('deep-extend');\nvar obj1 = {\n a: 1,\n b: 2,\n d: {\n a: 1,\n b: [],\n c: { test1: 123, test2: 321 }\n },\n f: 5,\n g: 123,\n i: 321,\n j: [1, 2]\n};\nvar obj2 = {\n b: 3,\n c: 5,\n d: {\n b: { first: 'one', second: 'two' },\n c: { test2: 222 }\n },\n e: { one: 1, two: 2 },\n f: [],\n g: (void 0),\n h: /abc/g,\n i: null,\n j: [3, 4]\n};\n\ndeepExtend(obj1, obj2);\n\nconsole.log(obj1);\n/*\n{ a: 1,\n b: 3,\n d:\n { a: 1,\n b: { first: 'one', second: 'two' },\n c: { test1: 123, test2: 222 } },\n f: [],\n g: undefined,\n c: 5,\n e: { one: 1, two: 2 },\n h: /abc/g,\n i: null,\n j: [3, 4] }\n*/\n```\n\nUnit testing\n------------\n\n```bash\n$ npm test\n```\n\nChangelog\n---------\n\n[CHANGELOG.md](./CHANGELOG.md)\n\nAny issues?\n-----------\n\nPlease, report about issues\n[here](https://github.com/unclechu/node-deep-extend/issues).\n\nLicense\n-------\n\n[MIT](./LICENSE)\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/unclechu/node-deep-extend.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "0.6.0" +} diff --git a/legacy-libs/grpc/node_modules/delegates/History.md b/legacy-libs/grpc/node_modules/delegates/History.md new file mode 100644 index 0000000..25959ea --- /dev/null +++ b/legacy-libs/grpc/node_modules/delegates/History.md @@ -0,0 +1,22 @@ + +1.0.0 / 2015-12-14 +================== + + * Merge pull request #12 from kasicka/master + * Add license text + +0.1.0 / 2014-10-17 +================== + + * adds `.fluent()` to api + +0.0.3 / 2014-01-13 +================== + + * fix receiver for .method() + +0.0.2 / 2014-01-13 +================== + + * Object.defineProperty() sucks + * Initial commit diff --git a/legacy-libs/grpc/node_modules/delegates/License b/legacy-libs/grpc/node_modules/delegates/License new file mode 100644 index 0000000..60de60a --- /dev/null +++ b/legacy-libs/grpc/node_modules/delegates/License @@ -0,0 +1,20 @@ +Copyright (c) 2015 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/legacy-libs/grpc/node_modules/delegates/Makefile b/legacy-libs/grpc/node_modules/delegates/Makefile new file mode 100644 index 0000000..a9dcfd5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/delegates/Makefile @@ -0,0 +1,8 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec \ + --bail + +.PHONY: test \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/delegates/Readme.md b/legacy-libs/grpc/node_modules/delegates/Readme.md new file mode 100644 index 0000000..ab8cf4a --- /dev/null +++ b/legacy-libs/grpc/node_modules/delegates/Readme.md @@ -0,0 +1,94 @@ + +# delegates + + Node method and accessor delegation utilty. + +## Installation + +``` +$ npm install delegates +``` + +## Example + +```js +var delegate = require('delegates'); + +... + +delegate(proto, 'request') + .method('acceptsLanguages') + .method('acceptsEncodings') + .method('acceptsCharsets') + .method('accepts') + .method('is') + .access('querystring') + .access('idempotent') + .access('socket') + .access('length') + .access('query') + .access('search') + .access('status') + .access('method') + .access('path') + .access('body') + .access('host') + .access('url') + .getter('subdomains') + .getter('protocol') + .getter('header') + .getter('stale') + .getter('fresh') + .getter('secure') + .getter('ips') + .getter('ip') +``` + +# API + +## Delegate(proto, prop) + +Creates a delegator instance used to configure using the `prop` on the given +`proto` object. (which is usually a prototype) + +## Delegate#method(name) + +Allows the given method `name` to be accessed on the host. + +## Delegate#getter(name) + +Creates a "getter" for the property with the given `name` on the delegated +object. + +## Delegate#setter(name) + +Creates a "setter" for the property with the given `name` on the delegated +object. + +## Delegate#access(name) + +Creates an "accessor" (ie: both getter *and* setter) for the property with the +given `name` on the delegated object. + +## Delegate#fluent(name) + +A unique type of "accessor" that works for a "fluent" API. When called as a +getter, the method returns the expected value. However, if the method is called +with a value, it will return itself so it can be chained. For example: + +```js +delegate(proto, 'request') + .fluent('query') + +// getter +var q = request.query(); + +// setter (chainable) +request + .query({ a: 1 }) + .query({ b: 2 }); +``` + +# License + + MIT diff --git a/legacy-libs/grpc/node_modules/delegates/index.js b/legacy-libs/grpc/node_modules/delegates/index.js new file mode 100644 index 0000000..17c222d --- /dev/null +++ b/legacy-libs/grpc/node_modules/delegates/index.js @@ -0,0 +1,121 @@ + +/** + * Expose `Delegator`. + */ + +module.exports = Delegator; + +/** + * Initialize a delegator. + * + * @param {Object} proto + * @param {String} target + * @api public + */ + +function Delegator(proto, target) { + if (!(this instanceof Delegator)) return new Delegator(proto, target); + this.proto = proto; + this.target = target; + this.methods = []; + this.getters = []; + this.setters = []; + this.fluents = []; +} + +/** + * Delegate method `name`. + * + * @param {String} name + * @return {Delegator} self + * @api public + */ + +Delegator.prototype.method = function(name){ + var proto = this.proto; + var target = this.target; + this.methods.push(name); + + proto[name] = function(){ + return this[target][name].apply(this[target], arguments); + }; + + return this; +}; + +/** + * Delegator accessor `name`. + * + * @param {String} name + * @return {Delegator} self + * @api public + */ + +Delegator.prototype.access = function(name){ + return this.getter(name).setter(name); +}; + +/** + * Delegator getter `name`. + * + * @param {String} name + * @return {Delegator} self + * @api public + */ + +Delegator.prototype.getter = function(name){ + var proto = this.proto; + var target = this.target; + this.getters.push(name); + + proto.__defineGetter__(name, function(){ + return this[target][name]; + }); + + return this; +}; + +/** + * Delegator setter `name`. + * + * @param {String} name + * @return {Delegator} self + * @api public + */ + +Delegator.prototype.setter = function(name){ + var proto = this.proto; + var target = this.target; + this.setters.push(name); + + proto.__defineSetter__(name, function(val){ + return this[target][name] = val; + }); + + return this; +}; + +/** + * Delegator fluent accessor + * + * @param {String} name + * @return {Delegator} self + * @api public + */ + +Delegator.prototype.fluent = function (name) { + var proto = this.proto; + var target = this.target; + this.fluents.push(name); + + proto[name] = function(val){ + if ('undefined' != typeof val) { + this[target][name] = val; + return this; + } else { + return this[target][name]; + } + }; + + return this; +}; diff --git a/legacy-libs/grpc/node_modules/delegates/package.json b/legacy-libs/grpc/node_modules/delegates/package.json new file mode 100644 index 0000000..e727b4a --- /dev/null +++ b/legacy-libs/grpc/node_modules/delegates/package.json @@ -0,0 +1,55 @@ +{ + "_args": [ + [ + "delegates@1.0.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "delegates@1.0.0", + "_id": "delegates@1.0.0", + "_inBundle": false, + "_integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "_location": "/grpc/delegates", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "delegates@1.0.0", + "name": "delegates", + "escapedName": "delegates", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/grpc/are-we-there-yet" + ], + "_resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "_shrinkwrap": null, + "_spec": "1.0.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "bugs": { + "url": "https://github.com/visionmedia/node-delegates/issues" + }, + "dependencies": {}, + "description": "delegate methods and accessors to another property", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "homepage": "https://github.com/visionmedia/node-delegates#readme", + "keywords": [ + "delegate", + "delegation" + ], + "license": "MIT", + "name": "delegates", + "optionalDependencies": {}, + "readme": "\n# delegates\n\n Node method and accessor delegation utilty.\n\n## Installation\n\n```\n$ npm install delegates\n```\n\n## Example\n\n```js\nvar delegate = require('delegates');\n\n...\n\ndelegate(proto, 'request')\n .method('acceptsLanguages')\n .method('acceptsEncodings')\n .method('acceptsCharsets')\n .method('accepts')\n .method('is')\n .access('querystring')\n .access('idempotent')\n .access('socket')\n .access('length')\n .access('query')\n .access('search')\n .access('status')\n .access('method')\n .access('path')\n .access('body')\n .access('host')\n .access('url')\n .getter('subdomains')\n .getter('protocol')\n .getter('header')\n .getter('stale')\n .getter('fresh')\n .getter('secure')\n .getter('ips')\n .getter('ip')\n```\n\n# API\n\n## Delegate(proto, prop)\n\nCreates a delegator instance used to configure using the `prop` on the given\n`proto` object. (which is usually a prototype)\n\n## Delegate#method(name)\n\nAllows the given method `name` to be accessed on the host.\n\n## Delegate#getter(name)\n\nCreates a \"getter\" for the property with the given `name` on the delegated\nobject.\n\n## Delegate#setter(name)\n\nCreates a \"setter\" for the property with the given `name` on the delegated\nobject.\n\n## Delegate#access(name)\n\nCreates an \"accessor\" (ie: both getter *and* setter) for the property with the\ngiven `name` on the delegated object.\n\n## Delegate#fluent(name)\n\nA unique type of \"accessor\" that works for a \"fluent\" API. When called as a\ngetter, the method returns the expected value. However, if the method is called\nwith a value, it will return itself so it can be chained. For example:\n\n```js\ndelegate(proto, 'request')\n .fluent('query')\n\n// getter\nvar q = request.query();\n\n// setter (chainable)\nrequest\n .query({ a: 1 })\n .query({ b: 2 });\n```\n\n# License\n\n MIT\n", + "readmeFilename": "Readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/visionmedia/node-delegates.git" + }, + "version": "1.0.0" +} diff --git a/legacy-libs/grpc/node_modules/delegates/test/index.js b/legacy-libs/grpc/node_modules/delegates/test/index.js new file mode 100644 index 0000000..7b6e3d4 --- /dev/null +++ b/legacy-libs/grpc/node_modules/delegates/test/index.js @@ -0,0 +1,94 @@ + +var assert = require('assert'); +var delegate = require('..'); + +describe('.method(name)', function(){ + it('should delegate methods', function(){ + var obj = {}; + + obj.request = { + foo: function(bar){ + assert(this == obj.request); + return bar; + } + }; + + delegate(obj, 'request').method('foo'); + + obj.foo('something').should.equal('something'); + }) +}) + +describe('.getter(name)', function(){ + it('should delegate getters', function(){ + var obj = {}; + + obj.request = { + get type() { + return 'text/html'; + } + } + + delegate(obj, 'request').getter('type'); + + obj.type.should.equal('text/html'); + }) +}) + +describe('.setter(name)', function(){ + it('should delegate setters', function(){ + var obj = {}; + + obj.request = { + get type() { + return this._type.toUpperCase(); + }, + + set type(val) { + this._type = val; + } + } + + delegate(obj, 'request').setter('type'); + + obj.type = 'hey'; + obj.request.type.should.equal('HEY'); + }) +}) + +describe('.access(name)', function(){ + it('should delegate getters and setters', function(){ + var obj = {}; + + obj.request = { + get type() { + return this._type.toUpperCase(); + }, + + set type(val) { + this._type = val; + } + } + + delegate(obj, 'request').access('type'); + + obj.type = 'hey'; + obj.type.should.equal('HEY'); + }) +}) + +describe('.fluent(name)', function () { + it('should delegate in a fluent fashion', function () { + var obj = { + settings: { + env: 'development' + } + }; + + delegate(obj, 'settings').fluent('env'); + + obj.env().should.equal('development'); + obj.env('production').should.equal(obj); + obj.settings.env.should.equal('production'); + }) +}) diff --git a/legacy-libs/grpc/node_modules/detect-libc/LICENSE b/legacy-libs/grpc/node_modules/detect-libc/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/legacy-libs/grpc/node_modules/detect-libc/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {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/legacy-libs/grpc/node_modules/detect-libc/README.md b/legacy-libs/grpc/node_modules/detect-libc/README.md new file mode 100644 index 0000000..3176357 --- /dev/null +++ b/legacy-libs/grpc/node_modules/detect-libc/README.md @@ -0,0 +1,78 @@ +# detect-libc + +Node.js module to detect the C standard library (libc) implementation +family and version in use on a given Linux system. + +Provides a value suitable for use with the `LIBC` option of +[prebuild](https://www.npmjs.com/package/prebuild), +[prebuild-ci](https://www.npmjs.com/package/prebuild-ci) and +[prebuild-install](https://www.npmjs.com/package/prebuild-install), +therefore allowing build and provision of pre-compiled binaries +for musl-based Linux e.g. Alpine as well as glibc-based. + +Currently supports libc detection of `glibc` and `musl`. + +## Install + +```sh +npm install detect-libc +``` + +## Usage + +### API + +```js +const { GLIBC, MUSL, family, version, isNonGlibcLinux } = require('detect-libc'); +``` + +* `GLIBC` is a String containing the value "glibc" for comparison with `family`. +* `MUSL` is a String containing the value "musl" for comparison with `family`. +* `family` is a String representing the system libc family. +* `version` is a String representing the system libc version number. +* `isNonGlibcLinux` is a Boolean representing whether the system is a non-glibc Linux, e.g. Alpine. + +### detect-libc command line tool + +When run on a Linux system with a non-glibc libc, +the child command will be run with the `LIBC` environment variable +set to the relevant value. + +On all other platforms will run the child command as-is. + +The command line feature requires `spawnSync` provided by Node v0.12+. + +```sh +detect-libc child-command +``` + +## Integrating with prebuild + +```json + "scripts": { + "install": "detect-libc prebuild-install || node-gyp rebuild", + "test": "mocha && detect-libc prebuild-ci" + }, + "dependencies": { + "detect-libc": "^1.0.2", + "prebuild-install": "^2.2.0" + }, + "devDependencies": { + "prebuild": "^6.2.1", + "prebuild-ci": "^2.2.3" + } +``` + +## Licence + +Copyright 2017 Lovell Fuller + +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](http://www.apache.org/licenses/LICENSE-2.0.html) + +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/legacy-libs/grpc/node_modules/detect-libc/bin/detect-libc.js b/legacy-libs/grpc/node_modules/detect-libc/bin/detect-libc.js new file mode 100644 index 0000000..5486127 --- /dev/null +++ b/legacy-libs/grpc/node_modules/detect-libc/bin/detect-libc.js @@ -0,0 +1,18 @@ +#!/usr/bin/env node + +'use strict'; + +var spawnSync = require('child_process').spawnSync; +var libc = require('../'); + +var spawnOptions = { + env: process.env, + shell: true, + stdio: 'inherit' +}; + +if (libc.isNonGlibcLinux) { + spawnOptions.env.LIBC = process.env.LIBC || libc.family; +} + +process.exit(spawnSync(process.argv[2], process.argv.slice(3), spawnOptions).status); diff --git a/legacy-libs/grpc/node_modules/detect-libc/lib/detect-libc.js b/legacy-libs/grpc/node_modules/detect-libc/lib/detect-libc.js new file mode 100644 index 0000000..1855fe1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/detect-libc/lib/detect-libc.js @@ -0,0 +1,92 @@ +'use strict'; + +var platform = require('os').platform(); +var spawnSync = require('child_process').spawnSync; +var readdirSync = require('fs').readdirSync; + +var GLIBC = 'glibc'; +var MUSL = 'musl'; + +var spawnOptions = { + encoding: 'utf8', + env: process.env +}; + +if (!spawnSync) { + spawnSync = function () { + return { status: 126, stdout: '', stderr: '' }; + }; +} + +function contains (needle) { + return function (haystack) { + return haystack.indexOf(needle) !== -1; + }; +} + +function versionFromMuslLdd (out) { + return out.split(/[\r\n]+/)[1].trim().split(/\s/)[1]; +} + +function safeReaddirSync (path) { + try { + return readdirSync(path); + } catch (e) {} + return []; +} + +var family = ''; +var version = ''; +var method = ''; + +if (platform === 'linux') { + // Try getconf + var glibc = spawnSync('getconf', ['GNU_LIBC_VERSION'], spawnOptions); + if (glibc.status === 0) { + family = GLIBC; + version = glibc.stdout.trim().split(' ')[1]; + method = 'getconf'; + } else { + // Try ldd + var ldd = spawnSync('ldd', ['--version'], spawnOptions); + if (ldd.status === 0 && ldd.stdout.indexOf(MUSL) !== -1) { + family = MUSL; + version = versionFromMuslLdd(ldd.stdout); + method = 'ldd'; + } else if (ldd.status === 1 && ldd.stderr.indexOf(MUSL) !== -1) { + family = MUSL; + version = versionFromMuslLdd(ldd.stderr); + method = 'ldd'; + } else { + // Try filesystem (family only) + var lib = safeReaddirSync('/lib'); + if (lib.some(contains('-linux-gnu'))) { + family = GLIBC; + method = 'filesystem'; + } else if (lib.some(contains('libc.musl-'))) { + family = MUSL; + method = 'filesystem'; + } else if (lib.some(contains('ld-musl-'))) { + family = MUSL; + method = 'filesystem'; + } else { + var usrSbin = safeReaddirSync('/usr/sbin'); + if (usrSbin.some(contains('glibc'))) { + family = GLIBC; + method = 'filesystem'; + } + } + } + } +} + +var isNonGlibcLinux = (family !== '' && family !== GLIBC); + +module.exports = { + GLIBC: GLIBC, + MUSL: MUSL, + family: family, + version: version, + method: method, + isNonGlibcLinux: isNonGlibcLinux +}; diff --git a/legacy-libs/grpc/node_modules/detect-libc/package.json b/legacy-libs/grpc/node_modules/detect-libc/package.json new file mode 100644 index 0000000..1bda8cf --- /dev/null +++ b/legacy-libs/grpc/node_modules/detect-libc/package.json @@ -0,0 +1,78 @@ +{ + "_args": [ + [ + "detect-libc@1.0.3", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "detect-libc@1.0.3", + "_id": "detect-libc@1.0.3", + "_inBundle": false, + "_integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", + "_location": "/grpc/detect-libc", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "detect-libc@1.0.3", + "name": "detect-libc", + "escapedName": "detect-libc", + "rawSpec": "1.0.3", + "saveSpec": null, + "fetchSpec": "1.0.3" + }, + "_requiredBy": [ + "/grpc/node-pre-gyp" + ], + "_resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "_shrinkwrap": null, + "_spec": "1.0.3", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Lovell Fuller", + "email": "npm@lovell.info" + }, + "bin": { + "detect-libc": "./bin/detect-libc.js" + }, + "bugs": { + "url": "https://github.com/lovell/detect-libc/issues" + }, + "contributors": [ + { + "name": "Niklas Salmoukas", + "email": "niklas@salmoukas.com" + } + ], + "dependencies": {}, + "description": "Node.js module to detect the C standard library (libc) implementation family and version", + "devDependencies": { + "ava": "^0.23.0", + "nyc": "^11.3.0", + "proxyquire": "^1.8.0", + "semistandard": "^11.0.0" + }, + "engines": { + "node": ">=0.10" + }, + "homepage": "https://github.com/lovell/detect-libc#readme", + "keywords": [ + "libc", + "glibc", + "musl" + ], + "license": "Apache-2.0", + "main": "lib/detect-libc.js", + "name": "detect-libc", + "optionalDependencies": {}, + "readme": "# detect-libc\n\nNode.js module to detect the C standard library (libc) implementation\nfamily and version in use on a given Linux system.\n\nProvides a value suitable for use with the `LIBC` option of\n[prebuild](https://www.npmjs.com/package/prebuild),\n[prebuild-ci](https://www.npmjs.com/package/prebuild-ci) and\n[prebuild-install](https://www.npmjs.com/package/prebuild-install),\ntherefore allowing build and provision of pre-compiled binaries\nfor musl-based Linux e.g. Alpine as well as glibc-based.\n\nCurrently supports libc detection of `glibc` and `musl`.\n\n## Install\n\n```sh\nnpm install detect-libc\n```\n\n## Usage\n\n### API\n\n```js\nconst { GLIBC, MUSL, family, version, isNonGlibcLinux } = require('detect-libc');\n```\n\n* `GLIBC` is a String containing the value \"glibc\" for comparison with `family`.\n* `MUSL` is a String containing the value \"musl\" for comparison with `family`.\n* `family` is a String representing the system libc family.\n* `version` is a String representing the system libc version number.\n* `isNonGlibcLinux` is a Boolean representing whether the system is a non-glibc Linux, e.g. Alpine.\n\n### detect-libc command line tool\n\nWhen run on a Linux system with a non-glibc libc,\nthe child command will be run with the `LIBC` environment variable\nset to the relevant value.\n\nOn all other platforms will run the child command as-is.\n\nThe command line feature requires `spawnSync` provided by Node v0.12+.\n\n```sh\ndetect-libc child-command\n```\n\n## Integrating with prebuild\n\n```json\n \"scripts\": {\n \"install\": \"detect-libc prebuild-install || node-gyp rebuild\",\n \"test\": \"mocha && detect-libc prebuild-ci\"\n },\n \"dependencies\": {\n \"detect-libc\": \"^1.0.2\",\n \"prebuild-install\": \"^2.2.0\"\n },\n \"devDependencies\": {\n \"prebuild\": \"^6.2.1\",\n \"prebuild-ci\": \"^2.2.3\"\n }\n```\n\n## Licence\n\nCopyright 2017 Lovell Fuller\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0.html)\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/lovell/detect-libc.git" + }, + "scripts": { + "test": "semistandard && nyc --reporter=lcov ava" + }, + "version": "1.0.3" +} diff --git a/legacy-libs/grpc/node_modules/fs-minipass/LICENSE b/legacy-libs/grpc/node_modules/fs-minipass/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/fs-minipass/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/fs-minipass/README.md b/legacy-libs/grpc/node_modules/fs-minipass/README.md new file mode 100644 index 0000000..1e61241 --- /dev/null +++ b/legacy-libs/grpc/node_modules/fs-minipass/README.md @@ -0,0 +1,70 @@ +# fs-minipass + +Filesystem streams based on [minipass](http://npm.im/minipass). + +4 classes are exported: + +- ReadStream +- ReadStreamSync +- WriteStream +- WriteStreamSync + +When using `ReadStreamSync`, all of the data is made available +immediately upon consuming the stream. Nothing is buffered in memory +when the stream is constructed. If the stream is piped to a writer, +then it will synchronously `read()` and emit data into the writer as +fast as the writer can consume it. (That is, it will respect +backpressure.) If you call `stream.read()` then it will read the +entire file and return the contents. + +When using `WriteStreamSync`, every write is flushed to the file +synchronously. If your writes all come in a single tick, then it'll +write it all out in a single tick. It's as synchronous as you are. + +The async versions work much like their node builtin counterparts, +with the exception of introducing significantly less Stream machinery +overhead. + +## USAGE + +It's just streams, you pipe them or read() them or write() to them. + +```js +const fsm = require('fs-minipass') +const readStream = new fsm.ReadStream('file.txt') +const writeStream = new fsm.WriteStream('output.txt') +writeStream.write('some file header or whatever\n') +readStream.pipe(writeStream) +``` + +## ReadStream(path, options) + +Path string is required, but somewhat irrelevant if an open file +descriptor is passed in as an option. + +Options: + +- `fd` Pass in a numeric file descriptor, if the file is already open. +- `readSize` The size of reads to do, defaults to 16MB +- `size` The size of the file, if known. Prevents zero-byte read() + call at the end. +- `autoClose` Set to `false` to prevent the file descriptor from being + closed when the file is done being read. + +## WriteStream(path, options) + +Path string is required, but somewhat irrelevant if an open file +descriptor is passed in as an option. + +Options: + +- `fd` Pass in a numeric file descriptor, if the file is already open. +- `mode` The mode to create the file with. Defaults to `0o666`. +- `start` The position in the file to start reading. If not + specified, then the file will start writing at position zero, and be + truncated by default. +- `autoClose` Set to `false` to prevent the file descriptor from being + closed when the stream is ended. +- `flags` Flags to use when opening the file. Irrelevant if `fd` is + passed in, since file won't be opened in that case. Defaults to + `'a'` if a `pos` is specified, or `'w'` otherwise. diff --git a/legacy-libs/grpc/node_modules/fs-minipass/index.js b/legacy-libs/grpc/node_modules/fs-minipass/index.js new file mode 100644 index 0000000..6bb7f10 --- /dev/null +++ b/legacy-libs/grpc/node_modules/fs-minipass/index.js @@ -0,0 +1,386 @@ +'use strict' +const MiniPass = require('minipass') +const EE = require('events').EventEmitter +const fs = require('fs') + +// for writev +const binding = process.binding('fs') +const writeBuffers = binding.writeBuffers +const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback + +const _autoClose = Symbol('_autoClose') +const _close = Symbol('_close') +const _ended = Symbol('_ended') +const _fd = Symbol('_fd') +const _finished = Symbol('_finished') +const _flags = Symbol('_flags') +const _flush = Symbol('_flush') +const _handleChunk = Symbol('_handleChunk') +const _makeBuf = Symbol('_makeBuf') +const _mode = Symbol('_mode') +const _needDrain = Symbol('_needDrain') +const _onerror = Symbol('_onerror') +const _onopen = Symbol('_onopen') +const _onread = Symbol('_onread') +const _onwrite = Symbol('_onwrite') +const _open = Symbol('_open') +const _path = Symbol('_path') +const _pos = Symbol('_pos') +const _queue = Symbol('_queue') +const _read = Symbol('_read') +const _readSize = Symbol('_readSize') +const _reading = Symbol('_reading') +const _remain = Symbol('_remain') +const _size = Symbol('_size') +const _write = Symbol('_write') +const _writing = Symbol('_writing') +const _defaultFlag = Symbol('_defaultFlag') + +class ReadStream extends MiniPass { + constructor (path, opt) { + opt = opt || {} + super(opt) + + this.writable = false + + if (typeof path !== 'string') + throw new TypeError('path must be a string') + + this[_fd] = typeof opt.fd === 'number' ? opt.fd : null + this[_path] = path + this[_readSize] = opt.readSize || 16*1024*1024 + this[_reading] = false + this[_size] = typeof opt.size === 'number' ? opt.size : Infinity + this[_remain] = this[_size] + this[_autoClose] = typeof opt.autoClose === 'boolean' ? + opt.autoClose : true + + if (typeof this[_fd] === 'number') + this[_read]() + else + this[_open]() + } + + get fd () { return this[_fd] } + get path () { return this[_path] } + + write () { + throw new TypeError('this is a readable stream') + } + + end () { + throw new TypeError('this is a readable stream') + } + + [_open] () { + fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd)) + } + + [_onopen] (er, fd) { + if (er) + this[_onerror](er) + else { + this[_fd] = fd + this.emit('open', fd) + this[_read]() + } + } + + [_makeBuf] () { + return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])) + } + + [_read] () { + if (!this[_reading]) { + this[_reading] = true + const buf = this[_makeBuf]() + /* istanbul ignore if */ + if (buf.length === 0) return process.nextTick(() => this[_onread](null, 0, buf)) + fs.read(this[_fd], buf, 0, buf.length, null, (er, br, buf) => + this[_onread](er, br, buf)) + } + } + + [_onread] (er, br, buf) { + this[_reading] = false + if (er) + this[_onerror](er) + else if (this[_handleChunk](br, buf)) + this[_read]() + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + fs.close(this[_fd], _ => this.emit('close')) + this[_fd] = null + } + } + + [_onerror] (er) { + this[_reading] = true + this[_close]() + this.emit('error', er) + } + + [_handleChunk] (br, buf) { + let ret = false + // no effect if infinite + this[_remain] -= br + if (br > 0) + ret = super.write(br < buf.length ? buf.slice(0, br) : buf) + + if (br === 0 || this[_remain] <= 0) { + ret = false + this[_close]() + super.end() + } + + return ret + } + + emit (ev, data) { + switch (ev) { + case 'prefinish': + case 'finish': + break + + case 'drain': + if (typeof this[_fd] === 'number') + this[_read]() + break + + default: + return super.emit(ev, data) + } + } +} + +class ReadStreamSync extends ReadStream { + [_open] () { + let threw = true + try { + this[_onopen](null, fs.openSync(this[_path], 'r')) + threw = false + } finally { + if (threw) + this[_close]() + } + } + + [_read] () { + let threw = true + try { + if (!this[_reading]) { + this[_reading] = true + do { + const buf = this[_makeBuf]() + /* istanbul ignore next */ + const br = buf.length === 0 ? 0 : fs.readSync(this[_fd], buf, 0, buf.length, null) + if (!this[_handleChunk](br, buf)) + break + } while (true) + this[_reading] = false + } + threw = false + } finally { + if (threw) + this[_close]() + } + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + try { + fs.closeSync(this[_fd]) + } catch (er) {} + this[_fd] = null + this.emit('close') + } + } +} + +class WriteStream extends EE { + constructor (path, opt) { + opt = opt || {} + super(opt) + this.readable = false + this[_writing] = false + this[_ended] = false + this[_needDrain] = false + this[_queue] = [] + this[_path] = path + this[_fd] = typeof opt.fd === 'number' ? opt.fd : null + this[_mode] = opt.mode === undefined ? 0o666 : opt.mode + this[_pos] = typeof opt.start === 'number' ? opt.start : null + this[_autoClose] = typeof opt.autoClose === 'boolean' ? + opt.autoClose : true + + // truncating makes no sense when writing into the middle + const defaultFlag = this[_pos] !== null ? 'r+' : 'w' + this[_defaultFlag] = opt.flags === undefined + this[_flags] = this[_defaultFlag] ? defaultFlag : opt.flags + + if (this[_fd] === null) + this[_open]() + } + + get fd () { return this[_fd] } + get path () { return this[_path] } + + [_onerror] (er) { + this[_close]() + this[_writing] = true + this.emit('error', er) + } + + [_open] () { + fs.open(this[_path], this[_flags], this[_mode], + (er, fd) => this[_onopen](er, fd)) + } + + [_onopen] (er, fd) { + if (this[_defaultFlag] && + this[_flags] === 'r+' && + er && er.code === 'ENOENT') { + this[_flags] = 'w' + this[_open]() + } else if (er) + this[_onerror](er) + else { + this[_fd] = fd + this.emit('open', fd) + this[_flush]() + } + } + + end (buf, enc) { + if (buf) + this.write(buf, enc) + + this[_ended] = true + + // synthetic after-write logic, where drain/finish live + if (!this[_writing] && !this[_queue].length && + typeof this[_fd] === 'number') + this[_onwrite](null, 0) + } + + write (buf, enc) { + if (typeof buf === 'string') + buf = new Buffer(buf, enc) + + if (this[_ended]) { + this.emit('error', new Error('write() after end()')) + return false + } + + if (this[_fd] === null || this[_writing] || this[_queue].length) { + this[_queue].push(buf) + this[_needDrain] = true + return false + } + + this[_writing] = true + this[_write](buf) + return true + } + + [_write] (buf) { + fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => + this[_onwrite](er, bw)) + } + + [_onwrite] (er, bw) { + if (er) + this[_onerror](er) + else { + if (this[_pos] !== null) + this[_pos] += bw + if (this[_queue].length) + this[_flush]() + else { + this[_writing] = false + + if (this[_ended] && !this[_finished]) { + this[_finished] = true + this[_close]() + this.emit('finish') + } else if (this[_needDrain]) { + this[_needDrain] = false + this.emit('drain') + } + } + } + } + + [_flush] () { + if (this[_queue].length === 0) { + if (this[_ended]) + this[_onwrite](null, 0) + } else if (this[_queue].length === 1) + this[_write](this[_queue].pop()) + else { + const iovec = this[_queue] + this[_queue] = [] + writev(this[_fd], iovec, this[_pos], + (er, bw) => this[_onwrite](er, bw)) + } + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + fs.close(this[_fd], _ => this.emit('close')) + this[_fd] = null + } + } +} + +class WriteStreamSync extends WriteStream { + [_open] () { + let fd + try { + fd = fs.openSync(this[_path], this[_flags], this[_mode]) + } catch (er) { + if (this[_defaultFlag] && + this[_flags] === 'r+' && + er && er.code === 'ENOENT') { + this[_flags] = 'w' + return this[_open]() + } else + throw er + } + this[_onopen](null, fd) + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + try { + fs.closeSync(this[_fd]) + } catch (er) {} + this[_fd] = null + this.emit('close') + } + } + + [_write] (buf) { + try { + this[_onwrite](null, + fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos])) + } catch (er) { + this[_onwrite](er, 0) + } + } +} + +const writev = (fd, iovec, pos, cb) => { + const done = (er, bw) => cb(er, bw, iovec) + const req = new FSReqWrap() + req.oncomplete = done + binding.writeBuffers(fd, iovec, pos, req) +} + +exports.ReadStream = ReadStream +exports.ReadStreamSync = ReadStreamSync + +exports.WriteStream = WriteStream +exports.WriteStreamSync = WriteStreamSync diff --git a/legacy-libs/grpc/node_modules/fs-minipass/package.json b/legacy-libs/grpc/node_modules/fs-minipass/package.json new file mode 100644 index 0000000..008d02b --- /dev/null +++ b/legacy-libs/grpc/node_modules/fs-minipass/package.json @@ -0,0 +1,69 @@ +{ + "_from": "fs-minipass@^1.2.5", + "_id": "fs-minipass@1.2.6", + "_inBundle": false, + "_integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==", + "_location": "/grpc/fs-minipass", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "fs-minipass@^1.2.5", + "name": "fs-minipass", + "escapedName": "fs-minipass", + "rawSpec": "^1.2.5", + "saveSpec": null, + "fetchSpec": "^1.2.5" + }, + "_requiredBy": [ + "/grpc/tar" + ], + "_resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz", + "_shasum": "2c5cc30ded81282bfe8a0d7c7c1853ddeb102c07", + "_shrinkwrap": null, + "_spec": "fs-minipass@^1.2.5", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/tar", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/npm/fs-minipass/issues" + }, + "bundleDependencies": false, + "dependencies": { + "minipass": "^2.2.1" + }, + "deprecated": false, + "description": "fs read and write streams based on minipass", + "devDependencies": { + "mutate-fs": "^2.0.1", + "tap": "^13.1.9" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/npm/fs-minipass#readme", + "keywords": [], + "license": "ISC", + "main": "index.js", + "name": "fs-minipass", + "optionalDependencies": {}, + "readme": "# fs-minipass\n\nFilesystem streams based on [minipass](http://npm.im/minipass).\n\n4 classes are exported:\n\n- ReadStream\n- ReadStreamSync\n- WriteStream\n- WriteStreamSync\n\nWhen using `ReadStreamSync`, all of the data is made available\nimmediately upon consuming the stream. Nothing is buffered in memory\nwhen the stream is constructed. If the stream is piped to a writer,\nthen it will synchronously `read()` and emit data into the writer as\nfast as the writer can consume it. (That is, it will respect\nbackpressure.) If you call `stream.read()` then it will read the\nentire file and return the contents.\n\nWhen using `WriteStreamSync`, every write is flushed to the file\nsynchronously. If your writes all come in a single tick, then it'll\nwrite it all out in a single tick. It's as synchronous as you are.\n\nThe async versions work much like their node builtin counterparts,\nwith the exception of introducing significantly less Stream machinery\noverhead.\n\n## USAGE\n\nIt's just streams, you pipe them or read() them or write() to them.\n\n```js\nconst fsm = require('fs-minipass')\nconst readStream = new fsm.ReadStream('file.txt')\nconst writeStream = new fsm.WriteStream('output.txt')\nwriteStream.write('some file header or whatever\\n')\nreadStream.pipe(writeStream)\n```\n\n## ReadStream(path, options)\n\nPath string is required, but somewhat irrelevant if an open file\ndescriptor is passed in as an option.\n\nOptions:\n\n- `fd` Pass in a numeric file descriptor, if the file is already open.\n- `readSize` The size of reads to do, defaults to 16MB\n- `size` The size of the file, if known. Prevents zero-byte read()\n call at the end.\n- `autoClose` Set to `false` to prevent the file descriptor from being\n closed when the file is done being read.\n\n## WriteStream(path, options)\n\nPath string is required, but somewhat irrelevant if an open file\ndescriptor is passed in as an option.\n\nOptions:\n\n- `fd` Pass in a numeric file descriptor, if the file is already open.\n- `mode` The mode to create the file with. Defaults to `0o666`.\n- `start` The position in the file to start reading. If not\n specified, then the file will start writing at position zero, and be\n truncated by default.\n- `autoClose` Set to `false` to prevent the file descriptor from being\n closed when the stream is ended.\n- `flags` Flags to use when opening the file. Irrelevant if `fd` is\n passed in, since file won't be opened in that case. Defaults to\n `'a'` if a `pos` is specified, or `'w'` otherwise.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/fs-minipass.git" + }, + "scripts": { + "postpublish": "git push origin --follow-tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap" + }, + "tap": { + "check-coverage": true + }, + "version": "1.2.6" +} diff --git a/legacy-libs/grpc/node_modules/fs.realpath/LICENSE b/legacy-libs/grpc/node_modules/fs.realpath/LICENSE new file mode 100644 index 0000000..5bd884c --- /dev/null +++ b/legacy-libs/grpc/node_modules/fs.realpath/LICENSE @@ -0,0 +1,43 @@ +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. + +---- + +This library bundles a version of the `fs.realpath` and `fs.realpathSync` +methods from Node.js v0.10 under the terms of the Node.js MIT license. + +Node's license follows, also included at the header of `old.js` which contains +the licensed code: + + 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. diff --git a/legacy-libs/grpc/node_modules/fs.realpath/README.md b/legacy-libs/grpc/node_modules/fs.realpath/README.md new file mode 100644 index 0000000..a42ceac --- /dev/null +++ b/legacy-libs/grpc/node_modules/fs.realpath/README.md @@ -0,0 +1,33 @@ +# fs.realpath + +A backwards-compatible fs.realpath for Node v6 and above + +In Node v6, the JavaScript implementation of fs.realpath was replaced +with a faster (but less resilient) native implementation. That raises +new and platform-specific errors and cannot handle long or excessively +symlink-looping paths. + +This module handles those cases by detecting the new errors and +falling back to the JavaScript implementation. On versions of Node +prior to v6, it has no effect. + +## USAGE + +```js +var rp = require('fs.realpath') + +// async version +rp.realpath(someLongAndLoopingPath, function (er, real) { + // the ELOOP was handled, but it was a bit slower +}) + +// sync version +var real = rp.realpathSync(someLongAndLoopingPath) + +// monkeypatch at your own risk! +// This replaces the fs.realpath/fs.realpathSync builtins +rp.monkeypatch() + +// un-do the monkeypatching +rp.unmonkeypatch() +``` diff --git a/legacy-libs/grpc/node_modules/fs.realpath/index.js b/legacy-libs/grpc/node_modules/fs.realpath/index.js new file mode 100644 index 0000000..b09c7c7 --- /dev/null +++ b/legacy-libs/grpc/node_modules/fs.realpath/index.js @@ -0,0 +1,66 @@ +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch + +var fs = require('fs') +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync + +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = require('./old.js') + +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} + +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } + + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) + } + }) +} + +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) + } + + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er + } + } +} + +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync +} + +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync +} diff --git a/legacy-libs/grpc/node_modules/fs.realpath/old.js b/legacy-libs/grpc/node_modules/fs.realpath/old.js new file mode 100644 index 0000000..b40305e --- /dev/null +++ b/legacy-libs/grpc/node_modules/fs.realpath/old.js @@ -0,0 +1,303 @@ +// 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. + +var pathModule = require('path'); +var isWindows = process.platform === 'win32'; +var fs = require('fs'); + +// JavaScript implementation of realpath, ported from node pre-v6 + +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; + + return callback; + + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } + + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } + } + } +} + +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); +} + +var normalize = pathModule.normalize; + +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; +} + +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; +} + +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; + } + + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } + + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } + + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } + + if (cache) cache[original] = p; + + return p; +}; + + +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } + + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); + } + + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); + } + + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } + + return fs.lstat(base, gotStat); + } + + function gotStat(err, stat) { + if (err) return cb(err); + + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); + } + + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs.stat(base, function(err) { + if (err) return cb(err); + + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); + } + + function gotTarget(err, target, base) { + if (err) return cb(err); + + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } + + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } +}; diff --git a/legacy-libs/grpc/node_modules/fs.realpath/package.json b/legacy-libs/grpc/node_modules/fs.realpath/package.json new file mode 100644 index 0000000..88ff784 --- /dev/null +++ b/legacy-libs/grpc/node_modules/fs.realpath/package.json @@ -0,0 +1,66 @@ +{ + "_args": [ + [ + "fs.realpath@1.0.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "fs.realpath@1.0.0", + "_id": "fs.realpath@1.0.0", + "_inBundle": false, + "_integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "_location": "/grpc/fs.realpath", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "fs.realpath@1.0.0", + "name": "fs.realpath", + "escapedName": "fs.realpath", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/grpc/rimraf/glob" + ], + "_resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "_shrinkwrap": null, + "_spec": "1.0.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/fs.realpath/issues" + }, + "dependencies": {}, + "description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails", + "devDependencies": {}, + "files": [ + "old.js", + "index.js" + ], + "homepage": "https://github.com/isaacs/fs.realpath#readme", + "keywords": [ + "realpath", + "fs", + "polyfill" + ], + "license": "ISC", + "main": "index.js", + "name": "fs.realpath", + "optionalDependencies": {}, + "readme": "# fs.realpath\n\nA backwards-compatible fs.realpath for Node v6 and above\n\nIn Node v6, the JavaScript implementation of fs.realpath was replaced\nwith a faster (but less resilient) native implementation. That raises\nnew and platform-specific errors and cannot handle long or excessively\nsymlink-looping paths.\n\nThis module handles those cases by detecting the new errors and\nfalling back to the JavaScript implementation. On versions of Node\nprior to v6, it has no effect.\n\n## USAGE\n\n```js\nvar rp = require('fs.realpath')\n\n// async version\nrp.realpath(someLongAndLoopingPath, function (er, real) {\n // the ELOOP was handled, but it was a bit slower\n})\n\n// sync version\nvar real = rp.realpathSync(someLongAndLoopingPath)\n\n// monkeypatch at your own risk!\n// This replaces the fs.realpath/fs.realpathSync builtins\nrp.monkeypatch()\n\n// un-do the monkeypatching\nrp.unmonkeypatch()\n```\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/fs.realpath.git" + }, + "scripts": { + "test": "tap test/*.js --cov" + }, + "version": "1.0.0" +} diff --git a/legacy-libs/grpc/node_modules/gauge/CHANGELOG.md b/legacy-libs/grpc/node_modules/gauge/CHANGELOG.md new file mode 100644 index 0000000..407bc19 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/CHANGELOG.md @@ -0,0 +1,160 @@ +### v2.7.4 + +* Reset colors prior to ending a line, to eliminate flicker when a line + is trucated between start and end color sequences. + +### v2.7.3 + +* Only create our onExit handler when we're enabled and remove it when we're + disabled. This stops us from creating multiple onExit handlers when + multiple gauge objects are being used. +* Fix bug where if a theme name were given instead of a theme object, it + would crash. +* Remove supports-color because it's not actually used. Uhm. Yes, I just + updated it. >.> + +### v2.7.2 + +* Use supports-color instead of has-color (as the module has been renamed) + +### v2.7.1 + +* Bug fix: Calls to show/pulse while the progress bar is disabled should still + update our internal representation of what would be shown should it be enabled. + +### v2.7.0 + +* New feature: Add new `isEnabled` method to allow introspection of the gauge's + "enabledness" as controlled by `.enable()` and `.disable()`. + +### v2.6.0 + +* Bug fix: Don't run the code associated with `enable`/`disable` if the gauge + is already enabled or disabled respectively. This prevents leaking event + listeners, amongst other weirdness. +* New feature: Template items can have default values that will be used if no + value was otherwise passed in. + +### v2.5.3 + +* Default to `enabled` only if we have a tty. Users can always override + this by passing in the `enabled` option explicitly or by calling calling + `gauge.enable()`. + +### v2.5.2 + +* Externalized `./console-strings.js` into `console-control-strings`. + +### v2.5.1 + +* Update to `signal-exit@3.0.0`, which fixes a compatibility bug with the + node profiler. +* [#39](https://github.com/iarna/gauge/pull/39) Fix tests on 0.10 and add + a missing devDependency. ([@helloyou2012](https://github.com/helloyou2012)) + +### v2.5.0 + +* Add way to programmatically fetch a list of theme names in a themeset + (`Themeset.getThemeNames`). + +### v2.4.0 + +* Add support for setting themesets on existing gauge objects. +* Add post-IO callback to `gauge.hide()` as it is somtetimes necessary when + your terminal is interleaving output from multiple filehandles (ie, stdout + & stderr). + +### v2.3.1 + +* Fix a refactor bug in setTheme where it wasn't accepting the various types + of args it should. + +### v2.3.0 + +#### FEATURES + +* Add setTemplate & setTheme back in. +* Add support for named themes, you can now ask for things like 'colorASCII' + and 'brailleSpinner'. Of course, you can still pass in theme objects. + Additionally you can now pass in an object with `hasUnicode`, `hasColor` and + `platform` keys in order to override our guesses as to those values when + selecting a default theme from the themeset. +* Make the output stream optional (it defaults to `process.stderr` now). +* Add `setWriteTo(stream[, tty])` to change the output stream and, + optionally, tty. + +#### BUG FIXES & REFACTORING + +* Abort the display phase early if we're supposed to be hidden and we are. +* Stop printing a bunch of spaces at the end of lines, since we're already + using an erase-to-end-of-line code anyway. +* The unicode themes were missing the subsection separator. + +### v2.2.1 + +* Fix image in readme + +### v2.2.0 + +* All new themes API– reference themes by name and pass in custom themes and + themesets (themesets get platform support autodetection done on them to + select the best theme). Theme mixins let you add features to all existing + themes. +* Much, much improved test coverage. + +### v2.1.0 + +* Got rid of ░ in the default platform, noUnicode, hasColor theme. Thanks + to @yongtw123 for pointing out this had snuck in. +* Fiddled with the demo output to make it easier to see the spinner spin. Also + added prints before each platforms test output. +* I forgot to include `signal-exit` in our deps. <.< Thank you @KenanY for + finding this. Then I was lazy and made a new commit instead of using his + PR. Again, thank you for your patience @KenenY. +* Drastically speed up travis testing. +* Add a small javascript demo (demo.js) for showing off the various themes + (and testing them on diff platforms). +* Change: The subsection separator from ⁄ and / (different chars) to >. +* Fix crasher: A show or pulse without a label would cause the template renderer + to complain about a missing value. +* New feature: Add the ability to disable the clean-up-on-exit behavior. + Not something I expect to be widely desirable, but important if you have + multiple distinct gauge instances in your app. +* Use our own color support detection. + The `has-color` module proved too magic for my needs, making assumptions + as to which stream we write to and reading command line arguments. + +### v2.0.0 + +This is a major rewrite of the internals. Externally there are fewer +changes: + +* On node>0.8 gauge object now prints updates at a fixed rate. This means + that when you call `show` it may wate up to `updateInterval` ms before it + actually prints an update. You override this behavior with the + `fixedFramerate` option. +* The gauge object now keeps the cursor hidden as long as it's enabled and + shown. +* The constructor's arguments have changed, now it takes a mandatory output + stream and an optional options object. The stream no longer needs to be + an `ansi`ified stream, although it can be if you want (but we won't make + use of its special features). +* Previously the gauge was disabled by default if `process.stdout` wasn't a + tty. Now it always defaults to enabled. If you want the previous + behavior set the `enabled` option to `process.stdout.isTTY`. +* The constructor's options have changed– see the docs for details. +* Themes are entirely different. If you were using a custom theme, or + referring to one directly (eg via `Gauge.unicode` or `Gauge.ascii`) then + you'll need to change your code. You can get the equivalent of the latter + with: + ``` + var themes = require('gauge/themes') + var unicodeTheme = themes(true, true) // returns the color unicode theme for your platform + ``` + The default themes no longer use any ambiguous width characters, so even + if you choose to display those as wide your progress bar should still + display correctly. +* Templates are entirely different and if you were using a custom one, you + should consult the documentation to learn how to recreate it. If you were + using the default, be aware that it has changed and the result looks quite + a bit different. diff --git a/legacy-libs/grpc/node_modules/gauge/LICENSE b/legacy-libs/grpc/node_modules/gauge/LICENSE new file mode 100644 index 0000000..e756052 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2014, Rebecca Turner + +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/legacy-libs/grpc/node_modules/gauge/README.md b/legacy-libs/grpc/node_modules/gauge/README.md new file mode 100644 index 0000000..bdd60e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/README.md @@ -0,0 +1,399 @@ +gauge +===== + +A nearly stateless terminal based horizontal gauge / progress bar. + +```javascript +var Gauge = require("gauge") + +var gauge = new Gauge() + +gauge.show("test", 0.20) + +gauge.pulse("this") + +gauge.hide() +``` + +![](gauge-demo.gif) + + +### CHANGES FROM 1.x + +Gauge 2.x is breaking release, please see the [changelog] for details on +what's changed if you were previously a user of this module. + +[changelog]: CHANGELOG.md + +### THE GAUGE CLASS + +This is the typical interface to the module– it provides a pretty +fire-and-forget interface to displaying your status information. + +``` +var Gauge = require("gauge") + +var gauge = new Gauge([stream], [options]) +``` + +* **stream** – *(optional, default STDERR)* A stream that progress bar + updates are to be written to. Gauge honors backpressure and will pause + most writing if it is indicated. +* **options** – *(optional)* An option object. + +Constructs a new gauge. Gauges are drawn on a single line, and are not drawn +if **stream** isn't a tty and a tty isn't explicitly provided. + +If **stream** is a terminal or if you pass in **tty** to **options** then we +will detect terminal resizes and redraw to fit. We do this by watching for +`resize` events on the tty. (To work around a bug in verisons of Node prior +to 2.5.0, we watch for them on stdout if the tty is stderr.) Resizes to +larger window sizes will be clean, but shrinking the window will always +result in some cruft. + +**IMPORTANT:** If you prevously were passing in a non-tty stream but you still +want output (for example, a stream wrapped by the `ansi` module) then you +need to pass in the **tty** option below, as `gauge` needs access to +the underlying tty in order to do things like terminal resizes and terminal +width detection. + +The **options** object can have the following properties, all of which are +optional: + +* **updateInterval**: How often gauge updates should be drawn, in miliseconds. +* **fixedFramerate**: Defaults to false on node 0.8, true on everything + else. When this is true a timer is created to trigger once every + `updateInterval` ms, when false, updates are printed as soon as they come + in but updates more often than `updateInterval` are ignored. The reason + 0.8 doesn't have this set to true is that it can't `unref` its timer and + so it would stop your program from exiting– if you want to use this + feature with 0.8 just make sure you call `gauge.disable()` before you + expect your program to exit. +* **themes**: A themeset to use when selecting the theme to use. Defaults + to `gauge/themes`, see the [themes] documentation for details. +* **theme**: Select a theme for use, it can be a: + * Theme object, in which case the **themes** is not used. + * The name of a theme, which will be looked up in the current *themes* + object. + * A configuration object with any of `hasUnicode`, `hasColor` or + `platform` keys, which if wlll be used to override our guesses when making + a default theme selection. + + If no theme is selected then a default is picked using a combination of our + best guesses at your OS, color support and unicode support. +* **template**: Describes what you want your gauge to look like. The + default is what npm uses. Detailed [documentation] is later in this + document. +* **hideCursor**: Defaults to true. If true, then the cursor will be hidden + while the gauge is displayed. +* **tty**: The tty that you're ultimately writing to. Defaults to the same + as **stream**. This is used for detecting the width of the terminal and + resizes. The width used is `tty.columns - 1`. If no tty is available then + a width of `79` is assumed. +* **enabled**: Defaults to true if `tty` is a TTY, false otherwise. If true + the gauge starts enabled. If disabled then all update commands are + ignored and no gauge will be printed until you call `.enable()`. +* **Plumbing**: The class to use to actually generate the gauge for + printing. This defaults to `require('gauge/plumbing')` and ordinarly you + shouldn't need to override this. +* **cleanupOnExit**: Defaults to true. Ordinarily we register an exit + handler to make sure your cursor is turned back on and the progress bar + erased when your process exits, even if you Ctrl-C out or otherwise exit + unexpectedly. You can disable this and it won't register the exit handler. + +[has-unicode]: https://www.npmjs.com/package/has-unicode +[themes]: #themes +[documentation]: #templates + +#### `gauge.show(section | status, [completed])` + +The first argument is either the section, the name of the current thing +contributing to progress, or an object with keys like **section**, +**subsection** & **completed** (or any others you have types for in a custom +template). If you don't want to update or set any of these you can pass +`null` and it will be ignored. + +The second argument is the percent completed as a value between 0 and 1. +Without it, completion is just not updated. You'll also note that completion +can be passed in as part of a status object as the first argument. If both +it and the completed argument are passed in, the completed argument wins. + +#### `gauge.hide([cb])` + +Removes the gauge from the terminal. Optionally, callback `cb` after IO has +had an opportunity to happen (currently this just means after `setImmediate` +has called back.) + +It turns out this is important when you're pausing the progress bar on one +filehandle and printing to another– otherwise (with a big enough print) node +can end up printing the "end progress bar" bits to the progress bar filehandle +while other stuff is printing to another filehandle. These getting interleaved +can cause corruption in some terminals. + +#### `gauge.pulse([subsection])` + +* **subsection** – *(optional)* The specific thing that triggered this pulse + +Spins the spinner in the gauge to show output. If **subsection** is +included then it will be combined with the last name passed to `gauge.show`. + +#### `gauge.disable()` + +Hides the gauge and ignores further calls to `show` or `pulse`. + +#### `gauge.enable()` + +Shows the gauge and resumes updating when `show` or `pulse` is called. + +#### `gauge.isEnabled()` + +Returns true if the gauge is enabled. + +#### `gauge.setThemeset(themes)` + +Change the themeset to select a theme from. The same as the `themes` option +used in the constructor. The theme will be reselected from this themeset. + +#### `gauge.setTheme(theme)` + +Change the active theme, will be displayed with the next show or pulse. This can be: + +* Theme object, in which case the **themes** is not used. +* The name of a theme, which will be looked up in the current *themes* + object. +* A configuration object with any of `hasUnicode`, `hasColor` or + `platform` keys, which if wlll be used to override our guesses when making + a default theme selection. + +If no theme is selected then a default is picked using a combination of our +best guesses at your OS, color support and unicode support. + +#### `gauge.setTemplate(template)` + +Change the active template, will be displayed with the next show or pulse + +### Tracking Completion + +If you have more than one thing going on that you want to track completion +of, you may find the related [are-we-there-yet] helpful. It's `change` +event can be wired up to the `show` method to get a more traditional +progress bar interface. + +[are-we-there-yet]: https://www.npmjs.com/package/are-we-there-yet + +### THEMES + +``` +var themes = require('gauge/themes') + +// fetch the default color unicode theme for this platform +var ourTheme = themes({hasUnicode: true, hasColor: true}) + +// fetch the default non-color unicode theme for osx +var ourTheme = themes({hasUnicode: true, hasColor: false, platform: 'darwin'}) + +// create a new theme based on the color ascii theme for this platform +// that brackets the progress bar with arrows +var ourTheme = themes.newTheme(theme(hasUnicode: false, hasColor: true}), { + preProgressbar: '→', + postProgressbar: '←' +}) +``` + +The object returned by `gauge/themes` is an instance of the `ThemeSet` class. + +``` +var ThemeSet = require('gauge/theme-set') +var themes = new ThemeSet() +// or +var themes = require('gauge/themes') +var mythemes = themes.newThemeset() // creates a new themeset based on the default themes +``` + +#### themes(opts) +#### themes.getDefault(opts) + +Theme objects are a function that fetches the default theme based on +platform, unicode and color support. + +Options is an object with the following properties: + +* **hasUnicode** - If true, fetch a unicode theme, if no unicode theme is + available then a non-unicode theme will be used. +* **hasColor** - If true, fetch a color theme, if no color theme is + available a non-color theme will be used. +* **platform** (optional) - Defaults to `process.platform`. If no + platform match is available then `fallback` is used instead. + +If no compatible theme can be found then an error will be thrown with a +`code` of `EMISSINGTHEME`. + +#### themes.addTheme(themeName, themeObj) +#### themes.addTheme(themeName, [parentTheme], newTheme) + +Adds a named theme to the themeset. You can pass in either a theme object, +as returned by `themes.newTheme` or the arguments you'd pass to +`themes.newTheme`. + +#### themes.getThemeNames() + +Return a list of all of the names of the themes in this themeset. Suitable +for use in `themes.getTheme(…)`. + +#### themes.getTheme(name) + +Returns the theme object from this theme set named `name`. + +If `name` does not exist in this themeset an error will be thrown with +a `code` of `EMISSINGTHEME`. + +#### themes.setDefault([opts], themeName) + +`opts` is an object with the following properties. + +* **platform** - Defaults to `'fallback'`. If your theme is platform + specific, specify that here with the platform from `process.platform`, eg, + `win32`, `darwin`, etc. +* **hasUnicode** - Defaults to `false`. If your theme uses unicode you + should set this to true. +* **hasColor** - Defaults to `false`. If your theme uses color you should + set this to true. + +`themeName` is the name of the theme (as given to `addTheme`) to use for +this set of `opts`. + +#### themes.newTheme([parentTheme,] newTheme) + +Create a new theme object based on `parentTheme`. If no `parentTheme` is +provided then a minimal parentTheme that defines functions for rendering the +activity indicator (spinner) and progress bar will be defined. (This +fallback parent is defined in `gauge/base-theme`.) + +newTheme should be a bare object– we'll start by discussing the properties +defined by the default themes: + +* **preProgressbar** - displayed prior to the progress bar, if the progress + bar is displayed. +* **postProgressbar** - displayed after the progress bar, if the progress bar + is displayed. +* **progressBarTheme** - The subtheme passed through to the progress bar + renderer, it's an object with `complete` and `remaining` properties + that are the strings you want repeated for those sections of the progress + bar. +* **activityIndicatorTheme** - The theme for the activity indicator (spinner), + this can either be a string, in which each character is a different step, or + an array of strings. +* **preSubsection** - Displayed as a separator between the `section` and + `subsection` when the latter is printed. + +More generally, themes can have any value that would be a valid value when rendering +templates. The properties in the theme are used when their name matches a type in +the template. Their values can be: + +* **strings & numbers** - They'll be included as is +* **function (values, theme, width)** - Should return what you want in your output. + *values* is an object with values provided via `gauge.show`, + *theme* is the theme specific to this item (see below) or this theme object, + and *width* is the number of characters wide your result should be. + +There are a couple of special prefixes: + +* **pre** - Is shown prior to the property, if its displayed. +* **post** - Is shown after the property, if its displayed. + +And one special suffix: + +* **Theme** - Its value is passed to a function-type item as the theme. + +#### themes.addToAllThemes(theme) + +This *mixes-in* `theme` into all themes currently defined. It also adds it +to the default parent theme for this themeset, so future themes added to +this themeset will get the values from `theme` by default. + +#### themes.newThemeset() + +Copy the current themeset into a new one. This allows you to easily inherit +one themeset from another. + +### TEMPLATES + +A template is an array of objects and strings that, after being evaluated, +will be turned into the gauge line. The default template is: + +```javascript +[ + {type: 'progressbar', length: 20}, + {type: 'activityIndicator', kerning: 1, length: 1}, + {type: 'section', kerning: 1, default: ''}, + {type: 'subsection', kerning: 1, default: ''} +] +``` + +The various template elements can either be **plain strings**, in which case they will +be be included verbatum in the output, or objects with the following properties: + +* *type* can be any of the following plus any keys you pass into `gauge.show` plus + any keys you have on a custom theme. + * `section` – What big thing you're working on now. + * `subsection` – What component of that thing is currently working. + * `activityIndicator` – Shows a spinner using the `activityIndicatorTheme` + from your active theme. + * `progressbar` – A progress bar representing your current `completed` + using the `progressbarTheme` from your active theme. +* *kerning* – Number of spaces that must be between this item and other + items, if this item is displayed at all. +* *maxLength* – The maximum length for this element. If its value is longer it + will be truncated. +* *minLength* – The minimum length for this element. If its value is shorter it + will be padded according to the *align* value. +* *align* – (Default: left) Possible values "left", "right" and "center". Works + as you'd expect from word processors. +* *length* – Provides a single value for both *minLength* and *maxLength*. If both + *length* and *minLength or *maxLength* are specifed then the latter take precedence. +* *value* – A literal value to use for this template item. +* *default* – A default value to use for this template item if a value + wasn't otherwise passed in. + +### PLUMBING + +This is the super simple, assume nothing, do no magic internals used by gauge to +implement its ordinary interface. + +``` +var Plumbing = require('gauge/plumbing') +var gauge = new Plumbing(theme, template, width) +``` + +* **theme**: The theme to use. +* **template**: The template to use. +* **width**: How wide your gauge should be + +#### `gauge.setTheme(theme)` + +Change the active theme. + +#### `gauge.setTemplate(template)` + +Change the active template. + +#### `gauge.setWidth(width)` + +Change the width to render at. + +#### `gauge.hide()` + +Return the string necessary to hide the progress bar + +#### `gauge.hideCursor()` + +Return a string to hide the cursor. + +#### `gauge.showCursor()` + +Return a string to show the cursor. + +#### `gauge.show(status)` + +Using `status` for values, render the provided template with the theme and return +a string that is suitable for printing to update the gauge. diff --git a/legacy-libs/grpc/node_modules/gauge/base-theme.js b/legacy-libs/grpc/node_modules/gauge/base-theme.js new file mode 100644 index 0000000..0b67638 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/base-theme.js @@ -0,0 +1,14 @@ +'use strict' +var spin = require('./spin.js') +var progressBar = require('./progress-bar.js') + +module.exports = { + activityIndicator: function (values, theme, width) { + if (values.spun == null) return + return spin(theme, values.spun) + }, + progressbar: function (values, theme, width) { + if (values.completed == null) return + return progressBar(theme, width, values.completed) + } +} diff --git a/legacy-libs/grpc/node_modules/gauge/error.js b/legacy-libs/grpc/node_modules/gauge/error.js new file mode 100644 index 0000000..d9914ba --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/error.js @@ -0,0 +1,24 @@ +'use strict' +var util = require('util') + +var User = exports.User = function User (msg) { + var err = new Error(msg) + Error.captureStackTrace(err, User) + err.code = 'EGAUGE' + return err +} + +exports.MissingTemplateValue = function MissingTemplateValue (item, values) { + var err = new User(util.format('Missing template value "%s"', item.type)) + Error.captureStackTrace(err, MissingTemplateValue) + err.template = item + err.values = values + return err +} + +exports.Internal = function Internal (msg) { + var err = new Error(msg) + Error.captureStackTrace(err, Internal) + err.code = 'EGAUGEINTERNAL' + return err +} diff --git a/legacy-libs/grpc/node_modules/gauge/has-color.js b/legacy-libs/grpc/node_modules/gauge/has-color.js new file mode 100644 index 0000000..e283a25 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/has-color.js @@ -0,0 +1,12 @@ +'use strict' + +module.exports = isWin32() || isColorTerm() + +function isWin32 () { + return process.platform === 'win32' +} + +function isColorTerm () { + var termHasColor = /^screen|^xterm|^vt100|color|ansi|cygwin|linux/i + return !!process.env.COLORTERM || termHasColor.test(process.env.TERM) +} diff --git a/legacy-libs/grpc/node_modules/gauge/index.js b/legacy-libs/grpc/node_modules/gauge/index.js new file mode 100644 index 0000000..c553240 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/index.js @@ -0,0 +1,233 @@ +'use strict' +var Plumbing = require('./plumbing.js') +var hasUnicode = require('has-unicode') +var hasColor = require('./has-color.js') +var onExit = require('signal-exit') +var defaultThemes = require('./themes') +var setInterval = require('./set-interval.js') +var process = require('./process.js') +var setImmediate = require('./set-immediate') + +module.exports = Gauge + +function callWith (obj, method) { + return function () { + return method.call(obj) + } +} + +function Gauge (arg1, arg2) { + var options, writeTo + if (arg1 && arg1.write) { + writeTo = arg1 + options = arg2 || {} + } else if (arg2 && arg2.write) { + writeTo = arg2 + options = arg1 || {} + } else { + writeTo = process.stderr + options = arg1 || arg2 || {} + } + + this._status = { + spun: 0, + section: '', + subsection: '' + } + this._paused = false // are we paused for back pressure? + this._disabled = true // are all progress bar updates disabled? + this._showing = false // do we WANT the progress bar on screen + this._onScreen = false // IS the progress bar on screen + this._needsRedraw = false // should we print something at next tick? + this._hideCursor = options.hideCursor == null ? true : options.hideCursor + this._fixedFramerate = options.fixedFramerate == null + ? !(/^v0\.8\./.test(process.version)) + : options.fixedFramerate + this._lastUpdateAt = null + this._updateInterval = options.updateInterval == null ? 50 : options.updateInterval + + this._themes = options.themes || defaultThemes + this._theme = options.theme + var theme = this._computeTheme(options.theme) + var template = options.template || [ + {type: 'progressbar', length: 20}, + {type: 'activityIndicator', kerning: 1, length: 1}, + {type: 'section', kerning: 1, default: ''}, + {type: 'subsection', kerning: 1, default: ''} + ] + this.setWriteTo(writeTo, options.tty) + var PlumbingClass = options.Plumbing || Plumbing + this._gauge = new PlumbingClass(theme, template, this.getWidth()) + + this._$$doRedraw = callWith(this, this._doRedraw) + this._$$handleSizeChange = callWith(this, this._handleSizeChange) + + this._cleanupOnExit = options.cleanupOnExit == null || options.cleanupOnExit + this._removeOnExit = null + + if (options.enabled || (options.enabled == null && this._tty && this._tty.isTTY)) { + this.enable() + } else { + this.disable() + } +} +Gauge.prototype = {} + +Gauge.prototype.isEnabled = function () { + return !this._disabled +} + +Gauge.prototype.setTemplate = function (template) { + this._gauge.setTemplate(template) + if (this._showing) this._requestRedraw() +} + +Gauge.prototype._computeTheme = function (theme) { + if (!theme) theme = {} + if (typeof theme === 'string') { + theme = this._themes.getTheme(theme) + } else if (theme && (Object.keys(theme).length === 0 || theme.hasUnicode != null || theme.hasColor != null)) { + var useUnicode = theme.hasUnicode == null ? hasUnicode() : theme.hasUnicode + var useColor = theme.hasColor == null ? hasColor : theme.hasColor + theme = this._themes.getDefault({hasUnicode: useUnicode, hasColor: useColor, platform: theme.platform}) + } + return theme +} + +Gauge.prototype.setThemeset = function (themes) { + this._themes = themes + this.setTheme(this._theme) +} + +Gauge.prototype.setTheme = function (theme) { + this._gauge.setTheme(this._computeTheme(theme)) + if (this._showing) this._requestRedraw() + this._theme = theme +} + +Gauge.prototype._requestRedraw = function () { + this._needsRedraw = true + if (!this._fixedFramerate) this._doRedraw() +} + +Gauge.prototype.getWidth = function () { + return ((this._tty && this._tty.columns) || 80) - 1 +} + +Gauge.prototype.setWriteTo = function (writeTo, tty) { + var enabled = !this._disabled + if (enabled) this.disable() + this._writeTo = writeTo + this._tty = tty || + (writeTo === process.stderr && process.stdout.isTTY && process.stdout) || + (writeTo.isTTY && writeTo) || + this._tty + if (this._gauge) this._gauge.setWidth(this.getWidth()) + if (enabled) this.enable() +} + +Gauge.prototype.enable = function () { + if (!this._disabled) return + this._disabled = false + if (this._tty) this._enableEvents() + if (this._showing) this.show() +} + +Gauge.prototype.disable = function () { + if (this._disabled) return + if (this._showing) { + this._lastUpdateAt = null + this._showing = false + this._doRedraw() + this._showing = true + } + this._disabled = true + if (this._tty) this._disableEvents() +} + +Gauge.prototype._enableEvents = function () { + if (this._cleanupOnExit) { + this._removeOnExit = onExit(callWith(this, this.disable)) + } + this._tty.on('resize', this._$$handleSizeChange) + if (this._fixedFramerate) { + this.redrawTracker = setInterval(this._$$doRedraw, this._updateInterval) + if (this.redrawTracker.unref) this.redrawTracker.unref() + } +} + +Gauge.prototype._disableEvents = function () { + this._tty.removeListener('resize', this._$$handleSizeChange) + if (this._fixedFramerate) clearInterval(this.redrawTracker) + if (this._removeOnExit) this._removeOnExit() +} + +Gauge.prototype.hide = function (cb) { + if (this._disabled) return cb && process.nextTick(cb) + if (!this._showing) return cb && process.nextTick(cb) + this._showing = false + this._doRedraw() + cb && setImmediate(cb) +} + +Gauge.prototype.show = function (section, completed) { + this._showing = true + if (typeof section === 'string') { + this._status.section = section + } else if (typeof section === 'object') { + var sectionKeys = Object.keys(section) + for (var ii = 0; ii < sectionKeys.length; ++ii) { + var key = sectionKeys[ii] + this._status[key] = section[key] + } + } + if (completed != null) this._status.completed = completed + if (this._disabled) return + this._requestRedraw() +} + +Gauge.prototype.pulse = function (subsection) { + this._status.subsection = subsection || '' + this._status.spun ++ + if (this._disabled) return + if (!this._showing) return + this._requestRedraw() +} + +Gauge.prototype._handleSizeChange = function () { + this._gauge.setWidth(this._tty.columns - 1) + this._requestRedraw() +} + +Gauge.prototype._doRedraw = function () { + if (this._disabled || this._paused) return + if (!this._fixedFramerate) { + var now = Date.now() + if (this._lastUpdateAt && now - this._lastUpdateAt < this._updateInterval) return + this._lastUpdateAt = now + } + if (!this._showing && this._onScreen) { + this._onScreen = false + var result = this._gauge.hide() + if (this._hideCursor) { + result += this._gauge.showCursor() + } + return this._writeTo.write(result) + } + if (!this._showing && !this._onScreen) return + if (this._showing && !this._onScreen) { + this._onScreen = true + this._needsRedraw = true + if (this._hideCursor) { + this._writeTo.write(this._gauge.hideCursor()) + } + } + if (!this._needsRedraw) return + if (!this._writeTo.write(this._gauge.show(this._status))) { + this._paused = true + this._writeTo.on('drain', callWith(this, function () { + this._paused = false + this._doRedraw() + })) + } +} diff --git a/legacy-libs/grpc/node_modules/gauge/package.json b/legacy-libs/grpc/node_modules/gauge/package.json new file mode 100644 index 0000000..e4549ce --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/package.json @@ -0,0 +1,98 @@ +{ + "_args": [ + [ + "gauge@2.7.4", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "gauge@2.7.4", + "_id": "gauge@2.7.4", + "_inBundle": false, + "_integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "_location": "/grpc/gauge", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "gauge@2.7.4", + "name": "gauge", + "escapedName": "gauge", + "rawSpec": "2.7.4", + "saveSpec": null, + "fetchSpec": "2.7.4" + }, + "_requiredBy": [ + "/grpc/npmlog" + ], + "_resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "_shrinkwrap": null, + "_spec": "2.7.4", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Rebecca Turner", + "email": "me@re-becca.org" + }, + "bugs": { + "url": "https://github.com/iarna/gauge/issues" + }, + "dependencies": { + "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" + }, + "description": "A terminal based horizontal guage", + "devDependencies": { + "readable-stream": "^2.0.6", + "require-inject": "^1.4.0", + "standard": "^7.1.2", + "tap": "^5.7.2", + "through2": "^2.0.0" + }, + "files": [ + "base-theme.js", + "CHANGELOG.md", + "error.js", + "has-color.js", + "index.js", + "LICENSE", + "package.json", + "plumbing.js", + "process.js", + "progress-bar.js", + "README.md", + "render-template.js", + "set-immediate.js", + "set-interval.js", + "spin.js", + "template-item.js", + "theme-set.js", + "themes.js", + "wide-truncate.js" + ], + "homepage": "https://github.com/iarna/gauge", + "keywords": [ + "progressbar", + "progress", + "gauge" + ], + "license": "ISC", + "main": "index.js", + "name": "gauge", + "optionalDependencies": {}, + "readme": "gauge\n=====\n\nA nearly stateless terminal based horizontal gauge / progress bar.\n\n```javascript\nvar Gauge = require(\"gauge\")\n\nvar gauge = new Gauge()\n\ngauge.show(\"test\", 0.20)\n\ngauge.pulse(\"this\")\n\ngauge.hide()\n```\n\n![](gauge-demo.gif)\n\n\n### CHANGES FROM 1.x\n\nGauge 2.x is breaking release, please see the [changelog] for details on\nwhat's changed if you were previously a user of this module.\n\n[changelog]: CHANGELOG.md\n\n### THE GAUGE CLASS\n\nThis is the typical interface to the module– it provides a pretty\nfire-and-forget interface to displaying your status information.\n\n```\nvar Gauge = require(\"gauge\")\n\nvar gauge = new Gauge([stream], [options])\n```\n\n* **stream** – *(optional, default STDERR)* A stream that progress bar\n updates are to be written to. Gauge honors backpressure and will pause\n most writing if it is indicated.\n* **options** – *(optional)* An option object.\n\nConstructs a new gauge. Gauges are drawn on a single line, and are not drawn\nif **stream** isn't a tty and a tty isn't explicitly provided.\n\nIf **stream** is a terminal or if you pass in **tty** to **options** then we\nwill detect terminal resizes and redraw to fit. We do this by watching for\n`resize` events on the tty. (To work around a bug in verisons of Node prior\nto 2.5.0, we watch for them on stdout if the tty is stderr.) Resizes to\nlarger window sizes will be clean, but shrinking the window will always\nresult in some cruft.\n\n**IMPORTANT:** If you prevously were passing in a non-tty stream but you still\nwant output (for example, a stream wrapped by the `ansi` module) then you\nneed to pass in the **tty** option below, as `gauge` needs access to\nthe underlying tty in order to do things like terminal resizes and terminal\nwidth detection.\n\nThe **options** object can have the following properties, all of which are\noptional:\n\n* **updateInterval**: How often gauge updates should be drawn, in miliseconds.\n* **fixedFramerate**: Defaults to false on node 0.8, true on everything\n else. When this is true a timer is created to trigger once every\n `updateInterval` ms, when false, updates are printed as soon as they come\n in but updates more often than `updateInterval` are ignored. The reason\n 0.8 doesn't have this set to true is that it can't `unref` its timer and\n so it would stop your program from exiting– if you want to use this\n feature with 0.8 just make sure you call `gauge.disable()` before you\n expect your program to exit.\n* **themes**: A themeset to use when selecting the theme to use. Defaults\n to `gauge/themes`, see the [themes] documentation for details.\n* **theme**: Select a theme for use, it can be a:\n * Theme object, in which case the **themes** is not used.\n * The name of a theme, which will be looked up in the current *themes*\n object.\n * A configuration object with any of `hasUnicode`, `hasColor` or\n `platform` keys, which if wlll be used to override our guesses when making\n a default theme selection.\n\n If no theme is selected then a default is picked using a combination of our\n best guesses at your OS, color support and unicode support.\n* **template**: Describes what you want your gauge to look like. The\n default is what npm uses. Detailed [documentation] is later in this\n document.\n* **hideCursor**: Defaults to true. If true, then the cursor will be hidden\n while the gauge is displayed.\n* **tty**: The tty that you're ultimately writing to. Defaults to the same\n as **stream**. This is used for detecting the width of the terminal and\n resizes. The width used is `tty.columns - 1`. If no tty is available then\n a width of `79` is assumed.\n* **enabled**: Defaults to true if `tty` is a TTY, false otherwise. If true\n the gauge starts enabled. If disabled then all update commands are\n ignored and no gauge will be printed until you call `.enable()`.\n* **Plumbing**: The class to use to actually generate the gauge for\n printing. This defaults to `require('gauge/plumbing')` and ordinarly you\n shouldn't need to override this.\n* **cleanupOnExit**: Defaults to true. Ordinarily we register an exit\n handler to make sure your cursor is turned back on and the progress bar\n erased when your process exits, even if you Ctrl-C out or otherwise exit\n unexpectedly. You can disable this and it won't register the exit handler.\n\n[has-unicode]: https://www.npmjs.com/package/has-unicode\n[themes]: #themes\n[documentation]: #templates\n\n#### `gauge.show(section | status, [completed])`\n\nThe first argument is either the section, the name of the current thing\ncontributing to progress, or an object with keys like **section**,\n**subsection** & **completed** (or any others you have types for in a custom\ntemplate). If you don't want to update or set any of these you can pass\n`null` and it will be ignored.\n\nThe second argument is the percent completed as a value between 0 and 1.\nWithout it, completion is just not updated. You'll also note that completion\ncan be passed in as part of a status object as the first argument. If both\nit and the completed argument are passed in, the completed argument wins.\n\n#### `gauge.hide([cb])`\n\nRemoves the gauge from the terminal. Optionally, callback `cb` after IO has\nhad an opportunity to happen (currently this just means after `setImmediate`\nhas called back.)\n\nIt turns out this is important when you're pausing the progress bar on one\nfilehandle and printing to another– otherwise (with a big enough print) node\ncan end up printing the \"end progress bar\" bits to the progress bar filehandle\nwhile other stuff is printing to another filehandle. These getting interleaved\ncan cause corruption in some terminals.\n\n#### `gauge.pulse([subsection])`\n\n* **subsection** – *(optional)* The specific thing that triggered this pulse\n\nSpins the spinner in the gauge to show output. If **subsection** is\nincluded then it will be combined with the last name passed to `gauge.show`.\n\n#### `gauge.disable()`\n\nHides the gauge and ignores further calls to `show` or `pulse`.\n\n#### `gauge.enable()`\n\nShows the gauge and resumes updating when `show` or `pulse` is called.\n\n#### `gauge.isEnabled()`\n\nReturns true if the gauge is enabled.\n\n#### `gauge.setThemeset(themes)`\n\nChange the themeset to select a theme from. The same as the `themes` option\nused in the constructor. The theme will be reselected from this themeset.\n\n#### `gauge.setTheme(theme)`\n\nChange the active theme, will be displayed with the next show or pulse. This can be:\n\n* Theme object, in which case the **themes** is not used.\n* The name of a theme, which will be looked up in the current *themes*\n object.\n* A configuration object with any of `hasUnicode`, `hasColor` or\n `platform` keys, which if wlll be used to override our guesses when making\n a default theme selection.\n\nIf no theme is selected then a default is picked using a combination of our\nbest guesses at your OS, color support and unicode support.\n\n#### `gauge.setTemplate(template)`\n\nChange the active template, will be displayed with the next show or pulse\n\n### Tracking Completion\n\nIf you have more than one thing going on that you want to track completion\nof, you may find the related [are-we-there-yet] helpful. It's `change`\nevent can be wired up to the `show` method to get a more traditional\nprogress bar interface.\n\n[are-we-there-yet]: https://www.npmjs.com/package/are-we-there-yet\n\n### THEMES\n\n```\nvar themes = require('gauge/themes')\n\n// fetch the default color unicode theme for this platform\nvar ourTheme = themes({hasUnicode: true, hasColor: true})\n\n// fetch the default non-color unicode theme for osx\nvar ourTheme = themes({hasUnicode: true, hasColor: false, platform: 'darwin'})\n\n// create a new theme based on the color ascii theme for this platform\n// that brackets the progress bar with arrows\nvar ourTheme = themes.newTheme(theme(hasUnicode: false, hasColor: true}), {\n preProgressbar: '→',\n postProgressbar: '←'\n})\n```\n\nThe object returned by `gauge/themes` is an instance of the `ThemeSet` class.\n\n```\nvar ThemeSet = require('gauge/theme-set')\nvar themes = new ThemeSet()\n// or\nvar themes = require('gauge/themes')\nvar mythemes = themes.newThemeset() // creates a new themeset based on the default themes\n```\n\n#### themes(opts)\n#### themes.getDefault(opts)\n\nTheme objects are a function that fetches the default theme based on\nplatform, unicode and color support.\n\nOptions is an object with the following properties:\n\n* **hasUnicode** - If true, fetch a unicode theme, if no unicode theme is\n available then a non-unicode theme will be used.\n* **hasColor** - If true, fetch a color theme, if no color theme is\n available a non-color theme will be used.\n* **platform** (optional) - Defaults to `process.platform`. If no\n platform match is available then `fallback` is used instead.\n\nIf no compatible theme can be found then an error will be thrown with a\n`code` of `EMISSINGTHEME`.\n\n#### themes.addTheme(themeName, themeObj)\n#### themes.addTheme(themeName, [parentTheme], newTheme)\n\nAdds a named theme to the themeset. You can pass in either a theme object,\nas returned by `themes.newTheme` or the arguments you'd pass to\n`themes.newTheme`.\n\n#### themes.getThemeNames()\n\nReturn a list of all of the names of the themes in this themeset. Suitable\nfor use in `themes.getTheme(…)`.\n\n#### themes.getTheme(name)\n\nReturns the theme object from this theme set named `name`.\n\nIf `name` does not exist in this themeset an error will be thrown with\na `code` of `EMISSINGTHEME`.\n\n#### themes.setDefault([opts], themeName)\n\n`opts` is an object with the following properties.\n\n* **platform** - Defaults to `'fallback'`. If your theme is platform\n specific, specify that here with the platform from `process.platform`, eg,\n `win32`, `darwin`, etc.\n* **hasUnicode** - Defaults to `false`. If your theme uses unicode you\n should set this to true.\n* **hasColor** - Defaults to `false`. If your theme uses color you should\n set this to true.\n\n`themeName` is the name of the theme (as given to `addTheme`) to use for\nthis set of `opts`.\n\n#### themes.newTheme([parentTheme,] newTheme)\n\nCreate a new theme object based on `parentTheme`. If no `parentTheme` is\nprovided then a minimal parentTheme that defines functions for rendering the\nactivity indicator (spinner) and progress bar will be defined. (This\nfallback parent is defined in `gauge/base-theme`.)\n\nnewTheme should be a bare object– we'll start by discussing the properties\ndefined by the default themes:\n\n* **preProgressbar** - displayed prior to the progress bar, if the progress\n bar is displayed.\n* **postProgressbar** - displayed after the progress bar, if the progress bar\n is displayed.\n* **progressBarTheme** - The subtheme passed through to the progress bar\n renderer, it's an object with `complete` and `remaining` properties\n that are the strings you want repeated for those sections of the progress\n bar.\n* **activityIndicatorTheme** - The theme for the activity indicator (spinner),\n this can either be a string, in which each character is a different step, or\n an array of strings.\n* **preSubsection** - Displayed as a separator between the `section` and\n `subsection` when the latter is printed.\n\nMore generally, themes can have any value that would be a valid value when rendering\ntemplates. The properties in the theme are used when their name matches a type in\nthe template. Their values can be:\n\n* **strings & numbers** - They'll be included as is\n* **function (values, theme, width)** - Should return what you want in your output.\n *values* is an object with values provided via `gauge.show`,\n *theme* is the theme specific to this item (see below) or this theme object,\n and *width* is the number of characters wide your result should be.\n\nThere are a couple of special prefixes:\n\n* **pre** - Is shown prior to the property, if its displayed.\n* **post** - Is shown after the property, if its displayed.\n\nAnd one special suffix:\n\n* **Theme** - Its value is passed to a function-type item as the theme.\n\n#### themes.addToAllThemes(theme)\n\nThis *mixes-in* `theme` into all themes currently defined. It also adds it\nto the default parent theme for this themeset, so future themes added to\nthis themeset will get the values from `theme` by default.\n\n#### themes.newThemeset()\n\nCopy the current themeset into a new one. This allows you to easily inherit\none themeset from another.\n\n### TEMPLATES\n\nA template is an array of objects and strings that, after being evaluated,\nwill be turned into the gauge line. The default template is:\n\n```javascript\n[\n {type: 'progressbar', length: 20},\n {type: 'activityIndicator', kerning: 1, length: 1},\n {type: 'section', kerning: 1, default: ''},\n {type: 'subsection', kerning: 1, default: ''}\n]\n```\n\nThe various template elements can either be **plain strings**, in which case they will\nbe be included verbatum in the output, or objects with the following properties:\n\n* *type* can be any of the following plus any keys you pass into `gauge.show` plus\n any keys you have on a custom theme.\n * `section` – What big thing you're working on now.\n * `subsection` – What component of that thing is currently working.\n * `activityIndicator` – Shows a spinner using the `activityIndicatorTheme`\n from your active theme.\n * `progressbar` – A progress bar representing your current `completed`\n using the `progressbarTheme` from your active theme.\n* *kerning* – Number of spaces that must be between this item and other\n items, if this item is displayed at all.\n* *maxLength* – The maximum length for this element. If its value is longer it\n will be truncated.\n* *minLength* – The minimum length for this element. If its value is shorter it\n will be padded according to the *align* value.\n* *align* – (Default: left) Possible values \"left\", \"right\" and \"center\". Works\n as you'd expect from word processors.\n* *length* – Provides a single value for both *minLength* and *maxLength*. If both\n *length* and *minLength or *maxLength* are specifed then the latter take precedence.\n* *value* – A literal value to use for this template item.\n* *default* – A default value to use for this template item if a value\n wasn't otherwise passed in.\n\n### PLUMBING\n\nThis is the super simple, assume nothing, do no magic internals used by gauge to\nimplement its ordinary interface.\n\n```\nvar Plumbing = require('gauge/plumbing')\nvar gauge = new Plumbing(theme, template, width)\n```\n\n* **theme**: The theme to use.\n* **template**: The template to use.\n* **width**: How wide your gauge should be\n\n#### `gauge.setTheme(theme)`\n\nChange the active theme.\n\n#### `gauge.setTemplate(template)`\n\nChange the active template.\n\n#### `gauge.setWidth(width)`\n\nChange the width to render at.\n\n#### `gauge.hide()`\n\nReturn the string necessary to hide the progress bar\n\n#### `gauge.hideCursor()`\n\nReturn a string to hide the cursor.\n\n#### `gauge.showCursor()`\n\nReturn a string to show the cursor.\n\n#### `gauge.show(status)`\n\nUsing `status` for values, render the provided template with the theme and return\na string that is suitable for printing to update the gauge.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/gauge.git" + }, + "scripts": { + "prepublish": "rm -f *~", + "test": "standard && tap test/*.js --coverage" + }, + "version": "2.7.4" +} diff --git a/legacy-libs/grpc/node_modules/gauge/plumbing.js b/legacy-libs/grpc/node_modules/gauge/plumbing.js new file mode 100644 index 0000000..1afb4af --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/plumbing.js @@ -0,0 +1,48 @@ +'use strict' +var consoleControl = require('console-control-strings') +var renderTemplate = require('./render-template.js') +var validate = require('aproba') + +var Plumbing = module.exports = function (theme, template, width) { + if (!width) width = 80 + validate('OAN', [theme, template, width]) + this.showing = false + this.theme = theme + this.width = width + this.template = template +} +Plumbing.prototype = {} + +Plumbing.prototype.setTheme = function (theme) { + validate('O', [theme]) + this.theme = theme +} + +Plumbing.prototype.setTemplate = function (template) { + validate('A', [template]) + this.template = template +} + +Plumbing.prototype.setWidth = function (width) { + validate('N', [width]) + this.width = width +} + +Plumbing.prototype.hide = function () { + return consoleControl.gotoSOL() + consoleControl.eraseLine() +} + +Plumbing.prototype.hideCursor = consoleControl.hideCursor + +Plumbing.prototype.showCursor = consoleControl.showCursor + +Plumbing.prototype.show = function (status) { + var values = Object.create(this.theme) + for (var key in status) { + values[key] = status[key] + } + + return renderTemplate(this.width, this.template, values).trim() + + consoleControl.color('reset') + + consoleControl.eraseLine() + consoleControl.gotoSOL() +} diff --git a/legacy-libs/grpc/node_modules/gauge/process.js b/legacy-libs/grpc/node_modules/gauge/process.js new file mode 100644 index 0000000..05e8569 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/process.js @@ -0,0 +1,3 @@ +'use strict' +// this exists so we can replace it during testing +module.exports = process diff --git a/legacy-libs/grpc/node_modules/gauge/progress-bar.js b/legacy-libs/grpc/node_modules/gauge/progress-bar.js new file mode 100644 index 0000000..7f8dd68 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/progress-bar.js @@ -0,0 +1,35 @@ +'use strict' +var validate = require('aproba') +var renderTemplate = require('./render-template.js') +var wideTruncate = require('./wide-truncate') +var stringWidth = require('string-width') + +module.exports = function (theme, width, completed) { + validate('ONN', [theme, width, completed]) + if (completed < 0) completed = 0 + if (completed > 1) completed = 1 + if (width <= 0) return '' + var sofar = Math.round(width * completed) + var rest = width - sofar + var template = [ + {type: 'complete', value: repeat(theme.complete, sofar), length: sofar}, + {type: 'remaining', value: repeat(theme.remaining, rest), length: rest} + ] + return renderTemplate(width, template, theme) +} + +// lodash's way of repeating +function repeat (string, width) { + var result = '' + var n = width + do { + if (n % 2) { + result += string + } + n = Math.floor(n / 2) + /*eslint no-self-assign: 0*/ + string += string + } while (n && stringWidth(result) < width) + + return wideTruncate(result, width) +} diff --git a/legacy-libs/grpc/node_modules/gauge/render-template.js b/legacy-libs/grpc/node_modules/gauge/render-template.js new file mode 100644 index 0000000..3261bfb --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/render-template.js @@ -0,0 +1,181 @@ +'use strict' +var align = require('wide-align') +var validate = require('aproba') +var objectAssign = require('object-assign') +var wideTruncate = require('./wide-truncate') +var error = require('./error') +var TemplateItem = require('./template-item') + +function renderValueWithValues (values) { + return function (item) { + return renderValue(item, values) + } +} + +var renderTemplate = module.exports = function (width, template, values) { + var items = prepareItems(width, template, values) + var rendered = items.map(renderValueWithValues(values)).join('') + return align.left(wideTruncate(rendered, width), width) +} + +function preType (item) { + var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1) + return 'pre' + cappedTypeName +} + +function postType (item) { + var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1) + return 'post' + cappedTypeName +} + +function hasPreOrPost (item, values) { + if (!item.type) return + return values[preType(item)] || values[postType(item)] +} + +function generatePreAndPost (baseItem, parentValues) { + var item = objectAssign({}, baseItem) + var values = Object.create(parentValues) + var template = [] + var pre = preType(item) + var post = postType(item) + if (values[pre]) { + template.push({value: values[pre]}) + values[pre] = null + } + item.minLength = null + item.length = null + item.maxLength = null + template.push(item) + values[item.type] = values[item.type] + if (values[post]) { + template.push({value: values[post]}) + values[post] = null + } + return function ($1, $2, length) { + return renderTemplate(length, template, values) + } +} + +function prepareItems (width, template, values) { + function cloneAndObjectify (item, index, arr) { + var cloned = new TemplateItem(item, width) + var type = cloned.type + if (cloned.value == null) { + if (!(type in values)) { + if (cloned.default == null) { + throw new error.MissingTemplateValue(cloned, values) + } else { + cloned.value = cloned.default + } + } else { + cloned.value = values[type] + } + } + if (cloned.value == null || cloned.value === '') return null + cloned.index = index + cloned.first = index === 0 + cloned.last = index === arr.length - 1 + if (hasPreOrPost(cloned, values)) cloned.value = generatePreAndPost(cloned, values) + return cloned + } + + var output = template.map(cloneAndObjectify).filter(function (item) { return item != null }) + + var outputLength = 0 + var remainingSpace = width + var variableCount = output.length + + function consumeSpace (length) { + if (length > remainingSpace) length = remainingSpace + outputLength += length + remainingSpace -= length + } + + function finishSizing (item, length) { + if (item.finished) throw new error.Internal('Tried to finish template item that was already finished') + if (length === Infinity) throw new error.Internal('Length of template item cannot be infinity') + if (length != null) item.length = length + item.minLength = null + item.maxLength = null + --variableCount + item.finished = true + if (item.length == null) item.length = item.getBaseLength() + if (item.length == null) throw new error.Internal('Finished template items must have a length') + consumeSpace(item.getLength()) + } + + output.forEach(function (item) { + if (!item.kerning) return + var prevPadRight = item.first ? 0 : output[item.index - 1].padRight + if (!item.first && prevPadRight < item.kerning) item.padLeft = item.kerning - prevPadRight + if (!item.last) item.padRight = item.kerning + }) + + // Finish any that have a fixed (literal or intuited) length + output.forEach(function (item) { + if (item.getBaseLength() == null) return + finishSizing(item) + }) + + var resized = 0 + var resizing + var hunkSize + do { + resizing = false + hunkSize = Math.round(remainingSpace / variableCount) + output.forEach(function (item) { + if (item.finished) return + if (!item.maxLength) return + if (item.getMaxLength() < hunkSize) { + finishSizing(item, item.maxLength) + resizing = true + } + }) + } while (resizing && resized++ < output.length) + if (resizing) throw new error.Internal('Resize loop iterated too many times while determining maxLength') + + resized = 0 + do { + resizing = false + hunkSize = Math.round(remainingSpace / variableCount) + output.forEach(function (item) { + if (item.finished) return + if (!item.minLength) return + if (item.getMinLength() >= hunkSize) { + finishSizing(item, item.minLength) + resizing = true + } + }) + } while (resizing && resized++ < output.length) + if (resizing) throw new error.Internal('Resize loop iterated too many times while determining minLength') + + hunkSize = Math.round(remainingSpace / variableCount) + output.forEach(function (item) { + if (item.finished) return + finishSizing(item, hunkSize) + }) + + return output +} + +function renderFunction (item, values, length) { + validate('OON', arguments) + if (item.type) { + return item.value(values, values[item.type + 'Theme'] || {}, length) + } else { + return item.value(values, {}, length) + } +} + +function renderValue (item, values) { + var length = item.getBaseLength() + var value = typeof item.value === 'function' ? renderFunction(item, values, length) : item.value + if (value == null || value === '') return '' + var alignWith = align[item.align] || align.left + var leftPadding = item.padLeft ? align.left('', item.padLeft) : '' + var rightPadding = item.padRight ? align.right('', item.padRight) : '' + var truncated = wideTruncate(String(value), length) + var aligned = alignWith(truncated, length) + return leftPadding + aligned + rightPadding +} diff --git a/legacy-libs/grpc/node_modules/gauge/set-immediate.js b/legacy-libs/grpc/node_modules/gauge/set-immediate.js new file mode 100644 index 0000000..6650a48 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/set-immediate.js @@ -0,0 +1,7 @@ +'use strict' +var process = require('./process') +try { + module.exports = setImmediate +} catch (ex) { + module.exports = process.nextTick +} diff --git a/legacy-libs/grpc/node_modules/gauge/set-interval.js b/legacy-libs/grpc/node_modules/gauge/set-interval.js new file mode 100644 index 0000000..5761987 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/set-interval.js @@ -0,0 +1,3 @@ +'use strict' +// this exists so we can replace it during testing +module.exports = setInterval diff --git a/legacy-libs/grpc/node_modules/gauge/spin.js b/legacy-libs/grpc/node_modules/gauge/spin.js new file mode 100644 index 0000000..34142ee --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/spin.js @@ -0,0 +1,5 @@ +'use strict' + +module.exports = function spin (spinstr, spun) { + return spinstr[spun % spinstr.length] +} diff --git a/legacy-libs/grpc/node_modules/gauge/template-item.js b/legacy-libs/grpc/node_modules/gauge/template-item.js new file mode 100644 index 0000000..e46f447 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/template-item.js @@ -0,0 +1,73 @@ +'use strict' +var stringWidth = require('string-width') + +module.exports = TemplateItem + +function isPercent (num) { + if (typeof num !== 'string') return false + return num.slice(-1) === '%' +} + +function percent (num) { + return Number(num.slice(0, -1)) / 100 +} + +function TemplateItem (values, outputLength) { + this.overallOutputLength = outputLength + this.finished = false + this.type = null + this.value = null + this.length = null + this.maxLength = null + this.minLength = null + this.kerning = null + this.align = 'left' + this.padLeft = 0 + this.padRight = 0 + this.index = null + this.first = null + this.last = null + if (typeof values === 'string') { + this.value = values + } else { + for (var prop in values) this[prop] = values[prop] + } + // Realize percents + if (isPercent(this.length)) { + this.length = Math.round(this.overallOutputLength * percent(this.length)) + } + if (isPercent(this.minLength)) { + this.minLength = Math.round(this.overallOutputLength * percent(this.minLength)) + } + if (isPercent(this.maxLength)) { + this.maxLength = Math.round(this.overallOutputLength * percent(this.maxLength)) + } + return this +} + +TemplateItem.prototype = {} + +TemplateItem.prototype.getBaseLength = function () { + var length = this.length + if (length == null && typeof this.value === 'string' && this.maxLength == null && this.minLength == null) { + length = stringWidth(this.value) + } + return length +} + +TemplateItem.prototype.getLength = function () { + var length = this.getBaseLength() + if (length == null) return null + return length + this.padLeft + this.padRight +} + +TemplateItem.prototype.getMaxLength = function () { + if (this.maxLength == null) return null + return this.maxLength + this.padLeft + this.padRight +} + +TemplateItem.prototype.getMinLength = function () { + if (this.minLength == null) return null + return this.minLength + this.padLeft + this.padRight +} + diff --git a/legacy-libs/grpc/node_modules/gauge/theme-set.js b/legacy-libs/grpc/node_modules/gauge/theme-set.js new file mode 100644 index 0000000..68971d5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/theme-set.js @@ -0,0 +1,115 @@ +'use strict' +var objectAssign = require('object-assign') + +module.exports = function () { + return ThemeSetProto.newThemeSet() +} + +var ThemeSetProto = {} + +ThemeSetProto.baseTheme = require('./base-theme.js') + +ThemeSetProto.newTheme = function (parent, theme) { + if (!theme) { + theme = parent + parent = this.baseTheme + } + return objectAssign({}, parent, theme) +} + +ThemeSetProto.getThemeNames = function () { + return Object.keys(this.themes) +} + +ThemeSetProto.addTheme = function (name, parent, theme) { + this.themes[name] = this.newTheme(parent, theme) +} + +ThemeSetProto.addToAllThemes = function (theme) { + var themes = this.themes + Object.keys(themes).forEach(function (name) { + objectAssign(themes[name], theme) + }) + objectAssign(this.baseTheme, theme) +} + +ThemeSetProto.getTheme = function (name) { + if (!this.themes[name]) throw this.newMissingThemeError(name) + return this.themes[name] +} + +ThemeSetProto.setDefault = function (opts, name) { + if (name == null) { + name = opts + opts = {} + } + var platform = opts.platform == null ? 'fallback' : opts.platform + var hasUnicode = !!opts.hasUnicode + var hasColor = !!opts.hasColor + if (!this.defaults[platform]) this.defaults[platform] = {true: {}, false: {}} + this.defaults[platform][hasUnicode][hasColor] = name +} + +ThemeSetProto.getDefault = function (opts) { + if (!opts) opts = {} + var platformName = opts.platform || process.platform + var platform = this.defaults[platformName] || this.defaults.fallback + var hasUnicode = !!opts.hasUnicode + var hasColor = !!opts.hasColor + if (!platform) throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor) + if (!platform[hasUnicode][hasColor]) { + if (hasUnicode && hasColor && platform[!hasUnicode][hasColor]) { + hasUnicode = false + } else if (hasUnicode && hasColor && platform[hasUnicode][!hasColor]) { + hasColor = false + } else if (hasUnicode && hasColor && platform[!hasUnicode][!hasColor]) { + hasUnicode = false + hasColor = false + } else if (hasUnicode && !hasColor && platform[!hasUnicode][hasColor]) { + hasUnicode = false + } else if (!hasUnicode && hasColor && platform[hasUnicode][!hasColor]) { + hasColor = false + } else if (platform === this.defaults.fallback) { + throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor) + } + } + if (platform[hasUnicode][hasColor]) { + return this.getTheme(platform[hasUnicode][hasColor]) + } else { + return this.getDefault(objectAssign({}, opts, {platform: 'fallback'})) + } +} + +ThemeSetProto.newMissingThemeError = function newMissingThemeError (name) { + var err = new Error('Could not find a gauge theme named "' + name + '"') + Error.captureStackTrace.call(err, newMissingThemeError) + err.theme = name + err.code = 'EMISSINGTHEME' + return err +} + +ThemeSetProto.newMissingDefaultThemeError = function newMissingDefaultThemeError (platformName, hasUnicode, hasColor) { + var err = new Error( + 'Could not find a gauge theme for your platform/unicode/color use combo:\n' + + ' platform = ' + platformName + '\n' + + ' hasUnicode = ' + hasUnicode + '\n' + + ' hasColor = ' + hasColor) + Error.captureStackTrace.call(err, newMissingDefaultThemeError) + err.platform = platformName + err.hasUnicode = hasUnicode + err.hasColor = hasColor + err.code = 'EMISSINGTHEME' + return err +} + +ThemeSetProto.newThemeSet = function () { + var themeset = function (opts) { + return themeset.getDefault(opts) + } + return objectAssign(themeset, ThemeSetProto, { + themes: objectAssign({}, this.themes), + baseTheme: objectAssign({}, this.baseTheme), + defaults: JSON.parse(JSON.stringify(this.defaults || {})) + }) +} + diff --git a/legacy-libs/grpc/node_modules/gauge/themes.js b/legacy-libs/grpc/node_modules/gauge/themes.js new file mode 100644 index 0000000..eb5a4f5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/themes.js @@ -0,0 +1,54 @@ +'use strict' +var consoleControl = require('console-control-strings') +var ThemeSet = require('./theme-set.js') + +var themes = module.exports = new ThemeSet() + +themes.addTheme('ASCII', { + preProgressbar: '[', + postProgressbar: ']', + progressbarTheme: { + complete: '#', + remaining: '.' + }, + activityIndicatorTheme: '-\\|/', + preSubsection: '>' +}) + +themes.addTheme('colorASCII', themes.getTheme('ASCII'), { + progressbarTheme: { + preComplete: consoleControl.color('inverse'), + complete: ' ', + postComplete: consoleControl.color('stopInverse'), + preRemaining: consoleControl.color('brightBlack'), + remaining: '.', + postRemaining: consoleControl.color('reset') + } +}) + +themes.addTheme('brailleSpinner', { + preProgressbar: '⸨', + postProgressbar: '⸩', + progressbarTheme: { + complete: '░', + remaining: '⠂' + }, + activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏', + preSubsection: '>' +}) + +themes.addTheme('colorBrailleSpinner', themes.getTheme('brailleSpinner'), { + progressbarTheme: { + preComplete: consoleControl.color('inverse'), + complete: ' ', + postComplete: consoleControl.color('stopInverse'), + preRemaining: consoleControl.color('brightBlack'), + remaining: '░', + postRemaining: consoleControl.color('reset') + } +}) + +themes.setDefault({}, 'ASCII') +themes.setDefault({hasColor: true}, 'colorASCII') +themes.setDefault({platform: 'darwin', hasUnicode: true}, 'brailleSpinner') +themes.setDefault({platform: 'darwin', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner') diff --git a/legacy-libs/grpc/node_modules/gauge/wide-truncate.js b/legacy-libs/grpc/node_modules/gauge/wide-truncate.js new file mode 100644 index 0000000..c531bc4 --- /dev/null +++ b/legacy-libs/grpc/node_modules/gauge/wide-truncate.js @@ -0,0 +1,25 @@ +'use strict' +var stringWidth = require('string-width') +var stripAnsi = require('strip-ansi') + +module.exports = wideTruncate + +function wideTruncate (str, target) { + if (stringWidth(str) === 0) return str + if (target <= 0) return '' + if (stringWidth(str) <= target) return str + + // We compute the number of bytes of ansi sequences here and add + // that to our initial truncation to ensure that we don't slice one + // that we want to keep in half. + var noAnsi = stripAnsi(str) + var ansiSize = str.length + noAnsi.length + var truncated = str.slice(0, target + ansiSize) + + // we have to shrink the result to account for our ansi sequence buffer + // (if an ansi sequence was truncated) and double width characters. + while (stringWidth(truncated) > target) { + truncated = truncated.slice(0, -1) + } + return truncated +} diff --git a/legacy-libs/grpc/node_modules/has-unicode/LICENSE b/legacy-libs/grpc/node_modules/has-unicode/LICENSE new file mode 100644 index 0000000..d42e25e --- /dev/null +++ b/legacy-libs/grpc/node_modules/has-unicode/LICENSE @@ -0,0 +1,14 @@ +Copyright (c) 2014, Rebecca Turner + +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/legacy-libs/grpc/node_modules/has-unicode/README.md b/legacy-libs/grpc/node_modules/has-unicode/README.md new file mode 100644 index 0000000..5a03e59 --- /dev/null +++ b/legacy-libs/grpc/node_modules/has-unicode/README.md @@ -0,0 +1,43 @@ +has-unicode +=========== + +Try to guess if your terminal supports unicode + +```javascript +var hasUnicode = require("has-unicode") + +if (hasUnicode()) { + // the terminal probably has unicode support +} +``` +```javascript +var hasUnicode = require("has-unicode").tryHarder +hasUnicode(function(unicodeSupported) { + if (unicodeSupported) { + // the terminal probably has unicode support + } +}) +``` + +## Detecting Unicode + +What we actually detect is UTF-8 support, as that's what Node itself supports. +If you have a UTF-16 locale then you won't be detected as unicode capable. + +### Windows + +Since at least Windows 7, `cmd` and `powershell` have been unicode capable, +but unfortunately even then it's not guaranteed. In many localizations it +still uses legacy code pages and there's no facility short of running +programs or linking C++ that will let us detect this. As such, we +report any Windows installation as NOT unicode capable, and recommend +that you encourage your users to override this via config. + +### Unix Like Operating Systems + +We look at the environment variables `LC_ALL`, `LC_CTYPE`, and `LANG` in +that order. For `LC_ALL` and `LANG`, it looks for `.UTF-8` in the value. +For `LC_CTYPE` it looks to see if the value is `UTF-8`. This is sufficient +for most POSIX systems. While locale data can be put in `/etc/locale.conf` +as well, AFAIK it's always copied into the environment. + diff --git a/legacy-libs/grpc/node_modules/has-unicode/index.js b/legacy-libs/grpc/node_modules/has-unicode/index.js new file mode 100644 index 0000000..9b0fe44 --- /dev/null +++ b/legacy-libs/grpc/node_modules/has-unicode/index.js @@ -0,0 +1,16 @@ +"use strict" +var os = require("os") + +var hasUnicode = module.exports = function () { + // Recent Win32 platforms (>XP) CAN support unicode in the console but + // don't have to, and in non-english locales often use traditional local + // code pages. There's no way, short of windows system calls or execing + // the chcp command line program to figure this out. As such, we default + // this to false and encourage your users to override it via config if + // appropriate. + if (os.type() == "Windows_NT") { return false } + + var isUTF8 = /UTF-?8$/i + var ctype = process.env.LC_ALL || process.env.LC_CTYPE || process.env.LANG + return isUTF8.test(ctype) +} diff --git a/legacy-libs/grpc/node_modules/has-unicode/package.json b/legacy-libs/grpc/node_modules/has-unicode/package.json new file mode 100644 index 0000000..317695d --- /dev/null +++ b/legacy-libs/grpc/node_modules/has-unicode/package.json @@ -0,0 +1,66 @@ +{ + "_args": [ + [ + "has-unicode@2.0.1", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "has-unicode@2.0.1", + "_id": "has-unicode@2.0.1", + "_inBundle": false, + "_integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "_location": "/grpc/has-unicode", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "has-unicode@2.0.1", + "name": "has-unicode", + "escapedName": "has-unicode", + "rawSpec": "2.0.1", + "saveSpec": null, + "fetchSpec": "2.0.1" + }, + "_requiredBy": [ + "/grpc/gauge" + ], + "_resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "_shrinkwrap": null, + "_spec": "2.0.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Rebecca Turner", + "email": "me@re-becca.org" + }, + "bugs": { + "url": "https://github.com/iarna/has-unicode/issues" + }, + "dependencies": {}, + "description": "Try to guess if your terminal supports unicode", + "devDependencies": { + "require-inject": "^1.3.0", + "tap": "^2.3.1" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/iarna/has-unicode", + "keywords": [ + "unicode", + "terminal" + ], + "license": "ISC", + "main": "index.js", + "name": "has-unicode", + "optionalDependencies": {}, + "readme": "has-unicode\n===========\n\nTry to guess if your terminal supports unicode\n\n```javascript\nvar hasUnicode = require(\"has-unicode\")\n\nif (hasUnicode()) {\n // the terminal probably has unicode support\n}\n```\n```javascript\nvar hasUnicode = require(\"has-unicode\").tryHarder\nhasUnicode(function(unicodeSupported) {\n if (unicodeSupported) {\n // the terminal probably has unicode support\n }\n})\n```\n\n## Detecting Unicode\n\nWhat we actually detect is UTF-8 support, as that's what Node itself supports.\nIf you have a UTF-16 locale then you won't be detected as unicode capable.\n\n### Windows\n\nSince at least Windows 7, `cmd` and `powershell` have been unicode capable,\nbut unfortunately even then it's not guaranteed. In many localizations it\nstill uses legacy code pages and there's no facility short of running\nprograms or linking C++ that will let us detect this. As such, we\nreport any Windows installation as NOT unicode capable, and recommend\nthat you encourage your users to override this via config.\n\n### Unix Like Operating Systems\n\nWe look at the environment variables `LC_ALL`, `LC_CTYPE`, and `LANG` in\nthat order. For `LC_ALL` and `LANG`, it looks for `.UTF-8` in the value. \nFor `LC_CTYPE` it looks to see if the value is `UTF-8`. This is sufficient\nfor most POSIX systems. While locale data can be put in `/etc/locale.conf`\nas well, AFAIK it's always copied into the environment.\n\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/has-unicode.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "2.0.1" +} diff --git a/legacy-libs/grpc/node_modules/iconv-lite/Changelog.md b/legacy-libs/grpc/node_modules/iconv-lite/Changelog.md new file mode 100644 index 0000000..e31cd0c --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/Changelog.md @@ -0,0 +1,158 @@ + +# 0.4.23 / 2018-05-07 + + * Fix deprecation warning in Node v10 due to the last usage of `new Buffer` (#185, by @felixbuenemann) + * Switched from NodeBuffer to Buffer in typings (#155 by @felixfbecker, #186 by @larssn) + + +# 0.4.22 / 2018-05-05 + + * Use older semver style for dependencies to be compatible with Node version 0.10 (#182, by @dougwilson) + * Fix tests to accomodate fixes in Node v10 (#182, by @dougwilson) + + +# 0.4.21 / 2018-04-06 + + * Fix encoding canonicalization (#156) + * Fix the paths in the "browser" field in package.json (#174 by @LMLB) + * Removed "contributors" section in package.json - see Git history instead. + + +# 0.4.20 / 2018-04-06 + + * Updated `new Buffer()` usages with recommended replacements as it's being deprecated in Node v10 (#176, #178 by @ChALkeR) + + +# 0.4.19 / 2017-09-09 + + * Fixed iso8859-1 codec regression in handling untranslatable characters (#162, caused by #147) + * Re-generated windows1255 codec, because it was updated in iconv project + * Fixed grammar in error message when iconv-lite is loaded with encoding other than utf8 + + +# 0.4.18 / 2017-06-13 + + * Fixed CESU-8 regression in Node v8. + + +# 0.4.17 / 2017-04-22 + + * Updated typescript definition file to support Angular 2 AoT mode (#153 by @larssn) + + +# 0.4.16 / 2017-04-22 + + * Added support for React Native (#150) + * Changed iso8859-1 encoding to usine internal 'binary' encoding, as it's the same thing (#147 by @mscdex) + * Fixed typo in Readme (#138 by @jiangzhuo) + * Fixed build for Node v6.10+ by making correct version comparison + * Added a warning if iconv-lite is loaded not as utf-8 (see #142) + + +# 0.4.15 / 2016-11-21 + + * Fixed typescript type definition (#137) + + +# 0.4.14 / 2016-11-20 + + * Preparation for v1.0 + * Added Node v6 and latest Node versions to Travis CI test rig + * Deprecated Node v0.8 support + * Typescript typings (@larssn) + * Fix encoding of Euro character in GB 18030 (inspired by @lygstate) + * Add ms prefix to dbcs windows encodings (@rokoroku) + + +# 0.4.13 / 2015-10-01 + + * Fix silly mistake in deprecation notice. + + +# 0.4.12 / 2015-09-26 + + * Node v4 support: + * Added CESU-8 decoding (#106) + * Added deprecation notice for `extendNodeEncodings` + * Added Travis tests for Node v4 and io.js latest (#105 by @Mithgol) + + +# 0.4.11 / 2015-07-03 + + * Added CESU-8 encoding. + + +# 0.4.10 / 2015-05-26 + + * Changed UTF-16 endianness heuristic to take into account any ASCII chars, not + just spaces. This should minimize the importance of "default" endianness. + + +# 0.4.9 / 2015-05-24 + + * Streamlined BOM handling: strip BOM by default, add BOM when encoding if + addBOM: true. Added docs to Readme. + * UTF16 now uses UTF16-LE by default. + * Fixed minor issue with big5 encoding. + * Added io.js testing on Travis; updated node-iconv version to test against. + Now we just skip testing SBCS encodings that node-iconv doesn't support. + * (internal refactoring) Updated codec interface to use classes. + * Use strict mode in all files. + + +# 0.4.8 / 2015-04-14 + + * added alias UNICODE-1-1-UTF-7 for UTF-7 encoding (#94) + + +# 0.4.7 / 2015-02-05 + + * stop official support of Node.js v0.8. Should still work, but no guarantees. + reason: Packages needed for testing are hard to get on Travis CI. + * work in environment where Object.prototype is monkey patched with enumerable + props (#89). + + +# 0.4.6 / 2015-01-12 + + * fix rare aliases of single-byte encodings (thanks @mscdex) + * double the timeout for dbcs tests to make them less flaky on travis + + +# 0.4.5 / 2014-11-20 + + * fix windows-31j and x-sjis encoding support (@nleush) + * minor fix: undefined variable reference when internal error happens + + +# 0.4.4 / 2014-07-16 + + * added encodings UTF-7 (RFC2152) and UTF-7-IMAP (RFC3501 Section 5.1.3) + * fixed streaming base64 encoding + + +# 0.4.3 / 2014-06-14 + + * added encodings UTF-16BE and UTF-16 with BOM + + +# 0.4.2 / 2014-06-12 + + * don't throw exception if `extendNodeEncodings()` is called more than once + + +# 0.4.1 / 2014-06-11 + + * codepage 808 added + + +# 0.4.0 / 2014-06-10 + + * code is rewritten from scratch + * all widespread encodings are supported + * streaming interface added + * browserify compatibility added + * (optional) extend core primitive encodings to make usage even simpler + * moved from vows to mocha as the testing framework + + diff --git a/legacy-libs/grpc/node_modules/iconv-lite/LICENSE b/legacy-libs/grpc/node_modules/iconv-lite/LICENSE new file mode 100644 index 0000000..d518d83 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2011 Alexander Shtuchkin + +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/legacy-libs/grpc/node_modules/iconv-lite/README.md b/legacy-libs/grpc/node_modules/iconv-lite/README.md new file mode 100644 index 0000000..c981c37 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/README.md @@ -0,0 +1,156 @@ +## Pure JS character encoding conversion [![Build Status](https://travis-ci.org/ashtuchkin/iconv-lite.svg?branch=master)](https://travis-ci.org/ashtuchkin/iconv-lite) + + * Doesn't need native code compilation. Works on Windows and in sandboxed environments like [Cloud9](http://c9.io). + * Used in popular projects like [Express.js (body_parser)](https://github.com/expressjs/body-parser), + [Grunt](http://gruntjs.com/), [Nodemailer](http://www.nodemailer.com/), [Yeoman](http://yeoman.io/) and others. + * Faster than [node-iconv](https://github.com/bnoordhuis/node-iconv) (see below for performance comparison). + * Intuitive encode/decode API + * Streaming support for Node v0.10+ + * [Deprecated] Can extend Node.js primitives (buffers, streams) to support all iconv-lite encodings. + * In-browser usage via [Browserify](https://github.com/substack/node-browserify) (~180k gzip compressed with Buffer shim included). + * Typescript [type definition file](https://github.com/ashtuchkin/iconv-lite/blob/master/lib/index.d.ts) included. + * React Native is supported (need to explicitly `npm install` two more modules: `buffer` and `stream`). + * License: MIT. + +[![NPM Stats](https://nodei.co/npm/iconv-lite.png?downloads=true&downloadRank=true)](https://npmjs.org/packages/iconv-lite/) + +## Usage +### Basic API +```javascript +var iconv = require('iconv-lite'); + +// Convert from an encoded buffer to js string. +str = iconv.decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251'); + +// Convert from js string to an encoded buffer. +buf = iconv.encode("Sample input string", 'win1251'); + +// Check if encoding is supported +iconv.encodingExists("us-ascii") +``` + +### Streaming API (Node v0.10+) +```javascript + +// Decode stream (from binary stream to js strings) +http.createServer(function(req, res) { + var converterStream = iconv.decodeStream('win1251'); + req.pipe(converterStream); + + converterStream.on('data', function(str) { + console.log(str); // Do something with decoded strings, chunk-by-chunk. + }); +}); + +// Convert encoding streaming example +fs.createReadStream('file-in-win1251.txt') + .pipe(iconv.decodeStream('win1251')) + .pipe(iconv.encodeStream('ucs2')) + .pipe(fs.createWriteStream('file-in-ucs2.txt')); + +// Sugar: all encode/decode streams have .collect(cb) method to accumulate data. +http.createServer(function(req, res) { + req.pipe(iconv.decodeStream('win1251')).collect(function(err, body) { + assert(typeof body == 'string'); + console.log(body); // full request body string + }); +}); +``` + +### [Deprecated] Extend Node.js own encodings +> NOTE: This doesn't work on latest Node versions. See [details](https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility). + +```javascript +// After this call all Node basic primitives will understand iconv-lite encodings. +iconv.extendNodeEncodings(); + +// Examples: +buf = new Buffer(str, 'win1251'); +buf.write(str, 'gbk'); +str = buf.toString('latin1'); +assert(Buffer.isEncoding('iso-8859-15')); +Buffer.byteLength(str, 'us-ascii'); + +http.createServer(function(req, res) { + req.setEncoding('big5'); + req.collect(function(err, body) { + console.log(body); + }); +}); + +fs.createReadStream("file.txt", "shift_jis"); + +// External modules are also supported (if they use Node primitives, which they probably do). +request = require('request'); +request({ + url: "http://github.com/", + encoding: "cp932" +}); + +// To remove extensions +iconv.undoExtendNodeEncodings(); +``` + +## Supported encodings + + * All node.js native encodings: utf8, ucs2 / utf16-le, ascii, binary, base64, hex. + * Additional unicode encodings: utf16, utf16-be, utf-7, utf-7-imap. + * All widespread singlebyte encodings: Windows 125x family, ISO-8859 family, + IBM/DOS codepages, Macintosh family, KOI8 family, all others supported by iconv library. + Aliases like 'latin1', 'us-ascii' also supported. + * All widespread multibyte encodings: CP932, CP936, CP949, CP950, GB2312, GBK, GB18030, Big5, Shift_JIS, EUC-JP. + +See [all supported encodings on wiki](https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings). + +Most singlebyte encodings are generated automatically from [node-iconv](https://github.com/bnoordhuis/node-iconv). Thank you Ben Noordhuis and libiconv authors! + +Multibyte encodings are generated from [Unicode.org mappings](http://www.unicode.org/Public/MAPPINGS/) and [WHATWG Encoding Standard mappings](http://encoding.spec.whatwg.org/). Thank you, respective authors! + + +## Encoding/decoding speed + +Comparison with node-iconv module (1000x256kb, on MacBook Pro, Core i5/2.6 GHz, Node v0.12.0). +Note: your results may vary, so please always check on your hardware. + + operation iconv@2.1.4 iconv-lite@0.4.7 + ---------------------------------------------------------- + encode('win1251') ~96 Mb/s ~320 Mb/s + decode('win1251') ~95 Mb/s ~246 Mb/s + +## BOM handling + + * Decoding: BOM is stripped by default, unless overridden by passing `stripBOM: false` in options + (f.ex. `iconv.decode(buf, enc, {stripBOM: false})`). + A callback might also be given as a `stripBOM` parameter - it'll be called if BOM character was actually found. + * If you want to detect UTF-8 BOM when decoding other encodings, use [node-autodetect-decoder-stream](https://github.com/danielgindi/node-autodetect-decoder-stream) module. + * Encoding: No BOM added, unless overridden by `addBOM: true` option. + +## UTF-16 Encodings + +This library supports UTF-16LE, UTF-16BE and UTF-16 encodings. First two are straightforward, but UTF-16 is trying to be +smart about endianness in the following ways: + * Decoding: uses BOM and 'spaces heuristic' to determine input endianness. Default is UTF-16LE, but can be + overridden with `defaultEncoding: 'utf-16be'` option. Strips BOM unless `stripBOM: false`. + * Encoding: uses UTF-16LE and writes BOM by default. Use `addBOM: false` to override. + +## Other notes + +When decoding, be sure to supply a Buffer to decode() method, otherwise [bad things usually happen](https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding). +Untranslatable characters are set to � or ?. No transliteration is currently supported. +Node versions 0.10.31 and 0.11.13 are buggy, don't use them (see #65, #77). + +## Testing + +```bash +$ git clone git@github.com:ashtuchkin/iconv-lite.git +$ cd iconv-lite +$ npm install +$ npm test + +$ # To view performance: +$ node test/performance.js + +$ # To view test coverage: +$ npm run coverage +$ open coverage/lcov-report/index.html +``` diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-codec.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-codec.js new file mode 100644 index 0000000..1fe3e16 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-codec.js @@ -0,0 +1,555 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Multibyte codec. In this scheme, a character is represented by 1 or more bytes. +// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences. +// To save memory and loading time, we read table files only when requested. + +exports._dbcs = DBCSCodec; + +var UNASSIGNED = -1, + GB18030_CODE = -2, + SEQ_START = -10, + NODE_START = -1000, + UNASSIGNED_NODE = new Array(0x100), + DEF_CHAR = -1; + +for (var i = 0; i < 0x100; i++) + UNASSIGNED_NODE[i] = UNASSIGNED; + + +// Class DBCSCodec reads and initializes mapping tables. +function DBCSCodec(codecOptions, iconv) { + this.encodingName = codecOptions.encodingName; + if (!codecOptions) + throw new Error("DBCS codec is called without the data.") + if (!codecOptions.table) + throw new Error("Encoding '" + this.encodingName + "' has no data."); + + // Load tables. + var mappingTable = codecOptions.table(); + + + // Decode tables: MBCS -> Unicode. + + // decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256. + // Trie root is decodeTables[0]. + // Values: >= 0 -> unicode character code. can be > 0xFFFF + // == UNASSIGNED -> unknown/unassigned sequence. + // == GB18030_CODE -> this is the end of a GB18030 4-byte sequence. + // <= NODE_START -> index of the next node in our trie to process next byte. + // <= SEQ_START -> index of the start of a character code sequence, in decodeTableSeq. + this.decodeTables = []; + this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node. + + // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here. + this.decodeTableSeq = []; + + // Actual mapping tables consist of chunks. Use them to fill up decode tables. + for (var i = 0; i < mappingTable.length; i++) + this._addDecodeChunk(mappingTable[i]); + + this.defaultCharUnicode = iconv.defaultCharUnicode; + + + // Encode tables: Unicode -> DBCS. + + // `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance. + // Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null. + // Values: >= 0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.). + // == UNASSIGNED -> no conversion found. Output a default char. + // <= SEQ_START -> it's an index in encodeTableSeq, see below. The character starts a sequence. + this.encodeTable = []; + + // `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of + // objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key + // means end of sequence (needed when one sequence is a strict subsequence of another). + // Objects are kept separately from encodeTable to increase performance. + this.encodeTableSeq = []; + + // Some chars can be decoded, but need not be encoded. + var skipEncodeChars = {}; + if (codecOptions.encodeSkipVals) + for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) { + var val = codecOptions.encodeSkipVals[i]; + if (typeof val === 'number') + skipEncodeChars[val] = true; + else + for (var j = val.from; j <= val.to; j++) + skipEncodeChars[j] = true; + } + + // Use decode trie to recursively fill out encode tables. + this._fillEncodeTable(0, 0, skipEncodeChars); + + // Add more encoding pairs when needed. + if (codecOptions.encodeAdd) { + for (var uChar in codecOptions.encodeAdd) + if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar)) + this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]); + } + + this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)]; + if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?']; + if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0); + + + // Load & create GB18030 tables when needed. + if (typeof codecOptions.gb18030 === 'function') { + this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges. + + // Add GB18030 decode tables. + var thirdByteNodeIdx = this.decodeTables.length; + var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0); + + var fourthByteNodeIdx = this.decodeTables.length; + var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0); + + for (var i = 0x81; i <= 0xFE; i++) { + var secondByteNodeIdx = NODE_START - this.decodeTables[0][i]; + var secondByteNode = this.decodeTables[secondByteNodeIdx]; + for (var j = 0x30; j <= 0x39; j++) + secondByteNode[j] = NODE_START - thirdByteNodeIdx; + } + for (var i = 0x81; i <= 0xFE; i++) + thirdByteNode[i] = NODE_START - fourthByteNodeIdx; + for (var i = 0x30; i <= 0x39; i++) + fourthByteNode[i] = GB18030_CODE + } +} + +DBCSCodec.prototype.encoder = DBCSEncoder; +DBCSCodec.prototype.decoder = DBCSDecoder; + +// Decoder helpers +DBCSCodec.prototype._getDecodeTrieNode = function(addr) { + var bytes = []; + for (; addr > 0; addr >>= 8) + bytes.push(addr & 0xFF); + if (bytes.length == 0) + bytes.push(0); + + var node = this.decodeTables[0]; + for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie. + var val = node[bytes[i]]; + + if (val == UNASSIGNED) { // Create new node. + node[bytes[i]] = NODE_START - this.decodeTables.length; + this.decodeTables.push(node = UNASSIGNED_NODE.slice(0)); + } + else if (val <= NODE_START) { // Existing node. + node = this.decodeTables[NODE_START - val]; + } + else + throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16)); + } + return node; +} + + +DBCSCodec.prototype._addDecodeChunk = function(chunk) { + // First element of chunk is the hex mbcs code where we start. + var curAddr = parseInt(chunk[0], 16); + + // Choose the decoding node where we'll write our chars. + var writeTable = this._getDecodeTrieNode(curAddr); + curAddr = curAddr & 0xFF; + + // Write all other elements of the chunk to the table. + for (var k = 1; k < chunk.length; k++) { + var part = chunk[k]; + if (typeof part === "string") { // String, write as-is. + for (var l = 0; l < part.length;) { + var code = part.charCodeAt(l++); + if (0xD800 <= code && code < 0xDC00) { // Decode surrogate + var codeTrail = part.charCodeAt(l++); + if (0xDC00 <= codeTrail && codeTrail < 0xE000) + writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00); + else + throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]); + } + else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used) + var len = 0xFFF - code + 2; + var seq = []; + for (var m = 0; m < len; m++) + seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq. + + writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length; + this.decodeTableSeq.push(seq); + } + else + writeTable[curAddr++] = code; // Basic char + } + } + else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character. + var charCode = writeTable[curAddr - 1] + 1; + for (var l = 0; l < part; l++) + writeTable[curAddr++] = charCode++; + } + else + throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]); + } + if (curAddr > 0xFF) + throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr); +} + +// Encoder helpers +DBCSCodec.prototype._getEncodeBucket = function(uCode) { + var high = uCode >> 8; // This could be > 0xFF because of astral characters. + if (this.encodeTable[high] === undefined) + this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand. + return this.encodeTable[high]; +} + +DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) { + var bucket = this._getEncodeBucket(uCode); + var low = uCode & 0xFF; + if (bucket[low] <= SEQ_START) + this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it. + else if (bucket[low] == UNASSIGNED) + bucket[low] = dbcsCode; +} + +DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) { + + // Get the root of character tree according to first character of the sequence. + var uCode = seq[0]; + var bucket = this._getEncodeBucket(uCode); + var low = uCode & 0xFF; + + var node; + if (bucket[low] <= SEQ_START) { + // There's already a sequence with - use it. + node = this.encodeTableSeq[SEQ_START-bucket[low]]; + } + else { + // There was no sequence object - allocate a new one. + node = {}; + if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence. + bucket[low] = SEQ_START - this.encodeTableSeq.length; + this.encodeTableSeq.push(node); + } + + // Traverse the character tree, allocating new nodes as needed. + for (var j = 1; j < seq.length-1; j++) { + var oldVal = node[uCode]; + if (typeof oldVal === 'object') + node = oldVal; + else { + node = node[uCode] = {} + if (oldVal !== undefined) + node[DEF_CHAR] = oldVal + } + } + + // Set the leaf to given dbcsCode. + uCode = seq[seq.length-1]; + node[uCode] = dbcsCode; +} + +DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) { + var node = this.decodeTables[nodeIdx]; + for (var i = 0; i < 0x100; i++) { + var uCode = node[i]; + var mbCode = prefix + i; + if (skipEncodeChars[mbCode]) + continue; + + if (uCode >= 0) + this._setEncodeChar(uCode, mbCode); + else if (uCode <= NODE_START) + this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars); + else if (uCode <= SEQ_START) + this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode); + } +} + + + +// == Encoder ================================================================== + +function DBCSEncoder(options, codec) { + // Encoder state + this.leadSurrogate = -1; + this.seqObj = undefined; + + // Static data + this.encodeTable = codec.encodeTable; + this.encodeTableSeq = codec.encodeTableSeq; + this.defaultCharSingleByte = codec.defCharSB; + this.gb18030 = codec.gb18030; +} + +DBCSEncoder.prototype.write = function(str) { + var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)), + leadSurrogate = this.leadSurrogate, + seqObj = this.seqObj, nextChar = -1, + i = 0, j = 0; + + while (true) { + // 0. Get next character. + if (nextChar === -1) { + if (i == str.length) break; + var uCode = str.charCodeAt(i++); + } + else { + var uCode = nextChar; + nextChar = -1; + } + + // 1. Handle surrogates. + if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates. + if (uCode < 0xDC00) { // We've got lead surrogate. + if (leadSurrogate === -1) { + leadSurrogate = uCode; + continue; + } else { + leadSurrogate = uCode; + // Double lead surrogate found. + uCode = UNASSIGNED; + } + } else { // We've got trail surrogate. + if (leadSurrogate !== -1) { + uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00); + leadSurrogate = -1; + } else { + // Incomplete surrogate pair - only trail surrogate found. + uCode = UNASSIGNED; + } + + } + } + else if (leadSurrogate !== -1) { + // Incomplete surrogate pair - only lead surrogate found. + nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char. + leadSurrogate = -1; + } + + // 2. Convert uCode character. + var dbcsCode = UNASSIGNED; + if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence + var resCode = seqObj[uCode]; + if (typeof resCode === 'object') { // Sequence continues. + seqObj = resCode; + continue; + + } else if (typeof resCode == 'number') { // Sequence finished. Write it. + dbcsCode = resCode; + + } else if (resCode == undefined) { // Current character is not part of the sequence. + + // Try default character for this sequence + resCode = seqObj[DEF_CHAR]; + if (resCode !== undefined) { + dbcsCode = resCode; // Found. Write it. + nextChar = uCode; // Current character will be written too in the next iteration. + + } else { + // TODO: What if we have no default? (resCode == undefined) + // Then, we should write first char of the sequence as-is and try the rest recursively. + // Didn't do it for now because no encoding has this situation yet. + // Currently, just skip the sequence and write current char. + } + } + seqObj = undefined; + } + else if (uCode >= 0) { // Regular character + var subtable = this.encodeTable[uCode >> 8]; + if (subtable !== undefined) + dbcsCode = subtable[uCode & 0xFF]; + + if (dbcsCode <= SEQ_START) { // Sequence start + seqObj = this.encodeTableSeq[SEQ_START-dbcsCode]; + continue; + } + + if (dbcsCode == UNASSIGNED && this.gb18030) { + // Use GB18030 algorithm to find character(s) to write. + var idx = findIdx(this.gb18030.uChars, uCode); + if (idx != -1) { + var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]); + newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600; + newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260; + newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10; + newBuf[j++] = 0x30 + dbcsCode; + continue; + } + } + } + + // 3. Write dbcsCode character. + if (dbcsCode === UNASSIGNED) + dbcsCode = this.defaultCharSingleByte; + + if (dbcsCode < 0x100) { + newBuf[j++] = dbcsCode; + } + else if (dbcsCode < 0x10000) { + newBuf[j++] = dbcsCode >> 8; // high byte + newBuf[j++] = dbcsCode & 0xFF; // low byte + } + else { + newBuf[j++] = dbcsCode >> 16; + newBuf[j++] = (dbcsCode >> 8) & 0xFF; + newBuf[j++] = dbcsCode & 0xFF; + } + } + + this.seqObj = seqObj; + this.leadSurrogate = leadSurrogate; + return newBuf.slice(0, j); +} + +DBCSEncoder.prototype.end = function() { + if (this.leadSurrogate === -1 && this.seqObj === undefined) + return; // All clean. Most often case. + + var newBuf = Buffer.alloc(10), j = 0; + + if (this.seqObj) { // We're in the sequence. + var dbcsCode = this.seqObj[DEF_CHAR]; + if (dbcsCode !== undefined) { // Write beginning of the sequence. + if (dbcsCode < 0x100) { + newBuf[j++] = dbcsCode; + } + else { + newBuf[j++] = dbcsCode >> 8; // high byte + newBuf[j++] = dbcsCode & 0xFF; // low byte + } + } else { + // See todo above. + } + this.seqObj = undefined; + } + + if (this.leadSurrogate !== -1) { + // Incomplete surrogate pair - only lead surrogate found. + newBuf[j++] = this.defaultCharSingleByte; + this.leadSurrogate = -1; + } + + return newBuf.slice(0, j); +} + +// Export for testing +DBCSEncoder.prototype.findIdx = findIdx; + + +// == Decoder ================================================================== + +function DBCSDecoder(options, codec) { + // Decoder state + this.nodeIdx = 0; + this.prevBuf = Buffer.alloc(0); + + // Static data + this.decodeTables = codec.decodeTables; + this.decodeTableSeq = codec.decodeTableSeq; + this.defaultCharUnicode = codec.defaultCharUnicode; + this.gb18030 = codec.gb18030; +} + +DBCSDecoder.prototype.write = function(buf) { + var newBuf = Buffer.alloc(buf.length*2), + nodeIdx = this.nodeIdx, + prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length, + seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence. + uCode; + + if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later. + prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]); + + for (var i = 0, j = 0; i < buf.length; i++) { + var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset]; + + // Lookup in current trie node. + var uCode = this.decodeTables[nodeIdx][curByte]; + + if (uCode >= 0) { + // Normal character, just use it. + } + else if (uCode === UNASSIGNED) { // Unknown char. + // TODO: Callback with seq. + //var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); + i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle). + uCode = this.defaultCharUnicode.charCodeAt(0); + } + else if (uCode === GB18030_CODE) { + var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); + var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30); + var idx = findIdx(this.gb18030.gbChars, ptr); + uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx]; + } + else if (uCode <= NODE_START) { // Go to next trie node. + nodeIdx = NODE_START - uCode; + continue; + } + else if (uCode <= SEQ_START) { // Output a sequence of chars. + var seq = this.decodeTableSeq[SEQ_START - uCode]; + for (var k = 0; k < seq.length - 1; k++) { + uCode = seq[k]; + newBuf[j++] = uCode & 0xFF; + newBuf[j++] = uCode >> 8; + } + uCode = seq[seq.length-1]; + } + else + throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte); + + // Write the character to buffer, handling higher planes using surrogate pair. + if (uCode > 0xFFFF) { + uCode -= 0x10000; + var uCodeLead = 0xD800 + Math.floor(uCode / 0x400); + newBuf[j++] = uCodeLead & 0xFF; + newBuf[j++] = uCodeLead >> 8; + + uCode = 0xDC00 + uCode % 0x400; + } + newBuf[j++] = uCode & 0xFF; + newBuf[j++] = uCode >> 8; + + // Reset trie node. + nodeIdx = 0; seqStart = i+1; + } + + this.nodeIdx = nodeIdx; + this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset); + return newBuf.slice(0, j).toString('ucs2'); +} + +DBCSDecoder.prototype.end = function() { + var ret = ''; + + // Try to parse all remaining chars. + while (this.prevBuf.length > 0) { + // Skip 1 character in the buffer. + ret += this.defaultCharUnicode; + var buf = this.prevBuf.slice(1); + + // Parse remaining as usual. + this.prevBuf = Buffer.alloc(0); + this.nodeIdx = 0; + if (buf.length > 0) + ret += this.write(buf); + } + + this.nodeIdx = 0; + return ret; +} + +// Binary search for GB18030. Returns largest i such that table[i] <= val. +function findIdx(table, val) { + if (table[0] > val) + return -1; + + var l = 0, r = table.length; + while (l < r-1) { // always table[l] <= val < table[r] + var mid = l + Math.floor((r-l+1)/2); + if (table[mid] <= val) + l = mid; + else + r = mid; + } + return l; +} + diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-data.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-data.js new file mode 100644 index 0000000..4b61914 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-data.js @@ -0,0 +1,176 @@ +"use strict"; + +// Description of supported double byte encodings and aliases. +// Tables are not require()-d until they are needed to speed up library load. +// require()-s are direct to support Browserify. + +module.exports = { + + // == Japanese/ShiftJIS ==================================================== + // All japanese encodings are based on JIS X set of standards: + // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF. + // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes. + // Has several variations in 1978, 1983, 1990 and 1997. + // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead. + // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233. + // 2 planes, first is superset of 0208, second - revised 0212. + // Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx) + + // Byte encodings are: + // * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte + // encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC. + // Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI. + // * EUC-JP: Up to 3 bytes per character. Used mostly on *nixes. + // 0x00-0x7F - lower part of 0201 + // 0x8E, 0xA1-0xDF - upper part of 0201 + // (0xA1-0xFE)x2 - 0208 plane (94x94). + // 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94). + // * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon. + // Used as-is in ISO2022 family. + // * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII, + // 0201-1976 Roman, 0208-1978, 0208-1983. + // * ISO2022-JP-1: Adds esc seq for 0212-1990. + // * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7. + // * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2. + // * ISO2022-JP-2004: Adds 0213-2004 Plane 1. + // + // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes. + // + // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html + + 'shiftjis': { + type: '_dbcs', + table: function() { return require('./tables/shiftjis.json') }, + encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, + encodeSkipVals: [{from: 0xED40, to: 0xF940}], + }, + 'csshiftjis': 'shiftjis', + 'mskanji': 'shiftjis', + 'sjis': 'shiftjis', + 'windows31j': 'shiftjis', + 'ms31j': 'shiftjis', + 'xsjis': 'shiftjis', + 'windows932': 'shiftjis', + 'ms932': 'shiftjis', + '932': 'shiftjis', + 'cp932': 'shiftjis', + + 'eucjp': { + type: '_dbcs', + table: function() { return require('./tables/eucjp.json') }, + encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, + }, + + // TODO: KDDI extension to Shift_JIS + // TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes. + // TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars. + + + // == Chinese/GBK ========================================================== + // http://en.wikipedia.org/wiki/GBK + // We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder + + // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936 + 'gb2312': 'cp936', + 'gb231280': 'cp936', + 'gb23121980': 'cp936', + 'csgb2312': 'cp936', + 'csiso58gb231280': 'cp936', + 'euccn': 'cp936', + + // Microsoft's CP936 is a subset and approximation of GBK. + 'windows936': 'cp936', + 'ms936': 'cp936', + '936': 'cp936', + 'cp936': { + type: '_dbcs', + table: function() { return require('./tables/cp936.json') }, + }, + + // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other. + 'gbk': { + type: '_dbcs', + table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) }, + }, + 'xgbk': 'gbk', + 'isoir58': 'gbk', + + // GB18030 is an algorithmic extension of GBK. + // Main source: https://www.w3.org/TR/encoding/#gbk-encoder + // http://icu-project.org/docs/papers/gb18030.html + // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml + // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0 + 'gb18030': { + type: '_dbcs', + table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) }, + gb18030: function() { return require('./tables/gb18030-ranges.json') }, + encodeSkipVals: [0x80], + encodeAdd: {'€': 0xA2E3}, + }, + + 'chinese': 'gb18030', + + + // == Korean =============================================================== + // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same. + 'windows949': 'cp949', + 'ms949': 'cp949', + '949': 'cp949', + 'cp949': { + type: '_dbcs', + table: function() { return require('./tables/cp949.json') }, + }, + + 'cseuckr': 'cp949', + 'csksc56011987': 'cp949', + 'euckr': 'cp949', + 'isoir149': 'cp949', + 'korean': 'cp949', + 'ksc56011987': 'cp949', + 'ksc56011989': 'cp949', + 'ksc5601': 'cp949', + + + // == Big5/Taiwan/Hong Kong ================================================ + // There are lots of tables for Big5 and cp950. Please see the following links for history: + // http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html + // Variations, in roughly number of defined chars: + // * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT + // * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/ + // * Big5-2003 (Taiwan standard) almost superset of cp950. + // * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers. + // * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard. + // many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years. + // Plus, it has 4 combining sequences. + // Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299 + // because big5-hkscs is the only encoding to include astral characters in non-algorithmic way. + // Implementations are not consistent within browsers; sometimes labeled as just big5. + // MS Internet Explorer switches from big5 to big5-hkscs when a patch applied. + // Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31 + // In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s. + // Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt + // http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt + // + // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder + // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong. + + 'windows950': 'cp950', + 'ms950': 'cp950', + '950': 'cp950', + 'cp950': { + type: '_dbcs', + table: function() { return require('./tables/cp950.json') }, + }, + + // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus. + 'big5': 'big5hkscs', + 'big5hkscs': { + type: '_dbcs', + table: function() { return require('./tables/cp950.json').concat(require('./tables/big5-added.json')) }, + encodeSkipVals: [0xa2cc], + }, + + 'cnbig5': 'big5hkscs', + 'csbig5': 'big5hkscs', + 'xxbig5': 'big5hkscs', +}; diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/index.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/index.js new file mode 100644 index 0000000..e304003 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/index.js @@ -0,0 +1,22 @@ +"use strict"; + +// Update this array if you add/rename/remove files in this directory. +// We support Browserify by skipping automatic module discovery and requiring modules directly. +var modules = [ + require("./internal"), + require("./utf16"), + require("./utf7"), + require("./sbcs-codec"), + require("./sbcs-data"), + require("./sbcs-data-generated"), + require("./dbcs-codec"), + require("./dbcs-data"), +]; + +// Put all encoding/alias/codec definitions to single object and export it. +for (var i = 0; i < modules.length; i++) { + var module = modules[i]; + for (var enc in module) + if (Object.prototype.hasOwnProperty.call(module, enc)) + exports[enc] = module[enc]; +} diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/internal.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/internal.js new file mode 100644 index 0000000..05ce38b --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/internal.js @@ -0,0 +1,188 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Export Node.js internal encodings. + +module.exports = { + // Encodings + utf8: { type: "_internal", bomAware: true}, + cesu8: { type: "_internal", bomAware: true}, + unicode11utf8: "utf8", + + ucs2: { type: "_internal", bomAware: true}, + utf16le: "ucs2", + + binary: { type: "_internal" }, + base64: { type: "_internal" }, + hex: { type: "_internal" }, + + // Codec. + _internal: InternalCodec, +}; + +//------------------------------------------------------------------------------ + +function InternalCodec(codecOptions, iconv) { + this.enc = codecOptions.encodingName; + this.bomAware = codecOptions.bomAware; + + if (this.enc === "base64") + this.encoder = InternalEncoderBase64; + else if (this.enc === "cesu8") { + this.enc = "utf8"; // Use utf8 for decoding. + this.encoder = InternalEncoderCesu8; + + // Add decoder for versions of Node not supporting CESU-8 + if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '💩') { + this.decoder = InternalDecoderCesu8; + this.defaultCharUnicode = iconv.defaultCharUnicode; + } + } +} + +InternalCodec.prototype.encoder = InternalEncoder; +InternalCodec.prototype.decoder = InternalDecoder; + +//------------------------------------------------------------------------------ + +// We use node.js internal decoder. Its signature is the same as ours. +var StringDecoder = require('string_decoder').StringDecoder; + +if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method. + StringDecoder.prototype.end = function() {}; + + +function InternalDecoder(options, codec) { + StringDecoder.call(this, codec.enc); +} + +InternalDecoder.prototype = StringDecoder.prototype; + + +//------------------------------------------------------------------------------ +// Encoder is mostly trivial + +function InternalEncoder(options, codec) { + this.enc = codec.enc; +} + +InternalEncoder.prototype.write = function(str) { + return Buffer.from(str, this.enc); +} + +InternalEncoder.prototype.end = function() { +} + + +//------------------------------------------------------------------------------ +// Except base64 encoder, which must keep its state. + +function InternalEncoderBase64(options, codec) { + this.prevStr = ''; +} + +InternalEncoderBase64.prototype.write = function(str) { + str = this.prevStr + str; + var completeQuads = str.length - (str.length % 4); + this.prevStr = str.slice(completeQuads); + str = str.slice(0, completeQuads); + + return Buffer.from(str, "base64"); +} + +InternalEncoderBase64.prototype.end = function() { + return Buffer.from(this.prevStr, "base64"); +} + + +//------------------------------------------------------------------------------ +// CESU-8 encoder is also special. + +function InternalEncoderCesu8(options, codec) { +} + +InternalEncoderCesu8.prototype.write = function(str) { + var buf = Buffer.alloc(str.length * 3), bufIdx = 0; + for (var i = 0; i < str.length; i++) { + var charCode = str.charCodeAt(i); + // Naive implementation, but it works because CESU-8 is especially easy + // to convert from UTF-16 (which all JS strings are encoded in). + if (charCode < 0x80) + buf[bufIdx++] = charCode; + else if (charCode < 0x800) { + buf[bufIdx++] = 0xC0 + (charCode >>> 6); + buf[bufIdx++] = 0x80 + (charCode & 0x3f); + } + else { // charCode will always be < 0x10000 in javascript. + buf[bufIdx++] = 0xE0 + (charCode >>> 12); + buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f); + buf[bufIdx++] = 0x80 + (charCode & 0x3f); + } + } + return buf.slice(0, bufIdx); +} + +InternalEncoderCesu8.prototype.end = function() { +} + +//------------------------------------------------------------------------------ +// CESU-8 decoder is not implemented in Node v4.0+ + +function InternalDecoderCesu8(options, codec) { + this.acc = 0; + this.contBytes = 0; + this.accBytes = 0; + this.defaultCharUnicode = codec.defaultCharUnicode; +} + +InternalDecoderCesu8.prototype.write = function(buf) { + var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, + res = ''; + for (var i = 0; i < buf.length; i++) { + var curByte = buf[i]; + if ((curByte & 0xC0) !== 0x80) { // Leading byte + if (contBytes > 0) { // Previous code is invalid + res += this.defaultCharUnicode; + contBytes = 0; + } + + if (curByte < 0x80) { // Single-byte code + res += String.fromCharCode(curByte); + } else if (curByte < 0xE0) { // Two-byte code + acc = curByte & 0x1F; + contBytes = 1; accBytes = 1; + } else if (curByte < 0xF0) { // Three-byte code + acc = curByte & 0x0F; + contBytes = 2; accBytes = 1; + } else { // Four or more are not supported for CESU-8. + res += this.defaultCharUnicode; + } + } else { // Continuation byte + if (contBytes > 0) { // We're waiting for it. + acc = (acc << 6) | (curByte & 0x3f); + contBytes--; accBytes++; + if (contBytes === 0) { + // Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80) + if (accBytes === 2 && acc < 0x80 && acc > 0) + res += this.defaultCharUnicode; + else if (accBytes === 3 && acc < 0x800) + res += this.defaultCharUnicode; + else + // Actually add character. + res += String.fromCharCode(acc); + } + } else { // Unexpected continuation byte + res += this.defaultCharUnicode; + } + } + } + this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes; + return res; +} + +InternalDecoderCesu8.prototype.end = function() { + var res = 0; + if (this.contBytes > 0) + res += this.defaultCharUnicode; + return res; +} diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-codec.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-codec.js new file mode 100644 index 0000000..f225823 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-codec.js @@ -0,0 +1,72 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that +// correspond to encoded bytes (if 128 - then lower half is ASCII). + +exports._sbcs = SBCSCodec; +function SBCSCodec(codecOptions, iconv) { + if (!codecOptions) + throw new Error("SBCS codec is called without the data.") + + // Prepare char buffer for decoding. + if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256)) + throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)"); + + if (codecOptions.chars.length === 128) { + var asciiString = ""; + for (var i = 0; i < 128; i++) + asciiString += String.fromCharCode(i); + codecOptions.chars = asciiString + codecOptions.chars; + } + + this.decodeBuf = new Buffer.from(codecOptions.chars, 'ucs2'); + + // Encoding buffer. + var encodeBuf = new Buffer.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0)); + + for (var i = 0; i < codecOptions.chars.length; i++) + encodeBuf[codecOptions.chars.charCodeAt(i)] = i; + + this.encodeBuf = encodeBuf; +} + +SBCSCodec.prototype.encoder = SBCSEncoder; +SBCSCodec.prototype.decoder = SBCSDecoder; + + +function SBCSEncoder(options, codec) { + this.encodeBuf = codec.encodeBuf; +} + +SBCSEncoder.prototype.write = function(str) { + var buf = Buffer.alloc(str.length); + for (var i = 0; i < str.length; i++) + buf[i] = this.encodeBuf[str.charCodeAt(i)]; + + return buf; +} + +SBCSEncoder.prototype.end = function() { +} + + +function SBCSDecoder(options, codec) { + this.decodeBuf = codec.decodeBuf; +} + +SBCSDecoder.prototype.write = function(buf) { + // Strings are immutable in JS -> we use ucs2 buffer to speed up computations. + var decodeBuf = this.decodeBuf; + var newBuf = Buffer.alloc(buf.length*2); + var idx1 = 0, idx2 = 0; + for (var i = 0; i < buf.length; i++) { + idx1 = buf[i]*2; idx2 = i*2; + newBuf[idx2] = decodeBuf[idx1]; + newBuf[idx2+1] = decodeBuf[idx1+1]; + } + return newBuf.toString('ucs2'); +} + +SBCSDecoder.prototype.end = function() { +} diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data-generated.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data-generated.js new file mode 100644 index 0000000..9b48236 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data-generated.js @@ -0,0 +1,451 @@ +"use strict"; + +// Generated data for sbcs codec. Don't edit manually. Regenerate using generation/gen-sbcs.js script. +module.exports = { + "437": "cp437", + "737": "cp737", + "775": "cp775", + "850": "cp850", + "852": "cp852", + "855": "cp855", + "856": "cp856", + "857": "cp857", + "858": "cp858", + "860": "cp860", + "861": "cp861", + "862": "cp862", + "863": "cp863", + "864": "cp864", + "865": "cp865", + "866": "cp866", + "869": "cp869", + "874": "windows874", + "922": "cp922", + "1046": "cp1046", + "1124": "cp1124", + "1125": "cp1125", + "1129": "cp1129", + "1133": "cp1133", + "1161": "cp1161", + "1162": "cp1162", + "1163": "cp1163", + "1250": "windows1250", + "1251": "windows1251", + "1252": "windows1252", + "1253": "windows1253", + "1254": "windows1254", + "1255": "windows1255", + "1256": "windows1256", + "1257": "windows1257", + "1258": "windows1258", + "28591": "iso88591", + "28592": "iso88592", + "28593": "iso88593", + "28594": "iso88594", + "28595": "iso88595", + "28596": "iso88596", + "28597": "iso88597", + "28598": "iso88598", + "28599": "iso88599", + "28600": "iso885910", + "28601": "iso885911", + "28603": "iso885913", + "28604": "iso885914", + "28605": "iso885915", + "28606": "iso885916", + "windows874": { + "type": "_sbcs", + "chars": "€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "win874": "windows874", + "cp874": "windows874", + "windows1250": { + "type": "_sbcs", + "chars": "€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬­®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" + }, + "win1250": "windows1250", + "cp1250": "windows1250", + "windows1251": { + "type": "_sbcs", + "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬­®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "win1251": "windows1251", + "cp1251": "windows1251", + "windows1252": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "win1252": "windows1252", + "cp1252": "windows1252", + "windows1253": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬­®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" + }, + "win1253": "windows1253", + "cp1253": "windows1253", + "windows1254": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" + }, + "win1254": "windows1254", + "cp1254": "windows1254", + "windows1255": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹֺֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" + }, + "win1255": "windows1255", + "cp1255": "windows1255", + "windows1256": { + "type": "_sbcs", + "chars": "€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œ‌‍ں ،¢£¤¥¦§¨©ھ«¬­®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûü‎‏ے" + }, + "win1256": "windows1256", + "cp1256": "windows1256", + "windows1257": { + "type": "_sbcs", + "chars": "€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬­®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙" + }, + "win1257": "windows1257", + "cp1257": "windows1257", + "windows1258": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "win1258": "windows1258", + "cp1258": "windows1258", + "iso88591": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28591": "iso88591", + "iso88592": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" + }, + "cp28592": "iso88592", + "iso88593": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ħ˘£¤�Ĥ§¨İŞĞĴ­�Ż°ħ²³´µĥ·¸ışğĵ½�żÀÁÂ�ÄĊĈÇÈÉÊËÌÍÎÏ�ÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâ�äċĉçèéêëìíîï�ñòóôġö÷ĝùúûüŭŝ˙" + }, + "cp28593": "iso88593", + "iso88594": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĸŖ¤ĨĻ§¨ŠĒĢŦ­Ž¯°ą˛ŗ´ĩļˇ¸šēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖ×ØŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙" + }, + "cp28594": "iso88594", + "iso88595": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂЃЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ" + }, + "cp28595": "iso88595", + "iso88596": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ���¤�������،­�������������؛���؟�ءآأؤإئابةتثجحخدذرزسشصضطظعغ�����ـفقكلمنهوىيًٌٍَُِّْ�������������" + }, + "cp28596": "iso88596", + "iso88597": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ‘’£€₯¦§¨©ͺ«¬­�―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" + }, + "cp28597": "iso88597", + "iso88598": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �¢£¤¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾��������������������������������‗אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" + }, + "cp28598": "iso88598", + "iso88599": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" + }, + "cp28599": "iso88599", + "iso885910": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĒĢĪĨĶ§ĻĐŠŦŽ­ŪŊ°ąēģīĩķ·ļđšŧž―ūŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎÏÐŅŌÓÔÕÖŨØŲÚÛÜÝÞßāáâãäåæįčéęëėíîïðņōóôõöũøųúûüýþĸ" + }, + "cp28600": "iso885910", + "iso885911": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "cp28601": "iso885911", + "iso885913": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ”¢£¤„¦§Ø©Ŗ«¬­®Æ°±²³“µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž’" + }, + "cp28603": "iso885913", + "iso885914": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ­®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ" + }, + "cp28604": "iso885914", + "iso885915": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28605": "iso885915", + "iso885916": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄąŁ€„Š§š©Ș«Ź­źŻ°±ČłŽ”¶·žčș»ŒœŸżÀÁÂĂÄĆÆÇÈÉÊËÌÍÎÏĐŃÒÓÔŐÖŚŰÙÚÛÜĘȚßàáâăäćæçèéêëìíîïđńòóôőöśűùúûüęțÿ" + }, + "cp28606": "iso885916", + "cp437": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm437": "cp437", + "csibm437": "cp437", + "cp737": { + "type": "_sbcs", + "chars": "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ " + }, + "ibm737": "cp737", + "csibm737": "cp737", + "cp775": { + "type": "_sbcs", + "chars": "ĆüéāäģåćłēŖŗīŹÄÅÉæÆōöĢ¢ŚśÖÜø£ØפĀĪóŻżź”¦©®¬½¼Ł«»░▒▓│┤ĄČĘĖ╣║╗╝ĮŠ┐└┴┬├─┼ŲŪ╚╔╩╦╠═╬Žąčęėįšųūž┘┌█▄▌▐▀ÓßŌŃõÕµńĶķĻļņĒŅ’­±“¾¶§÷„°∙·¹³²■ " + }, + "ibm775": "cp775", + "csibm775": "cp775", + "cp850": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm850": "cp850", + "csibm850": "cp850", + "cp852": { + "type": "_sbcs", + "chars": "ÇüéâäůćçłëŐőîŹÄĆÉĹĺôöĽľŚśÖÜŤťŁ×čáíóúĄąŽžĘ꬟Ⱥ«»░▒▓│┤ÁÂĚŞ╣║╗╝Żż┐└┴┬├─┼Ăă╚╔╩╦╠═╬¤đĐĎËďŇÍÎě┘┌█▄ŢŮ▀ÓßÔŃńňŠšŔÚŕŰýÝţ´­˝˛ˇ˘§÷¸°¨˙űŘř■ " + }, + "ibm852": "cp852", + "csibm852": "cp852", + "cp855": { + "type": "_sbcs", + "chars": "ђЂѓЃёЁєЄѕЅіІїЇјЈљЉњЊћЋќЌўЎџЏюЮъЪаАбБцЦдДеЕфФгГ«»░▒▓│┤хХиИ╣║╗╝йЙ┐└┴┬├─┼кК╚╔╩╦╠═╬¤лЛмМнНоОп┘┌█▄Пя▀ЯрРсСтТуУжЖвВьЬ№­ыЫзЗшШэЭщЩчЧ§■ " + }, + "ibm855": "cp855", + "csibm855": "cp855", + "cp856": { + "type": "_sbcs", + "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת�£�×����������®¬½¼�«»░▒▓│┤���©╣║╗╝¢¥┐└┴┬├─┼��╚╔╩╦╠═╬¤���������┘┌█▄¦�▀������µ�������¯´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm856": "cp856", + "csibm856": "cp856", + "cp857": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîıÄÅÉæÆôöòûùİÖÜø£ØŞşáíóúñÑĞ𿮬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ºªÊËÈ�ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµ�×ÚÛÙìÿ¯´­±�¾¶§÷¸°¨·¹³²■ " + }, + "ibm857": "cp857", + "csibm857": "cp857", + "cp858": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈ€ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm858": "cp858", + "csibm858": "cp858", + "cp860": { + "type": "_sbcs", + "chars": "ÇüéâãàÁçêÊèÍÔìÃÂÉÀÈôõòÚùÌÕÜ¢£Ù₧ÓáíóúñѪº¿Ò¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm860": "cp860", + "csibm860": "cp860", + "cp861": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèÐðÞÄÅÉæÆôöþûÝýÖÜø£Ø₧ƒáíóúÁÍÓÚ¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm861": "cp861", + "csibm861": "cp861", + "cp862": { + "type": "_sbcs", + "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm862": "cp862", + "csibm862": "cp862", + "cp863": { + "type": "_sbcs", + "chars": "ÇüéâÂà¶çêëèïî‗À§ÉÈÊôËÏûù¤ÔÜ¢£ÙÛƒ¦´óú¨¸³¯Î⌐¬½¼¾«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm863": "cp863", + "csibm863": "cp863", + "cp864": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�" + }, + "ibm864": "cp864", + "csibm864": "cp864", + "cp865": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm865": "cp865", + "csibm865": "cp865", + "cp866": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ " + }, + "ibm866": "cp866", + "csibm866": "cp866", + "cp869": { + "type": "_sbcs", + "chars": "������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ■ " + }, + "ibm869": "cp869", + "csibm869": "cp869", + "cp922": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®‾°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖ×ØÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ" + }, + "ibm922": "cp922", + "csibm922": "cp922", + "cp1046": { + "type": "_sbcs", + "chars": "ﺈ×÷ﹱˆ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�" + }, + "ibm1046": "cp1046", + "csibm1046": "cp1046", + "cp1124": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ" + }, + "ibm1124": "cp1124", + "csibm1124": "cp1124", + "cp1125": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ " + }, + "ibm1125": "cp1125", + "csibm1125": "cp1125", + "cp1129": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "ibm1129": "cp1129", + "csibm1129": "cp1129", + "cp1133": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�" + }, + "ibm1133": "cp1133", + "csibm1133": "cp1133", + "cp1161": { + "type": "_sbcs", + "chars": "��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ " + }, + "ibm1161": "cp1161", + "csibm1161": "cp1161", + "cp1162": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "ibm1162": "cp1162", + "csibm1162": "cp1162", + "cp1163": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "ibm1163": "cp1163", + "csibm1163": "cp1163", + "maccroatian": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈Ć«Č… ÀÃÕŒœĐ—“”‘’÷◊�©⁄¤‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ" + }, + "maccyrillic": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°¢£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµ∂ЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" + }, + "macgreek": { + "type": "_sbcs", + "chars": "Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦­ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ�" + }, + "maciceland": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macroman": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macromania": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂŞ∞±≤≥¥µ∂∑∏π∫ªºΩăş¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›Ţţ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macthai": { + "type": "_sbcs", + "chars": "«»…“”�•‘’� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู​–—฿เแโใไๅๆ็่้๊๋์ํ™๏๐๑๒๓๔๕๖๗๘๙®©����" + }, + "macturkish": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙ�ˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macukraine": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" + }, + "koi8r": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8u": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґ╝╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪Ґ╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8ru": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґў╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪ҐЎ©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8t": { + "type": "_sbcs", + "chars": "қғ‚Ғ„…†‡�‰ҳ‹ҲҷҶ�Қ‘’“”•–—�™�›�����ӯӮё¤ӣ¦§���«¬­®�°±²Ё�Ӣ¶·�№�»���©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "armscii8": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �և։)(»«—.՝,-֊…՜՛՞ԱաԲբԳգԴդԵեԶզԷէԸըԹթԺժԻիԼլԽխԾծԿկՀհՁձՂղՃճՄմՅյՆնՇշՈոՉչՊպՋջՌռՍսՎվՏտՐրՑցՒւՓփՔքՕօՖֆ՚�" + }, + "rk1048": { + "type": "_sbcs", + "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊҚҺЏђ‘’“”•–—�™љ›њқһџ ҰұӘ¤Ө¦§Ё©Ғ«¬­®Ү°±Ііөµ¶·ё№ғ»әҢңүАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "tcvn": { + "type": "_sbcs", + "chars": "\u0000ÚỤ\u0003ỪỬỮ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010ỨỰỲỶỸÝỴ\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ" + }, + "georgianacademy": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "georgianps": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "pt154": { + "type": "_sbcs", + "chars": "ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө¶·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "viscii": { + "type": "_sbcs", + "chars": "\u0000\u0001Ẳ\u0003\u0004ẴẪ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013Ỷ\u0015\u0016\u0017\u0018Ỹ\u001a\u001b\u001c\u001dỴ\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ" + }, + "iso646cn": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" + }, + "iso646jp": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" + }, + "hproman8": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�" + }, + "macintosh": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "ascii": { + "type": "_sbcs", + "chars": "��������������������������������������������������������������������������������������������������������������������������������" + }, + "tis620": { + "type": "_sbcs", + "chars": "���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + } +} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data.js new file mode 100644 index 0000000..2d6f846 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data.js @@ -0,0 +1,169 @@ +"use strict"; + +// Manually added data to be used by sbcs codec in addition to generated one. + +module.exports = { + // Not supported by iconv, not sure why. + "10029": "maccenteuro", + "maccenteuro": { + "type": "_sbcs", + "chars": "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ" + }, + + "808": "cp808", + "ibm808": "cp808", + "cp808": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ " + }, + + // Aliases of generated encodings. + "ascii8bit": "ascii", + "usascii": "ascii", + "ansix34": "ascii", + "ansix341968": "ascii", + "ansix341986": "ascii", + "csascii": "ascii", + "cp367": "ascii", + "ibm367": "ascii", + "isoir6": "ascii", + "iso646us": "ascii", + "iso646irv": "ascii", + "us": "ascii", + + "latin1": "iso88591", + "latin2": "iso88592", + "latin3": "iso88593", + "latin4": "iso88594", + "latin5": "iso88599", + "latin6": "iso885910", + "latin7": "iso885913", + "latin8": "iso885914", + "latin9": "iso885915", + "latin10": "iso885916", + + "csisolatin1": "iso88591", + "csisolatin2": "iso88592", + "csisolatin3": "iso88593", + "csisolatin4": "iso88594", + "csisolatincyrillic": "iso88595", + "csisolatinarabic": "iso88596", + "csisolatingreek" : "iso88597", + "csisolatinhebrew": "iso88598", + "csisolatin5": "iso88599", + "csisolatin6": "iso885910", + + "l1": "iso88591", + "l2": "iso88592", + "l3": "iso88593", + "l4": "iso88594", + "l5": "iso88599", + "l6": "iso885910", + "l7": "iso885913", + "l8": "iso885914", + "l9": "iso885915", + "l10": "iso885916", + + "isoir14": "iso646jp", + "isoir57": "iso646cn", + "isoir100": "iso88591", + "isoir101": "iso88592", + "isoir109": "iso88593", + "isoir110": "iso88594", + "isoir144": "iso88595", + "isoir127": "iso88596", + "isoir126": "iso88597", + "isoir138": "iso88598", + "isoir148": "iso88599", + "isoir157": "iso885910", + "isoir166": "tis620", + "isoir179": "iso885913", + "isoir199": "iso885914", + "isoir203": "iso885915", + "isoir226": "iso885916", + + "cp819": "iso88591", + "ibm819": "iso88591", + + "cyrillic": "iso88595", + + "arabic": "iso88596", + "arabic8": "iso88596", + "ecma114": "iso88596", + "asmo708": "iso88596", + + "greek" : "iso88597", + "greek8" : "iso88597", + "ecma118" : "iso88597", + "elot928" : "iso88597", + + "hebrew": "iso88598", + "hebrew8": "iso88598", + + "turkish": "iso88599", + "turkish8": "iso88599", + + "thai": "iso885911", + "thai8": "iso885911", + + "celtic": "iso885914", + "celtic8": "iso885914", + "isoceltic": "iso885914", + + "tis6200": "tis620", + "tis62025291": "tis620", + "tis62025330": "tis620", + + "10000": "macroman", + "10006": "macgreek", + "10007": "maccyrillic", + "10079": "maciceland", + "10081": "macturkish", + + "cspc8codepage437": "cp437", + "cspc775baltic": "cp775", + "cspc850multilingual": "cp850", + "cspcp852": "cp852", + "cspc862latinhebrew": "cp862", + "cpgr": "cp869", + + "msee": "cp1250", + "mscyrl": "cp1251", + "msansi": "cp1252", + "msgreek": "cp1253", + "msturk": "cp1254", + "mshebr": "cp1255", + "msarab": "cp1256", + "winbaltrim": "cp1257", + + "cp20866": "koi8r", + "20866": "koi8r", + "ibm878": "koi8r", + "cskoi8r": "koi8r", + + "cp21866": "koi8u", + "21866": "koi8u", + "ibm1168": "koi8u", + + "strk10482002": "rk1048", + + "tcvn5712": "tcvn", + "tcvn57121": "tcvn", + + "gb198880": "iso646cn", + "cn": "iso646cn", + + "csiso14jisc6220ro": "iso646jp", + "jisc62201969ro": "iso646jp", + "jp": "iso646jp", + + "cshproman8": "hproman8", + "r8": "hproman8", + "roman8": "hproman8", + "xroman8": "hproman8", + "ibm1051": "hproman8", + + "mac": "macintosh", + "csmacintosh": "macintosh", +}; + diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/big5-added.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/big5-added.json new file mode 100644 index 0000000..3c3d3c2 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/big5-added.json @@ -0,0 +1,122 @@ +[ +["8740","䏰䰲䘃䖦䕸𧉧䵷䖳𧲱䳢𧳅㮕䜶䝄䱇䱀𤊿𣘗𧍒𦺋𧃒䱗𪍑䝏䗚䲅𧱬䴇䪤䚡𦬣爥𥩔𡩣𣸆𣽡晍囻"], +["8767","綕夝𨮹㷴霴𧯯寛𡵞媤㘥𩺰嫑宷峼杮薓𩥅瑡璝㡵𡵓𣚞𦀡㻬"], +["87a1","𥣞㫵竼龗𤅡𨤍𣇪𠪊𣉞䌊蒄龖鐯䤰蘓墖靊鈘秐稲晠権袝瑌篅枂稬剏遆㓦珄𥶹瓆鿇垳䤯呌䄱𣚎堘穲𧭥讏䚮𦺈䆁𥶙箮𢒼鿈𢓁𢓉𢓌鿉蔄𣖻䂴鿊䓡𪷿拁灮鿋"], +["8840","㇀",4,"𠄌㇅𠃑𠃍㇆㇇𠃋𡿨㇈𠃊㇉㇊㇋㇌𠄎㇍㇎ĀÁǍÀĒÉĚÈŌÓǑÒ࿿Ê̄Ế࿿Ê̌ỀÊāáǎàɑēéěèīíǐìōóǒòūúǔùǖǘǚ"], +["88a1","ǜü࿿ê̄ế࿿ê̌ềêɡ⏚⏛"], +["8940","𪎩𡅅"], +["8943","攊"], +["8946","丽滝鵎釟"], +["894c","𧜵撑会伨侨兖兴农凤务动医华发变团声处备夲头学实実岚庆总斉柾栄桥济炼电纤纬纺织经统缆缷艺苏药视设询车轧轮"], +["89a1","琑糼緍楆竉刧"], +["89ab","醌碸酞肼"], +["89b0","贋胶𠧧"], +["89b5","肟黇䳍鷉鸌䰾𩷶𧀎鸊𪄳㗁"], +["89c1","溚舾甙"], +["89c5","䤑马骏龙禇𨑬𡷊𠗐𢫦两亁亀亇亿仫伷㑌侽㹈倃傈㑽㒓㒥円夅凛凼刅争剹劐匧㗇厩㕑厰㕓参吣㕭㕲㚁咓咣咴咹哐哯唘唣唨㖘唿㖥㖿嗗㗅"], +["8a40","𧶄唥"], +["8a43","𠱂𠴕𥄫喐𢳆㧬𠍁蹆𤶸𩓥䁓𨂾睺𢰸㨴䟕𨅝𦧲𤷪擝𠵼𠾴𠳕𡃴撍蹾𠺖𠰋𠽤𢲩𨉖𤓓"], +["8a64","𠵆𩩍𨃩䟴𤺧𢳂骲㩧𩗴㿭㔆𥋇𩟔𧣈𢵄鵮頕"], +["8a76","䏙𦂥撴哣𢵌𢯊𡁷㧻𡁯"], +["8aa1","𦛚𦜖𧦠擪𥁒𠱃蹨𢆡𨭌𠜱"], +["8aac","䠋𠆩㿺塳𢶍"], +["8ab2","𤗈𠓼𦂗𠽌𠶖啹䂻䎺"], +["8abb","䪴𢩦𡂝膪飵𠶜捹㧾𢝵跀嚡摼㹃"], +["8ac9","𪘁𠸉𢫏𢳉"], +["8ace","𡃈𣧂㦒㨆𨊛㕸𥹉𢃇噒𠼱𢲲𩜠㒼氽𤸻"], +["8adf","𧕴𢺋𢈈𪙛𨳍𠹺𠰴𦠜羓𡃏𢠃𢤹㗻𥇣𠺌𠾍𠺪㾓𠼰𠵇𡅏𠹌"], +["8af6","𠺫𠮩𠵈𡃀𡄽㿹𢚖搲𠾭"], +["8b40","𣏴𧘹𢯎𠵾𠵿𢱑𢱕㨘𠺘𡃇𠼮𪘲𦭐𨳒𨶙𨳊閪哌苄喹"], +["8b55","𩻃鰦骶𧝞𢷮煀腭胬尜𦕲脴㞗卟𨂽醶𠻺𠸏𠹷𠻻㗝𤷫㘉𠳖嚯𢞵𡃉𠸐𠹸𡁸𡅈𨈇𡑕𠹹𤹐𢶤婔𡀝𡀞𡃵𡃶垜𠸑"], +["8ba1","𧚔𨋍𠾵𠹻𥅾㜃𠾶𡆀𥋘𪊽𤧚𡠺𤅷𨉼墙剨㘚𥜽箲孨䠀䬬鼧䧧鰟鮍𥭴𣄽嗻㗲嚉丨夂𡯁屮靑𠂆乛亻㔾尣彑忄㣺扌攵歺氵氺灬爫丬犭𤣩罒礻糹罓𦉪㓁"], +["8bde","𦍋耂肀𦘒𦥑卝衤见𧢲讠贝钅镸长门𨸏韦页风飞饣𩠐鱼鸟黄歯龜丷𠂇阝户钢"], +["8c40","倻淾𩱳龦㷉袏𤅎灷峵䬠𥇍㕙𥴰愢𨨲辧釶熑朙玺𣊁𪄇㲋𡦀䬐磤琂冮𨜏䀉橣𪊺䈣蘏𠩯稪𩥇𨫪靕灍匤𢁾鏴盙𨧣龧矝亣俰傼丯众龨吴綋墒壐𡶶庒庙忂𢜒斋"], +["8ca1","𣏹椙橃𣱣泿"], +["8ca7","爀𤔅玌㻛𤨓嬕璹讃𥲤𥚕窓篬糃繬苸薗龩袐龪躹龫迏蕟駠鈡龬𨶹𡐿䁱䊢娚"], +["8cc9","顨杫䉶圽"], +["8cce","藖𤥻芿𧄍䲁𦵴嵻𦬕𦾾龭龮宖龯曧繛湗秊㶈䓃𣉖𢞖䎚䔶"], +["8ce6","峕𣬚諹屸㴒𣕑嵸龲煗䕘𤃬𡸣䱷㥸㑊𠆤𦱁諌侴𠈹妿腬顖𩣺弻"], +["8d40","𠮟"], +["8d42","𢇁𨥭䄂䚻𩁹㼇龳𪆵䃸㟖䛷𦱆䅼𨚲𧏿䕭㣔𥒚䕡䔛䶉䱻䵶䗪㿈𤬏㙡䓞䒽䇭崾嵈嵖㷼㠏嶤嶹㠠㠸幂庽弥徃㤈㤔㤿㥍惗愽峥㦉憷憹懏㦸戬抐拥挘㧸嚱"], +["8da1","㨃揢揻搇摚㩋擀崕嘡龟㪗斆㪽旿晓㫲暒㬢朖㭂枤栀㭘桊梄㭲㭱㭻椉楃牜楤榟榅㮼槖㯝橥橴橱檂㯬檙㯲檫檵櫔櫶殁毁毪汵沪㳋洂洆洦涁㳯涤涱渕渘温溆𨧀溻滢滚齿滨滩漤漴㵆𣽁澁澾㵪㵵熷岙㶊瀬㶑灐灔灯灿炉𠌥䏁㗱𠻘"], +["8e40","𣻗垾𦻓焾𥟠㙎榢𨯩孴穉𥣡𩓙穥穽𥦬窻窰竂竃燑𦒍䇊竚竝竪䇯咲𥰁笋筕笩𥌎𥳾箢筯莜𥮴𦱿篐萡箒箸𥴠㶭𥱥蒒篺簆簵𥳁籄粃𤢂粦晽𤕸糉糇糦籴糳糵糎"], +["8ea1","繧䔝𦹄絝𦻖璍綉綫焵綳緒𤁗𦀩緤㴓緵𡟹緥𨍭縝𦄡𦅚繮纒䌫鑬縧罀罁罇礶𦋐駡羗𦍑羣𡙡𠁨䕜𣝦䔃𨌺翺𦒉者耈耝耨耯𪂇𦳃耻耼聡𢜔䦉𦘦𣷣𦛨朥肧𨩈脇脚墰𢛶汿𦒘𤾸擧𡒊舘𡡞橓𤩥𤪕䑺舩𠬍𦩒𣵾俹𡓽蓢荢𦬊𤦧𣔰𡝳𣷸芪椛芳䇛"], +["8f40","蕋苐茚𠸖𡞴㛁𣅽𣕚艻苢茘𣺋𦶣𦬅𦮗𣗎㶿茝嗬莅䔋𦶥莬菁菓㑾𦻔橗蕚㒖𦹂𢻯葘𥯤葱㷓䓤檧葊𣲵祘蒨𦮖𦹷𦹃蓞萏莑䒠蒓蓤𥲑䉀𥳀䕃蔴嫲𦺙䔧蕳䔖枿蘖"], +["8fa1","𨘥𨘻藁𧂈蘂𡖂𧃍䕫䕪蘨㙈𡢢号𧎚虾蝱𪃸蟮𢰧螱蟚蠏噡虬桖䘏衅衆𧗠𣶹𧗤衞袜䙛袴袵揁装睷𧜏覇覊覦覩覧覼𨨥觧𧤤𧪽誜瞓釾誐𧩙竩𧬺𣾏䜓𧬸煼謌謟𥐰𥕥謿譌譍誩𤩺讐讛誯𡛟䘕衏貛𧵔𧶏貫㜥𧵓賖𧶘𧶽贒贃𡤐賛灜贑𤳉㻐起"], +["9040","趩𨀂𡀔𤦊㭼𨆼𧄌竧躭躶軃鋔輙輭𨍥𨐒辥錃𪊟𠩐辳䤪𨧞𨔽𣶻廸𣉢迹𪀔𨚼𨔁𢌥㦀𦻗逷𨔼𧪾遡𨕬𨘋邨𨜓郄𨛦邮都酧㫰醩釄粬𨤳𡺉鈎沟鉁鉢𥖹銹𨫆𣲛𨬌𥗛"], +["90a1","𠴱錬鍫𨫡𨯫炏嫃𨫢𨫥䥥鉄𨯬𨰹𨯿鍳鑛躼閅閦鐦閠濶䊹𢙺𨛘𡉼𣸮䧟氜陻隖䅬隣𦻕懚隶磵𨫠隽双䦡𦲸𠉴𦐐𩂯𩃥𤫑𡤕𣌊霱虂霶䨏䔽䖅𤫩灵孁霛靜𩇕靗孊𩇫靟鐥僐𣂷𣂼鞉鞟鞱鞾韀韒韠𥑬韮琜𩐳響韵𩐝𧥺䫑頴頳顋顦㬎𧅵㵑𠘰𤅜"], +["9140","𥜆飊颷飈飇䫿𦴧𡛓喰飡飦飬鍸餹𤨩䭲𩡗𩤅駵騌騻騐驘𥜥㛄𩂱𩯕髠髢𩬅髴䰎鬔鬭𨘀倴鬴𦦨㣃𣁽魐魀𩴾婅𡡣鮎𤉋鰂鯿鰌𩹨鷔𩾷𪆒𪆫𪃡𪄣𪇟鵾鶃𪄴鸎梈"], +["91a1","鷄𢅛𪆓𪈠𡤻𪈳鴹𪂹𪊴麐麕麞麢䴴麪麯𤍤黁㭠㧥㴝伲㞾𨰫鼂鼈䮖鐤𦶢鼗鼖鼹嚟嚊齅馸𩂋韲葿齢齩竜龎爖䮾𤥵𤦻煷𤧸𤍈𤩑玞𨯚𡣺禟𨥾𨸶鍩鏳𨩄鋬鎁鏋𨥬𤒹爗㻫睲穃烐𤑳𤏸煾𡟯炣𡢾𣖙㻇𡢅𥐯𡟸㜢𡛻𡠹㛡𡝴𡣑𥽋㜣𡛀坛𤨥𡏾𡊨"], +["9240","𡏆𡒶蔃𣚦蔃葕𤦔𧅥𣸱𥕜𣻻𧁒䓴𣛮𩦝𦼦柹㜳㰕㷧塬𡤢栐䁗𣜿𤃡𤂋𤄏𦰡哋嚞𦚱嚒𠿟𠮨𠸍鏆𨬓鎜仸儫㠙𤐶亼𠑥𠍿佋侊𥙑婨𠆫𠏋㦙𠌊𠐔㐵伩𠋀𨺳𠉵諚𠈌亘"], +["92a1","働儍侢伃𤨎𣺊佂倮偬傁俌俥偘僼兙兛兝兞湶𣖕𣸹𣺿浲𡢄𣺉冨凃𠗠䓝𠒣𠒒𠒑赺𨪜𠜎剙劤𠡳勡鍮䙺熌𤎌𠰠𤦬𡃤槑𠸝瑹㻞璙琔瑖玘䮎𤪼𤂍叐㖄爏𤃉喴𠍅响𠯆圝鉝雴鍦埝垍坿㘾壋媙𨩆𡛺𡝯𡜐娬妸銏婾嫏娒𥥆𡧳𡡡𤊕㛵洅瑃娡𥺃"], +["9340","媁𨯗𠐓鏠璌𡌃焅䥲鐈𨧻鎽㞠尞岞幞幈𡦖𡥼𣫮廍孏𡤃𡤄㜁𡢠㛝𡛾㛓脪𨩇𡶺𣑲𨦨弌弎𡤧𡞫婫𡜻孄蘔𧗽衠恾𢡠𢘫忛㺸𢖯𢖾𩂈𦽳懀𠀾𠁆𢘛憙憘恵𢲛𢴇𤛔𩅍"], +["93a1","摱𤙥𢭪㨩𢬢𣑐𩣪𢹸挷𪑛撶挱揑𤧣𢵧护𢲡搻敫楲㯴𣂎𣊭𤦉𣊫唍𣋠𡣙𩐿曎𣊉𣆳㫠䆐𥖄𨬢𥖏𡛼𥕛𥐥磮𣄃𡠪𣈴㑤𣈏𣆂𤋉暎𦴤晫䮓昰𧡰𡷫晣𣋒𣋡昞𥡲㣑𣠺𣞼㮙𣞢𣏾瓐㮖枏𤘪梶栞㯄檾㡣𣟕𤒇樳橒櫉欅𡤒攑梘橌㯗橺歗𣿀𣲚鎠鋲𨯪𨫋"], +["9440","銉𨀞𨧜鑧涥漋𤧬浧𣽿㶏渄𤀼娽渊塇洤硂焻𤌚𤉶烱牐犇犔𤞏𤜥兹𤪤𠗫瑺𣻸𣙟𤩊𤤗𥿡㼆㺱𤫟𨰣𣼵悧㻳瓌琼鎇琷䒟𦷪䕑疃㽣𤳙𤴆㽘畕癳𪗆㬙瑨𨫌𤦫𤦎㫻"], +["94a1","㷍𤩎㻿𤧅𤣳釺圲鍂𨫣𡡤僟𥈡𥇧睸𣈲眎眏睻𤚗𣞁㩞𤣰琸璛㺿𤪺𤫇䃈𤪖𦆮錇𥖁砞碍碈磒珐祙𧝁𥛣䄎禛蒖禥樭𣻺稺秴䅮𡛦䄲鈵秱𠵌𤦌𠊙𣶺𡝮㖗啫㕰㚪𠇔𠰍竢婙𢛵𥪯𥪜娍𠉛磰娪𥯆竾䇹籝籭䈑𥮳𥺼𥺦糍𤧹𡞰粎籼粮檲緜縇緓罎𦉡"], +["9540","𦅜𧭈綗𥺂䉪𦭵𠤖柖𠁎𣗏埄𦐒𦏸𤥢翝笧𠠬𥫩𥵃笌𥸎駦虅驣樜𣐿㧢𤧷𦖭騟𦖠蒀𧄧𦳑䓪脷䐂胆脉腂𦞴飃𦩂艢艥𦩑葓𦶧蘐𧈛媆䅿𡡀嬫𡢡嫤𡣘蚠蜨𣶏蠭𧐢娂"], +["95a1","衮佅袇袿裦襥襍𥚃襔𧞅𧞄𨯵𨯙𨮜𨧹㺭蒣䛵䛏㟲訽訜𩑈彍鈫𤊄旔焩烄𡡅鵭貟賩𧷜妚矃姰䍮㛔踪躧𤰉輰轊䋴汘澻𢌡䢛潹溋𡟚鯩㚵𤤯邻邗啱䤆醻鐄𨩋䁢𨫼鐧𨰝𨰻蓥訫閙閧閗閖𨴴瑅㻂𤣿𤩂𤏪㻧𣈥随𨻧𨹦𨹥㻌𤧭𤩸𣿮琒瑫㻼靁𩂰"], +["9640","桇䨝𩂓𥟟靝鍨𨦉𨰦𨬯𦎾銺嬑譩䤼珹𤈛鞛靱餸𠼦巁𨯅𤪲頟𩓚鋶𩗗釥䓀𨭐𤩧𨭤飜𨩅㼀鈪䤥萔餻饍𧬆㷽馛䭯馪驜𨭥𥣈檏騡嫾騯𩣱䮐𩥈馼䮽䮗鍽塲𡌂堢𤦸"], +["96a1","𡓨硄𢜟𣶸棅㵽鑘㤧慐𢞁𢥫愇鱏鱓鱻鰵鰐魿鯏𩸭鮟𪇵𪃾鴡䲮𤄄鸘䲰鴌𪆴𪃭𪃳𩤯鶥蒽𦸒𦿟𦮂藼䔳𦶤𦺄𦷰萠藮𦸀𣟗𦁤秢𣖜𣙀䤭𤧞㵢鏛銾鍈𠊿碹鉷鑍俤㑀遤𥕝砽硔碶硋𡝗𣇉𤥁㚚佲濚濙瀞瀞吔𤆵垻壳垊鴖埗焴㒯𤆬燫𦱀𤾗嬨𡞵𨩉"], +["9740","愌嫎娋䊼𤒈㜬䭻𨧼鎻鎸𡣖𠼝葲𦳀𡐓𤋺𢰦𤏁妔𣶷𦝁綨𦅛𦂤𤦹𤦋𨧺鋥珢㻩璴𨭣𡢟㻡𤪳櫘珳珻㻖𤨾𤪔𡟙𤩦𠎧𡐤𤧥瑈𤤖炥𤥶銄珦鍟𠓾錱𨫎𨨖鎆𨯧𥗕䤵𨪂煫"], +["97a1","𤥃𠳿嚤𠘚𠯫𠲸唂秄𡟺緾𡛂𤩐𡡒䔮鐁㜊𨫀𤦭妰𡢿𡢃𧒄媡㛢𣵛㚰鉟婹𨪁𡡢鍴㳍𠪴䪖㦊僴㵩㵌𡎜煵䋻𨈘渏𩃤䓫浗𧹏灧沯㳖𣿭𣸭渂漌㵯𠏵畑㚼㓈䚀㻚䡱姄鉮䤾轁𨰜𦯀堒埈㛖𡑒烾𤍢𤩱𢿣𡊰𢎽梹楧𡎘𣓥𧯴𣛟𨪃𣟖𣏺𤲟樚𣚭𦲷萾䓟䓎"], +["9840","𦴦𦵑𦲂𦿞漗𧄉茽𡜺菭𦲀𧁓𡟛妉媂𡞳婡婱𡤅𤇼㜭姯𡜼㛇熎鎐暚𤊥婮娫𤊓樫𣻹𧜶𤑛𤋊焝𤉙𨧡侰𦴨峂𤓎𧹍𤎽樌𤉖𡌄炦焳𤏩㶥泟勇𤩏繥姫崯㷳彜𤩝𡟟綤萦"], +["98a1","咅𣫺𣌀𠈔坾𠣕𠘙㿥𡾞𪊶瀃𩅛嵰玏糓𨩙𩐠俈翧狍猐𧫴猸猹𥛶獁獈㺩𧬘遬燵𤣲珡臶㻊県㻑沢国琙琞琟㻢㻰㻴㻺瓓㼎㽓畂畭畲疍㽼痈痜㿀癍㿗癴㿜発𤽜熈嘣覀塩䀝睃䀹条䁅㗛瞘䁪䁯属瞾矋売砘点砜䂨砹硇硑硦葈𥔵礳栃礲䄃"], +["9940","䄉禑禙辻稆込䅧窑䆲窼艹䇄竏竛䇏両筢筬筻簒簛䉠䉺类粜䊌粸䊔糭输烀𠳏総緔緐緽羮羴犟䎗耠耥笹耮耱联㷌垴炠肷胩䏭脌猪脎脒畠脔䐁㬹腖腙腚"], +["99a1","䐓堺腼膄䐥膓䐭膥埯臁臤艔䒏芦艶苊苘苿䒰荗险榊萅烵葤惣蒈䔄蒾蓡蓸蔐蔸蕒䔻蕯蕰藠䕷虲蚒蚲蛯际螋䘆䘗袮裿褤襇覑𧥧訩訸誔誴豑賔賲贜䞘塟跃䟭仮踺嗘坔蹱嗵躰䠷軎転軤軭軲辷迁迊迌逳駄䢭飠鈓䤞鈨鉘鉫銱銮銿"], +["9a40","鋣鋫鋳鋴鋽鍃鎄鎭䥅䥑麿鐗匁鐝鐭鐾䥪鑔鑹锭関䦧间阳䧥枠䨤靀䨵鞲韂噔䫤惨颹䬙飱塄餎餙冴餜餷饂饝饢䭰駅䮝騼鬏窃魩鮁鯝鯱鯴䱭鰠㝯𡯂鵉鰺"], +["9aa1","黾噐鶓鶽鷀鷼银辶鹻麬麱麽黆铜黢黱黸竈齄𠂔𠊷𠎠椚铃妬𠓗塀铁㞹𠗕𠘕𠙶𡚺块煳𠫂𠫍𠮿呪吆𠯋咞𠯻𠰻𠱓𠱥𠱼惧𠲍噺𠲵𠳝𠳭𠵯𠶲𠷈楕鰯螥𠸄𠸎𠻗𠾐𠼭𠹳尠𠾼帋𡁜𡁏𡁶朞𡁻𡂈𡂖㙇𡂿𡃓𡄯𡄻卤蒭𡋣𡍵𡌶讁𡕷𡘙𡟃𡟇乸炻𡠭𡥪"], +["9b40","𡨭𡩅𡰪𡱰𡲬𡻈拃𡻕𡼕熘桕𢁅槩㛈𢉼𢏗𢏺𢜪𢡱𢥏苽𢥧𢦓𢫕覥𢫨辠𢬎鞸𢬿顇骽𢱌"], +["9b62","𢲈𢲷𥯨𢴈𢴒𢶷𢶕𢹂𢽴𢿌𣀳𣁦𣌟𣏞徱晈暿𧩹𣕧𣗳爁𤦺矗𣘚𣜖纇𠍆墵朎"], +["9ba1","椘𣪧𧙗𥿢𣸑𣺹𧗾𢂚䣐䪸𤄙𨪚𤋮𤌍𤀻𤌴𤎖𤩅𠗊凒𠘑妟𡺨㮾𣳿𤐄𤓖垈𤙴㦛𤜯𨗨𩧉㝢𢇃譞𨭎駖𤠒𤣻𤨕爉𤫀𠱸奥𤺥𤾆𠝹軚𥀬劏圿煱𥊙𥐙𣽊𤪧喼𥑆𥑮𦭒釔㑳𥔿𧘲𥕞䜘𥕢𥕦𥟇𤤿𥡝偦㓻𣏌惞𥤃䝼𨥈𥪮𥮉𥰆𡶐垡煑澶𦄂𧰒遖𦆲𤾚譢𦐂𦑊"], +["9c40","嵛𦯷輶𦒄𡤜諪𤧶𦒈𣿯𦔒䯀𦖿𦚵𢜛鑥𥟡憕娧晉侻嚹𤔡𦛼乪𤤴陖涏𦲽㘘襷𦞙𦡮𦐑𦡞營𦣇筂𩃀𠨑𦤦鄄𦤹穅鷰𦧺騦𦨭㙟𦑩𠀡禃𦨴𦭛崬𣔙菏𦮝䛐𦲤画补𦶮墶"], +["9ca1","㜜𢖍𧁋𧇍㱔𧊀𧊅銁𢅺𧊋錰𧋦𤧐氹钟𧑐𠻸蠧裵𢤦𨑳𡞱溸𤨪𡠠㦤㚹尐秣䔿暶𩲭𩢤襃𧟌𧡘囖䃟𡘊㦡𣜯𨃨𡏅熭荦𧧝𩆨婧䲷𧂯𨦫𧧽𧨊𧬋𧵦𤅺筃祾𨀉澵𪋟樃𨌘厢𦸇鎿栶靝𨅯𨀣𦦵𡏭𣈯𨁈嶅𨰰𨂃圕頣𨥉嶫𤦈斾槕叒𤪥𣾁㰑朶𨂐𨃴𨄮𡾡𨅏"], +["9d40","𨆉𨆯𨈚𨌆𨌯𨎊㗊𨑨𨚪䣺揦𨥖砈鉕𨦸䏲𨧧䏟𨧨𨭆𨯔姸𨰉輋𨿅𩃬筑𩄐𩄼㷷𩅞𤫊运犏嚋𩓧𩗩𩖰𩖸𩜲𩣑𩥉𩥪𩧃𩨨𩬎𩵚𩶛纟𩻸𩼣䲤镇𪊓熢𪋿䶑递𪗋䶜𠲜达嗁"], +["9da1","辺𢒰边𤪓䔉繿潖檱仪㓤𨬬𧢝㜺躀𡟵𨀤𨭬𨮙𧨾𦚯㷫𧙕𣲷𥘵𥥖亚𥺁𦉘嚿𠹭踎孭𣺈𤲞揞拐𡟶𡡻攰嘭𥱊吚𥌑㷆𩶘䱽嘢嘞罉𥻘奵𣵀蝰东𠿪𠵉𣚺脗鵞贘瘻鱅癎瞹鍅吲腈苷嘥脲萘肽嗪祢噃吖𠺝㗎嘅嗱曱𨋢㘭甴嗰喺咗啲𠱁𠲖廐𥅈𠹶𢱢"], +["9e40","𠺢麫絚嗞𡁵抝靭咔賍燶酶揼掹揾啩𢭃鱲𢺳冚㓟𠶧冧呍唞唓癦踭𦢊疱肶蠄螆裇膶萜𡃁䓬猄𤜆宐茋𦢓噻𢛴𧴯𤆣𧵳𦻐𧊶酰𡇙鈈𣳼𪚩𠺬𠻹牦𡲢䝎𤿂𧿹𠿫䃺"], +["9ea1","鱝攟𢶠䣳𤟠𩵼𠿬𠸊恢𧖣𠿭"], +["9ead","𦁈𡆇熣纎鵐业丄㕷嬍沲卧㚬㧜卽㚥𤘘墚𤭮舭呋垪𥪕𠥹"], +["9ec5","㩒𢑥獴𩺬䴉鯭𣳾𩼰䱛𤾩𩖞𩿞葜𣶶𧊲𦞳𣜠挮紥𣻷𣸬㨪逈勌㹴㙺䗩𠒎癀嫰𠺶硺𧼮墧䂿噼鮋嵴癔𪐴麅䳡痹㟻愙𣃚𤏲"], +["9ef5","噝𡊩垧𤥣𩸆刴𧂮㖭汊鵼"], +["9f40","籖鬹埞𡝬屓擓𩓐𦌵𧅤蚭𠴨𦴢𤫢𠵱"], +["9f4f","凾𡼏嶎霃𡷑麁遌笟鬂峑箣扨挵髿篏鬪籾鬮籂粆鰕篼鬉鼗鰛𤤾齚啳寃俽麘俲剠㸆勑坧偖妷帒韈鶫轜呩鞴饀鞺匬愰"], +["9fa1","椬叚鰊鴂䰻陁榀傦畆𡝭駚剳"], +["9fae","酙隁酜"], +["9fb2","酑𨺗捿𦴣櫊嘑醎畺抅𠏼獏籰𥰡𣳽"], +["9fc1","𤤙盖鮝个𠳔莾衂"], +["9fc9","届槀僭坺刟巵从氱𠇲伹咜哚劚趂㗾弌㗳"], +["9fdb","歒酼龥鮗頮颴骺麨麄煺笔"], +["9fe7","毺蠘罸"], +["9feb","嘠𪙊蹷齓"], +["9ff0","跔蹏鸜踁抂𨍽踨蹵竓𤩷稾磘泪詧瘇"], +["a040","𨩚鼦泎蟖痃𪊲硓咢贌狢獱謭猂瓱賫𤪻蘯徺袠䒷"], +["a055","𡠻𦸅"], +["a058","詾𢔛"], +["a05b","惽癧髗鵄鍮鮏蟵"], +["a063","蠏賷猬霡鮰㗖犲䰇籑饊𦅙慙䰄麖慽"], +["a073","坟慯抦戹拎㩜懢厪𣏵捤栂㗒"], +["a0a1","嵗𨯂迚𨸹"], +["a0a6","僙𡵆礆匲阸𠼻䁥"], +["a0ae","矾"], +["a0b0","糂𥼚糚稭聦聣絍甅瓲覔舚朌聢𧒆聛瓰脃眤覉𦟌畓𦻑螩蟎臈螌詉貭譃眫瓸蓚㘵榲趦"], +["a0d4","覩瑨涹蟁𤀑瓧㷛煶悤憜㳑煢恷"], +["a0e2","罱𨬭牐惩䭾删㰘𣳇𥻗𧙖𥔱𡥄𡋾𩤃𦷜𧂭峁𦆭𨨏𣙷𠃮𦡆𤼎䕢嬟𦍌齐麦𦉫"], +["a3c0","␀",31,"␡"], +["c6a1","①",9,"⑴",9,"ⅰ",9,"丶丿亅亠冂冖冫勹匸卩厶夊宀巛⼳广廴彐彡攴无疒癶辵隶¨ˆヽヾゝゞ〃仝々〆〇ー[]✽ぁ",23], +["c740","す",58,"ァアィイ"], +["c7a1","ゥ",81,"А",5,"ЁЖ",4], +["c840","Л",26,"ёж",25,"⇧↸↹㇏𠃌乚𠂊刂䒑"], +["c8a1","龰冈龱𧘇"], +["c8cd","¬¦'"㈱№℡゛゜⺀⺄⺆⺇⺈⺊⺌⺍⺕⺜⺝⺥⺧⺪⺬⺮⺶⺼⺾⻆⻊⻌⻍⻏⻖⻗⻞⻣"], +["c8f5","ʃɐɛɔɵœøŋʊɪ"], +["f9fe","■"], +["fa40","𠕇鋛𠗟𣿅蕌䊵珯况㙉𤥂𨧤鍄𡧛苮𣳈砼杄拟𤤳𨦪𠊠𦮳𡌅侫𢓭倈𦴩𧪄𣘀𤪱𢔓倩𠍾徤𠎀𠍇滛𠐟偽儁㑺儎顬㝃萖𤦤𠒇兠𣎴兪𠯿𢃼𠋥𢔰𠖎𣈳𡦃宂蝽𠖳𣲙冲冸"], +["faa1","鴴凉减凑㳜凓𤪦决凢卂凭菍椾𣜭彻刋刦刼劵剗劔効勅簕蕂勠蘍𦬓包𨫞啉滙𣾀𠥔𣿬匳卄𠯢泋𡜦栛珕恊㺪㣌𡛨燝䒢卭却𨚫卾卿𡖖𡘓矦厓𨪛厠厫厮玧𥝲㽙玜叁叅汉义埾叙㪫𠮏叠𣿫𢶣叶𠱷吓灹唫晗浛呭𦭓𠵴啝咏咤䞦𡜍𠻝㶴𠵍"], +["fb40","𨦼𢚘啇䳭启琗喆喩嘅𡣗𤀺䕒𤐵暳𡂴嘷曍𣊊暤暭噍噏磱囱鞇叾圀囯园𨭦㘣𡉏坆𤆥汮炋坂㚱𦱾埦𡐖堃𡑔𤍣堦𤯵塜墪㕡壠壜𡈼壻寿坃𪅐𤉸鏓㖡够梦㛃湙"], +["fba1","𡘾娤啓𡚒蔅姉𠵎𦲁𦴪𡟜姙𡟻𡞲𦶦浱𡠨𡛕姹𦹅媫婣㛦𤦩婷㜈媖瑥嫓𦾡𢕔㶅𡤑㜲𡚸広勐孶斈孼𧨎䀄䡝𠈄寕慠𡨴𥧌𠖥寳宝䴐尅𡭄尓珎尔𡲥𦬨屉䣝岅峩峯嶋𡷹𡸷崐崘嵆𡺤岺巗苼㠭𤤁𢁉𢅳芇㠶㯂帮檊幵幺𤒼𠳓厦亷廐厨𡝱帉廴𨒂"], +["fc40","廹廻㢠廼栾鐛弍𠇁弢㫞䢮𡌺强𦢈𢏐彘𢑱彣鞽𦹮彲鍀𨨶徧嶶㵟𥉐𡽪𧃸𢙨釖𠊞𨨩怱暅𡡷㥣㷇㘹垐𢞴祱㹀悞悤悳𤦂𤦏𧩓璤僡媠慤萤慂慈𦻒憁凴𠙖憇宪𣾷"], +["fca1","𢡟懓𨮝𩥝懐㤲𢦀𢣁怣慜攞掋𠄘担𡝰拕𢸍捬𤧟㨗搸揸𡎎𡟼撐澊𢸶頔𤂌𥜝擡擥鑻㩦携㩗敍漖𤨨𤨣斅敭敟𣁾斵𤥀䬷旑䃘𡠩无旣忟𣐀昘𣇷𣇸晄𣆤𣆥晋𠹵晧𥇦晳晴𡸽𣈱𨗴𣇈𥌓矅𢣷馤朂𤎜𤨡㬫槺𣟂杞杧杢𤇍𩃭柗䓩栢湐鈼栁𣏦𦶠桝"], +["fd40","𣑯槡樋𨫟楳棃𣗍椁椀㴲㨁𣘼㮀枬楡𨩊䋼椶榘㮡𠏉荣傐槹𣙙𢄪橅𣜃檝㯳枱櫈𩆜㰍欝𠤣惞欵歴𢟍溵𣫛𠎵𡥘㝀吡𣭚毡𣻼毜氷𢒋𤣱𦭑汚舦汹𣶼䓅𣶽𤆤𤤌𤤀"], +["fda1","𣳉㛥㳫𠴲鮃𣇹𢒑羏样𦴥𦶡𦷫涖浜湼漄𤥿𤂅𦹲蔳𦽴凇沜渝萮𨬡港𣸯瑓𣾂秌湏媑𣁋濸㜍澝𣸰滺𡒗𤀽䕕鏰潄潜㵎潴𩅰㴻澟𤅄濓𤂑𤅕𤀹𣿰𣾴𤄿凟𤅖𤅗𤅀𦇝灋灾炧炁烌烕烖烟䄄㷨熴熖𤉷焫煅媈煊煮岜𤍥煏鍢𤋁焬𤑚𤨧𤨢熺𨯨炽爎"], +["fe40","鑂爕夑鑃爤鍁𥘅爮牀𤥴梽牕牗㹕𣁄栍漽犂猪猫𤠣𨠫䣭𨠄猨献珏玪𠰺𦨮珉瑉𤇢𡛧𤨤昣㛅𤦷𤦍𤧻珷琕椃𤨦琹𠗃㻗瑜𢢭瑠𨺲瑇珤瑶莹瑬㜰瑴鏱樬璂䥓𤪌"], +["fea1","𤅟𤩹𨮏孆𨰃𡢞瓈𡦈甎瓩甞𨻙𡩋寗𨺬鎅畍畊畧畮𤾂㼄𤴓疎瑝疞疴瘂瘬癑癏癯癶𦏵皐臯㟸𦤑𦤎皡皥皷盌𦾟葢𥂝𥅽𡸜眞眦着撯𥈠睘𣊬瞯𨥤𨥨𡛁矴砉𡍶𤨒棊碯磇磓隥礮𥗠磗礴碱𧘌辸袄𨬫𦂃𢘜禆褀椂禀𥡗禝𧬹礼禩渪𧄦㺨秆𩄍秔"] +] diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp936.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp936.json new file mode 100644 index 0000000..49ddb9a --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp936.json @@ -0,0 +1,264 @@ +[ +["0","\u0000",127,"€"], +["8140","丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱丳丵丷丼乀乁乂乄乆乊乑乕乗乚乛乢乣乤乥乧乨乪",5,"乲乴",9,"乿",6,"亇亊"], +["8180","亐亖亗亙亜亝亞亣亪亯亰亱亴亶亷亸亹亼亽亾仈仌仏仐仒仚仛仜仠仢仦仧仩仭仮仯仱仴仸仹仺仼仾伀伂",6,"伋伌伒",4,"伜伝伡伣伨伩伬伭伮伱伳伵伷伹伻伾",4,"佄佅佇",5,"佒佔佖佡佢佦佨佪佫佭佮佱佲併佷佸佹佺佽侀侁侂侅來侇侊侌侎侐侒侓侕侖侘侙侚侜侞侟価侢"], +["8240","侤侫侭侰",4,"侶",8,"俀俁係俆俇俈俉俋俌俍俒",4,"俙俛俠俢俤俥俧俫俬俰俲俴俵俶俷俹俻俼俽俿",11], +["8280","個倎倐們倓倕倖倗倛倝倞倠倢倣値倧倫倯",10,"倻倽倿偀偁偂偄偅偆偉偊偋偍偐",4,"偖偗偘偙偛偝",7,"偦",5,"偭",8,"偸偹偺偼偽傁傂傃傄傆傇傉傊傋傌傎",20,"傤傦傪傫傭",4,"傳",6,"傼"], +["8340","傽",17,"僐",5,"僗僘僙僛",10,"僨僩僪僫僯僰僱僲僴僶",4,"僼",9,"儈"], +["8380","儉儊儌",5,"儓",13,"儢",28,"兂兇兊兌兎兏児兒兓兗兘兙兛兝",4,"兣兤兦內兩兪兯兲兺兾兿冃冄円冇冊冋冎冏冐冑冓冔冘冚冝冞冟冡冣冦",4,"冭冮冴冸冹冺冾冿凁凂凃凅凈凊凍凎凐凒",5], +["8440","凘凙凚凜凞凟凢凣凥",5,"凬凮凱凲凴凷凾刄刅刉刋刌刏刐刓刔刕刜刞刟刡刢刣別刦刧刪刬刯刱刲刴刵刼刾剄",5,"剋剎剏剒剓剕剗剘"], +["8480","剙剚剛剝剟剠剢剣剤剦剨剫剬剭剮剰剱剳",9,"剾劀劃",4,"劉",6,"劑劒劔",6,"劜劤劥劦劧劮劯劰労",9,"勀勁勂勄勅勆勈勊勌勍勎勏勑勓勔動勗務",5,"勠勡勢勣勥",10,"勱",7,"勻勼勽匁匂匃匄匇匉匊匋匌匎"], +["8540","匑匒匓匔匘匛匜匞匟匢匤匥匧匨匩匫匬匭匯",9,"匼匽區卂卄卆卋卌卍卐協単卙卛卝卥卨卪卬卭卲卶卹卻卼卽卾厀厁厃厇厈厊厎厏"], +["8580","厐",4,"厖厗厙厛厜厞厠厡厤厧厪厫厬厭厯",6,"厷厸厹厺厼厽厾叀參",4,"収叏叐叒叓叕叚叜叝叞叡叢叧叴叺叾叿吀吂吅吇吋吔吘吙吚吜吢吤吥吪吰吳吶吷吺吽吿呁呂呄呅呇呉呌呍呎呏呑呚呝",4,"呣呥呧呩",7,"呴呹呺呾呿咁咃咅咇咈咉咊咍咑咓咗咘咜咞咟咠咡"], +["8640","咢咥咮咰咲咵咶咷咹咺咼咾哃哅哊哋哖哘哛哠",4,"哫哬哯哰哱哴",5,"哻哾唀唂唃唄唅唈唊",4,"唒唓唕",5,"唜唝唞唟唡唥唦"], +["8680","唨唩唫唭唲唴唵唶唸唹唺唻唽啀啂啅啇啈啋",4,"啑啒啓啔啗",4,"啝啞啟啠啢啣啨啩啫啯",5,"啹啺啽啿喅喆喌喍喎喐喒喓喕喖喗喚喛喞喠",6,"喨",8,"喲喴営喸喺喼喿",4,"嗆嗇嗈嗊嗋嗎嗏嗐嗕嗗",4,"嗞嗠嗢嗧嗩嗭嗮嗰嗱嗴嗶嗸",4,"嗿嘂嘃嘄嘅"], +["8740","嘆嘇嘊嘋嘍嘐",7,"嘙嘚嘜嘝嘠嘡嘢嘥嘦嘨嘩嘪嘫嘮嘯嘰嘳嘵嘷嘸嘺嘼嘽嘾噀",11,"噏",4,"噕噖噚噛噝",4], +["8780","噣噥噦噧噭噮噯噰噲噳噴噵噷噸噹噺噽",7,"嚇",6,"嚐嚑嚒嚔",14,"嚤",10,"嚰",6,"嚸嚹嚺嚻嚽",12,"囋",8,"囕囖囘囙囜団囥",5,"囬囮囯囲図囶囷囸囻囼圀圁圂圅圇國",6], +["8840","園",9,"圝圞圠圡圢圤圥圦圧圫圱圲圴",4,"圼圽圿坁坃坄坅坆坈坉坋坒",4,"坘坙坢坣坥坧坬坮坰坱坲坴坵坸坹坺坽坾坿垀"], +["8880","垁垇垈垉垊垍",4,"垔",6,"垜垝垞垟垥垨垪垬垯垰垱垳垵垶垷垹",8,"埄",6,"埌埍埐埑埓埖埗埛埜埞埡埢埣埥",7,"埮埰埱埲埳埵埶執埻埼埾埿堁堃堄堅堈堉堊堌堎堏堐堒堓堔堖堗堘堚堛堜堝堟堢堣堥",4,"堫",4,"報堲堳場堶",7], +["8940","堾",5,"塅",6,"塎塏塐塒塓塕塖塗塙",4,"塟",5,"塦",4,"塭",16,"塿墂墄墆墇墈墊墋墌"], +["8980","墍",4,"墔",4,"墛墜墝墠",7,"墪",17,"墽墾墿壀壂壃壄壆",10,"壒壓壔壖",13,"壥",5,"壭壯壱売壴壵壷壸壺",7,"夃夅夆夈",4,"夎夐夑夒夓夗夘夛夝夞夠夡夢夣夦夨夬夰夲夳夵夶夻"], +["8a40","夽夾夿奀奃奅奆奊奌奍奐奒奓奙奛",4,"奡奣奤奦",12,"奵奷奺奻奼奾奿妀妅妉妋妌妎妏妐妑妔妕妘妚妛妜妝妟妠妡妢妦"], +["8a80","妧妬妭妰妱妳",5,"妺妼妽妿",6,"姇姈姉姌姍姎姏姕姖姙姛姞",4,"姤姦姧姩姪姫姭",11,"姺姼姽姾娀娂娊娋娍娎娏娐娒娔娕娖娗娙娚娛娝娞娡娢娤娦娧娨娪",6,"娳娵娷",4,"娽娾娿婁",4,"婇婈婋",9,"婖婗婘婙婛",5], +["8b40","婡婣婤婥婦婨婩婫",8,"婸婹婻婼婽婾媀",17,"媓",6,"媜",13,"媫媬"], +["8b80","媭",4,"媴媶媷媹",4,"媿嫀嫃",5,"嫊嫋嫍",4,"嫓嫕嫗嫙嫚嫛嫝嫞嫟嫢嫤嫥嫧嫨嫪嫬",4,"嫲",22,"嬊",11,"嬘",25,"嬳嬵嬶嬸",7,"孁",6], +["8c40","孈",7,"孒孖孞孠孡孧孨孫孭孮孯孲孴孶孷學孹孻孼孾孿宂宆宊宍宎宐宑宒宔宖実宧宨宩宬宭宮宯宱宲宷宺宻宼寀寁寃寈寉寊寋寍寎寏"], +["8c80","寑寔",8,"寠寢寣實寧審",4,"寯寱",6,"寽対尀専尃尅將專尋尌對導尐尒尓尗尙尛尞尟尠尡尣尦尨尩尪尫尭尮尯尰尲尳尵尶尷屃屄屆屇屌屍屒屓屔屖屗屘屚屛屜屝屟屢層屧",6,"屰屲",6,"屻屼屽屾岀岃",4,"岉岊岋岎岏岒岓岕岝",4,"岤",4], +["8d40","岪岮岯岰岲岴岶岹岺岻岼岾峀峂峃峅",5,"峌",5,"峓",5,"峚",6,"峢峣峧峩峫峬峮峯峱",9,"峼",4], +["8d80","崁崄崅崈",5,"崏",4,"崕崗崘崙崚崜崝崟",4,"崥崨崪崫崬崯",4,"崵",7,"崿",7,"嵈嵉嵍",10,"嵙嵚嵜嵞",10,"嵪嵭嵮嵰嵱嵲嵳嵵",12,"嶃",21,"嶚嶛嶜嶞嶟嶠"], +["8e40","嶡",21,"嶸",12,"巆",6,"巎",12,"巜巟巠巣巤巪巬巭"], +["8e80","巰巵巶巸",4,"巿帀帄帇帉帊帋帍帎帒帓帗帞",7,"帨",4,"帯帰帲",4,"帹帺帾帿幀幁幃幆",5,"幍",6,"幖",4,"幜幝幟幠幣",14,"幵幷幹幾庁庂広庅庈庉庌庍庎庒庘庛庝庡庢庣庤庨",4,"庮",4,"庴庺庻庼庽庿",6], +["8f40","廆廇廈廋",5,"廔廕廗廘廙廚廜",11,"廩廫",8,"廵廸廹廻廼廽弅弆弇弉弌弍弎弐弒弔弖弙弚弜弝弞弡弢弣弤"], +["8f80","弨弫弬弮弰弲",6,"弻弽弾弿彁",14,"彑彔彙彚彛彜彞彟彠彣彥彧彨彫彮彯彲彴彵彶彸彺彽彾彿徃徆徍徎徏徑従徔徖徚徛徝從徟徠徢",5,"復徫徬徯",5,"徶徸徹徺徻徾",4,"忇忈忊忋忎忓忔忕忚忛応忞忟忢忣忥忦忨忩忬忯忰忲忳忴忶忷忹忺忼怇"], +["9040","怈怉怋怌怐怑怓怗怘怚怞怟怢怣怤怬怭怮怰",4,"怶",4,"怽怾恀恄",6,"恌恎恏恑恓恔恖恗恘恛恜恞恟恠恡恥恦恮恱恲恴恵恷恾悀"], +["9080","悁悂悅悆悇悈悊悋悎悏悐悑悓悕悗悘悙悜悞悡悢悤悥悧悩悪悮悰悳悵悶悷悹悺悽",7,"惇惈惉惌",4,"惒惓惔惖惗惙惛惞惡",4,"惪惱惲惵惷惸惻",4,"愂愃愄愅愇愊愋愌愐",4,"愖愗愘愙愛愜愝愞愡愢愥愨愩愪愬",18,"慀",6], +["9140","慇慉態慍慏慐慒慓慔慖",6,"慞慟慠慡慣慤慥慦慩",6,"慱慲慳慴慶慸",18,"憌憍憏",4,"憕"], +["9180","憖",6,"憞",8,"憪憫憭",9,"憸",5,"憿懀懁懃",4,"應懌",4,"懓懕",16,"懧",13,"懶",8,"戀",5,"戇戉戓戔戙戜戝戞戠戣戦戧戨戩戫戭戯戰戱戲戵戶戸",4,"扂扄扅扆扊"], +["9240","扏扐払扖扗扙扚扜",6,"扤扥扨扱扲扴扵扷扸扺扻扽抁抂抃抅抆抇抈抋",5,"抔抙抜抝択抣抦抧抩抪抭抮抯抰抲抳抴抶抷抸抺抾拀拁"], +["9280","拃拋拏拑拕拝拞拠拡拤拪拫拰拲拵拸拹拺拻挀挃挄挅挆挊挋挌挍挏挐挒挓挔挕挗挘挙挜挦挧挩挬挭挮挰挱挳",5,"挻挼挾挿捀捁捄捇捈捊捑捒捓捔捖",7,"捠捤捥捦捨捪捫捬捯捰捲捳捴捵捸捹捼捽捾捿掁掃掄掅掆掋掍掑掓掔掕掗掙",6,"採掤掦掫掯掱掲掵掶掹掻掽掿揀"], +["9340","揁揂揃揅揇揈揊揋揌揑揓揔揕揗",6,"揟揢揤",4,"揫揬揮揯揰揱揳揵揷揹揺揻揼揾搃搄搆",4,"損搎搑搒搕",5,"搝搟搢搣搤"], +["9380","搥搧搨搩搫搮",5,"搵",4,"搻搼搾摀摂摃摉摋",6,"摓摕摖摗摙",4,"摟",7,"摨摪摫摬摮",9,"摻",6,"撃撆撈",8,"撓撔撗撘撚撛撜撝撟",4,"撥撦撧撨撪撫撯撱撲撳撴撶撹撻撽撾撿擁擃擄擆",6,"擏擑擓擔擕擖擙據"], +["9440","擛擜擝擟擠擡擣擥擧",24,"攁",7,"攊",7,"攓",4,"攙",8], +["9480","攢攣攤攦",4,"攬攭攰攱攲攳攷攺攼攽敀",4,"敆敇敊敋敍敎敐敒敓敔敗敘敚敜敟敠敡敤敥敧敨敩敪敭敮敯敱敳敵敶數",14,"斈斉斊斍斎斏斒斔斕斖斘斚斝斞斠斢斣斦斨斪斬斮斱",7,"斺斻斾斿旀旂旇旈旉旊旍旐旑旓旔旕旘",7,"旡旣旤旪旫"], +["9540","旲旳旴旵旸旹旻",4,"昁昄昅昇昈昉昋昍昐昑昒昖昗昘昚昛昜昞昡昢昣昤昦昩昪昫昬昮昰昲昳昷",4,"昽昿晀時晄",6,"晍晎晐晑晘"], +["9580","晙晛晜晝晞晠晢晣晥晧晩",4,"晱晲晳晵晸晹晻晼晽晿暀暁暃暅暆暈暉暊暋暍暎暏暐暒暓暔暕暘",4,"暞",8,"暩",4,"暯",4,"暵暶暷暸暺暻暼暽暿",25,"曚曞",7,"曧曨曪",5,"曱曵曶書曺曻曽朁朂會"], +["9640","朄朅朆朇朌朎朏朑朒朓朖朘朙朚朜朞朠",5,"朧朩朮朰朲朳朶朷朸朹朻朼朾朿杁杄杅杇杊杋杍杒杔杕杗",4,"杝杢杣杤杦杧杫杬杮東杴杶"], +["9680","杸杹杺杻杽枀枂枃枅枆枈枊枌枍枎枏枑枒枓枔枖枙枛枟枠枡枤枦枩枬枮枱枲枴枹",7,"柂柅",9,"柕柖柗柛柟柡柣柤柦柧柨柪柫柭柮柲柵",7,"柾栁栂栃栄栆栍栐栒栔栕栘",4,"栞栟栠栢",6,"栫",6,"栴栵栶栺栻栿桇桋桍桏桒桖",5], +["9740","桜桝桞桟桪桬",7,"桵桸",8,"梂梄梇",7,"梐梑梒梔梕梖梘",9,"梣梤梥梩梪梫梬梮梱梲梴梶梷梸"], +["9780","梹",6,"棁棃",5,"棊棌棎棏棐棑棓棔棖棗棙棛",4,"棡棢棤",9,"棯棲棳棴棶棷棸棻棽棾棿椀椂椃椄椆",4,"椌椏椑椓",11,"椡椢椣椥",7,"椮椯椱椲椳椵椶椷椸椺椻椼椾楀楁楃",16,"楕楖楘楙楛楜楟"], +["9840","楡楢楤楥楧楨楩楪楬業楯楰楲",4,"楺楻楽楾楿榁榃榅榊榋榌榎",5,"榖榗榙榚榝",9,"榩榪榬榮榯榰榲榳榵榶榸榹榺榼榽"], +["9880","榾榿槀槂",7,"構槍槏槑槒槓槕",5,"槜槝槞槡",11,"槮槯槰槱槳",9,"槾樀",9,"樋",11,"標",5,"樠樢",5,"権樫樬樭樮樰樲樳樴樶",6,"樿",4,"橅橆橈",7,"橑",6,"橚"], +["9940","橜",4,"橢橣橤橦",10,"橲",6,"橺橻橽橾橿檁檂檃檅",8,"檏檒",4,"檘",7,"檡",5], +["9980","檧檨檪檭",114,"欥欦欨",6], +["9a40","欯欰欱欳欴欵欶欸欻欼欽欿歀歁歂歄歅歈歊歋歍",11,"歚",7,"歨歩歫",13,"歺歽歾歿殀殅殈"], +["9a80","殌殎殏殐殑殔殕殗殘殙殜",4,"殢",7,"殫",7,"殶殸",6,"毀毃毄毆",4,"毌毎毐毑毘毚毜",4,"毢",7,"毬毭毮毰毱毲毴毶毷毸毺毻毼毾",6,"氈",4,"氎氒気氜氝氞氠氣氥氫氬氭氱氳氶氷氹氺氻氼氾氿汃汄汅汈汋",4,"汑汒汓汖汘"], +["9b40","汙汚汢汣汥汦汧汫",4,"汱汳汵汷汸決汻汼汿沀沄沇沊沋沍沎沑沒沕沖沗沘沚沜沝沞沠沢沨沬沯沰沴沵沶沷沺泀況泂泃泆泇泈泋泍泎泏泑泒泘"], +["9b80","泙泚泜泝泟泤泦泧泩泬泭泲泴泹泿洀洂洃洅洆洈洉洊洍洏洐洑洓洔洕洖洘洜洝洟",5,"洦洨洩洬洭洯洰洴洶洷洸洺洿浀浂浄浉浌浐浕浖浗浘浛浝浟浡浢浤浥浧浨浫浬浭浰浱浲浳浵浶浹浺浻浽",4,"涃涄涆涇涊涋涍涏涐涒涖",4,"涜涢涥涬涭涰涱涳涴涶涷涹",5,"淁淂淃淈淉淊"], +["9c40","淍淎淏淐淒淓淔淕淗淚淛淜淟淢淣淥淧淨淩淪淭淯淰淲淴淵淶淸淺淽",7,"渆渇済渉渋渏渒渓渕渘渙減渜渞渟渢渦渧渨渪測渮渰渱渳渵"], +["9c80","渶渷渹渻",7,"湅",7,"湏湐湑湒湕湗湙湚湜湝湞湠",10,"湬湭湯",14,"満溁溂溄溇溈溊",4,"溑",6,"溙溚溛溝溞溠溡溣溤溦溨溩溫溬溭溮溰溳溵溸溹溼溾溿滀滃滄滅滆滈滉滊滌滍滎滐滒滖滘滙滛滜滝滣滧滪",5], +["9d40","滰滱滲滳滵滶滷滸滺",7,"漃漄漅漇漈漊",4,"漐漑漒漖",9,"漡漢漣漥漦漧漨漬漮漰漲漴漵漷",6,"漿潀潁潂"], +["9d80","潃潄潅潈潉潊潌潎",9,"潙潚潛潝潟潠潡潣潤潥潧",5,"潯潰潱潳潵潶潷潹潻潽",6,"澅澆澇澊澋澏",12,"澝澞澟澠澢",4,"澨",10,"澴澵澷澸澺",5,"濁濃",5,"濊",6,"濓",10,"濟濢濣濤濥"], +["9e40","濦",7,"濰",32,"瀒",7,"瀜",6,"瀤",6], +["9e80","瀫",9,"瀶瀷瀸瀺",17,"灍灎灐",13,"灟",11,"灮灱灲灳灴灷灹灺灻災炁炂炃炄炆炇炈炋炌炍炏炐炑炓炗炘炚炛炞",12,"炰炲炴炵炶為炾炿烄烅烆烇烉烋",12,"烚"], +["9f40","烜烝烞烠烡烢烣烥烪烮烰",6,"烸烺烻烼烾",10,"焋",4,"焑焒焔焗焛",10,"焧",7,"焲焳焴"], +["9f80","焵焷",13,"煆煇煈煉煋煍煏",12,"煝煟",4,"煥煩",4,"煯煰煱煴煵煶煷煹煻煼煾",5,"熅",4,"熋熌熍熎熐熑熒熓熕熖熗熚",4,"熡",6,"熩熪熫熭",5,"熴熶熷熸熺",8,"燄",9,"燏",4], +["a040","燖",9,"燡燢燣燤燦燨",5,"燯",9,"燺",11,"爇",19], +["a080","爛爜爞",9,"爩爫爭爮爯爲爳爴爺爼爾牀",6,"牉牊牋牎牏牐牑牓牔牕牗牘牚牜牞牠牣牤牥牨牪牫牬牭牰牱牳牴牶牷牸牻牼牽犂犃犅",4,"犌犎犐犑犓",11,"犠",11,"犮犱犲犳犵犺",6,"狅狆狇狉狊狋狌狏狑狓狔狕狖狘狚狛"], +["a1a1"," 、。·ˉˇ¨〃々—~‖…‘’“”〔〕〈",7,"〖〗【】±×÷∶∧∨∑∏∪∩∈∷√⊥∥∠⌒⊙∫∮≡≌≈∽∝≠≮≯≤≥∞∵∴♂♀°′″℃$¤¢£‰§№☆★○●◎◇◆□■△▲※→←↑↓〓"], +["a2a1","ⅰ",9], +["a2b1","⒈",19,"⑴",19,"①",9], +["a2e5","㈠",9], +["a2f1","Ⅰ",11], +["a3a1","!"#¥%",88," ̄"], +["a4a1","ぁ",82], +["a5a1","ァ",85], +["a6a1","Α",16,"Σ",6], +["a6c1","α",16,"σ",6], +["a6e0","︵︶︹︺︿﹀︽︾﹁﹂﹃﹄"], +["a6ee","︻︼︷︸︱"], +["a6f4","︳︴"], +["a7a1","А",5,"ЁЖ",25], +["a7d1","а",5,"ёж",25], +["a840","ˊˋ˙–―‥‵℅℉↖↗↘↙∕∟∣≒≦≧⊿═",35,"▁",6], +["a880","█",7,"▓▔▕▼▽◢◣◤◥☉⊕〒〝〞"], +["a8a1","āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜüêɑ"], +["a8bd","ńň"], +["a8c0","ɡ"], +["a8c5","ㄅ",36], +["a940","〡",8,"㊣㎎㎏㎜㎝㎞㎡㏄㏎㏑㏒㏕︰¬¦"], +["a959","℡㈱"], +["a95c","‐"], +["a960","ー゛゜ヽヾ〆ゝゞ﹉",9,"﹔﹕﹖﹗﹙",8], +["a980","﹢",4,"﹨﹩﹪﹫"], +["a996","〇"], +["a9a4","─",75], +["aa40","狜狝狟狢",5,"狪狫狵狶狹狽狾狿猀猂猄",5,"猋猌猍猏猐猑猒猔猘猙猚猟猠猣猤猦猧猨猭猯猰猲猳猵猶猺猻猼猽獀",8], +["aa80","獉獊獋獌獎獏獑獓獔獕獖獘",7,"獡",10,"獮獰獱"], +["ab40","獲",11,"獿",4,"玅玆玈玊玌玍玏玐玒玓玔玕玗玘玙玚玜玝玞玠玡玣",5,"玪玬玭玱玴玵玶玸玹玼玽玾玿珁珃",4], +["ab80","珋珌珎珒",6,"珚珛珜珝珟珡珢珣珤珦珨珪珫珬珮珯珰珱珳",4], +["ac40","珸",10,"琄琇琈琋琌琍琎琑",8,"琜",5,"琣琤琧琩琫琭琯琱琲琷",4,"琽琾琿瑀瑂",11], +["ac80","瑎",6,"瑖瑘瑝瑠",12,"瑮瑯瑱",4,"瑸瑹瑺"], +["ad40","瑻瑼瑽瑿璂璄璅璆璈璉璊璌璍璏璑",10,"璝璟",7,"璪",15,"璻",12], +["ad80","瓈",9,"瓓",8,"瓝瓟瓡瓥瓧",6,"瓰瓱瓲"], +["ae40","瓳瓵瓸",6,"甀甁甂甃甅",7,"甎甐甒甔甕甖甗甛甝甞甠",4,"甦甧甪甮甴甶甹甼甽甿畁畂畃畄畆畇畉畊畍畐畑畒畓畕畖畗畘"], +["ae80","畝",7,"畧畨畩畫",6,"畳畵當畷畺",4,"疀疁疂疄疅疇"], +["af40","疈疉疊疌疍疎疐疓疕疘疛疜疞疢疦",4,"疭疶疷疺疻疿痀痁痆痋痌痎痏痐痑痓痗痙痚痜痝痟痠痡痥痩痬痭痮痯痲痳痵痶痷痸痺痻痽痾瘂瘄瘆瘇"], +["af80","瘈瘉瘋瘍瘎瘏瘑瘒瘓瘔瘖瘚瘜瘝瘞瘡瘣瘧瘨瘬瘮瘯瘱瘲瘶瘷瘹瘺瘻瘽癁療癄"], +["b040","癅",6,"癎",5,"癕癗",4,"癝癟癠癡癢癤",6,"癬癭癮癰",7,"癹発發癿皀皁皃皅皉皊皌皍皏皐皒皔皕皗皘皚皛"], +["b080","皜",7,"皥",8,"皯皰皳皵",9,"盀盁盃啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆榜膀绑棒磅蚌镑傍谤苞胞包褒剥"], +["b140","盄盇盉盋盌盓盕盙盚盜盝盞盠",4,"盦",7,"盰盳盵盶盷盺盻盽盿眀眂眃眅眆眊県眎",10,"眛眜眝眞眡眣眤眥眧眪眫"], +["b180","眬眮眰",4,"眹眻眽眾眿睂睄睅睆睈",7,"睒",7,"睜薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳"], +["b240","睝睞睟睠睤睧睩睪睭",11,"睺睻睼瞁瞂瞃瞆",5,"瞏瞐瞓",11,"瞡瞣瞤瞦瞨瞫瞭瞮瞯瞱瞲瞴瞶",4], +["b280","瞼瞾矀",12,"矎",8,"矘矙矚矝",4,"矤病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖"], +["b340","矦矨矪矯矰矱矲矴矵矷矹矺矻矼砃",5,"砊砋砎砏砐砓砕砙砛砞砠砡砢砤砨砪砫砮砯砱砲砳砵砶砽砿硁硂硃硄硆硈硉硊硋硍硏硑硓硔硘硙硚"], +["b380","硛硜硞",11,"硯",7,"硸硹硺硻硽",6,"场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚"], +["b440","碄碅碆碈碊碋碏碐碒碔碕碖碙碝碞碠碢碤碦碨",7,"碵碶碷碸確碻碼碽碿磀磂磃磄磆磇磈磌磍磎磏磑磒磓磖磗磘磚",9], +["b480","磤磥磦磧磩磪磫磭",4,"磳磵磶磸磹磻",5,"礂礃礄礆",6,"础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮"], +["b540","礍",5,"礔",9,"礟",4,"礥",14,"礵",4,"礽礿祂祃祄祅祇祊",8,"祔祕祘祙祡祣"], +["b580","祤祦祩祪祫祬祮祰",6,"祹祻",4,"禂禃禆禇禈禉禋禌禍禎禐禑禒怠耽担丹单郸掸胆旦氮但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟蝶迭谍叠"], +["b640","禓",6,"禛",11,"禨",10,"禴",4,"禼禿秂秄秅秇秈秊秌秎秏秐秓秔秖秗秙",5,"秠秡秢秥秨秪"], +["b680","秬秮秱",6,"秹秺秼秾秿稁稄稅稇稈稉稊稌稏",4,"稕稖稘稙稛稜丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二"], +["b740","稝稟稡稢稤",14,"稴稵稶稸稺稾穀",5,"穇",9,"穒",4,"穘",16], +["b780","穩",6,"穱穲穳穵穻穼穽穾窂窅窇窉窊窋窌窎窏窐窓窔窙窚窛窞窡窢贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服"], +["b840","窣窤窧窩窪窫窮",4,"窴",10,"竀",10,"竌",9,"竗竘竚竛竜竝竡竢竤竧",5,"竮竰竱竲竳"], +["b880","竴",4,"竻竼竾笀笁笂笅笇笉笌笍笎笐笒笓笖笗笘笚笜笝笟笡笢笣笧笩笭浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹"], +["b940","笯笰笲笴笵笶笷笹笻笽笿",5,"筆筈筊筍筎筓筕筗筙筜筞筟筡筣",10,"筯筰筳筴筶筸筺筼筽筿箁箂箃箄箆",6,"箎箏"], +["b980","箑箒箓箖箘箙箚箛箞箟箠箣箤箥箮箯箰箲箳箵箶箷箹",7,"篂篃範埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈"], +["ba40","篅篈築篊篋篍篎篏篐篒篔",4,"篛篜篞篟篠篢篣篤篧篨篩篫篬篭篯篰篲",4,"篸篹篺篻篽篿",7,"簈簉簊簍簎簐",5,"簗簘簙"], +["ba80","簚",4,"簠",5,"簨簩簫",12,"簹",5,"籂骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖"], +["bb40","籃",9,"籎",36,"籵",5,"籾",9], +["bb80","粈粊",6,"粓粔粖粙粚粛粠粡粣粦粧粨粩粫粬粭粯粰粴",4,"粺粻弧虎唬护互沪户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸击圾基机畸稽积箕"], +["bc40","粿糀糂糃糄糆糉糋糎",6,"糘糚糛糝糞糡",6,"糩",5,"糰",7,"糹糺糼",13,"紋",5], +["bc80","紑",14,"紡紣紤紥紦紨紩紪紬紭紮細",6,"肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件"], +["bd40","紷",54,"絯",7], +["bd80","絸",32,"健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸"], +["be40","継",12,"綧",6,"綯",42], +["be80","線",32,"尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻"], +["bf40","緻",62], +["bf80","縺縼",4,"繂",4,"繈",21,"俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀"], +["c040","繞",35,"纃",23,"纜纝纞"], +["c080","纮纴纻纼绖绤绬绹缊缐缞缷缹缻",6,"罃罆",9,"罒罓馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐"], +["c140","罖罙罛罜罝罞罠罣",4,"罫罬罭罯罰罳罵罶罷罸罺罻罼罽罿羀羂",7,"羋羍羏",4,"羕",4,"羛羜羠羢羣羥羦羨",6,"羱"], +["c180","羳",4,"羺羻羾翀翂翃翄翆翇翈翉翋翍翏",4,"翖翗翙",5,"翢翣痢立粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫馏留刘瘤流柳六龙聋咙笼窿"], +["c240","翤翧翨翪翫翬翭翯翲翴",6,"翽翾翿耂耇耈耉耊耎耏耑耓耚耛耝耞耟耡耣耤耫",5,"耲耴耹耺耼耾聀聁聄聅聇聈聉聎聏聐聑聓聕聖聗"], +["c280","聙聛",13,"聫",5,"聲",11,"隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫"], +["c340","聾肁肂肅肈肊肍",5,"肔肕肗肙肞肣肦肧肨肬肰肳肵肶肸肹肻胅胇",4,"胏",6,"胘胟胠胢胣胦胮胵胷胹胻胾胿脀脁脃脄脅脇脈脋"], +["c380","脌脕脗脙脛脜脝脟",12,"脭脮脰脳脴脵脷脹",4,"脿谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸"], +["c440","腀",5,"腇腉腍腎腏腒腖腗腘腛",4,"腡腢腣腤腦腨腪腫腬腯腲腳腵腶腷腸膁膃",4,"膉膋膌膍膎膐膒",5,"膙膚膞",4,"膤膥"], +["c480","膧膩膫",7,"膴",5,"膼膽膾膿臄臅臇臈臉臋臍",6,"摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁"], +["c540","臔",14,"臤臥臦臨臩臫臮",4,"臵",5,"臽臿舃與",4,"舎舏舑舓舕",5,"舝舠舤舥舦舧舩舮舲舺舼舽舿"], +["c580","艀艁艂艃艅艆艈艊艌艍艎艐",7,"艙艛艜艝艞艠",7,"艩拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗"], +["c640","艪艫艬艭艱艵艶艷艸艻艼芀芁芃芅芆芇芉芌芐芓芔芕芖芚芛芞芠芢芣芧芲芵芶芺芻芼芿苀苂苃苅苆苉苐苖苙苚苝苢苧苨苩苪苬苭苮苰苲苳苵苶苸"], +["c680","苺苼",4,"茊茋茍茐茒茓茖茘茙茝",9,"茩茪茮茰茲茷茻茽啤脾疲皮匹痞僻屁譬篇偏片骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣讫掐"], +["c740","茾茿荁荂荄荅荈荊",4,"荓荕",4,"荝荢荰",6,"荹荺荾",6,"莇莈莊莋莌莍莏莐莑莔莕莖莗莙莚莝莟莡",6,"莬莭莮"], +["c780","莯莵莻莾莿菂菃菄菆菈菉菋菍菎菐菑菒菓菕菗菙菚菛菞菢菣菤菦菧菨菫菬菭恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠"], +["c840","菮華菳",4,"菺菻菼菾菿萀萂萅萇萈萉萊萐萒",5,"萙萚萛萞",5,"萩",7,"萲",5,"萹萺萻萾",7,"葇葈葉"], +["c880","葊",6,"葒",4,"葘葝葞葟葠葢葤",4,"葪葮葯葰葲葴葷葹葻葼取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁"], +["c940","葽",4,"蒃蒄蒅蒆蒊蒍蒏",7,"蒘蒚蒛蒝蒞蒟蒠蒢",12,"蒰蒱蒳蒵蒶蒷蒻蒼蒾蓀蓂蓃蓅蓆蓇蓈蓋蓌蓎蓏蓒蓔蓕蓗"], +["c980","蓘",4,"蓞蓡蓢蓤蓧",4,"蓭蓮蓯蓱",10,"蓽蓾蔀蔁蔂伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳"], +["ca40","蔃",8,"蔍蔎蔏蔐蔒蔔蔕蔖蔘蔙蔛蔜蔝蔞蔠蔢",8,"蔭",9,"蔾",4,"蕄蕅蕆蕇蕋",10], +["ca80","蕗蕘蕚蕛蕜蕝蕟",4,"蕥蕦蕧蕩",8,"蕳蕵蕶蕷蕸蕼蕽蕿薀薁省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱"], +["cb40","薂薃薆薈",6,"薐",10,"薝",6,"薥薦薧薩薫薬薭薱",5,"薸薺",6,"藂",6,"藊",4,"藑藒"], +["cb80","藔藖",5,"藝",6,"藥藦藧藨藪",14,"恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔"], +["cc40","藹藺藼藽藾蘀",4,"蘆",10,"蘒蘓蘔蘕蘗",15,"蘨蘪",13,"蘹蘺蘻蘽蘾蘿虀"], +["cc80","虁",11,"虒虓處",4,"虛虜虝號虠虡虣",7,"獭挞蹋踏胎苔抬台泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳贴铁帖厅听烃"], +["cd40","虭虯虰虲",6,"蚃",6,"蚎",4,"蚔蚖",5,"蚞",4,"蚥蚦蚫蚭蚮蚲蚳蚷蚸蚹蚻",4,"蛁蛂蛃蛅蛈蛌蛍蛒蛓蛕蛖蛗蛚蛜"], +["cd80","蛝蛠蛡蛢蛣蛥蛦蛧蛨蛪蛫蛬蛯蛵蛶蛷蛺蛻蛼蛽蛿蜁蜄蜅蜆蜋蜌蜎蜏蜐蜑蜔蜖汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威"], +["ce40","蜙蜛蜝蜟蜠蜤蜦蜧蜨蜪蜫蜬蜭蜯蜰蜲蜳蜵蜶蜸蜹蜺蜼蜽蝀",6,"蝊蝋蝍蝏蝐蝑蝒蝔蝕蝖蝘蝚",5,"蝡蝢蝦",7,"蝯蝱蝲蝳蝵"], +["ce80","蝷蝸蝹蝺蝿螀螁螄螆螇螉螊螌螎",4,"螔螕螖螘",6,"螠",4,"巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺"], +["cf40","螥螦螧螩螪螮螰螱螲螴螶螷螸螹螻螼螾螿蟁",4,"蟇蟈蟉蟌",4,"蟔",6,"蟜蟝蟞蟟蟡蟢蟣蟤蟦蟧蟨蟩蟫蟬蟭蟯",9], +["cf80","蟺蟻蟼蟽蟿蠀蠁蠂蠄",5,"蠋",7,"蠔蠗蠘蠙蠚蠜",4,"蠣稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓"], +["d040","蠤",13,"蠳",5,"蠺蠻蠽蠾蠿衁衂衃衆",5,"衎",5,"衕衖衘衚",6,"衦衧衪衭衯衱衳衴衵衶衸衹衺"], +["d080","衻衼袀袃袆袇袉袊袌袎袏袐袑袓袔袕袗",4,"袝",4,"袣袥",5,"小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄"], +["d140","袬袮袯袰袲",4,"袸袹袺袻袽袾袿裀裃裄裇裈裊裋裌裍裏裐裑裓裖裗裚",4,"裠裡裦裧裩",6,"裲裵裶裷裺裻製裿褀褁褃",5], +["d180","褉褋",4,"褑褔",4,"褜",4,"褢褣褤褦褧褨褩褬褭褮褯褱褲褳褵褷选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶"], +["d240","褸",8,"襂襃襅",24,"襠",5,"襧",19,"襼"], +["d280","襽襾覀覂覄覅覇",26,"摇尧遥窑谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音阴姻吟银淫寅饮尹引隐"], +["d340","覢",30,"觃觍觓觔觕觗觘觙觛觝觟觠觡觢觤觧觨觩觪觬觭觮觰觱觲觴",6], +["d380","觻",4,"訁",5,"計",21,"印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉"], +["d440","訞",31,"訿",8,"詉",21], +["d480","詟",25,"詺",6,"浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧"], +["d540","誁",7,"誋",7,"誔",46], +["d580","諃",32,"铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政"], +["d640","諤",34,"謈",27], +["d680","謤謥謧",30,"帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑"], +["d740","譆",31,"譧",4,"譭",25], +["d780","讇",24,"讬讱讻诇诐诪谉谞住注祝驻抓爪拽专砖转撰赚篆桩庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"], +["d840","谸",8,"豂豃豄豅豈豊豋豍",7,"豖豗豘豙豛",5,"豣",6,"豬",6,"豴豵豶豷豻",6,"貃貄貆貇"], +["d880","貈貋貍",6,"貕貖貗貙",20,"亍丌兀丐廿卅丕亘丞鬲孬噩丨禺丿匕乇夭爻卮氐囟胤馗毓睾鼗丶亟鼐乜乩亓芈孛啬嘏仄厍厝厣厥厮靥赝匚叵匦匮匾赜卦卣刂刈刎刭刳刿剀剌剞剡剜蒯剽劂劁劐劓冂罔亻仃仉仂仨仡仫仞伛仳伢佤仵伥伧伉伫佞佧攸佚佝"], +["d940","貮",62], +["d980","賭",32,"佟佗伲伽佶佴侑侉侃侏佾佻侪佼侬侔俦俨俪俅俚俣俜俑俟俸倩偌俳倬倏倮倭俾倜倌倥倨偾偃偕偈偎偬偻傥傧傩傺僖儆僭僬僦僮儇儋仝氽佘佥俎龠汆籴兮巽黉馘冁夔勹匍訇匐凫夙兕亠兖亳衮袤亵脔裒禀嬴蠃羸冫冱冽冼"], +["da40","贎",14,"贠赑赒赗赟赥赨赩赪赬赮赯赱赲赸",8,"趂趃趆趇趈趉趌",4,"趒趓趕",9,"趠趡"], +["da80","趢趤",12,"趲趶趷趹趻趽跀跁跂跅跇跈跉跊跍跐跒跓跔凇冖冢冥讠讦讧讪讴讵讷诂诃诋诏诎诒诓诔诖诘诙诜诟诠诤诨诩诮诰诳诶诹诼诿谀谂谄谇谌谏谑谒谔谕谖谙谛谘谝谟谠谡谥谧谪谫谮谯谲谳谵谶卩卺阝阢阡阱阪阽阼陂陉陔陟陧陬陲陴隈隍隗隰邗邛邝邙邬邡邴邳邶邺"], +["db40","跕跘跙跜跠跡跢跥跦跧跩跭跮跰跱跲跴跶跼跾",6,"踆踇踈踋踍踎踐踑踒踓踕",7,"踠踡踤",4,"踫踭踰踲踳踴踶踷踸踻踼踾"], +["db80","踿蹃蹅蹆蹌",4,"蹓",5,"蹚",11,"蹧蹨蹪蹫蹮蹱邸邰郏郅邾郐郄郇郓郦郢郜郗郛郫郯郾鄄鄢鄞鄣鄱鄯鄹酃酆刍奂劢劬劭劾哿勐勖勰叟燮矍廴凵凼鬯厶弁畚巯坌垩垡塾墼壅壑圩圬圪圳圹圮圯坜圻坂坩垅坫垆坼坻坨坭坶坳垭垤垌垲埏垧垴垓垠埕埘埚埙埒垸埴埯埸埤埝"], +["dc40","蹳蹵蹷",4,"蹽蹾躀躂躃躄躆躈",6,"躑躒躓躕",6,"躝躟",11,"躭躮躰躱躳",6,"躻",7], +["dc80","軃",10,"軏",21,"堋堍埽埭堀堞堙塄堠塥塬墁墉墚墀馨鼙懿艹艽艿芏芊芨芄芎芑芗芙芫芸芾芰苈苊苣芘芷芮苋苌苁芩芴芡芪芟苄苎芤苡茉苷苤茏茇苜苴苒苘茌苻苓茑茚茆茔茕苠苕茜荑荛荜茈莒茼茴茱莛荞茯荏荇荃荟荀茗荠茭茺茳荦荥"], +["dd40","軥",62], +["dd80","輤",32,"荨茛荩荬荪荭荮莰荸莳莴莠莪莓莜莅荼莶莩荽莸荻莘莞莨莺莼菁萁菥菘堇萘萋菝菽菖萜萸萑萆菔菟萏萃菸菹菪菅菀萦菰菡葜葑葚葙葳蒇蒈葺蒉葸萼葆葩葶蒌蒎萱葭蓁蓍蓐蓦蒽蓓蓊蒿蒺蓠蒡蒹蒴蒗蓥蓣蔌甍蔸蓰蔹蔟蔺"], +["de40","轅",32,"轪辀辌辒辝辠辡辢辤辥辦辧辪辬辭辮辯農辳辴辵辷辸辺辻込辿迀迃迆"], +["de80","迉",4,"迏迒迖迗迚迠迡迣迧迬迯迱迲迴迵迶迺迻迼迾迿逇逈逌逎逓逕逘蕖蔻蓿蓼蕙蕈蕨蕤蕞蕺瞢蕃蕲蕻薤薨薇薏蕹薮薜薅薹薷薰藓藁藜藿蘧蘅蘩蘖蘼廾弈夼奁耷奕奚奘匏尢尥尬尴扌扪抟抻拊拚拗拮挢拶挹捋捃掭揶捱捺掎掴捭掬掊捩掮掼揲揸揠揿揄揞揎摒揆掾摅摁搋搛搠搌搦搡摞撄摭撖"], +["df40","這逜連逤逥逧",5,"逰",4,"逷逹逺逽逿遀遃遅遆遈",4,"過達違遖遙遚遜",5,"遤遦遧適遪遫遬遯",4,"遶",6,"遾邁"], +["df80","還邅邆邇邉邊邌",4,"邒邔邖邘邚邜邞邟邠邤邥邧邨邩邫邭邲邷邼邽邿郀摺撷撸撙撺擀擐擗擤擢攉攥攮弋忒甙弑卟叱叽叩叨叻吒吖吆呋呒呓呔呖呃吡呗呙吣吲咂咔呷呱呤咚咛咄呶呦咝哐咭哂咴哒咧咦哓哔呲咣哕咻咿哌哙哚哜咩咪咤哝哏哞唛哧唠哽唔哳唢唣唏唑唧唪啧喏喵啉啭啁啕唿啐唼"], +["e040","郂郃郆郈郉郋郌郍郒郔郕郖郘郙郚郞郟郠郣郤郥郩郪郬郮郰郱郲郳郵郶郷郹郺郻郼郿鄀鄁鄃鄅",19,"鄚鄛鄜"], +["e080","鄝鄟鄠鄡鄤",10,"鄰鄲",6,"鄺",8,"酄唷啖啵啶啷唳唰啜喋嗒喃喱喹喈喁喟啾嗖喑啻嗟喽喾喔喙嗪嗷嗉嘟嗑嗫嗬嗔嗦嗝嗄嗯嗥嗲嗳嗌嗍嗨嗵嗤辔嘞嘈嘌嘁嘤嘣嗾嘀嘧嘭噘嘹噗嘬噍噢噙噜噌噔嚆噤噱噫噻噼嚅嚓嚯囔囗囝囡囵囫囹囿圄圊圉圜帏帙帔帑帱帻帼"], +["e140","酅酇酈酑酓酔酕酖酘酙酛酜酟酠酦酧酨酫酭酳酺酻酼醀",4,"醆醈醊醎醏醓",6,"醜",5,"醤",5,"醫醬醰醱醲醳醶醷醸醹醻"], +["e180","醼",10,"釈釋釐釒",9,"針",8,"帷幄幔幛幞幡岌屺岍岐岖岈岘岙岑岚岜岵岢岽岬岫岱岣峁岷峄峒峤峋峥崂崃崧崦崮崤崞崆崛嵘崾崴崽嵬嵛嵯嵝嵫嵋嵊嵩嵴嶂嶙嶝豳嶷巅彳彷徂徇徉後徕徙徜徨徭徵徼衢彡犭犰犴犷犸狃狁狎狍狒狨狯狩狲狴狷猁狳猃狺"], +["e240","釦",62], +["e280","鈥",32,"狻猗猓猡猊猞猝猕猢猹猥猬猸猱獐獍獗獠獬獯獾舛夥飧夤夂饣饧",5,"饴饷饽馀馄馇馊馍馐馑馓馔馕庀庑庋庖庥庠庹庵庾庳赓廒廑廛廨廪膺忄忉忖忏怃忮怄忡忤忾怅怆忪忭忸怙怵怦怛怏怍怩怫怊怿怡恸恹恻恺恂"], +["e340","鉆",45,"鉵",16], +["e380","銆",7,"銏",24,"恪恽悖悚悭悝悃悒悌悛惬悻悱惝惘惆惚悴愠愦愕愣惴愀愎愫慊慵憬憔憧憷懔懵忝隳闩闫闱闳闵闶闼闾阃阄阆阈阊阋阌阍阏阒阕阖阗阙阚丬爿戕氵汔汜汊沣沅沐沔沌汨汩汴汶沆沩泐泔沭泷泸泱泗沲泠泖泺泫泮沱泓泯泾"], +["e440","銨",5,"銯",24,"鋉",31], +["e480","鋩",32,"洹洧洌浃浈洇洄洙洎洫浍洮洵洚浏浒浔洳涑浯涞涠浞涓涔浜浠浼浣渚淇淅淞渎涿淠渑淦淝淙渖涫渌涮渫湮湎湫溲湟溆湓湔渲渥湄滟溱溘滠漭滢溥溧溽溻溷滗溴滏溏滂溟潢潆潇漤漕滹漯漶潋潴漪漉漩澉澍澌潸潲潼潺濑"], +["e540","錊",51,"錿",10], +["e580","鍊",31,"鍫濉澧澹澶濂濡濮濞濠濯瀚瀣瀛瀹瀵灏灞宀宄宕宓宥宸甯骞搴寤寮褰寰蹇謇辶迓迕迥迮迤迩迦迳迨逅逄逋逦逑逍逖逡逵逶逭逯遄遑遒遐遨遘遢遛暹遴遽邂邈邃邋彐彗彖彘尻咫屐屙孱屣屦羼弪弩弭艴弼鬻屮妁妃妍妩妪妣"], +["e640","鍬",34,"鎐",27], +["e680","鎬",29,"鏋鏌鏍妗姊妫妞妤姒妲妯姗妾娅娆姝娈姣姘姹娌娉娲娴娑娣娓婀婧婊婕娼婢婵胬媪媛婷婺媾嫫媲嫒嫔媸嫠嫣嫱嫖嫦嫘嫜嬉嬗嬖嬲嬷孀尕尜孚孥孳孑孓孢驵驷驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟纡纣纥纨纩"], +["e740","鏎",7,"鏗",54], +["e780","鐎",32,"纭纰纾绀绁绂绉绋绌绐绔绗绛绠绡绨绫绮绯绱绲缍绶绺绻绾缁缂缃缇缈缋缌缏缑缒缗缙缜缛缟缡",6,"缪缫缬缭缯",4,"缵幺畿巛甾邕玎玑玮玢玟珏珂珑玷玳珀珉珈珥珙顼琊珩珧珞玺珲琏琪瑛琦琥琨琰琮琬"], +["e840","鐯",14,"鐿",43,"鑬鑭鑮鑯"], +["e880","鑰",20,"钑钖钘铇铏铓铔铚铦铻锜锠琛琚瑁瑜瑗瑕瑙瑷瑭瑾璜璎璀璁璇璋璞璨璩璐璧瓒璺韪韫韬杌杓杞杈杩枥枇杪杳枘枧杵枨枞枭枋杷杼柰栉柘栊柩枰栌柙枵柚枳柝栀柃枸柢栎柁柽栲栳桠桡桎桢桄桤梃栝桕桦桁桧桀栾桊桉栩梵梏桴桷梓桫棂楮棼椟椠棹"], +["e940","锧锳锽镃镈镋镕镚镠镮镴镵長",7,"門",42], +["e980","閫",32,"椤棰椋椁楗棣椐楱椹楠楂楝榄楫榀榘楸椴槌榇榈槎榉楦楣楹榛榧榻榫榭槔榱槁槊槟榕槠榍槿樯槭樗樘橥槲橄樾檠橐橛樵檎橹樽樨橘橼檑檐檩檗檫猷獒殁殂殇殄殒殓殍殚殛殡殪轫轭轱轲轳轵轶轸轷轹轺轼轾辁辂辄辇辋"], +["ea40","闌",27,"闬闿阇阓阘阛阞阠阣",6,"阫阬阭阯阰阷阸阹阺阾陁陃陊陎陏陑陒陓陖陗"], +["ea80","陘陙陚陜陝陞陠陣陥陦陫陭",4,"陳陸",12,"隇隉隊辍辎辏辘辚軎戋戗戛戟戢戡戥戤戬臧瓯瓴瓿甏甑甓攴旮旯旰昊昙杲昃昕昀炅曷昝昴昱昶昵耆晟晔晁晏晖晡晗晷暄暌暧暝暾曛曜曦曩贲贳贶贻贽赀赅赆赈赉赇赍赕赙觇觊觋觌觎觏觐觑牮犟牝牦牯牾牿犄犋犍犏犒挈挲掰"], +["eb40","隌階隑隒隓隕隖隚際隝",9,"隨",7,"隱隲隴隵隷隸隺隻隿雂雃雈雊雋雐雑雓雔雖",9,"雡",6,"雫"], +["eb80","雬雭雮雰雱雲雴雵雸雺電雼雽雿霂霃霅霊霋霌霐霑霒霔霕霗",4,"霝霟霠搿擘耄毪毳毽毵毹氅氇氆氍氕氘氙氚氡氩氤氪氲攵敕敫牍牒牖爰虢刖肟肜肓肼朊肽肱肫肭肴肷胧胨胩胪胛胂胄胙胍胗朐胝胫胱胴胭脍脎胲胼朕脒豚脶脞脬脘脲腈腌腓腴腙腚腱腠腩腼腽腭腧塍媵膈膂膑滕膣膪臌朦臊膻"], +["ec40","霡",8,"霫霬霮霯霱霳",4,"霺霻霼霽霿",18,"靔靕靗靘靚靜靝靟靣靤靦靧靨靪",7], +["ec80","靲靵靷",4,"靽",7,"鞆",4,"鞌鞎鞏鞐鞓鞕鞖鞗鞙",4,"臁膦欤欷欹歃歆歙飑飒飓飕飙飚殳彀毂觳斐齑斓於旆旄旃旌旎旒旖炀炜炖炝炻烀炷炫炱烨烊焐焓焖焯焱煳煜煨煅煲煊煸煺熘熳熵熨熠燠燔燧燹爝爨灬焘煦熹戾戽扃扈扉礻祀祆祉祛祜祓祚祢祗祠祯祧祺禅禊禚禧禳忑忐"], +["ed40","鞞鞟鞡鞢鞤",6,"鞬鞮鞰鞱鞳鞵",46], +["ed80","韤韥韨韮",4,"韴韷",23,"怼恝恚恧恁恙恣悫愆愍慝憩憝懋懑戆肀聿沓泶淼矶矸砀砉砗砘砑斫砭砜砝砹砺砻砟砼砥砬砣砩硎硭硖硗砦硐硇硌硪碛碓碚碇碜碡碣碲碹碥磔磙磉磬磲礅磴礓礤礞礴龛黹黻黼盱眄眍盹眇眈眚眢眙眭眦眵眸睐睑睇睃睚睨"], +["ee40","頏",62], +["ee80","顎",32,"睢睥睿瞍睽瞀瞌瞑瞟瞠瞰瞵瞽町畀畎畋畈畛畲畹疃罘罡罟詈罨罴罱罹羁罾盍盥蠲钅钆钇钋钊钌钍钏钐钔钗钕钚钛钜钣钤钫钪钭钬钯钰钲钴钶",4,"钼钽钿铄铈",6,"铐铑铒铕铖铗铙铘铛铞铟铠铢铤铥铧铨铪"], +["ef40","顯",5,"颋颎颒颕颙颣風",37,"飏飐飔飖飗飛飜飝飠",4], +["ef80","飥飦飩",30,"铩铫铮铯铳铴铵铷铹铼铽铿锃锂锆锇锉锊锍锎锏锒",4,"锘锛锝锞锟锢锪锫锩锬锱锲锴锶锷锸锼锾锿镂锵镄镅镆镉镌镎镏镒镓镔镖镗镘镙镛镞镟镝镡镢镤",8,"镯镱镲镳锺矧矬雉秕秭秣秫稆嵇稃稂稞稔"], +["f040","餈",4,"餎餏餑",28,"餯",26], +["f080","饊",9,"饖",12,"饤饦饳饸饹饻饾馂馃馉稹稷穑黏馥穰皈皎皓皙皤瓞瓠甬鸠鸢鸨",4,"鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦",6,"鹱鹭鹳疒疔疖疠疝疬疣疳疴疸痄疱疰痃痂痖痍痣痨痦痤痫痧瘃痱痼痿瘐瘀瘅瘌瘗瘊瘥瘘瘕瘙"], +["f140","馌馎馚",10,"馦馧馩",47], +["f180","駙",32,"瘛瘼瘢瘠癀瘭瘰瘿瘵癃瘾瘳癍癞癔癜癖癫癯翊竦穸穹窀窆窈窕窦窠窬窨窭窳衤衩衲衽衿袂袢裆袷袼裉裢裎裣裥裱褚裼裨裾裰褡褙褓褛褊褴褫褶襁襦襻疋胥皲皴矜耒耔耖耜耠耢耥耦耧耩耨耱耋耵聃聆聍聒聩聱覃顸颀颃"], +["f240","駺",62], +["f280","騹",32,"颉颌颍颏颔颚颛颞颟颡颢颥颦虍虔虬虮虿虺虼虻蚨蚍蚋蚬蚝蚧蚣蚪蚓蚩蚶蛄蚵蛎蚰蚺蚱蚯蛉蛏蚴蛩蛱蛲蛭蛳蛐蜓蛞蛴蛟蛘蛑蜃蜇蛸蜈蜊蜍蜉蜣蜻蜞蜥蜮蜚蜾蝈蜴蜱蜩蜷蜿螂蜢蝽蝾蝻蝠蝰蝌蝮螋蝓蝣蝼蝤蝙蝥螓螯螨蟒"], +["f340","驚",17,"驲骃骉骍骎骔骕骙骦骩",6,"骲骳骴骵骹骻骽骾骿髃髄髆",4,"髍髎髏髐髒體髕髖髗髙髚髛髜"], +["f380","髝髞髠髢髣髤髥髧髨髩髪髬髮髰",8,"髺髼",6,"鬄鬅鬆蟆螈螅螭螗螃螫蟥螬螵螳蟋蟓螽蟑蟀蟊蟛蟪蟠蟮蠖蠓蟾蠊蠛蠡蠹蠼缶罂罄罅舐竺竽笈笃笄笕笊笫笏筇笸笪笙笮笱笠笥笤笳笾笞筘筚筅筵筌筝筠筮筻筢筲筱箐箦箧箸箬箝箨箅箪箜箢箫箴篑篁篌篝篚篥篦篪簌篾篼簏簖簋"], +["f440","鬇鬉",5,"鬐鬑鬒鬔",10,"鬠鬡鬢鬤",10,"鬰鬱鬳",7,"鬽鬾鬿魀魆魊魋魌魎魐魒魓魕",5], +["f480","魛",32,"簟簪簦簸籁籀臾舁舂舄臬衄舡舢舣舭舯舨舫舸舻舳舴舾艄艉艋艏艚艟艨衾袅袈裘裟襞羝羟羧羯羰羲籼敉粑粝粜粞粢粲粼粽糁糇糌糍糈糅糗糨艮暨羿翎翕翥翡翦翩翮翳糸絷綦綮繇纛麸麴赳趄趔趑趱赧赭豇豉酊酐酎酏酤"], +["f540","魼",62], +["f580","鮻",32,"酢酡酰酩酯酽酾酲酴酹醌醅醐醍醑醢醣醪醭醮醯醵醴醺豕鹾趸跫踅蹙蹩趵趿趼趺跄跖跗跚跞跎跏跛跆跬跷跸跣跹跻跤踉跽踔踝踟踬踮踣踯踺蹀踹踵踽踱蹉蹁蹂蹑蹒蹊蹰蹶蹼蹯蹴躅躏躔躐躜躞豸貂貊貅貘貔斛觖觞觚觜"], +["f640","鯜",62], +["f680","鰛",32,"觥觫觯訾謦靓雩雳雯霆霁霈霏霎霪霭霰霾龀龃龅",5,"龌黾鼋鼍隹隼隽雎雒瞿雠銎銮鋈錾鍪鏊鎏鐾鑫鱿鲂鲅鲆鲇鲈稣鲋鲎鲐鲑鲒鲔鲕鲚鲛鲞",5,"鲥",4,"鲫鲭鲮鲰",7,"鲺鲻鲼鲽鳄鳅鳆鳇鳊鳋"], +["f740","鰼",62], +["f780","鱻鱽鱾鲀鲃鲄鲉鲊鲌鲏鲓鲖鲗鲘鲙鲝鲪鲬鲯鲹鲾",4,"鳈鳉鳑鳒鳚鳛鳠鳡鳌",4,"鳓鳔鳕鳗鳘鳙鳜鳝鳟鳢靼鞅鞑鞒鞔鞯鞫鞣鞲鞴骱骰骷鹘骶骺骼髁髀髅髂髋髌髑魅魃魇魉魈魍魑飨餍餮饕饔髟髡髦髯髫髻髭髹鬈鬏鬓鬟鬣麽麾縻麂麇麈麋麒鏖麝麟黛黜黝黠黟黢黩黧黥黪黯鼢鼬鼯鼹鼷鼽鼾齄"], +["f840","鳣",62], +["f880","鴢",32], +["f940","鵃",62], +["f980","鶂",32], +["fa40","鶣",62], +["fa80","鷢",32], +["fb40","鸃",27,"鸤鸧鸮鸰鸴鸻鸼鹀鹍鹐鹒鹓鹔鹖鹙鹝鹟鹠鹡鹢鹥鹮鹯鹲鹴",9,"麀"], +["fb80","麁麃麄麅麆麉麊麌",5,"麔",8,"麞麠",5,"麧麨麩麪"], +["fc40","麫",8,"麵麶麷麹麺麼麿",4,"黅黆黇黈黊黋黌黐黒黓黕黖黗黙黚點黡黣黤黦黨黫黬黭黮黰",8,"黺黽黿",6], +["fc80","鼆",4,"鼌鼏鼑鼒鼔鼕鼖鼘鼚",5,"鼡鼣",8,"鼭鼮鼰鼱"], +["fd40","鼲",4,"鼸鼺鼼鼿",4,"齅",10,"齒",38], +["fd80","齹",5,"龁龂龍",11,"龜龝龞龡",4,"郎凉秊裏隣"], +["fe40","兀嗀﨎﨏﨑﨓﨔礼﨟蘒﨡﨣﨤﨧﨨﨩"] +] diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp949.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp949.json new file mode 100644 index 0000000..2022a00 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp949.json @@ -0,0 +1,273 @@ +[ +["0","\u0000",127], +["8141","갂갃갅갆갋",4,"갘갞갟갡갢갣갥",6,"갮갲갳갴"], +["8161","갵갶갷갺갻갽갾갿걁",9,"걌걎",5,"걕"], +["8181","걖걗걙걚걛걝",18,"걲걳걵걶걹걻",4,"겂겇겈겍겎겏겑겒겓겕",6,"겞겢",5,"겫겭겮겱",6,"겺겾겿곀곂곃곅곆곇곉곊곋곍",7,"곖곘",7,"곢곣곥곦곩곫곭곮곲곴곷",4,"곾곿괁괂괃괅괇",4,"괎괐괒괓"], +["8241","괔괕괖괗괙괚괛괝괞괟괡",7,"괪괫괮",5], +["8261","괶괷괹괺괻괽",6,"굆굈굊",5,"굑굒굓굕굖굗"], +["8281","굙",7,"굢굤",7,"굮굯굱굲굷굸굹굺굾궀궃",4,"궊궋궍궎궏궑",10,"궞",5,"궥",17,"궸",7,"귂귃귅귆귇귉",6,"귒귔",7,"귝귞귟귡귢귣귥",18], +["8341","귺귻귽귾긂",5,"긊긌긎",5,"긕",7], +["8361","긝",18,"긲긳긵긶긹긻긼"], +["8381","긽긾긿깂깄깇깈깉깋깏깑깒깓깕깗",4,"깞깢깣깤깦깧깪깫깭깮깯깱",6,"깺깾",5,"꺆",5,"꺍",46,"꺿껁껂껃껅",6,"껎껒",5,"껚껛껝",8], +["8441","껦껧껩껪껬껮",5,"껵껶껷껹껺껻껽",8], +["8461","꼆꼉꼊꼋꼌꼎꼏꼑",18], +["8481","꼤",7,"꼮꼯꼱꼳꼵",6,"꼾꽀꽄꽅꽆꽇꽊",5,"꽑",10,"꽞",5,"꽦",18,"꽺",5,"꾁꾂꾃꾅꾆꾇꾉",6,"꾒꾓꾔꾖",5,"꾝",26,"꾺꾻꾽꾾"], +["8541","꾿꿁",5,"꿊꿌꿏",4,"꿕",6,"꿝",4], +["8561","꿢",5,"꿪",5,"꿲꿳꿵꿶꿷꿹",6,"뀂뀃"], +["8581","뀅",6,"뀍뀎뀏뀑뀒뀓뀕",6,"뀞",9,"뀩",26,"끆끇끉끋끍끏끐끑끒끖끘끚끛끜끞",29,"끾끿낁낂낃낅",6,"낎낐낒",5,"낛낝낞낣낤"], +["8641","낥낦낧낪낰낲낶낷낹낺낻낽",6,"냆냊",5,"냒"], +["8661","냓냕냖냗냙",6,"냡냢냣냤냦",10], +["8681","냱",22,"넊넍넎넏넑넔넕넖넗넚넞",4,"넦넧넩넪넫넭",6,"넶넺",5,"녂녃녅녆녇녉",6,"녒녓녖녗녙녚녛녝녞녟녡",22,"녺녻녽녾녿놁놃",4,"놊놌놎놏놐놑놕놖놗놙놚놛놝"], +["8741","놞",9,"놩",15], +["8761","놹",18,"뇍뇎뇏뇑뇒뇓뇕"], +["8781","뇖",5,"뇞뇠",7,"뇪뇫뇭뇮뇯뇱",7,"뇺뇼뇾",5,"눆눇눉눊눍",6,"눖눘눚",5,"눡",18,"눵",6,"눽",26,"뉙뉚뉛뉝뉞뉟뉡",6,"뉪",4], +["8841","뉯",4,"뉶",5,"뉽",6,"늆늇늈늊",4], +["8861","늏늒늓늕늖늗늛",4,"늢늤늧늨늩늫늭늮늯늱늲늳늵늶늷"], +["8881","늸",15,"닊닋닍닎닏닑닓",4,"닚닜닞닟닠닡닣닧닩닪닰닱닲닶닼닽닾댂댃댅댆댇댉",6,"댒댖",5,"댝",54,"덗덙덚덝덠덡덢덣"], +["8941","덦덨덪덬덭덯덲덳덵덶덷덹",6,"뎂뎆",5,"뎍"], +["8961","뎎뎏뎑뎒뎓뎕",10,"뎢",5,"뎩뎪뎫뎭"], +["8981","뎮",21,"돆돇돉돊돍돏돑돒돓돖돘돚돜돞돟돡돢돣돥돦돧돩",18,"돽",18,"됑",6,"됙됚됛됝됞됟됡",6,"됪됬",7,"됵",15], +["8a41","둅",10,"둒둓둕둖둗둙",6,"둢둤둦"], +["8a61","둧",4,"둭",18,"뒁뒂"], +["8a81","뒃",4,"뒉",19,"뒞",5,"뒥뒦뒧뒩뒪뒫뒭",7,"뒶뒸뒺",5,"듁듂듃듅듆듇듉",6,"듑듒듓듔듖",5,"듞듟듡듢듥듧",4,"듮듰듲",5,"듹",26,"딖딗딙딚딝"], +["8b41","딞",5,"딦딫",4,"딲딳딵딶딷딹",6,"땂땆"], +["8b61","땇땈땉땊땎땏땑땒땓땕",6,"땞땢",8], +["8b81","땫",52,"떢떣떥떦떧떩떬떭떮떯떲떶",4,"떾떿뗁뗂뗃뗅",6,"뗎뗒",5,"뗙",18,"뗭",18], +["8c41","똀",15,"똒똓똕똖똗똙",4], +["8c61","똞",6,"똦",5,"똭",6,"똵",5], +["8c81","똻",12,"뙉",26,"뙥뙦뙧뙩",50,"뚞뚟뚡뚢뚣뚥",5,"뚭뚮뚯뚰뚲",16], +["8d41","뛃",16,"뛕",8], +["8d61","뛞",17,"뛱뛲뛳뛵뛶뛷뛹뛺"], +["8d81","뛻",4,"뜂뜃뜄뜆",33,"뜪뜫뜭뜮뜱",6,"뜺뜼",7,"띅띆띇띉띊띋띍",6,"띖",9,"띡띢띣띥띦띧띩",6,"띲띴띶",5,"띾띿랁랂랃랅",6,"랎랓랔랕랚랛랝랞"], +["8e41","랟랡",6,"랪랮",5,"랶랷랹",8], +["8e61","럂",4,"럈럊",19], +["8e81","럞",13,"럮럯럱럲럳럵",6,"럾렂",4,"렊렋렍렎렏렑",6,"렚렜렞",5,"렦렧렩렪렫렭",6,"렶렺",5,"롁롂롃롅",11,"롒롔",7,"롞롟롡롢롣롥",6,"롮롰롲",5,"롹롺롻롽",7], +["8f41","뢅",7,"뢎",17], +["8f61","뢠",7,"뢩",6,"뢱뢲뢳뢵뢶뢷뢹",4], +["8f81","뢾뢿룂룄룆",5,"룍룎룏룑룒룓룕",7,"룞룠룢",5,"룪룫룭룮룯룱",6,"룺룼룾",5,"뤅",18,"뤙",6,"뤡",26,"뤾뤿륁륂륃륅",6,"륍륎륐륒",5], +["9041","륚륛륝륞륟륡",6,"륪륬륮",5,"륶륷륹륺륻륽"], +["9061","륾",5,"릆릈릋릌릏",15], +["9081","릟",12,"릮릯릱릲릳릵",6,"릾맀맂",5,"맊맋맍맓",4,"맚맜맟맠맢맦맧맩맪맫맭",6,"맶맻",4,"먂",5,"먉",11,"먖",33,"먺먻먽먾먿멁멃멄멅멆"], +["9141","멇멊멌멏멐멑멒멖멗멙멚멛멝",6,"멦멪",5], +["9161","멲멳멵멶멷멹",9,"몆몈몉몊몋몍",5], +["9181","몓",20,"몪몭몮몯몱몳",4,"몺몼몾",5,"뫅뫆뫇뫉",14,"뫚",33,"뫽뫾뫿묁묂묃묅",7,"묎묐묒",5,"묙묚묛묝묞묟묡",6], +["9241","묨묪묬",7,"묷묹묺묿",4,"뭆뭈뭊뭋뭌뭎뭑뭒"], +["9261","뭓뭕뭖뭗뭙",7,"뭢뭤",7,"뭭",4], +["9281","뭲",21,"뮉뮊뮋뮍뮎뮏뮑",18,"뮥뮦뮧뮩뮪뮫뮭",6,"뮵뮶뮸",7,"믁믂믃믅믆믇믉",6,"믑믒믔",35,"믺믻믽믾밁"], +["9341","밃",4,"밊밎밐밒밓밙밚밠밡밢밣밦밨밪밫밬밮밯밲밳밵"], +["9361","밶밷밹",6,"뱂뱆뱇뱈뱊뱋뱎뱏뱑",8], +["9381","뱚뱛뱜뱞",37,"벆벇벉벊벍벏",4,"벖벘벛",4,"벢벣벥벦벩",6,"벲벶",5,"벾벿볁볂볃볅",7,"볎볒볓볔볖볗볙볚볛볝",22,"볷볹볺볻볽"], +["9441","볾",5,"봆봈봊",5,"봑봒봓봕",8], +["9461","봞",5,"봥",6,"봭",12], +["9481","봺",5,"뵁",6,"뵊뵋뵍뵎뵏뵑",6,"뵚",9,"뵥뵦뵧뵩",22,"붂붃붅붆붋",4,"붒붔붖붗붘붛붝",6,"붥",10,"붱",6,"붹",24], +["9541","뷒뷓뷖뷗뷙뷚뷛뷝",11,"뷪",5,"뷱"], +["9561","뷲뷳뷵뷶뷷뷹",6,"븁븂븄븆",5,"븎븏븑븒븓"], +["9581","븕",6,"븞븠",35,"빆빇빉빊빋빍빏",4,"빖빘빜빝빞빟빢빣빥빦빧빩빫",4,"빲빶",4,"빾빿뺁뺂뺃뺅",6,"뺎뺒",5,"뺚",13,"뺩",14], +["9641","뺸",23,"뻒뻓"], +["9661","뻕뻖뻙",6,"뻡뻢뻦",5,"뻭",8], +["9681","뻶",10,"뼂",5,"뼊",13,"뼚뼞",33,"뽂뽃뽅뽆뽇뽉",6,"뽒뽓뽔뽖",44], +["9741","뾃",16,"뾕",8], +["9761","뾞",17,"뾱",7], +["9781","뾹",11,"뿆",5,"뿎뿏뿑뿒뿓뿕",6,"뿝뿞뿠뿢",89,"쀽쀾쀿"], +["9841","쁀",16,"쁒",5,"쁙쁚쁛"], +["9861","쁝쁞쁟쁡",6,"쁪",15], +["9881","쁺",21,"삒삓삕삖삗삙",6,"삢삤삦",5,"삮삱삲삷",4,"삾샂샃샄샆샇샊샋샍샎샏샑",6,"샚샞",5,"샦샧샩샪샫샭",6,"샶샸샺",5,"섁섂섃섅섆섇섉",6,"섑섒섓섔섖",5,"섡섢섥섨섩섪섫섮"], +["9941","섲섳섴섵섷섺섻섽섾섿셁",6,"셊셎",5,"셖셗"], +["9961","셙셚셛셝",6,"셦셪",5,"셱셲셳셵셶셷셹셺셻"], +["9981","셼",8,"솆",5,"솏솑솒솓솕솗",4,"솞솠솢솣솤솦솧솪솫솭솮솯솱",11,"솾",5,"쇅쇆쇇쇉쇊쇋쇍",6,"쇕쇖쇙",6,"쇡쇢쇣쇥쇦쇧쇩",6,"쇲쇴",7,"쇾쇿숁숂숃숅",6,"숎숐숒",5,"숚숛숝숞숡숢숣"], +["9a41","숤숥숦숧숪숬숮숰숳숵",16], +["9a61","쉆쉇쉉",6,"쉒쉓쉕쉖쉗쉙",6,"쉡쉢쉣쉤쉦"], +["9a81","쉧",4,"쉮쉯쉱쉲쉳쉵",6,"쉾슀슂",5,"슊",5,"슑",6,"슙슚슜슞",5,"슦슧슩슪슫슮",5,"슶슸슺",33,"싞싟싡싢싥",5,"싮싰싲싳싴싵싷싺싽싾싿쌁",6,"쌊쌋쌎쌏"], +["9b41","쌐쌑쌒쌖쌗쌙쌚쌛쌝",6,"쌦쌧쌪",8], +["9b61","쌳",17,"썆",7], +["9b81","썎",25,"썪썫썭썮썯썱썳",4,"썺썻썾",5,"쎅쎆쎇쎉쎊쎋쎍",50,"쏁",22,"쏚"], +["9c41","쏛쏝쏞쏡쏣",4,"쏪쏫쏬쏮",5,"쏶쏷쏹",5], +["9c61","쏿",8,"쐉",6,"쐑",9], +["9c81","쐛",8,"쐥",6,"쐭쐮쐯쐱쐲쐳쐵",6,"쐾",9,"쑉",26,"쑦쑧쑩쑪쑫쑭",6,"쑶쑷쑸쑺",5,"쒁",18,"쒕",6,"쒝",12], +["9d41","쒪",13,"쒹쒺쒻쒽",8], +["9d61","쓆",25], +["9d81","쓠",8,"쓪",5,"쓲쓳쓵쓶쓷쓹쓻쓼쓽쓾씂",9,"씍씎씏씑씒씓씕",6,"씝",10,"씪씫씭씮씯씱",6,"씺씼씾",5,"앆앇앋앏앐앑앒앖앚앛앜앟앢앣앥앦앧앩",6,"앲앶",5,"앾앿얁얂얃얅얆얈얉얊얋얎얐얒얓얔"], +["9e41","얖얙얚얛얝얞얟얡",7,"얪",9,"얶"], +["9e61","얷얺얿",4,"엋엍엏엒엓엕엖엗엙",6,"엢엤엦엧"], +["9e81","엨엩엪엫엯엱엲엳엵엸엹엺엻옂옃옄옉옊옋옍옎옏옑",6,"옚옝",6,"옦옧옩옪옫옯옱옲옶옸옺옼옽옾옿왂왃왅왆왇왉",6,"왒왖",5,"왞왟왡",10,"왭왮왰왲",5,"왺왻왽왾왿욁",6,"욊욌욎",5,"욖욗욙욚욛욝",6,"욦"], +["9f41","욨욪",5,"욲욳욵욶욷욻",4,"웂웄웆",5,"웎"], +["9f61","웏웑웒웓웕",6,"웞웟웢",5,"웪웫웭웮웯웱웲"], +["9f81","웳",4,"웺웻웼웾",5,"윆윇윉윊윋윍",6,"윖윘윚",5,"윢윣윥윦윧윩",6,"윲윴윶윸윹윺윻윾윿읁읂읃읅",4,"읋읎읐읙읚읛읝읞읟읡",6,"읩읪읬",7,"읶읷읹읺읻읿잀잁잂잆잋잌잍잏잒잓잕잙잛",4,"잢잧",4,"잮잯잱잲잳잵잶잷"], +["a041","잸잹잺잻잾쟂",5,"쟊쟋쟍쟏쟑",6,"쟙쟚쟛쟜"], +["a061","쟞",5,"쟥쟦쟧쟩쟪쟫쟭",13], +["a081","쟻",4,"젂젃젅젆젇젉젋",4,"젒젔젗",4,"젞젟젡젢젣젥",6,"젮젰젲",5,"젹젺젻젽젾젿졁",6,"졊졋졎",5,"졕",26,"졲졳졵졶졷졹졻",4,"좂좄좈좉좊좎",5,"좕",7,"좞좠좢좣좤"], +["a141","좥좦좧좩",18,"좾좿죀죁"], +["a161","죂죃죅죆죇죉죊죋죍",6,"죖죘죚",5,"죢죣죥"], +["a181","죦",14,"죶",5,"죾죿줁줂줃줇",4,"줎 、。·‥…¨〃­―∥\∼‘’“”〔〕〈",9,"±×÷≠≤≥∞∴°′″℃Å¢£¥♂♀∠⊥⌒∂∇≡≒§※☆★○●◎◇◆□■△▲▽▼→←↑↓↔〓≪≫√∽∝∵∫∬∈∋⊆⊇⊂⊃∪∩∧∨¬"], +["a241","줐줒",5,"줙",18], +["a261","줭",6,"줵",18], +["a281","쥈",7,"쥒쥓쥕쥖쥗쥙",6,"쥢쥤",7,"쥭쥮쥯⇒⇔∀∃´~ˇ˘˝˚˙¸˛¡¿ː∮∑∏¤℉‰◁◀▷▶♤♠♡♥♧♣⊙◈▣◐◑▒▤▥▨▧▦▩♨☏☎☜☞¶†‡↕↗↙↖↘♭♩♪♬㉿㈜№㏇™㏂㏘℡€®"], +["a341","쥱쥲쥳쥵",6,"쥽",10,"즊즋즍즎즏"], +["a361","즑",6,"즚즜즞",16], +["a381","즯",16,"짂짃짅짆짉짋",4,"짒짔짗짘짛!",58,"₩]",32," ̄"], +["a441","짞짟짡짣짥짦짨짩짪짫짮짲",5,"짺짻짽짾짿쨁쨂쨃쨄"], +["a461","쨅쨆쨇쨊쨎",5,"쨕쨖쨗쨙",12], +["a481","쨦쨧쨨쨪",28,"ㄱ",93], +["a541","쩇",4,"쩎쩏쩑쩒쩓쩕",6,"쩞쩢",5,"쩩쩪"], +["a561","쩫",17,"쩾",5,"쪅쪆"], +["a581","쪇",16,"쪙",14,"ⅰ",9], +["a5b0","Ⅰ",9], +["a5c1","Α",16,"Σ",6], +["a5e1","α",16,"σ",6], +["a641","쪨",19,"쪾쪿쫁쫂쫃쫅"], +["a661","쫆",5,"쫎쫐쫒쫔쫕쫖쫗쫚",5,"쫡",6], +["a681","쫨쫩쫪쫫쫭",6,"쫵",18,"쬉쬊─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂┒┑┚┙┖┕┎┍┞┟┡┢┦┧┩┪┭┮┱┲┵┶┹┺┽┾╀╁╃",7], +["a741","쬋",4,"쬑쬒쬓쬕쬖쬗쬙",6,"쬢",7], +["a761","쬪",22,"쭂쭃쭄"], +["a781","쭅쭆쭇쭊쭋쭍쭎쭏쭑",6,"쭚쭛쭜쭞",5,"쭥",7,"㎕㎖㎗ℓ㎘㏄㎣㎤㎥㎦㎙",9,"㏊㎍㎎㎏㏏㎈㎉㏈㎧㎨㎰",9,"㎀",4,"㎺",5,"㎐",4,"Ω㏀㏁㎊㎋㎌㏖㏅㎭㎮㎯㏛㎩㎪㎫㎬㏝㏐㏓㏃㏉㏜㏆"], +["a841","쭭",10,"쭺",14], +["a861","쮉",18,"쮝",6], +["a881","쮤",19,"쮹",11,"ÆЪĦ"], +["a8a6","IJ"], +["a8a8","ĿŁØŒºÞŦŊ"], +["a8b1","㉠",27,"ⓐ",25,"①",14,"½⅓⅔¼¾⅛⅜⅝⅞"], +["a941","쯅",14,"쯕",10], +["a961","쯠쯡쯢쯣쯥쯦쯨쯪",18], +["a981","쯽",14,"찎찏찑찒찓찕",6,"찞찟찠찣찤æđðħıijĸŀłøœßþŧŋʼn㈀",27,"⒜",25,"⑴",14,"¹²³⁴ⁿ₁₂₃₄"], +["aa41","찥찦찪찫찭찯찱",6,"찺찿",4,"챆챇챉챊챋챍챎"], +["aa61","챏",4,"챖챚",5,"챡챢챣챥챧챩",6,"챱챲"], +["aa81","챳챴챶",29,"ぁ",82], +["ab41","첔첕첖첗첚첛첝첞첟첡",6,"첪첮",5,"첶첷첹"], +["ab61","첺첻첽",6,"쳆쳈쳊",5,"쳑쳒쳓쳕",5], +["ab81","쳛",8,"쳥",6,"쳭쳮쳯쳱",12,"ァ",85], +["ac41","쳾쳿촀촂",5,"촊촋촍촎촏촑",6,"촚촜촞촟촠"], +["ac61","촡촢촣촥촦촧촩촪촫촭",11,"촺",4], +["ac81","촿",28,"쵝쵞쵟А",5,"ЁЖ",25], +["acd1","а",5,"ёж",25], +["ad41","쵡쵢쵣쵥",6,"쵮쵰쵲",5,"쵹",7], +["ad61","춁",6,"춉",10,"춖춗춙춚춛춝춞춟"], +["ad81","춠춡춢춣춦춨춪",5,"춱",18,"췅"], +["ae41","췆",5,"췍췎췏췑",16], +["ae61","췢",5,"췩췪췫췭췮췯췱",6,"췺췼췾",4], +["ae81","츃츅츆츇츉츊츋츍",6,"츕츖츗츘츚",5,"츢츣츥츦츧츩츪츫"], +["af41","츬츭츮츯츲츴츶",19], +["af61","칊",13,"칚칛칝칞칢",5,"칪칬"], +["af81","칮",5,"칶칷칹칺칻칽",6,"캆캈캊",5,"캒캓캕캖캗캙"], +["b041","캚",5,"캢캦",5,"캮",12], +["b061","캻",5,"컂",19], +["b081","컖",13,"컦컧컩컪컭",6,"컶컺",5,"가각간갇갈갉갊감",7,"같",4,"갠갤갬갭갯갰갱갸갹갼걀걋걍걔걘걜거걱건걷걸걺검겁것겄겅겆겉겊겋게겐겔겜겝겟겠겡겨격겪견겯결겸겹겻겼경곁계곈곌곕곗고곡곤곧골곪곬곯곰곱곳공곶과곽관괄괆"], +["b141","켂켃켅켆켇켉",6,"켒켔켖",5,"켝켞켟켡켢켣"], +["b161","켥",6,"켮켲",5,"켹",11], +["b181","콅",14,"콖콗콙콚콛콝",6,"콦콨콪콫콬괌괍괏광괘괜괠괩괬괭괴괵괸괼굄굅굇굉교굔굘굡굣구국군굳굴굵굶굻굼굽굿궁궂궈궉권궐궜궝궤궷귀귁귄귈귐귑귓규균귤그극근귿글긁금급긋긍긔기긱긴긷길긺김깁깃깅깆깊까깍깎깐깔깖깜깝깟깠깡깥깨깩깬깰깸"], +["b241","콭콮콯콲콳콵콶콷콹",6,"쾁쾂쾃쾄쾆",5,"쾍"], +["b261","쾎",18,"쾢",5,"쾩"], +["b281","쾪",5,"쾱",18,"쿅",6,"깹깻깼깽꺄꺅꺌꺼꺽꺾껀껄껌껍껏껐껑께껙껜껨껫껭껴껸껼꼇꼈꼍꼐꼬꼭꼰꼲꼴꼼꼽꼿꽁꽂꽃꽈꽉꽐꽜꽝꽤꽥꽹꾀꾄꾈꾐꾑꾕꾜꾸꾹꾼꿀꿇꿈꿉꿋꿍꿎꿔꿜꿨꿩꿰꿱꿴꿸뀀뀁뀄뀌뀐뀔뀜뀝뀨끄끅끈끊끌끎끓끔끕끗끙"], +["b341","쿌",19,"쿢쿣쿥쿦쿧쿩"], +["b361","쿪",5,"쿲쿴쿶",5,"쿽쿾쿿퀁퀂퀃퀅",5], +["b381","퀋",5,"퀒",5,"퀙",19,"끝끼끽낀낄낌낍낏낑나낙낚난낟날낡낢남납낫",4,"낱낳내낵낸낼냄냅냇냈냉냐냑냔냘냠냥너넉넋넌널넒넓넘넙넛넜넝넣네넥넨넬넴넵넷넸넹녀녁년녈념녑녔녕녘녜녠노녹논놀놂놈놉놋농높놓놔놘놜놨뇌뇐뇔뇜뇝"], +["b441","퀮",5,"퀶퀷퀹퀺퀻퀽",6,"큆큈큊",5], +["b461","큑큒큓큕큖큗큙",6,"큡",10,"큮큯"], +["b481","큱큲큳큵",6,"큾큿킀킂",18,"뇟뇨뇩뇬뇰뇹뇻뇽누눅눈눋눌눔눕눗눙눠눴눼뉘뉜뉠뉨뉩뉴뉵뉼늄늅늉느늑는늘늙늚늠늡늣능늦늪늬늰늴니닉닌닐닒님닙닛닝닢다닥닦단닫",4,"닳담답닷",4,"닿대댁댄댈댐댑댓댔댕댜더덕덖던덛덜덞덟덤덥"], +["b541","킕",14,"킦킧킩킪킫킭",5], +["b561","킳킶킸킺",5,"탂탃탅탆탇탊",5,"탒탖",4], +["b581","탛탞탟탡탢탣탥",6,"탮탲",5,"탹",11,"덧덩덫덮데덱덴델뎀뎁뎃뎄뎅뎌뎐뎔뎠뎡뎨뎬도독돈돋돌돎돐돔돕돗동돛돝돠돤돨돼됐되된될됨됩됫됴두둑둔둘둠둡둣둥둬뒀뒈뒝뒤뒨뒬뒵뒷뒹듀듄듈듐듕드득든듣들듦듬듭듯등듸디딕딘딛딜딤딥딧딨딩딪따딱딴딸"], +["b641","턅",7,"턎",17], +["b661","턠",15,"턲턳턵턶턷턹턻턼턽턾"], +["b681","턿텂텆",5,"텎텏텑텒텓텕",6,"텞텠텢",5,"텩텪텫텭땀땁땃땄땅땋때땍땐땔땜땝땟땠땡떠떡떤떨떪떫떰떱떳떴떵떻떼떽뗀뗄뗌뗍뗏뗐뗑뗘뗬또똑똔똘똥똬똴뙈뙤뙨뚜뚝뚠뚤뚫뚬뚱뛔뛰뛴뛸뜀뜁뜅뜨뜩뜬뜯뜰뜸뜹뜻띄띈띌띔띕띠띤띨띰띱띳띵라락란랄람랍랏랐랑랒랖랗"], +["b741","텮",13,"텽",6,"톅톆톇톉톊"], +["b761","톋",20,"톢톣톥톦톧"], +["b781","톩",6,"톲톴톶톷톸톹톻톽톾톿퇁",14,"래랙랜랠램랩랫랬랭랴략랸럇량러럭런럴럼럽럿렀렁렇레렉렌렐렘렙렛렝려력련렬렴렵렷렸령례롄롑롓로록론롤롬롭롯롱롸롼뢍뢨뢰뢴뢸룀룁룃룅료룐룔룝룟룡루룩룬룰룸룹룻룽뤄뤘뤠뤼뤽륀륄륌륏륑류륙륜률륨륩"], +["b841","퇐",7,"퇙",17], +["b861","퇫",8,"퇵퇶퇷퇹",13], +["b881","툈툊",5,"툑",24,"륫륭르륵른를름릅릇릉릊릍릎리릭린릴림립릿링마막만많",4,"맘맙맛망맞맡맣매맥맨맬맴맵맷맸맹맺먀먁먈먕머먹먼멀멂멈멉멋멍멎멓메멕멘멜멤멥멧멨멩며멱면멸몃몄명몇몌모목몫몬몰몲몸몹못몽뫄뫈뫘뫙뫼"], +["b941","툪툫툮툯툱툲툳툵",6,"툾퉀퉂",5,"퉉퉊퉋퉌"], +["b961","퉍",14,"퉝",6,"퉥퉦퉧퉨"], +["b981","퉩",22,"튂튃튅튆튇튉튊튋튌묀묄묍묏묑묘묜묠묩묫무묵묶문묻물묽묾뭄뭅뭇뭉뭍뭏뭐뭔뭘뭡뭣뭬뮈뮌뮐뮤뮨뮬뮴뮷므믄믈믐믓미믹민믿밀밂밈밉밋밌밍및밑바",4,"받",4,"밤밥밧방밭배백밴밸뱀뱁뱃뱄뱅뱉뱌뱍뱐뱝버벅번벋벌벎범법벗"], +["ba41","튍튎튏튒튓튔튖",5,"튝튞튟튡튢튣튥",6,"튭"], +["ba61","튮튯튰튲",5,"튺튻튽튾틁틃",4,"틊틌",5], +["ba81","틒틓틕틖틗틙틚틛틝",6,"틦",9,"틲틳틵틶틷틹틺벙벚베벡벤벧벨벰벱벳벴벵벼벽변별볍볏볐병볕볘볜보복볶본볼봄봅봇봉봐봔봤봬뵀뵈뵉뵌뵐뵘뵙뵤뵨부북분붇불붉붊붐붑붓붕붙붚붜붤붰붸뷔뷕뷘뷜뷩뷰뷴뷸븀븃븅브븍븐블븜븝븟비빅빈빌빎빔빕빗빙빚빛빠빡빤"], +["bb41","틻",4,"팂팄팆",5,"팏팑팒팓팕팗",4,"팞팢팣"], +["bb61","팤팦팧팪팫팭팮팯팱",6,"팺팾",5,"퍆퍇퍈퍉"], +["bb81","퍊",31,"빨빪빰빱빳빴빵빻빼빽뺀뺄뺌뺍뺏뺐뺑뺘뺙뺨뻐뻑뻔뻗뻘뻠뻣뻤뻥뻬뼁뼈뼉뼘뼙뼛뼜뼝뽀뽁뽄뽈뽐뽑뽕뾔뾰뿅뿌뿍뿐뿔뿜뿟뿡쀼쁑쁘쁜쁠쁨쁩삐삑삔삘삠삡삣삥사삭삯산삳살삵삶삼삽삿샀상샅새색샌샐샘샙샛샜생샤"], +["bc41","퍪",17,"퍾퍿펁펂펃펅펆펇"], +["bc61","펈펉펊펋펎펒",5,"펚펛펝펞펟펡",6,"펪펬펮"], +["bc81","펯",4,"펵펶펷펹펺펻펽",6,"폆폇폊",5,"폑",5,"샥샨샬샴샵샷샹섀섄섈섐섕서",4,"섣설섦섧섬섭섯섰성섶세섹센셀셈셉셋셌셍셔셕션셜셤셥셧셨셩셰셴셸솅소속솎손솔솖솜솝솟송솥솨솩솬솰솽쇄쇈쇌쇔쇗쇘쇠쇤쇨쇰쇱쇳쇼쇽숀숄숌숍숏숑수숙순숟술숨숩숫숭"], +["bd41","폗폙",7,"폢폤",7,"폮폯폱폲폳폵폶폷"], +["bd61","폸폹폺폻폾퐀퐂",5,"퐉",13], +["bd81","퐗",5,"퐞",25,"숯숱숲숴쉈쉐쉑쉔쉘쉠쉥쉬쉭쉰쉴쉼쉽쉿슁슈슉슐슘슛슝스슥슨슬슭슴습슷승시식신싣실싫심십싯싱싶싸싹싻싼쌀쌈쌉쌌쌍쌓쌔쌕쌘쌜쌤쌥쌨쌩썅써썩썬썰썲썸썹썼썽쎄쎈쎌쏀쏘쏙쏜쏟쏠쏢쏨쏩쏭쏴쏵쏸쐈쐐쐤쐬쐰"], +["be41","퐸",7,"푁푂푃푅",14], +["be61","푔",7,"푝푞푟푡푢푣푥",7,"푮푰푱푲"], +["be81","푳",4,"푺푻푽푾풁풃",4,"풊풌풎",5,"풕",8,"쐴쐼쐽쑈쑤쑥쑨쑬쑴쑵쑹쒀쒔쒜쒸쒼쓩쓰쓱쓴쓸쓺쓿씀씁씌씐씔씜씨씩씬씰씸씹씻씽아악안앉않알앍앎앓암압앗았앙앝앞애액앤앨앰앱앳앴앵야약얀얄얇얌얍얏양얕얗얘얜얠얩어억언얹얻얼얽얾엄",6,"엌엎"], +["bf41","풞",10,"풪",14], +["bf61","풹",18,"퓍퓎퓏퓑퓒퓓퓕"], +["bf81","퓖",5,"퓝퓞퓠",7,"퓩퓪퓫퓭퓮퓯퓱",6,"퓹퓺퓼에엑엔엘엠엡엣엥여역엮연열엶엷염",5,"옅옆옇예옌옐옘옙옛옜오옥온올옭옮옰옳옴옵옷옹옻와왁완왈왐왑왓왔왕왜왝왠왬왯왱외왹왼욀욈욉욋욍요욕욘욜욤욥욧용우욱운울욹욺움웁웃웅워웍원월웜웝웠웡웨"], +["c041","퓾",5,"픅픆픇픉픊픋픍",6,"픖픘",5], +["c061","픞",25], +["c081","픸픹픺픻픾픿핁핂핃핅",6,"핎핐핒",5,"핚핛핝핞핟핡핢핣웩웬웰웸웹웽위윅윈윌윔윕윗윙유육윤율윰윱윳융윷으윽은을읊음읍읏응",7,"읜읠읨읫이익인일읽읾잃임입잇있잉잊잎자작잔잖잗잘잚잠잡잣잤장잦재잭잰잴잼잽잿쟀쟁쟈쟉쟌쟎쟐쟘쟝쟤쟨쟬저적전절젊"], +["c141","핤핦핧핪핬핮",5,"핶핷핹핺핻핽",6,"햆햊햋"], +["c161","햌햍햎햏햑",19,"햦햧"], +["c181","햨",31,"점접젓정젖제젝젠젤젬젭젯젱져젼졀졈졉졌졍졔조족존졸졺좀좁좃종좆좇좋좌좍좔좝좟좡좨좼좽죄죈죌죔죕죗죙죠죡죤죵주죽준줄줅줆줌줍줏중줘줬줴쥐쥑쥔쥘쥠쥡쥣쥬쥰쥴쥼즈즉즌즐즘즙즛증지직진짇질짊짐집짓"], +["c241","헊헋헍헎헏헑헓",4,"헚헜헞",5,"헦헧헩헪헫헭헮"], +["c261","헯",4,"헶헸헺",5,"혂혃혅혆혇혉",6,"혒"], +["c281","혖",5,"혝혞혟혡혢혣혥",7,"혮",9,"혺혻징짖짙짚짜짝짠짢짤짧짬짭짯짰짱째짹짼쨀쨈쨉쨋쨌쨍쨔쨘쨩쩌쩍쩐쩔쩜쩝쩟쩠쩡쩨쩽쪄쪘쪼쪽쫀쫄쫌쫍쫏쫑쫓쫘쫙쫠쫬쫴쬈쬐쬔쬘쬠쬡쭁쭈쭉쭌쭐쭘쭙쭝쭤쭸쭹쮜쮸쯔쯤쯧쯩찌찍찐찔찜찝찡찢찧차착찬찮찰참찹찻"], +["c341","혽혾혿홁홂홃홄홆홇홊홌홎홏홐홒홓홖홗홙홚홛홝",4], +["c361","홢",4,"홨홪",5,"홲홳홵",11], +["c381","횁횂횄횆",5,"횎횏횑횒횓횕",7,"횞횠횢",5,"횩횪찼창찾채책챈챌챔챕챗챘챙챠챤챦챨챰챵처척천철첨첩첫첬청체첵첸첼쳄쳅쳇쳉쳐쳔쳤쳬쳰촁초촉촌촐촘촙촛총촤촨촬촹최쵠쵤쵬쵭쵯쵱쵸춈추축춘출춤춥춧충춰췄췌췐취췬췰췸췹췻췽츄츈츌츔츙츠측츤츨츰츱츳층"], +["c441","횫횭횮횯횱",7,"횺횼",7,"훆훇훉훊훋"], +["c461","훍훎훏훐훒훓훕훖훘훚",5,"훡훢훣훥훦훧훩",4], +["c481","훮훯훱훲훳훴훶",5,"훾훿휁휂휃휅",11,"휒휓휔치칙친칟칠칡침칩칫칭카칵칸칼캄캅캇캉캐캑캔캘캠캡캣캤캥캬캭컁커컥컨컫컬컴컵컷컸컹케켁켄켈켐켑켓켕켜켠켤켬켭켯켰켱켸코콕콘콜콤콥콧콩콰콱콴콸쾀쾅쾌쾡쾨쾰쿄쿠쿡쿤쿨쿰쿱쿳쿵쿼퀀퀄퀑퀘퀭퀴퀵퀸퀼"], +["c541","휕휖휗휚휛휝휞휟휡",6,"휪휬휮",5,"휶휷휹"], +["c561","휺휻휽",6,"흅흆흈흊",5,"흒흓흕흚",4], +["c581","흟흢흤흦흧흨흪흫흭흮흯흱흲흳흵",6,"흾흿힀힂",5,"힊힋큄큅큇큉큐큔큘큠크큭큰클큼큽킁키킥킨킬킴킵킷킹타탁탄탈탉탐탑탓탔탕태택탠탤탬탭탯탰탱탸턍터턱턴털턺텀텁텃텄텅테텍텐텔템텝텟텡텨텬텼톄톈토톡톤톨톰톱톳통톺톼퇀퇘퇴퇸툇툉툐투툭툰툴툼툽툿퉁퉈퉜"], +["c641","힍힎힏힑",6,"힚힜힞",5], +["c6a1","퉤튀튁튄튈튐튑튕튜튠튤튬튱트특튼튿틀틂틈틉틋틔틘틜틤틥티틱틴틸팀팁팃팅파팍팎판팔팖팜팝팟팠팡팥패팩팬팰팸팹팻팼팽퍄퍅퍼퍽펀펄펌펍펏펐펑페펙펜펠펨펩펫펭펴편펼폄폅폈평폐폘폡폣포폭폰폴폼폽폿퐁"], +["c7a1","퐈퐝푀푄표푠푤푭푯푸푹푼푿풀풂품풉풋풍풔풩퓌퓐퓔퓜퓟퓨퓬퓰퓸퓻퓽프픈플픔픕픗피픽핀필핌핍핏핑하학한할핥함합핫항해핵핸핼햄햅햇했행햐향허헉헌헐헒험헙헛헝헤헥헨헬헴헵헷헹혀혁현혈혐협혓혔형혜혠"], +["c8a1","혤혭호혹혼홀홅홈홉홋홍홑화확환활홧황홰홱홴횃횅회획횐횔횝횟횡효횬횰횹횻후훅훈훌훑훔훗훙훠훤훨훰훵훼훽휀휄휑휘휙휜휠휨휩휫휭휴휵휸휼흄흇흉흐흑흔흖흗흘흙흠흡흣흥흩희흰흴흼흽힁히힉힌힐힘힙힛힝"], +["caa1","伽佳假價加可呵哥嘉嫁家暇架枷柯歌珂痂稼苛茄街袈訶賈跏軻迦駕刻却各恪慤殼珏脚覺角閣侃刊墾奸姦干幹懇揀杆柬桿澗癎看磵稈竿簡肝艮艱諫間乫喝曷渴碣竭葛褐蝎鞨勘坎堪嵌感憾戡敢柑橄減甘疳監瞰紺邯鑑鑒龕"], +["cba1","匣岬甲胛鉀閘剛堈姜岡崗康强彊慷江畺疆糠絳綱羌腔舡薑襁講鋼降鱇介价個凱塏愷愾慨改槪漑疥皆盖箇芥蓋豈鎧開喀客坑更粳羹醵倨去居巨拒据據擧渠炬祛距踞車遽鉅鋸乾件健巾建愆楗腱虔蹇鍵騫乞傑杰桀儉劍劒檢"], +["cca1","瞼鈐黔劫怯迲偈憩揭擊格檄激膈覡隔堅牽犬甄絹繭肩見譴遣鵑抉決潔結缺訣兼慊箝謙鉗鎌京俓倞傾儆勁勍卿坰境庚徑慶憬擎敬景暻更梗涇炅烱璟璥瓊痙硬磬竟競絅經耕耿脛莖警輕逕鏡頃頸驚鯨係啓堺契季屆悸戒桂械"], +["cda1","棨溪界癸磎稽系繫繼計誡谿階鷄古叩告呱固姑孤尻庫拷攷故敲暠枯槁沽痼皐睾稿羔考股膏苦苽菰藁蠱袴誥賈辜錮雇顧高鼓哭斛曲梏穀谷鵠困坤崑昆梱棍滾琨袞鯤汨滑骨供公共功孔工恐恭拱控攻珙空蚣貢鞏串寡戈果瓜"], +["cea1","科菓誇課跨過鍋顆廓槨藿郭串冠官寬慣棺款灌琯瓘管罐菅觀貫關館刮恝括适侊光匡壙廣曠洸炚狂珖筐胱鑛卦掛罫乖傀塊壞怪愧拐槐魁宏紘肱轟交僑咬喬嬌嶠巧攪敎校橋狡皎矯絞翹膠蕎蛟較轎郊餃驕鮫丘久九仇俱具勾"], +["cfa1","區口句咎嘔坵垢寇嶇廐懼拘救枸柩構歐毆毬求溝灸狗玖球瞿矩究絿耉臼舅舊苟衢謳購軀逑邱鉤銶駒驅鳩鷗龜國局菊鞠鞫麴君窘群裙軍郡堀屈掘窟宮弓穹窮芎躬倦券勸卷圈拳捲權淃眷厥獗蕨蹶闕机櫃潰詭軌饋句晷歸貴"], +["d0a1","鬼龜叫圭奎揆槻珪硅窺竅糾葵規赳逵閨勻均畇筠菌鈞龜橘克剋劇戟棘極隙僅劤勤懃斤根槿瑾筋芹菫覲謹近饉契今妗擒昑檎琴禁禽芩衾衿襟金錦伋及急扱汲級給亘兢矜肯企伎其冀嗜器圻基埼夔奇妓寄岐崎己幾忌技旗旣"], +["d1a1","朞期杞棋棄機欺氣汽沂淇玘琦琪璂璣畸畿碁磯祁祇祈祺箕紀綺羈耆耭肌記譏豈起錡錤飢饑騎騏驥麒緊佶吉拮桔金喫儺喇奈娜懦懶拏拿癩",5,"那樂",4,"諾酪駱亂卵暖欄煖爛蘭難鸞捏捺南嵐枏楠湳濫男藍襤拉"], +["d2a1","納臘蠟衲囊娘廊",4,"乃來內奈柰耐冷女年撚秊念恬拈捻寧寗努勞奴弩怒擄櫓爐瑙盧",5,"駑魯",10,"濃籠聾膿農惱牢磊腦賂雷尿壘",7,"嫩訥杻紐勒",5,"能菱陵尼泥匿溺多茶"], +["d3a1","丹亶但單團壇彖斷旦檀段湍短端簞緞蛋袒鄲鍛撻澾獺疸達啖坍憺擔曇淡湛潭澹痰聃膽蕁覃談譚錟沓畓答踏遝唐堂塘幢戇撞棠當糖螳黨代垈坮大對岱帶待戴擡玳臺袋貸隊黛宅德悳倒刀到圖堵塗導屠島嶋度徒悼挑掉搗桃"], +["d4a1","棹櫂淘渡滔濤燾盜睹禱稻萄覩賭跳蹈逃途道都鍍陶韜毒瀆牘犢獨督禿篤纛讀墩惇敦旽暾沌焞燉豚頓乭突仝冬凍動同憧東桐棟洞潼疼瞳童胴董銅兜斗杜枓痘竇荳讀豆逗頭屯臀芚遁遯鈍得嶝橙燈登等藤謄鄧騰喇懶拏癩羅"], +["d5a1","蘿螺裸邏樂洛烙珞絡落諾酪駱丹亂卵欄欒瀾爛蘭鸞剌辣嵐擥攬欖濫籃纜藍襤覽拉臘蠟廊朗浪狼琅瑯螂郞來崍徠萊冷掠略亮倆兩凉梁樑粮粱糧良諒輛量侶儷勵呂廬慮戾旅櫚濾礪藜蠣閭驢驪麗黎力曆歷瀝礫轢靂憐戀攣漣"], +["d6a1","煉璉練聯蓮輦連鍊冽列劣洌烈裂廉斂殮濂簾獵令伶囹寧岺嶺怜玲笭羚翎聆逞鈴零靈領齡例澧禮醴隷勞怒撈擄櫓潞瀘爐盧老蘆虜路輅露魯鷺鹵碌祿綠菉錄鹿麓論壟弄朧瀧瓏籠聾儡瀨牢磊賂賚賴雷了僚寮廖料燎療瞭聊蓼"], +["d7a1","遼鬧龍壘婁屢樓淚漏瘻累縷蔞褸鏤陋劉旒柳榴流溜瀏琉瑠留瘤硫謬類六戮陸侖倫崙淪綸輪律慄栗率隆勒肋凜凌楞稜綾菱陵俚利厘吏唎履悧李梨浬犁狸理璃異痢籬罹羸莉裏裡里釐離鯉吝潾燐璘藺躪隣鱗麟林淋琳臨霖砬"], +["d8a1","立笠粒摩瑪痲碼磨馬魔麻寞幕漠膜莫邈万卍娩巒彎慢挽晩曼滿漫灣瞞萬蔓蠻輓饅鰻唜抹末沫茉襪靺亡妄忘忙望網罔芒茫莽輞邙埋妹媒寐昧枚梅每煤罵買賣邁魅脈貊陌驀麥孟氓猛盲盟萌冪覓免冕勉棉沔眄眠綿緬面麵滅"], +["d9a1","蔑冥名命明暝椧溟皿瞑茗蓂螟酩銘鳴袂侮冒募姆帽慕摸摹暮某模母毛牟牡瑁眸矛耗芼茅謀謨貌木沐牧目睦穆鶩歿沒夢朦蒙卯墓妙廟描昴杳渺猫竗苗錨務巫憮懋戊拇撫无楙武毋無珷畝繆舞茂蕪誣貿霧鵡墨默們刎吻問文"], +["daa1","汶紊紋聞蚊門雯勿沕物味媚尾嵋彌微未梶楣渼湄眉米美薇謎迷靡黴岷悶愍憫敏旻旼民泯玟珉緡閔密蜜謐剝博拍搏撲朴樸泊珀璞箔粕縛膊舶薄迫雹駁伴半反叛拌搬攀斑槃泮潘班畔瘢盤盼磐磻礬絆般蟠返頒飯勃拔撥渤潑"], +["dba1","發跋醱鉢髮魃倣傍坊妨尨幇彷房放方旁昉枋榜滂磅紡肪膀舫芳蒡蚌訪謗邦防龐倍俳北培徘拜排杯湃焙盃背胚裴裵褙賠輩配陪伯佰帛柏栢白百魄幡樊煩燔番磻繁蕃藩飜伐筏罰閥凡帆梵氾汎泛犯範范法琺僻劈壁擘檗璧癖"], +["dca1","碧蘗闢霹便卞弁變辨辯邊別瞥鱉鼈丙倂兵屛幷昞昺柄棅炳甁病秉竝輧餠騈保堡報寶普步洑湺潽珤甫菩補褓譜輔伏僕匐卜宓復服福腹茯蔔複覆輹輻馥鰒本乶俸奉封峯峰捧棒烽熢琫縫蓬蜂逢鋒鳳不付俯傅剖副否咐埠夫婦"], +["dda1","孚孵富府復扶敷斧浮溥父符簿缶腐腑膚艀芙莩訃負賦賻赴趺部釜阜附駙鳧北分吩噴墳奔奮忿憤扮昐汾焚盆粉糞紛芬賁雰不佛弗彿拂崩朋棚硼繃鵬丕備匕匪卑妃婢庇悲憊扉批斐枇榧比毖毗毘沸泌琵痺砒碑秕秘粃緋翡肥"], +["dea1","脾臂菲蜚裨誹譬費鄙非飛鼻嚬嬪彬斌檳殯浜濱瀕牝玭貧賓頻憑氷聘騁乍事些仕伺似使俟僿史司唆嗣四士奢娑寫寺射巳師徙思捨斜斯柶査梭死沙泗渣瀉獅砂社祀祠私篩紗絲肆舍莎蓑蛇裟詐詞謝賜赦辭邪飼駟麝削數朔索"], +["dfa1","傘刪山散汕珊産疝算蒜酸霰乷撒殺煞薩三參杉森渗芟蔘衫揷澁鈒颯上傷像償商喪嘗孀尙峠常床庠廂想桑橡湘爽牀狀相祥箱翔裳觴詳象賞霜塞璽賽嗇塞穡索色牲生甥省笙墅壻嶼序庶徐恕抒捿敍暑曙書栖棲犀瑞筮絮緖署"], +["e0a1","胥舒薯西誓逝鋤黍鼠夕奭席惜昔晳析汐淅潟石碩蓆釋錫仙僊先善嬋宣扇敾旋渲煽琁瑄璇璿癬禪線繕羨腺膳船蘚蟬詵跣選銑鐥饍鮮卨屑楔泄洩渫舌薛褻設說雪齧剡暹殲纖蟾贍閃陝攝涉燮葉城姓宬性惺成星晟猩珹盛省筬"], +["e1a1","聖聲腥誠醒世勢歲洗稅笹細說貰召嘯塑宵小少巢所掃搔昭梳沼消溯瀟炤燒甦疏疎瘙笑篠簫素紹蔬蕭蘇訴逍遡邵銷韶騷俗屬束涑粟續謖贖速孫巽損蓀遜飡率宋悚松淞訟誦送頌刷殺灑碎鎖衰釗修受嗽囚垂壽嫂守岫峀帥愁"], +["e2a1","戍手授搜收數樹殊水洙漱燧狩獸琇璲瘦睡秀穗竪粹綏綬繡羞脩茱蒐蓚藪袖誰讐輸遂邃酬銖銹隋隧隨雖需須首髓鬚叔塾夙孰宿淑潚熟琡璹肅菽巡徇循恂旬栒楯橓殉洵淳珣盾瞬筍純脣舜荀蓴蕣詢諄醇錞順馴戌術述鉥崇崧"], +["e3a1","嵩瑟膝蝨濕拾習褶襲丞乘僧勝升承昇繩蠅陞侍匙嘶始媤尸屎屍市弑恃施是時枾柴猜矢示翅蒔蓍視試詩諡豕豺埴寔式息拭植殖湜熄篒蝕識軾食飾伸侁信呻娠宸愼新晨燼申神紳腎臣莘薪藎蜃訊身辛辰迅失室實悉審尋心沁"], +["e4a1","沈深瀋甚芯諶什十拾雙氏亞俄兒啞娥峨我牙芽莪蛾衙訝阿雅餓鴉鵝堊岳嶽幄惡愕握樂渥鄂鍔顎鰐齷安岸按晏案眼雁鞍顔鮟斡謁軋閼唵岩巖庵暗癌菴闇壓押狎鴨仰央怏昻殃秧鴦厓哀埃崖愛曖涯碍艾隘靄厄扼掖液縊腋額"], +["e5a1","櫻罌鶯鸚也倻冶夜惹揶椰爺耶若野弱掠略約若葯蒻藥躍亮佯兩凉壤孃恙揚攘敭暘梁楊樣洋瀁煬痒瘍禳穰糧羊良襄諒讓釀陽量養圄御於漁瘀禦語馭魚齬億憶抑檍臆偃堰彦焉言諺孼蘖俺儼嚴奄掩淹嶪業円予余勵呂女如廬"], +["e6a1","旅歟汝濾璵礖礪與艅茹輿轝閭餘驪麗黎亦力域役易曆歷疫繹譯轢逆驛嚥堧姸娟宴年延憐戀捐挻撚椽沇沿涎涓淵演漣烟然煙煉燃燕璉硏硯秊筵緣練縯聯衍軟輦蓮連鉛鍊鳶列劣咽悅涅烈熱裂說閱厭廉念捻染殮炎焰琰艶苒"], +["e7a1","簾閻髥鹽曄獵燁葉令囹塋寧嶺嶸影怜映暎楹榮永泳渶潁濚瀛瀯煐營獰玲瑛瑩瓔盈穎纓羚聆英詠迎鈴鍈零霙靈領乂倪例刈叡曳汭濊猊睿穢芮藝蘂禮裔詣譽豫醴銳隸霓預五伍俉傲午吾吳嗚塢墺奧娛寤悟惡懊敖旿晤梧汚澳"], +["e8a1","烏熬獒筽蜈誤鰲鼇屋沃獄玉鈺溫瑥瘟穩縕蘊兀壅擁瓮甕癰翁邕雍饔渦瓦窩窪臥蛙蝸訛婉完宛梡椀浣玩琓琬碗緩翫脘腕莞豌阮頑曰往旺枉汪王倭娃歪矮外嵬巍猥畏了僚僥凹堯夭妖姚寥寮尿嶢拗搖撓擾料曜樂橈燎燿瑤療"], +["e9a1","窈窯繇繞耀腰蓼蟯要謠遙遼邀饒慾欲浴縟褥辱俑傭冗勇埇墉容庸慂榕涌湧溶熔瑢用甬聳茸蓉踊鎔鏞龍于佑偶優又友右宇寓尤愚憂旴牛玗瑀盂祐禑禹紆羽芋藕虞迂遇郵釪隅雨雩勖彧旭昱栯煜稶郁頊云暈橒殞澐熉耘芸蕓"], +["eaa1","運隕雲韻蔚鬱亐熊雄元原員圓園垣媛嫄寃怨愿援沅洹湲源爰猿瑗苑袁轅遠阮院願鴛月越鉞位偉僞危圍委威尉慰暐渭爲瑋緯胃萎葦蔿蝟衛褘謂違韋魏乳侑儒兪劉唯喩孺宥幼幽庾悠惟愈愉揄攸有杻柔柚柳楡楢油洧流游溜"], +["eba1","濡猶猷琉瑜由留癒硫紐維臾萸裕誘諛諭踰蹂遊逾遺酉釉鍮類六堉戮毓肉育陸倫允奫尹崙淪潤玧胤贇輪鈗閏律慄栗率聿戎瀜絨融隆垠恩慇殷誾銀隱乙吟淫蔭陰音飮揖泣邑凝應膺鷹依倚儀宜意懿擬椅毅疑矣義艤薏蟻衣誼"], +["eca1","議醫二以伊利吏夷姨履已弛彛怡易李梨泥爾珥理異痍痢移罹而耳肄苡荑裏裡貽貳邇里離飴餌匿溺瀷益翊翌翼謚人仁刃印吝咽因姻寅引忍湮燐璘絪茵藺蚓認隣靭靷鱗麟一佚佾壹日溢逸鎰馹任壬妊姙恁林淋稔臨荏賃入卄"], +["eda1","立笠粒仍剩孕芿仔刺咨姉姿子字孜恣慈滋炙煮玆瓷疵磁紫者自茨蔗藉諮資雌作勺嚼斫昨灼炸爵綽芍酌雀鵲孱棧殘潺盞岑暫潛箴簪蠶雜丈仗匠場墻壯奬將帳庄張掌暲杖樟檣欌漿牆狀獐璋章粧腸臟臧莊葬蔣薔藏裝贓醬長"], +["eea1","障再哉在宰才材栽梓渽滓災縡裁財載齋齎爭箏諍錚佇低儲咀姐底抵杵楮樗沮渚狙猪疽箸紵苧菹著藷詛貯躇這邸雎齟勣吊嫡寂摘敵滴狄炙的積笛籍績翟荻謫賊赤跡蹟迪迹適鏑佃佺傳全典前剪塡塼奠專展廛悛戰栓殿氈澱"], +["efa1","煎琠田甸畑癲筌箋箭篆纏詮輾轉鈿銓錢鐫電顚顫餞切截折浙癤竊節絶占岾店漸点粘霑鮎點接摺蝶丁井亭停偵呈姃定幀庭廷征情挺政整旌晶晸柾楨檉正汀淀淨渟湞瀞炡玎珽町睛碇禎程穽精綎艇訂諪貞鄭酊釘鉦鋌錠霆靖"], +["f0a1","靜頂鼎制劑啼堤帝弟悌提梯濟祭第臍薺製諸蹄醍除際霽題齊俎兆凋助嘲弔彫措操早晁曺曹朝條棗槽漕潮照燥爪璪眺祖祚租稠窕粗糟組繰肇藻蚤詔調趙躁造遭釣阻雕鳥族簇足鏃存尊卒拙猝倧宗從悰慫棕淙琮種終綜縱腫"], +["f1a1","踪踵鍾鐘佐坐左座挫罪主住侏做姝胄呪周嗾奏宙州廚晝朱柱株注洲湊澍炷珠疇籌紂紬綢舟蛛註誅走躊輳週酎酒鑄駐竹粥俊儁准埈寯峻晙樽浚準濬焌畯竣蠢逡遵雋駿茁中仲衆重卽櫛楫汁葺增憎曾拯烝甑症繒蒸證贈之只"], +["f2a1","咫地址志持指摯支旨智枝枳止池沚漬知砥祉祗紙肢脂至芝芷蜘誌識贄趾遲直稙稷織職唇嗔塵振搢晉晋桭榛殄津溱珍瑨璡畛疹盡眞瞋秦縉縝臻蔯袗診賑軫辰進鎭陣陳震侄叱姪嫉帙桎瓆疾秩窒膣蛭質跌迭斟朕什執潗緝輯"], +["f3a1","鏶集徵懲澄且侘借叉嗟嵯差次此磋箚茶蹉車遮捉搾着窄錯鑿齪撰澯燦璨瓚竄簒纂粲纘讚贊鑽餐饌刹察擦札紮僭參塹慘慙懺斬站讒讖倉倡創唱娼廠彰愴敞昌昶暢槍滄漲猖瘡窓脹艙菖蒼債埰寀寨彩採砦綵菜蔡采釵冊柵策"], +["f4a1","責凄妻悽處倜刺剔尺慽戚拓擲斥滌瘠脊蹠陟隻仟千喘天川擅泉淺玔穿舛薦賤踐遷釧闡阡韆凸哲喆徹撤澈綴輟轍鐵僉尖沾添甛瞻簽籤詹諂堞妾帖捷牒疊睫諜貼輒廳晴淸聽菁請靑鯖切剃替涕滯締諦逮遞體初剿哨憔抄招梢"], +["f5a1","椒楚樵炒焦硝礁礎秒稍肖艸苕草蕉貂超酢醋醮促囑燭矗蜀觸寸忖村邨叢塚寵悤憁摠總聰蔥銃撮催崔最墜抽推椎楸樞湫皺秋芻萩諏趨追鄒酋醜錐錘鎚雛騶鰍丑畜祝竺筑築縮蓄蹙蹴軸逐春椿瑃出朮黜充忠沖蟲衝衷悴膵萃"], +["f6a1","贅取吹嘴娶就炊翠聚脆臭趣醉驟鷲側仄厠惻測層侈値嗤峙幟恥梔治淄熾痔痴癡稚穉緇緻置致蚩輜雉馳齒則勅飭親七柒漆侵寢枕沈浸琛砧針鍼蟄秤稱快他咤唾墮妥惰打拖朶楕舵陀馱駝倬卓啄坼度托拓擢晫柝濁濯琢琸託"], +["f7a1","鐸呑嘆坦彈憚歎灘炭綻誕奪脫探眈耽貪塔搭榻宕帑湯糖蕩兌台太怠態殆汰泰笞胎苔跆邰颱宅擇澤撑攄兎吐土討慟桶洞痛筒統通堆槌腿褪退頹偸套妬投透鬪慝特闖坡婆巴把播擺杷波派爬琶破罷芭跛頗判坂板版瓣販辦鈑"], +["f8a1","阪八叭捌佩唄悖敗沛浿牌狽稗覇貝彭澎烹膨愎便偏扁片篇編翩遍鞭騙貶坪平枰萍評吠嬖幣廢弊斃肺蔽閉陛佈包匍匏咆哺圃布怖抛抱捕暴泡浦疱砲胞脯苞葡蒲袍褒逋鋪飽鮑幅暴曝瀑爆輻俵剽彪慓杓標漂瓢票表豹飇飄驃"], +["f9a1","品稟楓諷豊風馮彼披疲皮被避陂匹弼必泌珌畢疋筆苾馝乏逼下何厦夏廈昰河瑕荷蝦賀遐霞鰕壑學虐謔鶴寒恨悍旱汗漢澣瀚罕翰閑閒限韓割轄函含咸啣喊檻涵緘艦銜陷鹹合哈盒蛤閤闔陜亢伉姮嫦巷恒抗杭桁沆港缸肛航"], +["faa1","行降項亥偕咳垓奚孩害懈楷海瀣蟹解該諧邂駭骸劾核倖幸杏荇行享向嚮珦鄕響餉饗香噓墟虛許憲櫶獻軒歇險驗奕爀赫革俔峴弦懸晛泫炫玄玹現眩睍絃絢縣舷衒見賢鉉顯孑穴血頁嫌俠協夾峽挾浹狹脅脇莢鋏頰亨兄刑型"], +["fba1","形泂滎瀅灐炯熒珩瑩荊螢衡逈邢鎣馨兮彗惠慧暳蕙蹊醯鞋乎互呼壕壺好岵弧戶扈昊晧毫浩淏湖滸澔濠濩灝狐琥瑚瓠皓祜糊縞胡芦葫蒿虎號蝴護豪鎬頀顥惑或酷婚昏混渾琿魂忽惚笏哄弘汞泓洪烘紅虹訌鴻化和嬅樺火畵"], +["fca1","禍禾花華話譁貨靴廓擴攫確碻穫丸喚奐宦幻患換歡晥桓渙煥環紈還驩鰥活滑猾豁闊凰幌徨恍惶愰慌晃晄榥況湟滉潢煌璜皇篁簧荒蝗遑隍黃匯回廻徊恢悔懷晦會檜淮澮灰獪繪膾茴蛔誨賄劃獲宖橫鐄哮嚆孝效斅曉梟涍淆"], +["fda1","爻肴酵驍侯候厚后吼喉嗅帿後朽煦珝逅勛勳塤壎焄熏燻薰訓暈薨喧暄煊萱卉喙毁彙徽揮暉煇諱輝麾休携烋畦虧恤譎鷸兇凶匈洶胸黑昕欣炘痕吃屹紇訖欠欽歆吸恰洽翕興僖凞喜噫囍姬嬉希憙憘戱晞曦熙熹熺犧禧稀羲詰"] +] diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp950.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp950.json new file mode 100644 index 0000000..d8bc871 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp950.json @@ -0,0 +1,177 @@ +[ +["0","\u0000",127], +["a140"," ,、。.‧;:?!︰…‥﹐﹑﹒·﹔﹕﹖﹗|–︱—︳╴︴﹏()︵︶{}︷︸〔〕︹︺【】︻︼《》︽︾〈〉︿﹀「」﹁﹂『』﹃﹄﹙﹚"], +["a1a1","﹛﹜﹝﹞‘’“”〝〞‵′#&*※§〃○●△▲◎☆★◇◆□■▽▼㊣℅¯ ̄_ˍ﹉﹊﹍﹎﹋﹌﹟﹠﹡+-×÷±√<>=≦≧≠∞≒≡﹢",4,"~∩∪⊥∠∟⊿㏒㏑∫∮∵∴♀♂⊕⊙↑↓←→↖↗↙↘∥∣/"], +["a240","\∕﹨$¥〒¢£%@℃℉﹩﹪﹫㏕㎜㎝㎞㏎㎡㎎㎏㏄°兙兛兞兝兡兣嗧瓩糎▁",7,"▏▎▍▌▋▊▉┼┴┬┤├▔─│▕┌┐└┘╭"], +["a2a1","╮╰╯═╞╪╡◢◣◥◤╱╲╳0",9,"Ⅰ",9,"〡",8,"十卄卅A",25,"a",21], +["a340","wxyzΑ",16,"Σ",6,"α",16,"σ",6,"ㄅ",10], +["a3a1","ㄐ",25,"˙ˉˊˇˋ"], +["a3e1","€"], +["a440","一乙丁七乃九了二人儿入八几刀刁力匕十卜又三下丈上丫丸凡久么也乞于亡兀刃勺千叉口土士夕大女子孑孓寸小尢尸山川工己已巳巾干廾弋弓才"], +["a4a1","丑丐不中丰丹之尹予云井互五亢仁什仃仆仇仍今介仄元允內六兮公冗凶分切刈勻勾勿化匹午升卅卞厄友及反壬天夫太夭孔少尤尺屯巴幻廿弔引心戈戶手扎支文斗斤方日曰月木欠止歹毋比毛氏水火爪父爻片牙牛犬王丙"], +["a540","世丕且丘主乍乏乎以付仔仕他仗代令仙仞充兄冉冊冬凹出凸刊加功包匆北匝仟半卉卡占卯卮去可古右召叮叩叨叼司叵叫另只史叱台句叭叻四囚外"], +["a5a1","央失奴奶孕它尼巨巧左市布平幼弁弘弗必戊打扔扒扑斥旦朮本未末札正母民氐永汁汀氾犯玄玉瓜瓦甘生用甩田由甲申疋白皮皿目矛矢石示禾穴立丞丟乒乓乩亙交亦亥仿伉伙伊伕伍伐休伏仲件任仰仳份企伋光兇兆先全"], +["a640","共再冰列刑划刎刖劣匈匡匠印危吉吏同吊吐吁吋各向名合吃后吆吒因回囝圳地在圭圬圯圩夙多夷夸妄奸妃好她如妁字存宇守宅安寺尖屹州帆并年"], +["a6a1","式弛忙忖戎戌戍成扣扛托收早旨旬旭曲曳有朽朴朱朵次此死氖汝汗汙江池汐汕污汛汍汎灰牟牝百竹米糸缶羊羽老考而耒耳聿肉肋肌臣自至臼舌舛舟艮色艾虫血行衣西阡串亨位住佇佗佞伴佛何估佐佑伽伺伸佃佔似但佣"], +["a740","作你伯低伶余佝佈佚兌克免兵冶冷別判利刪刨劫助努劬匣即卵吝吭吞吾否呎吧呆呃吳呈呂君吩告吹吻吸吮吵吶吠吼呀吱含吟听囪困囤囫坊坑址坍"], +["a7a1","均坎圾坐坏圻壯夾妝妒妨妞妣妙妖妍妤妓妊妥孝孜孚孛完宋宏尬局屁尿尾岐岑岔岌巫希序庇床廷弄弟彤形彷役忘忌志忍忱快忸忪戒我抄抗抖技扶抉扭把扼找批扳抒扯折扮投抓抑抆改攻攸旱更束李杏材村杜杖杞杉杆杠"], +["a840","杓杗步每求汞沙沁沈沉沅沛汪決沐汰沌汨沖沒汽沃汲汾汴沆汶沍沔沘沂灶灼災灸牢牡牠狄狂玖甬甫男甸皂盯矣私秀禿究系罕肖肓肝肘肛肚育良芒"], +["a8a1","芋芍見角言谷豆豕貝赤走足身車辛辰迂迆迅迄巡邑邢邪邦那酉釆里防阮阱阪阬並乖乳事些亞享京佯依侍佳使佬供例來侃佰併侈佩佻侖佾侏侑佺兔兒兕兩具其典冽函刻券刷刺到刮制剁劾劻卒協卓卑卦卷卸卹取叔受味呵"], +["a940","咖呸咕咀呻呷咄咒咆呼咐呱呶和咚呢周咋命咎固垃坷坪坩坡坦坤坼夜奉奇奈奄奔妾妻委妹妮姑姆姐姍始姓姊妯妳姒姅孟孤季宗定官宜宙宛尚屈居"], +["a9a1","屆岷岡岸岩岫岱岳帘帚帖帕帛帑幸庚店府底庖延弦弧弩往征彿彼忝忠忽念忿怏怔怯怵怖怪怕怡性怩怫怛或戕房戾所承拉拌拄抿拂抹拒招披拓拔拋拈抨抽押拐拙拇拍抵拚抱拘拖拗拆抬拎放斧於旺昔易昌昆昂明昀昏昕昊"], +["aa40","昇服朋杭枋枕東果杳杷枇枝林杯杰板枉松析杵枚枓杼杪杲欣武歧歿氓氛泣注泳沱泌泥河沽沾沼波沫法泓沸泄油況沮泗泅泱沿治泡泛泊沬泯泜泖泠"], +["aaa1","炕炎炒炊炙爬爭爸版牧物狀狎狙狗狐玩玨玟玫玥甽疝疙疚的盂盲直知矽社祀祁秉秈空穹竺糾罔羌羋者肺肥肢肱股肫肩肴肪肯臥臾舍芳芝芙芭芽芟芹花芬芥芯芸芣芰芾芷虎虱初表軋迎返近邵邸邱邶采金長門阜陀阿阻附"], +["ab40","陂隹雨青非亟亭亮信侵侯便俠俑俏保促侶俘俟俊俗侮俐俄係俚俎俞侷兗冒冑冠剎剃削前剌剋則勇勉勃勁匍南卻厚叛咬哀咨哎哉咸咦咳哇哂咽咪品"], +["aba1","哄哈咯咫咱咻咩咧咿囿垂型垠垣垢城垮垓奕契奏奎奐姜姘姿姣姨娃姥姪姚姦威姻孩宣宦室客宥封屎屏屍屋峙峒巷帝帥帟幽庠度建弈弭彥很待徊律徇後徉怒思怠急怎怨恍恰恨恢恆恃恬恫恪恤扁拜挖按拼拭持拮拽指拱拷"], +["ac40","拯括拾拴挑挂政故斫施既春昭映昧是星昨昱昤曷柿染柱柔某柬架枯柵柩柯柄柑枴柚查枸柏柞柳枰柙柢柝柒歪殃殆段毒毗氟泉洋洲洪流津洌洱洞洗"], +["aca1","活洽派洶洛泵洹洧洸洩洮洵洎洫炫為炳炬炯炭炸炮炤爰牲牯牴狩狠狡玷珊玻玲珍珀玳甚甭畏界畎畋疫疤疥疢疣癸皆皇皈盈盆盃盅省盹相眉看盾盼眇矜砂研砌砍祆祉祈祇禹禺科秒秋穿突竿竽籽紂紅紀紉紇約紆缸美羿耄"], +["ad40","耐耍耑耶胖胥胚胃胄背胡胛胎胞胤胝致舢苧范茅苣苛苦茄若茂茉苒苗英茁苜苔苑苞苓苟苯茆虐虹虻虺衍衫要觔計訂訃貞負赴赳趴軍軌述迦迢迪迥"], +["ada1","迭迫迤迨郊郎郁郃酋酊重閂限陋陌降面革韋韭音頁風飛食首香乘亳倌倍倣俯倦倥俸倩倖倆值借倚倒們俺倀倔倨俱倡個候倘俳修倭倪俾倫倉兼冤冥冢凍凌准凋剖剜剔剛剝匪卿原厝叟哨唐唁唷哼哥哲唆哺唔哩哭員唉哮哪"], +["ae40","哦唧唇哽唏圃圄埂埔埋埃堉夏套奘奚娑娘娜娟娛娓姬娠娣娩娥娌娉孫屘宰害家宴宮宵容宸射屑展屐峭峽峻峪峨峰島崁峴差席師庫庭座弱徒徑徐恙"], +["aea1","恣恥恐恕恭恩息悄悟悚悍悔悌悅悖扇拳挈拿捎挾振捕捂捆捏捉挺捐挽挪挫挨捍捌效敉料旁旅時晉晏晃晒晌晅晁書朔朕朗校核案框桓根桂桔栩梳栗桌桑栽柴桐桀格桃株桅栓栘桁殊殉殷氣氧氨氦氤泰浪涕消涇浦浸海浙涓"], +["af40","浬涉浮浚浴浩涌涊浹涅浥涔烊烘烤烙烈烏爹特狼狹狽狸狷玆班琉珮珠珪珞畔畝畜畚留疾病症疲疳疽疼疹痂疸皋皰益盍盎眩真眠眨矩砰砧砸砝破砷"], +["afa1","砥砭砠砟砲祕祐祠祟祖神祝祗祚秤秣秧租秦秩秘窄窈站笆笑粉紡紗紋紊素索純紐紕級紜納紙紛缺罟羔翅翁耆耘耕耙耗耽耿胱脂胰脅胭胴脆胸胳脈能脊胼胯臭臬舀舐航舫舨般芻茫荒荔荊茸荐草茵茴荏茲茹茶茗荀茱茨荃"], +["b040","虔蚊蚪蚓蚤蚩蚌蚣蚜衰衷袁袂衽衹記訐討訌訕訊託訓訖訏訑豈豺豹財貢起躬軒軔軏辱送逆迷退迺迴逃追逅迸邕郡郝郢酒配酌釘針釗釜釙閃院陣陡"], +["b0a1","陛陝除陘陞隻飢馬骨高鬥鬲鬼乾偺偽停假偃偌做偉健偶偎偕偵側偷偏倏偯偭兜冕凰剪副勒務勘動匐匏匙匿區匾參曼商啪啦啄啞啡啃啊唱啖問啕唯啤唸售啜唬啣唳啁啗圈國圉域堅堊堆埠埤基堂堵執培夠奢娶婁婉婦婪婀"], +["b140","娼婢婚婆婊孰寇寅寄寂宿密尉專將屠屜屝崇崆崎崛崖崢崑崩崔崙崤崧崗巢常帶帳帷康庸庶庵庾張強彗彬彩彫得徙從徘御徠徜恿患悉悠您惋悴惦悽"], +["b1a1","情悻悵惜悼惘惕惆惟悸惚惇戚戛扈掠控捲掖探接捷捧掘措捱掩掉掃掛捫推掄授掙採掬排掏掀捻捩捨捺敝敖救教敗啟敏敘敕敔斜斛斬族旋旌旎晝晚晤晨晦晞曹勗望梁梯梢梓梵桿桶梱梧梗械梃棄梭梆梅梔條梨梟梡梂欲殺"], +["b240","毫毬氫涎涼淳淙液淡淌淤添淺清淇淋涯淑涮淞淹涸混淵淅淒渚涵淚淫淘淪深淮淨淆淄涪淬涿淦烹焉焊烽烯爽牽犁猜猛猖猓猙率琅琊球理現琍瓠瓶"], +["b2a1","瓷甜產略畦畢異疏痔痕疵痊痍皎盔盒盛眷眾眼眶眸眺硫硃硎祥票祭移窒窕笠笨笛第符笙笞笮粒粗粕絆絃統紮紹紼絀細紳組累終紲紱缽羞羚翌翎習耜聊聆脯脖脣脫脩脰脤舂舵舷舶船莎莞莘荸莢莖莽莫莒莊莓莉莠荷荻荼"], +["b340","莆莧處彪蛇蛀蚶蛄蚵蛆蛋蚱蚯蛉術袞袈被袒袖袍袋覓規訪訝訣訥許設訟訛訢豉豚販責貫貨貪貧赧赦趾趺軛軟這逍通逗連速逝逐逕逞造透逢逖逛途"], +["b3a1","部郭都酗野釵釦釣釧釭釩閉陪陵陳陸陰陴陶陷陬雀雪雩章竟頂頃魚鳥鹵鹿麥麻傢傍傅備傑傀傖傘傚最凱割剴創剩勞勝勛博厥啻喀喧啼喊喝喘喂喜喪喔喇喋喃喳單喟唾喲喚喻喬喱啾喉喫喙圍堯堪場堤堰報堡堝堠壹壺奠"], +["b440","婷媚婿媒媛媧孳孱寒富寓寐尊尋就嵌嵐崴嵇巽幅帽幀幃幾廊廁廂廄弼彭復循徨惑惡悲悶惠愜愣惺愕惰惻惴慨惱愎惶愉愀愒戟扉掣掌描揀揩揉揆揍"], +["b4a1","插揣提握揖揭揮捶援揪換摒揚揹敞敦敢散斑斐斯普晰晴晶景暑智晾晷曾替期朝棺棕棠棘棗椅棟棵森棧棹棒棲棣棋棍植椒椎棉棚楮棻款欺欽殘殖殼毯氮氯氬港游湔渡渲湧湊渠渥渣減湛湘渤湖湮渭渦湯渴湍渺測湃渝渾滋"], +["b540","溉渙湎湣湄湲湩湟焙焚焦焰無然煮焜牌犄犀猶猥猴猩琺琪琳琢琥琵琶琴琯琛琦琨甥甦畫番痢痛痣痙痘痞痠登發皖皓皴盜睏短硝硬硯稍稈程稅稀窘"], +["b5a1","窗窖童竣等策筆筐筒答筍筋筏筑粟粥絞結絨絕紫絮絲絡給絢絰絳善翔翕耋聒肅腕腔腋腑腎脹腆脾腌腓腴舒舜菩萃菸萍菠菅萋菁華菱菴著萊菰萌菌菽菲菊萸萎萄菜萇菔菟虛蛟蛙蛭蛔蛛蛤蛐蛞街裁裂袱覃視註詠評詞証詁"], +["b640","詔詛詐詆訴診訶詖象貂貯貼貳貽賁費賀貴買貶貿貸越超趁跎距跋跚跑跌跛跆軻軸軼辜逮逵週逸進逶鄂郵鄉郾酣酥量鈔鈕鈣鈉鈞鈍鈐鈇鈑閔閏開閑"], +["b6a1","間閒閎隊階隋陽隅隆隍陲隄雁雅雄集雇雯雲韌項順須飧飪飯飩飲飭馮馭黃黍黑亂傭債傲傳僅傾催傷傻傯僇剿剷剽募勦勤勢勣匯嗟嗨嗓嗦嗎嗜嗇嗑嗣嗤嗯嗚嗡嗅嗆嗥嗉園圓塞塑塘塗塚塔填塌塭塊塢塒塋奧嫁嫉嫌媾媽媼"], +["b740","媳嫂媲嵩嵯幌幹廉廈弒彙徬微愚意慈感想愛惹愁愈慎慌慄慍愾愴愧愍愆愷戡戢搓搾搞搪搭搽搬搏搜搔損搶搖搗搆敬斟新暗暉暇暈暖暄暘暍會榔業"], +["b7a1","楚楷楠楔極椰概楊楨楫楞楓楹榆楝楣楛歇歲毀殿毓毽溢溯滓溶滂源溝滇滅溥溘溼溺溫滑準溜滄滔溪溧溴煎煙煩煤煉照煜煬煦煌煥煞煆煨煖爺牒猷獅猿猾瑯瑚瑕瑟瑞瑁琿瑙瑛瑜當畸瘀痰瘁痲痱痺痿痴痳盞盟睛睫睦睞督"], +["b840","睹睪睬睜睥睨睢矮碎碰碗碘碌碉硼碑碓硿祺祿禁萬禽稜稚稠稔稟稞窟窠筷節筠筮筧粱粳粵經絹綑綁綏絛置罩罪署義羨群聖聘肆肄腱腰腸腥腮腳腫"], +["b8a1","腹腺腦舅艇蒂葷落萱葵葦葫葉葬葛萼萵葡董葩葭葆虞虜號蛹蜓蜈蜇蜀蛾蛻蜂蜃蜆蜊衙裟裔裙補裘裝裡裊裕裒覜解詫該詳試詩詰誇詼詣誠話誅詭詢詮詬詹詻訾詨豢貊貉賊資賈賄貲賃賂賅跡跟跨路跳跺跪跤跦躲較載軾輊"], +["b940","辟農運遊道遂達逼違遐遇遏過遍遑逾遁鄒鄗酬酪酩釉鈷鉗鈸鈽鉀鈾鉛鉋鉤鉑鈴鉉鉍鉅鈹鈿鉚閘隘隔隕雍雋雉雊雷電雹零靖靴靶預頑頓頊頒頌飼飴"], +["b9a1","飽飾馳馱馴髡鳩麂鼎鼓鼠僧僮僥僖僭僚僕像僑僱僎僩兢凳劃劂匱厭嗾嘀嘛嘗嗽嘔嘆嘉嘍嘎嗷嘖嘟嘈嘐嗶團圖塵塾境墓墊塹墅塽壽夥夢夤奪奩嫡嫦嫩嫗嫖嫘嫣孵寞寧寡寥實寨寢寤察對屢嶄嶇幛幣幕幗幔廓廖弊彆彰徹慇"], +["ba40","愿態慷慢慣慟慚慘慵截撇摘摔撤摸摟摺摑摧搴摭摻敲斡旗旖暢暨暝榜榨榕槁榮槓構榛榷榻榫榴槐槍榭槌榦槃榣歉歌氳漳演滾漓滴漩漾漠漬漏漂漢"], +["baa1","滿滯漆漱漸漲漣漕漫漯澈漪滬漁滲滌滷熔熙煽熊熄熒爾犒犖獄獐瑤瑣瑪瑰瑭甄疑瘧瘍瘋瘉瘓盡監瞄睽睿睡磁碟碧碳碩碣禎福禍種稱窪窩竭端管箕箋筵算箝箔箏箸箇箄粹粽精綻綰綜綽綾綠緊綴網綱綺綢綿綵綸維緒緇綬"], +["bb40","罰翠翡翟聞聚肇腐膀膏膈膊腿膂臧臺與舔舞艋蓉蒿蓆蓄蒙蒞蒲蒜蓋蒸蓀蓓蒐蒼蓑蓊蜿蜜蜻蜢蜥蜴蜘蝕蜷蜩裳褂裴裹裸製裨褚裯誦誌語誣認誡誓誤"], +["bba1","說誥誨誘誑誚誧豪貍貌賓賑賒赫趙趕跼輔輒輕輓辣遠遘遜遣遙遞遢遝遛鄙鄘鄞酵酸酷酴鉸銀銅銘銖鉻銓銜銨鉼銑閡閨閩閣閥閤隙障際雌雒需靼鞅韶頗領颯颱餃餅餌餉駁骯骰髦魁魂鳴鳶鳳麼鼻齊億儀僻僵價儂儈儉儅凜"], +["bc40","劇劈劉劍劊勰厲嘮嘻嘹嘲嘿嘴嘩噓噎噗噴嘶嘯嘰墀墟增墳墜墮墩墦奭嬉嫻嬋嫵嬌嬈寮寬審寫層履嶝嶔幢幟幡廢廚廟廝廣廠彈影德徵慶慧慮慝慕憂"], +["bca1","慼慰慫慾憧憐憫憎憬憚憤憔憮戮摩摯摹撞撲撈撐撰撥撓撕撩撒撮播撫撚撬撙撢撳敵敷數暮暫暴暱樣樟槨樁樞標槽模樓樊槳樂樅槭樑歐歎殤毅毆漿潼澄潑潦潔澆潭潛潸潮澎潺潰潤澗潘滕潯潠潟熟熬熱熨牖犛獎獗瑩璋璃"], +["bd40","瑾璀畿瘠瘩瘟瘤瘦瘡瘢皚皺盤瞎瞇瞌瞑瞋磋磅確磊碾磕碼磐稿稼穀稽稷稻窯窮箭箱範箴篆篇篁箠篌糊締練緯緻緘緬緝編緣線緞緩綞緙緲緹罵罷羯"], +["bda1","翩耦膛膜膝膠膚膘蔗蔽蔚蓮蔬蔭蔓蔑蔣蔡蔔蓬蔥蓿蔆螂蝴蝶蝠蝦蝸蝨蝙蝗蝌蝓衛衝褐複褒褓褕褊誼諒談諄誕請諸課諉諂調誰論諍誶誹諛豌豎豬賠賞賦賤賬賭賢賣賜質賡赭趟趣踫踐踝踢踏踩踟踡踞躺輝輛輟輩輦輪輜輞"], +["be40","輥適遮遨遭遷鄰鄭鄧鄱醇醉醋醃鋅銻銷鋪銬鋤鋁銳銼鋒鋇鋰銲閭閱霄霆震霉靠鞍鞋鞏頡頫頜颳養餓餒餘駝駐駟駛駑駕駒駙骷髮髯鬧魅魄魷魯鴆鴉"], +["bea1","鴃麩麾黎墨齒儒儘儔儐儕冀冪凝劑劓勳噙噫噹噩噤噸噪器噥噱噯噬噢噶壁墾壇壅奮嬝嬴學寰導彊憲憑憩憊懍憶憾懊懈戰擅擁擋撻撼據擄擇擂操撿擒擔撾整曆曉暹曄曇暸樽樸樺橙橫橘樹橄橢橡橋橇樵機橈歙歷氅濂澱澡"], +["bf40","濃澤濁澧澳激澹澶澦澠澴熾燉燐燒燈燕熹燎燙燜燃燄獨璜璣璘璟璞瓢甌甍瘴瘸瘺盧盥瞠瞞瞟瞥磨磚磬磧禦積穎穆穌穋窺篙簑築篤篛篡篩篦糕糖縊"], +["bfa1","縑縈縛縣縞縝縉縐罹羲翰翱翮耨膳膩膨臻興艘艙蕊蕙蕈蕨蕩蕃蕉蕭蕪蕞螃螟螞螢融衡褪褲褥褫褡親覦諦諺諫諱謀諜諧諮諾謁謂諷諭諳諶諼豫豭貓賴蹄踱踴蹂踹踵輻輯輸輳辨辦遵遴選遲遼遺鄴醒錠錶鋸錳錯錢鋼錫錄錚"], +["c040","錐錦錡錕錮錙閻隧隨險雕霎霑霖霍霓霏靛靜靦鞘頰頸頻頷頭頹頤餐館餞餛餡餚駭駢駱骸骼髻髭鬨鮑鴕鴣鴦鴨鴒鴛默黔龍龜優償儡儲勵嚎嚀嚐嚅嚇"], +["c0a1","嚏壕壓壑壎嬰嬪嬤孺尷屨嶼嶺嶽嶸幫彌徽應懂懇懦懋戲戴擎擊擘擠擰擦擬擱擢擭斂斃曙曖檀檔檄檢檜櫛檣橾檗檐檠歜殮毚氈濘濱濟濠濛濤濫濯澀濬濡濩濕濮濰燧營燮燦燥燭燬燴燠爵牆獰獲璩環璦璨癆療癌盪瞳瞪瞰瞬"], +["c140","瞧瞭矯磷磺磴磯礁禧禪穗窿簇簍篾篷簌篠糠糜糞糢糟糙糝縮績繆縷縲繃縫總縱繅繁縴縹繈縵縿縯罄翳翼聱聲聰聯聳臆臃膺臂臀膿膽臉膾臨舉艱薪"], +["c1a1","薄蕾薜薑薔薯薛薇薨薊虧蟀蟑螳蟒蟆螫螻螺蟈蟋褻褶襄褸褽覬謎謗謙講謊謠謝謄謐豁谿豳賺賽購賸賻趨蹉蹋蹈蹊轄輾轂轅輿避遽還邁邂邀鄹醣醞醜鍍鎂錨鍵鍊鍥鍋錘鍾鍬鍛鍰鍚鍔闊闋闌闈闆隱隸雖霜霞鞠韓顆颶餵騁"], +["c240","駿鮮鮫鮪鮭鴻鴿麋黏點黜黝黛鼾齋叢嚕嚮壙壘嬸彝懣戳擴擲擾攆擺擻擷斷曜朦檳檬櫃檻檸櫂檮檯歟歸殯瀉瀋濾瀆濺瀑瀏燻燼燾燸獷獵璧璿甕癖癘"], +["c2a1","癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶臍臏舊藏薩藍藐藉薰薺薹薦蟯蟬蟲蟠覆覲觴謨謹謬謫豐贅蹙蹣蹦蹤蹟蹕軀轉轍邇邃邈醫醬釐鎔鎊鎖鎢鎳鎮鎬鎰鎘鎚鎗闔闖闐闕離雜雙雛雞霤鞣鞦"], +["c340","鞭韹額顏題顎顓颺餾餿餽餮馥騎髁鬃鬆魏魎魍鯊鯉鯽鯈鯀鵑鵝鵠黠鼕鼬儳嚥壞壟壢寵龐廬懲懷懶懵攀攏曠曝櫥櫝櫚櫓瀛瀟瀨瀚瀝瀕瀘爆爍牘犢獸"], +["c3a1","獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩藝藪藕藤藥藷蟻蠅蠍蟹蟾襠襟襖襞譁譜識證譚譎譏譆譙贈贊蹼蹲躇蹶蹬蹺蹴轔轎辭邊邋醱醮鏡鏑鏟鏃鏈鏜鏝鏖鏢鏍鏘鏤鏗鏨關隴難霪霧靡韜韻類"], +["c440","願顛颼饅饉騖騙鬍鯨鯧鯖鯛鶉鵡鵲鵪鵬麒麗麓麴勸嚨嚷嚶嚴嚼壤孀孃孽寶巉懸懺攘攔攙曦朧櫬瀾瀰瀲爐獻瓏癢癥礦礪礬礫竇競籌籃籍糯糰辮繽繼"], +["c4a1","纂罌耀臚艦藻藹蘑藺蘆蘋蘇蘊蠔蠕襤覺觸議譬警譯譟譫贏贍躉躁躅躂醴釋鐘鐃鏽闡霰飄饒饑馨騫騰騷騵鰓鰍鹹麵黨鼯齟齣齡儷儸囁囀囂夔屬巍懼懾攝攜斕曩櫻欄櫺殲灌爛犧瓖瓔癩矓籐纏續羼蘗蘭蘚蠣蠢蠡蠟襪襬覽譴"], +["c540","護譽贓躊躍躋轟辯醺鐮鐳鐵鐺鐸鐲鐫闢霸霹露響顧顥饗驅驃驀騾髏魔魑鰭鰥鶯鶴鷂鶸麝黯鼙齜齦齧儼儻囈囊囉孿巔巒彎懿攤權歡灑灘玀瓤疊癮癬"], +["c5a1","禳籠籟聾聽臟襲襯觼讀贖贗躑躓轡酈鑄鑑鑒霽霾韃韁顫饕驕驍髒鬚鱉鰱鰾鰻鷓鷗鼴齬齪龔囌巖戀攣攫攪曬欐瓚竊籤籣籥纓纖纔臢蘸蘿蠱變邐邏鑣鑠鑤靨顯饜驚驛驗髓體髑鱔鱗鱖鷥麟黴囑壩攬灞癱癲矗罐羈蠶蠹衢讓讒"], +["c640","讖艷贛釀鑪靂靈靄韆顰驟鬢魘鱟鷹鷺鹼鹽鼇齷齲廳欖灣籬籮蠻觀躡釁鑲鑰顱饞髖鬣黌灤矚讚鑷韉驢驥纜讜躪釅鑽鑾鑼鱷鱸黷豔鑿鸚爨驪鬱鸛鸞籲"], +["c940","乂乜凵匚厂万丌乇亍囗兀屮彳丏冇与丮亓仂仉仈冘勼卬厹圠夃夬尐巿旡殳毌气爿丱丼仨仜仩仡仝仚刌匜卌圢圣夗夯宁宄尒尻屴屳帄庀庂忉戉扐氕"], +["c9a1","氶汃氿氻犮犰玊禸肊阞伎优伬仵伔仱伀价伈伝伂伅伢伓伄仴伒冱刓刉刐劦匢匟卍厊吇囡囟圮圪圴夼妀奼妅奻奾奷奿孖尕尥屼屺屻屾巟幵庄异弚彴忕忔忏扜扞扤扡扦扢扙扠扚扥旯旮朾朹朸朻机朿朼朳氘汆汒汜汏汊汔汋"], +["ca40","汌灱牞犴犵玎甪癿穵网艸艼芀艽艿虍襾邙邗邘邛邔阢阤阠阣佖伻佢佉体佤伾佧佒佟佁佘伭伳伿佡冏冹刜刞刡劭劮匉卣卲厎厏吰吷吪呔呅吙吜吥吘"], +["caa1","吽呏呁吨吤呇囮囧囥坁坅坌坉坋坒夆奀妦妘妠妗妎妢妐妏妧妡宎宒尨尪岍岏岈岋岉岒岊岆岓岕巠帊帎庋庉庌庈庍弅弝彸彶忒忑忐忭忨忮忳忡忤忣忺忯忷忻怀忴戺抃抌抎抏抔抇扱扻扺扰抁抈扷扽扲扴攷旰旴旳旲旵杅杇"], +["cb40","杙杕杌杈杝杍杚杋毐氙氚汸汧汫沄沋沏汱汯汩沚汭沇沕沜汦汳汥汻沎灴灺牣犿犽狃狆狁犺狅玕玗玓玔玒町甹疔疕皁礽耴肕肙肐肒肜芐芏芅芎芑芓"], +["cba1","芊芃芄豸迉辿邟邡邥邞邧邠阰阨阯阭丳侘佼侅佽侀侇佶佴侉侄佷佌侗佪侚佹侁佸侐侜侔侞侒侂侕佫佮冞冼冾刵刲刳剆刱劼匊匋匼厒厔咇呿咁咑咂咈呫呺呾呥呬呴呦咍呯呡呠咘呣呧呤囷囹坯坲坭坫坱坰坶垀坵坻坳坴坢"], +["cc40","坨坽夌奅妵妺姏姎妲姌姁妶妼姃姖妱妽姀姈妴姇孢孥宓宕屄屇岮岤岠岵岯岨岬岟岣岭岢岪岧岝岥岶岰岦帗帔帙弨弢弣弤彔徂彾彽忞忥怭怦怙怲怋"], +["cca1","怴怊怗怳怚怞怬怢怍怐怮怓怑怌怉怜戔戽抭抴拑抾抪抶拊抮抳抯抻抩抰抸攽斨斻昉旼昄昒昈旻昃昋昍昅旽昑昐曶朊枅杬枎枒杶杻枘枆构杴枍枌杺枟枑枙枃杽极杸杹枔欥殀歾毞氝沓泬泫泮泙沶泔沭泧沷泐泂沺泃泆泭泲"], +["cd40","泒泝沴沊沝沀泞泀洰泍泇沰泹泏泩泑炔炘炅炓炆炄炑炖炂炚炃牪狖狋狘狉狜狒狔狚狌狑玤玡玭玦玢玠玬玝瓝瓨甿畀甾疌疘皯盳盱盰盵矸矼矹矻矺"], +["cda1","矷祂礿秅穸穻竻籵糽耵肏肮肣肸肵肭舠芠苀芫芚芘芛芵芧芮芼芞芺芴芨芡芩苂芤苃芶芢虰虯虭虮豖迒迋迓迍迖迕迗邲邴邯邳邰阹阽阼阺陃俍俅俓侲俉俋俁俔俜俙侻侳俛俇俖侺俀侹俬剄剉勀勂匽卼厗厖厙厘咺咡咭咥哏"], +["ce40","哃茍咷咮哖咶哅哆咠呰咼咢咾呲哞咰垵垞垟垤垌垗垝垛垔垘垏垙垥垚垕壴复奓姡姞姮娀姱姝姺姽姼姶姤姲姷姛姩姳姵姠姾姴姭宨屌峐峘峌峗峋峛"], +["cea1","峞峚峉峇峊峖峓峔峏峈峆峎峟峸巹帡帢帣帠帤庰庤庢庛庣庥弇弮彖徆怷怹恔恲恞恅恓恇恉恛恌恀恂恟怤恄恘恦恮扂扃拏挍挋拵挎挃拫拹挏挌拸拶挀挓挔拺挕拻拰敁敃斪斿昶昡昲昵昜昦昢昳昫昺昝昴昹昮朏朐柁柲柈枺"], +["cf40","柜枻柸柘柀枷柅柫柤柟枵柍枳柷柶柮柣柂枹柎柧柰枲柼柆柭柌枮柦柛柺柉柊柃柪柋欨殂殄殶毖毘毠氠氡洨洴洭洟洼洿洒洊泚洳洄洙洺洚洑洀洝浂"], +["cfa1","洁洘洷洃洏浀洇洠洬洈洢洉洐炷炟炾炱炰炡炴炵炩牁牉牊牬牰牳牮狊狤狨狫狟狪狦狣玅珌珂珈珅玹玶玵玴珫玿珇玾珃珆玸珋瓬瓮甮畇畈疧疪癹盄眈眃眄眅眊盷盻盺矧矨砆砑砒砅砐砏砎砉砃砓祊祌祋祅祄秕种秏秖秎窀"], +["d040","穾竑笀笁籺籸籹籿粀粁紃紈紁罘羑羍羾耇耎耏耔耷胘胇胠胑胈胂胐胅胣胙胜胊胕胉胏胗胦胍臿舡芔苙苾苹茇苨茀苕茺苫苖苴苬苡苲苵茌苻苶苰苪"], +["d0a1","苤苠苺苳苭虷虴虼虳衁衎衧衪衩觓訄訇赲迣迡迮迠郱邽邿郕郅邾郇郋郈釔釓陔陏陑陓陊陎倞倅倇倓倢倰倛俵俴倳倷倬俶俷倗倜倠倧倵倯倱倎党冔冓凊凄凅凈凎剡剚剒剞剟剕剢勍匎厞唦哢唗唒哧哳哤唚哿唄唈哫唑唅哱"], +["d140","唊哻哷哸哠唎唃唋圁圂埌堲埕埒垺埆垽垼垸垶垿埇埐垹埁夎奊娙娖娭娮娕娏娗娊娞娳孬宧宭宬尃屖屔峬峿峮峱峷崀峹帩帨庨庮庪庬弳弰彧恝恚恧"], +["d1a1","恁悢悈悀悒悁悝悃悕悛悗悇悜悎戙扆拲挐捖挬捄捅挶捃揤挹捋捊挼挩捁挴捘捔捙挭捇挳捚捑挸捗捀捈敊敆旆旃旄旂晊晟晇晑朒朓栟栚桉栲栳栻桋桏栖栱栜栵栫栭栯桎桄栴栝栒栔栦栨栮桍栺栥栠欬欯欭欱欴歭肂殈毦毤"], +["d240","毨毣毢毧氥浺浣浤浶洍浡涒浘浢浭浯涑涍淯浿涆浞浧浠涗浰浼浟涂涘洯浨涋浾涀涄洖涃浻浽浵涐烜烓烑烝烋缹烢烗烒烞烠烔烍烅烆烇烚烎烡牂牸"], +["d2a1","牷牶猀狺狴狾狶狳狻猁珓珙珥珖玼珧珣珩珜珒珛珔珝珚珗珘珨瓞瓟瓴瓵甡畛畟疰痁疻痄痀疿疶疺皊盉眝眛眐眓眒眣眑眕眙眚眢眧砣砬砢砵砯砨砮砫砡砩砳砪砱祔祛祏祜祓祒祑秫秬秠秮秭秪秜秞秝窆窉窅窋窌窊窇竘笐"], +["d340","笄笓笅笏笈笊笎笉笒粄粑粊粌粈粍粅紞紝紑紎紘紖紓紟紒紏紌罜罡罞罠罝罛羖羒翃翂翀耖耾耹胺胲胹胵脁胻脀舁舯舥茳茭荄茙荑茥荖茿荁茦茜茢"], +["d3a1","荂荎茛茪茈茼荍茖茤茠茷茯茩荇荅荌荓茞茬荋茧荈虓虒蚢蚨蚖蚍蚑蚞蚇蚗蚆蚋蚚蚅蚥蚙蚡蚧蚕蚘蚎蚝蚐蚔衃衄衭衵衶衲袀衱衿衯袃衾衴衼訒豇豗豻貤貣赶赸趵趷趶軑軓迾迵适迿迻逄迼迶郖郠郙郚郣郟郥郘郛郗郜郤酐"], +["d440","酎酏釕釢釚陜陟隼飣髟鬯乿偰偪偡偞偠偓偋偝偲偈偍偁偛偊偢倕偅偟偩偫偣偤偆偀偮偳偗偑凐剫剭剬剮勖勓匭厜啵啶唼啍啐唴唪啑啢唶唵唰啒啅"], +["d4a1","唌唲啥啎唹啈唭唻啀啋圊圇埻堔埢埶埜埴堀埭埽堈埸堋埳埏堇埮埣埲埥埬埡堎埼堐埧堁堌埱埩埰堍堄奜婠婘婕婧婞娸娵婭婐婟婥婬婓婤婗婃婝婒婄婛婈媎娾婍娹婌婰婩婇婑婖婂婜孲孮寁寀屙崞崋崝崚崠崌崨崍崦崥崏"], +["d540","崰崒崣崟崮帾帴庱庴庹庲庳弶弸徛徖徟悊悐悆悾悰悺惓惔惏惤惙惝惈悱惛悷惊悿惃惍惀挲捥掊掂捽掽掞掭掝掗掫掎捯掇掐据掯捵掜捭掮捼掤挻掟"], +["d5a1","捸掅掁掑掍捰敓旍晥晡晛晙晜晢朘桹梇梐梜桭桮梮梫楖桯梣梬梩桵桴梲梏桷梒桼桫桲梪梀桱桾梛梖梋梠梉梤桸桻梑梌梊桽欶欳欷欸殑殏殍殎殌氪淀涫涴涳湴涬淩淢涷淶淔渀淈淠淟淖涾淥淜淝淛淴淊涽淭淰涺淕淂淏淉"], +["d640","淐淲淓淽淗淍淣涻烺焍烷焗烴焌烰焄烳焐烼烿焆焓焀烸烶焋焂焎牾牻牼牿猝猗猇猑猘猊猈狿猏猞玈珶珸珵琄琁珽琇琀珺珼珿琌琋珴琈畤畣痎痒痏"], +["d6a1","痋痌痑痐皏皉盓眹眯眭眱眲眴眳眽眥眻眵硈硒硉硍硊硌砦硅硐祤祧祩祪祣祫祡离秺秸秶秷窏窔窐笵筇笴笥笰笢笤笳笘笪笝笱笫笭笯笲笸笚笣粔粘粖粣紵紽紸紶紺絅紬紩絁絇紾紿絊紻紨罣羕羜羝羛翊翋翍翐翑翇翏翉耟"], +["d740","耞耛聇聃聈脘脥脙脛脭脟脬脞脡脕脧脝脢舑舸舳舺舴舲艴莐莣莨莍荺荳莤荴莏莁莕莙荵莔莩荽莃莌莝莛莪莋荾莥莯莈莗莰荿莦莇莮荶莚虙虖蚿蚷"], +["d7a1","蛂蛁蛅蚺蚰蛈蚹蚳蚸蛌蚴蚻蚼蛃蚽蚾衒袉袕袨袢袪袚袑袡袟袘袧袙袛袗袤袬袌袓袎覂觖觙觕訰訧訬訞谹谻豜豝豽貥赽赻赹趼跂趹趿跁軘軞軝軜軗軠軡逤逋逑逜逌逡郯郪郰郴郲郳郔郫郬郩酖酘酚酓酕釬釴釱釳釸釤釹釪"], +["d840","釫釷釨釮镺閆閈陼陭陫陱陯隿靪頄飥馗傛傕傔傞傋傣傃傌傎傝偨傜傒傂傇兟凔匒匑厤厧喑喨喥喭啷噅喢喓喈喏喵喁喣喒喤啽喌喦啿喕喡喎圌堩堷"], +["d8a1","堙堞堧堣堨埵塈堥堜堛堳堿堶堮堹堸堭堬堻奡媯媔媟婺媢媞婸媦婼媥媬媕媮娷媄媊媗媃媋媩婻婽媌媜媏媓媝寪寍寋寔寑寊寎尌尰崷嵃嵫嵁嵋崿崵嵑嵎嵕崳崺嵒崽崱嵙嵂崹嵉崸崼崲崶嵀嵅幄幁彘徦徥徫惉悹惌惢惎惄愔"], +["d940","惲愊愖愅惵愓惸惼惾惁愃愘愝愐惿愄愋扊掔掱掰揎揥揨揯揃撝揳揊揠揶揕揲揵摡揟掾揝揜揄揘揓揂揇揌揋揈揰揗揙攲敧敪敤敜敨敥斌斝斞斮旐旒"], +["d9a1","晼晬晻暀晱晹晪晲朁椌棓椄棜椪棬棪棱椏棖棷棫棤棶椓椐棳棡椇棌椈楰梴椑棯棆椔棸棐棽棼棨椋椊椗棎棈棝棞棦棴棑椆棔棩椕椥棇欹欻欿欼殔殗殙殕殽毰毲毳氰淼湆湇渟湉溈渼渽湅湢渫渿湁湝湳渜渳湋湀湑渻渃渮湞"], +["da40","湨湜湡渱渨湠湱湫渹渢渰湓湥渧湸湤湷湕湹湒湦渵渶湚焠焞焯烻焮焱焣焥焢焲焟焨焺焛牋牚犈犉犆犅犋猒猋猰猢猱猳猧猲猭猦猣猵猌琮琬琰琫琖"], +["daa1","琚琡琭琱琤琣琝琩琠琲瓻甯畯畬痧痚痡痦痝痟痤痗皕皒盚睆睇睄睍睅睊睎睋睌矞矬硠硤硥硜硭硱硪确硰硩硨硞硢祴祳祲祰稂稊稃稌稄窙竦竤筊笻筄筈筌筎筀筘筅粢粞粨粡絘絯絣絓絖絧絪絏絭絜絫絒絔絩絑絟絎缾缿罥"], +["db40","罦羢羠羡翗聑聏聐胾胔腃腊腒腏腇脽腍脺臦臮臷臸臹舄舼舽舿艵茻菏菹萣菀菨萒菧菤菼菶萐菆菈菫菣莿萁菝菥菘菿菡菋菎菖菵菉萉萏菞萑萆菂菳"], +["dba1","菕菺菇菑菪萓菃菬菮菄菻菗菢萛菛菾蛘蛢蛦蛓蛣蛚蛪蛝蛫蛜蛬蛩蛗蛨蛑衈衖衕袺裗袹袸裀袾袶袼袷袽袲褁裉覕覘覗觝觚觛詎詍訹詙詀詗詘詄詅詒詈詑詊詌詏豟貁貀貺貾貰貹貵趄趀趉跘跓跍跇跖跜跏跕跙跈跗跅軯軷軺"], +["dc40","軹軦軮軥軵軧軨軶軫軱軬軴軩逭逴逯鄆鄬鄄郿郼鄈郹郻鄁鄀鄇鄅鄃酡酤酟酢酠鈁鈊鈥鈃鈚鈦鈏鈌鈀鈒釿釽鈆鈄鈧鈂鈜鈤鈙鈗鈅鈖镻閍閌閐隇陾隈"], +["dca1","隉隃隀雂雈雃雱雰靬靰靮頇颩飫鳦黹亃亄亶傽傿僆傮僄僊傴僈僂傰僁傺傱僋僉傶傸凗剺剸剻剼嗃嗛嗌嗐嗋嗊嗝嗀嗔嗄嗩喿嗒喍嗏嗕嗢嗖嗈嗲嗍嗙嗂圔塓塨塤塏塍塉塯塕塎塝塙塥塛堽塣塱壼嫇嫄嫋媺媸媱媵媰媿嫈媻嫆"], +["dd40","媷嫀嫊媴媶嫍媹媐寖寘寙尟尳嵱嵣嵊嵥嵲嵬嵞嵨嵧嵢巰幏幎幊幍幋廅廌廆廋廇彀徯徭惷慉慊愫慅愶愲愮慆愯慏愩慀戠酨戣戥戤揅揱揫搐搒搉搠搤"], +["dda1","搳摃搟搕搘搹搷搢搣搌搦搰搨摁搵搯搊搚摀搥搧搋揧搛搮搡搎敯斒旓暆暌暕暐暋暊暙暔晸朠楦楟椸楎楢楱椿楅楪椹楂楗楙楺楈楉椵楬椳椽楥棰楸椴楩楀楯楄楶楘楁楴楌椻楋椷楜楏楑椲楒椯楻椼歆歅歃歂歈歁殛嗀毻毼"], +["de40","毹毷毸溛滖滈溏滀溟溓溔溠溱溹滆滒溽滁溞滉溷溰滍溦滏溲溾滃滜滘溙溒溎溍溤溡溿溳滐滊溗溮溣煇煔煒煣煠煁煝煢煲煸煪煡煂煘煃煋煰煟煐煓"], +["dea1","煄煍煚牏犍犌犑犐犎猼獂猻猺獀獊獉瑄瑊瑋瑒瑑瑗瑀瑏瑐瑎瑂瑆瑍瑔瓡瓿瓾瓽甝畹畷榃痯瘏瘃痷痾痼痹痸瘐痻痶痭痵痽皙皵盝睕睟睠睒睖睚睩睧睔睙睭矠碇碚碔碏碄碕碅碆碡碃硹碙碀碖硻祼禂祽祹稑稘稙稒稗稕稢稓"], +["df40","稛稐窣窢窞竫筦筤筭筴筩筲筥筳筱筰筡筸筶筣粲粴粯綈綆綀綍絿綅絺綎絻綃絼綌綔綄絽綒罭罫罧罨罬羦羥羧翛翜耡腤腠腷腜腩腛腢腲朡腞腶腧腯"], +["dfa1","腄腡舝艉艄艀艂艅蓱萿葖葶葹蒏蒍葥葑葀蒆葧萰葍葽葚葙葴葳葝蔇葞萷萺萴葺葃葸萲葅萩菙葋萯葂萭葟葰萹葎葌葒葯蓅蒎萻葇萶萳葨葾葄萫葠葔葮葐蜋蜄蛷蜌蛺蛖蛵蝍蛸蜎蜉蜁蛶蜍蜅裖裋裍裎裞裛裚裌裐覅覛觟觥觤"], +["e040","觡觠觢觜触詶誆詿詡訿詷誂誄詵誃誁詴詺谼豋豊豥豤豦貆貄貅賌赨赩趑趌趎趏趍趓趔趐趒跰跠跬跱跮跐跩跣跢跧跲跫跴輆軿輁輀輅輇輈輂輋遒逿"], +["e0a1","遄遉逽鄐鄍鄏鄑鄖鄔鄋鄎酮酯鉈鉒鈰鈺鉦鈳鉥鉞銃鈮鉊鉆鉭鉬鉏鉠鉧鉯鈶鉡鉰鈱鉔鉣鉐鉲鉎鉓鉌鉖鈲閟閜閞閛隒隓隑隗雎雺雽雸雵靳靷靸靲頏頍頎颬飶飹馯馲馰馵骭骫魛鳪鳭鳧麀黽僦僔僗僨僳僛僪僝僤僓僬僰僯僣僠"], +["e140","凘劀劁勩勫匰厬嘧嘕嘌嘒嗼嘏嘜嘁嘓嘂嗺嘝嘄嗿嗹墉塼墐墘墆墁塿塴墋塺墇墑墎塶墂墈塻墔墏壾奫嫜嫮嫥嫕嫪嫚嫭嫫嫳嫢嫠嫛嫬嫞嫝嫙嫨嫟孷寠"], +["e1a1","寣屣嶂嶀嵽嶆嵺嶁嵷嶊嶉嶈嵾嵼嶍嵹嵿幘幙幓廘廑廗廎廜廕廙廒廔彄彃彯徶愬愨慁慞慱慳慒慓慲慬憀慴慔慺慛慥愻慪慡慖戩戧戫搫摍摛摝摴摶摲摳摽摵摦撦摎撂摞摜摋摓摠摐摿搿摬摫摙摥摷敳斠暡暠暟朅朄朢榱榶槉"], +["e240","榠槎榖榰榬榼榑榙榎榧榍榩榾榯榿槄榽榤槔榹槊榚槏榳榓榪榡榞槙榗榐槂榵榥槆歊歍歋殞殟殠毃毄毾滎滵滱漃漥滸漷滻漮漉潎漙漚漧漘漻漒滭漊"], +["e2a1","漶潳滹滮漭潀漰漼漵滫漇漎潃漅滽滶漹漜滼漺漟漍漞漈漡熇熐熉熀熅熂熏煻熆熁熗牄牓犗犕犓獃獍獑獌瑢瑳瑱瑵瑲瑧瑮甀甂甃畽疐瘖瘈瘌瘕瘑瘊瘔皸瞁睼瞅瞂睮瞀睯睾瞃碲碪碴碭碨硾碫碞碥碠碬碢碤禘禊禋禖禕禔禓"], +["e340","禗禈禒禐稫穊稰稯稨稦窨窫窬竮箈箜箊箑箐箖箍箌箛箎箅箘劄箙箤箂粻粿粼粺綧綷緂綣綪緁緀緅綝緎緄緆緋緌綯綹綖綼綟綦綮綩綡緉罳翢翣翥翞"], +["e3a1","耤聝聜膉膆膃膇膍膌膋舕蒗蒤蒡蒟蒺蓎蓂蒬蒮蒫蒹蒴蓁蓍蒪蒚蒱蓐蒝蒧蒻蒢蒔蓇蓌蒛蒩蒯蒨蓖蒘蒶蓏蒠蓗蓔蓒蓛蒰蒑虡蜳蜣蜨蝫蝀蜮蜞蜡蜙蜛蝃蜬蝁蜾蝆蜠蜲蜪蜭蜼蜒蜺蜱蜵蝂蜦蜧蜸蜤蜚蜰蜑裷裧裱裲裺裾裮裼裶裻"], +["e440","裰裬裫覝覡覟覞觩觫觨誫誙誋誒誏誖谽豨豩賕賏賗趖踉踂跿踍跽踊踃踇踆踅跾踀踄輐輑輎輍鄣鄜鄠鄢鄟鄝鄚鄤鄡鄛酺酲酹酳銥銤鉶銛鉺銠銔銪銍"], +["e4a1","銦銚銫鉹銗鉿銣鋮銎銂銕銢鉽銈銡銊銆銌銙銧鉾銇銩銝銋鈭隞隡雿靘靽靺靾鞃鞀鞂靻鞄鞁靿韎韍頖颭颮餂餀餇馝馜駃馹馻馺駂馽駇骱髣髧鬾鬿魠魡魟鳱鳲鳵麧僿儃儰僸儆儇僶僾儋儌僽儊劋劌勱勯噈噂噌嘵噁噊噉噆噘"], +["e540","噚噀嘳嘽嘬嘾嘸嘪嘺圚墫墝墱墠墣墯墬墥墡壿嫿嫴嫽嫷嫶嬃嫸嬂嫹嬁嬇嬅嬏屧嶙嶗嶟嶒嶢嶓嶕嶠嶜嶡嶚嶞幩幝幠幜緳廛廞廡彉徲憋憃慹憱憰憢憉"], +["e5a1","憛憓憯憭憟憒憪憡憍慦憳戭摮摰撖撠撅撗撜撏撋撊撌撣撟摨撱撘敶敺敹敻斲斳暵暰暩暲暷暪暯樀樆樗槥槸樕槱槤樠槿槬槢樛樝槾樧槲槮樔槷槧橀樈槦槻樍槼槫樉樄樘樥樏槶樦樇槴樖歑殥殣殢殦氁氀毿氂潁漦潾澇濆澒"], +["e640","澍澉澌潢潏澅潚澖潶潬澂潕潲潒潐潗澔澓潝漀潡潫潽潧澐潓澋潩潿澕潣潷潪潻熲熯熛熰熠熚熩熵熝熥熞熤熡熪熜熧熳犘犚獘獒獞獟獠獝獛獡獚獙"], +["e6a1","獢璇璉璊璆璁瑽璅璈瑼瑹甈甇畾瘥瘞瘙瘝瘜瘣瘚瘨瘛皜皝皞皛瞍瞏瞉瞈磍碻磏磌磑磎磔磈磃磄磉禚禡禠禜禢禛歶稹窲窴窳箷篋箾箬篎箯箹篊箵糅糈糌糋緷緛緪緧緗緡縃緺緦緶緱緰緮緟罶羬羰羭翭翫翪翬翦翨聤聧膣膟"], +["e740","膞膕膢膙膗舖艏艓艒艐艎艑蔤蔻蔏蔀蔩蔎蔉蔍蔟蔊蔧蔜蓻蔫蓺蔈蔌蓴蔪蓲蔕蓷蓫蓳蓼蔒蓪蓩蔖蓾蔨蔝蔮蔂蓽蔞蓶蔱蔦蓧蓨蓰蓯蓹蔘蔠蔰蔋蔙蔯虢"], +["e7a1","蝖蝣蝤蝷蟡蝳蝘蝔蝛蝒蝡蝚蝑蝞蝭蝪蝐蝎蝟蝝蝯蝬蝺蝮蝜蝥蝏蝻蝵蝢蝧蝩衚褅褌褔褋褗褘褙褆褖褑褎褉覢覤覣觭觰觬諏諆誸諓諑諔諕誻諗誾諀諅諘諃誺誽諙谾豍貏賥賟賙賨賚賝賧趠趜趡趛踠踣踥踤踮踕踛踖踑踙踦踧"], +["e840","踔踒踘踓踜踗踚輬輤輘輚輠輣輖輗遳遰遯遧遫鄯鄫鄩鄪鄲鄦鄮醅醆醊醁醂醄醀鋐鋃鋄鋀鋙銶鋏鋱鋟鋘鋩鋗鋝鋌鋯鋂鋨鋊鋈鋎鋦鋍鋕鋉鋠鋞鋧鋑鋓"], +["e8a1","銵鋡鋆銴镼閬閫閮閰隤隢雓霅霈霂靚鞊鞎鞈韐韏頞頝頦頩頨頠頛頧颲餈飺餑餔餖餗餕駜駍駏駓駔駎駉駖駘駋駗駌骳髬髫髳髲髱魆魃魧魴魱魦魶魵魰魨魤魬鳼鳺鳽鳿鳷鴇鴀鳹鳻鴈鴅鴄麃黓鼏鼐儜儓儗儚儑凞匴叡噰噠噮"], +["e940","噳噦噣噭噲噞噷圜圛壈墽壉墿墺壂墼壆嬗嬙嬛嬡嬔嬓嬐嬖嬨嬚嬠嬞寯嶬嶱嶩嶧嶵嶰嶮嶪嶨嶲嶭嶯嶴幧幨幦幯廩廧廦廨廥彋徼憝憨憖懅憴懆懁懌憺"], +["e9a1","憿憸憌擗擖擐擏擉撽撉擃擛擳擙攳敿敼斢曈暾曀曊曋曏暽暻暺曌朣樴橦橉橧樲橨樾橝橭橶橛橑樨橚樻樿橁橪橤橐橏橔橯橩橠樼橞橖橕橍橎橆歕歔歖殧殪殫毈毇氄氃氆澭濋澣濇澼濎濈潞濄澽澞濊澨瀄澥澮澺澬澪濏澿澸"], +["ea40","澢濉澫濍澯澲澰燅燂熿熸燖燀燁燋燔燊燇燏熽燘熼燆燚燛犝犞獩獦獧獬獥獫獪瑿璚璠璔璒璕璡甋疀瘯瘭瘱瘽瘳瘼瘵瘲瘰皻盦瞚瞝瞡瞜瞛瞢瞣瞕瞙"], +["eaa1","瞗磝磩磥磪磞磣磛磡磢磭磟磠禤穄穈穇窶窸窵窱窷篞篣篧篝篕篥篚篨篹篔篪篢篜篫篘篟糒糔糗糐糑縒縡縗縌縟縠縓縎縜縕縚縢縋縏縖縍縔縥縤罃罻罼罺羱翯耪耩聬膱膦膮膹膵膫膰膬膴膲膷膧臲艕艖艗蕖蕅蕫蕍蕓蕡蕘"], +["eb40","蕀蕆蕤蕁蕢蕄蕑蕇蕣蔾蕛蕱蕎蕮蕵蕕蕧蕠薌蕦蕝蕔蕥蕬虣虥虤螛螏螗螓螒螈螁螖螘蝹螇螣螅螐螑螝螄螔螜螚螉褞褦褰褭褮褧褱褢褩褣褯褬褟觱諠"], +["eba1","諢諲諴諵諝謔諤諟諰諈諞諡諨諿諯諻貑貒貐賵賮賱賰賳赬赮趥趧踳踾踸蹀蹅踶踼踽蹁踰踿躽輶輮輵輲輹輷輴遶遹遻邆郺鄳鄵鄶醓醐醑醍醏錧錞錈錟錆錏鍺錸錼錛錣錒錁鍆錭錎錍鋋錝鋺錥錓鋹鋷錴錂錤鋿錩錹錵錪錔錌"], +["ec40","錋鋾錉錀鋻錖閼闍閾閹閺閶閿閵閽隩雔霋霒霐鞙鞗鞔韰韸頵頯頲餤餟餧餩馞駮駬駥駤駰駣駪駩駧骹骿骴骻髶髺髹髷鬳鮀鮅鮇魼魾魻鮂鮓鮒鮐魺鮕"], +["eca1","魽鮈鴥鴗鴠鴞鴔鴩鴝鴘鴢鴐鴙鴟麈麆麇麮麭黕黖黺鼒鼽儦儥儢儤儠儩勴嚓嚌嚍嚆嚄嚃噾嚂噿嚁壖壔壏壒嬭嬥嬲嬣嬬嬧嬦嬯嬮孻寱寲嶷幬幪徾徻懃憵憼懧懠懥懤懨懞擯擩擣擫擤擨斁斀斶旚曒檍檖檁檥檉檟檛檡檞檇檓檎"], +["ed40","檕檃檨檤檑橿檦檚檅檌檒歛殭氉濌澩濴濔濣濜濭濧濦濞濲濝濢濨燡燱燨燲燤燰燢獳獮獯璗璲璫璐璪璭璱璥璯甐甑甒甏疄癃癈癉癇皤盩瞵瞫瞲瞷瞶"], +["eda1","瞴瞱瞨矰磳磽礂磻磼磲礅磹磾礄禫禨穜穛穖穘穔穚窾竀竁簅簏篲簀篿篻簎篴簋篳簂簉簃簁篸篽簆篰篱簐簊糨縭縼繂縳顈縸縪繉繀繇縩繌縰縻縶繄縺罅罿罾罽翴翲耬膻臄臌臊臅臇膼臩艛艚艜薃薀薏薧薕薠薋薣蕻薤薚薞"], +["ee40","蕷蕼薉薡蕺蕸蕗薎薖薆薍薙薝薁薢薂薈薅蕹蕶薘薐薟虨螾螪螭蟅螰螬螹螵螼螮蟉蟃蟂蟌螷螯蟄蟊螴螶螿螸螽蟞螲褵褳褼褾襁襒褷襂覭覯覮觲觳謞"], +["eea1","謘謖謑謅謋謢謏謒謕謇謍謈謆謜謓謚豏豰豲豱豯貕貔賹赯蹎蹍蹓蹐蹌蹇轃轀邅遾鄸醚醢醛醙醟醡醝醠鎡鎃鎯鍤鍖鍇鍼鍘鍜鍶鍉鍐鍑鍠鍭鎏鍌鍪鍹鍗鍕鍒鍏鍱鍷鍻鍡鍞鍣鍧鎀鍎鍙闇闀闉闃闅閷隮隰隬霠霟霘霝霙鞚鞡鞜"], +["ef40","鞞鞝韕韔韱顁顄顊顉顅顃餥餫餬餪餳餲餯餭餱餰馘馣馡騂駺駴駷駹駸駶駻駽駾駼騃骾髾髽鬁髼魈鮚鮨鮞鮛鮦鮡鮥鮤鮆鮢鮠鮯鴳鵁鵧鴶鴮鴯鴱鴸鴰"], +["efa1","鵅鵂鵃鴾鴷鵀鴽翵鴭麊麉麍麰黈黚黻黿鼤鼣鼢齔龠儱儭儮嚘嚜嚗嚚嚝嚙奰嬼屩屪巀幭幮懘懟懭懮懱懪懰懫懖懩擿攄擽擸攁攃擼斔旛曚曛曘櫅檹檽櫡櫆檺檶檷櫇檴檭歞毉氋瀇瀌瀍瀁瀅瀔瀎濿瀀濻瀦濼濷瀊爁燿燹爃燽獶"], +["f040","璸瓀璵瓁璾璶璻瓂甔甓癜癤癙癐癓癗癚皦皽盬矂瞺磿礌礓礔礉礐礒礑禭禬穟簜簩簙簠簟簭簝簦簨簢簥簰繜繐繖繣繘繢繟繑繠繗繓羵羳翷翸聵臑臒"], +["f0a1","臐艟艞薴藆藀藃藂薳薵薽藇藄薿藋藎藈藅薱薶藒蘤薸薷薾虩蟧蟦蟢蟛蟫蟪蟥蟟蟳蟤蟔蟜蟓蟭蟘蟣螤蟗蟙蠁蟴蟨蟝襓襋襏襌襆襐襑襉謪謧謣謳謰謵譇謯謼謾謱謥謷謦謶謮謤謻謽謺豂豵貙貘貗賾贄贂贀蹜蹢蹠蹗蹖蹞蹥蹧"], +["f140","蹛蹚蹡蹝蹩蹔轆轇轈轋鄨鄺鄻鄾醨醥醧醯醪鎵鎌鎒鎷鎛鎝鎉鎧鎎鎪鎞鎦鎕鎈鎙鎟鎍鎱鎑鎲鎤鎨鎴鎣鎥闒闓闑隳雗雚巂雟雘雝霣霢霥鞬鞮鞨鞫鞤鞪"], +["f1a1","鞢鞥韗韙韖韘韺顐顑顒颸饁餼餺騏騋騉騍騄騑騊騅騇騆髀髜鬈鬄鬅鬩鬵魊魌魋鯇鯆鯃鮿鯁鮵鮸鯓鮶鯄鮹鮽鵜鵓鵏鵊鵛鵋鵙鵖鵌鵗鵒鵔鵟鵘鵚麎麌黟鼁鼀鼖鼥鼫鼪鼩鼨齌齕儴儵劖勷厴嚫嚭嚦嚧嚪嚬壚壝壛夒嬽嬾嬿巃幰"], +["f240","徿懻攇攐攍攉攌攎斄旞旝曞櫧櫠櫌櫑櫙櫋櫟櫜櫐櫫櫏櫍櫞歠殰氌瀙瀧瀠瀖瀫瀡瀢瀣瀩瀗瀤瀜瀪爌爊爇爂爅犥犦犤犣犡瓋瓅璷瓃甖癠矉矊矄矱礝礛"], +["f2a1","礡礜礗礞禰穧穨簳簼簹簬簻糬糪繶繵繸繰繷繯繺繲繴繨罋罊羃羆羷翽翾聸臗臕艤艡艣藫藱藭藙藡藨藚藗藬藲藸藘藟藣藜藑藰藦藯藞藢蠀蟺蠃蟶蟷蠉蠌蠋蠆蟼蠈蟿蠊蠂襢襚襛襗襡襜襘襝襙覈覷覶觶譐譈譊譀譓譖譔譋譕"], +["f340","譑譂譒譗豃豷豶貚贆贇贉趬趪趭趫蹭蹸蹳蹪蹯蹻軂轒轑轏轐轓辴酀鄿醰醭鏞鏇鏏鏂鏚鏐鏹鏬鏌鏙鎩鏦鏊鏔鏮鏣鏕鏄鏎鏀鏒鏧镽闚闛雡霩霫霬霨霦"], +["f3a1","鞳鞷鞶韝韞韟顜顙顝顗颿颽颻颾饈饇饃馦馧騚騕騥騝騤騛騢騠騧騣騞騜騔髂鬋鬊鬎鬌鬷鯪鯫鯠鯞鯤鯦鯢鯰鯔鯗鯬鯜鯙鯥鯕鯡鯚鵷鶁鶊鶄鶈鵱鶀鵸鶆鶋鶌鵽鵫鵴鵵鵰鵩鶅鵳鵻鶂鵯鵹鵿鶇鵨麔麑黀黼鼭齀齁齍齖齗齘匷嚲"], +["f440","嚵嚳壣孅巆巇廮廯忀忁懹攗攖攕攓旟曨曣曤櫳櫰櫪櫨櫹櫱櫮櫯瀼瀵瀯瀷瀴瀱灂瀸瀿瀺瀹灀瀻瀳灁爓爔犨獽獼璺皫皪皾盭矌矎矏矍矲礥礣礧礨礤礩"], +["f4a1","禲穮穬穭竷籉籈籊籇籅糮繻繾纁纀羺翿聹臛臙舋艨艩蘢藿蘁藾蘛蘀藶蘄蘉蘅蘌藽蠙蠐蠑蠗蠓蠖襣襦覹觷譠譪譝譨譣譥譧譭趮躆躈躄轙轖轗轕轘轚邍酃酁醷醵醲醳鐋鐓鏻鐠鐏鐔鏾鐕鐐鐨鐙鐍鏵鐀鏷鐇鐎鐖鐒鏺鐉鏸鐊鏿"], +["f540","鏼鐌鏶鐑鐆闞闠闟霮霯鞹鞻韽韾顠顢顣顟飁飂饐饎饙饌饋饓騲騴騱騬騪騶騩騮騸騭髇髊髆鬐鬒鬑鰋鰈鯷鰅鰒鯸鱀鰇鰎鰆鰗鰔鰉鶟鶙鶤鶝鶒鶘鶐鶛"], +["f5a1","鶠鶔鶜鶪鶗鶡鶚鶢鶨鶞鶣鶿鶩鶖鶦鶧麙麛麚黥黤黧黦鼰鼮齛齠齞齝齙龑儺儹劘劗囃嚽嚾孈孇巋巏廱懽攛欂櫼欃櫸欀灃灄灊灈灉灅灆爝爚爙獾甗癪矐礭礱礯籔籓糲纊纇纈纋纆纍罍羻耰臝蘘蘪蘦蘟蘣蘜蘙蘧蘮蘡蘠蘩蘞蘥"], +["f640","蠩蠝蠛蠠蠤蠜蠫衊襭襩襮襫觺譹譸譅譺譻贐贔趯躎躌轞轛轝酆酄酅醹鐿鐻鐶鐩鐽鐼鐰鐹鐪鐷鐬鑀鐱闥闤闣霵霺鞿韡顤飉飆飀饘饖騹騽驆驄驂驁騺"], +["f6a1","騿髍鬕鬗鬘鬖鬺魒鰫鰝鰜鰬鰣鰨鰩鰤鰡鶷鶶鶼鷁鷇鷊鷏鶾鷅鷃鶻鶵鷎鶹鶺鶬鷈鶱鶭鷌鶳鷍鶲鹺麜黫黮黭鼛鼘鼚鼱齎齥齤龒亹囆囅囋奱孋孌巕巑廲攡攠攦攢欋欈欉氍灕灖灗灒爞爟犩獿瓘瓕瓙瓗癭皭礵禴穰穱籗籜籙籛籚"], +["f740","糴糱纑罏羇臞艫蘴蘵蘳蘬蘲蘶蠬蠨蠦蠪蠥襱覿覾觻譾讄讂讆讅譿贕躕躔躚躒躐躖躗轠轢酇鑌鑐鑊鑋鑏鑇鑅鑈鑉鑆霿韣顪顩飋饔饛驎驓驔驌驏驈驊"], +["f7a1","驉驒驐髐鬙鬫鬻魖魕鱆鱈鰿鱄鰹鰳鱁鰼鰷鰴鰲鰽鰶鷛鷒鷞鷚鷋鷐鷜鷑鷟鷩鷙鷘鷖鷵鷕鷝麶黰鼵鼳鼲齂齫龕龢儽劙壨壧奲孍巘蠯彏戁戃戄攩攥斖曫欑欒欏毊灛灚爢玂玁玃癰矔籧籦纕艬蘺虀蘹蘼蘱蘻蘾蠰蠲蠮蠳襶襴襳觾"], +["f840","讌讎讋讈豅贙躘轤轣醼鑢鑕鑝鑗鑞韄韅頀驖驙鬞鬟鬠鱒鱘鱐鱊鱍鱋鱕鱙鱌鱎鷻鷷鷯鷣鷫鷸鷤鷶鷡鷮鷦鷲鷰鷢鷬鷴鷳鷨鷭黂黐黲黳鼆鼜鼸鼷鼶齃齏"], +["f8a1","齱齰齮齯囓囍孎屭攭曭曮欓灟灡灝灠爣瓛瓥矕礸禷禶籪纗羉艭虃蠸蠷蠵衋讔讕躞躟躠躝醾醽釂鑫鑨鑩雥靆靃靇韇韥驞髕魙鱣鱧鱦鱢鱞鱠鸂鷾鸇鸃鸆鸅鸀鸁鸉鷿鷽鸄麠鼞齆齴齵齶囔攮斸欘欙欗欚灢爦犪矘矙礹籩籫糶纚"], +["f940","纘纛纙臠臡虆虇虈襹襺襼襻觿讘讙躥躤躣鑮鑭鑯鑱鑳靉顲饟鱨鱮鱭鸋鸍鸐鸏鸒鸑麡黵鼉齇齸齻齺齹圞灦籯蠼趲躦釃鑴鑸鑶鑵驠鱴鱳鱱鱵鸔鸓黶鼊"], +["f9a1","龤灨灥糷虪蠾蠽蠿讞貜躩軉靋顳顴飌饡馫驤驦驧鬤鸕鸗齈戇欞爧虌躨钂钀钁驩驨鬮鸙爩虋讟钃鱹麷癵驫鱺鸝灩灪麤齾齉龘碁銹裏墻恒粧嫺╔╦╗╠╬╣╚╩╝╒╤╕╞╪╡╘╧╛╓╥╖╟╫╢╙╨╜║═╭╮╰╯▓"] +] diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/eucjp.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/eucjp.json new file mode 100644 index 0000000..4fa61ca --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/eucjp.json @@ -0,0 +1,182 @@ +[ +["0","\u0000",127], +["8ea1","。",62], +["a1a1"," 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",9,"+-±×÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇"], +["a2a1","◆□■△▲▽▼※〒→←↑↓〓"], +["a2ba","∈∋⊆⊇⊂⊃∪∩"], +["a2ca","∧∨¬⇒⇔∀∃"], +["a2dc","∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"], +["a2f2","ʼn♯♭♪†‡¶"], +["a2fe","◯"], +["a3b0","0",9], +["a3c1","A",25], +["a3e1","a",25], +["a4a1","ぁ",82], +["a5a1","ァ",85], +["a6a1","Α",16,"Σ",6], +["a6c1","α",16,"σ",6], +["a7a1","А",5,"ЁЖ",25], +["a7d1","а",5,"ёж",25], +["a8a1","─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"], +["ada1","①",19,"Ⅰ",9], +["adc0","㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"], +["addf","㍻〝〟№㏍℡㊤",4,"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"], +["b0a1","亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"], +["b1a1","院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応"], +["b2a1","押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"], +["b3a1","魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱"], +["b4a1","粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"], +["b5a1","機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京"], +["b6a1","供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"], +["b7a1","掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲"], +["b8a1","検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"], +["b9a1","后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込"], +["baa1","此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"], +["bba1","察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時"], +["bca1","次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"], +["bda1","宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償"], +["bea1","勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"], +["bfa1","拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾"], +["c0a1","澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"], +["c1a1","繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎"], +["c2a1","臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"], +["c3a1","叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵"], +["c4a1","帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"], +["c5a1","邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到"], +["c6a1","董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"], +["c7a1","如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦"], +["c8a1","函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"], +["c9a1","鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服"], +["caa1","福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"], +["cba1","法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満"], +["cca1","漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"], +["cda1","諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃"], +["cea1","痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"], +["cfa1","蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"], +["d0a1","弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"], +["d1a1","僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨"], +["d2a1","辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"], +["d3a1","咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉"], +["d4a1","圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"], +["d5a1","奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓"], +["d6a1","屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"], +["d7a1","廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚"], +["d8a1","悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"], +["d9a1","戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼"], +["daa1","據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"], +["dba1","曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍"], +["dca1","棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"], +["dda1","檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾"], +["dea1","沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"], +["dfa1","漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼"], +["e0a1","燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"], +["e1a1","瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰"], +["e2a1","癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"], +["e3a1","磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐"], +["e4a1","筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"], +["e5a1","紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺"], +["e6a1","罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"], +["e7a1","隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙"], +["e8a1","茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"], +["e9a1","蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙"], +["eaa1","蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"], +["eba1","襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫"], +["eca1","譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"], +["eda1","蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸"], +["eea1","遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"], +["efa1","錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞"], +["f0a1","陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"], +["f1a1","顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷"], +["f2a1","髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"], +["f3a1","鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠"], +["f4a1","堯槇遙瑤凜熙"], +["f9a1","纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德"], +["faa1","忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"], +["fba1","犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚"], +["fca1","釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"], +["fcf1","ⅰ",9,"¬¦'""], +["8fa2af","˘ˇ¸˙˝¯˛˚~΄΅"], +["8fa2c2","¡¦¿"], +["8fa2eb","ºª©®™¤№"], +["8fa6e1","ΆΈΉΊΪ"], +["8fa6e7","Ό"], +["8fa6e9","ΎΫ"], +["8fa6ec","Ώ"], +["8fa6f1","άέήίϊΐόςύϋΰώ"], +["8fa7c2","Ђ",10,"ЎЏ"], +["8fa7f2","ђ",10,"ўџ"], +["8fa9a1","ÆĐ"], +["8fa9a4","Ħ"], +["8fa9a6","IJ"], +["8fa9a8","ŁĿ"], +["8fa9ab","ŊØŒ"], +["8fa9af","ŦÞ"], +["8fa9c1","æđðħıijĸłŀʼnŋøœßŧþ"], +["8faaa1","ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈËÊĚĖĒĘ"], +["8faaba","ĜĞĢĠĤÍÌÏÎǏİĪĮĨĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙǕŴÝŸŶŹŽŻ"], +["8faba1","áàäâăǎāąåãćĉčçċďéèëêěėēęǵĝğ"], +["8fabbd","ġĥíìïîǐ"], +["8fabc5","īįĩĵķĺľļńňņñóòöôǒőōõŕřŗśŝšşťţúùüûŭǔűūųůũǘǜǚǖŵýÿŷźžż"], +["8fb0a1","丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄"], +["8fb1a1","侅侉侊侌侎侐侒侓侔侗侙侚侞侟侲侷侹侻侼侽侾俀俁俅俆俈俉俋俌俍俏俒俜俠俢俰俲俼俽俿倀倁倄倇倊倌倎倐倓倗倘倛倜倝倞倢倧倮倰倲倳倵偀偁偂偅偆偊偌偎偑偒偓偗偙偟偠偢偣偦偧偪偭偰偱倻傁傃傄傆傊傎傏傐"], +["8fb2a1","傒傓傔傖傛傜傞",4,"傪傯傰傹傺傽僀僃僄僇僌僎僐僓僔僘僜僝僟僢僤僦僨僩僯僱僶僺僾儃儆儇儈儋儌儍儎僲儐儗儙儛儜儝儞儣儧儨儬儭儯儱儳儴儵儸儹兂兊兏兓兕兗兘兟兤兦兾冃冄冋冎冘冝冡冣冭冸冺冼冾冿凂"], +["8fb3a1","凈减凑凒凓凕凘凞凢凥凮凲凳凴凷刁刂刅划刓刕刖刘刢刨刱刲刵刼剅剉剕剗剘剚剜剟剠剡剦剮剷剸剹劀劂劅劊劌劓劕劖劗劘劚劜劤劥劦劧劯劰劶劷劸劺劻劽勀勄勆勈勌勏勑勔勖勛勜勡勥勨勩勪勬勰勱勴勶勷匀匃匊匋"], +["8fb4a1","匌匑匓匘匛匜匞匟匥匧匨匩匫匬匭匰匲匵匼匽匾卂卌卋卙卛卡卣卥卬卭卲卹卾厃厇厈厎厓厔厙厝厡厤厪厫厯厲厴厵厷厸厺厽叀叅叏叒叓叕叚叝叞叠另叧叵吂吓吚吡吧吨吪启吱吴吵呃呄呇呍呏呞呢呤呦呧呩呫呭呮呴呿"], +["8fb5a1","咁咃咅咈咉咍咑咕咖咜咟咡咦咧咩咪咭咮咱咷咹咺咻咿哆哊响哎哠哪哬哯哶哼哾哿唀唁唅唈唉唌唍唎唕唪唫唲唵唶唻唼唽啁啇啉啊啍啐啑啘啚啛啞啠啡啤啦啿喁喂喆喈喎喏喑喒喓喔喗喣喤喭喲喿嗁嗃嗆嗉嗋嗌嗎嗑嗒"], +["8fb6a1","嗓嗗嗘嗛嗞嗢嗩嗶嗿嘅嘈嘊嘍",5,"嘙嘬嘰嘳嘵嘷嘹嘻嘼嘽嘿噀噁噃噄噆噉噋噍噏噔噞噠噡噢噣噦噩噭噯噱噲噵嚄嚅嚈嚋嚌嚕嚙嚚嚝嚞嚟嚦嚧嚨嚩嚫嚬嚭嚱嚳嚷嚾囅囉囊囋囏囐囌囍囙囜囝囟囡囤",4,"囱囫园"], +["8fb7a1","囶囷圁圂圇圊圌圑圕圚圛圝圠圢圣圤圥圩圪圬圮圯圳圴圽圾圿坅坆坌坍坒坢坥坧坨坫坭",4,"坳坴坵坷坹坺坻坼坾垁垃垌垔垗垙垚垜垝垞垟垡垕垧垨垩垬垸垽埇埈埌埏埕埝埞埤埦埧埩埭埰埵埶埸埽埾埿堃堄堈堉埡"], +["8fb8a1","堌堍堛堞堟堠堦堧堭堲堹堿塉塌塍塏塐塕塟塡塤塧塨塸塼塿墀墁墇墈墉墊墌墍墏墐墔墖墝墠墡墢墦墩墱墲壄墼壂壈壍壎壐壒壔壖壚壝壡壢壩壳夅夆夋夌夒夓夔虁夝夡夣夤夨夯夰夳夵夶夿奃奆奒奓奙奛奝奞奟奡奣奫奭"], +["8fb9a1","奯奲奵奶她奻奼妋妌妎妒妕妗妟妤妧妭妮妯妰妳妷妺妼姁姃姄姈姊姍姒姝姞姟姣姤姧姮姯姱姲姴姷娀娄娌娍娎娒娓娞娣娤娧娨娪娭娰婄婅婇婈婌婐婕婞婣婥婧婭婷婺婻婾媋媐媓媖媙媜媞媟媠媢媧媬媱媲媳媵媸媺媻媿"], +["8fbaa1","嫄嫆嫈嫏嫚嫜嫠嫥嫪嫮嫵嫶嫽嬀嬁嬈嬗嬴嬙嬛嬝嬡嬥嬭嬸孁孋孌孒孖孞孨孮孯孼孽孾孿宁宄宆宊宎宐宑宓宔宖宨宩宬宭宯宱宲宷宺宼寀寁寍寏寖",4,"寠寯寱寴寽尌尗尞尟尣尦尩尫尬尮尰尲尵尶屙屚屜屢屣屧屨屩"], +["8fbba1","屭屰屴屵屺屻屼屽岇岈岊岏岒岝岟岠岢岣岦岪岲岴岵岺峉峋峒峝峗峮峱峲峴崁崆崍崒崫崣崤崦崧崱崴崹崽崿嵂嵃嵆嵈嵕嵑嵙嵊嵟嵠嵡嵢嵤嵪嵭嵰嵹嵺嵾嵿嶁嶃嶈嶊嶒嶓嶔嶕嶙嶛嶟嶠嶧嶫嶰嶴嶸嶹巃巇巋巐巎巘巙巠巤"], +["8fbca1","巩巸巹帀帇帍帒帔帕帘帟帠帮帨帲帵帾幋幐幉幑幖幘幛幜幞幨幪",4,"幰庀庋庎庢庤庥庨庪庬庱庳庽庾庿廆廌廋廎廑廒廔廕廜廞廥廫异弆弇弈弎弙弜弝弡弢弣弤弨弫弬弮弰弴弶弻弽弿彀彄彅彇彍彐彔彘彛彠彣彤彧"], +["8fbda1","彯彲彴彵彸彺彽彾徉徍徏徖徜徝徢徧徫徤徬徯徰徱徸忄忇忈忉忋忐",4,"忞忡忢忨忩忪忬忭忮忯忲忳忶忺忼怇怊怍怓怔怗怘怚怟怤怭怳怵恀恇恈恉恌恑恔恖恗恝恡恧恱恾恿悂悆悈悊悎悑悓悕悘悝悞悢悤悥您悰悱悷"], +["8fbea1","悻悾惂惄惈惉惊惋惎惏惔惕惙惛惝惞惢惥惲惵惸惼惽愂愇愊愌愐",4,"愖愗愙愜愞愢愪愫愰愱愵愶愷愹慁慅慆慉慞慠慬慲慸慻慼慿憀憁憃憄憋憍憒憓憗憘憜憝憟憠憥憨憪憭憸憹憼懀懁懂懎懏懕懜懝懞懟懡懢懧懩懥"], +["8fbfa1","懬懭懯戁戃戄戇戓戕戜戠戢戣戧戩戫戹戽扂扃扄扆扌扐扑扒扔扖扚扜扤扭扯扳扺扽抍抎抏抐抦抨抳抶抷抺抾抿拄拎拕拖拚拪拲拴拼拽挃挄挊挋挍挐挓挖挘挩挪挭挵挶挹挼捁捂捃捄捆捊捋捎捒捓捔捘捛捥捦捬捭捱捴捵"], +["8fc0a1","捸捼捽捿掂掄掇掊掐掔掕掙掚掞掤掦掭掮掯掽揁揅揈揎揑揓揔揕揜揠揥揪揬揲揳揵揸揹搉搊搐搒搔搘搞搠搢搤搥搩搪搯搰搵搽搿摋摏摑摒摓摔摚摛摜摝摟摠摡摣摭摳摴摻摽撅撇撏撐撑撘撙撛撝撟撡撣撦撨撬撳撽撾撿"], +["8fc1a1","擄擉擊擋擌擎擐擑擕擗擤擥擩擪擭擰擵擷擻擿攁攄攈攉攊攏攓攔攖攙攛攞攟攢攦攩攮攱攺攼攽敃敇敉敐敒敔敟敠敧敫敺敽斁斅斊斒斕斘斝斠斣斦斮斲斳斴斿旂旈旉旎旐旔旖旘旟旰旲旴旵旹旾旿昀昄昈昉昍昑昒昕昖昝"], +["8fc2a1","昞昡昢昣昤昦昩昪昫昬昮昰昱昳昹昷晀晅晆晊晌晑晎晗晘晙晛晜晠晡曻晪晫晬晾晳晵晿晷晸晹晻暀晼暋暌暍暐暒暙暚暛暜暟暠暤暭暱暲暵暻暿曀曂曃曈曌曎曏曔曛曟曨曫曬曮曺朅朇朎朓朙朜朠朢朳朾杅杇杈杌杔杕杝"], +["8fc3a1","杦杬杮杴杶杻极构枎枏枑枓枖枘枙枛枰枱枲枵枻枼枽柹柀柂柃柅柈柉柒柗柙柜柡柦柰柲柶柷桒栔栙栝栟栨栧栬栭栯栰栱栳栻栿桄桅桊桌桕桗桘桛桫桮",4,"桵桹桺桻桼梂梄梆梈梖梘梚梜梡梣梥梩梪梮梲梻棅棈棌棏"], +["8fc4a1","棐棑棓棖棙棜棝棥棨棪棫棬棭棰棱棵棶棻棼棽椆椉椊椐椑椓椖椗椱椳椵椸椻楂楅楉楎楗楛楣楤楥楦楨楩楬楰楱楲楺楻楿榀榍榒榖榘榡榥榦榨榫榭榯榷榸榺榼槅槈槑槖槗槢槥槮槯槱槳槵槾樀樁樃樏樑樕樚樝樠樤樨樰樲"], +["8fc5a1","樴樷樻樾樿橅橆橉橊橎橐橑橒橕橖橛橤橧橪橱橳橾檁檃檆檇檉檋檑檛檝檞檟檥檫檯檰檱檴檽檾檿櫆櫉櫈櫌櫐櫔櫕櫖櫜櫝櫤櫧櫬櫰櫱櫲櫼櫽欂欃欆欇欉欏欐欑欗欛欞欤欨欫欬欯欵欶欻欿歆歊歍歒歖歘歝歠歧歫歮歰歵歽"], +["8fc6a1","歾殂殅殗殛殟殠殢殣殨殩殬殭殮殰殸殹殽殾毃毄毉毌毖毚毡毣毦毧毮毱毷毹毿氂氄氅氉氍氎氐氒氙氟氦氧氨氬氮氳氵氶氺氻氿汊汋汍汏汒汔汙汛汜汫汭汯汴汶汸汹汻沅沆沇沉沔沕沗沘沜沟沰沲沴泂泆泍泏泐泑泒泔泖"], +["8fc7a1","泚泜泠泧泩泫泬泮泲泴洄洇洊洎洏洑洓洚洦洧洨汧洮洯洱洹洼洿浗浞浟浡浥浧浯浰浼涂涇涑涒涔涖涗涘涪涬涴涷涹涽涿淄淈淊淎淏淖淛淝淟淠淢淥淩淯淰淴淶淼渀渄渞渢渧渲渶渹渻渼湄湅湈湉湋湏湑湒湓湔湗湜湝湞"], +["8fc8a1","湢湣湨湳湻湽溍溓溙溠溧溭溮溱溳溻溿滀滁滃滇滈滊滍滎滏滫滭滮滹滻滽漄漈漊漌漍漖漘漚漛漦漩漪漯漰漳漶漻漼漭潏潑潒潓潗潙潚潝潞潡潢潨潬潽潾澃澇澈澋澌澍澐澒澓澔澖澚澟澠澥澦澧澨澮澯澰澵澶澼濅濇濈濊"], +["8fc9a1","濚濞濨濩濰濵濹濼濽瀀瀅瀆瀇瀍瀗瀠瀣瀯瀴瀷瀹瀼灃灄灈灉灊灋灔灕灝灞灎灤灥灬灮灵灶灾炁炅炆炔",4,"炛炤炫炰炱炴炷烊烑烓烔烕烖烘烜烤烺焃",4,"焋焌焏焞焠焫焭焯焰焱焸煁煅煆煇煊煋煐煒煗煚煜煞煠"], +["8fcaa1","煨煹熀熅熇熌熒熚熛熠熢熯熰熲熳熺熿燀燁燄燋燌燓燖燙燚燜燸燾爀爇爈爉爓爗爚爝爟爤爫爯爴爸爹牁牂牃牅牎牏牐牓牕牖牚牜牞牠牣牨牫牮牯牱牷牸牻牼牿犄犉犍犎犓犛犨犭犮犱犴犾狁狇狉狌狕狖狘狟狥狳狴狺狻"], +["8fcba1","狾猂猄猅猇猋猍猒猓猘猙猞猢猤猧猨猬猱猲猵猺猻猽獃獍獐獒獖獘獝獞獟獠獦獧獩獫獬獮獯獱獷獹獼玀玁玃玅玆玎玐玓玕玗玘玜玞玟玠玢玥玦玪玫玭玵玷玹玼玽玿珅珆珉珋珌珏珒珓珖珙珝珡珣珦珧珩珴珵珷珹珺珻珽"], +["8fcca1","珿琀琁琄琇琊琑琚琛琤琦琨",9,"琹瑀瑃瑄瑆瑇瑋瑍瑑瑒瑗瑝瑢瑦瑧瑨瑫瑭瑮瑱瑲璀璁璅璆璇璉璏璐璑璒璘璙璚璜璟璠璡璣璦璨璩璪璫璮璯璱璲璵璹璻璿瓈瓉瓌瓐瓓瓘瓚瓛瓞瓟瓤瓨瓪瓫瓯瓴瓺瓻瓼瓿甆"], +["8fcda1","甒甖甗甠甡甤甧甩甪甯甶甹甽甾甿畀畃畇畈畎畐畒畗畞畟畡畯畱畹",5,"疁疅疐疒疓疕疙疜疢疤疴疺疿痀痁痄痆痌痎痏痗痜痟痠痡痤痧痬痮痯痱痹瘀瘂瘃瘄瘇瘈瘊瘌瘏瘒瘓瘕瘖瘙瘛瘜瘝瘞瘣瘥瘦瘩瘭瘲瘳瘵瘸瘹"], +["8fcea1","瘺瘼癊癀癁癃癄癅癉癋癕癙癟癤癥癭癮癯癱癴皁皅皌皍皕皛皜皝皟皠皢",6,"皪皭皽盁盅盉盋盌盎盔盙盠盦盨盬盰盱盶盹盼眀眆眊眎眒眔眕眗眙眚眜眢眨眭眮眯眴眵眶眹眽眾睂睅睆睊睍睎睏睒睖睗睜睞睟睠睢"], +["8fcfa1","睤睧睪睬睰睲睳睴睺睽瞀瞄瞌瞍瞔瞕瞖瞚瞟瞢瞧瞪瞮瞯瞱瞵瞾矃矉矑矒矕矙矞矟矠矤矦矪矬矰矱矴矸矻砅砆砉砍砎砑砝砡砢砣砭砮砰砵砷硃硄硇硈硌硎硒硜硞硠硡硣硤硨硪确硺硾碊碏碔碘碡碝碞碟碤碨碬碭碰碱碲碳"], +["8fd0a1","碻碽碿磇磈磉磌磎磒磓磕磖磤磛磟磠磡磦磪磲磳礀磶磷磺磻磿礆礌礐礚礜礞礟礠礥礧礩礭礱礴礵礻礽礿祄祅祆祊祋祏祑祔祘祛祜祧祩祫祲祹祻祼祾禋禌禑禓禔禕禖禘禛禜禡禨禩禫禯禱禴禸离秂秄秇秈秊秏秔秖秚秝秞"], +["8fd1a1","秠秢秥秪秫秭秱秸秼稂稃稇稉稊稌稑稕稛稞稡稧稫稭稯稰稴稵稸稹稺穄穅穇穈穌穕穖穙穜穝穟穠穥穧穪穭穵穸穾窀窂窅窆窊窋窐窑窔窞窠窣窬窳窵窹窻窼竆竉竌竎竑竛竨竩竫竬竱竴竻竽竾笇笔笟笣笧笩笪笫笭笮笯笰"], +["8fd2a1","笱笴笽笿筀筁筇筎筕筠筤筦筩筪筭筯筲筳筷箄箉箎箐箑箖箛箞箠箥箬箯箰箲箵箶箺箻箼箽篂篅篈篊篔篖篗篙篚篛篨篪篲篴篵篸篹篺篼篾簁簂簃簄簆簉簋簌簎簏簙簛簠簥簦簨簬簱簳簴簶簹簺籆籊籕籑籒籓籙",5], +["8fd3a1","籡籣籧籩籭籮籰籲籹籼籽粆粇粏粔粞粠粦粰粶粷粺粻粼粿糄糇糈糉糍糏糓糔糕糗糙糚糝糦糩糫糵紃紇紈紉紏紑紒紓紖紝紞紣紦紪紭紱紼紽紾絀絁絇絈絍絑絓絗絙絚絜絝絥絧絪絰絸絺絻絿綁綂綃綅綆綈綋綌綍綑綖綗綝"], +["8fd4a1","綞綦綧綪綳綶綷綹緂",4,"緌緍緎緗緙縀緢緥緦緪緫緭緱緵緶緹緺縈縐縑縕縗縜縝縠縧縨縬縭縯縳縶縿繄繅繇繎繐繒繘繟繡繢繥繫繮繯繳繸繾纁纆纇纊纍纑纕纘纚纝纞缼缻缽缾缿罃罄罇罏罒罓罛罜罝罡罣罤罥罦罭"], +["8fd5a1","罱罽罾罿羀羋羍羏羐羑羖羗羜羡羢羦羪羭羴羼羿翀翃翈翎翏翛翟翣翥翨翬翮翯翲翺翽翾翿耇耈耊耍耎耏耑耓耔耖耝耞耟耠耤耦耬耮耰耴耵耷耹耺耼耾聀聄聠聤聦聭聱聵肁肈肎肜肞肦肧肫肸肹胈胍胏胒胔胕胗胘胠胭胮"], +["8fd6a1","胰胲胳胶胹胺胾脃脋脖脗脘脜脞脠脤脧脬脰脵脺脼腅腇腊腌腒腗腠腡腧腨腩腭腯腷膁膐膄膅膆膋膎膖膘膛膞膢膮膲膴膻臋臃臅臊臎臏臕臗臛臝臞臡臤臫臬臰臱臲臵臶臸臹臽臿舀舃舏舓舔舙舚舝舡舢舨舲舴舺艃艄艅艆"], +["8fd7a1","艋艎艏艑艖艜艠艣艧艭艴艻艽艿芀芁芃芄芇芉芊芎芑芔芖芘芚芛芠芡芣芤芧芨芩芪芮芰芲芴芷芺芼芾芿苆苐苕苚苠苢苤苨苪苭苯苶苷苽苾茀茁茇茈茊茋荔茛茝茞茟茡茢茬茭茮茰茳茷茺茼茽荂荃荄荇荍荎荑荕荖荗荰荸"], +["8fd8a1","荽荿莀莂莄莆莍莒莔莕莘莙莛莜莝莦莧莩莬莾莿菀菇菉菏菐菑菔菝荓菨菪菶菸菹菼萁萆萊萏萑萕萙莭萯萹葅葇葈葊葍葏葑葒葖葘葙葚葜葠葤葥葧葪葰葳葴葶葸葼葽蒁蒅蒒蒓蒕蒞蒦蒨蒩蒪蒯蒱蒴蒺蒽蒾蓀蓂蓇蓈蓌蓏蓓"], +["8fd9a1","蓜蓧蓪蓯蓰蓱蓲蓷蔲蓺蓻蓽蔂蔃蔇蔌蔎蔐蔜蔞蔢蔣蔤蔥蔧蔪蔫蔯蔳蔴蔶蔿蕆蕏",4,"蕖蕙蕜",6,"蕤蕫蕯蕹蕺蕻蕽蕿薁薅薆薉薋薌薏薓薘薝薟薠薢薥薧薴薶薷薸薼薽薾薿藂藇藊藋藎薭藘藚藟藠藦藨藭藳藶藼"], +["8fdaa1","藿蘀蘄蘅蘍蘎蘐蘑蘒蘘蘙蘛蘞蘡蘧蘩蘶蘸蘺蘼蘽虀虂虆虒虓虖虗虘虙虝虠",4,"虩虬虯虵虶虷虺蚍蚑蚖蚘蚚蚜蚡蚦蚧蚨蚭蚱蚳蚴蚵蚷蚸蚹蚿蛀蛁蛃蛅蛑蛒蛕蛗蛚蛜蛠蛣蛥蛧蚈蛺蛼蛽蜄蜅蜇蜋蜎蜏蜐蜓蜔蜙蜞蜟蜡蜣"], +["8fdba1","蜨蜮蜯蜱蜲蜹蜺蜼蜽蜾蝀蝃蝅蝍蝘蝝蝡蝤蝥蝯蝱蝲蝻螃",6,"螋螌螐螓螕螗螘螙螞螠螣螧螬螭螮螱螵螾螿蟁蟈蟉蟊蟎蟕蟖蟙蟚蟜蟟蟢蟣蟤蟪蟫蟭蟱蟳蟸蟺蟿蠁蠃蠆蠉蠊蠋蠐蠙蠒蠓蠔蠘蠚蠛蠜蠞蠟蠨蠭蠮蠰蠲蠵"], +["8fdca1","蠺蠼衁衃衅衈衉衊衋衎衑衕衖衘衚衜衟衠衤衩衱衹衻袀袘袚袛袜袟袠袨袪袺袽袾裀裊",4,"裑裒裓裛裞裧裯裰裱裵裷褁褆褍褎褏褕褖褘褙褚褜褠褦褧褨褰褱褲褵褹褺褾襀襂襅襆襉襏襒襗襚襛襜襡襢襣襫襮襰襳襵襺"], +["8fdda1","襻襼襽覉覍覐覔覕覛覜覟覠覥覰覴覵覶覷覼觔",4,"觥觩觫觭觱觳觶觹觽觿訄訅訇訏訑訒訔訕訞訠訢訤訦訫訬訯訵訷訽訾詀詃詅詇詉詍詎詓詖詗詘詜詝詡詥詧詵詶詷詹詺詻詾詿誀誃誆誋誏誐誒誖誗誙誟誧誩誮誯誳"], +["8fdea1","誶誷誻誾諃諆諈諉諊諑諓諔諕諗諝諟諬諰諴諵諶諼諿謅謆謋謑謜謞謟謊謭謰謷謼譂",4,"譈譒譓譔譙譍譞譣譭譶譸譹譼譾讁讄讅讋讍讏讔讕讜讞讟谸谹谽谾豅豇豉豋豏豑豓豔豗豘豛豝豙豣豤豦豨豩豭豳豵豶豻豾貆"], +["8fdfa1","貇貋貐貒貓貙貛貜貤貹貺賅賆賉賋賏賖賕賙賝賡賨賬賯賰賲賵賷賸賾賿贁贃贉贒贗贛赥赩赬赮赿趂趄趈趍趐趑趕趞趟趠趦趫趬趯趲趵趷趹趻跀跅跆跇跈跊跎跑跔跕跗跙跤跥跧跬跰趼跱跲跴跽踁踄踅踆踋踑踔踖踠踡踢"], +["8fe0a1","踣踦踧踱踳踶踷踸踹踽蹀蹁蹋蹍蹎蹏蹔蹛蹜蹝蹞蹡蹢蹩蹬蹭蹯蹰蹱蹹蹺蹻躂躃躉躐躒躕躚躛躝躞躢躧躩躭躮躳躵躺躻軀軁軃軄軇軏軑軔軜軨軮軰軱軷軹軺軭輀輂輇輈輏輐輖輗輘輞輠輡輣輥輧輨輬輭輮輴輵輶輷輺轀轁"], +["8fe1a1","轃轇轏轑",4,"轘轝轞轥辝辠辡辤辥辦辵辶辸达迀迁迆迊迋迍运迒迓迕迠迣迤迨迮迱迵迶迻迾适逄逈逌逘逛逨逩逯逪逬逭逳逴逷逿遃遄遌遛遝遢遦遧遬遰遴遹邅邈邋邌邎邐邕邗邘邙邛邠邡邢邥邰邲邳邴邶邽郌邾郃"], +["8fe2a1","郄郅郇郈郕郗郘郙郜郝郟郥郒郶郫郯郰郴郾郿鄀鄄鄅鄆鄈鄍鄐鄔鄖鄗鄘鄚鄜鄞鄠鄥鄢鄣鄧鄩鄮鄯鄱鄴鄶鄷鄹鄺鄼鄽酃酇酈酏酓酗酙酚酛酡酤酧酭酴酹酺酻醁醃醅醆醊醎醑醓醔醕醘醞醡醦醨醬醭醮醰醱醲醳醶醻醼醽醿"], +["8fe3a1","釂釃釅釓釔釗釙釚釞釤釥釩釪釬",5,"釷釹釻釽鈀鈁鈄鈅鈆鈇鈉鈊鈌鈐鈒鈓鈖鈘鈜鈝鈣鈤鈥鈦鈨鈮鈯鈰鈳鈵鈶鈸鈹鈺鈼鈾鉀鉂鉃鉆鉇鉊鉍鉎鉏鉑鉘鉙鉜鉝鉠鉡鉥鉧鉨鉩鉮鉯鉰鉵",4,"鉻鉼鉽鉿銈銉銊銍銎銒銗"], +["8fe4a1","銙銟銠銤銥銧銨銫銯銲銶銸銺銻銼銽銿",4,"鋅鋆鋇鋈鋋鋌鋍鋎鋐鋓鋕鋗鋘鋙鋜鋝鋟鋠鋡鋣鋥鋧鋨鋬鋮鋰鋹鋻鋿錀錂錈錍錑錔錕錜錝錞錟錡錤錥錧錩錪錳錴錶錷鍇鍈鍉鍐鍑鍒鍕鍗鍘鍚鍞鍤鍥鍧鍩鍪鍭鍯鍰鍱鍳鍴鍶"], +["8fe5a1","鍺鍽鍿鎀鎁鎂鎈鎊鎋鎍鎏鎒鎕鎘鎛鎞鎡鎣鎤鎦鎨鎫鎴鎵鎶鎺鎩鏁鏄鏅鏆鏇鏉",4,"鏓鏙鏜鏞鏟鏢鏦鏧鏹鏷鏸鏺鏻鏽鐁鐂鐄鐈鐉鐍鐎鐏鐕鐖鐗鐟鐮鐯鐱鐲鐳鐴鐻鐿鐽鑃鑅鑈鑊鑌鑕鑙鑜鑟鑡鑣鑨鑫鑭鑮鑯鑱鑲钄钃镸镹"], +["8fe6a1","镾閄閈閌閍閎閝閞閟閡閦閩閫閬閴閶閺閽閿闆闈闉闋闐闑闒闓闙闚闝闞闟闠闤闦阝阞阢阤阥阦阬阱阳阷阸阹阺阼阽陁陒陔陖陗陘陡陮陴陻陼陾陿隁隂隃隄隉隑隖隚隝隟隤隥隦隩隮隯隳隺雊雒嶲雘雚雝雞雟雩雯雱雺霂"], +["8fe7a1","霃霅霉霚霛霝霡霢霣霨霱霳靁靃靊靎靏靕靗靘靚靛靣靧靪靮靳靶靷靸靻靽靿鞀鞉鞕鞖鞗鞙鞚鞞鞟鞢鞬鞮鞱鞲鞵鞶鞸鞹鞺鞼鞾鞿韁韄韅韇韉韊韌韍韎韐韑韔韗韘韙韝韞韠韛韡韤韯韱韴韷韸韺頇頊頙頍頎頔頖頜頞頠頣頦"], +["8fe8a1","頫頮頯頰頲頳頵頥頾顄顇顊顑顒顓顖顗顙顚顢顣顥顦顪顬颫颭颮颰颴颷颸颺颻颿飂飅飈飌飡飣飥飦飧飪飳飶餂餇餈餑餕餖餗餚餛餜餟餢餦餧餫餱",4,"餹餺餻餼饀饁饆饇饈饍饎饔饘饙饛饜饞饟饠馛馝馟馦馰馱馲馵"], +["8fe9a1","馹馺馽馿駃駉駓駔駙駚駜駞駧駪駫駬駰駴駵駹駽駾騂騃騄騋騌騐騑騖騞騠騢騣騤騧騭騮騳騵騶騸驇驁驄驊驋驌驎驑驔驖驝骪骬骮骯骲骴骵骶骹骻骾骿髁髃髆髈髎髐髒髕髖髗髛髜髠髤髥髧髩髬髲髳髵髹髺髽髿",4], +["8feaa1","鬄鬅鬈鬉鬋鬌鬍鬎鬐鬒鬖鬙鬛鬜鬠鬦鬫鬭鬳鬴鬵鬷鬹鬺鬽魈魋魌魕魖魗魛魞魡魣魥魦魨魪",4,"魳魵魷魸魹魿鮀鮄鮅鮆鮇鮉鮊鮋鮍鮏鮐鮔鮚鮝鮞鮦鮧鮩鮬鮰鮱鮲鮷鮸鮻鮼鮾鮿鯁鯇鯈鯎鯐鯗鯘鯝鯟鯥鯧鯪鯫鯯鯳鯷鯸"], +["8feba1","鯹鯺鯽鯿鰀鰂鰋鰏鰑鰖鰘鰙鰚鰜鰞鰢鰣鰦",4,"鰱鰵鰶鰷鰽鱁鱃鱄鱅鱉鱊鱎鱏鱐鱓鱔鱖鱘鱛鱝鱞鱟鱣鱩鱪鱜鱫鱨鱮鱰鱲鱵鱷鱻鳦鳲鳷鳹鴋鴂鴑鴗鴘鴜鴝鴞鴯鴰鴲鴳鴴鴺鴼鵅鴽鵂鵃鵇鵊鵓鵔鵟鵣鵢鵥鵩鵪鵫鵰鵶鵷鵻"], +["8feca1","鵼鵾鶃鶄鶆鶊鶍鶎鶒鶓鶕鶖鶗鶘鶡鶪鶬鶮鶱鶵鶹鶼鶿鷃鷇鷉鷊鷔鷕鷖鷗鷚鷞鷟鷠鷥鷧鷩鷫鷮鷰鷳鷴鷾鸊鸂鸇鸎鸐鸑鸒鸕鸖鸙鸜鸝鹺鹻鹼麀麂麃麄麅麇麎麏麖麘麛麞麤麨麬麮麯麰麳麴麵黆黈黋黕黟黤黧黬黭黮黰黱黲黵"], +["8feda1","黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃",4,"齓齕齖齗齘齚齝齞齨齩齭",4,"齳齵齺齽龏龐龑龒龔龖龗龞龡龢龣龥"] +] diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json new file mode 100644 index 0000000..85c6934 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json @@ -0,0 +1 @@ +{"uChars":[128,165,169,178,184,216,226,235,238,244,248,251,253,258,276,284,300,325,329,334,364,463,465,467,469,471,473,475,477,506,594,610,712,716,730,930,938,962,970,1026,1104,1106,8209,8215,8218,8222,8231,8241,8244,8246,8252,8365,8452,8454,8458,8471,8482,8556,8570,8596,8602,8713,8720,8722,8726,8731,8737,8740,8742,8748,8751,8760,8766,8777,8781,8787,8802,8808,8816,8854,8858,8870,8896,8979,9322,9372,9548,9588,9616,9622,9634,9652,9662,9672,9676,9680,9702,9735,9738,9793,9795,11906,11909,11913,11917,11928,11944,11947,11951,11956,11960,11964,11979,12284,12292,12312,12319,12330,12351,12436,12447,12535,12543,12586,12842,12850,12964,13200,13215,13218,13253,13263,13267,13270,13384,13428,13727,13839,13851,14617,14703,14801,14816,14964,15183,15471,15585,16471,16736,17208,17325,17330,17374,17623,17997,18018,18212,18218,18301,18318,18760,18811,18814,18820,18823,18844,18848,18872,19576,19620,19738,19887,40870,59244,59336,59367,59413,59417,59423,59431,59437,59443,59452,59460,59478,59493,63789,63866,63894,63976,63986,64016,64018,64021,64025,64034,64037,64042,65074,65093,65107,65112,65127,65132,65375,65510,65536],"gbChars":[0,36,38,45,50,81,89,95,96,100,103,104,105,109,126,133,148,172,175,179,208,306,307,308,309,310,311,312,313,341,428,443,544,545,558,741,742,749,750,805,819,820,7922,7924,7925,7927,7934,7943,7944,7945,7950,8062,8148,8149,8152,8164,8174,8236,8240,8262,8264,8374,8380,8381,8384,8388,8390,8392,8393,8394,8396,8401,8406,8416,8419,8424,8437,8439,8445,8482,8485,8496,8521,8603,8936,8946,9046,9050,9063,9066,9076,9092,9100,9108,9111,9113,9131,9162,9164,9218,9219,11329,11331,11334,11336,11346,11361,11363,11366,11370,11372,11375,11389,11682,11686,11687,11692,11694,11714,11716,11723,11725,11730,11736,11982,11989,12102,12336,12348,12350,12384,12393,12395,12397,12510,12553,12851,12962,12973,13738,13823,13919,13933,14080,14298,14585,14698,15583,15847,16318,16434,16438,16481,16729,17102,17122,17315,17320,17402,17418,17859,17909,17911,17915,17916,17936,17939,17961,18664,18703,18814,18962,19043,33469,33470,33471,33484,33485,33490,33497,33501,33505,33513,33520,33536,33550,37845,37921,37948,38029,38038,38064,38065,38066,38069,38075,38076,38078,39108,39109,39113,39114,39115,39116,39265,39394,189000]} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gbk-added.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gbk-added.json new file mode 100644 index 0000000..8abfa9f --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gbk-added.json @@ -0,0 +1,55 @@ +[ +["a140","",62], +["a180","",32], +["a240","",62], +["a280","",32], +["a2ab","",5], +["a2e3","€"], +["a2ef",""], +["a2fd",""], +["a340","",62], +["a380","",31," "], +["a440","",62], +["a480","",32], +["a4f4","",10], +["a540","",62], +["a580","",32], +["a5f7","",7], +["a640","",62], +["a680","",32], +["a6b9","",7], +["a6d9","",6], +["a6ec",""], +["a6f3",""], +["a6f6","",8], +["a740","",62], +["a780","",32], +["a7c2","",14], +["a7f2","",12], +["a896","",10], +["a8bc",""], +["a8bf","ǹ"], +["a8c1",""], +["a8ea","",20], +["a958",""], +["a95b",""], +["a95d",""], +["a989","〾⿰",11], +["a997","",12], +["a9f0","",14], +["aaa1","",93], +["aba1","",93], +["aca1","",93], +["ada1","",93], +["aea1","",93], +["afa1","",93], +["d7fa","",4], +["f8a1","",93], +["f9a1","",93], +["faa1","",93], +["fba1","",93], +["fca1","",93], +["fda1","",93], +["fe50","⺁⺄㑳㑇⺈⺋㖞㘚㘎⺌⺗㥮㤘㧏㧟㩳㧐㭎㱮㳠⺧⺪䁖䅟⺮䌷⺳⺶⺷䎱䎬⺻䏝䓖䙡䙌"], +["fe80","䜣䜩䝼䞍⻊䥇䥺䥽䦂䦃䦅䦆䦟䦛䦷䦶䲣䲟䲠䲡䱷䲢䴓",6,"䶮",93] +] diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/shiftjis.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/shiftjis.json new file mode 100644 index 0000000..5a3a43c --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/shiftjis.json @@ -0,0 +1,125 @@ +[ +["0","\u0000",128], +["a1","。",62], +["8140"," 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",9,"+-±×"], +["8180","÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇◆□■△▲▽▼※〒→←↑↓〓"], +["81b8","∈∋⊆⊇⊂⊃∪∩"], +["81c8","∧∨¬⇒⇔∀∃"], +["81da","∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"], +["81f0","ʼn♯♭♪†‡¶"], +["81fc","◯"], +["824f","0",9], +["8260","A",25], +["8281","a",25], +["829f","ぁ",82], +["8340","ァ",62], +["8380","ム",22], +["839f","Α",16,"Σ",6], +["83bf","α",16,"σ",6], +["8440","А",5,"ЁЖ",25], +["8470","а",5,"ёж",7], +["8480","о",17], +["849f","─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"], +["8740","①",19,"Ⅰ",9], +["875f","㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"], +["877e","㍻"], +["8780","〝〟№㏍℡㊤",4,"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"], +["889f","亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"], +["8940","院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円"], +["8980","園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"], +["8a40","魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫"], +["8a80","橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"], +["8b40","機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救"], +["8b80","朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"], +["8c40","掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨"], +["8c80","劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"], +["8d40","后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降"], +["8d80","項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"], +["8e40","察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止"], +["8e80","死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"], +["8f40","宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳"], +["8f80","準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"], +["9040","拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨"], +["9080","逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"], +["9140","繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻"], +["9180","操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"], +["9240","叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄"], +["9280","逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"], +["9340","邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬"], +["9380","凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"], +["9440","如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅"], +["9480","楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"], +["9540","鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷"], +["9580","斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"], +["9640","法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆"], +["9680","摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"], +["9740","諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲"], +["9780","沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"], +["9840","蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"], +["989f","弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"], +["9940","僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭"], +["9980","凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"], +["9a40","咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸"], +["9a80","噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"], +["9b40","奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀"], +["9b80","它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"], +["9c40","廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠"], +["9c80","怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"], +["9d40","戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫"], +["9d80","捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"], +["9e40","曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎"], +["9e80","梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"], +["9f40","檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯"], +["9f80","麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"], +["e040","漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝"], +["e080","烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"], +["e140","瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿"], +["e180","痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"], +["e240","磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰"], +["e280","窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"], +["e340","紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷"], +["e380","縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"], +["e440","隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤"], +["e480","艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"], +["e540","蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬"], +["e580","蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"], +["e640","襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧"], +["e680","諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"], +["e740","蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜"], +["e780","轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"], +["e840","錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙"], +["e880","閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"], +["e940","顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃"], +["e980","騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"], +["ea40","鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯"], +["ea80","黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙"], +["ed40","纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏"], +["ed80","塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"], +["ee40","犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙"], +["ee80","蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"], +["eeef","ⅰ",9,"¬¦'""], +["f040","",62], +["f080","",124], +["f140","",62], +["f180","",124], +["f240","",62], +["f280","",124], +["f340","",62], +["f380","",124], +["f440","",62], +["f480","",124], +["f540","",62], +["f580","",124], +["f640","",62], +["f680","",124], +["f740","",62], +["f780","",124], +["f840","",62], +["f880","",124], +["f940",""], +["fa40","ⅰ",9,"Ⅰ",9,"¬¦'"㈱№℡∵纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊"], +["fa80","兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯"], +["fb40","涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神"], +["fb80","祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙"], +["fc40","髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"] +] diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/utf16.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/utf16.js new file mode 100644 index 0000000..54765ae --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/utf16.js @@ -0,0 +1,177 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js + +// == UTF16-BE codec. ========================================================== + +exports.utf16be = Utf16BECodec; +function Utf16BECodec() { +} + +Utf16BECodec.prototype.encoder = Utf16BEEncoder; +Utf16BECodec.prototype.decoder = Utf16BEDecoder; +Utf16BECodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf16BEEncoder() { +} + +Utf16BEEncoder.prototype.write = function(str) { + var buf = Buffer.from(str, 'ucs2'); + for (var i = 0; i < buf.length; i += 2) { + var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp; + } + return buf; +} + +Utf16BEEncoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf16BEDecoder() { + this.overflowByte = -1; +} + +Utf16BEDecoder.prototype.write = function(buf) { + if (buf.length == 0) + return ''; + + var buf2 = Buffer.alloc(buf.length + 1), + i = 0, j = 0; + + if (this.overflowByte !== -1) { + buf2[0] = buf[0]; + buf2[1] = this.overflowByte; + i = 1; j = 2; + } + + for (; i < buf.length-1; i += 2, j+= 2) { + buf2[j] = buf[i+1]; + buf2[j+1] = buf[i]; + } + + this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1; + + return buf2.slice(0, j).toString('ucs2'); +} + +Utf16BEDecoder.prototype.end = function() { +} + + +// == UTF-16 codec ============================================================= +// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic. +// Defaults to UTF-16LE, as it's prevalent and default in Node. +// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le +// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'}); + +// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false). + +exports.utf16 = Utf16Codec; +function Utf16Codec(codecOptions, iconv) { + this.iconv = iconv; +} + +Utf16Codec.prototype.encoder = Utf16Encoder; +Utf16Codec.prototype.decoder = Utf16Decoder; + + +// -- Encoding (pass-through) + +function Utf16Encoder(options, codec) { + options = options || {}; + if (options.addBOM === undefined) + options.addBOM = true; + this.encoder = codec.iconv.getEncoder('utf-16le', options); +} + +Utf16Encoder.prototype.write = function(str) { + return this.encoder.write(str); +} + +Utf16Encoder.prototype.end = function() { + return this.encoder.end(); +} + + +// -- Decoding + +function Utf16Decoder(options, codec) { + this.decoder = null; + this.initialBytes = []; + this.initialBytesLen = 0; + + this.options = options || {}; + this.iconv = codec.iconv; +} + +Utf16Decoder.prototype.write = function(buf) { + if (!this.decoder) { + // Codec is not chosen yet. Accumulate initial bytes. + this.initialBytes.push(buf); + this.initialBytesLen += buf.length; + + if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below) + return ''; + + // We have enough bytes -> detect endianness. + var buf = Buffer.concat(this.initialBytes), + encoding = detectEncoding(buf, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + this.initialBytes.length = this.initialBytesLen = 0; + } + + return this.decoder.write(buf); +} + +Utf16Decoder.prototype.end = function() { + if (!this.decoder) { + var buf = Buffer.concat(this.initialBytes), + encoding = detectEncoding(buf, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var res = this.decoder.write(buf), + trail = this.decoder.end(); + + return trail ? (res + trail) : res; + } + return this.decoder.end(); +} + +function detectEncoding(buf, defaultEncoding) { + var enc = defaultEncoding || 'utf-16le'; + + if (buf.length >= 2) { + // Check BOM. + if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM + enc = 'utf-16be'; + else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM + enc = 'utf-16le'; + else { + // No BOM found. Try to deduce encoding from initial content. + // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon. + // So, we count ASCII as if it was LE or BE, and decide from that. + var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions + _len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even. + + for (var i = 0; i < _len; i += 2) { + if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++; + if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++; + } + + if (asciiCharsBE > asciiCharsLE) + enc = 'utf-16be'; + else if (asciiCharsBE < asciiCharsLE) + enc = 'utf-16le'; + } + } + + return enc; +} + + diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/utf7.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/utf7.js new file mode 100644 index 0000000..b7631c2 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/encodings/utf7.js @@ -0,0 +1,290 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152 +// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3 + +exports.utf7 = Utf7Codec; +exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7 +function Utf7Codec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7Codec.prototype.encoder = Utf7Encoder; +Utf7Codec.prototype.decoder = Utf7Decoder; +Utf7Codec.prototype.bomAware = true; + + +// -- Encoding + +var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g; + +function Utf7Encoder(options, codec) { + this.iconv = codec.iconv; +} + +Utf7Encoder.prototype.write = function(str) { + // Naive implementation. + // Non-direct chars are encoded as "+-"; single "+" char is encoded as "+-". + return Buffer.from(str.replace(nonDirectChars, function(chunk) { + return "+" + (chunk === '+' ? '' : + this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) + + "-"; + }.bind(this))); +} + +Utf7Encoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf7Decoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64Regex = /[A-Za-z0-9\/+]/; +var base64Chars = []; +for (var i = 0; i < 256; i++) + base64Chars[i] = base64Regex.test(String.fromCharCode(i)); + +var plusChar = '+'.charCodeAt(0), + minusChar = '-'.charCodeAt(0), + andChar = '&'.charCodeAt(0); + +Utf7Decoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '+' + if (buf[i] == plusChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64Chars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) {// "+-" -> "+" + res += "+"; + } else { + var b64str = base64Accum + buf.slice(lastI, i).toString(); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus is absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + buf.slice(lastI).toString(); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7Decoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + +// UTF-7-IMAP codec. +// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3) +// Differences: +// * Base64 part is started by "&" instead of "+" +// * Direct characters are 0x20-0x7E, except "&" (0x26) +// * In Base64, "," is used instead of "/" +// * Base64 must not be used to represent direct characters. +// * No implicit shift back from Base64 (should always end with '-') +// * String must end in non-shifted position. +// * "-&" while in base64 is not allowed. + + +exports.utf7imap = Utf7IMAPCodec; +function Utf7IMAPCodec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder; +Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder; +Utf7IMAPCodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf7IMAPEncoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = Buffer.alloc(6); + this.base64AccumIdx = 0; +} + +Utf7IMAPEncoder.prototype.write = function(str) { + var inBase64 = this.inBase64, + base64Accum = this.base64Accum, + base64AccumIdx = this.base64AccumIdx, + buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0; + + for (var i = 0; i < str.length; i++) { + var uChar = str.charCodeAt(i); + if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'. + if (inBase64) { + if (base64AccumIdx > 0) { + bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + inBase64 = false; + } + + if (!inBase64) { + buf[bufIdx++] = uChar; // Write direct character + + if (uChar === andChar) // Ampersand -> '&-' + buf[bufIdx++] = minusChar; + } + + } else { // Non-direct character + if (!inBase64) { + buf[bufIdx++] = andChar; // Write '&', then go to base64 mode. + inBase64 = true; + } + if (inBase64) { + base64Accum[base64AccumIdx++] = uChar >> 8; + base64Accum[base64AccumIdx++] = uChar & 0xFF; + + if (base64AccumIdx == base64Accum.length) { + bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx); + base64AccumIdx = 0; + } + } + } + } + + this.inBase64 = inBase64; + this.base64AccumIdx = base64AccumIdx; + + return buf.slice(0, bufIdx); +} + +Utf7IMAPEncoder.prototype.end = function() { + var buf = Buffer.alloc(10), bufIdx = 0; + if (this.inBase64) { + if (this.base64AccumIdx > 0) { + bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + this.base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + this.inBase64 = false; + } + + return buf.slice(0, bufIdx); +} + + +// -- Decoding + +function Utf7IMAPDecoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64IMAPChars = base64Chars.slice(); +base64IMAPChars[','.charCodeAt(0)] = true; + +Utf7IMAPDecoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + // It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end). + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '&' + if (buf[i] == andChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64IMAPChars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) { // "&-" -> "&" + res += "&"; + } else { + var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/'); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus may be absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/'); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7IMAPDecoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + diff --git a/legacy-libs/grpc/node_modules/iconv-lite/lib/bom-handling.js b/legacy-libs/grpc/node_modules/iconv-lite/lib/bom-handling.js new file mode 100644 index 0000000..1050872 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/lib/bom-handling.js @@ -0,0 +1,52 @@ +"use strict"; + +var BOMChar = '\uFEFF'; + +exports.PrependBOM = PrependBOMWrapper +function PrependBOMWrapper(encoder, options) { + this.encoder = encoder; + this.addBOM = true; +} + +PrependBOMWrapper.prototype.write = function(str) { + if (this.addBOM) { + str = BOMChar + str; + this.addBOM = false; + } + + return this.encoder.write(str); +} + +PrependBOMWrapper.prototype.end = function() { + return this.encoder.end(); +} + + +//------------------------------------------------------------------------------ + +exports.StripBOM = StripBOMWrapper; +function StripBOMWrapper(decoder, options) { + this.decoder = decoder; + this.pass = false; + this.options = options || {}; +} + +StripBOMWrapper.prototype.write = function(buf) { + var res = this.decoder.write(buf); + if (this.pass || !res) + return res; + + if (res[0] === BOMChar) { + res = res.slice(1); + if (typeof this.options.stripBOM === 'function') + this.options.stripBOM(); + } + + this.pass = true; + return res; +} + +StripBOMWrapper.prototype.end = function() { + return this.decoder.end(); +} + diff --git a/legacy-libs/grpc/node_modules/iconv-lite/lib/extend-node.js b/legacy-libs/grpc/node_modules/iconv-lite/lib/extend-node.js new file mode 100644 index 0000000..87f5394 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/lib/extend-node.js @@ -0,0 +1,217 @@ +"use strict"; +var Buffer = require("buffer").Buffer; +// Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer + +// == Extend Node primitives to use iconv-lite ================================= + +module.exports = function (iconv) { + var original = undefined; // Place to keep original methods. + + // Node authors rewrote Buffer internals to make it compatible with + // Uint8Array and we cannot patch key functions since then. + // Note: this does use older Buffer API on a purpose + iconv.supportsNodeEncodingsExtension = !(Buffer.from || new Buffer(0) instanceof Uint8Array); + + iconv.extendNodeEncodings = function extendNodeEncodings() { + if (original) return; + original = {}; + + if (!iconv.supportsNodeEncodingsExtension) { + console.error("ACTION NEEDED: require('iconv-lite').extendNodeEncodings() is not supported in your version of Node"); + console.error("See more info at https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility"); + return; + } + + var nodeNativeEncodings = { + 'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true, + 'base64': true, 'ucs2': true, 'ucs-2': true, 'utf16le': true, 'utf-16le': true, + }; + + Buffer.isNativeEncoding = function(enc) { + return enc && nodeNativeEncodings[enc.toLowerCase()]; + } + + // -- SlowBuffer ----------------------------------------------------------- + var SlowBuffer = require('buffer').SlowBuffer; + + original.SlowBufferToString = SlowBuffer.prototype.toString; + SlowBuffer.prototype.toString = function(encoding, start, end) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.SlowBufferToString.call(this, encoding, start, end); + + // Otherwise, use our decoding method. + if (typeof start == 'undefined') start = 0; + if (typeof end == 'undefined') end = this.length; + return iconv.decode(this.slice(start, end), encoding); + } + + original.SlowBufferWrite = SlowBuffer.prototype.write; + SlowBuffer.prototype.write = function(string, offset, length, encoding) { + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length; + length = undefined; + } + } else { // legacy + var swap = encoding; + encoding = offset; + offset = length; + length = swap; + } + + offset = +offset || 0; + var remaining = this.length - offset; + if (!length) { + length = remaining; + } else { + length = +length; + if (length > remaining) { + length = remaining; + } + } + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.SlowBufferWrite.call(this, string, offset, length, encoding); + + if (string.length > 0 && (length < 0 || offset < 0)) + throw new RangeError('attempt to write beyond buffer bounds'); + + // Otherwise, use our encoding method. + var buf = iconv.encode(string, encoding); + if (buf.length < length) length = buf.length; + buf.copy(this, offset, 0, length); + return length; + } + + // -- Buffer --------------------------------------------------------------- + + original.BufferIsEncoding = Buffer.isEncoding; + Buffer.isEncoding = function(encoding) { + return Buffer.isNativeEncoding(encoding) || iconv.encodingExists(encoding); + } + + original.BufferByteLength = Buffer.byteLength; + Buffer.byteLength = SlowBuffer.byteLength = function(str, encoding) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferByteLength.call(this, str, encoding); + + // Slow, I know, but we don't have a better way yet. + return iconv.encode(str, encoding).length; + } + + original.BufferToString = Buffer.prototype.toString; + Buffer.prototype.toString = function(encoding, start, end) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferToString.call(this, encoding, start, end); + + // Otherwise, use our decoding method. + if (typeof start == 'undefined') start = 0; + if (typeof end == 'undefined') end = this.length; + return iconv.decode(this.slice(start, end), encoding); + } + + original.BufferWrite = Buffer.prototype.write; + Buffer.prototype.write = function(string, offset, length, encoding) { + var _offset = offset, _length = length, _encoding = encoding; + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length; + length = undefined; + } + } else { // legacy + var swap = encoding; + encoding = offset; + offset = length; + length = swap; + } + + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferWrite.call(this, string, _offset, _length, _encoding); + + offset = +offset || 0; + var remaining = this.length - offset; + if (!length) { + length = remaining; + } else { + length = +length; + if (length > remaining) { + length = remaining; + } + } + + if (string.length > 0 && (length < 0 || offset < 0)) + throw new RangeError('attempt to write beyond buffer bounds'); + + // Otherwise, use our encoding method. + var buf = iconv.encode(string, encoding); + if (buf.length < length) length = buf.length; + buf.copy(this, offset, 0, length); + return length; + + // TODO: Set _charsWritten. + } + + + // -- Readable ------------------------------------------------------------- + if (iconv.supportsStreams) { + var Readable = require('stream').Readable; + + original.ReadableSetEncoding = Readable.prototype.setEncoding; + Readable.prototype.setEncoding = function setEncoding(enc, options) { + // Use our own decoder, it has the same interface. + // We cannot use original function as it doesn't handle BOM-s. + this._readableState.decoder = iconv.getDecoder(enc, options); + this._readableState.encoding = enc; + } + + Readable.prototype.collect = iconv._collect; + } + } + + // Remove iconv-lite Node primitive extensions. + iconv.undoExtendNodeEncodings = function undoExtendNodeEncodings() { + if (!iconv.supportsNodeEncodingsExtension) + return; + if (!original) + throw new Error("require('iconv-lite').undoExtendNodeEncodings(): Nothing to undo; extendNodeEncodings() is not called.") + + delete Buffer.isNativeEncoding; + + var SlowBuffer = require('buffer').SlowBuffer; + + SlowBuffer.prototype.toString = original.SlowBufferToString; + SlowBuffer.prototype.write = original.SlowBufferWrite; + + Buffer.isEncoding = original.BufferIsEncoding; + Buffer.byteLength = original.BufferByteLength; + Buffer.prototype.toString = original.BufferToString; + Buffer.prototype.write = original.BufferWrite; + + if (iconv.supportsStreams) { + var Readable = require('stream').Readable; + + Readable.prototype.setEncoding = original.ReadableSetEncoding; + delete Readable.prototype.collect; + } + + original = undefined; + } +} diff --git a/legacy-libs/grpc/node_modules/iconv-lite/lib/index.d.ts b/legacy-libs/grpc/node_modules/iconv-lite/lib/index.d.ts new file mode 100644 index 0000000..0547eb3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/lib/index.d.ts @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + * REQUIREMENT: This definition is dependent on the @types/node definition. + * Install with `npm install @types/node --save-dev` + *--------------------------------------------------------------------------------------------*/ + +declare module 'iconv-lite' { + export function decode(buffer: Buffer, encoding: string, options?: Options): string; + + export function encode(content: string, encoding: string, options?: Options): Buffer; + + export function encodingExists(encoding: string): boolean; + + export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; + + export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; +} + +export interface Options { + stripBOM?: boolean; + addBOM?: boolean; + defaultEncoding?: string; +} diff --git a/legacy-libs/grpc/node_modules/iconv-lite/lib/index.js b/legacy-libs/grpc/node_modules/iconv-lite/lib/index.js new file mode 100644 index 0000000..5391919 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/lib/index.js @@ -0,0 +1,153 @@ +"use strict"; + +// Some environments don't have global Buffer (e.g. React Native). +// Solution would be installing npm modules "buffer" and "stream" explicitly. +var Buffer = require("safer-buffer").Buffer; + +var bomHandling = require("./bom-handling"), + iconv = module.exports; + +// All codecs and aliases are kept here, keyed by encoding name/alias. +// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`. +iconv.encodings = null; + +// Characters emitted in case of error. +iconv.defaultCharUnicode = '�'; +iconv.defaultCharSingleByte = '?'; + +// Public API. +iconv.encode = function encode(str, encoding, options) { + str = "" + (str || ""); // Ensure string. + + var encoder = iconv.getEncoder(encoding, options); + + var res = encoder.write(str); + var trail = encoder.end(); + + return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res; +} + +iconv.decode = function decode(buf, encoding, options) { + if (typeof buf === 'string') { + if (!iconv.skipDecodeWarning) { + console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding'); + iconv.skipDecodeWarning = true; + } + + buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer. + } + + var decoder = iconv.getDecoder(encoding, options); + + var res = decoder.write(buf); + var trail = decoder.end(); + + return trail ? (res + trail) : res; +} + +iconv.encodingExists = function encodingExists(enc) { + try { + iconv.getCodec(enc); + return true; + } catch (e) { + return false; + } +} + +// Legacy aliases to convert functions +iconv.toEncoding = iconv.encode; +iconv.fromEncoding = iconv.decode; + +// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache. +iconv._codecDataCache = {}; +iconv.getCodec = function getCodec(encoding) { + if (!iconv.encodings) + iconv.encodings = require("../encodings"); // Lazy load all encoding definitions. + + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + var enc = iconv._canonicalizeEncoding(encoding); + + // Traverse iconv.encodings to find actual codec. + var codecOptions = {}; + while (true) { + var codec = iconv._codecDataCache[enc]; + if (codec) + return codec; + + var codecDef = iconv.encodings[enc]; + + switch (typeof codecDef) { + case "string": // Direct alias to other encoding. + enc = codecDef; + break; + + case "object": // Alias with options. Can be layered. + for (var key in codecDef) + codecOptions[key] = codecDef[key]; + + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + enc = codecDef.type; + break; + + case "function": // Codec itself. + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + // The codec function must load all tables and return object with .encoder and .decoder methods. + // It'll be called only once (for each different options object). + codec = new codecDef(codecOptions, iconv); + + iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later. + return codec; + + default: + throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')"); + } + } +} + +iconv._canonicalizeEncoding = function(encoding) { + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, ""); +} + +iconv.getEncoder = function getEncoder(encoding, options) { + var codec = iconv.getCodec(encoding), + encoder = new codec.encoder(options, codec); + + if (codec.bomAware && options && options.addBOM) + encoder = new bomHandling.PrependBOM(encoder, options); + + return encoder; +} + +iconv.getDecoder = function getDecoder(encoding, options) { + var codec = iconv.getCodec(encoding), + decoder = new codec.decoder(options, codec); + + if (codec.bomAware && !(options && options.stripBOM === false)) + decoder = new bomHandling.StripBOM(decoder, options); + + return decoder; +} + + +// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json. +var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node; +if (nodeVer) { + + // Load streaming support in Node v0.10+ + var nodeVerArr = nodeVer.split(".").map(Number); + if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) { + require("./streams")(iconv); + } + + // Load Node primitive extensions. + require("./extend-node")(iconv); +} + +if ("Ā" != "\u0100") { + console.error("iconv-lite warning: javascript files use encoding different from utf-8. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info."); +} diff --git a/legacy-libs/grpc/node_modules/iconv-lite/lib/streams.js b/legacy-libs/grpc/node_modules/iconv-lite/lib/streams.js new file mode 100644 index 0000000..4409552 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/lib/streams.js @@ -0,0 +1,121 @@ +"use strict"; + +var Buffer = require("buffer").Buffer, + Transform = require("stream").Transform; + + +// == Exports ================================================================== +module.exports = function(iconv) { + + // Additional Public API. + iconv.encodeStream = function encodeStream(encoding, options) { + return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options); + } + + iconv.decodeStream = function decodeStream(encoding, options) { + return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options); + } + + iconv.supportsStreams = true; + + + // Not published yet. + iconv.IconvLiteEncoderStream = IconvLiteEncoderStream; + iconv.IconvLiteDecoderStream = IconvLiteDecoderStream; + iconv._collect = IconvLiteDecoderStream.prototype.collect; +}; + + +// == Encoder stream ======================================================= +function IconvLiteEncoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.decodeStrings = false; // We accept only strings, so we don't need to decode them. + Transform.call(this, options); +} + +IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteEncoderStream } +}); + +IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) { + if (typeof chunk != 'string') + return done(new Error("Iconv encoding stream needs strings as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteEncoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteEncoderStream.prototype.collect = function(cb) { + var chunks = []; + this.on('error', cb); + this.on('data', function(chunk) { chunks.push(chunk); }); + this.on('end', function() { + cb(null, Buffer.concat(chunks)); + }); + return this; +} + + +// == Decoder stream ======================================================= +function IconvLiteDecoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.encoding = this.encoding = 'utf8'; // We output strings. + Transform.call(this, options); +} + +IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteDecoderStream } +}); + +IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) { + if (!Buffer.isBuffer(chunk)) + return done(new Error("Iconv decoding stream needs buffers as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteDecoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteDecoderStream.prototype.collect = function(cb) { + var res = ''; + this.on('error', cb); + this.on('data', function(chunk) { res += chunk; }); + this.on('end', function() { + cb(null, res); + }); + return this; +} + diff --git a/legacy-libs/grpc/node_modules/iconv-lite/package.json b/legacy-libs/grpc/node_modules/iconv-lite/package.json new file mode 100644 index 0000000..0f2f7d8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/iconv-lite/package.json @@ -0,0 +1,83 @@ +{ + "_args": [ + [ + "iconv-lite@0.4.23", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "iconv-lite@0.4.23", + "_id": "iconv-lite@0.4.23", + "_inBundle": false, + "_integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "_location": "/grpc/iconv-lite", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "iconv-lite@0.4.23", + "name": "iconv-lite", + "escapedName": "iconv-lite", + "rawSpec": "0.4.23", + "saveSpec": null, + "fetchSpec": "0.4.23" + }, + "_requiredBy": [ + "/grpc/needle" + ], + "_resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "_shrinkwrap": null, + "_spec": "0.4.23", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Alexander Shtuchkin", + "email": "ashtuchkin@gmail.com" + }, + "browser": { + "./lib/extend-node": false, + "./lib/streams": false + }, + "bugs": { + "url": "https://github.com/ashtuchkin/iconv-lite/issues" + }, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "description": "Convert character encodings in pure javascript.", + "devDependencies": { + "async": "*", + "errto": "*", + "iconv": "*", + "istanbul": "*", + "mocha": "^3.1.0", + "request": "~2.81.0", + "semver": "*", + "unorm": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "homepage": "https://github.com/ashtuchkin/iconv-lite", + "keywords": [ + "iconv", + "convert", + "charset", + "icu" + ], + "license": "MIT", + "main": "./lib/index.js", + "name": "iconv-lite", + "optionalDependencies": {}, + "readme": "## Pure JS character encoding conversion [![Build Status](https://travis-ci.org/ashtuchkin/iconv-lite.svg?branch=master)](https://travis-ci.org/ashtuchkin/iconv-lite)\n\n * Doesn't need native code compilation. Works on Windows and in sandboxed environments like [Cloud9](http://c9.io).\n * Used in popular projects like [Express.js (body_parser)](https://github.com/expressjs/body-parser), \n [Grunt](http://gruntjs.com/), [Nodemailer](http://www.nodemailer.com/), [Yeoman](http://yeoman.io/) and others.\n * Faster than [node-iconv](https://github.com/bnoordhuis/node-iconv) (see below for performance comparison).\n * Intuitive encode/decode API\n * Streaming support for Node v0.10+\n * [Deprecated] Can extend Node.js primitives (buffers, streams) to support all iconv-lite encodings.\n * In-browser usage via [Browserify](https://github.com/substack/node-browserify) (~180k gzip compressed with Buffer shim included).\n * Typescript [type definition file](https://github.com/ashtuchkin/iconv-lite/blob/master/lib/index.d.ts) included.\n * React Native is supported (need to explicitly `npm install` two more modules: `buffer` and `stream`).\n * License: MIT.\n\n[![NPM Stats](https://nodei.co/npm/iconv-lite.png?downloads=true&downloadRank=true)](https://npmjs.org/packages/iconv-lite/)\n\n## Usage\n### Basic API\n```javascript\nvar iconv = require('iconv-lite');\n\n// Convert from an encoded buffer to js string.\nstr = iconv.decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251');\n\n// Convert from js string to an encoded buffer.\nbuf = iconv.encode(\"Sample input string\", 'win1251');\n\n// Check if encoding is supported\niconv.encodingExists(\"us-ascii\")\n```\n\n### Streaming API (Node v0.10+)\n```javascript\n\n// Decode stream (from binary stream to js strings)\nhttp.createServer(function(req, res) {\n var converterStream = iconv.decodeStream('win1251');\n req.pipe(converterStream);\n\n converterStream.on('data', function(str) {\n console.log(str); // Do something with decoded strings, chunk-by-chunk.\n });\n});\n\n// Convert encoding streaming example\nfs.createReadStream('file-in-win1251.txt')\n .pipe(iconv.decodeStream('win1251'))\n .pipe(iconv.encodeStream('ucs2'))\n .pipe(fs.createWriteStream('file-in-ucs2.txt'));\n\n// Sugar: all encode/decode streams have .collect(cb) method to accumulate data.\nhttp.createServer(function(req, res) {\n req.pipe(iconv.decodeStream('win1251')).collect(function(err, body) {\n assert(typeof body == 'string');\n console.log(body); // full request body string\n });\n});\n```\n\n### [Deprecated] Extend Node.js own encodings\n> NOTE: This doesn't work on latest Node versions. See [details](https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility).\n\n```javascript\n// After this call all Node basic primitives will understand iconv-lite encodings.\niconv.extendNodeEncodings();\n\n// Examples:\nbuf = new Buffer(str, 'win1251');\nbuf.write(str, 'gbk');\nstr = buf.toString('latin1');\nassert(Buffer.isEncoding('iso-8859-15'));\nBuffer.byteLength(str, 'us-ascii');\n\nhttp.createServer(function(req, res) {\n req.setEncoding('big5');\n req.collect(function(err, body) {\n console.log(body);\n });\n});\n\nfs.createReadStream(\"file.txt\", \"shift_jis\");\n\n// External modules are also supported (if they use Node primitives, which they probably do).\nrequest = require('request');\nrequest({\n url: \"http://github.com/\", \n encoding: \"cp932\"\n});\n\n// To remove extensions\niconv.undoExtendNodeEncodings();\n```\n\n## Supported encodings\n\n * All node.js native encodings: utf8, ucs2 / utf16-le, ascii, binary, base64, hex.\n * Additional unicode encodings: utf16, utf16-be, utf-7, utf-7-imap.\n * All widespread singlebyte encodings: Windows 125x family, ISO-8859 family, \n IBM/DOS codepages, Macintosh family, KOI8 family, all others supported by iconv library. \n Aliases like 'latin1', 'us-ascii' also supported.\n * All widespread multibyte encodings: CP932, CP936, CP949, CP950, GB2312, GBK, GB18030, Big5, Shift_JIS, EUC-JP.\n\nSee [all supported encodings on wiki](https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings).\n\nMost singlebyte encodings are generated automatically from [node-iconv](https://github.com/bnoordhuis/node-iconv). Thank you Ben Noordhuis and libiconv authors!\n\nMultibyte encodings are generated from [Unicode.org mappings](http://www.unicode.org/Public/MAPPINGS/) and [WHATWG Encoding Standard mappings](http://encoding.spec.whatwg.org/). Thank you, respective authors!\n\n\n## Encoding/decoding speed\n\nComparison with node-iconv module (1000x256kb, on MacBook Pro, Core i5/2.6 GHz, Node v0.12.0). \nNote: your results may vary, so please always check on your hardware.\n\n operation iconv@2.1.4 iconv-lite@0.4.7\n ----------------------------------------------------------\n encode('win1251') ~96 Mb/s ~320 Mb/s\n decode('win1251') ~95 Mb/s ~246 Mb/s\n\n## BOM handling\n\n * Decoding: BOM is stripped by default, unless overridden by passing `stripBOM: false` in options\n (f.ex. `iconv.decode(buf, enc, {stripBOM: false})`).\n A callback might also be given as a `stripBOM` parameter - it'll be called if BOM character was actually found.\n * If you want to detect UTF-8 BOM when decoding other encodings, use [node-autodetect-decoder-stream](https://github.com/danielgindi/node-autodetect-decoder-stream) module.\n * Encoding: No BOM added, unless overridden by `addBOM: true` option.\n\n## UTF-16 Encodings\n\nThis library supports UTF-16LE, UTF-16BE and UTF-16 encodings. First two are straightforward, but UTF-16 is trying to be\nsmart about endianness in the following ways:\n * Decoding: uses BOM and 'spaces heuristic' to determine input endianness. Default is UTF-16LE, but can be \n overridden with `defaultEncoding: 'utf-16be'` option. Strips BOM unless `stripBOM: false`.\n * Encoding: uses UTF-16LE and writes BOM by default. Use `addBOM: false` to override.\n\n## Other notes\n\nWhen decoding, be sure to supply a Buffer to decode() method, otherwise [bad things usually happen](https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding). \nUntranslatable characters are set to � or ?. No transliteration is currently supported. \nNode versions 0.10.31 and 0.11.13 are buggy, don't use them (see #65, #77). \n\n## Testing\n\n```bash\n$ git clone git@github.com:ashtuchkin/iconv-lite.git\n$ cd iconv-lite\n$ npm install\n$ npm test\n \n$ # To view performance:\n$ node test/performance.js\n\n$ # To view test coverage:\n$ npm run coverage\n$ open coverage/lcov-report/index.html\n```\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/ashtuchkin/iconv-lite.git" + }, + "scripts": { + "coverage": "istanbul cover _mocha -- --grep .", + "coverage-open": "open coverage/lcov-report/index.html", + "test": "mocha --reporter spec --grep ." + }, + "typings": "./lib/index.d.ts", + "version": "0.4.23" +} diff --git a/legacy-libs/grpc/node_modules/ignore-walk/LICENSE b/legacy-libs/grpc/node_modules/ignore-walk/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/ignore-walk/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/ignore-walk/README.md b/legacy-libs/grpc/node_modules/ignore-walk/README.md new file mode 100644 index 0000000..66b69e8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/ignore-walk/README.md @@ -0,0 +1,60 @@ +# ignore-walk + +[![Build +Status](https://travis-ci.org/isaacs/ignore-walk.svg?branch=master)](https://travis-ci.org/isaacs/ignore-walk) + +Nested/recursive `.gitignore`/`.npmignore` parsing and filtering. + +Walk a directory creating a list of entries, parsing any `.ignore` +files met along the way to exclude files. + +## USAGE + +```javascript +const walk = require('ignore-walk') + +// All options are optional, defaults provided. + +// this function returns a promise, but you can also pass a cb +// if you like that approach better. +walk({ + path: '...', // root dir to start in. defaults to process.cwd() + ignoreFiles: [ '.gitignore' ], // list of filenames. defaults to ['.ignore'] + includeEmpty: true|false, // true to include empty dirs, default false + follow: true|false // true to follow symlink dirs, default false +}, callback) + +// to walk synchronously, do it this way: +const result = walk.sync({ path: '/wow/such/filepath' }) +``` + +If you want to get at the underlying classes, they're at `walk.Walker` +and `walk.WalkerSync`. + +## OPTIONS + +* `path` The path to start in. Defaults to `process.cwd()` + +* `ignoreFiles` Filenames to treat as ignore files. The default is + `['.ignore']`. (This is where you'd put `.gitignore` or + `.npmignore` or whatever.) If multiple ignore files are in a + directory, then rules from each are applied in the order that the + files are listed. + +* `includeEmpty` Set to `true` to include empty directories, assuming + they are not excluded by any of the ignore rules. If not set, then + this follows the standard `git` behavior of not including + directories that are empty. + + Note: this will cause an empty directory to be included if it + would contain an included entry, even if it would have otherwise + been excluded itself. + + For example, given the rules `*` (ignore everything) and `!/a/b/c` + (re-include the entry at `/a/b/c`), the directory `/a/b` will be + included if it is empty. + +* `follow` Set to `true` to treat symbolically linked directories as + directories, recursing into them. There is no handling for nested + symlinks, so `ELOOP` errors can occur in some cases when using this + option. Defaults to `false`. diff --git a/legacy-libs/grpc/node_modules/ignore-walk/index.js b/legacy-libs/grpc/node_modules/ignore-walk/index.js new file mode 100644 index 0000000..abfd9ec --- /dev/null +++ b/legacy-libs/grpc/node_modules/ignore-walk/index.js @@ -0,0 +1,265 @@ +'use strict' + +const fs = require('fs') +const path = require('path') +const EE = require('events').EventEmitter +const Minimatch = require('minimatch').Minimatch + +class Walker extends EE { + constructor (opts) { + opts = opts || {} + super(opts) + this.path = opts.path || process.cwd() + this.basename = path.basename(this.path) + this.ignoreFiles = opts.ignoreFiles || [ '.ignore' ] + this.ignoreRules = {} + this.parent = opts.parent || null + this.includeEmpty = !!opts.includeEmpty + this.root = this.parent ? this.parent.root : this.path + this.follow = !!opts.follow + this.result = this.parent ? this.parent.result : [] + this.entries = null + this.sawError = false + } + + sort (a, b) { + return a.localeCompare(b) + } + + emit (ev, data) { + let ret = false + if (!(this.sawError && ev === 'error')) { + if (ev === 'error') + this.sawError = true + else if (ev === 'done' && !this.parent) + data = data.sort(this.sort) + if (ev === 'error' && this.parent) + ret = this.parent.emit('error', data) + else + ret = super.emit(ev, data) + } + return ret + } + + start () { + fs.readdir(this.path, (er, entries) => + er ? this.emit('error', er) : this.onReaddir(entries)) + return this + } + + isIgnoreFile (e) { + return e !== "." && + e !== ".." && + -1 !== this.ignoreFiles.indexOf(e) + } + + onReaddir (entries) { + this.entries = entries + if (entries.length === 0) { + if (this.includeEmpty) + this.result.push(this.path.substr(this.root.length + 1)) + this.emit('done', this.result) + } else { + const hasIg = this.entries.some(e => + this.isIgnoreFile(e)) + + if (hasIg) + this.addIgnoreFiles() + else + this.filterEntries() + } + } + + addIgnoreFiles () { + const newIg = this.entries + .filter(e => this.isIgnoreFile(e)) + + let igCount = newIg.length + const then = _ => { + if (--igCount === 0) + this.filterEntries() + } + + newIg.forEach(e => this.addIgnoreFile(e, then)) + } + + addIgnoreFile (file, then) { + const ig = path.resolve(this.path, file) + fs.readFile(ig, 'utf8', (er, data) => + er ? this.emit('error', er) : this.onReadIgnoreFile(file, data, then)) + } + + onReadIgnoreFile (file, data, then) { + const mmopt = { + matchBase: true, + dot: true, + flipNegate: true, + nocase: true + } + const rules = data.split(/\r?\n/) + .filter(line => !/^#|^$/.test(line.trim())) + .map(r => new Minimatch(r, mmopt)) + + this.ignoreRules[file] = rules + + then() + } + + filterEntries () { + // at this point we either have ignore rules, or just inheriting + // this exclusion is at the point where we know the list of + // entries in the dir, but don't know what they are. since + // some of them *might* be directories, we have to run the + // match in dir-mode as well, so that we'll pick up partials + // of files that will be included later. Anything included + // at this point will be checked again later once we know + // what it is. + const filtered = this.entries.map(entry => { + // at this point, we don't know if it's a dir or not. + const passFile = this.filterEntry(entry) + const passDir = this.filterEntry(entry, true) + return (passFile || passDir) ? [entry, passFile, passDir] : false + }).filter(e => e) + + // now we stat them all + // if it's a dir, and passes as a dir, then recurse + // if it's not a dir, but passes as a file, add to set + let entryCount = filtered.length + if (entryCount === 0) { + this.emit('done', this.result) + } else { + const then = _ => { + if (-- entryCount === 0) + this.emit('done', this.result) + } + filtered.forEach(filt => { + const entry = filt[0] + const file = filt[1] + const dir = filt[2] + this.stat(entry, file, dir, then) + }) + } + } + + onstat (st, entry, file, dir, then) { + const abs = this.path + '/' + entry + if (!st.isDirectory()) { + if (file) + this.result.push(abs.substr(this.root.length + 1)) + then() + } else { + // is a directory + if (dir) + this.walker(entry, then) + else + then() + } + } + + stat (entry, file, dir, then) { + const abs = this.path + '/' + entry + fs[this.follow ? 'stat' : 'lstat'](abs, (er, st) => { + if (er) + this.emit('error', er) + else + this.onstat(st, entry, file, dir, then) + }) + } + + walkerOpt (entry) { + return { + path: this.path + '/' + entry, + parent: this, + ignoreFiles: this.ignoreFiles, + follow: this.follow, + includeEmpty: this.includeEmpty + } + } + + walker (entry, then) { + new Walker(this.walkerOpt(entry)).on('done', then).start() + } + + filterEntry (entry, partial) { + let included = true + + // this = /a/b/c + // entry = d + // parent /a/b sees c/d + if (this.parent && this.parent.filterEntry) { + var pt = this.basename + "/" + entry + included = this.parent.filterEntry(pt, partial) + } + + this.ignoreFiles.forEach(f => { + if (this.ignoreRules[f]) { + this.ignoreRules[f].forEach(rule => { + // negation means inclusion + // so if it's negated, and already included, no need to check + // likewise if it's neither negated nor included + if (rule.negate !== included) { + // first, match against /foo/bar + // then, against foo/bar + // then, in the case of partials, match with a / + const match = rule.match('/' + entry) || + rule.match(entry) || + (!!partial && ( + rule.match('/' + entry + '/') || + rule.match(entry + '/'))) || + (!!partial && rule.negate && ( + rule.match('/' + entry, true) || + rule.match(entry, true))) + + if (match) + included = rule.negate + } + }) + } + }) + + return included + } +} + +class WalkerSync extends Walker { + constructor (opt) { + super(opt) + } + + start () { + this.onReaddir(fs.readdirSync(this.path)) + return this + } + + addIgnoreFile (file, then) { + const ig = path.resolve(this.path, file) + this.onReadIgnoreFile(file, fs.readFileSync(ig, 'utf8'), then) + } + + stat (entry, file, dir, then) { + const abs = this.path + '/' + entry + const st = fs[this.follow ? 'statSync' : 'lstatSync'](abs) + this.onstat(st, entry, file, dir, then) + } + + walker (entry, then) { + new WalkerSync(this.walkerOpt(entry)).start() + then() + } +} + +const walk = (options, callback) => { + const p = new Promise((resolve, reject) => { + new Walker(options).on('done', resolve).on('error', reject).start() + }) + return callback ? p.then(res => callback(null, res), callback) : p +} + +const walkSync = options => { + return new WalkerSync(options).start().result +} + +module.exports = walk +walk.sync = walkSync +walk.Walker = Walker +walk.WalkerSync = WalkerSync diff --git a/legacy-libs/grpc/node_modules/ignore-walk/package.json b/legacy-libs/grpc/node_modules/ignore-walk/package.json new file mode 100644 index 0000000..0405313 --- /dev/null +++ b/legacy-libs/grpc/node_modules/ignore-walk/package.json @@ -0,0 +1,78 @@ +{ + "_args": [ + [ + "ignore-walk@3.0.1", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "ignore-walk@3.0.1", + "_id": "ignore-walk@3.0.1", + "_inBundle": false, + "_integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", + "_location": "/grpc/ignore-walk", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ignore-walk@3.0.1", + "name": "ignore-walk", + "escapedName": "ignore-walk", + "rawSpec": "3.0.1", + "saveSpec": null, + "fetchSpec": "3.0.1" + }, + "_requiredBy": [ + "/grpc/npm-packlist" + ], + "_resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", + "_shrinkwrap": null, + "_spec": "3.0.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/ignore-walk/issues" + }, + "dependencies": { + "minimatch": "^3.0.4" + }, + "description": "Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.", + "devDependencies": { + "mkdirp": "^0.5.1", + "mutate-fs": "^1.1.0", + "rimraf": "^2.6.1", + "tap": "^10.7.2" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/isaacs/ignore-walk#readme", + "keywords": [ + "ignorefile", + "ignore", + "file", + ".gitignore", + ".npmignore", + "glob" + ], + "license": "ISC", + "main": "index.js", + "name": "ignore-walk", + "optionalDependencies": {}, + "readme": "# ignore-walk\n\n[![Build\nStatus](https://travis-ci.org/isaacs/ignore-walk.svg?branch=master)](https://travis-ci.org/isaacs/ignore-walk)\n\nNested/recursive `.gitignore`/`.npmignore` parsing and filtering.\n\nWalk a directory creating a list of entries, parsing any `.ignore`\nfiles met along the way to exclude files.\n\n## USAGE\n\n```javascript\nconst walk = require('ignore-walk')\n\n// All options are optional, defaults provided.\n\n// this function returns a promise, but you can also pass a cb\n// if you like that approach better.\nwalk({\n path: '...', // root dir to start in. defaults to process.cwd()\n ignoreFiles: [ '.gitignore' ], // list of filenames. defaults to ['.ignore']\n includeEmpty: true|false, // true to include empty dirs, default false\n follow: true|false // true to follow symlink dirs, default false\n}, callback)\n\n// to walk synchronously, do it this way:\nconst result = walk.sync({ path: '/wow/such/filepath' })\n```\n\nIf you want to get at the underlying classes, they're at `walk.Walker`\nand `walk.WalkerSync`.\n\n## OPTIONS\n\n* `path` The path to start in. Defaults to `process.cwd()`\n\n* `ignoreFiles` Filenames to treat as ignore files. The default is\n `['.ignore']`. (This is where you'd put `.gitignore` or\n `.npmignore` or whatever.) If multiple ignore files are in a\n directory, then rules from each are applied in the order that the\n files are listed.\n\n* `includeEmpty` Set to `true` to include empty directories, assuming\n they are not excluded by any of the ignore rules. If not set, then\n this follows the standard `git` behavior of not including\n directories that are empty.\n\n Note: this will cause an empty directory to be included if it\n would contain an included entry, even if it would have otherwise\n been excluded itself.\n\n For example, given the rules `*` (ignore everything) and `!/a/b/c`\n (re-include the entry at `/a/b/c`), the directory `/a/b` will be\n included if it is empty.\n\n* `follow` Set to `true` to treat symbolically linked directories as\n directories, recursing into them. There is no handling for nested\n symlinks, so `ELOOP` errors can occur in some cases when using this\n option. Defaults to `false`.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/ignore-walk.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --100" + }, + "version": "3.0.1" +} diff --git a/legacy-libs/grpc/node_modules/inflight/LICENSE b/legacy-libs/grpc/node_modules/inflight/LICENSE new file mode 100644 index 0000000..05eeeb8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/inflight/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/inflight/README.md b/legacy-libs/grpc/node_modules/inflight/README.md new file mode 100644 index 0000000..6dc8929 --- /dev/null +++ b/legacy-libs/grpc/node_modules/inflight/README.md @@ -0,0 +1,37 @@ +# inflight + +Add callbacks to requests in flight to avoid async duplication + +## USAGE + +```javascript +var inflight = require('inflight') + +// some request that does some stuff +function req(key, callback) { + // key is any random string. like a url or filename or whatever. + // + // will return either a falsey value, indicating that the + // request for this key is already in flight, or a new callback + // which when called will call all callbacks passed to inflightk + // with the same key + callback = inflight(key, callback) + + // If we got a falsey value back, then there's already a req going + if (!callback) return + + // this is where you'd fetch the url or whatever + // callback is also once()-ified, so it can safely be assigned + // to multiple events etc. First call wins. + setTimeout(function() { + callback(null, key) + }, 100) +} + +// only assigns a single setTimeout +// when it dings, all cbs get called +req('foo', cb1) +req('foo', cb2) +req('foo', cb3) +req('foo', cb4) +``` diff --git a/legacy-libs/grpc/node_modules/inflight/inflight.js b/legacy-libs/grpc/node_modules/inflight/inflight.js new file mode 100644 index 0000000..48202b3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/inflight/inflight.js @@ -0,0 +1,54 @@ +var wrappy = require('wrappy') +var reqs = Object.create(null) +var once = require('once') + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + + // XXX It's somewhat ambiguous whether a new callback added in this + // pass should be queued for later execution if something in the + // list of callbacks throws, or if it should just be discarded. + // However, it's such an edge case that it hardly matters, and either + // choice is likely as surprising as the other. + // As it happens, we do go ahead and schedule it for later execution. + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + } finally { + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} diff --git a/legacy-libs/grpc/node_modules/inflight/package.json b/legacy-libs/grpc/node_modules/inflight/package.json new file mode 100644 index 0000000..9bf5e01 --- /dev/null +++ b/legacy-libs/grpc/node_modules/inflight/package.json @@ -0,0 +1,65 @@ +{ + "_args": [ + [ + "inflight@1.0.6", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "inflight@1.0.6", + "_id": "inflight@1.0.6", + "_inBundle": false, + "_integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "_location": "/grpc/inflight", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "inflight@1.0.6", + "name": "inflight", + "escapedName": "inflight", + "rawSpec": "1.0.6", + "saveSpec": null, + "fetchSpec": "1.0.6" + }, + "_requiredBy": [ + "/grpc/rimraf/glob" + ], + "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "_shrinkwrap": null, + "_spec": "1.0.6", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/inflight/issues" + }, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "description": "Add callbacks to requests in flight to avoid async duplication", + "devDependencies": { + "tap": "^7.1.2" + }, + "files": [ + "inflight.js" + ], + "homepage": "https://github.com/isaacs/inflight", + "license": "ISC", + "main": "inflight.js", + "name": "inflight", + "optionalDependencies": {}, + "readme": "# inflight\n\nAdd callbacks to requests in flight to avoid async duplication\n\n## USAGE\n\n```javascript\nvar inflight = require('inflight')\n\n// some request that does some stuff\nfunction req(key, callback) {\n // key is any random string. like a url or filename or whatever.\n //\n // will return either a falsey value, indicating that the\n // request for this key is already in flight, or a new callback\n // which when called will call all callbacks passed to inflightk\n // with the same key\n callback = inflight(key, callback)\n\n // If we got a falsey value back, then there's already a req going\n if (!callback) return\n\n // this is where you'd fetch the url or whatever\n // callback is also once()-ified, so it can safely be assigned\n // to multiple events etc. First call wins.\n setTimeout(function() {\n callback(null, key)\n }, 100)\n}\n\n// only assigns a single setTimeout\n// when it dings, all cbs get called\nreq('foo', cb1)\nreq('foo', cb2)\nreq('foo', cb3)\nreq('foo', cb4)\n```\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/inflight.git" + }, + "scripts": { + "test": "tap test.js --100" + }, + "version": "1.0.6" +} diff --git a/legacy-libs/grpc/node_modules/inherits/LICENSE b/legacy-libs/grpc/node_modules/inherits/LICENSE new file mode 100644 index 0000000..dea3013 --- /dev/null +++ b/legacy-libs/grpc/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +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/legacy-libs/grpc/node_modules/inherits/README.md b/legacy-libs/grpc/node_modules/inherits/README.md new file mode 100644 index 0000000..b1c5665 --- /dev/null +++ b/legacy-libs/grpc/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +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/legacy-libs/grpc/node_modules/inherits/inherits.js b/legacy-libs/grpc/node_modules/inherits/inherits.js new file mode 100644 index 0000000..3b94763 --- /dev/null +++ b/legacy-libs/grpc/node_modules/inherits/inherits.js @@ -0,0 +1,7 @@ +try { + var util = require('util'); + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + module.exports = require('./inherits_browser.js'); +} diff --git a/legacy-libs/grpc/node_modules/inherits/inherits_browser.js b/legacy-libs/grpc/node_modules/inherits/inherits_browser.js new file mode 100644 index 0000000..c1e78a7 --- /dev/null +++ b/legacy-libs/grpc/node_modules/inherits/inherits_browser.js @@ -0,0 +1,23 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, 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) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} diff --git a/legacy-libs/grpc/node_modules/inherits/package.json b/legacy-libs/grpc/node_modules/inherits/package.json new file mode 100644 index 0000000..dac6c33 --- /dev/null +++ b/legacy-libs/grpc/node_modules/inherits/package.json @@ -0,0 +1,70 @@ +{ + "_args": [ + [ + "inherits@2.0.3", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "inherits@2.0.3", + "_id": "inherits@2.0.3", + "_inBundle": false, + "_integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "_location": "/grpc/inherits", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "inherits@2.0.3", + "name": "inherits", + "escapedName": "inherits", + "rawSpec": "2.0.3", + "saveSpec": null, + "fetchSpec": "2.0.3" + }, + "_requiredBy": [ + "/grpc/readable-stream", + "/grpc/rimraf/glob" + ], + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "_shrinkwrap": null, + "_spec": "2.0.3", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "browser": "./inherits_browser.js", + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "dependencies": {}, + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "devDependencies": { + "tap": "^7.1.0" + }, + "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", + "optionalDependencies": {}, + "readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n superclass\n* new version overwrites current prototype while old one preserves any\n existing fields on it\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits.git" + }, + "scripts": { + "test": "node test" + }, + "version": "2.0.3" +} diff --git a/legacy-libs/grpc/node_modules/ini/LICENSE b/legacy-libs/grpc/node_modules/ini/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/ini/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/ini/README.md b/legacy-libs/grpc/node_modules/ini/README.md new file mode 100644 index 0000000..33df258 --- /dev/null +++ b/legacy-libs/grpc/node_modules/ini/README.md @@ -0,0 +1,102 @@ +An ini format parser and serializer for node. + +Sections are treated as nested objects. Items before the first +heading are saved on the object directly. + +## Usage + +Consider an ini-file `config.ini` that looks like this: + + ; this comment is being ignored + scope = global + + [database] + user = dbuser + password = dbpassword + database = use_this_database + + [paths.default] + datadir = /var/lib/data + array[] = first value + array[] = second value + array[] = third value + +You can read, manipulate and write the ini-file like so: + + var fs = require('fs') + , ini = require('ini') + + var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8')) + + config.scope = 'local' + config.database.database = 'use_another_database' + config.paths.default.tmpdir = '/tmp' + delete config.paths.default.datadir + config.paths.default.array.push('fourth value') + + fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' })) + +This will result in a file called `config_modified.ini` being written +to the filesystem with the following content: + + [section] + scope=local + [section.database] + user=dbuser + password=dbpassword + database=use_another_database + [section.paths.default] + tmpdir=/tmp + array[]=first value + array[]=second value + array[]=third value + array[]=fourth value + + +## API + +### decode(inistring) + +Decode the ini-style formatted `inistring` into a nested object. + +### parse(inistring) + +Alias for `decode(inistring)` + +### encode(object, [options]) + +Encode the object `object` into an ini-style formatted string. If the +optional parameter `section` is given, then all top-level properties +of the object are put into this section and the `section`-string is +prepended to all sub-sections, see the usage example above. + +The `options` object may contain the following: + +* `section` A string which will be the first `section` in the encoded + ini data. Defaults to none. +* `whitespace` Boolean to specify whether to put whitespace around the + `=` character. By default, whitespace is omitted, to be friendly to + some persnickety old parsers that don't tolerate it well. But some + find that it's more human-readable and pretty with the whitespace. + +For backwards compatibility reasons, if a `string` options is passed +in, then it is assumed to be the `section` value. + +### stringify(object, [options]) + +Alias for `encode(object, [options])` + +### safe(val) + +Escapes the string `val` such that it is safe to be used as a key or +value in an ini-file. Basically escapes quotes. For example + + ini.safe('"unsafe string"') + +would result in + + "\"unsafe string\"" + +### unsafe(val) + +Unescapes the string `val` diff --git a/legacy-libs/grpc/node_modules/ini/ini.js b/legacy-libs/grpc/node_modules/ini/ini.js new file mode 100644 index 0000000..590195d --- /dev/null +++ b/legacy-libs/grpc/node_modules/ini/ini.js @@ -0,0 +1,194 @@ +exports.parse = exports.decode = decode + +exports.stringify = exports.encode = encode + +exports.safe = safe +exports.unsafe = unsafe + +var eol = typeof process !== 'undefined' && + process.platform === 'win32' ? '\r\n' : '\n' + +function encode (obj, opt) { + var children = [] + var out = '' + + if (typeof opt === 'string') { + opt = { + section: opt, + whitespace: false + } + } else { + opt = opt || {} + opt.whitespace = opt.whitespace === true + } + + var separator = opt.whitespace ? ' = ' : '=' + + Object.keys(obj).forEach(function (k, _, __) { + var val = obj[k] + if (val && Array.isArray(val)) { + val.forEach(function (item) { + out += safe(k + '[]') + separator + safe(item) + '\n' + }) + } else if (val && typeof val === 'object') { + children.push(k) + } else { + out += safe(k) + separator + safe(val) + eol + } + }) + + if (opt.section && out.length) { + out = '[' + safe(opt.section) + ']' + eol + out + } + + children.forEach(function (k, _, __) { + var nk = dotSplit(k).join('\\.') + var section = (opt.section ? opt.section + '.' : '') + nk + var child = encode(obj[k], { + section: section, + whitespace: opt.whitespace + }) + if (out.length && child.length) { + out += eol + } + out += child + }) + + return out +} + +function dotSplit (str) { + return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002') + .replace(/\\\./g, '\u0001') + .split(/\./).map(function (part) { + return part.replace(/\1/g, '\\.') + .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001') + }) +} + +function decode (str) { + var out = {} + var p = out + var section = null + // section |key = value + var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i + var lines = str.split(/[\r\n]+/g) + + lines.forEach(function (line, _, __) { + if (!line || line.match(/^\s*[;#]/)) return + var match = line.match(re) + if (!match) return + if (match[1] !== undefined) { + section = unsafe(match[1]) + p = out[section] = out[section] || {} + return + } + var key = unsafe(match[2]) + var value = match[3] ? unsafe(match[4]) : true + switch (value) { + case 'true': + case 'false': + case 'null': value = JSON.parse(value) + } + + // Convert keys with '[]' suffix to an array + if (key.length > 2 && key.slice(-2) === '[]') { + key = key.substring(0, key.length - 2) + if (!p[key]) { + p[key] = [] + } else if (!Array.isArray(p[key])) { + p[key] = [p[key]] + } + } + + // safeguard against resetting a previously defined + // array by accidentally forgetting the brackets + if (Array.isArray(p[key])) { + p[key].push(value) + } else { + p[key] = value + } + }) + + // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}} + // use a filter to return the keys that have to be deleted. + Object.keys(out).filter(function (k, _, __) { + if (!out[k] || + typeof out[k] !== 'object' || + Array.isArray(out[k])) { + return false + } + // see if the parent section is also an object. + // if so, add it to that, and mark this one for deletion + var parts = dotSplit(k) + var p = out + var l = parts.pop() + var nl = l.replace(/\\\./g, '.') + parts.forEach(function (part, _, __) { + if (!p[part] || typeof p[part] !== 'object') p[part] = {} + p = p[part] + }) + if (p === out && nl === l) { + return false + } + p[nl] = out[k] + return true + }).forEach(function (del, _, __) { + delete out[del] + }) + + return out +} + +function isQuoted (val) { + return (val.charAt(0) === '"' && val.slice(-1) === '"') || + (val.charAt(0) === "'" && val.slice(-1) === "'") +} + +function safe (val) { + return (typeof val !== 'string' || + val.match(/[=\r\n]/) || + val.match(/^\[/) || + (val.length > 1 && + isQuoted(val)) || + val !== val.trim()) + ? JSON.stringify(val) + : val.replace(/;/g, '\\;').replace(/#/g, '\\#') +} + +function unsafe (val, doUnesc) { + val = (val || '').trim() + if (isQuoted(val)) { + // remove the single quotes before calling JSON.parse + if (val.charAt(0) === "'") { + val = val.substr(1, val.length - 2) + } + try { val = JSON.parse(val) } catch (_) {} + } else { + // walk the val to find the first not-escaped ; character + var esc = false + var unesc = '' + for (var i = 0, l = val.length; i < l; i++) { + var c = val.charAt(i) + if (esc) { + if ('\\;#'.indexOf(c) !== -1) { + unesc += c + } else { + unesc += '\\' + c + } + esc = false + } else if (';#'.indexOf(c) !== -1) { + break + } else if (c === '\\') { + esc = true + } else { + unesc += c + } + } + if (esc) { + unesc += '\\' + } + return unesc.trim() + } + return val +} diff --git a/legacy-libs/grpc/node_modules/ini/package.json b/legacy-libs/grpc/node_modules/ini/package.json new file mode 100644 index 0000000..541a101 --- /dev/null +++ b/legacy-libs/grpc/node_modules/ini/package.json @@ -0,0 +1,70 @@ +{ + "_args": [ + [ + "ini@1.3.5", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "ini@1.3.5", + "_id": "ini@1.3.5", + "_inBundle": false, + "_integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "_location": "/grpc/ini", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ini@1.3.5", + "name": "ini", + "escapedName": "ini", + "rawSpec": "1.3.5", + "saveSpec": null, + "fetchSpec": "1.3.5" + }, + "_requiredBy": [ + "/grpc/rc" + ], + "_resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "_shrinkwrap": null, + "_spec": "1.3.5", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/ini/issues" + }, + "dependencies": {}, + "description": "An ini encoder/decoder for node", + "devDependencies": { + "standard": "^10.0.3", + "tap": "^10.7.3 || 11" + }, + "engines": { + "node": "*" + }, + "files": [ + "ini.js" + ], + "homepage": "https://github.com/isaacs/ini#readme", + "license": "ISC", + "main": "ini.js", + "name": "ini", + "optionalDependencies": {}, + "readme": "An ini format parser and serializer for node.\n\nSections are treated as nested objects. Items before the first\nheading are saved on the object directly.\n\n## Usage\n\nConsider an ini-file `config.ini` that looks like this:\n\n ; this comment is being ignored\n scope = global\n\n [database]\n user = dbuser\n password = dbpassword\n database = use_this_database\n\n [paths.default]\n datadir = /var/lib/data\n array[] = first value\n array[] = second value\n array[] = third value\n\nYou can read, manipulate and write the ini-file like so:\n\n var fs = require('fs')\n , ini = require('ini')\n\n var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8'))\n\n config.scope = 'local'\n config.database.database = 'use_another_database'\n config.paths.default.tmpdir = '/tmp'\n delete config.paths.default.datadir\n config.paths.default.array.push('fourth value')\n\n fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' }))\n\nThis will result in a file called `config_modified.ini` being written\nto the filesystem with the following content:\n\n [section]\n scope=local\n [section.database]\n user=dbuser\n password=dbpassword\n database=use_another_database\n [section.paths.default]\n tmpdir=/tmp\n array[]=first value\n array[]=second value\n array[]=third value\n array[]=fourth value\n\n\n## API\n\n### decode(inistring)\n\nDecode the ini-style formatted `inistring` into a nested object.\n\n### parse(inistring)\n\nAlias for `decode(inistring)`\n\n### encode(object, [options])\n\nEncode the object `object` into an ini-style formatted string. If the\noptional parameter `section` is given, then all top-level properties\nof the object are put into this section and the `section`-string is\nprepended to all sub-sections, see the usage example above.\n\nThe `options` object may contain the following:\n\n* `section` A string which will be the first `section` in the encoded\n ini data. Defaults to none.\n* `whitespace` Boolean to specify whether to put whitespace around the\n `=` character. By default, whitespace is omitted, to be friendly to\n some persnickety old parsers that don't tolerate it well. But some\n find that it's more human-readable and pretty with the whitespace.\n\nFor backwards compatibility reasons, if a `string` options is passed\nin, then it is assumed to be the `section` value.\n\n### stringify(object, [options])\n\nAlias for `encode(object, [options])`\n\n### safe(val)\n\nEscapes the string `val` such that it is safe to be used as a key or\nvalue in an ini-file. Basically escapes quotes. For example\n\n ini.safe('\"unsafe string\"')\n\nwould result in\n\n \"\\\"unsafe string\\\"\"\n\n### unsafe(val)\n\nUnescapes the string `val`\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/ini.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "pretest": "standard ini.js", + "preversion": "npm test", + "test": "tap test/*.js --100 -J" + }, + "version": "1.3.5" +} diff --git a/legacy-libs/grpc/node_modules/is-fullwidth-code-point/index.js b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/index.js new file mode 100644 index 0000000..a7d3e38 --- /dev/null +++ b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/index.js @@ -0,0 +1,46 @@ +'use strict'; +var numberIsNan = require('number-is-nan'); + +module.exports = function (x) { + if (numberIsNan(x)) { + return false; + } + + // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369 + + // code points are derived from: + // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt + if (x >= 0x1100 && ( + x <= 0x115f || // Hangul Jamo + 0x2329 === x || // LEFT-POINTING ANGLE BRACKET + 0x232a === x || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + 0x3250 <= x && x <= 0x4dbf || + // CJK Unified Ideographs .. Yi Radicals + 0x4e00 <= x && x <= 0xa4c6 || + // Hangul Jamo Extended-A + 0xa960 <= x && x <= 0xa97c || + // Hangul Syllables + 0xac00 <= x && x <= 0xd7a3 || + // CJK Compatibility Ideographs + 0xf900 <= x && x <= 0xfaff || + // Vertical Forms + 0xfe10 <= x && x <= 0xfe19 || + // CJK Compatibility Forms .. Small Form Variants + 0xfe30 <= x && x <= 0xfe6b || + // Halfwidth and Fullwidth Forms + 0xff01 <= x && x <= 0xff60 || + 0xffe0 <= x && x <= 0xffe6 || + // Kana Supplement + 0x1b000 <= x && x <= 0x1b001 || + // Enclosed Ideographic Supplement + 0x1f200 <= x && x <= 0x1f251 || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + 0x20000 <= x && x <= 0x3fffd)) { + return true; + } + + return false; +} diff --git a/legacy-libs/grpc/node_modules/is-fullwidth-code-point/license b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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/legacy-libs/grpc/node_modules/is-fullwidth-code-point/package.json b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/package.json new file mode 100644 index 0000000..fe46afc --- /dev/null +++ b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/package.json @@ -0,0 +1,84 @@ +{ + "_args": [ + [ + "is-fullwidth-code-point@1.0.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "is-fullwidth-code-point@1.0.0", + "_id": "is-fullwidth-code-point@1.0.0", + "_inBundle": false, + "_integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "_location": "/grpc/is-fullwidth-code-point", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "is-fullwidth-code-point@1.0.0", + "name": "is-fullwidth-code-point", + "escapedName": "is-fullwidth-code-point", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/grpc/string-width" + ], + "_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "_shrinkwrap": null, + "_spec": "1.0.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues" + }, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "description": "Check if the character represented by a given Unicode code point is fullwidth", + "devDependencies": { + "ava": "0.0.4", + "code-point-at": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme", + "keywords": [ + "fullwidth", + "full-width", + "full", + "width", + "unicode", + "character", + "char", + "string", + "str", + "codepoint", + "code", + "point", + "is", + "detect", + "check" + ], + "license": "MIT", + "name": "is-fullwidth-code-point", + "optionalDependencies": {}, + "readme": "# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point)\n\n> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms)\n\n\n## Install\n\n```\n$ npm install --save is-fullwidth-code-point\n```\n\n\n## Usage\n\n```js\nvar isFullwidthCodePoint = require('is-fullwidth-code-point');\n\nisFullwidthCodePoint('谢'.codePointAt());\n//=> true\n\nisFullwidthCodePoint('a'.codePointAt());\n//=> false\n```\n\n\n## API\n\n### isFullwidthCodePoint(input)\n\n#### input\n\nType: `number`\n\n[Code point](https://en.wikipedia.org/wiki/Code_point) of a character.\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.0.0" +} diff --git a/legacy-libs/grpc/node_modules/is-fullwidth-code-point/readme.md b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/readme.md new file mode 100644 index 0000000..4936464 --- /dev/null +++ b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/readme.md @@ -0,0 +1,39 @@ +# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) + +> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) + + +## Install + +``` +$ npm install --save is-fullwidth-code-point +``` + + +## Usage + +```js +var isFullwidthCodePoint = require('is-fullwidth-code-point'); + +isFullwidthCodePoint('谢'.codePointAt()); +//=> true + +isFullwidthCodePoint('a'.codePointAt()); +//=> false +``` + + +## API + +### isFullwidthCodePoint(input) + +#### input + +Type: `number` + +[Code point](https://en.wikipedia.org/wiki/Code_point) of a character. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/legacy-libs/grpc/node_modules/isarray/Makefile b/legacy-libs/grpc/node_modules/isarray/Makefile new file mode 100644 index 0000000..787d56e --- /dev/null +++ b/legacy-libs/grpc/node_modules/isarray/Makefile @@ -0,0 +1,6 @@ + +test: + @node_modules/.bin/tape test.js + +.PHONY: test + diff --git a/legacy-libs/grpc/node_modules/isarray/README.md b/legacy-libs/grpc/node_modules/isarray/README.md new file mode 100644 index 0000000..16d2c59 --- /dev/null +++ b/legacy-libs/grpc/node_modules/isarray/README.md @@ -0,0 +1,60 @@ + +# isarray + +`Array#isArray` for older browsers. + +[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray) +[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray) + +[![browser support](https://ci.testling.com/juliangruber/isarray.png) +](https://ci.testling.com/juliangruber/isarray) + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](http://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/browserify). + +With [component](http://component.io) do + +```bash +$ component install juliangruber/isarray +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/legacy-libs/grpc/node_modules/isarray/component.json b/legacy-libs/grpc/node_modules/isarray/component.json new file mode 100644 index 0000000..9e31b68 --- /dev/null +++ b/legacy-libs/grpc/node_modules/isarray/component.json @@ -0,0 +1,19 @@ +{ + "name" : "isarray", + "description" : "Array#isArray for older browsers", + "version" : "0.0.1", + "repository" : "juliangruber/isarray", + "homepage": "https://github.com/juliangruber/isarray", + "main" : "index.js", + "scripts" : [ + "index.js" + ], + "dependencies" : {}, + "keywords": ["browser","isarray","array"], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT" +} diff --git a/legacy-libs/grpc/node_modules/isarray/index.js b/legacy-libs/grpc/node_modules/isarray/index.js new file mode 100644 index 0000000..a57f634 --- /dev/null +++ b/legacy-libs/grpc/node_modules/isarray/index.js @@ -0,0 +1,5 @@ +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; diff --git a/legacy-libs/grpc/node_modules/isarray/package.json b/legacy-libs/grpc/node_modules/isarray/package.json new file mode 100644 index 0000000..387fb1c --- /dev/null +++ b/legacy-libs/grpc/node_modules/isarray/package.json @@ -0,0 +1,80 @@ +{ + "_args": [ + [ + "isarray@1.0.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "isarray@1.0.0", + "_id": "isarray@1.0.0", + "_inBundle": false, + "_integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "_location": "/grpc/isarray", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "isarray@1.0.0", + "name": "isarray", + "escapedName": "isarray", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/grpc/readable-stream" + ], + "_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "_shrinkwrap": null, + "_spec": "1.0.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/isarray/issues" + }, + "dependencies": {}, + "description": "Array#isArray for older browsers", + "devDependencies": { + "tape": "~2.13.4" + }, + "homepage": "https://github.com/juliangruber/isarray", + "keywords": [ + "browser", + "isarray", + "array" + ], + "license": "MIT", + "main": "index.js", + "name": "isarray", + "optionalDependencies": {}, + "readme": "\n# isarray\n\n`Array#isArray` for older browsers.\n\n[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray)\n[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray)\n\n[![browser support](https://ci.testling.com/juliangruber/isarray.png)\n](https://ci.testling.com/juliangruber/isarray)\n\n## Usage\n\n```js\nvar isArray = require('isarray');\n\nconsole.log(isArray([])); // => true\nconsole.log(isArray({})); // => false\n```\n\n## Installation\n\nWith [npm](http://npmjs.org) do\n\n```bash\n$ npm install isarray\n```\n\nThen bundle for the browser with\n[browserify](https://github.com/substack/browserify).\n\nWith [component](http://component.io) do\n\n```bash\n$ component install juliangruber/isarray\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber <julian@juliangruber.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "scripts": { + "test": "tape test.js" + }, + "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": "1.0.0" +} diff --git a/legacy-libs/grpc/node_modules/isarray/test.js b/legacy-libs/grpc/node_modules/isarray/test.js new file mode 100644 index 0000000..e0c3444 --- /dev/null +++ b/legacy-libs/grpc/node_modules/isarray/test.js @@ -0,0 +1,20 @@ +var isArray = require('./'); +var test = require('tape'); + +test('is array', function(t){ + t.ok(isArray([])); + t.notOk(isArray({})); + t.notOk(isArray(null)); + t.notOk(isArray(false)); + + var obj = {}; + obj[0] = true; + t.notOk(isArray(obj)); + + var arr = []; + arr.foo = 'bar'; + t.ok(isArray(arr)); + + t.end(); +}); + diff --git a/legacy-libs/grpc/node_modules/minimatch/LICENSE b/legacy-libs/grpc/node_modules/minimatch/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/minimatch/README.md b/legacy-libs/grpc/node_modules/minimatch/README.md new file mode 100644 index 0000000..ad72b81 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimatch/README.md @@ -0,0 +1,209 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.svg)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/legacy-libs/grpc/node_modules/minimatch/minimatch.js b/legacy-libs/grpc/node_modules/minimatch/minimatch.js new file mode 100644 index 0000000..5b5f8cf --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimatch/minimatch.js @@ -0,0 +1,923 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = require('path') +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError('pattern is too long') + } + + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] + + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) + + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/legacy-libs/grpc/node_modules/minimatch/package.json b/legacy-libs/grpc/node_modules/minimatch/package.json new file mode 100644 index 0000000..ebfbfc8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimatch/package.json @@ -0,0 +1,71 @@ +{ + "_args": [ + [ + "minimatch@3.0.4", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "minimatch@3.0.4", + "_id": "minimatch@3.0.4", + "_inBundle": false, + "_integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "_location": "/grpc/minimatch", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "minimatch@3.0.4", + "name": "minimatch", + "escapedName": "minimatch", + "rawSpec": "3.0.4", + "saveSpec": null, + "fetchSpec": "3.0.4" + }, + "_requiredBy": [ + "/grpc/ignore-walk", + "/grpc/rimraf/glob" + ], + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "_shrinkwrap": null, + "_spec": "3.0.4", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "bugs": { + "url": "https://github.com/isaacs/minimatch/issues" + }, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "description": "a glob matcher in javascript", + "devDependencies": { + "tap": "^10.3.2" + }, + "engines": { + "node": "*" + }, + "files": [ + "minimatch.js" + ], + "homepage": "https://github.com/isaacs/minimatch#readme", + "license": "ISC", + "main": "minimatch.js", + "name": "minimatch", + "optionalDependencies": {}, + "readme": "# minimatch\n\nA minimal matching utility.\n\n[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.svg)](http://travis-ci.org/isaacs/minimatch)\n\n\nThis is the matching library used internally by npm.\n\nIt works by converting glob expressions into JavaScript `RegExp`\nobjects.\n\n## Usage\n\n```javascript\nvar minimatch = require(\"minimatch\")\n\nminimatch(\"bar.foo\", \"*.foo\") // true!\nminimatch(\"bar.foo\", \"*.bar\") // false!\nminimatch(\"bar.foo\", \"*.+(bar|foo)\", { debug: true }) // true, and noisy!\n```\n\n## Features\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n\n## Minimatch Class\n\nCreate a minimatch object by instantiating the `minimatch.Minimatch` class.\n\n```javascript\nvar Minimatch = require(\"minimatch\").Minimatch\nvar mm = new Minimatch(pattern, options)\n```\n\n### Properties\n\n* `pattern` The original pattern the minimatch object represents.\n* `options` The options supplied to the constructor.\n* `set` A 2-dimensional array of regexp or string expressions.\n Each row in the\n array corresponds to a brace-expanded pattern. Each item in the row\n corresponds to a single path-part. For example, the pattern\n `{a,b/c}/d` would expand to a set of patterns like:\n\n [ [ a, d ]\n , [ b, c, d ] ]\n\n If a portion of the pattern doesn't have any \"magic\" in it\n (that is, it's something like `\"foo\"` rather than `fo*o?`), then it\n will be left as a string rather than converted to a regular\n expression.\n\n* `regexp` Created by the `makeRe` method. A single regular expression\n expressing the entire pattern. This is useful in cases where you wish\n to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.\n* `negate` True if the pattern is negated.\n* `comment` True if the pattern is a comment.\n* `empty` True if the pattern is `\"\"`.\n\n### Methods\n\n* `makeRe` Generate the `regexp` member if necessary, and return it.\n Will return `false` if the pattern is invalid.\n* `match(fname)` Return true if the filename matches the pattern, or\n false otherwise.\n* `matchOne(fileArray, patternArray, partial)` Take a `/`-split\n filename, and match it against a single row in the `regExpSet`. This\n method is mainly for internal use, but is exposed so that it can be\n used by a glob-walker that needs to avoid excessive filesystem calls.\n\nAll other methods are internal, and will be called as necessary.\n\n### minimatch(path, pattern, options)\n\nMain export. Tests a path against the pattern using the options.\n\n```javascript\nvar isJS = minimatch(file, \"*.js\", { matchBase: true })\n```\n\n### minimatch.filter(pattern, options)\n\nReturns a function that tests its\nsupplied argument, suitable for use with `Array.filter`. Example:\n\n```javascript\nvar javascripts = fileList.filter(minimatch.filter(\"*.js\", {matchBase: true}))\n```\n\n### minimatch.match(list, pattern, options)\n\nMatch against the list of\nfiles, in the style of fnmatch or glob. If nothing is matched, and\noptions.nonull is set, then return a list containing the pattern itself.\n\n```javascript\nvar javascripts = minimatch.match(fileList, \"*.js\", {matchBase: true}))\n```\n\n### minimatch.makeRe(pattern, options)\n\nMake a regular expression object from the pattern.\n\n## Options\n\nAll options are `false` by default.\n\n### debug\n\nDump a ton of stuff to stderr.\n\n### nobrace\n\nDo not expand `{a,b}` and `{1..3}` brace sets.\n\n### noglobstar\n\nDisable `**` matching against multiple folder names.\n\n### dot\n\nAllow patterns to match filenames starting with a period, even if\nthe pattern does not explicitly have a period in that spot.\n\nNote that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`\nis set.\n\n### noext\n\nDisable \"extglob\" style patterns like `+(a|b)`.\n\n### nocase\n\nPerform a case-insensitive match.\n\n### nonull\n\nWhen a match is not found by `minimatch.match`, return a list containing\nthe pattern itself if this option is set. When not set, an empty list\nis returned if there are no matches.\n\n### matchBase\n\nIf set, then patterns without slashes will be matched\nagainst the basename of the path if it contains slashes. For example,\n`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.\n\n### nocomment\n\nSuppress the behavior of treating `#` at the start of a pattern as a\ncomment.\n\n### nonegate\n\nSuppress the behavior of treating a leading `!` character as negation.\n\n### flipNegate\n\nReturns from negate expressions the same as if they were not negated.\n(Ie, true on a hit, false on a miss.)\n\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between minimatch and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not.\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen minimatch.match returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`minimatch.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --cov" + }, + "version": "3.0.4" +} diff --git a/legacy-libs/grpc/node_modules/minimist/LICENSE b/legacy-libs/grpc/node_modules/minimist/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +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/legacy-libs/grpc/node_modules/minimist/example/parse.js b/legacy-libs/grpc/node_modules/minimist/example/parse.js new file mode 100644 index 0000000..abff3e8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/example/parse.js @@ -0,0 +1,2 @@ +var argv = require('../')(process.argv.slice(2)); +console.dir(argv); diff --git a/legacy-libs/grpc/node_modules/minimist/index.js b/legacy-libs/grpc/node_modules/minimist/index.js new file mode 100644 index 0000000..6a0559d --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/index.js @@ -0,0 +1,236 @@ +module.exports = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {}, unknownFn: null }; + + if (typeof opts['unknown'] === 'function') { + flags.unknownFn = opts['unknown']; + } + + if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { + flags.allBools = true; + } else { + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } + + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + flags.strings[aliases[key]] = true; + } + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function argDefined(key, arg) { + return (flags.allBools && /^--[^=]+$/.test(arg)) || + flags.strings[key] || flags.bools[key] || aliases[key]; + } + + function setArg (key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) return; + } + + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + function setKey (obj, keys, value) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + if (o[key] === undefined) o[key] = {}; + o = o[key]; + }); + + var key = keys[keys.length - 1]; + if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { + o[key] = value; + } + else if (Array.isArray(o[key])) { + o[key].push(value); + } + else { + o[key] = [ o[key], value ]; + } + } + + function aliasIsBoolean(key) { + return aliases[key].some(function (x) { + return flags.bools[x]; + }); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + var key = m[1]; + var value = m[2]; + if (flags.bools[key]) { + value = value !== 'false'; + } + setArg(key, value, arg); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !aliasIsBoolean(key) : true)) { + setArg(key, next, arg); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next, arg) + continue; + } + + if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { + setArg(letters[j], next.split('=')[1], arg); + broken = true; + break; + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next, arg); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2), arg); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !aliasIsBoolean(key) : true)) { + setArg(key, args[i+1], arg); + i++; + } + else if (args[i+1] && /true|false/.test(args[i+1])) { + setArg(key, args[i+1] === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + } + else { + if (!flags.unknownFn || flags.unknownFn(arg) !== false) { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + if (opts.stopEarly) { + argv._.push.apply(argv._, args.slice(i + 1)); + break; + } + } + } + + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); + + if (opts['--']) { + argv['--'] = new Array(); + notFlags.forEach(function(key) { + argv['--'].push(key); + }); + } + else { + notFlags.forEach(function(key) { + argv._.push(key); + }); + } + + return argv; +}; + +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function isNumber (x) { + if (typeof x === 'number') return true; + if (/^0x[0-9a-f]+$/i.test(x)) return true; + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); +} + diff --git a/legacy-libs/grpc/node_modules/minimist/package.json b/legacy-libs/grpc/node_modules/minimist/package.json new file mode 100644 index 0000000..4daddce --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/package.json @@ -0,0 +1,81 @@ +{ + "_args": [ + [ + "minimist@1.2.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "minimist@1.2.0", + "_id": "minimist@1.2.0", + "_inBundle": false, + "_integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "_location": "/grpc/minimist", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "minimist@1.2.0", + "name": "minimist", + "escapedName": "minimist", + "rawSpec": "1.2.0", + "saveSpec": null, + "fetchSpec": "1.2.0" + }, + "_requiredBy": [ + "/grpc/rc" + ], + "_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "_shrinkwrap": null, + "_spec": "1.2.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/minimist/issues" + }, + "dependencies": {}, + "description": "parse argument options", + "devDependencies": { + "covert": "^1.0.0", + "tap": "~0.4.0", + "tape": "^3.5.0" + }, + "homepage": "https://github.com/substack/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "license": "MIT", + "main": "index.js", + "name": "minimist", + "optionalDependencies": {}, + "readme": "# minimist\n\nparse argument options\n\nThis module is the guts of optimist's argument parser without all the\nfanciful decoration.\n\n[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)\n\n[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)\n\n# example\n\n``` js\nvar argv = require('minimist')(process.argv.slice(2));\nconsole.dir(argv);\n```\n\n```\n$ node example/parse.js -a beep -b boop\n{ _: [], a: 'beep', b: 'boop' }\n```\n\n```\n$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz\n{ _: [ 'foo', 'bar', 'baz' ],\n x: 3,\n y: 4,\n n: 5,\n a: true,\n b: true,\n c: true,\n beep: 'boop' }\n```\n\n# methods\n\n``` js\nvar parseArgs = require('minimist')\n```\n\n## var argv = parseArgs(args, opts={})\n\nReturn an argument object `argv` populated with the array arguments from `args`.\n\n`argv._` contains all the arguments that didn't have an option associated with\nthem.\n\nNumeric-looking arguments will be returned as numbers unless `opts.string` or\n`opts.boolean` is set for that argument name.\n\nAny arguments after `'--'` will not be parsed and will end up in `argv._`.\n\noptions can be:\n\n* `opts.string` - a string or array of strings argument names to always treat as\nstrings\n* `opts.boolean` - a boolean, string or array of strings to always treat as\nbooleans. if `true` will treat all double hyphenated arguments without equal signs\nas boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)\n* `opts.alias` - an object mapping string names to strings or arrays of string\nargument names to use as aliases\n* `opts.default` - an object mapping string argument names to default values\n* `opts.stopEarly` - when true, populate `argv._` with everything after the\nfirst non-option\n* `opts['--']` - when true, populate `argv._` with everything before the `--`\nand `argv['--']` with everything after the `--`. Here's an example:\n* `opts.unknown` - a function which is invoked with a command line parameter not\ndefined in the `opts` configuration object. If the function returns `false`, the\nunknown option is not added to `argv`.\n\n```\n> require('./')('one two three -- four five --six'.split(' '), { '--': true })\n{ _: [ 'one', 'two', 'three' ],\n '--': [ 'four', 'five', '--six' ] }\n```\n\nNote that with `opts['--']` set, parsing for arguments still stops after the\n`--`.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install minimist\n```\n\n# license\n\nMIT\n", + "readmeFilename": "readme.markdown", + "repository": { + "type": "git", + "url": "git://github.com/substack/minimist.git" + }, + "scripts": { + "coverage": "covert test/*.js", + "test": "tap test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "version": "1.2.0" +} diff --git a/legacy-libs/grpc/node_modules/minimist/readme.markdown b/legacy-libs/grpc/node_modules/minimist/readme.markdown new file mode 100644 index 0000000..30a74cf --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/readme.markdown @@ -0,0 +1,91 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist) + +[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist) + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.dir(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a boolean, string or array of strings to always treat as +booleans. if `true` will treat all double hyphenated arguments without equal signs +as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values +* `opts.stopEarly` - when true, populate `argv._` with everything after the +first non-option +* `opts['--']` - when true, populate `argv._` with everything before the `--` +and `argv['--']` with everything after the `--`. Here's an example: +* `opts.unknown` - a function which is invoked with a command line parameter not +defined in the `opts` configuration object. If the function returns `false`, the +unknown option is not added to `argv`. + +``` +> require('./')('one two three -- four five --six'.split(' '), { '--': true }) +{ _: [ 'one', 'two', 'three' ], + '--': [ 'four', 'five', '--six' ] } +``` + +Note that with `opts['--']` set, parsing for arguments still stops after the +`--`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/legacy-libs/grpc/node_modules/minimist/test/all_bool.js b/legacy-libs/grpc/node_modules/minimist/test/all_bool.js new file mode 100644 index 0000000..ac83548 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/all_bool.js @@ -0,0 +1,32 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean true (default all --args to boolean)', function (t) { + var argv = parse(['moo', '--honk', 'cow'], { + boolean: true + }); + + t.deepEqual(argv, { + honk: true, + _: ['moo', 'cow'] + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); + +test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { + var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { + boolean: true + }); + + t.deepEqual(argv, { + honk: true, + tacos: 'good', + p: 55, + _: ['moo', 'cow'] + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/bool.js b/legacy-libs/grpc/node_modules/minimist/test/bool.js new file mode 100644 index 0000000..14b0717 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/bool.js @@ -0,0 +1,166 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false } + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { + boolean: ['x','y','z'] + }); + + t.deepEqual(argv, { + x : true, + y : false, + z : true, + _ : [ 'one', 'two', 'three' ] + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); +test('boolean and alias with chainable api', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + alias: { 'h': 'herp' }, + boolean: 'herp' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias array with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var alt = [ '--harp', 'derp' ]; + var opts = { + alias: { 'h': ['herp', 'harp'] }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var altPropertyArgv = parse(alt, opts); + var expected = { + harp: true, + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.same(altPropertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = [ '-h', 'true' ]; + var regular = [ '--herp', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function(t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); + +test('boolean --boool=true', function (t) { + var parsed = parse(['--boool=true'], { + default: { + boool: false + }, + boolean: ['boool'] + }); + + t.same(parsed.boool, true); + t.end(); +}); + +test('boolean --boool=false', function (t) { + var parsed = parse(['--boool=false'], { + default: { + boool: true + }, + boolean: ['boool'] + }); + + t.same(parsed.boool, false); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/dash.js b/legacy-libs/grpc/node_modules/minimist/test/dash.js new file mode 100644 index 0000000..5a4fa5b --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/dash.js @@ -0,0 +1,31 @@ +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(5); + t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); + t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); + t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); + t.deepEqual( + parse([ '-b', '-' ], { boolean: 'b' }), + { b: true, _: [ '-' ] } + ); + t.deepEqual( + parse([ '-s', '-' ], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(3); + t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); +}); + +test('move arguments after the -- into their own `--` array', function(t) { + t.plan(1); + t.deepEqual( + parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }), + { name: 'John', _: [ 'before' ], '--': [ 'after' ] }); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/default_bool.js b/legacy-libs/grpc/node_modules/minimist/test/default_bool.js new file mode 100644 index 0000000..780a311 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/default_bool.js @@ -0,0 +1,35 @@ +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true } + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false } + }); + t.equal(argv.somefalse, false); + t.end(); +}); + +test('boolean default to null', function (t) { + var argv = parse([], { + boolean: 'maybe', + default: { maybe: null } + }); + t.equal(argv.maybe, null); + var argv = parse(['--maybe'], { + boolean: 'maybe', + default: { maybe: null } + }); + t.equal(argv.maybe, true); + t.end(); + +}) diff --git a/legacy-libs/grpc/node_modules/minimist/test/dotted.js b/legacy-libs/grpc/node_modules/minimist/test/dotted.js new file mode 100644 index 0000000..d8b3e85 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/dotted.js @@ -0,0 +1,22 @@ +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); + +test('dotted default with no alias', function (t) { + var argv = parse('', {default: {'a.b': 11}}); + t.equal(argv.a.b, 11); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/kv_short.js b/legacy-libs/grpc/node_modules/minimist/test/kv_short.js new file mode 100644 index 0000000..f813b30 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/kv_short.js @@ -0,0 +1,16 @@ +var parse = require('../'); +var test = require('tape'); + +test('short -k=v' , function (t) { + t.plan(1); + + var argv = parse([ '-b=123' ]); + t.deepEqual(argv, { b: 123, _: [] }); +}); + +test('multi short -k=v' , function (t) { + t.plan(1); + + var argv = parse([ '-a=whatever', '-b=robots' ]); + t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] }); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/long.js b/legacy-libs/grpc/node_modules/minimist/test/long.js new file mode 100644 index 0000000..5d3a1e0 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/long.js @@ -0,0 +1,31 @@ +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse([ '--bool' ]), + { bool : true, _ : [] }, + 'long boolean' + ); + t.deepEqual( + parse([ '--pow', 'xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture sp' + ); + t.deepEqual( + parse([ '--pow=xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture eq' + ); + t.deepEqual( + parse([ '--host', 'localhost', '--port', '555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures sp' + ); + t.deepEqual( + parse([ '--host=localhost', '--port=555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/num.js b/legacy-libs/grpc/node_modules/minimist/test/num.js new file mode 100644 index 0000000..2cc77f4 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/num.js @@ -0,0 +1,36 @@ +var parse = require('../'); +var test = require('tape'); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789' + ]); + t.deepEqual(argv, { + x : 1234, + y : 5.67, + z : 1e7, + w : '10f', + hex : 0xdeadbeef, + _ : [ 789 ] + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('already a number', function (t) { + var argv = parse([ '-x', 1234, 789 ]); + t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/parse.js b/legacy-libs/grpc/node_modules/minimist/test/parse.js new file mode 100644 index 0000000..7b4a2a1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/parse.js @@ -0,0 +1,197 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse([ '--no-moo' ]), + { moo : false, _ : [] }, + 'no' + ); + t.deepEqual( + parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), + { v : ['a','b','c'], _ : [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek' + ]), + { + c : true, + a : true, + t : true, + s : 'woo', + h : 'awesome', + b : true, + bool : true, + key : 'value', + multi : [ 'quux', 'baz' ], + meep : false, + name : 'meowmers', + _ : [ 'bare', '--not-a-flag', 'eek' ] + } + ); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse([ '-t', 'moo' ], { boolean: 't' }); + t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: [ 't', 'verbose' ], + default: { verbose: true } + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('newlines in params' , function (t) { + var args = parse([ '-s', "X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse([ "--s=X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + t.end(); +}); + +test('strings' , function (t) { + var s = parse([ '-s', '0001234' ], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse([ '-x', '56' ], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([ ' ', ' ' ], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function(t) { + var s = parse([ '-s' ], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse([ '--str' ], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse([ '-art' ], { + string: [ 'a', 't' ] + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + + +test('string and alias', function(t) { + var x = parse([ '--str', '000123' ], { + string: 's', + alias: { s: 'str' } + }); + + t.equal(x.str, '000123'); + t.equal(typeof x.str, 'string'); + t.equal(x.s, '000123'); + t.equal(typeof x.s, 'string'); + + var y = parse([ '-s', '000123' ], { + string: 'str', + alias: { str: 's' } + }); + + t.equal(y.str, '000123'); + t.equal(typeof y.str, 'string'); + t.equal(y.s, '000123'); + t.equal(typeof y.s, 'string'); + t.end(); +}); + +test('slashBreak', function (t) { + t.same( + parse([ '-I/foo/bar/baz' ]), + { I : '/foo/bar/baz', _ : [] } + ); + t.same( + parse([ '-xyz/foo/bar/baz' ]), + { x : true, y : true, z : '/foo/bar/baz', _ : [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: 'zoom' } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: [ 'zm', 'zoom' ] } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop' + ]); + + t.same(argv.foo, { + bar : 3, + baz : 4, + quux : { + quibble : 5, + o_O : true + } + }); + t.same(argv.beep, { boop : true }); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/parse_modified.js b/legacy-libs/grpc/node_modules/minimist/test/parse_modified.js new file mode 100644 index 0000000..ab620dc --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,9 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions' , function (t) { + t.plan(1); + + var argv = parse([ '-b', '123' ], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: [123] }); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/short.js b/legacy-libs/grpc/node_modules/minimist/test/short.js new file mode 100644 index 0000000..d513a1c --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/short.js @@ -0,0 +1,67 @@ +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); + t.deepEqual( + parse([ '-123', '456' ]), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse([ '-b' ]), + { b : true, _ : [] }, + 'short boolean' + ); + t.deepEqual( + parse([ 'foo', 'bar', 'baz' ]), + { _ : [ 'foo', 'bar', 'baz' ] }, + 'bare' + ); + t.deepEqual( + parse([ '-cats' ]), + { c : true, a : true, t : true, s : true, _ : [] }, + 'group' + ); + t.deepEqual( + parse([ '-cats', 'meow' ]), + { c : true, a : true, t : true, s : 'meow', _ : [] }, + 'short group next' + ); + t.deepEqual( + parse([ '-h', 'localhost' ]), + { h : 'localhost', _ : [] }, + 'short capture' + ); + t.deepEqual( + parse([ '-h', 'localhost', '-p', '555' ]), + { h : 'localhost', p : 555, _ : [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/stop_early.js b/legacy-libs/grpc/node_modules/minimist/test/stop_early.js new file mode 100644 index 0000000..bdf9fbc --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/stop_early.js @@ -0,0 +1,15 @@ +var parse = require('../'); +var test = require('tape'); + +test('stops parsing on the first non-option when stopEarly is set', function (t) { + var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { + stopEarly: true + }); + + t.deepEqual(argv, { + aaa: 'bbb', + _: ['ccc', '--ddd'] + }); + + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/unknown.js b/legacy-libs/grpc/node_modules/minimist/test/unknown.js new file mode 100644 index 0000000..462a36b --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/unknown.js @@ -0,0 +1,102 @@ +var parse = require('../'); +var test = require('tape'); + +test('boolean and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'true', '--derp', 'true' ]; + var regular = [ '--herp', 'true', '-d', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('flag boolean true any double hyphen argument is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { + boolean: true, + unknown: unknownFn + }); + t.same(unknown, ['--tacos=good', 'cow', '-p']); + t.same(argv, { + honk: true, + _: [] + }); + t.end(); +}); + +test('string and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'hello', '--derp', 'goodbye' ]; + var regular = [ '--herp', 'hello', '-d', 'moon' ]; + var opts = { + alias: { h: 'herp' }, + string: 'h', + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('default and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'hello' ]; + var regular = [ '--herp', 'hello' ]; + var opts = { + default: { 'h': 'bar' }, + alias: { 'h': 'herp' }, + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, []); + t.end(); + unknownFn(); // exercise fn for 100% coverage +}); + +test('value following -- is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '--bad', '--', 'good', 'arg' ]; + var opts = { + '--': true, + unknown: unknownFn + }; + var argv = parse(aliased, opts); + + t.same(unknown, ['--bad']); + t.same(argv, { + '--': ['good', 'arg'], + '_': [] + }) + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/minimist/test/whitespace.js b/legacy-libs/grpc/node_modules/minimist/test/whitespace.js new file mode 100644 index 0000000..8a52a58 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minimist/test/whitespace.js @@ -0,0 +1,8 @@ +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace' , function (t) { + t.plan(1); + var x = parse([ '-x', '\t' ]).x; + t.equal(x, '\t'); +}); diff --git a/legacy-libs/grpc/node_modules/minipass/LICENSE b/legacy-libs/grpc/node_modules/minipass/LICENSE new file mode 100644 index 0000000..20a4762 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minipass/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) npm, Inc. 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/legacy-libs/grpc/node_modules/minipass/README.md b/legacy-libs/grpc/node_modules/minipass/README.md new file mode 100644 index 0000000..7a83c59 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minipass/README.md @@ -0,0 +1,124 @@ +# minipass + +A _very_ minimal implementation of a [PassThrough +stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough) + +[It's very +fast](https://docs.google.com/spreadsheets/d/1oObKSrVwLX_7Ut4Z6g3fZW-AX1j1-k6w-cDsrkaSbHM/edit#gid=0) +for objects, strings, and buffers. + +Supports pipe()ing (including multi-pipe() and backpressure +transmission), buffering data until either a `data` event handler or +`pipe()` is added (so you don't lose the first chunk), and most other +cases where PassThrough is a good idea. + +There is a `read()` method, but it's much more efficient to consume +data from this stream via `'data'` events or by calling `pipe()` into +some other stream. Calling `read()` requires the buffer to be +flattened in some cases, which requires copying memory. + +There is also no `unpipe()` method. Once you start piping, there is +no stopping it! + +If you set `objectMode: true` in the options, then whatever is written +will be emitted. Otherwise, it'll do a minimal amount of Buffer +copying to ensure proper Streams semantics when `read(n)` is called. + +This is not a `through` or `through2` stream. It doesn't transform +the data, it just passes it right through. If you want to transform +the data, extend the class, and override the `write()` method. Once +you're done transforming the data however you want, call +`super.write()` with the transform output. + +For an example of a stream that extends MiniPass to provide transform +capabilities, check out [minizlib](http://npm.im/minizlib). + +## USAGE + +```js +const MiniPass = require('minipass') +const mp = new MiniPass(options) // optional: { encoding } +mp.write('foo') +mp.pipe(someOtherStream) +mp.end('bar') +``` + +### collecting + +```js +mp.collect().then(all => { + // all is an array of all the data emitted + // encoding is supported in this case, so + // so the result will be a collection of strings if + // an encoding is specified, or buffers/objects if not. + // + // In an async function, you may do + // const data = await stream.collect() +}) +``` + +### iteration + +You can iterate over streams synchronously or asynchronously in +platforms that support it. + +Synchronous iteration will end when the currently available data is +consumed, even if the `end` event has not been reached. In string and +buffer mode, the data is concatenated, so unless multiple writes are +occurring in the same tick as the `read()`, sync iteration loops will +generally only have a single iteration. + +To consume chunks in this way exactly as they have been written, with +no flattening, create the stream with the `{ objectMode: true }` +option. + +```js +const mp = new Minipass({ objectMode: true }) +mp.write('a') +mp.write('b') +for (let letter of mp) { + console.log(letter) // a, b +} +mp.write('c') +mp.write('d') +for (let letter of mp) { + console.log(letter) // c, d +} +mp.write('e') +mp.end() +for (let letter of mp) { + console.log(letter) // e +} +for (let letter of mp) { + console.log(letter) // nothing +} +``` + +Asynchronous iteration will continue until the end event is reached, +consuming all of the data. + +```js +const mp = new Minipass({ encoding: 'utf8' }) + +// some source of some data +let i = 5 +const inter = setInterval(() => { + if (i --> 0) + mp.write(Buffer.from('foo\n', 'utf8')) + else { + mp.end() + clearInterval(inter) + } +}, 100) + +// consume the data with asynchronous iteration +async function consume () { + for await (let chunk of mp) { + console.log(chunk) + } + return 'ok' +} + +consume().then(res => console.log(res)) +// logs `foo\n` 5 times, and then `ok` +``` diff --git a/legacy-libs/grpc/node_modules/minipass/index.js b/legacy-libs/grpc/node_modules/minipass/index.js new file mode 100644 index 0000000..de472c3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minipass/index.js @@ -0,0 +1,375 @@ +'use strict' +const EE = require('events') +const Yallist = require('yallist') +const EOF = Symbol('EOF') +const MAYBE_EMIT_END = Symbol('maybeEmitEnd') +const EMITTED_END = Symbol('emittedEnd') +const CLOSED = Symbol('closed') +const READ = Symbol('read') +const FLUSH = Symbol('flush') +const doIter = process.env._MP_NO_ITERATOR_SYMBOLS_ !== '1' +const ASYNCITERATOR = doIter && Symbol.asyncIterator || Symbol('asyncIterator not implemented') +const ITERATOR = doIter && Symbol.iterator || Symbol('iterator not implemented') +const FLUSHCHUNK = Symbol('flushChunk') +const SD = require('string_decoder').StringDecoder +const ENCODING = Symbol('encoding') +const DECODER = Symbol('decoder') +const FLOWING = Symbol('flowing') +const RESUME = Symbol('resume') +const BUFFERLENGTH = Symbol('bufferLength') +const BUFFERPUSH = Symbol('bufferPush') +const BUFFERSHIFT = Symbol('bufferShift') +const OBJECTMODE = Symbol('objectMode') + +// Buffer in node 4.x < 4.5.0 doesn't have working Buffer.from +// or Buffer.alloc, and Buffer in node 10 deprecated the ctor. +// .M, this is fine .\^/M.. +let B = Buffer +/* istanbul ignore next */ +if (!B.alloc) { + B = require('safe-buffer').Buffer +} + +module.exports = class MiniPass extends EE { + constructor (options) { + super() + this[FLOWING] = false + this.pipes = new Yallist() + this.buffer = new Yallist() + this[OBJECTMODE] = options && options.objectMode || false + if (this[OBJECTMODE]) + this[ENCODING] = null + else + this[ENCODING] = options && options.encoding || null + if (this[ENCODING] === 'buffer') + this[ENCODING] = null + this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null + this[EOF] = false + this[EMITTED_END] = false + this[CLOSED] = false + this.writable = true + this.readable = true + this[BUFFERLENGTH] = 0 + } + + get bufferLength () { return this[BUFFERLENGTH] } + + get encoding () { return this[ENCODING] } + set encoding (enc) { + if (this[OBJECTMODE]) + throw new Error('cannot set encoding in objectMode') + + if (this[ENCODING] && enc !== this[ENCODING] && + (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH])) + throw new Error('cannot change encoding') + + if (this[ENCODING] !== enc) { + this[DECODER] = enc ? new SD(enc) : null + if (this.buffer.length) + this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk)) + } + + this[ENCODING] = enc + } + + setEncoding (enc) { + this.encoding = enc + } + + write (chunk, encoding, cb) { + if (this[EOF]) + throw new Error('write after end') + + if (typeof encoding === 'function') + cb = encoding, encoding = 'utf8' + + if (!encoding) + encoding = 'utf8' + + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && !this[OBJECTMODE] && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) { + chunk = B.from(chunk, encoding) + } + + if (B.isBuffer(chunk) && this[ENCODING]) + chunk = this[DECODER].write(chunk) + + try { + return this.flowing + ? (this.emit('data', chunk), this.flowing) + : (this[BUFFERPUSH](chunk), false) + } finally { + this.emit('readable') + if (cb) + cb() + } + } + + read (n) { + try { + if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) + return null + + if (this[OBJECTMODE]) + n = null + + if (this.buffer.length > 1 && !this[OBJECTMODE]) { + if (this.encoding) + this.buffer = new Yallist([ + Array.from(this.buffer).join('') + ]) + else + this.buffer = new Yallist([ + B.concat(Array.from(this.buffer), this[BUFFERLENGTH]) + ]) + } + + return this[READ](n || null, this.buffer.head.value) + } finally { + this[MAYBE_EMIT_END]() + } + } + + [READ] (n, chunk) { + if (n === chunk.length || n === null) + this[BUFFERSHIFT]() + else { + this.buffer.head.value = chunk.slice(n) + chunk = chunk.slice(0, n) + this[BUFFERLENGTH] -= n + } + + this.emit('data', chunk) + + if (!this.buffer.length && !this[EOF]) + this.emit('drain') + + return chunk + } + + end (chunk, encoding, cb) { + if (typeof chunk === 'function') + cb = chunk, chunk = null + if (typeof encoding === 'function') + cb = encoding, encoding = 'utf8' + if (chunk) + this.write(chunk, encoding) + if (cb) + this.once('end', cb) + this[EOF] = true + this.writable = false + if (this.flowing) + this[MAYBE_EMIT_END]() + } + + // don't let the internal resume be overwritten + [RESUME] () { + this[FLOWING] = true + this.emit('resume') + if (this.buffer.length) + this[FLUSH]() + else if (this[EOF]) + this[MAYBE_EMIT_END]() + else + this.emit('drain') + } + + resume () { + return this[RESUME]() + } + + pause () { + this[FLOWING] = false + } + + get flowing () { + return this[FLOWING] + } + + [BUFFERPUSH] (chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1 + else + this[BUFFERLENGTH] += chunk.length + return this.buffer.push(chunk) + } + + [BUFFERSHIFT] () { + if (this.buffer.length) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1 + else + this[BUFFERLENGTH] -= this.buffer.head.value.length + } + return this.buffer.shift() + } + + [FLUSH] () { + do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]())) + + if (!this.buffer.length && !this[EOF]) + this.emit('drain') + } + + [FLUSHCHUNK] (chunk) { + return chunk ? (this.emit('data', chunk), this.flowing) : false + } + + pipe (dest, opts) { + if (dest === process.stdout || dest === process.stderr) + (opts = opts || {}).end = false + const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() } + this.pipes.push(p) + + dest.on('drain', p.ondrain) + this[RESUME]() + return dest + } + + addListener (ev, fn) { + return this.on(ev, fn) + } + + on (ev, fn) { + try { + return super.on(ev, fn) + } finally { + if (ev === 'data' && !this.pipes.length && !this.flowing) + this[RESUME]() + else if (ev === 'end' && this[EMITTED_END]) { + super.emit('end') + this.removeAllListeners('end') + } + } + } + + get emittedEnd () { + return this[EMITTED_END] + } + + [MAYBE_EMIT_END] () { + if (!this[EMITTED_END] && this.buffer.length === 0 && this[EOF]) { + this.emit('end') + this.emit('prefinish') + this.emit('finish') + if (this[CLOSED]) + this.emit('close') + } + } + + emit (ev, data) { + if (ev === 'data') { + if (!data) + return + + if (this.pipes.length) + this.pipes.forEach(p => p.dest.write(data) || this.pause()) + } else if (ev === 'end') { + if (this[EMITTED_END] === true) + return + + this[EMITTED_END] = true + this.readable = false + + if (this[DECODER]) { + data = this[DECODER].end() + if (data) { + this.pipes.forEach(p => p.dest.write(data)) + super.emit('data', data) + } + } + + this.pipes.forEach(p => { + p.dest.removeListener('drain', p.ondrain) + if (!p.opts || p.opts.end !== false) + p.dest.end() + }) + } else if (ev === 'close') { + this[CLOSED] = true + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END]) + return + } + + const args = new Array(arguments.length) + args[0] = ev + args[1] = data + if (arguments.length > 2) { + for (let i = 2; i < arguments.length; i++) { + args[i] = arguments[i] + } + } + + try { + return super.emit.apply(this, args) + } finally { + if (ev !== 'end') + this[MAYBE_EMIT_END]() + else + this.removeAllListeners('end') + } + } + + // const all = await stream.collect() + collect () { + return new Promise((resolve, reject) => { + const buf = [] + this.on('data', c => buf.push(c)) + this.on('end', () => resolve(buf)) + this.on('error', reject) + }) + } + + // for await (let chunk of stream) + [ASYNCITERATOR] () { + const next = () => { + const res = this.read() + if (res !== null) + return Promise.resolve({ done: false, value: res }) + + if (this[EOF]) + return Promise.resolve({ done: true }) + + let resolve = null + let reject = null + const onerr = er => { + this.removeListener('data', ondata) + this.removeListener('end', onend) + reject(er) + } + const ondata = value => { + this.removeListener('error', onerr) + this.removeListener('end', onend) + this.pause() + resolve({ value: value, done: !!this[EOF] }) + } + const onend = () => { + this.removeListener('error', onerr) + this.removeListener('data', ondata) + resolve({ done: true }) + } + return new Promise((res, rej) => { + reject = rej + resolve = res + this.once('error', onerr) + this.once('end', onend) + this.once('data', ondata) + }) + } + + return { next } + } + + // for (let chunk of stream) + [ITERATOR] () { + const next = () => { + const value = this.read() + const done = value === null + return { value, done } + } + return { next } + } +} diff --git a/legacy-libs/grpc/node_modules/minipass/package.json b/legacy-libs/grpc/node_modules/minipass/package.json new file mode 100644 index 0000000..9b68cd6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minipass/package.json @@ -0,0 +1,73 @@ +{ + "_from": "minipass@^2.3.4", + "_id": "minipass@2.3.5", + "_inBundle": false, + "_integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", + "_location": "/grpc/minipass", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "minipass@^2.3.4", + "name": "minipass", + "escapedName": "minipass", + "rawSpec": "^2.3.4", + "saveSpec": null, + "fetchSpec": "^2.3.4" + }, + "_requiredBy": [ + "/grpc/fs-minipass", + "/grpc/minizlib", + "/grpc/tar" + ], + "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", + "_shasum": "cacebe492022497f656b0f0f51e2682a9ed2d848", + "_shrinkwrap": null, + "_spec": "minipass@^2.3.4", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/tar", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/minipass/issues" + }, + "bundleDependencies": false, + "dependencies": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + }, + "deprecated": false, + "description": "minimal implementation of a PassThrough stream", + "devDependencies": { + "end-of-stream": "^1.4.0", + "tap": "^12.0.1", + "through2": "^2.0.3" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/isaacs/minipass#readme", + "keywords": [ + "passthrough", + "stream" + ], + "license": "ISC", + "main": "index.js", + "name": "minipass", + "optionalDependencies": {}, + "readme": "# minipass\n\nA _very_ minimal implementation of a [PassThrough\nstream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough)\n\n[It's very\nfast](https://docs.google.com/spreadsheets/d/1oObKSrVwLX_7Ut4Z6g3fZW-AX1j1-k6w-cDsrkaSbHM/edit#gid=0)\nfor objects, strings, and buffers.\n\nSupports pipe()ing (including multi-pipe() and backpressure\ntransmission), buffering data until either a `data` event handler or\n`pipe()` is added (so you don't lose the first chunk), and most other\ncases where PassThrough is a good idea.\n\nThere is a `read()` method, but it's much more efficient to consume\ndata from this stream via `'data'` events or by calling `pipe()` into\nsome other stream. Calling `read()` requires the buffer to be\nflattened in some cases, which requires copying memory.\n\nThere is also no `unpipe()` method. Once you start piping, there is\nno stopping it!\n\nIf you set `objectMode: true` in the options, then whatever is written\nwill be emitted. Otherwise, it'll do a minimal amount of Buffer\ncopying to ensure proper Streams semantics when `read(n)` is called.\n\nThis is not a `through` or `through2` stream. It doesn't transform\nthe data, it just passes it right through. If you want to transform\nthe data, extend the class, and override the `write()` method. Once\nyou're done transforming the data however you want, call\n`super.write()` with the transform output.\n\nFor an example of a stream that extends MiniPass to provide transform\ncapabilities, check out [minizlib](http://npm.im/minizlib).\n\n## USAGE\n\n```js\nconst MiniPass = require('minipass')\nconst mp = new MiniPass(options) // optional: { encoding }\nmp.write('foo')\nmp.pipe(someOtherStream)\nmp.end('bar')\n```\n\n### collecting\n\n```js\nmp.collect().then(all => {\n // all is an array of all the data emitted\n // encoding is supported in this case, so\n // so the result will be a collection of strings if\n // an encoding is specified, or buffers/objects if not.\n //\n // In an async function, you may do\n // const data = await stream.collect()\n})\n```\n\n### iteration\n\nYou can iterate over streams synchronously or asynchronously in\nplatforms that support it.\n\nSynchronous iteration will end when the currently available data is\nconsumed, even if the `end` event has not been reached. In string and\nbuffer mode, the data is concatenated, so unless multiple writes are\noccurring in the same tick as the `read()`, sync iteration loops will\ngenerally only have a single iteration.\n\nTo consume chunks in this way exactly as they have been written, with\nno flattening, create the stream with the `{ objectMode: true }`\noption.\n\n```js\nconst mp = new Minipass({ objectMode: true })\nmp.write('a')\nmp.write('b')\nfor (let letter of mp) {\n console.log(letter) // a, b\n}\nmp.write('c')\nmp.write('d')\nfor (let letter of mp) {\n console.log(letter) // c, d\n}\nmp.write('e')\nmp.end()\nfor (let letter of mp) {\n console.log(letter) // e\n}\nfor (let letter of mp) {\n console.log(letter) // nothing\n}\n```\n\nAsynchronous iteration will continue until the end event is reached,\nconsuming all of the data.\n\n```js\nconst mp = new Minipass({ encoding: 'utf8' })\n\n// some source of some data\nlet i = 5\nconst inter = setInterval(() => {\n if (i --> 0)\n mp.write(Buffer.from('foo\\n', 'utf8'))\n else {\n mp.end()\n clearInterval(inter)\n }\n}, 100)\n\n// consume the data with asynchronous iteration\nasync function consume () {\n for await (let chunk of mp) {\n console.log(chunk)\n }\n return 'ok'\n}\n\nconsume().then(res => console.log(res))\n// logs `foo\\n` 5 times, and then `ok`\n```\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/minipass.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --100" + }, + "version": "2.3.5" +} diff --git a/legacy-libs/grpc/node_modules/minizlib/LICENSE b/legacy-libs/grpc/node_modules/minizlib/LICENSE new file mode 100644 index 0000000..ffce738 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minizlib/LICENSE @@ -0,0 +1,26 @@ +Minizlib was created by Isaac Z. Schlueter. +It is a derivative work of the Node.js project. + +""" +Copyright Isaac Z. Schlueter and Contributors +Copyright Node.js contributors. All rights reserved. +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/legacy-libs/grpc/node_modules/minizlib/README.md b/legacy-libs/grpc/node_modules/minizlib/README.md new file mode 100644 index 0000000..2b58554 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minizlib/README.md @@ -0,0 +1,44 @@ +# minizlib + +A tiny fast zlib stream built on [minipass](http://npm.im/minipass) +and Node.js's zlib binding. + +This module was created to serve the needs of +[node-tar](http://npm.im/tar) v2. If your needs are different, then +it may not be for you. + +## How does this differ from the streams in `require('zlib')`? + +First, there are no convenience methods to compress or decompress a +buffer. If you want those, use the built-in `zlib` module. This is +only streams. + +This module compresses and decompresses the data as fast as you feed +it in. It is synchronous, and runs on the main process thread. Zlib +operations can be high CPU, but they're very fast, and doing it this +way means much less bookkeeping and artificial deferral. + +Node's built in zlib streams are built on top of `stream.Transform`. +They do the maximally safe thing with respect to consistent +asynchrony, buffering, and backpressure. + +This module _does_ support backpressure, and will buffer output chunks +that are not consumed, but is less of a mediator between the input and +output. There is no high or low watermarks, no state objects, and so +artificial async deferrals. It will not protect you from Zalgo. + +If you write, data will be emitted right away. If you write +everything synchronously in one tick, and you are listening to the +`data` event to consume it, then it'll all be emitted right away in +that same tick. If you want data to be emitted in the next tick, then +write it in the next tick. + +It is thus the responsibility of the reader and writer to manage their +own consumption and process execution flow. + +The goal is to compress and decompress as fast as possible, even for +files that are too large to store all in one buffer. + +The API is very similar to the built-in zlib module. There are +classes that you instantiate with `new` and they are streams that can +be piped together. diff --git a/legacy-libs/grpc/node_modules/minizlib/constants.js b/legacy-libs/grpc/node_modules/minizlib/constants.js new file mode 100644 index 0000000..4edffde --- /dev/null +++ b/legacy-libs/grpc/node_modules/minizlib/constants.js @@ -0,0 +1,46 @@ +module.exports = Object.freeze({ + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + Z_VERSION_ERROR: -6, + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + ZLIB_VERNUM: 4736, + DEFLATE: 1, + INFLATE: 2, + GZIP: 3, + GUNZIP: 4, + DEFLATERAW: 5, + INFLATERAW: 6, + UNZIP: 7, + Z_MIN_WINDOWBITS: 8, + Z_MAX_WINDOWBITS: 15, + Z_DEFAULT_WINDOWBITS: 15, + Z_MIN_CHUNK: 64, + Z_MAX_CHUNK: Infinity, + Z_DEFAULT_CHUNK: 16384, + Z_MIN_MEMLEVEL: 1, + Z_MAX_MEMLEVEL: 9, + Z_DEFAULT_MEMLEVEL: 8, + Z_MIN_LEVEL: -1, + Z_MAX_LEVEL: 9, + Z_DEFAULT_LEVEL: -1 +}) diff --git a/legacy-libs/grpc/node_modules/minizlib/index.js b/legacy-libs/grpc/node_modules/minizlib/index.js new file mode 100644 index 0000000..df48696 --- /dev/null +++ b/legacy-libs/grpc/node_modules/minizlib/index.js @@ -0,0 +1,335 @@ +'use strict' + +const assert = require('assert') +const Buffer = require('buffer').Buffer +const realZlib = require('zlib') + +const constants = exports.constants = require('./constants.js') +const MiniPass = require('minipass') + +const OriginalBufferConcat = Buffer.concat + +class ZlibError extends Error { + constructor (msg, errno) { + super('zlib: ' + msg) + this.errno = errno + this.code = codes.get(errno) + } + + get name () { + return 'ZlibError' + } +} + +// translation table for return codes. +const codes = new Map([ + [constants.Z_OK, 'Z_OK'], + [constants.Z_STREAM_END, 'Z_STREAM_END'], + [constants.Z_NEED_DICT, 'Z_NEED_DICT'], + [constants.Z_ERRNO, 'Z_ERRNO'], + [constants.Z_STREAM_ERROR, 'Z_STREAM_ERROR'], + [constants.Z_DATA_ERROR, 'Z_DATA_ERROR'], + [constants.Z_MEM_ERROR, 'Z_MEM_ERROR'], + [constants.Z_BUF_ERROR, 'Z_BUF_ERROR'], + [constants.Z_VERSION_ERROR, 'Z_VERSION_ERROR'] +]) + +const validFlushFlags = new Set([ + constants.Z_NO_FLUSH, + constants.Z_PARTIAL_FLUSH, + constants.Z_SYNC_FLUSH, + constants.Z_FULL_FLUSH, + constants.Z_FINISH, + constants.Z_BLOCK +]) + +const strategies = new Set([ + constants.Z_FILTERED, + constants.Z_HUFFMAN_ONLY, + constants.Z_RLE, + constants.Z_FIXED, + constants.Z_DEFAULT_STRATEGY +]) + +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. +const _opts = Symbol('opts') +const _flushFlag = Symbol('flushFlag') +const _finishFlush = Symbol('finishFlush') +const _handle = Symbol('handle') +const _onError = Symbol('onError') +const _level = Symbol('level') +const _strategy = Symbol('strategy') +const _ended = Symbol('ended') + +class Zlib extends MiniPass { + constructor (opts, mode) { + super(opts) + this[_ended] = false + this[_opts] = opts = opts || {} + if (opts.flush && !validFlushFlags.has(opts.flush)) { + throw new TypeError('Invalid flush flag: ' + opts.flush) + } + if (opts.finishFlush && !validFlushFlags.has(opts.finishFlush)) { + throw new TypeError('Invalid flush flag: ' + opts.finishFlush) + } + + this[_flushFlag] = opts.flush || constants.Z_NO_FLUSH + this[_finishFlush] = typeof opts.finishFlush !== 'undefined' ? + opts.finishFlush : constants.Z_FINISH + + if (opts.chunkSize) { + if (opts.chunkSize < constants.Z_MIN_CHUNK) { + throw new RangeError('Invalid chunk size: ' + opts.chunkSize) + } + } + + if (opts.windowBits) { + if (opts.windowBits < constants.Z_MIN_WINDOWBITS || + opts.windowBits > constants.Z_MAX_WINDOWBITS) { + throw new RangeError('Invalid windowBits: ' + opts.windowBits) + } + } + + if (opts.level) { + if (opts.level < constants.Z_MIN_LEVEL || + opts.level > constants.Z_MAX_LEVEL) { + throw new RangeError('Invalid compression level: ' + opts.level) + } + } + + if (opts.memLevel) { + if (opts.memLevel < constants.Z_MIN_MEMLEVEL || + opts.memLevel > constants.Z_MAX_MEMLEVEL) { + throw new RangeError('Invalid memLevel: ' + opts.memLevel) + } + } + + if (opts.strategy && !(strategies.has(opts.strategy))) + throw new TypeError('Invalid strategy: ' + opts.strategy) + + if (opts.dictionary) { + if (!(opts.dictionary instanceof Buffer)) { + throw new TypeError('Invalid dictionary: it should be a Buffer instance') + } + } + + this[_handle] = new realZlib[mode](opts) + + this[_onError] = (err) => { + // there is no way to cleanly recover. + // continuing only obscures problems. + this.close() + + const error = new ZlibError(err.message, err.errno) + this.emit('error', error) + } + this[_handle].on('error', this[_onError]) + + const level = typeof opts.level === 'number' ? opts.level + : constants.Z_DEFAULT_COMPRESSION + + var strategy = typeof opts.strategy === 'number' ? opts.strategy + : constants.Z_DEFAULT_STRATEGY + + // API changed in node v9 + /* istanbul ignore next */ + + this[_level] = level + this[_strategy] = strategy + + this.once('end', this.close) + } + + close () { + if (this[_handle]) { + this[_handle].close() + this[_handle] = null + this.emit('close') + } + } + + params (level, strategy) { + if (!this[_handle]) + throw new Error('cannot switch params when binding is closed') + + // no way to test this without also not supporting params at all + /* istanbul ignore if */ + if (!this[_handle].params) + throw new Error('not supported in this implementation') + + if (level < constants.Z_MIN_LEVEL || + level > constants.Z_MAX_LEVEL) { + throw new RangeError('Invalid compression level: ' + level) + } + + if (!(strategies.has(strategy))) + throw new TypeError('Invalid strategy: ' + strategy) + + if (this[_level] !== level || this[_strategy] !== strategy) { + this.flush(constants.Z_SYNC_FLUSH) + assert(this[_handle], 'zlib binding closed') + // .params() calls .flush(), but the latter is always async in the + // core zlib. We override .flush() temporarily to intercept that and + // flush synchronously. + const origFlush = this[_handle].flush + this[_handle].flush = (flushFlag, cb) => { + this[_handle].flush = origFlush + this.flush(flushFlag) + cb() + } + this[_handle].params(level, strategy) + /* istanbul ignore else */ + if (this[_handle]) { + this[_level] = level + this[_strategy] = strategy + } + } + } + + reset () { + assert(this[_handle], 'zlib binding closed') + return this[_handle].reset() + } + + flush (kind) { + if (kind === undefined) + kind = constants.Z_FULL_FLUSH + + if (this.ended) + return + + const flushFlag = this[_flushFlag] + this[_flushFlag] = kind + this.write(Buffer.alloc(0)) + this[_flushFlag] = flushFlag + } + + end (chunk, encoding, cb) { + if (chunk) + this.write(chunk, encoding) + this.flush(this[_finishFlush]) + this[_ended] = true + return super.end(null, null, cb) + } + + get ended () { + return this[_ended] + } + + write (chunk, encoding, cb) { + // process the chunk using the sync process + // then super.write() all the outputted chunks + if (typeof encoding === 'function') + cb = encoding, encoding = 'utf8' + + if (typeof chunk === 'string') + chunk = Buffer.from(chunk, encoding) + + assert(this[_handle], 'zlib binding closed') + + // _processChunk tries to .close() the native handle after it's done, so we + // intercept that by temporarily making it a no-op. + const nativeHandle = this[_handle]._handle + const originalNativeClose = nativeHandle.close + nativeHandle.close = () => {} + const originalClose = this[_handle].close + this[_handle].close = () => {} + // It also calls `Buffer.concat()` at the end, which may be convenient + // for some, but which we are not interested in as it slows us down. + Buffer.concat = (args) => args + let result + try { + result = this[_handle]._processChunk(chunk, this[_flushFlag]) + } catch (err) { + this[_onError](err) + } finally { + Buffer.concat = OriginalBufferConcat + if (this[_handle]) { + // Core zlib resets `_handle` to null after attempting to close the + // native handle. Our no-op handler prevented actual closure, but we + // need to restore the `._handle` property. + this[_handle]._handle = nativeHandle + nativeHandle.close = originalNativeClose + this[_handle].close = originalClose + // `_processChunk()` adds an 'error' listener. If we don't remove it + // after each call, these handlers start piling up. + this[_handle].removeAllListeners('error') + } + } + + let writeReturn + if (result) { + if (Array.isArray(result) && result.length > 0) { + // The first buffer is always `handle._outBuffer`, which would be + // re-used for later invocations; so, we always have to copy that one. + writeReturn = super.write(Buffer.from(result[0])) + for (let i = 1; i < result.length; i++) { + writeReturn = super.write(result[i]) + } + } else { + writeReturn = super.write(Buffer.from(result)) + } + } + + if (cb) + cb() + return writeReturn + } +} + +// minimal 2-byte header +class Deflate extends Zlib { + constructor (opts) { + super(opts, 'Deflate') + } +} + +class Inflate extends Zlib { + constructor (opts) { + super(opts, 'Inflate') + } +} + +// gzip - bigger header, same deflate compression +class Gzip extends Zlib { + constructor (opts) { + super(opts, 'Gzip') + } +} + +class Gunzip extends Zlib { + constructor (opts) { + super(opts, 'Gunzip') + } +} + +// raw - no header +class DeflateRaw extends Zlib { + constructor (opts) { + super(opts, 'DeflateRaw') + } +} + +class InflateRaw extends Zlib { + constructor (opts) { + super(opts, 'InflateRaw') + } +} + +// auto-detect header. +class Unzip extends Zlib { + constructor (opts) { + super(opts, 'Unzip') + } +} + +exports.Deflate = Deflate +exports.Inflate = Inflate +exports.Gzip = Gzip +exports.Gunzip = Gunzip +exports.DeflateRaw = DeflateRaw +exports.InflateRaw = InflateRaw +exports.Unzip = Unzip diff --git a/legacy-libs/grpc/node_modules/minizlib/package.json b/legacy-libs/grpc/node_modules/minizlib/package.json new file mode 100644 index 0000000..f5919ae --- /dev/null +++ b/legacy-libs/grpc/node_modules/minizlib/package.json @@ -0,0 +1,75 @@ +{ + "_from": "minizlib@^1.1.1", + "_id": "minizlib@1.2.1", + "_inBundle": false, + "_integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", + "_location": "/grpc/minizlib", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "minizlib@^1.1.1", + "name": "minizlib", + "escapedName": "minizlib", + "rawSpec": "^1.1.1", + "saveSpec": null, + "fetchSpec": "^1.1.1" + }, + "_requiredBy": [ + "/grpc/tar" + ], + "_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", + "_shasum": "dd27ea6136243c7c880684e8672bb3a45fd9b614", + "_shrinkwrap": null, + "_spec": "minizlib@^1.1.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/tar", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/minizlib/issues" + }, + "bundleDependencies": false, + "dependencies": { + "minipass": "^2.2.1" + }, + "deprecated": false, + "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.", + "devDependencies": { + "tap": "^12.0.1" + }, + "files": [ + "index.js", + "constants.js" + ], + "homepage": "https://github.com/isaacs/minizlib#readme", + "keywords": [ + "zlib", + "gzip", + "gunzip", + "deflate", + "inflate", + "compression", + "zip", + "unzip" + ], + "license": "MIT", + "main": "index.js", + "name": "minizlib", + "optionalDependencies": {}, + "readme": "# minizlib\n\nA tiny fast zlib stream built on [minipass](http://npm.im/minipass)\nand Node.js's zlib binding.\n\nThis module was created to serve the needs of\n[node-tar](http://npm.im/tar) v2. If your needs are different, then\nit may not be for you.\n\n## How does this differ from the streams in `require('zlib')`?\n\nFirst, there are no convenience methods to compress or decompress a\nbuffer. If you want those, use the built-in `zlib` module. This is\nonly streams.\n\nThis module compresses and decompresses the data as fast as you feed\nit in. It is synchronous, and runs on the main process thread. Zlib\noperations can be high CPU, but they're very fast, and doing it this\nway means much less bookkeeping and artificial deferral.\n\nNode's built in zlib streams are built on top of `stream.Transform`.\nThey do the maximally safe thing with respect to consistent\nasynchrony, buffering, and backpressure.\n\nThis module _does_ support backpressure, and will buffer output chunks\nthat are not consumed, but is less of a mediator between the input and\noutput. There is no high or low watermarks, no state objects, and so\nartificial async deferrals. It will not protect you from Zalgo.\n\nIf you write, data will be emitted right away. If you write\neverything synchronously in one tick, and you are listening to the\n`data` event to consume it, then it'll all be emitted right away in\nthat same tick. If you want data to be emitted in the next tick, then\nwrite it in the next tick.\n\nIt is thus the responsibility of the reader and writer to manage their\nown consumption and process execution flow.\n\nThe goal is to compress and decompress as fast as possible, even for\nfiles that are too large to store all in one buffer.\n\nThe API is very similar to the built-in zlib module. There are\nclasses that you instantiate with `new` and they are streams that can\nbe piped together.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/minizlib.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --100 -J" + }, + "version": "1.2.1" +} diff --git a/legacy-libs/grpc/node_modules/mkdirp/LICENSE b/legacy-libs/grpc/node_modules/mkdirp/LICENSE new file mode 100644 index 0000000..432d1ae --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/LICENSE @@ -0,0 +1,21 @@ +Copyright 2010 James Halliday (mail@substack.net) + +This project is free software released under the MIT/X11 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/legacy-libs/grpc/node_modules/mkdirp/bin/cmd.js b/legacy-libs/grpc/node_modules/mkdirp/bin/cmd.js new file mode 100644 index 0000000..d95de15 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/bin/cmd.js @@ -0,0 +1,33 @@ +#!/usr/bin/env node + +var mkdirp = require('../'); +var minimist = require('minimist'); +var fs = require('fs'); + +var argv = minimist(process.argv.slice(2), { + alias: { m: 'mode', h: 'help' }, + string: [ 'mode' ] +}); +if (argv.help) { + fs.createReadStream(__dirname + '/usage.txt').pipe(process.stdout); + return; +} + +var paths = argv._.slice(); +var mode = argv.mode ? parseInt(argv.mode, 8) : undefined; + +(function next () { + if (paths.length === 0) return; + var p = paths.shift(); + + if (mode === undefined) mkdirp(p, cb) + else mkdirp(p, mode, cb) + + function cb (err) { + if (err) { + console.error(err.message); + process.exit(1); + } + else next(); + } +})(); diff --git a/legacy-libs/grpc/node_modules/mkdirp/bin/usage.txt b/legacy-libs/grpc/node_modules/mkdirp/bin/usage.txt new file mode 100644 index 0000000..f952aa2 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/bin/usage.txt @@ -0,0 +1,12 @@ +usage: mkdirp [DIR1,DIR2..] {OPTIONS} + + Create each supplied directory including any necessary parent directories that + don't yet exist. + + If the directory already exists, do nothing. + +OPTIONS are: + + -m, --mode If a directory needs to be created, set the mode as an octal + permission string. + diff --git a/legacy-libs/grpc/node_modules/mkdirp/examples/pow.js b/legacy-libs/grpc/node_modules/mkdirp/examples/pow.js new file mode 100644 index 0000000..e692421 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/examples/pow.js @@ -0,0 +1,6 @@ +var mkdirp = require('mkdirp'); + +mkdirp('/tmp/foo/bar/baz', function (err) { + if (err) console.error(err) + else console.log('pow!') +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/index.js b/legacy-libs/grpc/node_modules/mkdirp/index.js new file mode 100644 index 0000000..6ce241b --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/index.js @@ -0,0 +1,98 @@ +var path = require('path'); +var fs = require('fs'); +var _0777 = parseInt('0777', 8); + +module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; + +function mkdirP (p, opts, f, made) { + if (typeof opts === 'function') { + f = opts; + opts = {}; + } + else if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = _0777 & (~process.umask()); + } + if (!made) made = null; + + var cb = f || function () {}; + p = path.resolve(p); + + xfs.mkdir(p, mode, function (er) { + if (!er) { + made = made || p; + return cb(null, made); + } + switch (er.code) { + case 'ENOENT': + mkdirP(path.dirname(p), opts, function (er, made) { + if (er) cb(er, made); + else mkdirP(p, opts, cb, made); + }); + break; + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, function (er2, stat) { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) cb(er, made) + else cb(null, made); + }); + break; + } + }); +} + +mkdirP.sync = function sync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = _0777 & (~process.umask()); + } + if (!made) made = null; + + p = path.resolve(p); + + try { + xfs.mkdirSync(p, mode); + made = made || p; + } + catch (err0) { + switch (err0.code) { + case 'ENOENT' : + made = sync(path.dirname(p), opts, made); + sync(p, opts, made); + break; + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + var stat; + try { + stat = xfs.statSync(p); + } + catch (err1) { + throw err0; + } + if (!stat.isDirectory()) throw err0; + break; + } + } + + return made; +}; diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/LICENSE b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +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/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/example/parse.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/example/parse.js new file mode 100644 index 0000000..abff3e8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/example/parse.js @@ -0,0 +1,2 @@ +var argv = require('../')(process.argv.slice(2)); +console.dir(argv); diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/index.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/index.js new file mode 100644 index 0000000..584f551 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/index.js @@ -0,0 +1,187 @@ +module.exports = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {} }; + + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + }); + + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function setArg (key, val) { + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + setArg(m[1], m[2]); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, next); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true'); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next) + continue; + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2)); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, args[i+1]); + i++; + } + else if (args[i+1] && /true|false/.test(args[i+1])) { + setArg(key, args[i+1] === 'true'); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true); + } + } + } + else { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + } + + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); + + notFlags.forEach(function(key) { + argv._.push(key); + }); + + return argv; +}; + +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function setKey (obj, keys, value) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + if (o[key] === undefined) o[key] = {}; + o = o[key]; + }); + + var key = keys[keys.length - 1]; + if (o[key] === undefined || typeof o[key] === 'boolean') { + o[key] = value; + } + else if (Array.isArray(o[key])) { + o[key].push(value); + } + else { + o[key] = [ o[key], value ]; + } +} + +function isNumber (x) { + if (typeof x === 'number') return true; + if (/^0x[0-9a-f]+$/i.test(x)) return true; + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); +} + +function longest (xs) { + return Math.max.apply(null, xs.map(function (x) { return x.length })); +} diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/package.json b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/package.json new file mode 100644 index 0000000..f59f73a --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/package.json @@ -0,0 +1,79 @@ +{ + "_args": [ + [ + "minimist@0.0.8", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "minimist@0.0.8", + "_id": "minimist@0.0.8", + "_inBundle": false, + "_integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "_location": "/grpc/mkdirp/minimist", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "minimist@0.0.8", + "name": "minimist", + "escapedName": "minimist", + "rawSpec": "0.0.8", + "saveSpec": null, + "fetchSpec": "0.0.8" + }, + "_requiredBy": [ + "/grpc/mkdirp" + ], + "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "_shrinkwrap": null, + "_spec": "0.0.8", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/minimist/issues" + }, + "dependencies": {}, + "description": "parse argument options", + "devDependencies": { + "tap": "~0.4.0", + "tape": "~1.0.4" + }, + "homepage": "https://github.com/substack/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "license": "MIT", + "main": "index.js", + "name": "minimist", + "optionalDependencies": {}, + "readme": "# minimist\n\nparse argument options\n\nThis module is the guts of optimist's argument parser without all the\nfanciful decoration.\n\n[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)\n\n[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)\n\n# example\n\n``` js\nvar argv = require('minimist')(process.argv.slice(2));\nconsole.dir(argv);\n```\n\n```\n$ node example/parse.js -a beep -b boop\n{ _: [], a: 'beep', b: 'boop' }\n```\n\n```\n$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz\n{ _: [ 'foo', 'bar', 'baz' ],\n x: 3,\n y: 4,\n n: 5,\n a: true,\n b: true,\n c: true,\n beep: 'boop' }\n```\n\n# methods\n\n``` js\nvar parseArgs = require('minimist')\n```\n\n## var argv = parseArgs(args, opts={})\n\nReturn an argument object `argv` populated with the array arguments from `args`.\n\n`argv._` contains all the arguments that didn't have an option associated with\nthem.\n\nNumeric-looking arguments will be returned as numbers unless `opts.string` or\n`opts.boolean` is set for that argument name.\n\nAny arguments after `'--'` will not be parsed and will end up in `argv._`.\n\noptions can be:\n\n* `opts.string` - a string or array of strings argument names to always treat as\nstrings\n* `opts.boolean` - a string or array of strings to always treat as booleans\n* `opts.alias` - an object mapping string names to strings or arrays of string\nargument names to use as aliases\n* `opts.default` - an object mapping string argument names to default values\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install minimist\n```\n\n# license\n\nMIT\n", + "readmeFilename": "readme.markdown", + "repository": { + "type": "git", + "url": "git://github.com/substack/minimist.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "version": "0.0.8" +} diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/readme.markdown b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/readme.markdown new file mode 100644 index 0000000..c256353 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/readme.markdown @@ -0,0 +1,73 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist) + +[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist) + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.dir(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a string or array of strings to always treat as booleans +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dash.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dash.js new file mode 100644 index 0000000..8b034b9 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dash.js @@ -0,0 +1,24 @@ +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(5); + t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); + t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); + t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); + t.deepEqual( + parse([ '-b', '-' ], { boolean: 'b' }), + { b: true, _: [ '-' ] } + ); + t.deepEqual( + parse([ '-s', '-' ], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(3); + t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/default_bool.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/default_bool.js new file mode 100644 index 0000000..f0041ee --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/default_bool.js @@ -0,0 +1,20 @@ +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true } + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false } + }); + t.equal(argv.somefalse, false); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dotted.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dotted.js new file mode 100644 index 0000000..ef0ae34 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dotted.js @@ -0,0 +1,16 @@ +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/long.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/long.js new file mode 100644 index 0000000..5d3a1e0 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/long.js @@ -0,0 +1,31 @@ +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse([ '--bool' ]), + { bool : true, _ : [] }, + 'long boolean' + ); + t.deepEqual( + parse([ '--pow', 'xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture sp' + ); + t.deepEqual( + parse([ '--pow=xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture eq' + ); + t.deepEqual( + parse([ '--host', 'localhost', '--port', '555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures sp' + ); + t.deepEqual( + parse([ '--host=localhost', '--port=555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse.js new file mode 100644 index 0000000..8a90646 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse.js @@ -0,0 +1,318 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse([ '--no-moo' ]), + { moo : false, _ : [] }, + 'no' + ); + t.deepEqual( + parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), + { v : ['a','b','c'], _ : [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek' + ]), + { + c : true, + a : true, + t : true, + s : 'woo', + h : 'awesome', + b : true, + bool : true, + key : 'value', + multi : [ 'quux', 'baz' ], + meep : false, + name : 'meowmers', + _ : [ 'bare', '--not-a-flag', 'eek' ] + } + ); + t.end(); +}); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789' + ]); + t.deepEqual(argv, { + x : 1234, + y : 5.67, + z : 1e7, + w : '10f', + hex : 0xdeadbeef, + _ : [ 789 ] + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse([ '-t', 'moo' ], { boolean: 't' }); + t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: [ 't', 'verbose' ], + default: { verbose: true } + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false } + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { + boolean: ['x','y','z'] + }); + + t.deepEqual(argv, { + x : true, + y : false, + z : true, + _ : [ 'one', 'two', 'three' ] + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); + +test('newlines in params' , function (t) { + var args = parse([ '-s', "X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse([ "--s=X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + t.end(); +}); + +test('strings' , function (t) { + var s = parse([ '-s', '0001234' ], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse([ '-x', '56' ], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([ ' ', ' ' ], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function(t) { + var s = parse([ '-s' ], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse([ '--str' ], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse([ '-art' ], { + string: [ 'a', 't' ] + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + + +test('slashBreak', function (t) { + t.same( + parse([ '-I/foo/bar/baz' ]), + { I : '/foo/bar/baz', _ : [] } + ); + t.same( + parse([ '-xyz/foo/bar/baz' ]), + { x : true, y : true, z : '/foo/bar/baz', _ : [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: 'zoom' } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: [ 'zm', 'zoom' ] } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop' + ]); + + t.same(argv.foo, { + bar : 3, + baz : 4, + quux : { + quibble : 5, + o_O : true + } + }); + t.same(argv.beep, { boop : true }); + t.end(); +}); + +test('boolean and alias with chainable api', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + alias: { 'h': 'herp' }, + boolean: 'herp' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = [ '-h', 'true' ]; + var regular = [ '--herp', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function(t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js new file mode 100644 index 0000000..21851b0 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,9 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions' , function (t) { + t.plan(1); + + var argv = parse([ '-b', '123' ], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: ['123'] }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/short.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/short.js new file mode 100644 index 0000000..d513a1c --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/short.js @@ -0,0 +1,67 @@ +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); + t.deepEqual( + parse([ '-123', '456' ]), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse([ '-b' ]), + { b : true, _ : [] }, + 'short boolean' + ); + t.deepEqual( + parse([ 'foo', 'bar', 'baz' ]), + { _ : [ 'foo', 'bar', 'baz' ] }, + 'bare' + ); + t.deepEqual( + parse([ '-cats' ]), + { c : true, a : true, t : true, s : true, _ : [] }, + 'group' + ); + t.deepEqual( + parse([ '-cats', 'meow' ]), + { c : true, a : true, t : true, s : 'meow', _ : [] }, + 'short group next' + ); + t.deepEqual( + parse([ '-h', 'localhost' ]), + { h : 'localhost', _ : [] }, + 'short capture' + ); + t.deepEqual( + parse([ '-h', 'localhost', '-p', '555' ]), + { h : 'localhost', p : 555, _ : [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/whitespace.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/whitespace.js new file mode 100644 index 0000000..8a52a58 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/whitespace.js @@ -0,0 +1,8 @@ +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace' , function (t) { + t.plan(1); + var x = parse([ '-x', '\t' ]).x; + t.equal(x, '\t'); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/package.json b/legacy-libs/grpc/node_modules/mkdirp/package.json new file mode 100644 index 0000000..779e468 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/package.json @@ -0,0 +1,70 @@ +{ + "_args": [ + [ + "mkdirp@0.5.1", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "mkdirp@0.5.1", + "_id": "mkdirp@0.5.1", + "_inBundle": false, + "_integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "_location": "/grpc/mkdirp", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "mkdirp@0.5.1", + "name": "mkdirp", + "escapedName": "mkdirp", + "rawSpec": "0.5.1", + "saveSpec": null, + "fetchSpec": "0.5.1" + }, + "_requiredBy": [ + "/grpc/node-pre-gyp", + "/grpc/tar" + ], + "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "_shrinkwrap": null, + "_spec": "0.5.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "bugs": { + "url": "https://github.com/substack/node-mkdirp/issues" + }, + "dependencies": { + "minimist": "0.0.8" + }, + "description": "Recursively mkdir, like `mkdir -p`", + "devDependencies": { + "mock-fs": "2 >=2.7.0", + "tap": "1" + }, + "homepage": "https://github.com/substack/node-mkdirp#readme", + "keywords": [ + "mkdir", + "directory" + ], + "license": "MIT", + "main": "index.js", + "name": "mkdirp", + "optionalDependencies": {}, + "readme": "# mkdirp\n\nLike `mkdir -p`, but in node.js!\n\n[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)\n\n# example\n\n## pow.js\n\n```js\nvar mkdirp = require('mkdirp');\n \nmkdirp('/tmp/foo/bar/baz', function (err) {\n if (err) console.error(err)\n else console.log('pow!')\n});\n```\n\nOutput\n\n```\npow!\n```\n\nAnd now /tmp/foo/bar/baz exists, huzzah!\n\n# methods\n\n```js\nvar mkdirp = require('mkdirp');\n```\n\n## mkdirp(dir, opts, cb)\n\nCreate a new directory and any necessary subdirectories at `dir` with octal\npermission string `opts.mode`. If `opts` is a non-object, it will be treated as\nthe `opts.mode`.\n\nIf `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\n`cb(err, made)` fires with the error or the first directory `made`\nthat had to be created, if any.\n\nYou can optionally pass in an alternate `fs` implementation by passing in\n`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and\n`opts.fs.stat(path, cb)`.\n\n## mkdirp.sync(dir, opts)\n\nSynchronously create a new directory and any necessary subdirectories at `dir`\nwith octal permission string `opts.mode`. If `opts` is a non-object, it will be\ntreated as the `opts.mode`.\n\nIf `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\nReturns the first directory that had to be created, if any.\n\nYou can optionally pass in an alternate `fs` implementation by passing in\n`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and\n`opts.fs.statSync(path)`.\n\n# usage\n\nThis package also ships with a `mkdirp` command.\n\n```\nusage: mkdirp [DIR1,DIR2..] {OPTIONS}\n\n Create each supplied directory including any necessary parent directories that\n don't yet exist.\n \n If the directory already exists, do nothing.\n\nOPTIONS are:\n\n -m, --mode If a directory needs to be created, set the mode as an octal\n permission string.\n\n```\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install mkdirp\n```\n\nto get the library, or\n\n```\nnpm install -g mkdirp\n```\n\nto get the command.\n\n# license\n\nMIT\n", + "readmeFilename": "readme.markdown", + "repository": { + "type": "git", + "url": "git+https://github.com/substack/node-mkdirp.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "0.5.1" +} diff --git a/legacy-libs/grpc/node_modules/mkdirp/readme.markdown b/legacy-libs/grpc/node_modules/mkdirp/readme.markdown new file mode 100644 index 0000000..3cc1315 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/readme.markdown @@ -0,0 +1,100 @@ +# mkdirp + +Like `mkdir -p`, but in node.js! + +[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) + +# example + +## pow.js + +```js +var mkdirp = require('mkdirp'); + +mkdirp('/tmp/foo/bar/baz', function (err) { + if (err) console.error(err) + else console.log('pow!') +}); +``` + +Output + +``` +pow! +``` + +And now /tmp/foo/bar/baz exists, huzzah! + +# methods + +```js +var mkdirp = require('mkdirp'); +``` + +## mkdirp(dir, opts, cb) + +Create a new directory and any necessary subdirectories at `dir` with octal +permission string `opts.mode`. If `opts` is a non-object, it will be treated as +the `opts.mode`. + +If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. + +`cb(err, made)` fires with the error or the first directory `made` +that had to be created, if any. + +You can optionally pass in an alternate `fs` implementation by passing in +`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and +`opts.fs.stat(path, cb)`. + +## mkdirp.sync(dir, opts) + +Synchronously create a new directory and any necessary subdirectories at `dir` +with octal permission string `opts.mode`. If `opts` is a non-object, it will be +treated as the `opts.mode`. + +If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. + +Returns the first directory that had to be created, if any. + +You can optionally pass in an alternate `fs` implementation by passing in +`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and +`opts.fs.statSync(path)`. + +# usage + +This package also ships with a `mkdirp` command. + +``` +usage: mkdirp [DIR1,DIR2..] {OPTIONS} + + Create each supplied directory including any necessary parent directories that + don't yet exist. + + If the directory already exists, do nothing. + +OPTIONS are: + + -m, --mode If a directory needs to be created, set the mode as an octal + permission string. + +``` + +# install + +With [npm](http://npmjs.org) do: + +``` +npm install mkdirp +``` + +to get the library, or + +``` +npm install -g mkdirp +``` + +to get the command. + +# license + +MIT diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/chmod.js b/legacy-libs/grpc/node_modules/mkdirp/test/chmod.js new file mode 100644 index 0000000..6a404b9 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/chmod.js @@ -0,0 +1,41 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); +var _0744 = parseInt('0744', 8); + +var ps = [ '', 'tmp' ]; + +for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); +} + +var file = ps.join('/'); + +test('chmod-pre', function (t) { + var mode = _0744 + mkdirp(file, mode, function (er) { + t.ifError(er, 'should not error'); + fs.stat(file, function (er, stat) { + t.ifError(er, 'should exist'); + t.ok(stat && stat.isDirectory(), 'should be directory'); + t.equal(stat && stat.mode & _0777, mode, 'should be 0744'); + t.end(); + }); + }); +}); + +test('chmod', function (t) { + var mode = _0755 + mkdirp(file, mode, function (er) { + t.ifError(er, 'should not error'); + fs.stat(file, function (er, stat) { + t.ifError(er, 'should exist'); + t.ok(stat && stat.isDirectory(), 'should be directory'); + t.end(); + }); + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/clobber.js b/legacy-libs/grpc/node_modules/mkdirp/test/clobber.js new file mode 100644 index 0000000..2433b9a --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/clobber.js @@ -0,0 +1,38 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; +var _0755 = parseInt('0755', 8); + +var ps = [ '', 'tmp' ]; + +for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); +} + +var file = ps.join('/'); + +// a file in the way +var itw = ps.slice(0, 3).join('/'); + + +test('clobber-pre', function (t) { + console.error("about to write to "+itw) + fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); + + fs.stat(itw, function (er, stat) { + t.ifError(er) + t.ok(stat && stat.isFile(), 'should be file') + t.end() + }) +}) + +test('clobber', function (t) { + t.plan(2); + mkdirp(file, _0755, function (err) { + t.ok(err); + t.equal(err.code, 'ENOTDIR'); + t.end(); + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/mkdirp.js b/legacy-libs/grpc/node_modules/mkdirp/test/mkdirp.js new file mode 100644 index 0000000..eaa8921 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/mkdirp.js @@ -0,0 +1,28 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('woo', function (t) { + t.plan(5); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + mkdirp(file, _0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }) + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/opts_fs.js b/legacy-libs/grpc/node_modules/mkdirp/test/opts_fs.js new file mode 100644 index 0000000..97186b6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/opts_fs.js @@ -0,0 +1,29 @@ +var mkdirp = require('../'); +var path = require('path'); +var test = require('tap').test; +var mockfs = require('mock-fs'); +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('opts.fs', function (t) { + t.plan(5); + + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/beep/boop/' + [x,y,z].join('/'); + var xfs = mockfs.fs(); + + mkdirp(file, { fs: xfs, mode: _0755 }, function (err) { + t.ifError(err); + xfs.exists(file, function (ex) { + t.ok(ex, 'created file'); + xfs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/opts_fs_sync.js b/legacy-libs/grpc/node_modules/mkdirp/test/opts_fs_sync.js new file mode 100644 index 0000000..6c370aa --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/opts_fs_sync.js @@ -0,0 +1,27 @@ +var mkdirp = require('../'); +var path = require('path'); +var test = require('tap').test; +var mockfs = require('mock-fs'); +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('opts.fs sync', function (t) { + t.plan(4); + + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/beep/boop/' + [x,y,z].join('/'); + var xfs = mockfs.fs(); + + mkdirp.sync(file, { fs: xfs, mode: _0755 }); + xfs.exists(file, function (ex) { + t.ok(ex, 'created file'); + xfs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/perm.js b/legacy-libs/grpc/node_modules/mkdirp/test/perm.js new file mode 100644 index 0000000..fbce44b --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/perm.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('async perm', function (t) { + t.plan(5); + var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); + + mkdirp(file, _0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }) + }); +}); + +test('async root perm', function (t) { + mkdirp('/tmp', _0755, function (err) { + if (err) t.fail(err); + t.end(); + }); + t.end(); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/perm_sync.js b/legacy-libs/grpc/node_modules/mkdirp/test/perm_sync.js new file mode 100644 index 0000000..398229f --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/perm_sync.js @@ -0,0 +1,36 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('sync perm', function (t) { + t.plan(4); + var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; + + mkdirp.sync(file, _0755); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); + +test('sync root perm', function (t) { + t.plan(3); + + var file = '/tmp'; + mkdirp.sync(file, _0755); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/race.js b/legacy-libs/grpc/node_modules/mkdirp/test/race.js new file mode 100644 index 0000000..b0b9e18 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/race.js @@ -0,0 +1,37 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('race', function (t) { + t.plan(10); + var ps = [ '', 'tmp' ]; + + for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); + } + var file = ps.join('/'); + + var res = 2; + mk(file); + + mk(file); + + function mk (file, cb) { + mkdirp(file, _0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }) + }); + } +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/rel.js b/legacy-libs/grpc/node_modules/mkdirp/test/rel.js new file mode 100644 index 0000000..4ddb342 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/rel.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('rel', function (t) { + t.plan(5); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var cwd = process.cwd(); + process.chdir('/tmp'); + + var file = [x,y,z].join('/'); + + mkdirp(file, _0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + process.chdir(cwd); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }) + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/return.js b/legacy-libs/grpc/node_modules/mkdirp/test/return.js new file mode 100644 index 0000000..bce68e5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/return.js @@ -0,0 +1,25 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('return value', function (t) { + t.plan(4); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + // should return the first dir created. + // By this point, it would be profoundly surprising if /tmp didn't + // already exist, since every other test makes things in there. + mkdirp(file, function (err, made) { + t.ifError(err); + t.equal(made, '/tmp/' + x); + mkdirp(file, function (err, made) { + t.ifError(err); + t.equal(made, null); + }); + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/return_sync.js b/legacy-libs/grpc/node_modules/mkdirp/test/return_sync.js new file mode 100644 index 0000000..7c222d3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/return_sync.js @@ -0,0 +1,24 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('return value', function (t) { + t.plan(2); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + // should return the first dir created. + // By this point, it would be profoundly surprising if /tmp didn't + // already exist, since every other test makes things in there. + // Note that this will throw on failure, which will fail the test. + var made = mkdirp.sync(file); + t.equal(made, '/tmp/' + x); + + // making the same file again should have no effect. + made = mkdirp.sync(file); + t.equal(made, null); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/root.js b/legacy-libs/grpc/node_modules/mkdirp/test/root.js new file mode 100644 index 0000000..9e7d079 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/root.js @@ -0,0 +1,19 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; +var _0755 = parseInt('0755', 8); + +test('root', function (t) { + // '/' on unix, 'c:/' on windows. + var file = path.resolve('/'); + + mkdirp(file, _0755, function (err) { + if (err) throw err + fs.stat(file, function (er, stat) { + if (er) throw er + t.ok(stat.isDirectory(), 'target is a directory'); + t.end(); + }) + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/sync.js b/legacy-libs/grpc/node_modules/mkdirp/test/sync.js new file mode 100644 index 0000000..8c8dc93 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/sync.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('sync', function (t) { + t.plan(4); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + try { + mkdirp.sync(file, _0755); + } catch (err) { + t.fail(err); + return t.end(); + } + + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/umask.js b/legacy-libs/grpc/node_modules/mkdirp/test/umask.js new file mode 100644 index 0000000..2033c63 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/umask.js @@ -0,0 +1,28 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('implicit mode from umask', function (t) { + t.plan(5); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + mkdirp(file, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0777 & (~process.umask())); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }) + }); +}); diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/umask_sync.js b/legacy-libs/grpc/node_modules/mkdirp/test/umask_sync.js new file mode 100644 index 0000000..11a7614 --- /dev/null +++ b/legacy-libs/grpc/node_modules/mkdirp/test/umask_sync.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('umask sync modes', function (t) { + t.plan(4); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + try { + mkdirp.sync(file); + } catch (err) { + t.fail(err); + return t.end(); + } + + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, (_0777 & (~process.umask()))); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); diff --git a/legacy-libs/grpc/node_modules/needle/README.md b/legacy-libs/grpc/node_modules/needle/README.md new file mode 100644 index 0000000..149bacc --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/README.md @@ -0,0 +1,593 @@ +Needle +====== + +[![NPM](https://nodei.co/npm/needle.png)](https://nodei.co/npm/needle/) + +The leanest and most handsome HTTP client in the Nodelands. + +```js +var needle = require('needle'); + +needle.get('http://www.google.com', function(error, response) { + if (!error && response.statusCode == 200) + console.log(response.body); +}); +``` + +Callbacks not floating your boat? Needle got your back. + +``` js +var data = { + file: '/home/johnlennon/walrus.png', + content_type: 'image/png' +}; + +// the callback is optional, and needle returns a `readableStream` object +// that triggers a 'done' event when the request/response process is complete. +needle + .post('https://my.server.com/foo', data, { multipart: true }) + .on('readable', function() { /* eat your chunks */ }) + .on('done', function(err, resp) { + console.log('Ready-o!'); + }) +``` + +From version 2.0.x up, Promises are also supported. Just call `needle()` directly and you'll get a native Promise object. + +```js +needle('put', 'https://hacking.the.gibson/login', { password: 'god' }, { json: true }) + .then(function(response) { + return doSomethingWith(response) + }) + .catch(function(err) { + console.log('Call the locksmith!') + }) +``` + +With only two real dependencies, Needle supports: + + - HTTP/HTTPS requests, with the usual verbs you would expect + - All of Node's native TLS options, such as 'rejectUnauthorized' (see below) + - Basic & Digest authentication with auto-detection + - Multipart form-data (e.g. file uploads) + - HTTP Proxy forwarding, optionally with authentication + - Streaming gzip or deflate decompression + - Automatic XML & JSON parsing + - 301/302/303 redirect following, with fine-grained tuning, and + - Streaming non-UTF-8 charset decoding, via `iconv-lite` + +And yes, Mr. Wayne, it does come in black. + +This makes Needle an ideal alternative for performing quick HTTP requests in Node, either for API interaction, downloading or uploading streams of data, and so on. If you need OAuth, AWS support or anything fancier, you should check out mikeal's request module. + +Install +------- + +``` +$ npm install needle +``` + +Usage +----- + +```js +// using promises +needle('get', 'https://server.com/posts/12') + .then(function(resp) { + // ... + }) + .catch(function(err) { + // ... + }); + +// with callback +needle.get('ifconfig.me/all.json', function(error, response, body) { + if (error) throw error; + + // body is an alias for `response.body`, + // that in this case holds a JSON-decoded object. + console.log(body.ip_addr); +}); + +// no callback, using streams +var out = fs.createWriteStream('logo.png'); +needle.get('https://google.com/images/logo.png').pipe(out).on('finish', function() { + console.log('Pipe finished!'); +}); +``` + +As you can see, you can use Needle with Promises or without them. When using Promises or when a callback is passed, the response's body will be buffered and written to `response.body`, and the callback will be fired when all of the data has been collected and processed (e.g. decompressed, decoded and/or parsed). + +When no callback is passed, however, the buffering logic will be skipped but the response stream will still go through Needle's processing pipeline, so you get all the benefits of post-processing while keeping the streamishness we all love from Node. + +Response pipeline +----------------- + +Depending on the response's Content-Type, Needle will either attempt to parse JSON or XML streams, or, if a text response was received, will ensure that the final encoding you get is UTF-8. + +You can also request a gzip/deflated response, which, if sent by the server, will be processed before parsing or decoding is performed. + +```js +needle.get('http://stackoverflow.com/feeds', { compressed: true }, function(err, resp) { + console.log(resp.body); // this little guy won't be a Gzipped binary blob + // but a nice object containing all the latest entries +}); +``` + +Or in anti-callback mode, using a few other options: + +```js +var options = { + compressed : true, // sets 'Accept-Encoding' to 'gzip,deflate' + follow_max : 5, // follow up to five redirects + rejectUnauthorized : true // verify SSL certificate +} + +var stream = needle.get('https://backend.server.com/everything.html', options); + +// read the chunks from the 'readable' event, so the stream gets consumed. +stream.on('readable', function() { + while (data = this.read()) { + console.log(data.toString()); + } +}) + +stream.on('done', function(err) { + // if our request had an error, our 'done' event will tell us. + if (!err) console.log('Great success!'); +}) +``` + +API +--- + +### needle(method, url[, data][, options][, callback]) `(> 2.0.x)` + +Calling `needle()` directly returns a Promise. Besides `method` and `url`, all parameters are optional, although when sending a `post`, `put` or `patch` request you will get an error if `data` is not present. + +```js +needle('get', 'http://some.url.com') + .then(function(resp) { console.log(resp.body) }) + .catch(function(err) { console.error(err) }) +}) +``` + +Except from the above, all of Needle's request methods return a Readable stream, and both `options` and `callback` are optional. If passed, the callback will return three arguments: `error`, `response` and `body`, which is basically an alias for `response.body`. + +### needle.head(url[, options][, callback]) + +```js +needle.head('https://my.backend.server.com', { + open_timeout: 5000 // if we're not able to open a connection in 5 seconds, boom. +}, function(err, resp) { + if (err) + console.log('Shoot! Something is wrong: ' + err.message) + else + console.log('Yup, still alive.') +}) +``` + +### needle.get(url[, options][, callback]) + +```js +needle.get('google.com/search?q=syd+barrett', function(err, resp) { + // if no http:// is found, Needle will automagically prepend it. +}); +``` + +### needle.post(url, data[, options][, callback]) + +```js +var options = { + headers: { 'X-Custom-Header': 'Bumbaway atuna' } +} + +needle.post('https://my.app.com/endpoint', 'foo=bar', options, function(err, resp) { + // you can pass params as a string or as an object. +}); +``` + +### needle.put(url, data[, options][, callback]) + +```js +var nested = { + params: { + are: { + also: 'supported' + } + } +} + +needle.put('https://api.app.com/v2', nested, function(err, resp) { + console.log('Got ' + resp.bytes + ' bytes.') // another nice treat from this handsome fella. +}); +``` + +### needle.patch(url, data[, options][, callback]) + +Same behaviour as PUT. + +### needle.delete(url, data[, options][, callback]) + +```js +var options = { + username: 'fidelio', + password: 'x' +} + +needle.delete('https://api.app.com/messages/123', null, options, function(err, resp) { + // in this case, data may be null, but you need to explicity pass it. +}); +``` + +### needle.request(method, url, data[, options][, callback]) + +Generic request. This not only allows for flexibility, but also lets you perform a GET request with data, in which case will be appended to the request as a query string, unless you pass a `json: true` option (read below). + +```js +var params = { + q : 'a very smart query', + page : 2 +} + +needle.request('get', 'forum.com/search', params, function(err, resp) { + if (!err && resp.statusCode == 200) + console.log(resp.body); // here you go, mister. +}); +``` + +Now, if you set pass `json: true` among the options, Needle won't set your params as a querystring but instead send a JSON representation of your data through the request's body, as well as set the `Content-Type` and `Accept` headers to `application/json`. + +```js +needle.request('get', 'forum.com/search', params, { json: true }, function(err, resp) { + if (resp.statusCode == 200) console.log('It worked!'); +}); +``` + +Events +------ + +The [Readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable) object returned by the above request methods emits the following events, in addition to the regular ones (e.g. `end`, `close`, `data`, `pipe`, `readable`). + +### Event: `'response'` + + - `response ` + +Emitted when the underlying [http.ClientRequest](https://nodejs.org/api/http.html#http_class_http_clientrequest) emits a response event. This is after the connection is established and the header received, but before any of it is processed (e.g. authorization required or redirect to be followed). No data has been consumed at this point. + +### Event: `'redirect'` + + - `location ` + +Indicates that the a redirect is being followed. This means that the response code was a redirect (`301`, `302`, `303`, `307`) and the given [redirect options](#redirect-options) allowed following the URL received in the `Location` header. + +### Event: `'header'` + + - `statusCode ` + - `headers ` + +Triggered after the header has been processed, and just before the data is to be consumed. This implies that no redirect was followed and/or authentication header was received. In other words, we got a "valid" response. + +### Event: `'done'` (previously 'end') + + - `exception ` (optional) + +Emitted when the request/response process has finished, either because all data was consumed or an error ocurred somewhere in between. Unlike a regular stream's `end` event, Needle's `done` will be fired either on success or on failure, which is why the first argument may be an Error object. In other words: + +```js +var resp = needle.get('something.worthy/of/being/streamed/by/needle'); +resp.pipe(someWritableStream); + +resp.on('done', function(err) { + if (err) console.log('An error ocurred: ' + err.message); + else console.log('Great success!'); +}) +``` + +### Event: `'err'` + + - `exception ` + +Emitted when an error ocurrs. This should only happen once in the lifecycle of a Needle request. + +### Event: `'timeout'` + + - `type ` + +Emitted when an timeout error occurs. Type can be either 'open', 'response', or 'read'. This will called right before aborting the request, which will also trigger an `err` event, a described above, with an `ECONNRESET` (Socket hang up) exception. + +Request options +--------------- + +For information about options that've changed, there's always [the changelog](https://github.com/tomas/needle/releases). + + - `agent` : Uses an [http.Agent](https://nodejs.org/api/http.html#http_class_http_agent) of your choice, instead of the global, default one. Useful for tweaking the behaviour at the connection level, such as when doing tunneling (see below for an example). + - `json` : When `true`, sets content type to `application/json` and sends request body as JSON string, instead of a query string. + - `open_timeout`: (or `timeout`) Returns error if connection takes longer than X milisecs to establish. Defaults to `10000` (10 secs). `0` means no timeout. + - `response_timeout`: Returns error if no response headers are received in X milisecs, counting from when the connection is opened. Defaults to `0` (no response timeout). + - `read_timeout`: Returns error if data transfer takes longer than X milisecs, once response headers are received. Defaults to `0` (no timeout). + - `follow_max` : (or `follow`) Number of redirects to follow. Defaults to `0`. See below for more redirect options. + - `multipart` : Enables multipart/form-data encoding. Defaults to `false`. Use it when uploading files. + - `proxy` : Forwards request through HTTP(s) proxy. Eg. `proxy: 'http://user:pass@proxy.server.com:3128'`. For more advanced proxying/tunneling use a custom `agent`, as described below. + - `headers` : Object containing custom HTTP headers for request. Overrides defaults described below. + - `auth` : Determines what to do with provided username/password. Options are `auto`, `digest` or `basic` (default). `auto` will detect the type of authentication depending on the response headers. + - `stream_length`: When sending streams, this lets you manually set the Content-Length header --if the stream's bytecount is known beforehand--, preventing ECONNRESET (socket hang up) errors on some servers that misbehave when receiving payloads of unknown size. Set it to `0` and Needle will get and set the stream's length for you, or leave unset for the default behaviour, which is no Content-Length header for stream payloads. + - `localAddress` : , IP address. Passed to http/https request. Local interface from witch the request should be emitted. + +Response options +---------------- + + - `decode_response` : (or `decode`) Whether to decode the text responses to UTF-8, if Content-Type header shows a different charset. Defaults to `true`. + - `parse_response` : (or `parse`) Whether to parse XML or JSON response bodies automagically. Defaults to `true`. You can also set this to 'xml' or 'json' in which case Needle will *only* parse the response if the content type matches. + - `output` : Dump response output to file. This occurs after parsing and charset decoding is done. + - `parse_cookies` : Whether to parse response’s `Set-Cookie` header. Defaults to `true`. If parsed, response cookies will be available at `resp.cookies`. + +HTTP Header options +------------------- + +These are basically shortcuts to the `headers` option described above. + + - `cookies` : Builds and sets a Cookie header from a `{ key: 'value' }` object. + - `compressed`: If `true`, sets 'Accept-Encoding' header to 'gzip,deflate', and inflates content if zipped. Defaults to `false`. + - `username` : For HTTP basic auth. + - `password` : For HTTP basic auth. Requires username to be passed, but is optional. + - `accept` : Sets 'Accept' HTTP header. Defaults to `*/*`. + - `connection`: Sets 'Connection' HTTP header. Not set by default, unless running Node < 0.11.4 in which case it defaults to `close`. More info about this below. + - `user_agent`: Sets the 'User-Agent' HTTP header. Defaults to `Needle/{version} (Node.js {node_version})`. + - `content_type`: Sets the 'Content-Type' header. Unset by default, unless you're sending data in which case it's set accordingly to whatever is being sent (`application/x-www-form-urlencoded`, `application/json` or `multipart/form-data`). That is, of course, unless the option is passed, either here or through `options.headers`. You're the boss. + +Node.js TLS Options +------------------- + +These options are passed directly to `https.request` if present. Taken from the [original documentation](http://nodejs.org/docs/latest/api/https.html): + + - `pfx` : Certificate, Private key and CA certificates to use for SSL. + - `key` : Private key to use for SSL. + - `passphrase` : A string of passphrase for the private key or pfx. + - `cert` : Public x509 certificate to use. + - `ca` : An authority certificate or array of authority certificates to check the remote host against. + - `ciphers` : A string describing the ciphers to use or exclude. + - `rejectUnauthorized` : If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. + - `secureProtocol` : The SSL method to use, e.g. SSLv3_method to force SSL version 3. + +Redirect options +---------------- + +These options only apply if the `follow_max` (or `follow`) option is higher than 0. + + - `follow_set_cookies` : Sends the cookies received in the `set-cookie` header as part of the following request. `false` by default. + - `follow_set_referer` : Sets the 'Referer' header to the requested URI when following a redirect. `false` by default. + - `follow_keep_method` : If enabled, resends the request using the original verb instead of being rewritten to `get` with no data. `false` by default. + - `follow_if_same_host` : When true, Needle will only follow redirects that point to the same host as the original request. `false` by default. + - `follow_if_same_protocol` : When true, Needle will only follow redirects that point to the same protocol as the original request. `false` by default. + +Overriding Defaults +------------------- + +Yes sir, we have it. Needle includes a `defaults()` method, that lets you override some of the defaults for all future requests. Like this: + +```js +needle.defaults({ + open_timeout: 60000, + user_agent: 'MyApp/1.2.3', + parse_response: false }); +``` + +This will override Needle's default user agent and 10-second timeout, and disable response parsing, so you don't need to pass those options in every other request. + +More advanced Proxy support +--------------------------- + +Since you can pass a custom HTTPAgent to Needle you can do all sorts of neat stuff. For example, if you want to use the [`tunnel`](https://github.com/koichik/node-tunnel) module for HTTPS proxying, you can do this: + +```js +var tunnel = require('tunnel'); +var myAgent = tunnel.httpOverHttp({ + proxy: { host: 'localhost' } +}); + +needle.get('foobar.com', { agent: myAgent }); +``` + +Regarding the 'Connection' header +--------------------------------- + +Unless you're running an old version of Node (< 0.11.4), by default Needle won't set the Connection header on requests, yielding Node's default behaviour of keeping the connection alive with the target server. This speeds up inmensely the process of sending several requests to the same host. + +On older versions, however, this has the unwanted behaviour of preventing the runtime from exiting, either because of a bug or 'feature' that was changed on 0.11.4. To overcome this Needle does set the 'Connection' header to 'close' on those versions, however this also means that making new requests to the same host doesn't benefit from Keep-Alive. + +So if you're stuck on 0.10 or even lower and want full speed, you can simply set the Connection header to 'Keep-Alive' by using `{ connection: 'Keep-Alive' }`. Please note, though, that an event loop handler will prevent the runtime from exiting so you'll need to manually call `process.exit()` or the universe will collapse. + +Examples Galore +--------------- + +### HTTPS GET with Basic Auth + +```js +needle.get('https://api.server.com', { username: 'you', password: 'secret' }, + function(err, resp) { + // used HTTP auth +}); +``` + +Or use [RFC-1738](http://tools.ietf.org/html/rfc1738#section-3.1) basic auth URL syntax: + +```js +needle.get('https://username:password@api.server.com', function(err, resp) { + // used HTTP auth from URL +}); +``` + +### Digest Auth + +```js +needle.get('other.server.com', { username: 'you', password: 'secret', auth: 'digest' }, + function(err, resp, body) { + // needle prepends 'http://' to your URL, if missing +}); +``` + +### Custom Accept header, deflate + +```js +var options = { + compressed : true, + follow : 10, + accept : 'application/vnd.github.full+json' +} + +needle.get('api.github.com/users/tomas', options, function(err, resp, body) { + // body will contain a JSON.parse(d) object + // if parsing fails, you'll simply get the original body +}); +``` + +### GET XML object + +```js +needle.get('https://news.ycombinator.com/rss', function(err, resp, body) { + // you'll get a nice object containing the nodes in the RSS +}); +``` + +### GET binary, output to file + +```js +needle.get('http://upload.server.com/tux.png', { output: '/tmp/tux.png' }, function(err, resp, body) { + // you can dump any response to a file, not only binaries. +}); +``` + +### GET through proxy + +```js +needle.get('http://search.npmjs.org', { proxy: 'http://localhost:1234' }, function(err, resp, body) { + // request passed through proxy +}); +``` + +### GET a very large document in a stream (from 0.7+) + +```js +var stream = needle.get('http://www.as35662.net/100.log'); + +stream.on('readable', function() { + var chunk; + while (chunk = this.read()) { + console.log('got data: ', chunk); + } +}); +``` + +### GET JSON object in a stream (from 0.7+) + +```js +var stream = needle.get('http://jsonplaceholder.typicode.com/db', { parse: true }); + +stream.on('readable', function() { + var node; + + // our stream will only emit a single JSON root node. + while (node = this.read()) { + console.log('got data: ', node); + } +}); +``` + +### GET JSONStream flexible parser with search query (from 0.7+) + +```js + + // The 'data' element of this stream will be the string representation + // of the titles of all posts. + +needle.get('http://jsonplaceholder.typicode.com/db', { parse: true }) + .pipe(new JSONStream.parse('posts.*.title')); + .on('data', function (obj) { + console.log('got post title: %s', obj); + }); +``` + +### File upload using multipart, passing file path + +```js +var data = { + foo: 'bar', + image: { file: '/home/tomas/linux.png', content_type: 'image/png' } +} + +needle.post('http://my.other.app.com', data, { multipart: true }, function(err, resp, body) { + // needle will read the file and include it in the form-data as binary +}); +``` + +### Stream upload, PUT or POST + +``` js +needle.put('https://api.app.com/v2', fs.createReadStream('myfile.txt'), function(err, resp, body) { + // stream content is uploaded verbatim +}); +``` + +### Multipart POST, passing data buffer + +```js +var buffer = fs.readFileSync('/path/to/package.zip'); + +var data = { + zip_file: { + buffer : buffer, + filename : 'mypackage.zip', + content_type : 'application/octet-stream' + } +} + +needle.post('http://somewhere.com/over/the/rainbow', data, { multipart: true }, function(err, resp, body) { + // if you see, when using buffers we need to pass the filename for the multipart body. + // you can also pass a filename when using the file path method, in case you want to override + // the default filename to be received on the other end. +}); +``` + +### Multipart with custom Content-Type + +```js +var data = { + token: 'verysecret', + payload: { + value: JSON.stringify({ title: 'test', version: 1 }), + content_type: 'application/json' + } +} + +needle.post('http://test.com/', data, { timeout: 5000, multipart: true }, function(err, resp, body) { + // in this case, if the request takes more than 5 seconds + // the callback will return a [Socket closed] error +}); +``` + +For even more examples, check out the examples directory in the repo. + +### Testing + +To run tests, you need to generate a self-signed SSL certificate in the `test` directory. After cloning the repository, run the following commands: + + $ mkdir -p test/keys + $ openssl genrsa -out test/keys/ssl.key 2048 + $ openssl req -new -key test/keys/ssl.key -x509 -days 999 -out test/keys/ssl.cert + +Then you should be able to run `npm test` once you have the dependencies in place. + +> Note: Tests currently only work on linux-based environments that have `/proc/self/fd`. They *do not* work on MacOS environments. +> You can use Docker to run tests by creating a container and mounting the needle project directory on `/app` +> `docker create --name Needle -v /app -w /app -v /app/node_modules -i node:argon` + +Credits +------- + +Written by Tomás Pollak, with the help of contributors. + +Copyright +--------- + +(c) Fork Ltd. Licensed under the MIT license. diff --git a/legacy-libs/grpc/node_modules/needle/bin/needle b/legacy-libs/grpc/node_modules/needle/bin/needle new file mode 100644 index 0000000..baaa79b --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/bin/needle @@ -0,0 +1,40 @@ +#!/usr/bin/env node +var needle = require('./../lib/needle'); + +function exit(code, str) { + console.log(str) || process.exit(code); +} + +function usage() { + var out = ['Usage: needle [get|head|post|put|delete] url [query]']; + out.push('Examples: \n needle get google.com\n needle post server.com/api foo=bar'); + exit(1, out.join('\n')) +} + +if (process.argv[2] == '-v' || process.argv[2] == '--version') + exit(0, needle.version); +else if (process.argv[2] == null) + usage(); + +var method = process.argv[2], + url = process.argv[3], + options = { compressed: true, parse_response: true, follow_max: 5, timeout: 10000 }; + +if (!needle[method]) { + url = method; + method = 'get'; +} + +var callback = function(err, resp) { + if (err) return exit(1, "Error: " + err.message); + + if (process.argv.indexOf('-i') != -1) + console.log(resp.headers) || console.log(''); + + console.log(resp.body.toString()); +}; + +if (method == 'post' || method == 'put') + needle[method](url, process.argv[4], options, callback); +else + needle[method](url, options, callback); diff --git a/legacy-libs/grpc/node_modules/needle/examples/deflated-stream.js b/legacy-libs/grpc/node_modules/needle/examples/deflated-stream.js new file mode 100644 index 0000000..4e771b7 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/examples/deflated-stream.js @@ -0,0 +1,22 @@ +var fs = require('fs'), + stream = require('stream'), + needle = require('./../'); + +var url = 'http://ibl.gamechaser.net/f/tagqfxtteucbuldhezkz/bt_level1.gz'; + +var resp = needle.get(url, { compressed: true, follow_max: 10 }); +console.log('Downloading...'); + +resp.on('readable', function() { + + while (data = this.read()) { + var lines = data.toString().split('\n'); + console.log('Got ' + lines.length + ' items.'); + // console.log(lines); + } + +}) + +resp.on('done', function(data) { + console.log('Done'); +}) diff --git a/legacy-libs/grpc/node_modules/needle/examples/digest-auth.js b/legacy-libs/grpc/node_modules/needle/examples/digest-auth.js new file mode 100644 index 0000000..5b8e5d5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/examples/digest-auth.js @@ -0,0 +1,16 @@ +var needle = require('./..'); + +var opts = { + username: 'user3', + password: 'user3', + auth: 'digest' +} + +needle.get('http://test.webdav.org/auth-digest/', opts, function(err, resp, body) { + console.log(resp.headers); + + if (resp.statusCode == 401) + console.log('\nIt failed.') + else + console.log('\nIt worked!') +}); diff --git a/legacy-libs/grpc/node_modules/needle/examples/download-to-file.js b/legacy-libs/grpc/node_modules/needle/examples/download-to-file.js new file mode 100644 index 0000000..39d5af9 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/examples/download-to-file.js @@ -0,0 +1,18 @@ +var fs = require('fs'), + needle = require('./..'), + path = require('path'); + +var url = process.argv[2] || 'https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png'; +var file = path.basename(url); + +console.log('Downloading ' + file); + +needle.get(url, { output: file, follow: 3 }, function(err, resp, data){ + console.log('File saved: ' + process.cwd() + '/' + file); + + var size = fs.statSync(file).size; + if (size == resp.bytes) + console.log(resp.bytes + ' bytes written to file.'); + else + throw new Error('File size mismatch: ' + size + ' != ' + resp.bytes); +}); diff --git a/legacy-libs/grpc/node_modules/needle/examples/multipart-stream.js b/legacy-libs/grpc/node_modules/needle/examples/multipart-stream.js new file mode 100644 index 0000000..df1ada6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/examples/multipart-stream.js @@ -0,0 +1,25 @@ +var needle = require('./../'); + +var url = 'http://posttestserver.com/post.php?dir=needle'; + +var black_pixel = Buffer.from("R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", 'base64'); + +var data = { + foo: 'bar', + nested: { + test: 123 + }, + image: { buffer: black_pixel, content_type: 'image/gif' } +} + +var resp = needle.post(url, data, { multipart: true }); + +resp.on('readable', function() { + while (data = this.read()) { + console.log(data.toString()); + } +}) + +resp.on('done', function(data) { + console.log('Done.'); +}) diff --git a/legacy-libs/grpc/node_modules/needle/examples/parsed-stream.js b/legacy-libs/grpc/node_modules/needle/examples/parsed-stream.js new file mode 100644 index 0000000..89c22c6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/examples/parsed-stream.js @@ -0,0 +1,23 @@ +////////////////////////////////////////// +// This example demonstrates what happends +// when you use the built-in JSON parser. +////////////////////////////////////////// + +var fs = require('fs'), + stream = require('stream'), + needle = require('./../'); + +var url = 'http://ip.jsontest.com/', + resp = needle.get(url, { parse: true }); + +resp.on('readable', function(obj) { + var chunk; + + while (chunk = this.read()) { + console.log('root = ', chunk); + } +}); + +resp.on('done', function() { + console.log('Done.'); +}); diff --git a/legacy-libs/grpc/node_modules/needle/examples/parsed-stream2.js b/legacy-libs/grpc/node_modules/needle/examples/parsed-stream2.js new file mode 100644 index 0000000..5d9b79a --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/examples/parsed-stream2.js @@ -0,0 +1,21 @@ +////////////////////////////////////////// +// This example illustrates a more complex +// example of parsing a JSON stream. +////////////////////////////////////////// + +var needle = require('./../'), + JSONStream = require('JSONStream'); + +var url = 'http://jsonplaceholder.typicode.com/db'; + +// Initialize our GET request with our default (JSON) +// parsers disabled. + +var json = new needle.get(url, {parse: false}) + // And now interpret the stream as JSON, returning only the + // title of all the posts. + .pipe(new JSONStream.parse('posts.*.title')); + +json.on('data', function (obj) { + console.log('got title: \'' + obj + '\''); +}) diff --git a/legacy-libs/grpc/node_modules/needle/examples/stream-events.js b/legacy-libs/grpc/node_modules/needle/examples/stream-events.js new file mode 100644 index 0000000..6230993 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/examples/stream-events.js @@ -0,0 +1,23 @@ +var needle = require('./..'); + +var resp = needle.get('google.com', { follow_max: 10, timeout: 5000 }); + +resp.on('readable', function() { + var chunk; + while (chunk = this.read()) { + console.log('Got ' + chunk.length + ' bytes'); + } +}) + +resp.on('headers', function(headers) { + console.log('Got headers', headers); +}) + +resp.on('redirect', function(url) { + console.log('Redirected to url ' + url); +}) + +resp.on('done', function(err) { + console.log('Finished. No more data to receive.'); + if (err) console.log('With error', err) +}) diff --git a/legacy-libs/grpc/node_modules/needle/examples/stream-to-file.js b/legacy-libs/grpc/node_modules/needle/examples/stream-to-file.js new file mode 100644 index 0000000..d261bee --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/examples/stream-to-file.js @@ -0,0 +1,14 @@ +var fs = require('fs'), + needle = require('./..'), + path = require('path'); + +var url = process.argv[2] || 'http://www.google.com/images/errors/robot.png'; +var file = path.basename(url); + +console.log('Downloading ' + file + '...'); +needle + .get(url) + .pipe(fs.createWriteStream(file)) + .on('done', function() { + console.log('Done!') + }) diff --git a/legacy-libs/grpc/node_modules/needle/examples/upload-image.js b/legacy-libs/grpc/node_modules/needle/examples/upload-image.js new file mode 100644 index 0000000..090e3e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/examples/upload-image.js @@ -0,0 +1,51 @@ +var needle = require('../'), + path = require('path'); + +var image = 'https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png'; + +function upload(obj, cb) { + console.log('Uploading image...'); + + var url = 'http://deviantsart.com'; + + var opts = { + timeout: 10000, + follow: 3, + multipart: true + }; + + var params = { + file: obj + } + + needle.post(url, params, opts, function(err, resp) { + if (err || !resp.body.match('url')) + return cb(err || new Error('No image URL found.')) + + cb(null, JSON.parse(resp.body).url) + }) +} + +function download(url, cb) { + console.log('Getting ' + url); + needle.get(url, function(err, resp) { + if (err) throw err; + + cb(null, resp.body); + }) +} + +//////////////////////////////////////// +// ok, now go. + +download(image, function(err, buffer) { + if (err) throw err; + + var obj = { buffer: buffer, content_type: 'image/png' }; + + upload(obj, function(err, url) { + if (err) throw err; + + console.log('Image uploaded to ' + url); + }) +}) diff --git a/legacy-libs/grpc/node_modules/needle/lib/auth.js b/legacy-libs/grpc/node_modules/needle/lib/auth.js new file mode 100644 index 0000000..b7ed4ca --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/lib/auth.js @@ -0,0 +1,110 @@ +var createHash = require('crypto').createHash; + +function get_header(header, credentials, opts) { + var type = header.split(' ')[0], + user = credentials[0], + pass = credentials[1]; + + if (type == 'Digest') { + return digest.generate(header, user, pass, opts.method, opts.path); + } else if (type == 'Basic') { + return basic(user, pass); + } +} + +//////////////////// +// basic + +function md5(string) { + return createHash('md5').update(string).digest('hex'); +} + +function basic(user, pass) { + var str = typeof pass == 'undefined' ? user : [user, pass].join(':'); + return 'Basic ' + Buffer.from(str).toString('base64'); +} + +//////////////////// +// digest +// logic inspired from https://github.com/simme/node-http-digest-client + +var digest = {}; + +digest.parse_header = function(header) { + var challenge = {}, + matches = header.match(/([a-z0-9_-]+)="?([a-z0-9=\/\.@\s-]+)"?/gi); + + for (var i = 0, l = matches.length; i < l; i++) { + var parts = matches[i].split('='), + key = parts.shift(), + val = parts.join('=').replace(/^"/, '').replace(/"$/, ''); + + challenge[key] = val; + } + + return challenge; +} + +digest.update_nc = function(nc) { + var max = 99999999; + nc++; + + if (nc > max) + nc = 1; + + var padding = new Array(8).join('0') + ''; + nc = nc + ''; + return padding.substr(0, 8 - nc.length) + nc; +} + +digest.generate = function(header, user, pass, method, path) { + + var nc = 1, + cnonce = null, + challenge = digest.parse_header(header); + + var ha1 = md5(user + ':' + challenge.realm + ':' + pass), + ha2 = md5(method.toUpperCase() + ':' + path), + resp = [ha1, challenge.nonce]; + + if (typeof challenge.qop === 'string') { + cnonce = md5(Math.random().toString(36)).substr(0, 8); + nc = digest.update_nc(nc); + resp = resp.concat(nc, cnonce); + } + + resp = resp.concat(challenge.qop, ha2); + + var params = { + uri : path, + realm : challenge.realm, + nonce : challenge.nonce, + username : user, + response : md5(resp.join(':')) + } + + if (challenge.qop) { + params.qop = challenge.qop; + } + + if (challenge.opaque) { + params.opaque = challenge.opaque; + } + + if (cnonce) { + params.nc = nc; + params.cnonce = cnonce; + } + + header = [] + for (var k in params) + header.push(k + '="' + params[k] + '"') + + return 'Digest ' + header.join(', '); +} + +module.exports = { + header : get_header, + basic : basic, + digest : digest.generate +} diff --git a/legacy-libs/grpc/node_modules/needle/lib/cookies.js b/legacy-libs/grpc/node_modules/needle/lib/cookies.js new file mode 100644 index 0000000..0f48afc --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/lib/cookies.js @@ -0,0 +1,79 @@ + +// Simple cookie handling implementation based on the standard RFC 6265. +// +// This module just has two functionalities: +// - Parse a set-cookie-header as a key value object +// - Write a cookie-string from a key value object +// +// All cookie attributes are ignored. + +var unescape = require('querystring').unescape; + +var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/; +var EXCLUDED_CHARS = /[\x00-\x1F\x7F\x3B\x3B\s\"\,\\"%]/g; +var TRAILING_SEMICOLON = /\x3B+$/; +var SEP_SEMICOLON = /\s*\x3B\s*/; + +// i know these should be 'const', but I'd like to keep +// supporting earlier node.js versions as long as I can. :) + +var KEY_INDEX = 1; // index of key from COOKIE_PAIR match +var VALUE_INDEX = 3; // index of value from COOKIE_PAIR match + +// Returns a copy str trimmed and without trainling semicolon. +function cleanCookieString(str) { + return str.trim().replace(/\x3B+$/, ''); +} + +function getFirstPair(str) { + var index = str.indexOf('\x3B'); + return index === -1 ? str : str.substr(0, index); +} + +// Returns a encoded copy of str based on RFC6265 S4.1.1. +function encodeCookieComponent(str) { + return str.toString().replace(EXCLUDED_CHARS, encodeURIComponent); +} + +// Parses a set-cookie-string based on the standard defined in RFC6265 S4.1.1. +function parseSetCookieString(str) { + str = cleanCookieString(str); + str = getFirstPair(str); + + var res = COOKIE_PAIR.exec(str); + if (!res || !res[VALUE_INDEX]) return null; + + return { + name : unescape(res[KEY_INDEX]), + value : unescape(res[VALUE_INDEX]) + }; +} + +// Parses a set-cookie-header and returns a key/value object. +// Each key represents the name of a cookie. +function parseSetCookieHeader(header) { + if (!header) return {}; + header = Array.isArray(header) ? header : [header]; + + return header.reduce(function(res, str) { + var cookie = parseSetCookieString(str); + if (cookie) res[cookie.name] = cookie.value; + return res; + }, {}); +} + +// Writes a set-cookie-string based on the standard definded in RFC6265 S4.1.1. +function writeCookieString(obj) { + return Object.keys(obj).reduce(function(str, name) { + var encodedName = encodeCookieComponent(name); + var encodedValue = encodeCookieComponent(obj[name]); + str += (str ? '; ' : '') + encodedName + '=' + encodedValue; + return str; + }, ''); +} + +// returns a key/val object from an array of cookie strings +exports.read = parseSetCookieHeader; + +// writes a cookie string header +exports.write = writeCookieString; diff --git a/legacy-libs/grpc/node_modules/needle/lib/decoder.js b/legacy-libs/grpc/node_modules/needle/lib/decoder.js new file mode 100644 index 0000000..d82bb5a --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/lib/decoder.js @@ -0,0 +1,53 @@ +var iconv, + inherits = require('util').inherits, + stream = require('stream'); + +var regex = /(?:charset|encoding)\s*=\s*['"]? *([\w\-]+)/i; + +inherits(StreamDecoder, stream.Transform); + +function StreamDecoder(charset) { + if (!(this instanceof StreamDecoder)) + return new StreamDecoder(charset); + + stream.Transform.call(this, charset); + this.charset = charset; + this.parsed_chunk = false; +} + +StreamDecoder.prototype._transform = function(chunk, encoding, done) { + var res, found; + + // try get charset from chunk, just once + if (this.charset == 'iso-8859-1' && !this.parsed_chunk) { + this.parsed_chunk = true; + + var matches = regex.exec(chunk.toString()); + if (matches) { + found = matches[1].toLowerCase(); + this.charset = found == 'utf-8' ? 'utf8' : found; + } + } + + try { + res = iconv.decode(chunk, this.charset); + } catch(e) { // something went wrong, just return original chunk + res = chunk; + } + + this.push(res); + done(); +} + +module.exports = function(charset) { + try { + if (!iconv) iconv = require('iconv-lite'); + } catch(e) { + /* iconv not found */ + } + + if (iconv) + return new StreamDecoder(charset); + else + return new stream.PassThrough; +} diff --git a/legacy-libs/grpc/node_modules/needle/lib/multipart.js b/legacy-libs/grpc/node_modules/needle/lib/multipart.js new file mode 100644 index 0000000..d1e6e18 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/lib/multipart.js @@ -0,0 +1,98 @@ +var readFile = require('fs').readFile, + basename = require('path').basename; + +exports.build = function(data, boundary, callback) { + + if (typeof data != 'object' || typeof data.pipe == 'function') + return callback(new Error('Multipart builder expects data as key/val object.')); + + var body = '', + object = flatten(data), + count = Object.keys(object).length; + + if (count === 0) + return callback(new Error('Empty multipart body. Invalid data.')) + + function done(err, section) { + if (err) return callback(err); + if (section) body += section; + --count || callback(null, body + '--' + boundary + '--'); + }; + + for (var key in object) { + var value = object[key]; + if (value === null || typeof value == 'undefined') { + done(); + } else if (Buffer.isBuffer(value)) { + var part = { buffer: value, content_type: 'application/octet-stream' }; + generate_part(key, part, boundary, done); + } else { + var part = (value.buffer || value.file || value.content_type) ? value : { value: value }; + generate_part(key, part, boundary, done); + } + } + +} + +function generate_part(name, part, boundary, callback) { + + var return_part = '--' + boundary + '\r\n'; + return_part += 'Content-Disposition: form-data; name="' + name + '"'; + + function append(data, filename) { + + if (data) { + var binary = part.content_type.indexOf('text') == -1; + return_part += '; filename="' + encodeURIComponent(filename) + '"\r\n'; + if (binary) return_part += 'Content-Transfer-Encoding: binary\r\n'; + return_part += 'Content-Type: ' + part.content_type + '\r\n\r\n'; + return_part += binary ? data.toString('binary') : data.toString('utf8'); + } + + callback(null, return_part + '\r\n'); + }; + + if ((part.file || part.buffer) && part.content_type) { + + var filename = part.filename ? part.filename : part.file ? basename(part.file) : name; + if (part.buffer) return append(part.buffer, filename); + + readFile(part.file, function(err, data) { + if (err) return callback(err); + append(data, filename); + }); + + } else { + + if (typeof part.value == 'object') + return callback(new Error('Object received for ' + name + ', expected string.')) + + if (part.content_type) { + return_part += '\r\n'; + return_part += 'Content-Type: ' + part.content_type; + } + + return_part += '\r\n\r\n'; + return_part += Buffer.from(String(part.value), 'utf8').toString('binary'); + append(); + + } + +} + +// flattens nested objects for multipart body +function flatten(object, into, prefix) { + into = into || {}; + + for(var key in object) { + var prefix_key = prefix ? prefix + '[' + key + ']' : key; + var prop = object[key]; + + if (prop && typeof prop === 'object' && !(prop.buffer || prop.file || prop.content_type)) + flatten(prop, into, prefix_key) + else + into[prefix_key] = prop; + } + + return into; +} diff --git a/legacy-libs/grpc/node_modules/needle/lib/needle.js b/legacy-libs/grpc/node_modules/needle/lib/needle.js new file mode 100644 index 0000000..001007c --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/lib/needle.js @@ -0,0 +1,797 @@ +////////////////////////////////////////// +// Needle -- HTTP Client for Node.js +// Written by Tomás Pollak +// (c) 2012-2017 - Fork Ltd. +// MIT Licensed +////////////////////////////////////////// + +var fs = require('fs'), + http = require('http'), + https = require('https'), + url = require('url'), + stream = require('stream'), + debug = require('debug')('needle'), + stringify = require('./querystring').build, + multipart = require('./multipart'), + auth = require('./auth'), + cookies = require('./cookies'), + parsers = require('./parsers'), + decoder = require('./decoder'); + +////////////////////////////////////////// +// variabilia + +var version = require('../package.json').version; + +var user_agent = 'Needle/' + version; +user_agent += ' (Node.js ' + process.version + '; ' + process.platform + ' ' + process.arch + ')'; + +var tls_options = 'agent pfx key passphrase cert ca ciphers rejectUnauthorized secureProtocol checkServerIdentity'; + +// older versions of node (< 0.11.4) prevent the runtime from exiting +// because of connections in keep-alive state. so if this is the case +// we'll default new requests to set a Connection: close header. +var close_by_default = !http.Agent || http.Agent.defaultMaxSockets != Infinity; + +// see if we have Object.assign. otherwise fall back to util._extend +var extend = Object.assign ? Object.assign : require('util')._extend; + +// these are the status codes that Needle interprets as redirects. +var redirect_codes = [301, 302, 303, 307]; + +////////////////////////////////////////// +// decompressors for gzip/deflate bodies + +var decompressors = {}; + +try { + + var zlib = require('zlib'); + decompressors['x-deflate'] = zlib.Inflate; + decompressors['deflate'] = zlib.Inflate; + decompressors['x-gzip'] = zlib.Gunzip; + decompressors['gzip'] = zlib.Gunzip; + + // Enable Z_SYNC_FLUSH to avoid Z_BUF_ERROR errors (Node PR #2595) + var zlib_options = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + } + +} catch(e) { /* zlib not available */ } + +////////////////////////////////////////// +// options and aliases + +var defaults = { + // data + boundary : '--------------------NODENEEDLEHTTPCLIENT', + encoding : 'utf8', + parse_response : 'all', // same as true. valid options: 'json', 'xml' or false/null + proxy : null, + + // headers + accept : '*/*', + user_agent : user_agent, + + // numbers + open_timeout : 10000, + response_timeout : 0, + read_timeout : 0, + follow_max : 0, + stream_length : -1, + + // booleans + decode_response : true, + parse_cookies : true, + follow_set_cookies : false, + follow_set_referer : false, + follow_keep_method : false, + follow_if_same_host : false, + follow_if_same_protocol : false +} + +var aliased = { + options: { + decode : 'decode_response', + parse : 'parse_response', + timeout : 'open_timeout', + follow : 'follow_max' + }, + inverted: {} +} + +// only once, invert aliased keys so we can get passed options. +Object.keys(aliased.options).map(function(k) { + var value = aliased.options[k]; + aliased.inverted[value] = k; +}); + +////////////////////////////////////////// +// helpers + +function keys_by_type(type) { + return Object.keys(defaults).map(function(el) { + if (defaults[el] !== null && defaults[el].constructor == type) + return el; + }).filter(function(el) { return el }) +} + +function parse_content_type(header) { + if (!header || header === '') return {}; + + var found, charset = 'iso-8859-1', arr = header.split(';'); + + if (arr.length > 1 && (found = arr[1].match(/charset=(.+)/))) + charset = found[1]; + + return { type: arr[0], charset: charset }; +} + +function is_stream(obj) { + return typeof obj.pipe === 'function'; +} + +function get_stream_length(stream, given_length, cb) { + if (given_length > 0) + return cb(given_length); + + if (stream.end !== void 0 && stream.end !== Infinity && stream.start !== void 0) + return cb((stream.end + 1) - (stream.start || 0)); + + fs.stat(stream.path, function(err, stat) { + cb(stat ? stat.size - (stream.start || 0) : null); + }); +} + +////////////////////////////////////////// +// the main act + +function Needle(method, uri, data, options, callback) { + // if (!(this instanceof Needle)) { + // return new Needle(method, uri, data, options, callback); + // } + + if (typeof uri !== 'string') + throw new TypeError('URL must be a string, not ' + uri); + + this.method = method; + this.uri = uri; + this.data = data; + + if (typeof options == 'function') { + this.callback = options; + this.options = {}; + } else { + this.callback = callback; + this.options = options; + } + +} + +Needle.prototype.setup = function(uri, options) { + + function get_option(key, fallback) { + // if original is in options, return that value + if (typeof options[key] != 'undefined') return options[key]; + + // otherwise, return value from alias or fallback/undefined + return typeof options[aliased.inverted[key]] != 'undefined' + ? options[aliased.inverted[key]] : fallback; + } + + function check_value(expected, key) { + var value = get_option(key), + type = typeof value; + + if (type != 'undefined' && type != expected) + throw new TypeError(type + ' received for ' + key + ', but expected a ' + expected); + + return (type == expected) ? value : defaults[key]; + } + + ////////////////////////////////////////////////// + // the basics + + var config = { + http_opts : { + localAddress: get_option('localAddress', undefined) + }, // passed later to http.request() directly + output : options.output, + proxy : get_option('proxy', defaults.proxy), + parser : get_option('parse_response', defaults.parse_response), + encoding : options.encoding || (options.multipart ? 'binary' : defaults.encoding) + } + + keys_by_type(Boolean).forEach(function(key) { + config[key] = check_value('boolean', key); + }) + + keys_by_type(Number).forEach(function(key) { + config[key] = check_value('number', key); + }) + + // populate http_opts with given TLS options + tls_options.split(' ').forEach(function(key) { + if (typeof options[key] != 'undefined') { + config.http_opts[key] = options[key]; + if (typeof options.agent == 'undefined') + config.http_opts.agent = false; // otherwise tls options are skipped + } + }); + + ////////////////////////////////////////////////// + // headers, cookies + + config.headers = { + 'accept' : options.accept || defaults.accept, + 'user-agent' : options.user_agent || defaults.user_agent + } + + if (options.content_type) + config.headers['content-type'] = options.content_type; + + // set connection header if opts.connection was passed, or if node < 0.11.4 (close) + if (options.connection || close_by_default) + config.headers['connection'] = options.connection || 'close'; + + if ((options.compressed || defaults.compressed) && typeof zlib != 'undefined') + config.headers['accept-encoding'] = 'gzip,deflate'; + + if (options.cookies) + config.headers['cookie'] = cookies.write(options.cookies); + + ////////////////////////////////////////////////// + // basic/digest auth + + if (uri.match(/[^\/]@/)) { // url contains user:pass@host, so parse it. + var parts = (url.parse(uri).auth || '').split(':'); + options.username = parts[0]; + options.password = parts[1]; + } + + if (options.username) { + if (options.auth && (options.auth == 'auto' || options.auth == 'digest')) { + config.credentials = [options.username, options.password]; + } else { + config.headers['authorization'] = auth.basic(options.username, options.password); + } + } + + // if proxy is present, set auth header from either url or proxy_user option. + if (config.proxy) { + if (config.proxy.indexOf('http') === -1) + config.proxy = 'http://' + config.proxy; + + if (config.proxy.indexOf('@') !== -1) { + var proxy = (url.parse(config.proxy).auth || '').split(':'); + options.proxy_user = proxy[0]; + options.proxy_pass = proxy[1]; + } + + if (options.proxy_user) + config.headers['proxy-authorization'] = auth.basic(options.proxy_user, options.proxy_pass); + } + + // now that all our headers are set, overwrite them if instructed. + for (var h in options.headers) + config.headers[h.toLowerCase()] = options.headers[h]; + + return config; +} + +Needle.prototype.start = function() { + + var out = new stream.PassThrough({ objectMode: false }), + uri = this.uri, + data = this.data, + method = this.method, + callback = (typeof this.options == 'function') ? this.options : this.callback, + options = this.options || {}; + + // if no 'http' is found on URL, prepend it. + if (uri.indexOf('http') === -1) + uri = uri.replace(/^(\/\/)?/, 'http://'); + + var self = this, body, waiting = false, config = this.setup(uri, options); + + // unless options.json was set to false, assume boss also wants JSON if content-type matches. + var json = options.json || (options.json !== false && config.headers['content-type'] == 'application/json'); + + if (data) { + + if (options.multipart) { // boss says we do multipart. so we do it. + var boundary = options.boundary || defaults.boundary; + + waiting = true; + multipart.build(data, boundary, function(err, parts) { + if (err) throw(err); + + config.headers['content-type'] = 'multipart/form-data; boundary=' + boundary; + next(parts); + }); + + } else if (is_stream(data)) { + + if (method.toUpperCase() == 'GET') + throw new Error('Refusing to pipe() a stream via GET. Did you mean .post?'); + + if (config.stream_length > 0 || (config.stream_length === 0 && data.path)) { + // ok, let's get the stream's length and set it as the content-length header. + // this prevents some servers from cutting us off before all the data is sent. + waiting = true; + get_stream_length(data, config.stream_length, function(length) { + data.length = length; + next(data); + }) + + } else { + // if the boss doesn't want us to get the stream's length, or if it doesn't + // have a file descriptor for that purpose, then just head on. + body = data; + } + + } else if (Buffer.isBuffer(data)) { + + body = data; // use the raw buffer as request body. + + } else if (method.toUpperCase() == 'GET' && !json) { + + // append the data to the URI as a querystring. + uri = uri.replace(/\?.*|$/, '?' + stringify(data)); + + } else { // string or object data, no multipart. + + // if string, leave it as it is, otherwise, stringify. + body = (typeof(data) === 'string') ? data + : json ? JSON.stringify(data) : stringify(data); + + // ensure we have a buffer so bytecount is correct. + body = Buffer.from(body, config.encoding); + } + + } + + function next(body) { + if (body) { + if (body.length) config.headers['content-length'] = body.length; + + // if no content-type was passed, determine if json or not. + if (!config.headers['content-type']) { + config.headers['content-type'] = json + ? 'application/json; charset=utf-8' + : 'application/x-www-form-urlencoded'; // no charset says W3 spec. + } + } + + // unless a specific accept header was set, assume json: true wants JSON back. + if (options.json && (!options.accept && !(options.headers || {}).accept)) + config.headers['accept'] = 'application/json'; + + self.send_request(1, method, uri, config, body, out, callback); + } + + if (!waiting) next(body); + return out; +} + +Needle.prototype.get_request_opts = function(method, uri, config) { + var opts = config.http_opts, + proxy = config.proxy, + remote = proxy ? url.parse(proxy) : url.parse(uri); + + opts.protocol = remote.protocol; + opts.host = remote.hostname; + opts.port = remote.port || (remote.protocol == 'https:' ? 443 : 80); + opts.path = proxy ? uri : remote.pathname + (remote.search || ''); + opts.method = method; + opts.headers = config.headers; + + if (!opts.headers['host']) { + // if using proxy, make sure the host header shows the final destination + var target = proxy ? url.parse(uri) : remote; + opts.headers['host'] = target.hostname; + + // and if a non standard port was passed, append it to the port header + if (target.port && [80, 443].indexOf(target.port) === -1) { + opts.headers['host'] += ':' + target.port; + } + } + + return opts; +} + +Needle.prototype.should_follow = function(location, config, original) { + if (!location) return false; + + // returns true if location contains matching property (host or protocol) + function matches(property) { + var property = original[property]; + return location.indexOf(property) !== -1; + } + + // first, check whether the requested location is actually different from the original + if (location === original) + return false; + + if (config.follow_if_same_host && !matches('host')) + return false; // host does not match, so not following + + if (config.follow_if_same_protocol && !matches('protocol')) + return false; // procotol does not match, so not following + + return true; +} + +Needle.prototype.send_request = function(count, method, uri, config, post_data, out, callback) { + + var timer, + returned = 0, + self = this, + request_opts = this.get_request_opts(method, uri, config), + protocol = request_opts.protocol == 'https:' ? https : http; + + function done(err, resp) { + if (returned++ > 0) + return debug('Already finished, stopping here.'); + + if (timer) clearTimeout(timer); + request.removeListener('error', had_error); + + if (callback) + return callback(err, resp, resp ? resp.body : undefined); + + // NOTE: this event used to be called 'end', but the behaviour was confusing + // when errors ocurred, because the stream would still emit an 'end' event. + out.emit('done', err); + } + + function had_error(err) { + debug('Request error', err); + out.emit('err', err); + done(err || new Error('Unknown error when making request.')); + } + + function set_timeout(type, milisecs) { + if (timer) clearTimeout(timer); + if (milisecs <= 0) return; + + timer = setTimeout(function() { + out.emit('timeout', type); + request.abort(); + // also invoke done() to terminate job on read_timeout + if (type == 'read') done(new Error(type + ' timeout')); + }, milisecs); + } + + // handle errors on the underlying socket, that may be closed while writing + // for an example case, see test/long_string_spec.js. we make sure this + // scenario ocurred by verifying the socket's writable & destroyed states. + function on_socket_end() { + if (!this.writable && this.destroyed === false) { + this.destroy(); + had_error(new Error('Remote end closed socket abruptly.')) + } + } + + debug('Making request #' + count, request_opts); + var request = protocol.request(request_opts, function(resp) { + + var headers = resp.headers; + debug('Got response', resp.statusCode, headers); + out.emit('response', resp); + + set_timeout('read', config.read_timeout); + + // if we got cookies, parse them unless we were instructed not to. make sure to include any + // cookies that might have been set on previous redirects. + if (config.parse_cookies && (headers['set-cookie'] || config.stored_cookies)) { + resp.cookies = extend(config.stored_cookies || {}, cookies.read(headers['set-cookie'])); + debug('Got cookies', resp.cookies); + } + + // if redirect code is found, determine if we should follow it according to the given options. + if (redirect_codes.indexOf(resp.statusCode) !== -1 && self.should_follow(headers.location, config, uri)) { + // clear timer before following redirects to prevent unexpected setTimeout consequence + clearTimeout(timer); + + if (count <= config.follow_max) { + out.emit('redirect', headers.location); + + // unless 'follow_keep_method' is true, rewrite the request to GET before continuing. + if (!config.follow_keep_method) { + method = 'GET'; + post_data = null; + delete config.headers['content-length']; // in case the original was a multipart POST request. + } + + // if follow_set_cookies is true, make sure to put any cookies in the next request's headers. + if (config.follow_set_cookies && resp.cookies) { + config.stored_cookies = resp.cookies; + config.headers['cookie'] = cookies.write(resp.cookies); + } + + if (config.follow_set_referer) + config.headers['referer'] = encodeURI(uri); // the original, not the destination URL. + + config.headers['host'] = null; // clear previous Host header to avoid conflicts. + + debug('Redirecting to ' + url.resolve(uri, headers.location)); + return self.send_request(++count, method, url.resolve(uri, headers.location), config, post_data, out, callback); + } else if (config.follow_max > 0) { + return done(new Error('Max redirects reached. Possible loop in: ' + headers.location)); + } + } + + // if auth is requested and credentials were not passed, resend request, provided we have user/pass. + if (resp.statusCode == 401 && headers['www-authenticate'] && config.credentials) { + if (!config.headers['authorization']) { // only if authentication hasn't been sent + var auth_header = auth.header(headers['www-authenticate'], config.credentials, request_opts); + + if (auth_header) { + config.headers['authorization'] = auth_header; + return self.send_request(count, method, uri, config, post_data, out, callback); + } + } + } + + // ok, so we got a valid (non-redirect & authorized) response. let's notify the stream guys. + out.emit('header', resp.statusCode, headers); + out.emit('headers', headers); + + var pipeline = [], + mime = parse_content_type(headers['content-type']), + text_response = mime.type && mime.type.indexOf('text/') != -1; + + // To start, if our body is compressed and we're able to inflate it, do it. + if (headers['content-encoding'] && decompressors[headers['content-encoding']]) { + + var decompressor = decompressors[headers['content-encoding']](zlib_options); + + // make sure we catch errors triggered by the decompressor. + decompressor.on('error', had_error); + pipeline.push(decompressor); + } + + // If parse is enabled and we have a parser for it, then go for it. + if (config.parser && parsers[mime.type]) { + + // If a specific parser was requested, make sure we don't parse other types. + var parser_name = config.parser.toString().toLowerCase(); + if (['xml', 'json'].indexOf(parser_name) == -1 || parsers[mime.type].name == parser_name) { + + // OK, so either we're parsing all content types or the one requested matches. + out.parser = parsers[mime.type].name; + pipeline.push(parsers[mime.type].fn()); + + // Set objectMode on out stream to improve performance. + out._writableState.objectMode = true; + out._readableState.objectMode = true; + } + + // If we're not parsing, and unless decoding was disabled, we'll try + // decoding non UTF-8 bodies to UTF-8, using the iconv-lite library. + } else if (text_response && config.decode_response + && mime.charset && !mime.charset.match(/utf-?8$/i)) { + pipeline.push(decoder(mime.charset)); + } + + // And `out` is the stream we finally push the decoded/parsed output to. + pipeline.push(out); + + // Now, release the kraken! + var tmp = resp; + while (pipeline.length) { + tmp = tmp.pipe(pipeline.shift()); + } + + // If the user has requested and output file, pipe the output stream to it. + // In stream mode, we will still get the response stream to play with. + if (config.output && resp.statusCode == 200) { + + // for some reason, simply piping resp to the writable stream doesn't + // work all the time (stream gets cut in the middle with no warning). + // so we'll manually need to do the readable/write(chunk) trick. + var file = fs.createWriteStream(config.output); + file.on('error', had_error); + + out.on('end', function() { + if (file.writable) file.end(); + }); + + file.on('close', function() { + delete out.file; + }) + + out.on('readable', function() { + var chunk; + while ((chunk = this.read()) !== null) { + if (file.writable) file.write(chunk); + + // if callback was requested, also push it to resp.body + if (resp.body) resp.body.push(chunk); + } + }) + + out.file = file; + } + + // Only aggregate the full body if a callback was requested. + if (callback) { + resp.raw = []; + resp.body = []; + resp.bytes = 0; + + // Gather and count the amount of (raw) bytes using a PassThrough stream. + var clean_pipe = new stream.PassThrough(); + resp.pipe(clean_pipe); + + clean_pipe.on('readable', function() { + var chunk; + while ((chunk = this.read()) != null) { + resp.bytes += chunk.length; + resp.raw.push(chunk); + } + }) + + // Listen on the 'readable' event to aggregate the chunks, but only if + // file output wasn't requested. Otherwise we'd have two stream readers. + if (!config.output || resp.statusCode != 200) { + out.on('readable', function() { + var chunk; + while ((chunk = this.read()) !== null) { + // We're either pushing buffers or objects, never strings. + if (typeof chunk == 'string') chunk = Buffer.from(chunk); + + // Push all chunks to resp.body. We'll bind them in resp.end(). + resp.body.push(chunk); + } + }) + } + } + + // And set the .body property once all data is in. + out.on('end', function() { + if (resp.body) { // callback mode + + // we want to be able to access to the raw data later, so keep a reference. + resp.raw = Buffer.concat(resp.raw); + + // if parse was successful, we should have an array with one object + if (resp.body[0] !== undefined && !Buffer.isBuffer(resp.body[0])) { + + // that's our body right there. + resp.body = resp.body[0]; + + // set the parser property on our response. we may want to check. + if (out.parser) resp.parser = out.parser; + + } else { // we got one or several buffers. string or binary. + resp.body = Buffer.concat(resp.body); + + // if we're here and parsed is true, it means we tried to but it didn't work. + // so given that we got a text response, let's stringify it. + if (text_response || out.parser) { + resp.body = resp.body.toString(); + } + } + } + + // if an output file is being written to, make sure the callback + // is triggered after all data has been written to it. + if (out.file) { + out.file.on('close', function() { + done(null, resp, resp.body); + }) + } else { // elvis has left the building. + done(null, resp, resp.body); + } + + }); + + }); // end request call + + // unless open_timeout was disabled, set a timeout to abort the request. + set_timeout('open', config.open_timeout); + + // handle errors on the request object. things might get bumpy. + request.on('error', had_error); + + // make sure timer is cleared if request is aborted (issue #257) + request.once('abort', function() { + if (timer) clearTimeout(timer); + }) + + // handle socket 'end' event to ensure we don't get delayed EPIPE errors. + request.once('socket', function(socket) { + if (socket.connecting) { + socket.once('connect', function() { + set_timeout('response', config.response_timeout); + }) + } else { + set_timeout('response', config.response_timeout); + } + + // console.log(socket); + if (!socket.on_socket_end) { + socket.on_socket_end = on_socket_end; + socket.once('end', function() { process.nextTick(on_socket_end.bind(socket)) }); + } + }) + + if (post_data) { + if (is_stream(post_data)) { + post_data.pipe(request); + } else { + request.write(post_data, config.encoding); + request.end(); + } + } else { + request.end(); + } + + out.request = request; + return out; +} + +////////////////////////////////////////// +// exports + +if (typeof Promise !== 'undefined') { + module.exports = function() { + var verb, args = [].slice.call(arguments); + + if (args[0].match(/\.|\//)) // first argument looks like a URL + verb = (args.length > 2) ? 'post' : 'get'; + else + verb = args.shift(); + + if (verb.match(/get|head/) && args.length == 2) + args.splice(1, 0, null); // assume no data if head/get with two args (url, options) + + return new Promise(function(resolve, reject) { + module.exports.request(verb, args[0], args[1], args[2], function(err, resp) { + return err ? reject(err) : resolve(resp); + }); + }) + } +} + +module.exports.version = version; + +module.exports.defaults = function(obj) { + for (var key in obj) { + var target_key = aliased.options[key] || key; + + if (defaults.hasOwnProperty(target_key) && typeof obj[key] != 'undefined') { + if (target_key != 'parse_response' && target_key != 'proxy') { + // ensure type matches the original, except for proxy/parse_response that can be null/bool or string + var valid_type = defaults[target_key].constructor.name; + + if (obj[key].constructor.name != valid_type) + throw new TypeError('Invalid type for ' + key + ', should be ' + valid_type); + } + defaults[target_key] = obj[key]; + } else { + throw new Error('Invalid property for defaults:' + target_key); + } + } + + return defaults; +} + +'head get'.split(' ').forEach(function(method) { + module.exports[method] = function(uri, options, callback) { + return new Needle(method, uri, null, options, callback).start(); + } +}) + +'post put patch delete'.split(' ').forEach(function(method) { + module.exports[method] = function(uri, data, options, callback) { + return new Needle(method, uri, data, options, callback).start(); + } +}) + +module.exports.request = function(method, uri, data, opts, callback) { + return new Needle(method, uri, data, opts, callback).start(); +}; diff --git a/legacy-libs/grpc/node_modules/needle/lib/parsers.js b/legacy-libs/grpc/node_modules/needle/lib/parsers.js new file mode 100644 index 0000000..108b17b --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/lib/parsers.js @@ -0,0 +1,120 @@ +////////////////////////////////////////// +// Defines mappings between content-type +// and the appropriate parsers. +////////////////////////////////////////// + +var Transform = require('stream').Transform; +var sax = require('sax'); + +function parseXML(str, cb) { + var obj, current, parser = sax.parser(true, { trim: true, lowercase: true }) + parser.onerror = parser.onend = done; + + function done(err) { + parser.onerror = parser.onend = function() { } + cb(err, obj) + } + + function newElement(name, attributes) { + return { + name: name || '', + value: '', + attributes: attributes || {}, + children: [] + } + } + + parser.ontext = function(t) { + if (current) current.value += t + } + + parser.onopentag = function(node) { + var element = newElement(node.name, node.attributes) + if (current) { + element.parent = current + current.children.push(element) + } else { // root object + obj = element + } + + current = element + }; + + parser.onclosetag = function() { + if (typeof current.parent !== 'undefined') { + var just_closed = current + current = current.parent + delete just_closed.parent + } + } + + parser.write(str).close() +} + +function parserFactory(name, fn) { + + function parser() { + var chunks = [], + stream = new Transform({ objectMode: true }); + + // Buffer all our data + stream._transform = function(chunk, encoding, done) { + chunks.push(chunk); + done(); + } + + // And call the parser when all is there. + stream._flush = function(done) { + var self = this, + data = Buffer.concat(chunks); + + try { + fn(data, function(err, result) { + if (err) throw err; + self.push(result); + }); + } catch (err) { + self.push(data); // just pass the original data + } finally { + done(); + } + } + + return stream; + } + + return { fn: parser, name: name }; +} + +var parsers = {} + +function buildParser(name, types, fn) { + var parser = parserFactory(name, fn); + types.forEach(function(type) { + parsers[type] = parser; + }) +} + +buildParser('json', [ + 'application/json', + 'text/javascript' +], function(buffer, cb) { + var err, data; + try { data = JSON.parse(buffer); } catch (e) { err = e; } + cb(err, data); +}); + +buildParser('xml', [ + 'text/xml', + 'application/xml', + 'application/rdf+xml', + 'application/rss+xml', + 'application/atom+xml' +], function(buffer, cb) { + parseXML(buffer.toString(), function(err, obj) { + cb(err, obj) + }) +}); + +module.exports = parsers; +module.exports.use = buildParser; \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/needle/lib/querystring.js b/legacy-libs/grpc/node_modules/needle/lib/querystring.js new file mode 100644 index 0000000..e58cc42 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/lib/querystring.js @@ -0,0 +1,49 @@ +// based on the qs module, but handles null objects as expected +// fixes by Tomas Pollak. + +var toString = Object.prototype.toString; + +function stringify(obj, prefix) { + if (prefix && (obj === null || typeof obj == 'undefined')) { + return prefix + '='; + } else if (toString.call(obj) == '[object Array]') { + return stringifyArray(obj, prefix); + } else if (toString.call(obj) == '[object Object]') { + return stringifyObject(obj, prefix); + } else if (toString.call(obj) == '[object Date]') { + return obj.toISOString(); + } else if (prefix) { // string inside array or hash + return prefix + '=' + encodeURIComponent(String(obj)); + } else if (String(obj).indexOf('=') !== -1) { // string with equal sign + return String(obj); + } else { + throw new TypeError('Cannot build a querystring out of: ' + obj); + } +}; + +function stringifyArray(arr, prefix) { + var ret = []; + + for (var i = 0, len = arr.length; i < len; i++) { + if (prefix) + ret.push(stringify(arr[i], prefix + '[]')); + else + ret.push(stringify(arr[i])); + } + + return ret.join('&'); +} + +function stringifyObject(obj, prefix) { + var ret = []; + + Object.keys(obj).forEach(function(key) { + ret.push(stringify(obj[key], prefix + ? prefix + '[' + encodeURIComponent(key) + ']' + : encodeURIComponent(key))); + }) + + return ret.join('&'); +} + +exports.build = stringify; diff --git a/legacy-libs/grpc/node_modules/needle/license.txt b/legacy-libs/grpc/node_modules/needle/license.txt new file mode 100644 index 0000000..fb245f3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/license.txt @@ -0,0 +1,19 @@ +Copyright (c) Fork, Ltd. + +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/legacy-libs/grpc/node_modules/needle/node_modules/debug/CHANGELOG.md b/legacy-libs/grpc/node_modules/needle/node_modules/debug/CHANGELOG.md new file mode 100644 index 0000000..820d21e --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/LICENSE b/legacy-libs/grpc/node_modules/needle/node_modules/debug/LICENSE new file mode 100644 index 0000000..658c933 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(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/legacy-libs/grpc/node_modules/needle/node_modules/debug/README.md b/legacy-libs/grpc/node_modules/needle/node_modules/debug/README.md new file mode 100644 index 0000000..0ee7634 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/debug/README.md @@ -0,0 +1,437 @@ +# 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 +``` + +## 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/legacy-libs/grpc/node_modules/needle/node_modules/debug/node.js b/legacy-libs/grpc/node_modules/needle/node_modules/debug/node.js new file mode 100644 index 0000000..7fc36fe --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/debug/node.js @@ -0,0 +1 @@ +module.exports = require('./src/node'); diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/package.json b/legacy-libs/grpc/node_modules/needle/node_modules/debug/package.json new file mode 100644 index 0000000..0b6ab5d --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/debug/package.json @@ -0,0 +1,94 @@ +{ + "_from": "debug@^3.2.6", + "_id": "debug@3.2.6", + "_inBundle": false, + "_integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "_location": "/grpc/needle/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@^3.2.6", + "name": "debug", + "escapedName": "debug", + "rawSpec": "^3.2.6", + "saveSpec": null, + "fetchSpec": "^3.2.6" + }, + "_requiredBy": [ + "/grpc/needle" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "_shasum": "e83d17de16d8a7efb7717edbe5fb10135eee629b", + "_shrinkwrap": null, + "_spec": "debug@^3.2.6", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/needle", + "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" + } + ], + "dependencies": { + "ms": "^2.1.1" + }, + "deprecated": false, + "description": "small debugging utility", + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "xo": "^0.23.0" + }, + "files": [ + "src", + "node.js", + "dist/debug.js", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/visionmedia/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "optionalDependencies": {}, + "readme": "# debug\n[![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)\n[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)\n\n\n\nA tiny JavaScript debugging utility modelled after Node.js core's debugging\ntechnique. Works in Node.js and web browsers.\n\n## Installation\n\n```bash\n$ npm install debug\n```\n\n## Usage\n\n`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.\n\nExample [_app.js_](./examples/node/app.js):\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %o', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample [_worker.js_](./examples/node/worker.js):\n\n```js\nvar a = require('debug')('worker:a')\n , b = require('debug')('worker:b');\n\nfunction work() {\n a('doing lots of uninteresting work');\n setTimeout(work, Math.random() * 1000);\n}\n\nwork();\n\nfunction workb() {\n b('doing some work');\n setTimeout(workb, Math.random() * 2000);\n}\n\nworkb();\n```\n\nThe `DEBUG` environment variable is then used to enable these based on space or\ncomma-delimited names.\n\nHere are some examples:\n\n\"screen\n\"screen\n\"screen\n\n#### Windows command prompt notes\n\n##### CMD\n\nOn Windows the environment variable is set using the `set` command.\n\n```cmd\nset DEBUG=*,-not_this\n```\n\nExample:\n\n```cmd\nset DEBUG=* & node app.js\n```\n\n##### PowerShell (VS Code default)\n\nPowerShell uses different syntax to set environment variables.\n\n```cmd\n$env:DEBUG = \"*,-not_this\"\n```\n\nExample:\n\n```cmd\n$env:DEBUG='app';node app.js\n```\n\nThen, run the program to be debugged as usual.\n\nnpm script example:\n```js\n \"windowsDebug\": \"@powershell -Command $env:DEBUG='*';node app.js\",\n```\n\n## Namespace Colors\n\nEvery debug instance has a color generated for it based on its namespace name.\nThis helps when visually parsing the debug output to identify which debug instance\na debug line belongs to.\n\n#### Node.js\n\nIn Node.js, colors are enabled when stderr is a TTY. You also _should_ install\nthe [`supports-color`](https://npmjs.org/supports-color) module alongside debug,\notherwise debug will only use a small handful of basic colors.\n\n\n\n#### Web Browser\n\nColors are also enabled on \"Web Inspectors\" that understand the `%c` formatting\noption. These are WebKit web inspectors, Firefox ([since version\n31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))\nand the Firebug plugin for Firefox (any version).\n\n\n\n\n## Millisecond diff\n\nWhen 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.\n\n\n\nWhen stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:\n\n\n\n\n## Conventions\n\nIf 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.\n\n## Wildcards\n\nThe `*` character may be used as a wildcard. Suppose for example your library has\ndebuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\",\ninstead of listing all three with\n`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do\n`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\nYou can also exclude specific debuggers by prefixing them with a \"-\" character.\nFor example, `DEBUG=*,-connect:*` would include all debuggers except those\nstarting with \"connect:\".\n\n## Environment Variables\n\nWhen running through Node.js, you can set a few environment variables that will\nchange the behavior of the debug logging:\n\n| Name | Purpose |\n|-----------|-------------------------------------------------|\n| `DEBUG` | Enables/disables specific debugging namespaces. |\n| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |\n| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |\n| `DEBUG_DEPTH` | Object inspection depth. |\n| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |\n\n\n__Note:__ The environment variables beginning with `DEBUG_` end up being\nconverted into an Options object that gets used with `%o`/`%O` formatters.\nSee the Node.js documentation for\n[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)\nfor the complete list.\n\n## Formatters\n\nDebug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.\nBelow are the officially supported formatters:\n\n| Formatter | Representation |\n|-----------|----------------|\n| `%O` | Pretty-print an Object on multiple lines. |\n| `%o` | Pretty-print an Object all on a single line. |\n| `%s` | String. |\n| `%d` | Number (both integer and float). |\n| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |\n| `%%` | Single percent sign ('%'). This does not consume an argument. |\n\n\n### Custom formatters\n\nYou can add custom formatters by extending the `debug.formatters` object.\nFor example, if you wanted to add support for rendering a Buffer as hex with\n`%h`, you could do something like:\n\n```js\nconst createDebug = require('debug')\ncreateDebug.formatters.h = (v) => {\n return v.toString('hex')\n}\n\n// …elsewhere\nconst debug = createDebug('foo')\ndebug('this is hex: %h', new Buffer('hello world'))\n// foo this is hex: 68656c6c6f20776f726c6421 +0ms\n```\n\n\n## Browser Support\n\nYou can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),\nor just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),\nif you don't want to build it yourself.\n\nDebug's enable state is currently persisted by `localStorage`.\nConsider the situation shown below where you have `worker:a` and `worker:b`,\nand wish to debug both. You can enable this using `localStorage.debug`:\n\n```js\nlocalStorage.debug = 'worker:*'\n```\n\nAnd then refresh the page.\n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n b('doing some work');\n}, 1200);\n```\n\n\n## Output streams\n\n By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:\n\nExample [_stdout.js_](./examples/node/stdout.js):\n\n```js\nvar debug = require('debug');\nvar error = debug('app:error');\n\n// by default stderr is used\nerror('goes to stderr!');\n\nvar log = debug('app:log');\n// set this namespace to log via console.log\nlog.log = console.log.bind(console); // don't forget to bind to console!\nlog('goes to stdout');\nerror('still goes to stderr!');\n\n// set all output to go via console.info\n// overrides all per-namespace log settings\ndebug.log = console.info.bind(console);\nerror('now goes to stdout via console.info');\nlog('still goes to stdout, but via console.info now');\n```\n\n## Extend\nYou can simply extend debugger \n```js\nconst log = require('debug')('auth');\n\n//creates new debug instance with extended namespace\nconst logSign = log.extend('sign');\nconst logLogin = log.extend('login');\n\nlog('hello'); // auth hello\nlogSign('hello'); //auth:sign hello\nlogLogin('hello'); //auth:login hello\n```\n\n## Set dynamically\n\nYou can also enable debug dynamically by calling the `enable()` method :\n\n```js\nlet debug = require('debug');\n\nconsole.log(1, debug.enabled('test'));\n\ndebug.enable('test');\nconsole.log(2, debug.enabled('test'));\n\ndebug.disable();\nconsole.log(3, debug.enabled('test'));\n\n```\n\nprint : \n```\n1 false\n2 true\n3 false\n```\n\nUsage : \n`enable(namespaces)` \n`namespaces` can include modes separated by a colon and wildcards.\n \nNote that calling `enable()` completely overrides previously set DEBUG variable : \n\n```\n$ DEBUG=foo node -e 'var dbg = require(\"debug\"); dbg.enable(\"bar\"); console.log(dbg.enabled(\"foo\"))'\n=> false\n```\n\n## Checking whether a debug target is enabled\n\nAfter you've created a debug instance, you can determine whether or not it is\nenabled by checking the `enabled` property:\n\n```javascript\nconst debug = require('debug')('http');\n\nif (debug.enabled) {\n // do stuff...\n}\n```\n\nYou can also manually toggle this property to force the debug instance to be\nenabled or disabled.\n\n\n## Authors\n\n - TJ Holowaychuk\n - Nathan Rajlich\n - Andrew Rhyne\n\n## Backers\n\nSupport us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Sponsors\n\nBecome 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)]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "unpkg": "./dist/debug.js", + "version": "3.2.6" +} diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/browser.js b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/browser.js new file mode 100644 index 0000000..c924b0a --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/browser.js @@ -0,0 +1,180 @@ +"use strict"; + +function _typeof(obj) { 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-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ +exports.log = log; +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; + } + + var 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 + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (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.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + +function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); +} +/** + * 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() { + var 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); +var formatters = module.exports.formatters; +/** + * 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/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/common.js b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/common.js new file mode 100644 index 0000000..e0de3fb --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/common.js @@ -0,0 +1,249 @@ +"use strict"; + +/** + * 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(function (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) { + var hash = 0; + + for (var 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) { + var prevTime; + + function debug() { + // Disabled? + if (!debug.enabled) { + return; + } + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var 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 + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var 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); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + } + /** + * 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 = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var 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++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @api public + */ + + + function disable() { + createDebug.enable(''); + } + /** + * 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; + } + + var i; + var 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; + } + /** + * 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/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/index.js b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/index.js new file mode 100644 index 0000000..0217315 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/index.js @@ -0,0 +1,12 @@ +"use strict"; + +/** + * 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/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/node.js b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/node.js new file mode 100644 index 0000000..dbbb5f1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/node.js @@ -0,0 +1,174 @@ +"use strict"; + +/** + * Module dependencies. + */ +var tty = require('tty'); + +var 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 + var 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(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // Camel-case + var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) { + return k.toUpperCase(); + }); // Coerce string value into JS value + + var 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) { + var name = this.namespace, + useColors = this.useColors; + + if (useColors) { + var c = this.color; + var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c); + var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m"); + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[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() { + return process.stderr.write(util.format.apply(util, arguments) + '\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 = {}; + var keys = Object.keys(exports.inspectOpts); + + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); +var formatters = module.exports.formatters; +/** + * 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/legacy-libs/grpc/node_modules/needle/node_modules/ms/index.js b/legacy-libs/grpc/node_modules/needle/node_modules/ms/index.js new file mode 100644 index 0000000..c4498bc --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/ms/license.md b/legacy-libs/grpc/node_modules/needle/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, 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/legacy-libs/grpc/node_modules/needle/node_modules/ms/package.json b/legacy-libs/grpc/node_modules/needle/node_modules/ms/package.json new file mode 100644 index 0000000..71ca8d8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/ms/package.json @@ -0,0 +1,74 @@ +{ + "_from": "ms@^2.1.1", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/grpc/needle/ms", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ms@^2.1.1", + "name": "ms", + "escapedName": "ms", + "rawSpec": "^2.1.1", + "saveSpec": null, + "fetchSpec": "^2.1.1" + }, + "_requiredBy": [ + "/grpc/needle/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_shrinkwrap": null, + "_spec": "ms@^2.1.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/needle/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "optionalDependencies": {}, + "readme": "# ms\n\n[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)\n[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit)\n\nUse this package to easily convert various time formats to milliseconds.\n\n## Examples\n\n```js\nms('2 days') // 172800000\nms('1d') // 86400000\nms('10h') // 36000000\nms('2.5 hrs') // 9000000\nms('2h') // 7200000\nms('1m') // 60000\nms('5s') // 5000\nms('1y') // 31557600000\nms('100') // 100\nms('-3 days') // -259200000\nms('-1h') // -3600000\nms('-200') // -200\n```\n\n### Convert from Milliseconds\n\n```js\nms(60000) // \"1m\"\nms(2 * 60000) // \"2m\"\nms(-3 * 60000) // \"-3m\"\nms(ms('10 hours')) // \"10h\"\n```\n\n### Time Format Written-Out\n\n```js\nms(60000, { long: true }) // \"1 minute\"\nms(2 * 60000, { long: true }) // \"2 minutes\"\nms(-3 * 60000, { long: true }) // \"-3 minutes\"\nms(ms('10 hours'), { long: true }) // \"10 hours\"\n```\n\n## Features\n\n- Works both in [Node.js](https://nodejs.org) and in the browser\n- If a number is supplied to `ms`, a string with a unit is returned\n- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)\n- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned\n\n## Related Packages\n\n- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.\n\n## Caught a Bug?\n\n1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device\n2. Link the package to the global module directory: `npm link`\n3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!\n\nAs always, you can run the tests using: `npm test`\n", + "readmeFilename": "readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/ms/readme.md b/legacy-libs/grpc/node_modules/needle/node_modules/ms/readme.md new file mode 100644 index 0000000..9a1996b --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/legacy-libs/grpc/node_modules/needle/package.json b/legacy-libs/grpc/node_modules/needle/package.json new file mode 100644 index 0000000..1527e38 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/package.json @@ -0,0 +1,106 @@ +{ + "_from": "needle@^2.2.1", + "_id": "needle@2.4.0", + "_inBundle": false, + "_integrity": "sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==", + "_location": "/grpc/needle", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "needle@^2.2.1", + "name": "needle", + "escapedName": "needle", + "rawSpec": "^2.2.1", + "saveSpec": null, + "fetchSpec": "^2.2.1" + }, + "_requiredBy": [ + "/grpc/node-pre-gyp" + ], + "_resolved": "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz", + "_shasum": "6833e74975c444642590e15a750288c5f939b57c", + "_shrinkwrap": null, + "_spec": "needle@^2.2.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/node-pre-gyp", + "author": { + "name": "Tomás Pollak", + "email": "tomas@forkhq.com" + }, + "bin": { + "needle": "./bin/needle" + }, + "bugs": { + "url": "https://github.com/tomas/needle/issues" + }, + "bundleDependencies": false, + "dependencies": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + }, + "deprecated": false, + "description": "The leanest and most handsome HTTP client in the Nodelands.", + "devDependencies": { + "JSONStream": "^1.3.5", + "jschardet": "^1.6.0", + "mocha": "^5.2.0", + "q": "^1.5.1", + "should": "^13.2.3", + "sinon": "^2.3.0", + "xml2js": "^0.4.19" + }, + "directories": { + "lib": "./lib" + }, + "engines": { + "node": ">= 4.4.x" + }, + "homepage": "https://github.com/tomas/needle#readme", + "keywords": [ + "http", + "https", + "simple", + "request", + "client", + "multipart", + "upload", + "proxy", + "deflate", + "timeout", + "charset", + "iconv", + "cookie", + "redirect" + ], + "license": "MIT", + "main": "./lib/needle", + "name": "needle", + "optionalDependencies": {}, + "readme": "Needle\n======\n\n[![NPM](https://nodei.co/npm/needle.png)](https://nodei.co/npm/needle/)\n\nThe leanest and most handsome HTTP client in the Nodelands.\n\n```js\nvar needle = require('needle');\n\nneedle.get('http://www.google.com', function(error, response) {\n if (!error && response.statusCode == 200)\n console.log(response.body);\n});\n```\n\nCallbacks not floating your boat? Needle got your back.\n\n``` js\nvar data = {\n file: '/home/johnlennon/walrus.png',\n content_type: 'image/png'\n};\n\n// the callback is optional, and needle returns a `readableStream` object\n// that triggers a 'done' event when the request/response process is complete.\nneedle\n .post('https://my.server.com/foo', data, { multipart: true })\n .on('readable', function() { /* eat your chunks */ })\n .on('done', function(err, resp) {\n console.log('Ready-o!');\n })\n```\n\nFrom version 2.0.x up, Promises are also supported. Just call `needle()` directly and you'll get a native Promise object.\n\n```js\nneedle('put', 'https://hacking.the.gibson/login', { password: 'god' }, { json: true })\n .then(function(response) {\n return doSomethingWith(response)\n })\n .catch(function(err) {\n console.log('Call the locksmith!')\n })\n```\n\nWith only two real dependencies, Needle supports:\n\n - HTTP/HTTPS requests, with the usual verbs you would expect\n - All of Node's native TLS options, such as 'rejectUnauthorized' (see below)\n - Basic & Digest authentication with auto-detection\n - Multipart form-data (e.g. file uploads)\n - HTTP Proxy forwarding, optionally with authentication\n - Streaming gzip or deflate decompression\n - Automatic XML & JSON parsing\n - 301/302/303 redirect following, with fine-grained tuning, and\n - Streaming non-UTF-8 charset decoding, via `iconv-lite`\n\nAnd yes, Mr. Wayne, it does come in black.\n\nThis makes Needle an ideal alternative for performing quick HTTP requests in Node, either for API interaction, downloading or uploading streams of data, and so on. If you need OAuth, AWS support or anything fancier, you should check out mikeal's request module.\n\nInstall\n-------\n\n```\n$ npm install needle\n```\n\nUsage\n-----\n\n```js\n// using promises\nneedle('get', 'https://server.com/posts/12')\n .then(function(resp) {\n // ...\n })\n .catch(function(err) {\n // ...\n });\n\n// with callback\nneedle.get('ifconfig.me/all.json', function(error, response, body) {\n if (error) throw error;\n\n // body is an alias for `response.body`,\n // that in this case holds a JSON-decoded object.\n console.log(body.ip_addr);\n});\n\n// no callback, using streams\nvar out = fs.createWriteStream('logo.png');\nneedle.get('https://google.com/images/logo.png').pipe(out).on('finish', function() {\n console.log('Pipe finished!');\n});\n```\n\nAs you can see, you can use Needle with Promises or without them. When using Promises or when a callback is passed, the response's body will be buffered and written to `response.body`, and the callback will be fired when all of the data has been collected and processed (e.g. decompressed, decoded and/or parsed).\n\nWhen no callback is passed, however, the buffering logic will be skipped but the response stream will still go through Needle's processing pipeline, so you get all the benefits of post-processing while keeping the streamishness we all love from Node.\n\nResponse pipeline\n-----------------\n\nDepending on the response's Content-Type, Needle will either attempt to parse JSON or XML streams, or, if a text response was received, will ensure that the final encoding you get is UTF-8.\n\nYou can also request a gzip/deflated response, which, if sent by the server, will be processed before parsing or decoding is performed.\n\n```js\nneedle.get('http://stackoverflow.com/feeds', { compressed: true }, function(err, resp) {\n console.log(resp.body); // this little guy won't be a Gzipped binary blob\n // but a nice object containing all the latest entries\n});\n```\n\nOr in anti-callback mode, using a few other options:\n\n```js\nvar options = {\n compressed : true, // sets 'Accept-Encoding' to 'gzip,deflate'\n follow_max : 5, // follow up to five redirects\n rejectUnauthorized : true // verify SSL certificate\n}\n\nvar stream = needle.get('https://backend.server.com/everything.html', options);\n\n// read the chunks from the 'readable' event, so the stream gets consumed.\nstream.on('readable', function() {\n while (data = this.read()) {\n console.log(data.toString());\n }\n})\n\nstream.on('done', function(err) {\n // if our request had an error, our 'done' event will tell us.\n if (!err) console.log('Great success!');\n})\n```\n\nAPI\n---\n\n### needle(method, url[, data][, options][, callback]) `(> 2.0.x)`\n\nCalling `needle()` directly returns a Promise. Besides `method` and `url`, all parameters are optional, although when sending a `post`, `put` or `patch` request you will get an error if `data` is not present.\n\n```js\nneedle('get', 'http://some.url.com')\n .then(function(resp) { console.log(resp.body) })\n .catch(function(err) { console.error(err) })\n})\n```\n\nExcept from the above, all of Needle's request methods return a Readable stream, and both `options` and `callback` are optional. If passed, the callback will return three arguments: `error`, `response` and `body`, which is basically an alias for `response.body`.\n\n### needle.head(url[, options][, callback])\n\n```js\nneedle.head('https://my.backend.server.com', {\n open_timeout: 5000 // if we're not able to open a connection in 5 seconds, boom.\n}, function(err, resp) {\n if (err)\n console.log('Shoot! Something is wrong: ' + err.message)\n else\n console.log('Yup, still alive.')\n})\n```\n\n### needle.get(url[, options][, callback])\n\n```js\nneedle.get('google.com/search?q=syd+barrett', function(err, resp) {\n // if no http:// is found, Needle will automagically prepend it.\n});\n```\n\n### needle.post(url, data[, options][, callback])\n\n```js\nvar options = {\n headers: { 'X-Custom-Header': 'Bumbaway atuna' }\n}\n\nneedle.post('https://my.app.com/endpoint', 'foo=bar', options, function(err, resp) {\n // you can pass params as a string or as an object.\n});\n```\n\n### needle.put(url, data[, options][, callback])\n\n```js\nvar nested = {\n params: {\n are: {\n also: 'supported'\n }\n }\n}\n\nneedle.put('https://api.app.com/v2', nested, function(err, resp) {\n console.log('Got ' + resp.bytes + ' bytes.') // another nice treat from this handsome fella.\n});\n```\n\n### needle.patch(url, data[, options][, callback])\n\nSame behaviour as PUT.\n\n### needle.delete(url, data[, options][, callback])\n\n```js\nvar options = {\n username: 'fidelio',\n password: 'x'\n}\n\nneedle.delete('https://api.app.com/messages/123', null, options, function(err, resp) {\n // in this case, data may be null, but you need to explicity pass it.\n});\n```\n\n### needle.request(method, url, data[, options][, callback])\n\nGeneric request. This not only allows for flexibility, but also lets you perform a GET request with data, in which case will be appended to the request as a query string, unless you pass a `json: true` option (read below).\n\n```js\nvar params = {\n q : 'a very smart query',\n page : 2\n}\n\nneedle.request('get', 'forum.com/search', params, function(err, resp) {\n if (!err && resp.statusCode == 200)\n console.log(resp.body); // here you go, mister.\n});\n```\n\nNow, if you set pass `json: true` among the options, Needle won't set your params as a querystring but instead send a JSON representation of your data through the request's body, as well as set the `Content-Type` and `Accept` headers to `application/json`.\n\n```js\nneedle.request('get', 'forum.com/search', params, { json: true }, function(err, resp) {\n if (resp.statusCode == 200) console.log('It worked!');\n});\n```\n\nEvents\n------\n\nThe [Readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable) object returned by the above request methods emits the following events, in addition to the regular ones (e.g. `end`, `close`, `data`, `pipe`, `readable`).\n\n### Event: `'response'`\n\n - `response `\n\nEmitted when the underlying [http.ClientRequest](https://nodejs.org/api/http.html#http_class_http_clientrequest) emits a response event. This is after the connection is established and the header received, but before any of it is processed (e.g. authorization required or redirect to be followed). No data has been consumed at this point.\n\n### Event: `'redirect'`\n\n - `location `\n\nIndicates that the a redirect is being followed. This means that the response code was a redirect (`301`, `302`, `303`, `307`) and the given [redirect options](#redirect-options) allowed following the URL received in the `Location` header.\n\n### Event: `'header'`\n\n - `statusCode `\n - `headers `\n\nTriggered after the header has been processed, and just before the data is to be consumed. This implies that no redirect was followed and/or authentication header was received. In other words, we got a \"valid\" response.\n\n### Event: `'done'` (previously 'end')\n\n - `exception ` (optional)\n\nEmitted when the request/response process has finished, either because all data was consumed or an error ocurred somewhere in between. Unlike a regular stream's `end` event, Needle's `done` will be fired either on success or on failure, which is why the first argument may be an Error object. In other words:\n\n```js\nvar resp = needle.get('something.worthy/of/being/streamed/by/needle');\nresp.pipe(someWritableStream);\n\nresp.on('done', function(err) {\n if (err) console.log('An error ocurred: ' + err.message);\n else console.log('Great success!');\n})\n```\n\n### Event: `'err'`\n\n - `exception `\n\nEmitted when an error ocurrs. This should only happen once in the lifecycle of a Needle request.\n\n### Event: `'timeout'`\n\n - `type `\n\nEmitted when an timeout error occurs. Type can be either 'open', 'response', or 'read'. This will called right before aborting the request, which will also trigger an `err` event, a described above, with an `ECONNRESET` (Socket hang up) exception.\n\nRequest options\n---------------\n\nFor information about options that've changed, there's always [the changelog](https://github.com/tomas/needle/releases).\n\n - `agent` : Uses an [http.Agent](https://nodejs.org/api/http.html#http_class_http_agent) of your choice, instead of the global, default one. Useful for tweaking the behaviour at the connection level, such as when doing tunneling (see below for an example).\n - `json` : When `true`, sets content type to `application/json` and sends request body as JSON string, instead of a query string.\n - `open_timeout`: (or `timeout`) Returns error if connection takes longer than X milisecs to establish. Defaults to `10000` (10 secs). `0` means no timeout.\n - `response_timeout`: Returns error if no response headers are received in X milisecs, counting from when the connection is opened. Defaults to `0` (no response timeout).\n - `read_timeout`: Returns error if data transfer takes longer than X milisecs, once response headers are received. Defaults to `0` (no timeout).\n - `follow_max` : (or `follow`) Number of redirects to follow. Defaults to `0`. See below for more redirect options.\n - `multipart` : Enables multipart/form-data encoding. Defaults to `false`. Use it when uploading files.\n - `proxy` : Forwards request through HTTP(s) proxy. Eg. `proxy: 'http://user:pass@proxy.server.com:3128'`. For more advanced proxying/tunneling use a custom `agent`, as described below.\n - `headers` : Object containing custom HTTP headers for request. Overrides defaults described below.\n - `auth` : Determines what to do with provided username/password. Options are `auto`, `digest` or `basic` (default). `auto` will detect the type of authentication depending on the response headers.\n - `stream_length`: When sending streams, this lets you manually set the Content-Length header --if the stream's bytecount is known beforehand--, preventing ECONNRESET (socket hang up) errors on some servers that misbehave when receiving payloads of unknown size. Set it to `0` and Needle will get and set the stream's length for you, or leave unset for the default behaviour, which is no Content-Length header for stream payloads.\n - `localAddress` : , IP address. Passed to http/https request. Local interface from witch the request should be emitted.\n\nResponse options\n----------------\n\n - `decode_response` : (or `decode`) Whether to decode the text responses to UTF-8, if Content-Type header shows a different charset. Defaults to `true`.\n - `parse_response` : (or `parse`) Whether to parse XML or JSON response bodies automagically. Defaults to `true`. You can also set this to 'xml' or 'json' in which case Needle will *only* parse the response if the content type matches.\n - `output` : Dump response output to file. This occurs after parsing and charset decoding is done.\n - `parse_cookies` : Whether to parse response’s `Set-Cookie` header. Defaults to `true`. If parsed, response cookies will be available at `resp.cookies`.\n\nHTTP Header options\n-------------------\n\nThese are basically shortcuts to the `headers` option described above.\n\n - `cookies` : Builds and sets a Cookie header from a `{ key: 'value' }` object.\n - `compressed`: If `true`, sets 'Accept-Encoding' header to 'gzip,deflate', and inflates content if zipped. Defaults to `false`.\n - `username` : For HTTP basic auth.\n - `password` : For HTTP basic auth. Requires username to be passed, but is optional.\n - `accept` : Sets 'Accept' HTTP header. Defaults to `*/*`.\n - `connection`: Sets 'Connection' HTTP header. Not set by default, unless running Node < 0.11.4 in which case it defaults to `close`. More info about this below.\n - `user_agent`: Sets the 'User-Agent' HTTP header. Defaults to `Needle/{version} (Node.js {node_version})`.\n - `content_type`: Sets the 'Content-Type' header. Unset by default, unless you're sending data in which case it's set accordingly to whatever is being sent (`application/x-www-form-urlencoded`, `application/json` or `multipart/form-data`). That is, of course, unless the option is passed, either here or through `options.headers`. You're the boss.\n\nNode.js TLS Options\n-------------------\n\nThese options are passed directly to `https.request` if present. Taken from the [original documentation](http://nodejs.org/docs/latest/api/https.html):\n\n - `pfx` : Certificate, Private key and CA certificates to use for SSL.\n - `key` : Private key to use for SSL.\n - `passphrase` : A string of passphrase for the private key or pfx.\n - `cert` : Public x509 certificate to use.\n - `ca` : An authority certificate or array of authority certificates to check the remote host against.\n - `ciphers` : A string describing the ciphers to use or exclude.\n - `rejectUnauthorized` : If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent.\n - `secureProtocol` : The SSL method to use, e.g. SSLv3_method to force SSL version 3.\n\nRedirect options\n----------------\n\nThese options only apply if the `follow_max` (or `follow`) option is higher than 0.\n\n - `follow_set_cookies` : Sends the cookies received in the `set-cookie` header as part of the following request. `false` by default.\n - `follow_set_referer` : Sets the 'Referer' header to the requested URI when following a redirect. `false` by default.\n - `follow_keep_method` : If enabled, resends the request using the original verb instead of being rewritten to `get` with no data. `false` by default.\n - `follow_if_same_host` : When true, Needle will only follow redirects that point to the same host as the original request. `false` by default.\n - `follow_if_same_protocol` : When true, Needle will only follow redirects that point to the same protocol as the original request. `false` by default.\n\nOverriding Defaults\n-------------------\n\nYes sir, we have it. Needle includes a `defaults()` method, that lets you override some of the defaults for all future requests. Like this:\n\n```js\nneedle.defaults({\n open_timeout: 60000,\n user_agent: 'MyApp/1.2.3',\n parse_response: false });\n```\n\nThis will override Needle's default user agent and 10-second timeout, and disable response parsing, so you don't need to pass those options in every other request.\n\nMore advanced Proxy support\n---------------------------\n\nSince you can pass a custom HTTPAgent to Needle you can do all sorts of neat stuff. For example, if you want to use the [`tunnel`](https://github.com/koichik/node-tunnel) module for HTTPS proxying, you can do this:\n\n```js\nvar tunnel = require('tunnel');\nvar myAgent = tunnel.httpOverHttp({\n proxy: { host: 'localhost' }\n});\n\nneedle.get('foobar.com', { agent: myAgent });\n```\n\nRegarding the 'Connection' header\n---------------------------------\n\nUnless you're running an old version of Node (< 0.11.4), by default Needle won't set the Connection header on requests, yielding Node's default behaviour of keeping the connection alive with the target server. This speeds up inmensely the process of sending several requests to the same host.\n\nOn older versions, however, this has the unwanted behaviour of preventing the runtime from exiting, either because of a bug or 'feature' that was changed on 0.11.4. To overcome this Needle does set the 'Connection' header to 'close' on those versions, however this also means that making new requests to the same host doesn't benefit from Keep-Alive.\n\nSo if you're stuck on 0.10 or even lower and want full speed, you can simply set the Connection header to 'Keep-Alive' by using `{ connection: 'Keep-Alive' }`. Please note, though, that an event loop handler will prevent the runtime from exiting so you'll need to manually call `process.exit()` or the universe will collapse.\n\nExamples Galore\n---------------\n\n### HTTPS GET with Basic Auth\n\n```js\nneedle.get('https://api.server.com', { username: 'you', password: 'secret' },\n function(err, resp) {\n // used HTTP auth\n});\n```\n\nOr use [RFC-1738](http://tools.ietf.org/html/rfc1738#section-3.1) basic auth URL syntax:\n\n```js\nneedle.get('https://username:password@api.server.com', function(err, resp) {\n // used HTTP auth from URL\n});\n```\n\n### Digest Auth\n\n```js\nneedle.get('other.server.com', { username: 'you', password: 'secret', auth: 'digest' },\n function(err, resp, body) {\n // needle prepends 'http://' to your URL, if missing\n});\n```\n\n### Custom Accept header, deflate\n\n```js\nvar options = {\n compressed : true,\n follow : 10,\n accept : 'application/vnd.github.full+json'\n}\n\nneedle.get('api.github.com/users/tomas', options, function(err, resp, body) {\n // body will contain a JSON.parse(d) object\n // if parsing fails, you'll simply get the original body\n});\n```\n\n### GET XML object\n\n```js\nneedle.get('https://news.ycombinator.com/rss', function(err, resp, body) {\n // you'll get a nice object containing the nodes in the RSS\n});\n```\n\n### GET binary, output to file\n\n```js\nneedle.get('http://upload.server.com/tux.png', { output: '/tmp/tux.png' }, function(err, resp, body) {\n // you can dump any response to a file, not only binaries.\n});\n```\n\n### GET through proxy\n\n```js\nneedle.get('http://search.npmjs.org', { proxy: 'http://localhost:1234' }, function(err, resp, body) {\n // request passed through proxy\n});\n```\n\n### GET a very large document in a stream (from 0.7+)\n\n```js\nvar stream = needle.get('http://www.as35662.net/100.log');\n\nstream.on('readable', function() {\n var chunk;\n while (chunk = this.read()) {\n console.log('got data: ', chunk);\n }\n});\n```\n\n### GET JSON object in a stream (from 0.7+)\n\n```js\nvar stream = needle.get('http://jsonplaceholder.typicode.com/db', { parse: true });\n\nstream.on('readable', function() {\n var node;\n\n // our stream will only emit a single JSON root node.\n while (node = this.read()) {\n console.log('got data: ', node);\n }\n});\n```\n\n### GET JSONStream flexible parser with search query (from 0.7+)\n\n```js\n\n // The 'data' element of this stream will be the string representation\n // of the titles of all posts.\n\nneedle.get('http://jsonplaceholder.typicode.com/db', { parse: true })\n .pipe(new JSONStream.parse('posts.*.title'));\n .on('data', function (obj) {\n console.log('got post title: %s', obj);\n });\n```\n\n### File upload using multipart, passing file path\n\n```js\nvar data = {\n foo: 'bar',\n image: { file: '/home/tomas/linux.png', content_type: 'image/png' }\n}\n\nneedle.post('http://my.other.app.com', data, { multipart: true }, function(err, resp, body) {\n // needle will read the file and include it in the form-data as binary\n});\n```\n\n### Stream upload, PUT or POST\n\n``` js\nneedle.put('https://api.app.com/v2', fs.createReadStream('myfile.txt'), function(err, resp, body) {\n // stream content is uploaded verbatim\n});\n```\n\n### Multipart POST, passing data buffer\n\n```js\nvar buffer = fs.readFileSync('/path/to/package.zip');\n\nvar data = {\n zip_file: {\n buffer : buffer,\n filename : 'mypackage.zip',\n content_type : 'application/octet-stream'\n }\n}\n\nneedle.post('http://somewhere.com/over/the/rainbow', data, { multipart: true }, function(err, resp, body) {\n // if you see, when using buffers we need to pass the filename for the multipart body.\n // you can also pass a filename when using the file path method, in case you want to override\n // the default filename to be received on the other end.\n});\n```\n\n### Multipart with custom Content-Type\n\n```js\nvar data = {\n token: 'verysecret',\n payload: {\n value: JSON.stringify({ title: 'test', version: 1 }),\n content_type: 'application/json'\n }\n}\n\nneedle.post('http://test.com/', data, { timeout: 5000, multipart: true }, function(err, resp, body) {\n // in this case, if the request takes more than 5 seconds\n // the callback will return a [Socket closed] error\n});\n```\n\nFor even more examples, check out the examples directory in the repo.\n\n### Testing\n\nTo run tests, you need to generate a self-signed SSL certificate in the `test` directory. After cloning the repository, run the following commands:\n\n $ mkdir -p test/keys\n $ openssl genrsa -out test/keys/ssl.key 2048\n $ openssl req -new -key test/keys/ssl.key -x509 -days 999 -out test/keys/ssl.cert\n\nThen you should be able to run `npm test` once you have the dependencies in place.\n\n> Note: Tests currently only work on linux-based environments that have `/proc/self/fd`. They *do not* work on MacOS environments.\n> You can use Docker to run tests by creating a container and mounting the needle project directory on `/app`\n> `docker create --name Needle -v /app -w /app -v /app/node_modules -i node:argon`\n\nCredits\n-------\n\nWritten by Tomás Pollak, with the help of contributors.\n\nCopyright\n---------\n\n(c) Fork Ltd. Licensed under the MIT license.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/tomas/needle.git" + }, + "scripts": { + "test": "mocha test" + }, + "tags": [ + "http", + "https", + "simple", + "request", + "client", + "multipart", + "upload", + "proxy", + "deflate", + "timeout", + "charset", + "iconv", + "cookie", + "redirect" + ], + "version": "2.4.0" +} diff --git a/legacy-libs/grpc/node_modules/needle/test/basic_auth_spec.js b/legacy-libs/grpc/node_modules/needle/test/basic_auth_spec.js new file mode 100644 index 0000000..343f1db --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/basic_auth_spec.js @@ -0,0 +1,196 @@ +var helpers = require('./helpers'), + should = require('should'), + needle = require('./../'), + server; + +var port = 7707; + +describe('Basic Auth', function() { + + before(function(done) { + server = helpers.server({ port: port }, done); + }) + + after(function(done) { + server.close(done); + }) + + ///////////////// helpers + + var get_auth = function(header) { + var token = header.split(/\s+/).pop(); + return token && Buffer.from(token, 'base64').toString().split(':'); + } + + describe('when neither username or password are passed', function() { + + it('doesnt send any Authorization headers', function(done) { + needle.get('localhost:' + port, { parse: true }, function(err, resp) { + var sent_headers = resp.body.headers; + Object.keys(sent_headers).should.not.containEql('authorization'); + done(); + }) + }) + + }) + + describe('when username is an empty string, and password is a valid string', function() { + + var opts = { username: '', password: 'foobar', parse: true }; + + it('doesnt send any Authorization headers', function(done) { + needle.get('localhost:' + port, { parse: true }, function(err, resp) { + var sent_headers = resp.body.headers; + Object.keys(sent_headers).should.not.containEql('authorization'); + done(); + }) + }) + + }); + + describe('when username is a valid string, but no username is passed', function() { + + var opts = { username: 'foobar', parse: true }; + + it('sends Authorization header', function(done) { + needle.get('localhost:' + port, opts, function(err, resp) { + var sent_headers = resp.body.headers; + Object.keys(sent_headers).should.containEql('authorization'); + done(); + }) + }) + + it('Basic Auth only includes username, without colon', function(done) { + needle.get('localhost:' + port, opts, function(err, resp) { + var sent_headers = resp.body.headers; + var auth = get_auth(sent_headers['authorization']); + auth[0].should.equal('foobar'); + auth.should.have.lengthOf(1); + done(); + }) + }) + + }) + + describe('when username is a valid string, and password is null', function() { + + var opts = { username: 'foobar', password: null, parse: true }; + + it('sends Authorization header', function(done) { + needle.get('localhost:' + port, opts, function(err, resp) { + var sent_headers = resp.body.headers; + Object.keys(sent_headers).should.containEql('authorization'); + done(); + }) + }) + + it('Basic Auth only includes both username and password', function(done) { + needle.get('localhost:' + port, opts, function(err, resp) { + var sent_headers = resp.body.headers; + var auth = get_auth(sent_headers['authorization']); + auth[0].should.equal('foobar'); + auth[1].should.equal(''); + done(); + }) + }) + + }) + + describe('when username is a valid string, and password is an empty string', function() { + + var opts = { username: 'foobar', password: '', parse: true }; + + it('sends Authorization header', function(done) { + needle.get('localhost:' + port, opts, function(err, resp) { + var sent_headers = resp.body.headers; + Object.keys(sent_headers).should.containEql('authorization'); + done(); + }) + }) + + it('Basic Auth only includes both username and password', function(done) { + needle.get('localhost:' + port, opts, function(err, resp) { + var sent_headers = resp.body.headers; + var auth = get_auth(sent_headers['authorization']); + auth[0].should.equal('foobar'); + auth[1].should.equal(''); + auth.should.have.lengthOf(2); + done(); + }) + }) + + }) + + describe('when username AND password are non empty strings', function() { + + var opts = { username: 'foobar', password: 'jakub', parse: true }; + + it('sends Authorization header', function(done) { + needle.get('localhost:' + port, opts, function(err, resp) { + var sent_headers = resp.body.headers; + Object.keys(sent_headers).should.containEql('authorization'); + done(); + }) + }) + + it('Basic Auth only includes both user and password', function(done) { + needle.get('localhost:' + port, opts, function(err, resp) { + var sent_headers = resp.body.headers; + var auth = get_auth(sent_headers['authorization']); + auth[0].should.equal('foobar'); + auth[1].should.equal('jakub'); + auth.should.have.lengthOf(2); + done(); + }) + }) + + }) + + describe('URL with @ but not username/pass', function() { + it('doesnt send Authorization header', function(done) { + var url = 'localhost:' + port + '/abc/@def/xyz.zip'; + + needle.get(url, {}, function(err, resp) { + var sent_headers = resp.body.headers; + Object.keys(sent_headers).should.not.containEql('authorization'); + done(); + }) + }) + + it('sends user:pass headers if passed via options', function(done) { + var url = 'localhost:' + port + '/abc/@def/xyz.zip'; + + needle.get(url, { username: 'foo' }, function(err, resp) { + var sent_headers = resp.body.headers; + Object.keys(sent_headers).should.containEql('authorization'); + sent_headers['authorization'].should.eql('Basic Zm9v') + done(); + }) + }) + }) + + describe('when username/password are included in URL', function() { + var opts = { parse: true }; + + it('sends Authorization header', function(done) { + needle.get('foobar:jakub@localhost:' + port, opts, function(err, resp) { + var sent_headers = resp.body.headers; + Object.keys(sent_headers).should.containEql('authorization'); + done(); + }) + }) + + it('Basic Auth only includes both user and password', function(done) { + needle.get('foobar:jakub@localhost:' + port, opts, function(err, resp) { + var sent_headers = resp.body.headers; + var auth = get_auth(sent_headers['authorization']); + auth[0].should.equal('foobar'); + auth[1].should.equal('jakub'); + auth.should.have.lengthOf(2); + done(); + }) + }) + + }) + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/compression_spec.js b/legacy-libs/grpc/node_modules/needle/test/compression_spec.js new file mode 100644 index 0000000..ea5f3b1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/compression_spec.js @@ -0,0 +1,94 @@ +var should = require('should'), + needle = require('./../'), + http = require('http'), + zlib = require('zlib'), + stream = require('stream'), + port = 11123, + server; + +describe('compression', function(){ + + require.bind(null, 'zlib').should.not.throw() + + var jsonData = '{"foo":"bar"}'; + + describe('when server supports compression', function(){ + + before(function(){ + server = http.createServer(function(req, res) { + var raw = new stream.PassThrough(); + + var acceptEncoding = req.headers['accept-encoding']; + if (!acceptEncoding) { + acceptEncoding = ''; + } + + if (acceptEncoding.match(/\bdeflate\b/)) { + res.setHeader('Content-Encoding', 'deflate'); + raw.pipe(zlib.createDeflate()).pipe(res); + } else if (acceptEncoding.match(/\bgzip\b/)) { + res.setHeader('Content-Encoding', 'gzip'); + raw.pipe(zlib.createGzip()).pipe(res); + } else { + raw.pipe(res); + } + + res.setHeader('Content-Type', 'application/json') + if (req.headers['with-bad']) { + res.end('foo'); // end, no deflate data + } else { + raw.end(jsonData) + } + + }) + + server.listen(port); + }); + + after(function(done){ + server.close(done); + }) + + describe('and client requests no compression', function() { + it('should have the body decompressed', function(done){ + needle.get('localhost:' + port, function(err, response, body){ + should.ifError(err); + body.should.have.property('foo', 'bar'); + response.bytes.should.equal(jsonData.length); + done(); + }) + }) + }) + + describe('and client requests gzip compression', function() { + it('should have the body decompressed', function(done){ + needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'gzip'}}, function(err, response, body){ + should.ifError(err); + body.should.have.property('foo', 'bar'); + response.bytes.should.not.equal(jsonData.length); + done(); + }) + }) + }) + + describe('and client requests deflate compression', function() { + it('should have the body decompressed', function(done){ + needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'deflate'}}, function(err, response, body){ + should.ifError(err); + body.should.have.property('foo', 'bar'); + response.bytes.should.not.equal(jsonData.length); + done(); + }) + }) + + it('should rethrow errors from decompressors', function(done){ + needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'deflate', 'With-Bad': 'true'}}, function(err, response, body) { + should.exist(err); + err.message.should.equal("incorrect header check"); + err.code.should.equal("Z_DATA_ERROR") + done(); + }) + }) + }) + }) +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/cookies_spec.js b/legacy-libs/grpc/node_modules/needle/test/cookies_spec.js new file mode 100644 index 0000000..04b5f11 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/cookies_spec.js @@ -0,0 +1,305 @@ +var needle = require('../'), + cookies = require('../lib/cookies'), + sinon = require('sinon'), + http = require('http'), + should = require('should'), + assert = require('assert'); + +var WEIRD_COOKIE_NAME = 'wc', + BASE64_COOKIE_NAME = 'bc', + FORBIDDEN_COOKIE_NAME = 'fc', + NUMBER_COOKIE_NAME = 'nc'; + +var WEIRD_COOKIE_VALUE = '!\'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~', + BASE64_COOKIE_VALUE = 'Y29va2llCg==', + FORBIDDEN_COOKIE_VALUE = ' ;"\\,', + NUMBER_COOKIE_VALUE = 12354342; + +var TEST_HOST = 'localhost', + NO_COOKIES_TEST_PORT = 11112, + ALL_COOKIES_TEST_PORT = 11113; + +describe('cookies', function() { + + var setCookieHeader, headers, server, opts; + + function decode(str) { + return decodeURIComponent(str); + } + + function encode(str) { + str = str.toString().replace(/[\x00-\x1F\x7F]/g, encodeURIComponent); + return str.replace(/[\s\"\,;\\%]/g, encodeURIComponent); + } + + before(function() { + setCookieHeader = [ + WEIRD_COOKIE_NAME + '=' + encode(WEIRD_COOKIE_VALUE) + ';', + BASE64_COOKIE_NAME + '=' + encode(BASE64_COOKIE_VALUE) + ';', + FORBIDDEN_COOKIE_NAME + '=' + encode(FORBIDDEN_COOKIE_VALUE) + ';', + NUMBER_COOKIE_NAME + '=' + encode(NUMBER_COOKIE_VALUE) + ';' + ]; + }); + + before(function(done) { + serverAllCookies = http.createServer(function(req, res) { + res.setHeader('Content-Type', 'text/html'); + res.setHeader('Set-Cookie', setCookieHeader); + res.end('200'); + }).listen(ALL_COOKIES_TEST_PORT, TEST_HOST, done); + }); + + after(function(done) { + serverAllCookies.close(done); + }); + + describe('with default options', function() { + it('no cookie header is set on request', function(done) { + needle.get( + TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(err, response) { + assert(!response.req._headers.cookie); + done(); + }); + }); + }); + + describe('if response does not contain cookies', function() { + before(function(done) { + serverNoCookies = http.createServer(function(req, res) { + res.setHeader('Content-Type', 'text/html'); + res.end('200'); + }).listen(NO_COOKIES_TEST_PORT, TEST_HOST, done); + }); + + it('response.cookies is undefined', function(done) { + needle.get( + TEST_HOST + ':' + NO_COOKIES_TEST_PORT, function(error, response) { + assert(!response.cookies); + done(); + }); + }); + + after(function(done) { + serverNoCookies.close(done); + }); + }); + + describe('if response contains cookies', function() { + + it('puts them on resp.cookies', function(done) { + needle.get( + TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(error, response) { + response.should.have.property('cookies'); + done(); + }); + }); + + it('parses them as a object', function(done) { + needle.get( + TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(error, response) { + response.cookies.should.be.an.instanceOf(Object) + .and.have.property(WEIRD_COOKIE_NAME); + response.cookies.should.have.property(BASE64_COOKIE_NAME); + response.cookies.should.have.property(FORBIDDEN_COOKIE_NAME); + response.cookies.should.have.property(NUMBER_COOKIE_NAME); + done(); + }); + }); + + it('must decode it', function(done) { + needle.get( + TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(error, response) { + response.cookies.wc.should.be.eql(WEIRD_COOKIE_VALUE); + response.cookies.bc.should.be.eql(BASE64_COOKIE_VALUE); + response.cookies.fc.should.be.eql(FORBIDDEN_COOKIE_VALUE); + response.cookies.nc.should.be.eql(NUMBER_COOKIE_VALUE.toString()); + done(); + }); + }); + + describe('when a cookie value is invalid', function() { + + before(function() { + setCookieHeader = [ + 'geo_city=%D1%E0%ED%EA%F2-%CF%E5%F2%E5%F0%E1%F3%F0%E3' + ]; + }) + + it('doesnt blow up', function(done) { + needle.get(TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(error, response) { + should.not.exist(error) + var whatever = 'efbfbdefbfbdefbfbdefbfbdefbfbd2defbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbd'; + Buffer.from(response.cookies.geo_city).toString('hex').should.eql(whatever) + done(); + }); + }) + + }) + + describe('and response is a redirect', function() { + + var redirectServer, testPort = 22222; + + var responseCookies = [ + [ // first req + WEIRD_COOKIE_NAME + '=' + encode(WEIRD_COOKIE_VALUE) + ';', + BASE64_COOKIE_NAME + '=' + encode(BASE64_COOKIE_VALUE) + ';', + 'FOO=123;' + ], [ // second req + FORBIDDEN_COOKIE_NAME + '=' + encode(FORBIDDEN_COOKIE_VALUE) + ';', + NUMBER_COOKIE_NAME + '=' + encode(NUMBER_COOKIE_VALUE) + ';' + ], [ // third red + 'FOO=BAR;' + ] + ] + + before(function() { + redirectServer = http.createServer(function(req, res) { + var number = parseInt(req.url.replace('/', '')); + var nextUrl = 'http://' + TEST_HOST + ':' + testPort + '/' + (number + 1); + + if (responseCookies[number]) { // got cookies + res.statusCode = 302; + res.setHeader('Set-Cookie', responseCookies[number]); + res.setHeader('Location', nextUrl); + } else if (number == 3) { + res.statusCode = 302; // redirect but without cookies + res.setHeader('Location', nextUrl); + } + + res.end('OK'); + }).listen(22222, TEST_HOST); + }); + + after(function(done) { + redirectServer.close(done); + }) + + describe('and follow_set_cookies is false', function() { + + var opts = { + follow_set_cookies: false, + follow_max: 4 + }; + + it('no cookie header set on redirection request', function(done) { + var spy = sinon.spy(cookies, 'write'); + + needle.get(TEST_HOST + ':' + testPort + '/0', opts, function(err, resp) { + spy.callCount.should.eql(0); + done(); + }); + }); + }); + + describe('and follow_set_cookies is true', function() { + var opts = { + follow_set_cookies: true, + follow_max: 4 + }; + + it('should have all the cookies', function(done) { + needle.get(TEST_HOST + ':' + testPort + '/0', opts, function(err, resp) { + resp.cookies.should.have.property(WEIRD_COOKIE_NAME); + resp.cookies.should.have.property(BASE64_COOKIE_NAME); + resp.cookies.should.have.property(FORBIDDEN_COOKIE_NAME); + resp.cookies.should.have.property(NUMBER_COOKIE_NAME); + resp.cookies.should.have.property('FOO'); + resp.cookies.FOO.should.eql('BAR'); // should overwrite previous one + done(); + }); + }); + }); + }); + + describe('with parse_cookies = false', function() { + it('does not parse them', function(done) { + needle.get( + TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, { parse_cookies: false }, function(error, response) { + assert(!response.cookies); + done(); + }); + }); + }); + }); + + describe('if request contains cookie header', function() { + var opts = { + cookies: {} + }; + + before(function() { + opts.cookies[WEIRD_COOKIE_NAME] = WEIRD_COOKIE_VALUE; + opts.cookies[BASE64_COOKIE_NAME] = BASE64_COOKIE_VALUE; + opts.cookies[FORBIDDEN_COOKIE_NAME] = FORBIDDEN_COOKIE_VALUE; + opts.cookies[NUMBER_COOKIE_NAME] = NUMBER_COOKIE_VALUE; + }); + + it('must be a valid cookie string', function(done) { + var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/; + + var full_header = [ + WEIRD_COOKIE_NAME + '=' + WEIRD_COOKIE_VALUE, + BASE64_COOKIE_NAME + '=' + BASE64_COOKIE_VALUE, + FORBIDDEN_COOKIE_NAME + '=' + encode(FORBIDDEN_COOKIE_VALUE), + NUMBER_COOKIE_NAME + '=' + NUMBER_COOKIE_VALUE + ].join('; ') + + needle.get(TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, opts, function(error, response) { + var cookieString = response.req._headers.cookie; + cookieString.should.be.type('string'); + + cookieString.split(/\s*;\s*/).forEach(function(pair) { + COOKIE_PAIR.test(pair).should.be.exactly(true); + }); + + cookieString.should.be.exactly(full_header); + done(); + }); + }); + + it('dont have to encode allowed characters', function(done) { + var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/, + KEY_INDEX = 1, + VALUE_INEX = 3; + + needle.get(TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, opts, function(error, response) { + var cookieObj = {}, + cookieString = response.req._headers.cookie; + + cookieString.split(/\s*;\s*/).forEach(function(str) { + var pair = COOKIE_PAIR.exec(str); + cookieObj[pair[KEY_INDEX]] = pair[VALUE_INEX]; + }); + + cookieObj[WEIRD_COOKIE_NAME].should.be.exactly(WEIRD_COOKIE_VALUE); + cookieObj[BASE64_COOKIE_NAME].should.be.exactly(BASE64_COOKIE_VALUE); + done(); + }); + }); + + it('must encode forbidden characters', function(done) { + var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/, + KEY_INDEX = 1, + VALUE_INEX = 3; + + needle.get(TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, opts, function(error, response) { + var cookieObj = {}, + cookieString = response.req._headers.cookie; + + cookieString.split(/\s*;\s*/).forEach(function(str) { + var pair = COOKIE_PAIR.exec(str); + cookieObj[pair[KEY_INDEX]] = pair[VALUE_INEX]; + }); + + cookieObj[FORBIDDEN_COOKIE_NAME].should.not.be.eql( + FORBIDDEN_COOKIE_VALUE); + cookieObj[FORBIDDEN_COOKIE_NAME].should.be.exactly( + encode(FORBIDDEN_COOKIE_VALUE)); + cookieObj[FORBIDDEN_COOKIE_NAME].should.be.exactly( + encodeURIComponent(FORBIDDEN_COOKIE_VALUE)); + done(); + }); + }); + }); +}); diff --git a/legacy-libs/grpc/node_modules/needle/test/decoder_spec.js b/legacy-libs/grpc/node_modules/needle/test/decoder_spec.js new file mode 100644 index 0000000..5225f6f --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/decoder_spec.js @@ -0,0 +1,86 @@ +var should = require('should'), + needle = require('./../'), + Q = require('q'), + chardet = require('jschardet'); + +describe('character encoding', function() { + + var url; + this.timeout(5000); + + describe('test A', function() { + + before(function() { + url = 'http://www.nina.jp/server/slackware/webapp/tomcat_charset.html'; + }) + + describe('with decode = false', function() { + + it('does not decode', function(done) { + + needle.get(url, { decode: false }, function(err, resp) { + resp.body.should.be.a.String; + chardet.detect(resp.body).encoding.should.eql('windows-1252'); + resp.body.indexOf('EUCを使う').should.eql(-1); + done(); + }) + + }) + + }) + + describe('with decode = true', function() { + + it('decodes', function(done) { + + needle.get(url, { decode: true }, function(err, resp) { + resp.body.should.be.a.String; + chardet.detect(resp.body).encoding.should.eql('ascii'); + resp.body.indexOf('EUCを使う').should.not.eql(-1); + done(); + }) + + }) + + }) + + }) + + describe('test B', function() { + + it('encodes to UTF-8', function(done) { + + // Our Needle wrapper that requests a chinese website. + var task = Q.nbind(needle.get, needle, 'http://www.chinesetop100.com/'); + + // Different instantiations of this task + var tasks = [Q.fcall(task, {decode: true}), + Q.fcall(task, {decode: false})]; + + var results = tasks.map(function(task) { + return task.then(function(obj) { + return obj[0].body; + }); + }); + + // Execute all requests concurrently + Q.all(results).done(function(bodies) { + + var charsets = [ + chardet.detect(bodies[0]).encoding, + chardet.detect(bodies[1]).encoding, + ] + + // We wanted to decode our first stream. + charsets[0].should.equal('ascii'); + bodies[0].indexOf('全球中文网站前二十强').should.not.equal(-1); + + // But not our second stream. + charsets[1].should.equal('windows-1252'); + bodies[1].indexOf('全球中文网站前二十强').should.equal(-1); + + done(); + }); + }) + }) +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/errors_spec.js b/legacy-libs/grpc/node_modules/needle/test/errors_spec.js new file mode 100644 index 0000000..2f488f5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/errors_spec.js @@ -0,0 +1,286 @@ +var needle = require('../'), + sinon = require('sinon'), + should = require('should'), + http = require('http'), + Emitter = require('events').EventEmitter, + helpers = require('./helpers'); + +var get_catch = function(url, opts) { + var err; + try { + needle.get(url, opts); + } catch(e) { + err = e; + } + return err; +} + +describe('errors', function() { + + after(function(done) { + setTimeout(done, 100) + }) + + describe('when host does not exist', function() { + + var url = 'http://unexistinghost/foo'; + + describe('with callback', function() { + + it('does not throw', function() { + var ex = get_catch(url); + should.not.exist(ex); + }) + + it('callbacks an error', function(done) { + needle.get(url, function(err) { + err.should.be.a.Error; + done(); + }) + }) + + it('error should be ENOTFOUND or EADDRINFO or EAI_AGAIN', function(done) { + needle.get(url, function(err) { + err.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/) + done(); + }) + }) + + it('does not callback a response', function(done) { + needle.get(url, function(err, resp) { + should.not.exist(resp); + done(); + }) + }) + + it('does not emit an error event', function(done) { + var emitted = false; + var req = needle.get(url, function(err, resp) { }) + + req.on('error', function() { + emitted = true; + }) + + setTimeout(function() { + emitted.should.eql(false); + done(); + }, 100); + }) + + }) + + describe('without callback', function() { + + it('does not throw', function() { + var ex = get_catch(url); + should.not.exist(ex); + }) + + it('emits end event once, with error', function(done) { + var callcount = 0, + stream = needle.get(url); + + stream.on('done', function(err) { + callcount++; + }) + + setTimeout(function() { + callcount.should.equal(1); + done(); + }, 200) + }) + + it('error should be ENOTFOUND or EADDRINFO or EAI_AGAIN', function(done) { + var errorific, + stream = needle.get(url); + + stream.on('done', function(err) { + errorific = err; + }) + + setTimeout(function() { + should.exist(errorific); + errorific.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/) + done(); + }, 200) + }) + + it('does not emit a readable event', function(done) { + var called = false, + stream = needle.get(url); + + stream.on('readable', function() { + called = true; + }) + + setTimeout(function() { + called.should.be.false; + done(); + }, 50) + }) + + it('does not emit an error event', function(done) { + var emitted = false, + req = needle.get(url); + + req.on('error', function() { + emitted = true; + }) + + setTimeout(function() { + emitted.should.eql(false); + done(); + }, 100); + }) + + }) + + }) + + describe('when request times out waiting for response', function() { + + var server, + url = 'http://localhost:3333/foo'; + + var send_request = function(cb) { + return needle.get(url, { response_timeout: 200 }, cb); + } + + before(function() { + server = helpers.server({ port: 3333, wait: 1000 }); + }) + + after(function() { + server.close(); + }) + + describe('with callback', function() { + + it('aborts the request', function(done) { + + var time = new Date(); + + send_request(function(err) { + var timediff = (new Date() - time); + timediff.should.be.within(200, 300); + done(); + }) + + }) + + it('callbacks an error', function(done) { + send_request(function(err) { + err.should.be.a.Error; + done(); + }) + }) + + it('error should be ECONNRESET', function(done) { + send_request(function(err) { + err.code.should.equal('ECONNRESET') + done(); + }) + }) + + it('does not callback a response', function(done) { + send_request(function(err, resp) { + should.not.exist(resp); + done(); + }) + }) + + it('does not emit an error event', function(done) { + var emitted = false; + + var req = send_request(function(err, resp) { + should.not.exist(resp); + }) + + req.on('error', function() { + emitted = true; + }) + + setTimeout(function() { + emitted.should.eql(false); + done(); + }, 350); + }) + + }) + + describe('without callback', function() { + + it('emits done event once, with error', function(done) { + var called = 0, + stream = send_request(); + + stream.on('done', function(err) { + called++; + }) + + setTimeout(function() { + called.should.equal(1); + done(); + }, 250) + }) + + it('aborts the request', function(done) { + + var time = new Date(); + var stream = send_request(); + + stream.on('done', function(err) { + var timediff = (new Date() - time); + timediff.should.be.within(200, 300); + done(); + }) + + }) + + it('error should be ECONNRESET', function(done) { + var error, + stream = send_request(); + + stream.on('done', function(err) { + error = err; + }) + + setTimeout(function() { + error.code.should.equal('ECONNRESET') + done(); + }, 250) + }) + + it('does not emit a readable event', function(done) { + var called = false, + stream = send_request(); + + stream.on('readable', function() { + called = true; + }) + + setTimeout(function() { + called.should.be.false; + done(); + }, 250) + }) + + it('does not emit an error event', function(done) { + var emitted = false; + var req = send_request(); + + req.on('error', function() { + emitted = true; + }) + + setTimeout(function() { + emitted.should.eql(false); + done(); + }, 100); + }) + + }) + + }) + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/headers_spec.js b/legacy-libs/grpc/node_modules/needle/test/headers_spec.js new file mode 100644 index 0000000..e6693ef --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/headers_spec.js @@ -0,0 +1,198 @@ +var http = require('http'), + helpers = require('./helpers'), + should = require('should'); + +var port = 54321; + +describe('request headers', function() { + + var needle, + server, + existing_sockets, + original_defaultMaxSockets; + + before(function(done) { + setTimeout(function() { + existing_sockets = get_active_sockets().length; + server = helpers.server({ port: port }, done); + }, 100); + }) + + after(function(done) { + server.close(done) + }) + + function send_request(opts, cb) { + needle.get('http://localhost:' + port, opts, cb); + } + + function get_active_sockets() { + var handles = process._getActiveHandles(); + + // only return the ones that have a .end() function (like a socket) + return handles.filter(function(el) { + if (el.constructor.name.toString() == 'Socket') { + return el.destroyed !== true; + } + }) + } + + describe('old node versions (<0.11.4) with persistent keep-alive connections', function() { + + before(function() { + delete require.cache[require.resolve('..')] // in case it was already loaded + original_defaultMaxSockets = http.Agent.defaultMaxSockets; + http.Agent.defaultMaxSockets = 5; + needle = require('..'); + }) + + after(function() { + http.Agent.defaultMaxSockets = original_defaultMaxSockets; + delete require.cache[require.resolve('..')] + }) + + describe('default options', function() { + + it('sends a Connection: close header', function(done) { + send_request({}, function(err, resp) { + resp.body.headers['connection'].should.eql('close'); + done(); + }) + }) + + it('no open sockets remain after request', function(done) { + send_request({}, function(err, resp) { + get_active_sockets().length.should.eql(existing_sockets); + done(); + }); + }) + + }) + + describe('passing connection: close', function() { + + it('sends a Connection: close header', function(done) { + send_request({ connection: 'close' }, function(err, resp) { + resp.body.headers['connection'].should.eql('close'); + done(); + }) + }) + + it('no open sockets remain after request', function(done) { + send_request({ connection: 'close' }, function(err, resp) { + get_active_sockets().length.should.eql(existing_sockets); + done(); + }); + }) + + }) + + describe('passing connection: keep-alive', function() { + + it('sends a Connection: keep-alive header (using options.headers.connection)', function(done) { + send_request({ headers: { connection: 'keep-alive' }}, function(err, resp) { + resp.body.headers['connection'].should.eql('keep-alive'); + done(); + }) + }) + + it('sends a Connection: keep-alive header (using options.connection)', function(done) { + send_request({ connection: 'keep-alive' }, function(err, resp) { + resp.body.headers['connection'].should.eql('keep-alive'); + done(); + }) + }) + + it('one open socket remain after request', function(done) { + send_request({ connection: 'keep-alive' }, function(err, resp) { + get_active_sockets().length.should.eql(existing_sockets + 1); + done(); + }); + }) + + }) + + }) + + describe('new node versions with smarter connection disposing', function() { + + before(function() { + delete require.cache[require.resolve('..')] + original_defaultMaxSockets = http.Agent.defaultMaxSockets; + http.Agent.defaultMaxSockets = Infinity; + needle = require('..'); + }) + + after(function() { + http.Agent.defaultMaxSockets = original_defaultMaxSockets; + delete require.cache[require.resolve('..')] + }) + + describe('default options', function() { + + // TODO: + // this is weird. by default, new node versions set a 'close' header + // while older versions set a keep-alive header + + it.skip('sets a Connection header', function(done) { + send_request({}, function(err, resp) { + // should.not.exist(resp.body.headers['connection']); + // done(); + }) + }) + + it.skip('one open sockets remain after request', function(done) { + send_request({}, function(err, resp) { + // get_active_sockets().length.should.eql(1); + // done(); + }); + }) + + }) + + describe('passing connection: close', function() { + + it('sends a Connection: close header', function(done) { + send_request({ connection: 'close' }, function(err, resp) { + resp.body.headers['connection'].should.eql('close'); + done(); + }) + }) + + it('no open sockets remain after request', function(done) { + send_request({ connection: 'close' }, function(err, resp) { + get_active_sockets().length.should.eql(existing_sockets); + done(); + }); + }) + + }) + + describe('passing connection: keep-alive', function() { + + it('sends a Connection: keep-alive header (using options.headers.connection)', function(done) { + send_request({ headers: { connection: 'keep-alive' }}, function(err, resp) { + resp.body.headers['connection'].should.eql('keep-alive'); + done(); + }) + }) + + it('sends a Connection: keep-alive header (using options.connection)', function(done) { + send_request({ connection: 'keep-alive' }, function(err, resp) { + resp.body.headers['connection'].should.eql('keep-alive'); + done(); + }) + }) + + it('one open socket remain after request', function(done) { + send_request({ connection: 'keep-alive' }, function(err, resp) { + get_active_sockets().length.should.eql(existing_sockets + 1); + done(); + }); + }) + + }) + + }) + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/helpers.js b/legacy-libs/grpc/node_modules/needle/test/helpers.js new file mode 100644 index 0000000..a85f548 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/helpers.js @@ -0,0 +1,72 @@ +var fs = require('fs'); + +var protocols = { + http : require('http'), + https : require('https') +} + +var keys = { + cert : fs.readFileSync(__dirname + '/keys/ssl.cert'), + key : fs.readFileSync(__dirname + '/keys/ssl.key') +} + +var helpers = {}; + +helpers.server = function(opts, cb) { + + var defaults = { + code : 200, + headers : {'Content-Type': 'application/json'} + } + + var mirror_response = function(req) { + return JSON.stringify({ + headers: req.headers, + body: req.body + }) + } + + var get = function(what) { + if (!opts[what]) + return defaults[what]; + + if (typeof opts[what] == 'function') + return opts[what](); // set them at runtime + else + return opts[what]; + } + + var finish = function(req, res) { + res.writeHead(get('code'), get('headers')); + res.end(opts.response || mirror_response(req)); + } + + var handler = function(req, res) { + + req.setEncoding('utf8'); // get as string + req.body = ''; + req.on('data', function(str) { req.body += str }) + req.socket.on('error', function(e) { + // res.writeHead(500, {'Content-Type': 'text/plain'}); + // res.end('Error: ' + e.message); + }) + + setTimeout(function(){ + finish(req, res); + }, opts.wait || 0); + + }; + + var protocol = opts.protocol || 'http'; + var server; + + if (protocol == 'https') + server = protocols[protocol].createServer(keys, handler); + else + server = protocols[protocol].createServer(handler); + + server.listen(opts.port, cb); + return server; +} + +module.exports = helpers; \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/needle/test/long_string_spec.js b/legacy-libs/grpc/node_modules/needle/test/long_string_spec.js new file mode 100644 index 0000000..4baa4fa --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/long_string_spec.js @@ -0,0 +1,34 @@ +var needle = require('../'), + should = require('should'); + +describe('when posting a very long string', function() { + + this.timeout(20000); + + function get_string(length) { + var str = ''; + for (var i = 0; i < length; i++) { + str += 'x'; + } + return str; + } + + it("shouldn't throw an EPIPE error out of nowhere", function(done) { + var error; + + function finished() { + setTimeout(function() { + should.not.exist(error); + done(); + }, 300); + } + + try { + needle.post('https://google.com', { data: get_string(Math.pow(2, 20)) }, finished) + } catch(e) { + error = e; + } + + }) + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/output_spec.js b/legacy-libs/grpc/node_modules/needle/test/output_spec.js new file mode 100644 index 0000000..14fc5bb --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/output_spec.js @@ -0,0 +1,254 @@ +var should = require('should'), + needle = require('./../'), + http = require('http'), + sinon = require('sinon'), + stream = require('stream'), + fs = require('fs'), + port = 11111, + server; + +describe('with output option', function() { + + var server, handler, file = '/tmp/foobar.out'; + + function send_request_cb(where, cb) { + var url = 'http://localhost:' + port + '/whatever.file'; + return needle.get(url, { output: where }, cb); + } + + function send_request_stream(where, cb) { + var url = 'http://localhost:' + port + '/whatever.file'; + var stream = needle.get(url, { output: where }); + stream.on('end', cb); + } + + // this will only work in UNICES + function get_open_file_descriptors() { + var list = fs.readdirSync('/proc/self/fd'); + return list.length; + } + + var send_request = send_request_cb; + + before(function(){ + server = http.createServer(function(req, res) { + handler(req, res); + }).listen(port); + }); + + after(function() { + server.close(); + }) + + beforeEach(function() { + try { fs.unlinkSync(file) } catch(e) { }; + }) + + describe('and a 404 response', function() { + + before(function() { + handler = function(req, res) { + res.writeHead(404, {'Content-Type': 'text/plain' }); + res.end(); + } + }) + + it('doesnt attempt to write a file', function(done) { + var spy = sinon.spy(fs, 'createWriteStream'); + send_request(file, function(err, resp) { + resp.statusCode.should.eql(404); + spy.called.should.eql(false); + spy.restore(); + done(); + }) + }) + + it('doesnt actually write a file', function(done) { + send_request(file, function(err, resp) { + resp.statusCode.should.eql(404); + fs.existsSync(file).should.eql(false); + done(); + }) + }) + + }) + + describe('and a 200 response', function() { + + describe('for an empty response', function() { + + before(function() { + handler = function(req, res) { + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.end(); + } + }) + + it('uses a writableStream', function(done) { + var spy = sinon.spy(fs, 'createWriteStream'); + send_request(file, function(err, resp) { + resp.statusCode.should.eql(200); + spy.called.should.eql(true); + spy.restore(); + done(); + }) + }) + + it('writes a file', function(done) { + fs.existsSync(file).should.eql(false); + send_request(file, function(err, resp) { + fs.existsSync(file).should.eql(true); + done(); + }) + }) + + it('file is zero bytes in length', function(done) { + send_request(file, function(err, resp) { + fs.statSync(file).size.should.equal(0); + done(); + }) + }) + + if (process.platform != 'win32') { + it('closes the file descriptor', function(done) { + var open_descriptors = get_open_file_descriptors(); + send_request(file + Math.random(), function(err, resp) { + var current_descriptors = get_open_file_descriptors(); + open_descriptors.should.eql(current_descriptors); + done() + }) + }) + } + + }) + + describe('for a JSON response', function() { + + before(function() { + handler = function(req, res) { + res.writeHead(200, { 'Content-Type': 'application/javascript' }); + res.end(JSON.stringify({foo: 'bar'})); + } + }) + + it('uses a writableStream', function(done) { + var spy = sinon.spy(fs, 'createWriteStream'); + send_request(file, function(err, resp) { + resp.statusCode.should.eql(200); + spy.called.should.eql(true); + spy.restore(); + done(); + }) + }) + + it('writes a file', function(done) { + fs.existsSync(file).should.eql(false); + send_request(file, function(err, resp) { + fs.existsSync(file).should.eql(true); + done(); + }) + }) + + it('file size equals response length', function(done) { + send_request(file, function(err, resp) { + fs.statSync(file).size.should.equal(resp.bytes); + done(); + }) + }) + + it('response pipeline is honoured (JSON is decoded by default)', function(done) { + send_request_stream(file, function(err, resp) { + // we need to wait a bit since writing to config.output + // happens independently of needle's callback logic. + setTimeout(function() { + fs.readFileSync(file).toString().should.eql('{\"foo\":\"bar\"}'); + done(); + }, 20); + }) + }) + + it('closes the file descriptor', function(done) { + var open_descriptors = get_open_file_descriptors(); + send_request(file + Math.random(), function(err, resp) { + var current_descriptors = get_open_file_descriptors(); + open_descriptors.should.eql(current_descriptors); + done() + }) + }) + + }) + + describe('for a binary file', function() { + + var pixel = Buffer.from("base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs", "base64"); + + before(function() { + handler = function(req, res) { + res.writeHead(200, { 'Content-Type': 'application/octet-stream', 'Transfer-Encoding': 'chunked' }); + res.write(pixel.slice(0, 10)); + res.write(pixel.slice(10, 20)); + res.write(pixel.slice(20, 30)); + res.write(pixel.slice(30)); + res.end(); + } + }) + + it('uses a writableStream', function(done) { + var spy = sinon.spy(fs, 'createWriteStream'); + send_request(file, function(err, resp) { + resp.statusCode.should.eql(200); + spy.called.should.eql(true); + spy.restore(); + done(); + }) + }) + + it('writes a file', function(done) { + fs.existsSync(file).should.eql(false); + send_request(file, function(err, resp) { + fs.existsSync(file).should.eql(true); + done(); + }) + }) + + it('file size equals response length', function(done) { + send_request(file, function(err, resp) { + fs.statSync(file).size.should.equal(resp.bytes); + done(); + }) + }) + + it('file is equal to original buffer', function(done) { + send_request(file, function(err, resp) { + // we need to wait a bit since writing to config.output + // happens independently of needle's callback logic. + setTimeout(function() { + fs.readFileSync(file).should.eql(pixel); + done(); + }, 20); + }) + }) + + it('returns the data in resp.body too', function(done) { + send_request(file, function(err, resp) { + resp.body.should.eql(pixel); + done(); + }) + }) + + if (process.platform != 'win32') { + it('closes the file descriptor', function(done) { + var open_descriptors = get_open_file_descriptors(); + send_request(file + Math.random(), function(err, resp) { + var current_descriptors = get_open_file_descriptors(); + open_descriptors.should.eql(current_descriptors); + done() + }) + }) + } + + }) + + }) + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/parsing_spec.js b/legacy-libs/grpc/node_modules/needle/test/parsing_spec.js new file mode 100644 index 0000000..406a292 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/parsing_spec.js @@ -0,0 +1,494 @@ +var should = require('should'), + needle = require('./../'), + http = require('http'), + port = 11111, + server; + +describe('parsing', function(){ + + describe('when response is an JSON string', function(){ + + var json_string = '{"foo":"bar"}'; + + before(function(done){ + server = http.createServer(function(req, res) { + res.setHeader('Content-Type', 'application/json'); + res.end(json_string); + }).listen(port, done); + }); + + after(function(done){ + server.close(done); + }) + + describe('and parse option is not passed', function() { + + describe('with default parse_response', function() { + + before(function() { + needle.defaults().parse_response.should.eql('all') + }) + + it('should return object', function(done){ + needle.get('localhost:' + port, function(err, response, body){ + should.ifError(err); + body.should.have.property('foo', 'bar'); + done(); + }) + }) + + }) + + describe('and default parse_response is set to false', function() { + + it('does NOT return object when disabled using .defaults', function(done){ + needle.defaults({ parse_response: false }) + + needle.get('localhost:' + port, function(err, response, body) { + should.not.exist(err); + body.should.be.an.instanceof(Buffer) + body.toString().should.eql('{"foo":"bar"}'); + + needle.defaults({ parse_response: 'all' }); + done(); + }) + }) + + + }) + + }) + + describe('and parse option is true', function() { + + describe('and JSON is valid', function() { + + it('should return object', function(done) { + needle.get('localhost:' + port, { parse: true }, function(err, response, body){ + should.not.exist(err); + body.should.have.property('foo', 'bar') + done(); + }) + }) + + it('should have a .parser = json property', function(done) { + needle.get('localhost:' + port, { parse: true }, function(err, resp) { + should.not.exist(err); + resp.parser.should.eql('json'); + done(); + }) + }) + + }); + + describe('and response is empty', function() { + + var old_json_string; + + before(function() { + old_json_string = json_string; + json_string = ""; + }); + + after(function() { + json_string = old_json_string; + }); + + it('should return an empty string', function(done) { + needle.get('localhost:' + port, { parse: true }, function(err, resp) { + should.not.exist(err); + resp.body.should.equal(''); + done(); + }) + }) + + }) + + describe('and JSON is invalid', function() { + + var old_json_string; + + before(function() { + old_json_string = json_string; + json_string = "this is not going to work"; + }); + + after(function() { + json_string = old_json_string; + }); + + it('does not throw', function(done) { + (function(){ + needle.get('localhost:' + port, { parse: true }, done); + }).should.not.throw(); + }); + + it('does NOT return object', function(done) { + needle.get('localhost:' + port, { parse: true }, function(err, response, body) { + should.not.exist(err); + body.should.be.a.String; + body.toString().should.eql('this is not going to work'); + done(); + }) + }) + + }); + + }) + + describe('and parse option is false', function() { + + it('does NOT return object', function(done){ + needle.get('localhost:' + port, { parse: false }, function(err, response, body) { + should.not.exist(err); + body.should.be.an.instanceof(Buffer) + body.toString().should.eql('{"foo":"bar"}'); + done(); + }) + }) + + it('should NOT have a .parser = json property', function(done) { + needle.get('localhost:' + port, { parse: false }, function(err, resp) { + should.not.exist(err); + should.not.exist(resp.parser); + done(); + }) + }) + + }) + + describe('and parse option is "xml"', function() { + + it('does NOT return object', function(done){ + needle.get('localhost:' + port, { parse: 'xml' }, function(err, response, body) { + should.not.exist(err); + body.should.be.an.instanceof(Buffer) + body.toString().should.eql('{"foo":"bar"}'); + done(); + }) + }) + + it('should NOT have a .parser = json property', function(done) { + needle.get('localhost:' + port, { parse: 'xml' }, function(err, resp) { + should.not.exist(err); + should.not.exist(resp.parser); + done(); + }) + }) + + }) + + }); + + describe('when response is JSON \'false\'', function(){ + + var json_string = 'false'; + + before(function(done){ + server = http.createServer(function(req, res) { + res.setHeader('Content-Type', 'application/json'); + res.end(json_string); + }).listen(port, done); + }); + + after(function(done){ + server.close(done); + }) + + describe('and parse option is not passed', function() { + + it('should return object', function(done){ + needle.get('localhost:' + port, function(err, response, body){ + should.ifError(err); + body.should.equal(false); + done(); + }) + }) + + }) + + describe('and parse option is true', function() { + + describe('and JSON is valid', function() { + + it('should return object', function(done){ + needle.get('localhost:' + port, { parse: true }, function(err, response, body){ + should.not.exist(err); + body.should.equal(false) + done(); + }) + }) + + }); + + describe('and response is empty', function() { + + var old_json_string; + + before(function() { + old_json_string = json_string; + json_string = ""; + }); + + after(function() { + json_string = old_json_string; + }); + + it('should return an empty string', function(done) { + needle.get('localhost:' + port, { parse: true }, function(err, resp) { + should.not.exist(err); + resp.body.should.equal(''); + done(); + }) + }) + + }) + + describe('and JSON is invalid', function() { + + var old_json_string; + + before(function() { + old_json_string = json_string; + json_string = "this is not going to work"; + }); + + after(function() { + json_string = old_json_string; + }); + + it('does not throw', function(done) { + (function(){ + needle.get('localhost:' + port, { parse: true }, done); + }).should.not.throw(); + }); + + it('does NOT return object', function(done) { + needle.get('localhost:' + port, { parse: true }, function(err, response, body) { + should.not.exist(err); + body.should.be.a.String; + body.toString().should.eql('this is not going to work'); + done(); + }) + }) + + }); + + }) + + describe('and parse option is false', function() { + + it('does NOT return object', function(done){ + needle.get('localhost:' + port, { parse: false }, function(err, response, body) { + should.not.exist(err); + body.should.be.an.instanceof(Buffer) + body.toString().should.eql('false'); + done(); + }) + }) + + }) + + describe('and parse option is "xml"', function() { + + it('does NOT return object', function(done){ + needle.get('localhost:' + port, { parse: 'xml' }, function(err, response, body) { + should.not.exist(err); + body.should.be.an.instanceof(Buffer) + body.toString().should.eql('false'); + done(); + }) + }) + + }) + + + }); + + describe('when response is an invalid XML string', function(){ + + before(function(done){ + server = http.createServer(function(req, res) { + res.writeHeader(200, {'Content-Type': 'application/xml'}) + res.end("") + }).listen(port, done); + }); + + after(function(done){ + server.close(done); + }) + + describe('and parse_response is true', function(){ + + it('should return original string', function(done) { + needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) { + should.not.exist(err); + body.should.eql('') + should.not.exist(body.name); + done(); + }) + }) + + it('should not have a .parser = xml property', function(done) { + needle.get('localhost:' + port, { parse_response: true }, function(err, resp) { + should.not.exist(err); + should.not.exist(resp.parser); + done(); + }) + }) + + }) + + describe('and parse response is false', function(){ + + it('should return valid object', function(done) { + needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){ + should.not.exist(err); + body.toString().should.eql('') + done(); + }) + }) + + it('should not have a .parser property', function(done) { + needle.get('localhost:' + port, { parse_response: false }, function(err, resp) { + should.not.exist(err); + should.not.exist(resp.parser) + done(); + }) + }) + + }) + + }) + + describe('when response is a valid XML string', function(){ + + before(function(done) { + server = http.createServer(function(req, res) { + res.writeHeader(200, {'Content-Type': 'application/xml'}) + res.end("

hello

world

") + }).listen(port, done); + }); + + after(function(done) { + server.close(done); + }) + + describe('and parse_response is true', function(){ + + it('should return valid object', function(done) { + needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) { + should.not.exist(err); + body.name.should.eql('post') + body.children[0].name.should.eql('p') + body.children[0].value.should.eql('hello') + + body.children[1].name.should.eql('p') + body.children[1].value.should.eql('world') + done(); + }) + }) + + it('should have a .parser = xml property', function(done) { + needle.get('localhost:' + port, { parse_response: true }, function(err, resp) { + should.not.exist(err); + resp.parser.should.eql('xml'); + done(); + }) + }) + + }) + + describe('and parse response is false', function(){ + + it('should return valid object', function(done) { + needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){ + should.not.exist(err); + body.toString().should.eql('

hello

world

') + done(); + }) + }) + + it('should not have a .parser property', function(done) { + needle.get('localhost:' + port, { parse_response: false }, function(err, resp) { + should.not.exist(err); + should.not.exist(resp.parser) + done(); + }) + }) + + }) + + }) + + + describe('valid XML, using xml2js', function() { + + var parsers, origParser; + + before(function(done) { + var xml2js = require('xml2js') + parsers = require('../lib/parsers'); + origParser = parsers['application/xml']; + + var customParser = require('xml2js').parseString; + parsers.use('xml2js', ['application/xml'], function(buff, cb) { + var opts = { explicitRoot: true, explicitArray: false }; + customParser(buff, opts, cb); + }) + + server = http.createServer(function(req, res) { + res.writeHeader(200, {'Content-Type': 'application/xml'}) + res.end("

hello

world

") + }).listen(port, done); + }); + + after(function(done) { + parsers['application/xml'] = origParser; + server.close(done); + }) + + describe('and parse_response is true', function(){ + + it('should return valid object', function(done) { + needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) { + should.not.exist(err); + body.should.eql({ post: { p: ['hello', 'world' ]}}) + done(); + }) + }) + + it('should have a .parser = xml property', function(done) { + needle.get('localhost:' + port, { parse_response: true }, function(err, resp) { + should.not.exist(err); + resp.parser.should.eql('xml2js'); + done(); + }) + }) + + }) + + describe('and parse response is false', function(){ + + it('should return valid object', function(done) { + needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){ + should.not.exist(err); + body.toString().should.eql('

hello

world

') + done(); + }) + }) + + it('should not have a .parser property', function(done) { + needle.get('localhost:' + port, { parse_response: false }, function(err, resp) { + should.not.exist(err); + should.not.exist(resp.parser) + done(); + }) + }) + + }) + + }) + + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/post_data_spec.js b/legacy-libs/grpc/node_modules/needle/test/post_data_spec.js new file mode 100644 index 0000000..d9a28c6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/post_data_spec.js @@ -0,0 +1,1021 @@ +var needle = require('..'), + http = require('http'), + should = require('should'), + sinon = require('sinon'), + stream = require('stream'), + helpers = require('./helpers'); + +var multiparts = ['----------------------NODENEEDLEHTTPCLIENT']; +multiparts.push(['Content-Disposition: form-data; name=\"foo\"']) +multiparts.push(['\r\nbar\r\n----------------------NODENEEDLEHTTPCLIENT--']) +// multiparts.push(['Content-Disposition: form-data; name=\"test\"']) +// multiparts.push(['\r\næµè¯\r\n----------------------NODENEEDLEHTTPCLIENT--']) +// multiparts.push(['\r\n' + Buffer.from('测试').toString() + '\r\n----------------------NODENEEDLEHTTPCLIENT--']) + + +describe('post data (e.g. request body)', function() { + + var stub, spy, server; + + before(function(done) { + server = helpers.server({ port: 4321 }, done); + }) + + after(function(done) { + server.close(done); + }) + + afterEach(function() { + if (stub) stub.restore(); + if (spy) spy.restore(); + }) + + function get(data, opts, cb) { + return needle.request('get', 'http://localhost:' + 4321, data, opts, cb) + } + + function post(data, opts, cb) { + return needle.request('post', 'http://localhost:' + 4321, data, opts, cb) + } + + function spystub_request() { + var http_req = http.request; + stub = sinon.stub(http, 'request', function(opts, cb) { + var req = http_req(opts, cb); + spy = sinon.spy(req, 'write'); + return req; + }) + } + + function check_request(method) { + stub.calledOnce.should.be.true; + stub.args[0][0]['headers']['host'].should.equal('localhost:4321'); + stub.args[0][0]['method'].should.equal(method); + } + + describe('with multipart: true', function() { + + describe('when null', function() { + + it('sends request (non multipart)', function(done) { + spystub_request(); + + post(null, { multipart: true }, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('doesnt set Content-Type header', function(done) { + post(null, { multipart: true }, function(err, resp) { + should.not.exist(resp.body.headers['content-type']); + done(); + }) + }) + + it('doesnt change default Accept header', function(done) { + post(null, { multipart: true }, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('doesnt write anything', function(done) { + spystub_request(); + + post(null, { multipart: true }, function(err, resp) { + spy.called.should.be.false; + resp.body.body.should.eql(''); + done(); + }) + }) + + }) + + describe('when string', function() { + + it('explodes', function() { + (function() { + post('foobar', { multipart: true }) + }).should.throw() + }) + + }) + + describe('when object', function() { + + describe('get request', function() { + + it('sends request', function(done) { + spystub_request(); + + get({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { + check_request('get'); + done(); + }) + }) + + it('sets Content-Type header', function(done) { + post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { + resp.body.headers['content-type'].should.equal('multipart/form-data; boundary=--------------------NODENEEDLEHTTPCLIENT'); + done(); + }) + }) + + it('doesnt change default Accept header', function(done) { + post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('writes string as buffer', function(done) { + spystub_request(); + + get({ foo: 'bar' }, { multipart: true }, function(err, resp) { + spy.called.should.be.true; + + spy.args[0][0].should.be.an.instanceof(String); + spy.args[0][0].toString().should.equal(multiparts.join('\r\n')); + resp.body.body.should.eql(multiparts.join('\r\n')); + done(); + }) + }) + + it('writes japanese chars correctly as binary', function(done) { + spystub_request(); + + get({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { + spy.called.should.be.true; + + spy.args[0][0].should.be.an.instanceof(String); + Buffer.from(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d') + done(); + }) + }) + + + }) + + describe('post request', function() { + + it('sends request', function(done) { + spystub_request(); + + post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('writes string as buffer', function(done) { + spystub_request(); + + post({ foo: 'bar' }, { multipart: true }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].should.be.an.instanceof(String); + spy.args[0][0].toString().should.equal(multiparts.join('\r\n')); + resp.body.body.should.eql(multiparts.join('\r\n')); + done(); + }) + }) + + it('writes japanese chars correctly as binary', function(done) { + spystub_request(); + + post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].should.be.an.instanceof(String); + Buffer.from(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d') + done(); + }) + }) + + }) + + }) + + describe('when stream', function() { + + var stream_for_multipart; + + before(function() { + stream_for_multipart = new stream.Readable(); + stream_for_multipart._read = function() { + this.push('foobar'); + this.push(null); + } + }) + + it('explodes', function() { + (function() { + post(stream_for_multipart, { multipart: true }) + }).should.throw() + }) + + }) + + }) + + describe('non multipart', function() { + + describe('when null', function() { + + describe('get request', function() { + + it('sends request', function(done) { + spystub_request(); + + get(null, {}, function(err, resp) { + check_request('get'); + done(); + }) + }) + + it('doesnt write anything', function(done) { + spystub_request(); + + get(null, {}, function(err, resp) { + spy.called.should.be.false; + resp.body.body.should.eql(''); + done(); + }) + }) + + }) + + describe('post request', function() { + + it('sends request', function(done) { + spystub_request(); + + post(null, {}, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('doesnt write anything', function(done) { + spystub_request(); + + post(null, {}, function(err, resp) { + spy.called.should.be.false; + resp.body.body.should.eql(''); + done(); + }) + }) + + }) + + }) + + describe('when string with no equal sign', function() { + + describe('get request', function() { + + it('explodes', function() { + (function() { + get('foobar', {}) + }).should.throw() + }) + + }) + + describe('post request', function() { + + it('sends request', function(done) { + spystub_request(); + + post('foobar', {}, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('writes string as buffer', function(done) { + spystub_request(); + + post('foobar', {}, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].should.be.an.instanceof(Buffer); + spy.args[0][0].toString().should.equal('foobar'); + resp.body.body.should.eql('foobar'); + done(); + }) + }) + + }) + + }) + + describe('when string WITH equal sign', function() { + + describe('get request', function() { + + describe('with json: false (default)', function() { + + it('sends request, adding data as querystring', function(done) { + spystub_request(); + + get('foo=bar', { json: false }, function(err, resp) { + check_request('get'); + stub.args[0][0]['path'].should.equal('/?foo=bar') + done(); + }) + }) + + it('doesnt set Content-Type header', function(done) { + get('foo=bar', { json: false }, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + should.not.exist(resp.body.headers['content-type']); + done(); + }) + }) + + it('doesnt change default Accept header', function(done) { + get('foo=bar', { json: false }, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('doesnt write anything', function(done) { + get('foo=bar', { json: false }, function(err, resp) { + spy.called.should.be.false; + resp.body.body.should.eql(''); + done(); + }) + }) + + }) + + describe('with json: true', function() { + + it('sends request, without setting a querystring', function(done) { + spystub_request(); + + get('foo=bar', { json: true }, function(err, resp) { + check_request('get'); + stub.args[0][0]['path'].should.equal('/') + done(); + }) + }) + + it('sets Content-Type header', function(done) { + get('foo=bar', { json: true }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); + done(); + }) + }) + + it('set Accept header to application/json', function(done) { + get('foo=bar', { json: true }, function(err, resp) { + resp.body.headers['accept'].should.equal('application/json'); + done(); + }) + }) + + it('writes raw string (assuming it already is JSON, so no JSON.stringify)', function(done) { + get('foo=bar', { json: true }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].toString().should.eql('foo=bar') + resp.body.body.should.eql('foo=bar'); + done(); + }) + }) + + }) + + }) + + describe('post request', function() { + + describe('with json: false (default)', function() { + + it('sends request', function(done) { + spystub_request(); + + post('foo=bar', { json: false }, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('sets Content-Type header to www-form-urlencoded', function(done) { + post('foo=bar', { json: false }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); + done(); + }) + }) + + it('doesnt change default Accept header', function(done) { + post('foo=bar', { json: false }, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('writes as buffer', function(done) { + post('foo=bar', { json: false }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].should.be.an.instanceof(Buffer); + spy.args[0][0].toString().should.equal('foo=bar'); + resp.body.body.should.eql('foo=bar'); + done(); + }) + }) + + }) + + describe('with json: true', function() { + + it('sends request', function(done) { + spystub_request(); + + post('foo=bar', { json: true }, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('sets Content-Type header', function(done) { + post('foo=bar', { json: true }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); + done(); + }) + }) + + it('set Accept header to application/json', function(done) { + post('foo=bar', { json: true }, function(err, resp) { + resp.body.headers['accept'].should.equal('application/json'); + done(); + }) + }) + + it('writes raw string (assuming it already is JSON, so no JSON.stringify)', function(done) { + post('foo=bar', { json: true }, function(err, resp) { + spy.called.should.be.true; + var json = JSON.stringify('foo=bar'); + spy.args[0][0].toString().should.eql('foo=bar') + resp.body.body.should.eql('foo=bar'); + done(); + }) + }) + + }) + + }) + + }) + + describe('when object', function() { + + describe('get request', function() { + + describe('with json: false (default)', function() { + + it('sends request, adding data as querystring', function(done) { + spystub_request(); + + get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { + check_request('get'); + stub.args[0][0]['path'].should.equal('/?foo=bar&test=%E6%B5%8B%E8%AF%95') + done(); + }) + }) + + it('doesnt set Content-Type header', function(done) { + get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + should.not.exist(resp.body.headers['content-type']); + done(); + }) + }) + + it('doesnt change default Accept header', function(done) { + get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('doesnt write anything', function(done) { + get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { + spy.called.should.be.false; + resp.body.body.should.eql(''); + done(); + }) + }) + + }) + + describe('with json: true', function() { + + it('sends request, without setting a querystring', function(done) { + spystub_request(); + + get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { + check_request('get'); + stub.args[0][0]['path'].should.equal('/') + done(); + }) + }) + + it('sets Content-Type header', function(done) { + get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); + done(); + }) + }) + + it('set Accept header to application/json', function(done) { + get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { + resp.body.headers['accept'].should.equal('application/json'); + done(); + }) + }) + + it('writes JSON.stringify version of object', function(done) { + get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { + spy.called.should.be.true; + var json = JSON.stringify({ foo: 'bar', test: '测试' }) + spy.args[0][0].toString().should.eql(json) + resp.body.body.should.eql(json); + done(); + }) + }) + + }) + + }) + + describe('post request', function() { + + describe('with json: false (default)', function() { + + it('sends request', function(done) { + spystub_request(); + + post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('sets Content-Type header to www-form-urlencoded', function(done) { + post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); + done(); + }) + }) + + it('doesnt change default Accept header', function(done) { + post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('writes as buffer', function(done) { + post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].should.be.an.instanceof(Buffer); + spy.args[0][0].toString().should.equal('foo=bar&test=%E6%B5%8B%E8%AF%95'); + resp.body.body.should.eql('foo=bar&test=%E6%B5%8B%E8%AF%95'); + done(); + }) + }) + + }) + + describe('with json: false and content_type = "application/json"', function() { + + var opts = { json: false, content_type: 'application/json' }; + + it('sends request', function(done) { + spystub_request(); + + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('sets Content-Type header to application/json', function(done) { + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/json'); + done(); + }) + }) + + it('doesnt change default Accept header', function(done) { + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('writes as buffer', function(done) { + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].constructor.name.should.eql('Buffer'); + spy.args[0][0].toString().should.equal('foo=bar&test=%E6%B5%8B%E8%AF%95'); + resp.body.body.should.eql('foo=bar&test=%E6%B5%8B%E8%AF%95'); + done(); + }) + }) + + }) + + describe('with json: undefined but content-type = application/json', function() { + + var opts = { headers: { 'content-type': 'application/json' } }; + + it('sends request', function(done) { + spystub_request(); + + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('doesnt change Content-Type header', function(done) { + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/json'); + done(); + }) + }) + + it('leaves default Accept header', function(done) { + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('writes JSON.stringified object', function(done) { + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + spy.called.should.be.true; + var json = JSON.stringify({ foo: 'bar', test: '测试' }) + spy.args[0][0].toString().should.eql(json) + resp.body.body.should.eql(json); + done(); + }) + }) + }) + + describe('with json: true', function() { + + it('sends request', function(done) { + spystub_request(); + + post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('sets Content-Type header', function(done) { + post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); + done(); + }) + }) + + it('set Accept header to application/json', function(done) { + post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { + resp.body.headers['accept'].should.equal('application/json'); + done(); + }) + }) + + it('writes JSON.stringified object', function(done) { + post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { + spy.called.should.be.true; + var json = JSON.stringify({ foo: 'bar', test: '测试' }) + spy.args[0][0].toString().should.eql(json) + resp.body.body.should.eql(json); + done(); + }) + }) + + }) + + + describe('with json: true and content_type: */* (passed, not default)', function() { + + var opts = { json: true, accept: '*/*' }; + + it('sends request', function(done) { + spystub_request(); + + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('sets Content-Type header to application/json', function(done) { + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); + done(); + }) + }) + + it('respects Accept header set by user', function(done) { + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('writes JSON.stringified object', function(done) { + post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { + spy.called.should.be.true; + var json = JSON.stringify({ foo: 'bar', test: '测试' }) + spy.args[0][0].toString().should.eql(json) + resp.body.body.should.eql(json); + done(); + }) + }) + + }) + + }) + + }) + + describe('when buffer', function() { + + describe('get request', function() { + + describe('with json: false (default)', function() { + + it('sends request', function(done) { + spystub_request(); + + get(Buffer.from('foobar'), { json: false }, function(err, resp) { + check_request('get'); + done(); + }) + }) + + it('sets Content-Type header', function(done) { + get(Buffer.from('foobar'), { json: false }, function(err, resp) { + // should.not.exist(resp.body.headers['content-type']); + resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); + + done(); + }) + }) + + it('doesnt change default Accept header', function(done) { + get(Buffer.from('foobar'), { json: false }, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('writes as buffer', function(done) { + get(Buffer.from('foobar'), { json: false }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].should.be.an.instanceof(Buffer); + spy.args[0][0].toString().should.equal('foobar'); + resp.body.body.should.eql('foobar'); + done(); + }) + }) + + }) + + describe('with json: true', function() { + + it('sends request, without setting a querystring', function(done) { + spystub_request(); + + get(Buffer.from('foobar'), { json: true }, function(err, resp) { + check_request('get'); + done(); + }) + }) + + it('sets Content-Type header', function(done) { + get(Buffer.from('foobar'), { json: true }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); + done(); + }) + }) + + it('set Accept header to application/json', function(done) { + get(Buffer.from('foobar'), { json: true }, function(err, resp) { + resp.body.headers['accept'].should.equal('application/json'); + done(); + }) + }) + + it('writes JSON.stringify version of object', function(done) { + get(Buffer.from('foobar'), { json: true }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].toString().should.eql('foobar') + resp.body.body.should.eql('foobar'); + done(); + }) + }) + + }) + + }) + + describe('post request', function() { + + describe('with json: false (default)', function() { + + it('sends request', function(done) { + spystub_request(); + + post(Buffer.from('foobar'), { json: false }, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('sets Content-Type header to www-form-urlencoded', function(done) { + post(Buffer.from('foobar'), { json: false }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); + done(); + }) + }) + + it('doesnt change default Accept header', function(done) { + post(Buffer.from('foobar'), { json: false }, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('writes as buffer', function(done) { + post(Buffer.from('foobar'), { json: false }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].should.be.an.instanceof(Buffer); + spy.args[0][0].toString().should.equal('foobar'); + resp.body.body.should.eql('foobar'); + done(); + }) + }) + + }) + + describe('with json: true', function() { + + it('sends request', function(done) { + spystub_request(); + + post(Buffer.from('foobar'), { json: true }, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('sets Content-Type header', function(done) { + post(Buffer.from('foobar'), { json: true }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); + done(); + }) + }) + + it('set Accept header to application/json', function(done) { + post(Buffer.from('foobar'), { json: true }, function(err, resp) { + resp.body.headers['accept'].should.equal('application/json'); + done(); + }) + }) + + it('passes raw buffer (assuming its a JSON string beneath)', function(done) { + post(Buffer.from('foobar'), { json: true }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].toString().should.eql('foobar') + resp.body.body.should.eql('foobar'); + done(); + }) + }) + + }) + + }) + + }) + + describe('when stream', function() { + + var input_stream; + + beforeEach(function() { + input_stream = new stream.Readable(); + input_stream._read = function() { + this.push('foobar'); + this.push(null); + } + }) + + describe('get request', function() { + + it('explodes', function() { + (function() { + get(input_stream, {}) + }).should.throw() + }) + + }); + + describe('post request', function() { + + describe('with json: false (default)', function() { + + it('sends request', function(done) { + spystub_request(); + + post(input_stream, { json: false }, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('sets Content-Type header to www-form-urlencoded', function(done) { + post(input_stream, { json: false }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); + done(); + }) + }) + + it('doesnt change default Accept header', function(done) { + post(input_stream, { json: false }, function(err, resp) { + // resp.body contains 'header' and 'body', mirroring what we sent + resp.body.headers['accept'].should.equal('*/*'); + done(); + }) + }) + + it('writes as buffer', function(done) { + post(input_stream, { json: false }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].should.be.an.instanceof(Buffer); + spy.args[0][0].toString().should.equal('foobar'); + resp.body.body.should.eql('foobar'); + done(); + }) + }) + + }) + + describe('with json: true', function() { + + it('sends request', function(done) { + spystub_request(); + + post(input_stream, { json: true }, function(err, resp) { + check_request('post'); + done(); + }) + }) + + it('sets Content-Type header', function(done) { + post(input_stream, { json: true }, function(err, resp) { + resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); + done(); + }) + }) + + it('set Accept header to application/json', function(done) { + post(input_stream, { json: true }, function(err, resp) { + resp.body.headers['accept'].should.equal('application/json'); + done(); + }) + }) + + it('writes JSON.stringified object', function(done) { + post(input_stream, { json: true }, function(err, resp) { + spy.called.should.be.true; + spy.args[0][0].toString().should.eql('foobar') + resp.body.body.should.eql('foobar'); + done(); + }) + }) + + }) + + }) + + }) + + }) + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/proxy_spec.js b/legacy-libs/grpc/node_modules/needle/test/proxy_spec.js new file mode 100644 index 0000000..9526e7f --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/proxy_spec.js @@ -0,0 +1,202 @@ +var helpers = require('./helpers'), + should = require('should'), + sinon = require('sinon'), + http = require('http'), + needle = require('./../'); + +var port = 7707; +var url = 'localhost:' + port; +var nonexisting_host = 'awepfokawepofawe.com'; + +describe('proxy option', function() { + + var spy, opts; + + function send_request(opts, done) { + if (spy) spy.restore(); + spy = sinon.spy(http, 'request'); + needle.get(url, opts, done); + } + + ////////////////////// + // proxy opts helpers + + function not_proxied(done) { + return function(err, resp) { + var path = spy.args[0][0].path; + path.should.eql('/'); // not the full original URI + spy.restore(); + done(); + } + } + + function proxied(host, port, done) { + return function(err, resp) { + var path = spy.args[0][0].path; + path.should.eql('http://' + url); // the full original URI + + var http_host = spy.args[0][0].host; + if (http_host) http_host.should.eql(host); + + var http_port = spy.args[0][0].port; + if (http_port) http_port.should.eql(port); + + spy.restore(); + done(); + } + } + + ////////////////////// + // auth helpers + + function get_auth(header) { + var token = header.split(/\s+/).pop(); + return token && Buffer.from(token, 'base64').toString().split(':'); + } + + function no_proxy_auth(done) { + return function(err, resp) { + var headers = spy.args[0][0].headers; + Object.keys(headers).should.not.containEql('proxy-authorization'); + done(); + } + } + + function header_set(name, user, pass, done) { + return function(err, resp) { + var headers = spy.args[0][0].headers; + var auth = get_auth(headers[name]); + auth[0].should.eql(user); + auth[1].should.eql(pass); + done(); + } + } + + function proxy_auth_set(user, pass, done) { + return header_set('proxy-authorization', user, pass, done); + } + + function basic_auth_set(user, pass, done) { + return header_set('authorization', user, pass, done); + } + + after(function() { + spy.restore(); + }) + + describe('when null proxy is passed', function() { + + it('does not proxy', function(done) { + send_request({ proxy: null }, not_proxied(done)) + }) + + describe('but defaults has been set', function() { + + before(function() { + needle.defaults({ proxy: 'foobar' }); + }) + + after(function() { + needle.defaults({ proxy: null }); + }) + + it('tries to proxy anyway', function(done) { + send_request({}, proxied('foobar', 80, done)) + }) + + }) + + }) + + describe('when weird string is passed', function() { + + it('tries to proxy anyway', function(done) { + send_request({ proxy: 'alfalfa' }, proxied('alfalfa', 80, done)) + }) + }) + + describe('when valid url is passed', function() { + + it('proxies request', function(done) { + send_request({ proxy: nonexisting_host + ':123/done' }, proxied(nonexisting_host, '123', done)) + }) + + it('does not set a Proxy-Authorization header', function(done) { + send_request({ proxy: nonexisting_host + ':123/done' }, no_proxy_auth(done)); + }) + + describe('and proxy url contains user:pass', function() { + + before(function() { + opts = { + proxy: 'http://mj:x@' + nonexisting_host + ':123/done' + } + }) + + it('proxies request', function(done) { + send_request(opts, proxied(nonexisting_host, '123', done)) + }) + + it('sets Proxy-Authorization header', function(done) { + send_request(opts, proxy_auth_set('mj', 'x', done)); + }) + + }) + + describe('and a proxy_user is passed', function() { + + before(function() { + opts = { + proxy: nonexisting_host + ':123', + proxy_user: 'someone', + proxy_pass: 'else' + } + }) + + it('proxies request', function(done) { + send_request(opts, proxied(nonexisting_host, '123', done)) + }) + + it('sets Proxy-Authorization header', function(done) { + send_request(opts, proxy_auth_set('someone', 'else', done)); + }) + + describe('and url also contains user:pass', function() { + + it('url user:pass wins', function(done) { + var opts = { + proxy: 'http://xxx:yyy@' + nonexisting_host + ':123', + proxy_user: 'someone', + proxy_pass: 'else' + } + + send_request(opts, proxy_auth_set('xxx', 'yyy', done)); + }) + + }) + + describe('and options.username is also present', function() { + + before(function() { + opts = { proxy_user: 'foobar', username: 'someone' }; + }) + + it('a separate Authorization header is set', function(done) { + var opts = { + proxy: nonexisting_host + ':123', + proxy_user: 'someone', + proxy_pass: 'else', + username: 'test', + password: 'X' + } + + send_request(opts, basic_auth_set('test', 'X', done)); + }) + + }) + + }) + + }) + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/querystring_spec.js b/legacy-libs/grpc/node_modules/needle/test/querystring_spec.js new file mode 100644 index 0000000..34c1748 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/querystring_spec.js @@ -0,0 +1,128 @@ +var should = require('should'), + stringify = require('../lib/querystring').build; + +describe('stringify', function() { + + describe('with null', function() { + + it('throws', function() { + (function() { + var res = stringify(null); + }).should.throw(); + }) + + }) + + describe('with a number', function() { + + it('throws', function() { + (function() { + var res = stringify(100); + }).should.throw(); + }) + + }) + + describe('with a string', function() { + + describe('that is empty', function() { + + it('throws', function() { + (function() { + var res = stringify(''); + }).should.throw(); + }) + + }) + + describe('that doesnt contain an equal sign', function() { + + it('throws', function() { + (function() { + var res = stringify('boomshagalaga'); + }).should.throw(); + }) + + }) + + describe('that contains an equal sign', function() { + + it('works', function() { + var res = stringify('hello=123'); + res.should.eql('hello=123'); + }) + + }) + + }) + + describe('with an array', function() { + + describe('with key val objects', function() { + + it('works', function() { + var res = stringify([ {foo: 'bar'} ]); + res.should.eql('foo=bar'); + }) + + }) + + describe('where all elements are strings with an equal sign', function() { + + it('works', function() { + var res = stringify([ 'bar=123', 'quux=' ]); + res.should.eql('bar=123&quux='); + }) + + }) + + describe('with random words', function() { + + it('throws', function() { + (function() { + var res = stringify(['hello', 'there']); + }).should.throw(); + }) + + }) + + describe('with integers', function() { + + it('throws', function() { + (function() { + var res = stringify([123, 432]); + }).should.throw(); + }) + + }) + + }) + + describe('with an object', function() { + + it('works', function() { + var res = stringify({ test: 100 }); + res.should.eql('test=100'); + }) + + describe('with object where val is an array', function() { + + it('works', function() { + var res = stringify({ foo: ['bar', 'baz'] }); + res.should.eql('foo[]=bar&foo[]=baz'); + }) + + }) + + describe('with object where val is an array of key val objects', function() { + + it('works', function() { + var res = stringify({ foo: [{'1': 'bar'}, {'2': 'baz'}] }); + res.should.eql('foo[][1]=bar&foo[][2]=baz'); + }) + + }) + + }) + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/redirect_spec.js b/legacy-libs/grpc/node_modules/needle/test/redirect_spec.js new file mode 100644 index 0000000..9399c98 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/redirect_spec.js @@ -0,0 +1,392 @@ +var helpers = require('./helpers'), + should = require('should'), + sinon = require('sinon'), + needle = require('./../'); + +var ports = { + http : 8888, + https : 9999 +} + +var protocols = { + http : require('http'), + https : require('https') +} + +var code = 301; +var location; // var to set the response location + +function response_code() { + return code; +} + +function response_headers() { + return { 'Content-Type': 'text/plain', 'Location': location } +} + +describe('redirects', function() { + + var spies = {}, + servers = {}; + + var current_protocol; + var hostname = require('os').hostname(); + + // open two servers, one that responds to a redirect + before(function(done) { + + var conf = { + port : ports.http, + code : response_code, + headers : response_headers + } + + servers.http = helpers.server(conf, function() { + conf.port = ports.https; + conf.protocol = 'https'; + servers.https = helpers.server(conf, done); + }); + }) + + after(function(done) { + servers.http.close(function() { + servers.https.close(done); + }); + }) + + var prots = {'http': 'https'}; + Object.keys(prots).forEach(function(protocol) { + + current_protocol = protocol; + var other_protocol = protocol == 'http' ? 'https' : 'http'; + + var opts, // each test will modify this + host = '127.0.0.1', + url = protocol + '://' + host + ':' + ports[protocol] + '/hello'; + + function send_request(opts, cb) { + opts.rejectUnauthorized = false; + // console.log(' -- sending request ' + url + ' -- redirect to ' + location); + needle.post(url, { foo: 'bar' }, opts, cb); + } + + function not_followed(done) { + send_request(opts, function(err, resp) { + resp.statusCode.should.eql(301); + if (current_protocol == 'http') { + spies.http.callCount.should.eql(1); // only original request + spies.https.callCount.should.eql(0); + } else { + spies.http.callCount.should.eql(0); + spies.https.callCount.should.eql(1); // only original request + } + done(); + }) + } + + function followed_same_protocol(done) { + send_request(opts, function(err, resp) { + // the original request plus the redirect one + spies[current_protocol].callCount.should.eql(2); + done(); + }) + + } + + function followed_other_protocol(done) { + send_request(opts, function(err, resp) { + // on new node versions, https.request calls http.request internally, + // so we need to amount for that additional call. + + var http_calls = protocols.http.Agent.defaultMaxSockets == Infinity ? 2 : 1; + + spies.http.callCount.should.eql(http_calls); // the one(s) from http.request + spies.https.callCount.should.eql(1); // the one from https.request (redirect) + done(); + }) + } + + // set a spy on [protocol].request + // so we can see how many times a request was made + before(function() { + spies.http = sinon.spy(protocols.http, 'request'); + spies.https = sinon.spy(protocols.https, 'request'); + }) + + // and make sure it is restored after each test + afterEach(function() { + spies.http.reset(); + spies.https.reset(); + }) + + after(function() { + spies.http.restore(); + spies.https.restore(); + }) + + describe('when overriding defaults', function() { + + before(function() { + needle.defaults({ follow_max: 10 }); + opts = {}; + }) + + after(function() { + // reset values to previous + needle.defaults({ follow_max: 0 }); + }) + + describe('and redirected to the same path on same host and protocol', function() { + before(function() { + location = url; + }) + it('does not follow redirect', not_followed); + }) + + describe('and redirected to the same path on same host and different protocol', function() { + before(function() { + location = url.replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); + }) + + it('follows redirect', followed_other_protocol); + }) + + describe('and redirected to a different path on same host, same protocol', function() { + before(function() { + location = url.replace('/hello', '/goodbye'); + }) + it('follows redirect', followed_same_protocol); + }) + + describe('and redirected to a different path on same host, different protocol', function() { + before(function() { + location = url.replace('/hello', '/goodbye').replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); + }) + it('follows redirect', followed_other_protocol); + }) + + describe('and redirected to same path on another host, same protocol', function() { + before(function() { + location = url.replace(host, hostname); + }) + it('follows redirect', followed_same_protocol); + }) + + describe('and redirected to same path on another host, different protocol', function() { + before(function() { + location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); + }) + it('follows redirect', followed_other_protocol); + }) + + }) + + // false and null have the same result + var values = [false, null]; + values.forEach(function(value) { + + describe('when follow is ' + value, function() { + + before(function() { + opts = { follow: value }; + }) + + + + describe('and redirected to the same path on same host and protocol', function() { + before(function() { + location = url; + }) + + it('throws an error', function() { + (function() { + send_request(opts, function() { }); + }).should.throw; + }) + + }) + + }) + + }) + + describe('when follow is true', function() { + + before(function() { + opts = { follow: true }; + }) + + describe('and redirected to the same path on same host and protocol', function() { + before(function() { location = url }) + + it('throws an error', function() { + (function() { + send_request(opts, function() { }); + }).should.throw; + }) + + }) + + }) + + describe('when follow is > 0', function() { + + before(function() { + needle.defaults({ follow: 10 }); + }) + + after(function() { + needle.defaults({ follow: 0 }); + }) + + describe('when keep_method is false', function() { + + before(function() { + opts = { follow_keep_method: false }; + }) + + // defaults to follow host and protocol + describe('and redirected to the same path on same host and different protocol', function() { + + before(function() { + location = url.replace(protocol, other_protocol); + }) + + it('follows redirect', followed_other_protocol); + + it('sends a GET request with no data', function(done) { + send_request(opts, function(err, resp) { + spies.http.args[0][0].method.should.eql('GET'); + // spy.args[0][3].should.eql(null); + done(); + }) + }) + + }) + + }) + + describe('and set_referer is true', function() { + + before(function() { + opts = { follow_set_referer: true }; + }) + + // defaults to follow host and protocol + describe('and redirected to the same path on same host and different protocol', function() { + + before(function() { + location = url.replace(protocol, other_protocol); + }) + + it('follows redirect', followed_other_protocol); + + it('sets Referer header when following redirect', function(done) { + send_request(opts, function(err, resp) { + spies.http.args[0][0].headers['referer'].should.eql("http://" + host + ":8888/hello"); + // spies.http.args[0][3].should.eql({ foo: 'bar'}); + done(); + }) + }) + + }) + + }) + + describe('and keep_method is true', function() { + + before(function() { + opts = { follow_keep_method: true }; + }) + + // defaults to follow host and protocol + describe('and redirected to the same path on same host and different protocol', function() { + + before(function() { + location = url.replace(protocol, other_protocol); + }) + + it('follows redirect', followed_other_protocol); + + it('sends a POST request with the original data', function(done) { + send_request(opts, function(err, resp) { + spies.http.args[0][0].method.should.eql('post'); + // spies.http.args[0][3].should.eql({ foo: 'bar'}); + done(); + }) + }) + + }) + + }) + + describe('and if_same_host is false', function() { + + before(function() { + opts = { follow_if_same_host: false }; + }) + + // by default it will follow other protocols + describe('and redirected to same path on another domain, same protocol', function() { + before(function() { + location = url.replace(host, hostname); + }) + it('follows redirect', followed_same_protocol); + }) + + }) + + describe('and if_same_host is true', function() { + + before(function() { + opts = { follow_if_same_host: true }; + }) + + // by default it will follow other protocols + describe('and redirected to same path on another domain, same protocol', function() { + before(function() { + location = url.replace(host, hostname); + }) + + it('does not follow redirect', not_followed); + }) + + }) + + describe('and if_same_protocol is false', function() { + + before(function() { + opts = { follow_if_same_protocol: false }; + }) + + // by default it will follow other hosts + describe('and redirected to same path on another domain, different protocol', function() { + before(function() { + location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); + }) + it('follows redirect', followed_other_protocol); + }) + + }) + + describe('and if_same_protocol is true', function() { + + before(function() { + opts = { follow_if_same_protocol: true }; + }) + + // by default it will follow other hosts + describe('and redirected to same path on another domain, different protocol', function() { + before(function() { + location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); + }) + it('does not follow redirect', not_followed); + }) + + }) + + }) + + }) + +}); diff --git a/legacy-libs/grpc/node_modules/needle/test/redirect_with_timeout.js b/legacy-libs/grpc/node_modules/needle/test/redirect_with_timeout.js new file mode 100644 index 0000000..7e8e02e --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/redirect_with_timeout.js @@ -0,0 +1,45 @@ +var should = require('should') +var needle = require('./../') + +describe('follow redirects when read_timeout is set', function () { + + it('clear timeout before following redirect', function (done) { + var opts = { + open_timeout: 1000, + read_timeout: 3000, + follow: 5, + user_agent: 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36' + } + + var timedOut = 0 + var redirects = 0 + + var timer = setTimeout(function () { + var hasRedirects = redirects > 0 + hasRedirects.should.equal(true) + done() + }, opts.read_timeout || 3000) + + var resp = needle.get('http://google.com/', opts, function (err, resp, body) { + var noErr = err === null + var hasBody = body.length > 0 + noErr.should.equal(true); + hasBody.should.equal(true); + }); + + resp.on('redirect', function (location) { + redirects++ + // console.info(' Redirected to ', location) + }) + + resp.on('timeout', function (type) { + timedOut++ + timedOut.should.equal(0) + // console.error(' ', type, 'timeout') + clearTimeout(timer) + done() + }) + + }).timeout(30000) + +}) \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/needle/test/request_stream_spec.js b/legacy-libs/grpc/node_modules/needle/test/request_stream_spec.js new file mode 100644 index 0000000..1f02c8b --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/request_stream_spec.js @@ -0,0 +1,202 @@ +var fs = require('fs'), + needle = require('..'), + stream = require('stream'), + http = require('http'), + should = require('should'), + sinon = require('sinon'); + +var port = 2233; + +describe('request stream length', function() { + + var server, writable; + + function createServer() { + return http.createServer(function(req, res) { + + req.on('data', function(chunk) { + // console.log(chunk.length); + }) + + req.on('end', function() { + res.writeHeader(200, { 'Content-Type': 'application/json'}) + res.end(JSON.stringify({ headers: req.headers })) + }) + + }) + } + + before(function(done) { + server = createServer(); + server.listen(port, done) + }) + + beforeEach(function() { + writable = new stream.Readable(); + writable._read = function() { + this.push('hello world'); + this.push(null); + } + }) + + after(function(done) { + server.close(done) + }) + + function send_request(opts, cb) { + needle.post('http://localhost:' + port, writable, opts, function(err, resp) { + cb(err, resp) + }) + } + + describe('no stream_length set', function() { + + it('doesnt set Content-Length header', function(done) { + send_request({}, function(err, resp) { + should.not.exist(resp.body.headers['content-length']); + done() + }) + }) + + it('doesnt work if Transfer-Encoding is set to a blank string', function(done) { + send_request({ headers: { 'Transfer-Encoding': '' }}, function(err, resp) { + err.code.should.eql('ECONNRESET'); + done() + }) + }) + + it('works if Transfer-Encoding is not set', function(done) { + send_request({}, function(err, resp) { + should.not.exist(err); + resp.statusCode.should.eql(200); + done() + }) + }) + + }) + + describe('stream_length set to invalid value', function() { + + it('sets Content-Length header to that value', function(done) { + send_request({ stream_length: 5 }, function(err, resp) { + should.exist(err); + err.code.should.eql('ECONNRESET'); + done() + }) + }) + + it('doesnt work if Transfer-Encoding is set to a blank string', function(done) { + send_request({ stream_length: 5, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { + err.code.should.eql('ECONNRESET'); + done() + }) + }) + + it('doesnt work if Transfer-Encoding is not set', function(done) { + send_request({ stream_length: 5 }, function(err, resp) { + err.code.should.eql('ECONNRESET'); + done() + }) + }) + + }) + + describe('stream_length is set to valid value', function() { + + it('sets Content-Length header to that value', function(done) { + send_request({ stream_length: 11 }, function(err, resp) { + resp.body.headers['content-length'].should.eql('11'); + done() + }) + }) + + it('works if Transfer-Encoding is set to a blank string', function(done) { + send_request({ stream_length: 11, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { + should.not.exist(err); + resp.statusCode.should.eql(200); + done() + }) + }) + + it('works if Transfer-Encoding is not set', function(done) { + send_request({ stream_length: 11 }, function(err, resp) { + should.not.exist(err); + resp.statusCode.should.eql(200); + done() + }) + }) + + }) + + + describe('stream_length set to 0', function() { + + describe('stream with path', function() { + + var stub; + + beforeEach(function() { + writable.path = '/foo/bar'; + stub = sinon.stub(fs, 'stat', function(path, cb) { + cb(null, { size: 11 }) + }) + }) + + afterEach(function() { + stub.restore(); + }) + + it('sets Content-Length header to streams length', function(done) { + send_request({ stream_length: 0 }, function(err, resp) { + resp.body.headers['content-length'].should.eql('11'); + done() + }) + }) + + it('works if Transfer-Encoding is set to a blank string', function(done) { + send_request({ stream_length: 0, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { + should.not.exist(err); + resp.statusCode.should.eql(200); + done() + }) + }) + + it('works if Transfer-Encoding is not set', function(done) { + send_request({ stream_length: 0 }, function(err, resp) { + should.not.exist(err); + resp.statusCode.should.eql(200); + done() + }) + }) + + }) + + describe('stream without path', function() { + it('does not set Content-Length header', function(done) { + send_request({ stream_length: 0 }, function(err, resp) { + should.not.exist(resp.body.headers['content-length']); + done() + }) + }) + + it('doesnt work if Transfer-Encoding is set to a blank string', function(done) { + send_request({ stream_length: 0, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { + err.code.should.eql('ECONNRESET'); + done() + }) + }) + + it('works if Transfer-Encoding is not set', function(done) { + send_request({ stream_length: 0 }, function(err, resp) { + should.not.exist(err); + resp.statusCode.should.eql(200); + done() + }) + }) + + }) + + + }) + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/response_stream_spec.js b/legacy-libs/grpc/node_modules/needle/test/response_stream_spec.js new file mode 100644 index 0000000..ef20e38 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/response_stream_spec.js @@ -0,0 +1,139 @@ +var should = require('should'), + needle = require('./../'), + http = require('http'), + stream = require('stream'), + fs = require('fs'), + port = 11111, + server; + +describe('response streams', function() { + + describe('when the server sends back json', function(){ + + before(function() { + server = http.createServer(function(req, res) { + res.setHeader('Content-Type', 'application/json') + res.end('{"foo":"bar"}') + }).listen(port); + }); + + after(function() { + server.close(); + }) + + describe('and the client uses streams', function(){ + + it('should create a proper streams2 stream', function(done) { + var stream = needle.get('localhost:' + port) + + // newer node versions set this to null instead of false + var bool = !!stream._readableState.flowing; + should.equal(false, bool); + + var readableCalled = false; + stream.on('readable', function() { + readableCalled = true; + }) + + stream.on('done', function() { + readableCalled.should.be.true; + done(); + }); + + stream.resume() + + }) + + it('emits a single data item which is our JSON object', function(done) { + var stream = needle.get('localhost:' + port) + + var chunks = []; + stream.on('readable', function () { + while (chunk = this.read()) { + chunk.should.be.an.Object; + chunks.push(chunk); + } + }) + + stream.on('done', function () { + chunks.should.have.length(1) + chunks[0].should.have.property('foo', 'bar'); + done(); + }); + }) + + it('emits a raw buffer if we do not want to parse JSON', function(done) { + var stream = needle.get('localhost:' + port, { parse: false }) + + var chunks = []; + stream.on('readable', function () { + while (chunk = this.read()) { + Buffer.isBuffer(chunk).should.be.true; + chunks.push(chunk); + } + }) + + stream.on('done', function() { + var body = Buffer.concat(chunks).toString(); + body.should.equal('{"foo":"bar"}') + done(); + }); + }) + + }) + }) + + describe('when the server sends back what was posted to it', function () { + var file = 'asdf.txt'; + + before(function(done){ + server = http.createServer(function(req, res) { + res.setHeader('Content-Type', 'application/octet') + req.pipe(res); + }).listen(port); + + fs.writeFile(file, 'contents of stream', done); + }); + + after(function(done){ + server.close(); + fs.unlink(file, done); + }) + + it('can PUT a stream', function (done) { + var stream = needle.put('localhost:' + port, fs.createReadStream(file), { stream: true }); + + var chunks = []; + stream.on('readable', function () { + while (chunk = this.read()) { + Buffer.isBuffer(chunk).should.be.true; + chunks.push(chunk); + } + }) + + stream.on('end', function () { + var body = Buffer.concat(chunks).toString(); + body.should.equal('contents of stream') + done(); + }); + }); + + it('can PATCH a stream', function (done) { + var stream = needle.patch('localhost:' + port, fs.createReadStream(file), { stream: true }); + + var chunks = []; + stream.on('readable', function () { + while (chunk = this.read()) { + Buffer.isBuffer(chunk).should.be.true; + chunks.push(chunk); + } + }) + + stream.on('end', function () { + var body = Buffer.concat(chunks).toString(); + body.should.equal('contents of stream') + done(); + }); + }); + }) +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/socket_pool_spec.js b/legacy-libs/grpc/node_modules/needle/test/socket_pool_spec.js new file mode 100644 index 0000000..58ffa14 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/socket_pool_spec.js @@ -0,0 +1,66 @@ +var needle = require('../'), + should = require('should'), + http = require('http'); + +var server, port = 11112; + +describe('socket reuse', function() { + + before(function() { + server = http.createServer(function(req, res) { + res.setHeader('Content-Type', 'application/json'); + setTimeout(function() { + res.end('{"foo":"bar"}'); + }, 50); + }).listen(port); + }); + + after(function() { + server.close(); + }); + + describe('when sockets are reused', function() { + + var httpAgent = new http.Agent({ + keepAlive : true, + maxSockets : 1 + }); + + it('does not duplicate listeners on .end', function(done) { + + var last_error; + var count = 10; + + function completed(err) { + --count || done(last_error); + } + + function send() { + needle.get('localhost:' + port, { agent: httpAgent }, function(err, resp) { + if (err) + throw new Error("Unexpected error: " + err); + + // lets go through all sockets and inspect all socket objects + for (hostTarget in httpAgent.sockets) { + httpAgent.sockets[hostTarget].forEach(function(socket) { + // normally, there are 2 internal listeners and 1 needle sets up, + // but to be sure the test does not fail even if newer node versions + // introduce additional listeners, we use a higher limit. + try { + socket.listeners('end').length.should.be.below(5, "too many listeners on the socket object's end event"); + } catch (e) { + last_error = e; + } + }); + } + + completed(); + }); + } + + for (var i = 0; i < count; i++) { + send(); + } + }); + }); +}); diff --git a/legacy-libs/grpc/node_modules/needle/test/url_spec.js b/legacy-libs/grpc/node_modules/needle/test/url_spec.js new file mode 100644 index 0000000..8a0fa3e --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/url_spec.js @@ -0,0 +1,155 @@ +var needle = require('../'), + sinon = require('sinon'), + should = require('should'), + http = require('http'), + helpers = require('./helpers'); + +var port = 3456; + +describe('urls', function() { + + var server, url; + + function send_request(cb) { + return needle.get(url, cb); + } + + before(function(done){ + server = helpers.server({ port: port }, done); + }) + + after(function(done) { + server.close(done); + }) + + describe('null URL', function(){ + + it('throws', function(){ + (function() { + send_request() + }).should.throw(); + }) + + }) + + describe('invalid protocol', function(){ + + before(function() { + url = 'foo://google.com/what' + }) + + it('does not throw', function(done) { + (function() { + send_request(function(err) { + done(); + }) + }).should.not.throw() + }) + + it('returns an error', function(done) { + send_request(function(err) { + err.should.be.an.Error; + err.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/) + done(); + }) + }) + + }) + + describe('invalid host', function(){ + + before(function() { + url = 'http://s1\\\2.com/' + }) + + it('fails', function(done) { + (function() { + send_request(function(){ }) + }.should.throw(TypeError)) + done() + }) + + }) + +/* + describe('invalid path', function(){ + + before(function() { + url = 'http://www.google.com\\\/x\\\ %^&*() /x2.com/' + }) + + it('fails', function(done) { + send_request(function(err) { + err.should.be.an.Error; + done(); + }) + }) + + }) +*/ + + describe('valid protocol and path', function() { + + before(function() { + url = 'http://localhost:' + port + '/foo'; + }) + + it('works', function(done) { + send_request(function(err){ + should.not.exist(err); + done(); + }) + }) + + }) + + describe('no protocol but with slashes and valid path', function() { + + before(function() { + url = '//localhost:' + port + '/foo'; + }) + + it('works', function(done) { + send_request(function(err){ + should.not.exist(err); + done(); + }) + }) + + }) + + describe('no protocol nor slashes and valid path', function() { + + before(function() { + url = 'localhost:' + port + '/foo'; + }) + + it('works', function(done) { + send_request(function(err){ + should.not.exist(err); + done(); + }) + }) + + }) + + describe('double encoding', function() { + + var path = '/foo?email=' + encodeURIComponent('what-ever@Example.Com'); + + before(function() { + url = 'localhost:' + port + path + }); + + it('should not occur', function(done) { + send_request(function(err, res) { + should.not.exist(err); + should(res.req.path).be.exactly(path); + done(); + }); + + }); + + }) + +}) diff --git a/legacy-libs/grpc/node_modules/needle/test/utils/formidable.js b/legacy-libs/grpc/node_modules/needle/test/utils/formidable.js new file mode 100644 index 0000000..ba1d983 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/utils/formidable.js @@ -0,0 +1,17 @@ +var formidable = require('formidable'), + http = require('http'), + util = require('util'); + +var port = process.argv[2] || 8888; + +http.createServer(function(req, res) { + var form = new formidable.IncomingForm(); + form.parse(req, function(err, fields, files) { + res.writeHead(200, {'content-type': 'text/plain'}); + res.write('received upload:\n\n'); + console.log(util.inspect({fields: fields, files: files})) + res.end(util.inspect({fields: fields, files: files})); + }); +}).listen(port); + +console.log('HTTP server listening on port ' + port); \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/needle/test/utils/proxy.js b/legacy-libs/grpc/node_modules/needle/test/utils/proxy.js new file mode 100644 index 0000000..531bf49 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/utils/proxy.js @@ -0,0 +1,62 @@ +var http = require('http'), + https = require('https'), + url = require('url'); + +var port = 1234, + log = true, + request_auth = false; + +http.createServer(function(request, response) { + + console.log(request.headers); + console.log("Got request: " + request.url); + console.log("Forwarding request to " + request.headers['host']); + + if (request_auth) { + if (!request.headers['proxy-authorization']) { + response.writeHead(407, {'Proxy-Authenticate': 'Basic realm="proxy.com"'}) + return response.end('Hello.'); + } + } + + var remote = url.parse(request.url); + var protocol = remote.protocol == 'https:' ? https : http; + + var opts = { + host: request.headers['host'], + port: remote.port || (remote.protocol == 'https:' ? 443 : 80), + method: request.method, + path: remote.pathname, + headers: request.headers + } + + var proxy_request = protocol.request(opts, function(proxy_response){ + + proxy_response.on('data', function(chunk) { + if (log) console.log(chunk.toString()); + response.write(chunk, 'binary'); + }); + proxy_response.on('end', function() { + response.end(); + }); + + response.writeHead(proxy_response.statusCode, proxy_response.headers); + }); + + request.on('data', function(chunk) { + if (log) console.log(chunk.toString()); + proxy_request.write(chunk, 'binary'); + }); + + request.on('end', function() { + proxy_request.end(); + }); + +}).listen(port); + +process.on('uncaughtException', function(err){ + console.log('Uncaught exception!'); + console.log(err); +}); + +console.log("Proxy server listening on port " + port); diff --git a/legacy-libs/grpc/node_modules/needle/test/utils/test.js b/legacy-libs/grpc/node_modules/needle/test/utils/test.js new file mode 100644 index 0000000..8d58d70 --- /dev/null +++ b/legacy-libs/grpc/node_modules/needle/test/utils/test.js @@ -0,0 +1,104 @@ +// TODO: write specs. :) + +var fs = require('fs'), + client = require('./../../'); + +process.env.DEBUG = true; + +var response_callback = function(err, resp, body){ + console.log(err); + if(resp) console.log("Got status code " + resp.statusCode) + console.log(body); +} + +function simple_head(){ + client.head('http://www.amazon.com', response_callback); +} + +function simple_get(){ + client.get('http://www.nodejs.org', response_callback); +} + +function proxy_get(){ + client.get('https://www.google.com/search?q=nodejs', {proxy: 'http://localhost:1234'}, response_callback); +} + +function auth_get(){ + client.get('https://www.twitter.com', {username: 'asd', password: '123'}, response_callback); +} + +function simple_post(url){ + + var data = { + foo: 'bar', + baz: { + nested: 'attribute' + } + } + + client.post(url, data, response_callback); + +} + +function multipart_post(url){ + + var filename = 'test_file.txt'; + var data = 'Plain text data.\nLorem ipsum dolor sit amet.\nBla bla bla.\n'; + fs.writeFileSync(filename, data); + + var black_pixel = Buffer.from("data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=".replace(/^data:image\/\w+;base64,/, ""), "base64"); + + var data = { + foo: 'bar', + bar: 'baz', + nested: { + my_document: { file: filename, content_type: 'text/plain' }, + even: { + more: 'nesting' + } + }, + pixel: { filename: 'black_pixel.gif', buffer: black_pixel, content_type: 'image/gif' }, + field2: {value: JSON.stringify({"json":[ {"one":1}, {"two":2} ]}), content_type: 'application/json' } + } + + client.post(url, data, {multipart: true}, function(err, resp, body){ + + console.log(err); + console.log("Got status code " + resp.statusCode) + console.log(body); + fs.unlink(filename); + + }); + +} + +switch(process.argv[2]){ + case 'head': + simple_head(); + break; + case 'get': + simple_get(); + break; + case 'auth': + auth_get(); + break; + case 'proxy': + proxy_get(); + break; + case 'post': + simple_post(process.argv[3] || 'http://posttestserver.com/post.php'); + break; + case 'multipart': + multipart_post(process.argv[3] || 'http://posttestserver.com/post.php?dir=example'); + break; + case 'all': + simple_head(); + simple_get(); + auth_get(); + proxy_get(); + simple_post(process.argv[3] || 'http://posttestserver.com/post.php'); + multipart_post(process.argv[3] || 'http://posttestserver.com/post.php?dir=example'); + break; + default: + console.log("Usage: ./test.js [head|get|auth|proxy|multipart]") +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/CHANGELOG.md b/legacy-libs/grpc/node_modules/node-pre-gyp/CHANGELOG.md new file mode 100644 index 0000000..bed8edc --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/CHANGELOG.md @@ -0,0 +1,432 @@ +# node-pre-gyp changelog + +## 0.12.0 + +- Fixed double-build problem with node v10 (https://github.com/mapbox/node-pre-gyp/pull/428) +- Added node 11 support in the local database (https://github.com/mapbox/node-pre-gyp/pull/422) + +## 0.11.0 + +- Fixed double-install problem with node v10 +- Significant N-API improvements (https://github.com/mapbox/node-pre-gyp/pull/405) + +## 0.10.3 + +- Now will use `request` over `needle` if request is installed. By default `needle` is used for `https`. This should unbreak proxy support that regressed in v0.9.0 + +## 0.10.2 + +- Fixed rc/deep-extent security vulnerability +- Fixed broken reinstall script do to incorrectly named get_best_napi_version + +## 0.10.1 + +- Fix needle error event (@medns) + +## 0.10.0 + +- Allow for a single-level module path when packing @allenluce (https://github.com/mapbox/node-pre-gyp/pull/371) +- Log warnings instead of errors when falling back @xzyfer (https://github.com/mapbox/node-pre-gyp/pull/366) +- Add Node.js v10 support to tests (https://github.com/mapbox/node-pre-gyp/pull/372) +- Remove retire.js from CI (https://github.com/mapbox/node-pre-gyp/pull/372) +- Remove support for Node.js v4 due to [EOL on April 30th, 2018](https://github.com/nodejs/Release/blob/7dd52354049cae99eed0e9fe01345b0722a86fde/schedule.json#L14) +- Update appveyor tests to install default NPM version instead of NPM v2.x for all Windows builds (https://github.com/mapbox/node-pre-gyp/pull/375) + +## 0.9.1 + +- Fixed regression (in v0.9.0) with support for http redirects @allenluce (https://github.com/mapbox/node-pre-gyp/pull/361) + +## 0.9.0 + +- Switched from using `request` to `needle` to reduce size of module deps (https://github.com/mapbox/node-pre-gyp/pull/350) + +## 0.8.0 + +- N-API support (@inspiredware) + +## 0.7.1 + +- Upgraded to tar v4.x + +## 0.7.0 + + - Updated request and hawk (#347) + - Dropped node v0.10.x support + +## 0.6.40 + + - Improved error reporting if an install fails + +## 0.6.39 + + - Support for node v9 + - Support for versioning on `{libc}` to allow binaries to work on non-glic linux systems like alpine linux + + +## 0.6.38 + + - Maintaining compatibility (for v0.6.x series) with node v0.10.x + +## 0.6.37 + + - Solved one part of #276: now now deduce the node ABI from the major version for node >= 2 even when not stored in the abi_crosswalk.json + - Fixed docs to avoid mentioning the deprecated and dangerous `prepublish` in package.json (#291) + - Add new node versions to crosswalk + - Ported tests to use tape instead of mocha + - Got appveyor tests passing by downgrading npm and node-gyp + +## 0.6.36 + + - Removed the running of `testbinary` during install. Because this was regressed for so long, it is too dangerous to re-enable by default. Developers needing validation can call `node-pre-gyp testbinary` directory. + - Fixed regression in v0.6.35 for electron installs (now skipping binary validation which is not yet supported for electron) + +## 0.6.35 + + - No longer recommending `npm ls` in `prepublish` (#291) + - Fixed testbinary command (#283) @szdavid92 + +## 0.6.34 + + - Added new node versions to crosswalk, including v8 + - Upgraded deps to latest versions, started using `^` instead of `~` for all deps. + +## 0.6.33 + + - Improved support for yarn + +## 0.6.32 + + - Honor npm configuration for CA bundles (@heikkipora) + - Add node-pre-gyp and npm versions to user agent (@addaleax) + - Updated various deps + - Add known node version for v7.x + +## 0.6.31 + + - Updated various deps + +## 0.6.30 + + - Update to npmlog@4.x and semver@5.3.x + - Add known node version for v6.5.0 + +## 0.6.29 + + - Add known node versions for v0.10.45, v0.12.14, v4.4.4, v5.11.1, and v6.1.0 + +## 0.6.28 + + - Now more verbose when remote binaries are not available. This is needed since npm is increasingly more quiet by default + and users need to know why builds are falling back to source compiles that might then error out. + +## 0.6.27 + + - Add known node version for node v6 + - Stopped bundling dependencies + - Documented method for module authors to avoid bundling node-pre-gyp + - See https://github.com/mapbox/node-pre-gyp/tree/master#configuring for details + +## 0.6.26 + + - Skip validation for nw runtime (https://github.com/mapbox/node-pre-gyp/pull/181) via @fleg + +## 0.6.25 + + - Improved support for auto-detection of electron runtime in `node-pre-gyp.find()` + - Pull request from @enlight - https://github.com/mapbox/node-pre-gyp/pull/187 + - Add known node version for 4.4.1 and 5.9.1 + +## 0.6.24 + + - Add known node version for 5.8.0, 5.9.0, and 4.4.0. + +## 0.6.23 + + - Add known node version for 0.10.43, 0.12.11, 4.3.2, and 5.7.1. + +## 0.6.22 + + - Add known node version for 4.3.1, and 5.7.0. + +## 0.6.21 + + - Add known node version for 0.10.42, 0.12.10, 4.3.0, and 5.6.0. + +## 0.6.20 + + - Add known node version for 4.2.5, 4.2.6, 5.4.0, 5.4.1,and 5.5.0. + +## 0.6.19 + + - Add known node version for 4.2.4 + +## 0.6.18 + + - Add new known node versions for 0.10.x, 0.12.x, 4.x, and 5.x + +## 0.6.17 + + - Re-tagged to fix packaging problem of `Error: Cannot find module 'isarray'` + +## 0.6.16 + + - Added known version in crosswalk for 5.1.0. + +## 0.6.15 + + - Upgraded tar-pack (https://github.com/mapbox/node-pre-gyp/issues/182) + - Support custom binary hosting mirror (https://github.com/mapbox/node-pre-gyp/pull/170) + - Added known version in crosswalk for 4.2.2. + +## 0.6.14 + + - Added node 5.x version + +## 0.6.13 + + - Added more known node 4.x versions + +## 0.6.12 + + - Added support for [Electron](http://electron.atom.io/). Just pass the `--runtime=electron` flag when building/installing. Thanks @zcbenz + +## 0.6.11 + + - Added known node and io.js versions including more 3.x and 4.x versions + +## 0.6.10 + + - Added known node and io.js versions including 3.x and 4.x versions + - Upgraded `tar` dep + +## 0.6.9 + + - Upgraded `rc` dep + - Updated known io.js version: v2.4.0 + +## 0.6.8 + + - Upgraded `semver` and `rimraf` deps + - Updated known node and io.js versions + +## 0.6.7 + + - Fixed `node_abi` versions for io.js 1.1.x -> 1.8.x (should be 43, but was stored as 42) (refs https://github.com/iojs/build/issues/94) + +## 0.6.6 + + - Updated with known io.js 2.0.0 version + +## 0.6.5 + + - Now respecting `npm_config_node_gyp` (https://github.com/npm/npm/pull/4887) + - Updated to semver@4.3.2 + - Updated known node v0.12.x versions and io.js 1.x versions. + +## 0.6.4 + + - Improved support for `io.js` (@fengmk2) + - Test coverage improvements (@mikemorris) + - Fixed support for `--dist-url` that regressed in 0.6.3 + +## 0.6.3 + + - Added support for passing raw options to node-gyp using `--` separator. Flags passed after + the `--` to `node-pre-gyp configure` will be passed directly to gyp while flags passed + after the `--` will be passed directly to make/visual studio. + - Added `node-pre-gyp configure` command to be able to call `node-gyp configure` directly + - Fix issue with require validation not working on windows 7 (@edgarsilva) + +## 0.6.2 + + - Support for io.js >= v1.0.2 + - Deferred require of `request` and `tar` to help speed up command line usage of `node-pre-gyp`. + +## 0.6.1 + + - Fixed bundled `tar` version + +## 0.6.0 + + - BREAKING: node odd releases like v0.11.x now use `major.minor.patch` for `{node_abi}` instead of `NODE_MODULE_VERSION` (#124) + - Added support for `toolset` option in versioning. By default is an empty string but `--toolset` can be passed to publish or install to select alternative binaries that target a custom toolset like C++11. For example to target Visual Studio 2014 modules like node-sqlite3 use `--toolset=v140`. + - Added support for `--no-rollback` option to request that a failed binary test does not remove the binary module leaves it in place. + - Added support for `--update-binary` option to request an existing binary be re-installed and the check for a valid local module be skipped. + - Added support for passing build options from `npm` through `node-pre-gyp` to `node-gyp`: `--nodedir`, `--disturl`, `--python`, and `--msvs_version` + +## 0.5.31 + + - Added support for deducing node_abi for node.js runtime from previous release if the series is even + - Added support for --target=0.10.33 + +## 0.5.30 + + - Repackaged with latest bundled deps + +## 0.5.29 + + - Added support for semver `build`. + - Fixed support for downloading from urls that include `+`. + +## 0.5.28 + + - Now reporting unix style paths only in reveal command + +## 0.5.27 + + - Fixed support for auto-detecting s3 bucket name when it contains `.` - @taavo + - Fixed support for installing when path contains a `'` - @halfdan + - Ported tests to mocha + +## 0.5.26 + + - Fix node-webkit support when `--target` option is not provided + +## 0.5.25 + + - Fix bundling of deps + +## 0.5.24 + + - Updated ABI crosswalk to incldue node v0.10.30 and v0.10.31 + +## 0.5.23 + + - Added `reveal` command. Pass no options to get all versioning data as json. Pass a second arg to grab a single versioned property value + - Added support for `--silent` (shortcut for `--loglevel=silent`) + +## 0.5.22 + + - Fixed node-webkit versioning name (NOTE: node-webkit support still experimental) + +## 0.5.21 + + - New package to fix `shasum check failed` error with v0.5.20 + +## 0.5.20 + + - Now versioning node-webkit binaries based on major.minor.patch - assuming no compatible ABI across versions (#90) + +## 0.5.19 + + - Updated to know about more node-webkit releases + +## 0.5.18 + + - Updated to know about more node-webkit releases + +## 0.5.17 + + - Updated to know about node v0.10.29 release + +## 0.5.16 + + - Now supporting all aws-sdk configuration parameters (http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html) (#86) + +## 0.5.15 + + - Fixed installation of windows packages sub directories on unix systems (#84) + +## 0.5.14 + + - Finished support for cross building using `--target_platform` option (#82) + - Now skipping binary validation on install if target arch/platform do not match the host. + - Removed multi-arch validing for OS X since it required a FAT node.js binary + +## 0.5.13 + + - Fix problem in 0.5.12 whereby the wrong versions of mkdirp and semver where bundled. + +## 0.5.12 + + - Improved support for node-webkit (@Mithgol) + +## 0.5.11 + + - Updated target versions listing + +## 0.5.10 + + - Fixed handling of `-debug` flag passed directory to node-pre-gyp (#72) + - Added optional second arg to `node_pre_gyp.find` to customize the default versioning options used to locate the runtime binary + - Failed install due to `testbinary` check failure no longer leaves behind binary (#70) + +## 0.5.9 + + - Fixed regression in `testbinary` command causing installs to fail on windows with 0.5.7 (#60) + +## 0.5.8 + + - Started bundling deps + +## 0.5.7 + + - Fixed the `testbinary` check, which is used to determine whether to re-download or source compile, to work even in complex dependency situations (#63) + - Exposed the internal `testbinary` command in node-pre-gyp command line tool + - Fixed minor bug so that `fallback_to_build` option is always respected + +## 0.5.6 + + - Added support for versioning on the `name` value in `package.json` (#57). + - Moved to using streams for reading tarball when publishing (#52) + +## 0.5.5 + + - Improved binary validation that also now works with node-webkit (@Mithgol) + - Upgraded test apps to work with node v0.11.x + - Improved test coverage + +## 0.5.4 + + - No longer depends on external install of node-gyp for compiling builds. + +## 0.5.3 + + - Reverted fix for debian/nodejs since it broke windows (#45) + +## 0.5.2 + + - Support for debian systems where the node binary is named `nodejs` (#45) + - Added `bin/node-pre-gyp.cmd` to be able to run command on windows locally (npm creates an .npm automatically when globally installed) + - Updated abi-crosswalk with node v0.10.26 entry. + +## 0.5.1 + + - Various minor bug fixes, several improving windows support for publishing. + +## 0.5.0 + + - Changed property names in `binary` object: now required are `module_name`, `module_path`, and `host`. + - Now `module_path` supports versioning, which allows developers to opt-in to using a versioned install path (#18). + - Added `remote_path` which also supports versioning. + - Changed `remote_uri` to `host`. + +## 0.4.2 + + - Added support for `--target` flag to request cross-compile against a specific node/node-webkit version. + - Added preliminary support for node-webkit + - Fixed support for `--target_arch` option being respected in all cases. + +## 0.4.1 + + - Fixed exception when only stderr is available in binary test (@bendi / #31) + +## 0.4.0 + + - Enforce only `https:` based remote publishing access. + - Added `node-pre-gyp info` command to display listing of published binaries + - Added support for changing the directory node-pre-gyp should build in with the `-C/--directory` option. + - Added support for S3 prefixes. + +## 0.3.1 + + - Added `unpublish` command. + - Fixed module path construction in tests. + - Added ability to disable falling back to build behavior via `npm install --fallback-to-build=false` which overrides setting in a depedencies package.json `install` target. + +## 0.3.0 + + - Support for packaging all files in `module_path` directory - see `app4` for example + - Added `testpackage` command. + - Changed `clean` command to only delete `.node` not entire `build` directory since node-gyp will handle that. + - `.node` modules must be in a folder of there own since tar-pack will remove everything when it unpacks. diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/LICENSE b/legacy-libs/grpc/node_modules/node-pre-gyp/LICENSE new file mode 100644 index 0000000..8f5fce9 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/LICENSE @@ -0,0 +1,27 @@ +Copyright (c), Mapbox + +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 node-pre-gyp 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/legacy-libs/grpc/node_modules/node-pre-gyp/README.md b/legacy-libs/grpc/node_modules/node-pre-gyp/README.md new file mode 100644 index 0000000..088f2af --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/README.md @@ -0,0 +1,693 @@ +# node-pre-gyp + +#### node-pre-gyp makes it easy to publish and install Node.js C++ addons from binaries + +[![NPM](https://nodei.co/npm/node-pre-gyp.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-pre-gyp/) + +[![Build Status](https://api.travis-ci.org/mapbox/node-pre-gyp.svg)](https://travis-ci.org/mapbox/node-pre-gyp) +[![Build status](https://ci.appveyor.com/api/projects/status/3nxewb425y83c0gv)](https://ci.appveyor.com/project/Mapbox/node-pre-gyp) +[![Dependencies](https://david-dm.org/mapbox/node-pre-gyp.svg)](https://david-dm.org/mapbox/node-pre-gyp) + +`node-pre-gyp` stands between [npm](https://github.com/npm/npm) and [node-gyp](https://github.com/Tootallnate/node-gyp) and offers a cross-platform method of binary deployment. + +### Features + + - A command line tool called `node-pre-gyp` that can install your package's C++ module from a binary. + - A variety of developer targeted commands for packaging, testing, and publishing binaries. + - A JavaScript module that can dynamically require your installed binary: `require('node-pre-gyp').find` + +For a hello world example of a module packaged with `node-pre-gyp` see and [the wiki ](https://github.com/mapbox/node-pre-gyp/wiki/Modules-using-node-pre-gyp) for real world examples. + +## Credits + + - The module is modeled after [node-gyp](https://github.com/Tootallnate/node-gyp) by [@Tootallnate](https://github.com/Tootallnate) + - Motivation for initial development came from [@ErisDS](https://github.com/ErisDS) and the [Ghost Project](https://github.com/TryGhost/Ghost). + - Development is sponsored by [Mapbox](https://www.mapbox.com/) + +## FAQ + +See the [Frequently Ask Questions](https://github.com/mapbox/node-pre-gyp/wiki/FAQ). + +## Depends + + - Node.js >= node v6.x + +## Install + +`node-pre-gyp` is designed to be installed as a local dependency of your Node.js C++ addon and accessed like: + + ./node_modules/.bin/node-pre-gyp --help + +But you can also install it globally: + + npm install node-pre-gyp -g + +## Usage + +### Commands + +View all possible commands: + + node-pre-gyp --help + +- clean - Remove the entire folder containing the compiled .node module +- install - Install pre-built binary for module +- reinstall - Run "clean" and "install" at once +- build - Compile the module by dispatching to node-gyp or nw-gyp +- rebuild - Run "clean" and "build" at once +- package - Pack binary into tarball +- testpackage - Test that the staged package is valid +- publish - Publish pre-built binary +- unpublish - Unpublish pre-built binary +- info - Fetch info on published binaries + +You can also chain commands: + + node-pre-gyp clean build unpublish publish info + +### Options + +Options include: + + - `-C/--directory`: run the command in this directory + - `--build-from-source`: build from source instead of using pre-built binary + - `--update-binary`: reinstall by replacing previously installed local binary with remote binary + - `--runtime=node-webkit`: customize the runtime: `node`, `electron` and `node-webkit` are the valid options + - `--fallback-to-build`: fallback to building from source if pre-built binary is not available + - `--target=0.4.0`: Pass the target node or node-webkit version to compile against + - `--target_arch=ia32`: Pass the target arch and override the host `arch`. Valid values are 'ia32','x64', or `arm`. + - `--target_platform=win32`: Pass the target platform and override the host `platform`. Valid values are `linux`, `darwin`, `win32`, `sunos`, `freebsd`, `openbsd`, and `aix`. + +Both `--build-from-source` and `--fallback-to-build` can be passed alone or they can provide values. You can pass `--fallback-to-build=false` to override the option as declared in package.json. In addition to being able to pass `--build-from-source` you can also pass `--build-from-source=myapp` where `myapp` is the name of your module. + +For example: `npm install --build-from-source=myapp`. This is useful if: + + - `myapp` is referenced in the package.json of a larger app and therefore `myapp` is being installed as a dependency with `npm install`. + - The larger app also depends on other modules installed with `node-pre-gyp` + - You only want to trigger a source compile for `myapp` and the other modules. + +### Configuring + +This is a guide to configuring your module to use node-pre-gyp. + +#### 1) Add new entries to your `package.json` + + - Add `node-pre-gyp` to `dependencies` + - Add `aws-sdk` as a `devDependency` + - Add a custom `install` script + - Declare a `binary` object + +This looks like: + +```js + "dependencies" : { + "node-pre-gyp": "0.6.x" + }, + "devDependencies": { + "aws-sdk": "2.x" + } + "scripts": { + "install": "node-pre-gyp install --fallback-to-build" + }, + "binary": { + "module_name": "your_module", + "module_path": "./lib/binding/", + "host": "https://your_module.s3-us-west-1.amazonaws.com" + } +``` + +For a full example see [node-addon-examples's package.json](https://github.com/springmeyer/node-addon-example/blob/master/package.json). + +Let's break this down: + + - Dependencies need to list `node-pre-gyp` + - Your devDependencies should list `aws-sdk` so that you can run `node-pre-gyp publish` locally or a CI system. We recommend using `devDependencies` only since `aws-sdk` is large and not needed for `node-pre-gyp install` since it only uses http to fetch binaries + - Your `scripts` section should override the `install` target with `"install": "node-pre-gyp install --fallback-to-build"`. This allows node-pre-gyp to be used instead of the default npm behavior of always source compiling with `node-gyp` directly. + - Your package.json should contain a `binary` section describing key properties you provide to allow node-pre-gyp to package optimally. They are detailed below. + +Note: in the past we recommended putting `node-pre-gyp` in the `bundledDependencies`, but we no longer recommend this. In the past there were npm bugs (with node versions 0.10.x) that could lead to node-pre-gyp not being available at the right time during install (unless we bundled). This should no longer be the case. Also, for a time we recommended using `"preinstall": "npm install node-pre-gyp"` as an alternative method to avoid needing to bundle. But this did not behave predictably across all npm versions - see https://github.com/mapbox/node-pre-gyp/issues/260 for the details. So we do not recommend using `preinstall` to install `node-pre-gyp`. More history on this at https://github.com/strongloop/fsevents/issues/157#issuecomment-265545908. + +##### The `binary` object has three required properties + +###### module_name + +The name of your native node module. This value must: + + - Match the name passed to [the NODE_MODULE macro](http://nodejs.org/api/addons.html#addons_hello_world) + - Must be a valid C variable name (e.g. it cannot contain `-`) + - Should not include the `.node` extension. + +###### module_path + +The location your native module is placed after a build. This should be an empty directory without other Javascript files. This entire directory will be packaged in the binary tarball. When installing from a remote package this directory will be overwritten with the contents of the tarball. + +Note: This property supports variables based on [Versioning](#versioning). + +###### host + +A url to the remote location where you've published tarball binaries (must be `https` not `http`). + +It is highly recommended that you use Amazon S3. The reasons are: + + - Various node-pre-gyp commands like `publish` and `info` only work with an S3 host. + - S3 is a very solid hosting platform for distributing large files. + - We provide detail documentation for using [S3 hosting](#s3-hosting) with node-pre-gyp. + +Why then not require S3? Because while some applications using node-pre-gyp need to distribute binaries as large as 20-30 MB, others might have very small binaries and might wish to store them in a GitHub repo. This is not recommended, but if an author really wants to host in a non-S3 location then it should be possible. + +It should also be mentioned that there is an optional and entirely separate npm module called [node-pre-gyp-github](https://github.com/bchr02/node-pre-gyp-github) which is intended to complement node-pre-gyp and be installed along with it. It provides the ability to store and publish your binaries within your repositories GitHub Releases if you would rather not use S3 directly. Installation and usage instructions can be found [here](https://github.com/bchr02/node-pre-gyp-github), but the basic premise is that instead of using the ```node-pre-gyp publish``` command you would use ```node-pre-gyp-github publish```. + +##### The `binary` object has two optional properties + +###### remote_path + +It **is recommended** that you customize this property. This is an extra path to use for publishing and finding remote tarballs. The default value for `remote_path` is `""` meaning that if you do not provide it then all packages will be published at the base of the `host`. It is recommended to provide a value like `./{name}/v{version}` to help organize remote packages in the case that you choose to publish multiple node addons to the same `host`. + +Note: This property supports variables based on [Versioning](#versioning). + +###### package_name + +It is **not recommended** to override this property unless you are also overriding the `remote_path`. This is the versioned name of the remote tarball containing the binary `.node` module and any supporting files you've placed inside the `module_path` directory. Unless you specify `package_name` in your `package.json` then it defaults to `{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz` which allows your binary to work across node versions, platforms, and architectures. If you are using `remote_path` that is also versioned by `./{module_name}/v{version}` then you could remove these variables from the `package_name` and just use: `{node_abi}-{platform}-{arch}.tar.gz`. Then your remote tarball will be looked up at, for example, `https://example.com/your-module/v0.1.0/node-v11-linux-x64.tar.gz`. + +Avoiding the version of your module in the `package_name` and instead only embedding in a directory name can be useful when you want to make a quick tag of your module that does not change any C++ code. In this case you can just copy binaries to the new version behind the scenes like: + +```sh +aws s3 sync --acl public-read s3://mapbox-node-binary/sqlite3/v3.0.3/ s3://mapbox-node-binary/sqlite3/v3.0.4/ +``` + +Note: This property supports variables based on [Versioning](#versioning). + +#### 2) Add a new target to binding.gyp + +`node-pre-gyp` calls out to `node-gyp` to compile the module and passes variables along like [module_name](#module_name) and [module_path](#module_path). + +A new target must be added to `binding.gyp` that moves the compiled `.node` module from `./build/Release/module_name.node` into the directory specified by `module_path`. + +Add a target like this at the end of your `targets` list: + +```js + { + "target_name": "action_after_build", + "type": "none", + "dependencies": [ "<(module_name)" ], + "copies": [ + { + "files": [ "<(PRODUCT_DIR)/<(module_name).node" ], + "destination": "<(module_path)" + } + ] + } +``` + +For a full example see [node-addon-example's binding.gyp](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/binding.gyp). + +#### 3) Dynamically require your `.node` + +Inside the main js file that requires your addon module you are likely currently doing: + +```js +var binding = require('../build/Release/binding.node'); +``` + +or: + +```js +var bindings = require('./bindings') +``` + +Change those lines to: + +```js +var binary = require('node-pre-gyp'); +var path = require('path'); +var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json'))); +var binding = require(binding_path); +``` + +For a full example see [node-addon-example's index.js](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/index.js#L1-L4) + +#### 4) Build and package your app + +Now build your module from source: + + npm install --build-from-source + +The `--build-from-source` tells `node-pre-gyp` to not look for a remote package and instead dispatch to node-gyp to build. + +Now `node-pre-gyp` should now also be installed as a local dependency so the command line tool it offers can be found at `./node_modules/.bin/node-pre-gyp`. + +#### 5) Test + +Now `npm test` should work just as it did before. + +#### 6) Publish the tarball + +Then package your app: + + ./node_modules/.bin/node-pre-gyp package + +Once packaged, now you can publish: + + ./node_modules/.bin/node-pre-gyp publish + +Currently the `publish` command pushes your binary to S3. This requires: + + - You have installed `aws-sdk` with `npm install aws-sdk` + - You have created a bucket already. + - The `host` points to an S3 http or https endpoint. + - You have configured node-pre-gyp to read your S3 credentials (see [S3 hosting](#s3-hosting) for details). + +You can also host your binaries elsewhere. To do this requires: + + - You manually publish the binary created by the `package` command to an `https` endpoint + - Ensure that the `host` value points to your custom `https` endpoint. + +#### 7) Automate builds + +Now you need to publish builds for all the platforms and node versions you wish to support. This is best automated. + + - See [Appveyor Automation](#appveyor-automation) for how to auto-publish builds on Windows. + - See [Travis Automation](#travis-automation) for how to auto-publish builds on OS X and Linux. + +#### 8) You're done! + +Now publish your module to the npm registry. Users will now be able to install your module from a binary. + +What will happen is this: + +1. `npm install ` will pull from the npm registry +2. npm will run the `install` script which will call out to `node-pre-gyp` +3. `node-pre-gyp` will fetch the binary `.node` module and unpack in the right place +4. Assuming that all worked, you are done + +If a a binary was not available for a given platform and `--fallback-to-build` was used then `node-gyp rebuild` will be called to try to source compile the module. + +## N-API Considerations + +[N-API](https://nodejs.org/api/n-api.html#n_api_n_api) is an ABI-stable alternative to previous technologies such as [nan](https://github.com/nodejs/nan) which are tied to a specific Node runtime engine. N-API is Node runtime engine agnostic and guarantees modules created today will continue to run, without changes, into the future. + +Using `node-pre-gyp` with N-API projects requires a handful of additional configuration values and imposes some additional requirements. + +The most significant difference is that an N-API module can be coded to target multiple N-API versions. Therefore, an N-API module must declare in its `package.json` file which N-API versions the module is designed to run against. In addition, since multiple builds may be required for a single module, path and file names must be specified in way that avoids naming conflicts. + +### The `napi_versions` array property + +An N-API modules must declare in its `package.json` file, the N-API versions the module is intended to support. This is accomplished by including an `napi-versions` array property in the `binary` object. For example: + +```js +"binary": { + "module_name": "your_module", + "module_path": "your_module_path", + "host": "https://your_bucket.s3-us-west-1.amazonaws.com", + "napi_versions": [1,3] + } +``` + +If the `napi_versions` array property is *not* present, `node-pre-gyp` operates as it always has. Including the `napi_versions` array property instructs `node-pre-gyp` that this is a N-API module build. + +When the `napi_versions` array property is present, `node-pre-gyp` fires off multiple operations, one for each of the N-API versions in the array. In the example above, two operations are initiated, one for N-API version 1 and second for N-API version 3. How this version number is communicated is described next. + +### The `napi_build_version` value + +For each of the N-API module operations `node-pre-gyp` initiates, it ensures that the `napi_build_version` is set appropriately. + +This value is of importance in two areas: + +1. The C/C++ code which needs to know against which N-API version it should compile. +2. `node-pre-gyp` itself which must assign appropriate path and file names to avoid collisions. + +### Defining `NAPI_VERSION` for the C/C++ code + +The `napi_build_version` value is communicated to the C/C++ code by adding this code to the `binding.gyp` file: + +``` +"defines": [ + "NAPI_VERSION=<(napi_build_version)", +] +``` + +This ensures that `NAPI_VERSION`, an integer value, is declared appropriately to the C/C++ code for each build. + +> Note that earlier versions of this document recommended defining the symbol `NAPI_BUILD_VERSION`. `NAPI_VERSION` is prefered because it used by the N-API C/C++ headers to configure the specific N-API veriosn being requested. + +### Path and file naming requirements in `package.json` + +Since `node-pre-gyp` fires off multiple operations for each request, it is essential that path and file names be created in such a way as to avoid collisions. This is accomplished by imposing additional path and file naming requirements. + +Specifically, when performing N-API builds, the `{napi_build_version}` text configuration value *must* be present in the `module_path` property. In addition, the `{napi_build_version}` text configuration value *must* be present in either the `remote_path` or `package_name` property. (No problem if it's in both.) + +Here's an example: + +```js +"binary": { + "module_name": "your_module", + "module_path": "./lib/binding/napi-v{napi_build_version}", + "remote_path": "./{module_name}/v{version}/{configuration}/", + "package_name": "{platform}-{arch}-napi-v{napi_build_version}.tar.gz", + "host": "https://your_bucket.s3-us-west-1.amazonaws.com", + "napi_versions": [1,3] + } +``` + +## Supporting both N-API and NAN builds + +You may have a legacy native add-on that you wish to continue supporting for those versions of Node that do not support N-API, as you add N-API support for later Node versions. This can be accomplished by specifying the `node_napi_label` configuration value in the package.json `binary.package_name` property. + +Placing the configuration value `node_napi_label` in the package.json `binary.package_name` property instructs `node-pre-gyp` to build all viable N-API binaries supported by the current Node instance. If the current Node instance does not support N-API, `node-pre-gyp` will request a traditional, non-N-API build. + +The configuration value `node_napi_label` is set by `node-pre-gyp` to the type of build created, `napi` or `node`, and the version number. For N-API builds, the string contains the N-API version nad has values like `napi-v3`. For traditional, non-N-API builds, the string contains the ABI version with values like `node-v46`. + +Here's how the `binary` configuration above might be changed to support both N-API and NAN builds: + +```js +"binary": { + "module_name": "your_module", + "module_path": "./lib/binding/{node_napi_label}", + "remote_path": "./{module_name}/v{version}/{configuration}/", + "package_name": "{platform}-{arch}-{node_napi_label}.tar.gz", + "host": "https://your_bucket.s3-us-west-1.amazonaws.com", + "napi_versions": [1,3] + } +``` + +The C/C++ symbol `NAPI_VERSION` can be used to distinguish N-API and non-N-API builds. The value of `NAPI_VERSION` is set to the integer N-API version for N-API builds and is set to `0` for non-N-API builds. + +For example: + +```C +#if NAPI_VERSION +// N-API code goes here +#else +// NAN code goes here +#endif +``` + +### Two additional configuration values + +The following two configuration values, which were implemented in previous versions of `node-pre-gyp`, continue to exist, but have been replaced by the `node_napi_label` configuration value described above. + +1. `napi_version` If N-API is supported by the currently executing Node instance, this value is the N-API version number supported by Node. If N-API is not supported, this value is an empty string. + +2. `node_abi_napi` If the value returned for `napi_version` is non empty, this value is `'napi'`. If the value returned for `napi_version` is empty, this value is the value returned for `node_abi`. + +These values are present for use in the `binding.gyp` file and may be used as `{napi_version}` and `{node_abi_napi}` for text substituion in the `binary` properties of the `package.json` file. + +## S3 Hosting + +You can host wherever you choose but S3 is cheap, `node-pre-gyp publish` expects it, and S3 can be integrated well with [Travis.ci](http://travis-ci.org) to automate builds for OS X and Ubuntu, and with [Appveyor](http://appveyor.com) to automate builds for Windows. Here is an approach to do this: + +First, get setup locally and test the workflow: + +#### 1) Create an S3 bucket + +And have your **key** and **secret key** ready for writing to the bucket. + +It is recommended to create a IAM user with a policy that only gives permissions to the specific bucket you plan to publish to. This can be done in the [IAM console](https://console.aws.amazon.com/iam/) by: 1) adding a new user, 2) choosing `Attach User Policy`, 3) Using the `Policy Generator`, 4) selecting `Amazon S3` for the service, 5) adding the actions: `DeleteObject`, `GetObject`, `GetObjectAcl`, `ListBucket`, `PutObject`, `PutObjectAcl`, 6) adding an ARN of `arn:aws:s3:::bucket/*` (replacing `bucket` with your bucket name), and finally 7) clicking `Add Statement` and saving the policy. It should generate a policy like: + +```js +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "Stmt1394587197000", + "Effect": "Allow", + "Action": [ + "s3:DeleteObject", + "s3:GetObject", + "s3:GetObjectAcl", + "s3:ListBucket", + "s3:PutObject", + "s3:PutObjectAcl" + ], + "Resource": [ + "arn:aws:s3:::node-pre-gyp-tests/*" + ] + } + ] +} +``` + +#### 2) Install node-pre-gyp + +Either install it globally: + + npm install node-pre-gyp -g + +Or put the local version on your PATH + + export PATH=`pwd`/node_modules/.bin/:$PATH + +#### 3) Configure AWS credentials + +There are several ways to do this. + +You can use any of the methods described at http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html. + +Or you can create a `~/.node_pre_gyprc` + +Or pass options in any way supported by [RC](https://github.com/dominictarr/rc#standards) + +A `~/.node_pre_gyprc` looks like: + +```js +{ + "accessKeyId": "xxx", + "secretAccessKey": "xxx" +} +``` + +Another way is to use your environment: + + export node_pre_gyp_accessKeyId=xxx + export node_pre_gyp_secretAccessKey=xxx + +You may also need to specify the `region` if it is not explicit in the `host` value you use. The `bucket` can also be specified but it is optional because `node-pre-gyp` will detect it from the `host` value. + +#### 4) Package and publish your build + +Install the `aws-sdk`: + + npm install aws-sdk + +Then publish: + + node-pre-gyp package publish + +Note: if you hit an error like `Hostname/IP doesn't match certificate's altnames` it may mean that you need to provide the `region` option in your config. + +## Appveyor Automation + +[Appveyor](http://www.appveyor.com/) can build binaries and publish the results per commit and supports: + + - Windows Visual Studio 2013 and related compilers + - Both 64 bit (x64) and 32 bit (x86) build configurations + - Multiple Node.js versions + +For an example of doing this see [node-sqlite3's appveyor.yml](https://github.com/mapbox/node-sqlite3/blob/master/appveyor.yml). + +Below is a guide to getting set up: + +#### 1) Create a free Appveyor account + +Go to https://ci.appveyor.com/signup/free and sign in with your GitHub account. + +#### 2) Create a new project + +Go to https://ci.appveyor.com/projects/new and select the GitHub repo for your module + +#### 3) Add appveyor.yml and push it + +Once you have committed an `appveyor.yml` ([appveyor.yml reference](http://www.appveyor.com/docs/appveyor-yml)) to your GitHub repo and pushed it AppVeyor should automatically start building your project. + +#### 4) Create secure variables + +Encrypt your S3 AWS keys by going to and hitting the `encrypt` button. + +Then paste the result into your `appveyor.yml` + +```yml +environment: + node_pre_gyp_accessKeyId: + secure: Dn9HKdLNYvDgPdQOzRq/DqZ/MPhjknRHB1o+/lVU8MA= + node_pre_gyp_secretAccessKey: + secure: W1rwNoSnOku1r+28gnoufO8UA8iWADmL1LiiwH9IOkIVhDTNGdGPJqAlLjNqwLnL +``` + +NOTE: keys are per account but not per repo (this is difference than Travis where keys are per repo but not related to the account used to encrypt them). + +#### 5) Hook up publishing + +Just put `node-pre-gyp package publish` in your `appveyor.yml` after `npm install`. + +#### 6) Publish when you want + +You might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`: + + SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE% + if not "%CM%" == "%CM:[publish binary]=%" node-pre-gyp --msvs_version=2013 publish + +If your commit message contains special characters (e.g. `&`) this method might fail. An alternative is to use PowerShell, which gives you additional possibilities, like ignoring case by using `ToLower()`: + + ps: if($env:APPVEYOR_REPO_COMMIT_MESSAGE.ToLower().Contains('[publish binary]')) { node-pre-gyp --msvs_version=2013 publish } + +Remember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package. + +## Travis Automation + +[Travis](https://travis-ci.org/) can push to S3 after a successful build and supports both: + + - Ubuntu Precise and OS X (64 bit) + - Multiple Node.js versions + +For an example of doing this see [node-add-example's .travis.yml](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/.travis.yml). + +Note: if you need 32 bit binaries, this can be done from a 64 bit Travis machine. See [the node-sqlite3 scripts for an example of doing this](https://github.com/mapbox/node-sqlite3/blob/bae122aa6a2b8a45f6b717fab24e207740e32b5d/scripts/build_against_node.sh#L54-L74). + +Below is a guide to getting set up: + +#### 1) Install the Travis gem + + gem install travis + +#### 2) Create secure variables + +Make sure you run this command from within the directory of your module. + +Use `travis-encrypt` like: + + travis encrypt node_pre_gyp_accessKeyId=${node_pre_gyp_accessKeyId} + travis encrypt node_pre_gyp_secretAccessKey=${node_pre_gyp_secretAccessKey} + +Then put those values in your `.travis.yml` like: + +```yaml +env: + global: + - secure: F+sEL/v56CzHqmCSSES4pEyC9NeQlkoR0Gs/ZuZxX1ytrj8SKtp3MKqBj7zhIclSdXBz4Ev966Da5ctmcTd410p0b240MV6BVOkLUtkjZJyErMBOkeb8n8yVfSoeMx8RiIhBmIvEn+rlQq+bSFis61/JkE9rxsjkGRZi14hHr4M= + - secure: o2nkUQIiABD139XS6L8pxq3XO5gch27hvm/gOdV+dzNKc/s2KomVPWcOyXNxtJGhtecAkABzaW8KHDDi5QL1kNEFx6BxFVMLO8rjFPsMVaBG9Ks6JiDQkkmrGNcnVdxI/6EKTLHTH5WLsz8+J7caDBzvKbEfTux5EamEhxIWgrI= +``` + +More details on Travis encryption at http://about.travis-ci.org/docs/user/encryption-keys/. + +#### 3) Hook up publishing + +Just put `node-pre-gyp package publish` in your `.travis.yml` after `npm install`. + +##### OS X publishing + +If you want binaries for OS X in addition to linux you can enable [multi-os for Travis](http://docs.travis-ci.com/user/multi-os/#Setting-.travis.yml) + +Use a configuration like: + +```yml + +language: cpp + +os: +- linux +- osx + +env: + matrix: + - NODE_VERSION="4" + - NODE_VERSION="6" + +before_install: +- rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm +- source ~/.nvm/nvm.sh +- nvm install $NODE_VERSION +- nvm use $NODE_VERSION +``` + +See [Travis OS X Gotchas](#travis-os-x-gotchas) for why we replace `language: node_js` and `node_js:` sections with `language: cpp` and a custom matrix. + +Also create platform specific sections for any deps that need install. For example if you need libpng: + +```yml +- if [ $(uname -s) == 'Linux' ]; then apt-get install libpng-dev; fi; +- if [ $(uname -s) == 'Darwin' ]; then brew install libpng; fi; +``` + +For detailed multi-OS examples see [node-mapnik](https://github.com/mapnik/node-mapnik/blob/master/.travis.yml) and [node-sqlite3](https://github.com/mapbox/node-sqlite3/blob/master/.travis.yml). + +##### Travis OS X Gotchas + +First, unlike the Travis Linux machines, the OS X machines do not put `node-pre-gyp` on PATH by default. To do so you will need to: + +```sh +export PATH=$(pwd)/node_modules/.bin:${PATH} +``` + +Second, the OS X machines do not support using a matrix for installing different Node.js versions. So you need to bootstrap the installation of Node.js in a cross platform way. + +By doing: + +```yml +env: + matrix: + - NODE_VERSION="4" + - NODE_VERSION="6" + +before_install: + - rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm + - source ~/.nvm/nvm.sh + - nvm install $NODE_VERSION + - nvm use $NODE_VERSION +``` + +You can easily recreate the previous behavior of this matrix: + +```yml +node_js: + - "4" + - "6" +``` + +#### 4) Publish when you want + +You might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`: + + COMMIT_MESSAGE=$(git log --format=%B --no-merges -n 1 | tr -d '\n') + if [[ ${COMMIT_MESSAGE} =~ "[publish binary]" ]]; then node-pre-gyp publish; fi; + +Then you can trigger new binaries to be built like: + + git commit -a -m "[publish binary]" + +Or, if you don't have any changes to make simply run: + + git commit --allow-empty -m "[publish binary]" + +WARNING: if you are working in a pull request and publishing binaries from there then you will want to avoid double publishing when Travis CI builds both the `push` and `pr`. You only want to run the publish on the `push` commit. See https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/is_pr_merge.sh which is called from https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/publish.sh for an example of how to do this. + +Remember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package. To automate the publishing of your entire package to npm on Travis see http://about.travis-ci.org/docs/user/deployment/npm/ + +# Versioning + +The `binary` properties of `module_path`, `remote_path`, and `package_name` support variable substitution. The strings are evaluated by `node-pre-gyp` depending on your system and any custom build flags you passed. + + - `node_abi`: The node C++ `ABI` number. This value is available in Javascript as `process.versions.modules` as of [`>= v0.10.4 >= v0.11.7`](https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e) and in C++ as the `NODE_MODULE_VERSION` define much earlier. For versions of Node before this was available we fallback to the V8 major and minor version. + - `platform` matches node's `process.platform` like `linux`, `darwin`, and `win32` unless the user passed the `--target_platform` option to override. + - `arch` matches node's `process.arch` like `x64` or `ia32` unless the user passes the `--target_arch` option to override. + - `libc` matches `require('detect-libc').family` like `glibc` or `musl` unless the user passes the `--target_libc` option to override. + - `configuration` - Either 'Release' or 'Debug' depending on if `--debug` is passed during the build. + - `module_name` - the `binary.module_name` attribute from `package.json`. + - `version` - the semver `version` value for your module from `package.json` (NOTE: ignores the `semver.build` property). + - `major`, `minor`, `patch`, and `prelease` match the individual semver values for your module's `version` + - `build` - the sevmer `build` value. For example it would be `this.that` if your package.json `version` was `v1.0.0+this.that` + - `prerelease` - the semver `prerelease` value. For example it would be `alpha.beta` if your package.json `version` was `v1.0.0-alpha.beta` + + +The options are visible in the code at + +# Download binary files from a mirror + +S3 is broken in China for the well known reason. + +Using the `npm` config argument: `--{module_name}_binary_host_mirror` can download binary files through a mirror. + +e.g.: Install [v8-profiler](https://www.npmjs.com/package/v8-profiler) from `npm`. + +```bash +$ npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/ +``` diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/appveyor.yml b/legacy-libs/grpc/node_modules/node-pre-gyp/appveyor.yml new file mode 100644 index 0000000..2e74dbc --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/appveyor.yml @@ -0,0 +1,30 @@ +os: Visual Studio 2015 + +environment: + matrix: + - nodejs_version: 6 + - nodejs_version: 10 + +platform: + - x64 + - x86 + +shallow_clone: true + +install: + - ps: Install-Product node $env:nodejs_version $env:Platform + - ps: Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force + - npm config get + - node --version + - npm --version + - node -e "console.log(process.arch);" + - IF /I "%PLATFORM%" == "x64" set PATH=C:\Python27-x64;%PATH% + - IF /I "%PLATFORM%" == "x86" SET PATH=C:\python27;%PATH% + - IF /I "%PLATFORM%" == "x64" CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 + - IF /I "%PLATFORM%" == "x86" CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 + - npm install + - npm test + +build: off +test: off +deploy: off diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp b/legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp new file mode 100644 index 0000000..737b002 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp @@ -0,0 +1,134 @@ +#!/usr/bin/env node + +"use strict"; + +/** + * Set the title. + */ + +process.title = 'node-pre-gyp'; + +/** + * Module dependencies. + */ + +var node_pre_gyp = require('../'); +var log = require('npmlog'); + +/** + * Process and execute the selected commands. + */ + +var prog = new node_pre_gyp.Run(); +var completed = false; +prog.parseArgv(process.argv); + +if (prog.todo.length === 0) { + if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) { + console.log('v%s', prog.version); + return process.exit(0); + } else if (~process.argv.indexOf('-h') || ~process.argv.indexOf('--help')) { + console.log('%s', prog.usage()); + return process.exit(0); + } + console.log('%s', prog.usage()); + return process.exit(1); +} + +// if --no-color is passed +if (prog.opts && prog.opts.hasOwnProperty('color') && !prog.opts.color) { + log.disableColor(); +} + +log.info('it worked if it ends with', 'ok'); +log.verbose('cli', process.argv); +log.info('using', process.title + '@%s', prog.version); +log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch); + + +/** + * Change dir if -C/--directory was passed. + */ + +var dir = prog.opts.directory; +if (dir) { + var fs = require('fs'); + try { + var stat = fs.statSync(dir); + if (stat.isDirectory()) { + log.info('chdir', dir); + process.chdir(dir); + } else { + log.warn('chdir', dir + ' is not a directory'); + } + } catch (e) { + if (e.code === 'ENOENT') { + log.warn('chdir', dir + ' is not a directory'); + } else { + log.warn('chdir', 'error during chdir() "%s"', e.message); + } + } +} + +function run () { + var command = prog.todo.shift(); + if (!command) { + // done! + completed = true; + log.info('ok'); + return; + } + + prog.commands[command.name](command.args, function (err) { + if (err) { + log.error(command.name + ' error'); + log.error('stack', err.stack); + errorMessage(); + log.error('not ok'); + console.log(err.message); + return process.exit(1); + } + var args_array = [].slice.call(arguments, 1); + if (args_array.length) { + console.log.apply(console, args_array); + } + // now run the next command in the queue + process.nextTick(run); + }); +} + +process.on('exit', function (code) { + if (!completed && !code) { + log.error('Completion callback never invoked!'); + issueMessage(); + process.exit(6); + } +}); + +process.on('uncaughtException', function (err) { + log.error('UNCAUGHT EXCEPTION'); + log.error('stack', err.stack); + issueMessage(); + process.exit(7); +}); + +function errorMessage () { + // copied from npm's lib/util/error-handler.js + var os = require('os'); + log.error('System', os.type() + ' ' + os.release()); + log.error('command', process.argv.map(JSON.stringify).join(' ')); + log.error('cwd', process.cwd()); + log.error('node -v', process.version); + log.error(process.title+' -v', 'v' + prog.package.version); +} + +function issueMessage () { + errorMessage(); + log.error('', [ 'This is a bug in `'+process.title+'`.', + 'Try to update '+process.title+' and file an issue if it does not help:', + ' ', + ].join('\n')); +} + +// start running the given commands! +run(); diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd b/legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd new file mode 100644 index 0000000..46e14b5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd @@ -0,0 +1,2 @@ +@echo off +node "%~dp0\node-pre-gyp" %* diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/contributing.md b/legacy-libs/grpc/node_modules/node-pre-gyp/contributing.md new file mode 100644 index 0000000..4038fa6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/contributing.md @@ -0,0 +1,10 @@ +# Contributing + + +### Releasing a new version: + +- Ensure tests are passing on travis and appveyor +- Run `node scripts/abi_crosswalk.js` and commit any changes +- Update the changelog +- Tag a new release like: `git tag -a v0.6.34 -m "tagging v0.6.34" && git push --tags` +- Run `npm publish` diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/build.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/build.js new file mode 100644 index 0000000..43c137e --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/build.js @@ -0,0 +1,51 @@ +"use strict"; + +module.exports = exports = build; + +exports.usage = 'Attempts to compile the module by dispatching to node-gyp or nw-gyp'; + +var napi = require('./util/napi.js'); +var compile = require('./util/compile.js'); +var handle_gyp_opts = require('./util/handle_gyp_opts.js'); +var configure = require('./configure.js'); + +function do_build(gyp,argv,callback) { + handle_gyp_opts(gyp,argv,function(err,result) { + var final_args = ['build'].concat(result.gyp).concat(result.pre); + if (result.unparsed.length > 0) { + final_args = final_args. + concat(['--']). + concat(result.unparsed); + } + if (!err && result.opts.napi_build_version) { + napi.swap_build_dir_in(result.opts.napi_build_version); + } + compile.run_gyp(final_args,result.opts,function(err) { + if (result.opts.napi_build_version) { + napi.swap_build_dir_out(result.opts.napi_build_version); + } + return callback(err); + }); + }); +} + +function build(gyp, argv, callback) { + + // Form up commands to pass to node-gyp: + // We map `node-pre-gyp build` to `node-gyp configure build` so that we do not + // trigger a clean and therefore do not pay the penalty of a full recompile + if (argv.length && (argv.indexOf('rebuild') > -1)) { + argv.shift(); // remove `rebuild` + // here we map `node-pre-gyp rebuild` to `node-gyp rebuild` which internally means + // "clean + configure + build" and triggers a full recompile + compile.run_gyp(['clean'],{},function(err) { + if (err) return callback(err); + configure(gyp,argv,function(err) { + if (err) return callback(err); + return do_build(gyp,argv,callback); + }); + }); + } else { + return do_build(gyp,argv,callback); + } +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/clean.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/clean.js new file mode 100644 index 0000000..e2da17b --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/clean.js @@ -0,0 +1,32 @@ +"use strict"; + +module.exports = exports = clean; + +exports.usage = 'Removes the entire folder containing the compiled .node module'; + +var fs = require('fs'); +var rm = require('rimraf'); +var exists = require('fs').exists || require('path').exists; +var versioning = require('./util/versioning.js'); +var napi = require('./util/napi.js'); +var path = require('path'); + +function clean (gyp, argv, callback) { + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var napi_build_version = napi.get_napi_build_version_from_command_args(argv); + var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); + var to_delete = opts.module_path; + if (!to_delete) { + return callback(new Error("module_path is empty, refusing to delete")); + } else if (path.normalize(to_delete) == path.normalize(process.cwd())) { + return callback(new Error("module_path is not set, refusing to delete")); + } else { + exists(to_delete, function(found) { + if (found) { + if (!gyp.opts.silent_clean) console.log('['+package_json.name+'] Removing "%s"', to_delete); + return rm(to_delete, callback); + } + return callback(); + }); + } +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/configure.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/configure.js new file mode 100644 index 0000000..a6e3438 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/configure.js @@ -0,0 +1,52 @@ +"use strict"; + +module.exports = exports = configure; + +exports.usage = 'Attempts to configure node-gyp or nw-gyp build'; + +var napi = require('./util/napi.js'); +var compile = require('./util/compile.js'); +var handle_gyp_opts = require('./util/handle_gyp_opts.js'); + +function configure(gyp, argv, callback) { + handle_gyp_opts(gyp,argv,function(err,result) { + var final_args = result.gyp.concat(result.pre); + // pull select node-gyp configure options out of the npm environ + var known_gyp_args = ['dist-url','python','nodedir','msvs_version']; + known_gyp_args.forEach(function(key) { + var val = gyp.opts[key] || gyp.opts[key.replace('-','_')]; + if (val) { + final_args.push('--'+key+'='+val); + } + }); + // --ensure=false tell node-gyp to re-install node development headers + // but it is only respected by node-gyp install, so we have to call install + // as a separate step if the user passes it + if (gyp.opts.ensure === false) { + var install_args = final_args.concat(['install','--ensure=false']); + compile.run_gyp(install_args,result.opts,function(err) { + if (err) return callback(err); + if (result.unparsed.length > 0) { + final_args = final_args. + concat(['--']). + concat(result.unparsed); + } + compile.run_gyp(['configure'].concat(final_args),result.opts,function(err) { + return callback(err); + }); + }); + } else { + if (result.unparsed.length > 0) { + final_args = final_args. + concat(['--']). + concat(result.unparsed); + } + compile.run_gyp(['configure'].concat(final_args),result.opts,function(err) { + if (!err && result.opts.napi_build_version) { + napi.swap_build_dir_out(result.opts.napi_build_version); + } + return callback(err); + }); + } + }); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/info.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/info.js new file mode 100644 index 0000000..aff9bf8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/info.js @@ -0,0 +1,40 @@ +"use strict"; + +module.exports = exports = unpublish; + +exports.usage = 'Lists all published binaries (requires aws-sdk)'; + +var fs = require('fs'); +var log = require('npmlog'); +var versioning = require('./util/versioning.js'); +var s3_setup = require('./util/s3_setup.js'); +var config = require('rc')("node_pre_gyp",{acl:"public-read"}); + +function unpublish(gyp, argv, callback) { + var AWS = require("aws-sdk"); + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var opts = versioning.evaluate(package_json, gyp.opts); + s3_setup.detect(opts.hosted_path,config); + AWS.config.update(config); + var s3 = new AWS.S3(); + var s3_opts = { Bucket: config.bucket, + Prefix: config.prefix + }; + s3.listObjects(s3_opts, function(err, meta){ + if (err && err.code == 'NotFound') { + return callback(new Error('['+package_json.name+'] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix)); + } else if(err) { + return callback(err); + } else { + log.verbose(JSON.stringify(meta,null,1)); + if (meta && meta.Contents) { + meta.Contents.forEach(function(obj) { + console.log(obj.Key); + }); + } else { + console.error('['+package_json.name+'] No objects found at https://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix ); + } + return callback(); + } + }); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/install.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/install.js new file mode 100644 index 0000000..cacce67 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/install.js @@ -0,0 +1,255 @@ +"use strict"; + +module.exports = exports = install; + +exports.usage = 'Attempts to install pre-built binary for module'; + +var fs = require('fs'); +var path = require('path'); +var log = require('npmlog'); +var existsAsync = fs.exists || path.exists; +var versioning = require('./util/versioning.js'); +var napi = require('./util/napi.js'); +var mkdirp = require('mkdirp'); + +var npgVersion = 'unknown'; +try { + // Read own package.json to get the current node-pre-pyp version. + var ownPackageJSON = fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'); + npgVersion = JSON.parse(ownPackageJSON).version; +} catch (e) {} + +var http_get = { + impl: undefined, + type: undefined +}; + +try { + http_get.impl = require('request'); + http_get.type = 'request'; + log.warn("Using request for node-pre-gyp https download"); +} catch (e) { + http_get.impl = require('needle'); + http_get.type = 'needle'; + log.warn("Using needle for node-pre-gyp https download"); +} + +function download(uri,opts,callback) { + log.http('GET', uri); + + var req = null; + + // Try getting version info from the currently running npm. + var envVersionInfo = process.env.npm_config_user_agent || + 'node ' + process.version; + + var requestOpts = { + uri: uri.replace('+','%2B'), + headers: { + 'User-Agent': 'node-pre-gyp (v' + npgVersion + ', ' + envVersionInfo + ')' + }, + follow_max: 10, + }; + + if (opts.cafile) { + try { + requestOpts.ca = fs.readFileSync(opts.cafile); + } catch (e) { + return callback(e); + } + } else if (opts.ca) { + requestOpts.ca = opts.ca; + } + + var proxyUrl = opts.proxy || + process.env.http_proxy || + process.env.HTTP_PROXY || + process.env.npm_config_proxy; + if (proxyUrl) { + if (/^https?:\/\//i.test(proxyUrl)) { + log.verbose('download', 'using proxy url: "%s"', proxyUrl); + requestOpts.proxy = proxyUrl; + } else { + log.warn('download', 'ignoring invalid "proxy" config setting: "%s"', proxyUrl); + } + } + try { + req = http_get.impl.get(requestOpts.uri, requestOpts); + } catch (e) { + return callback(e); + } + if (req) { + req.on('response', function (res) { + log.http(res.statusCode, uri); + }); + } + return callback(null,req); +} + +function place_binary(from,to,opts,callback) { + download(from,opts,function(err,req) { + if (err) return callback(err); + if (!req) return callback(new Error("empty req")); + var badDownload = false; + var extractCount = 0; + var hasResponse = false; + var tar = require('tar'); + + function afterTarball(err) { + if (err) return callback(err); + if (badDownload) return callback(new Error("bad download")); + if (extractCount === 0) { + return callback(new Error('There was a fatal problem while downloading/extracting the tarball')); + } + log.info('tarball', 'done parsing tarball'); + callback(); + } + + function filter_func(entry) { + log.info('install','unpacking ' + entry.path); + extractCount++; + } + + // for request compatibility + req.on('error', function(err) { + badDownload = true; + if (!hasResponse) { + hasResponse = true; + return callback(err); + } + }); + + // for needle compatibility + req.on('err', function(err) { + badDownload = true; + if (!hasResponse) { + hasResponse = true; + return callback(err); + } + }); + + req.on('close', function () { + if (!hasResponse) { + hasResponse = true; + return callback(new Error('Connection closed while downloading tarball file')); + } + }); + + req.on('response', function(res) { + // ignore redirects, needle handles these automatically. + if (http_get.type === 'needle' && res.headers.hasOwnProperty('location') && res.headers.location !== '') { + return; + } + if (hasResponse) { + return; + } + hasResponse = true; + if (res.statusCode !== 200) { + badDownload = true; + var err = new Error(res.statusCode + ' status code downloading tarball ' + from); + err.statusCode = res.statusCode; + return callback(err); + } + // start unzipping and untaring + req.pipe(tar.extract({ + cwd: to, + strip: 1, + onentry: filter_func + }).on('close', afterTarball).on('error', callback)); + }); + }); +} + +function do_build(gyp,argv,callback) { + var args = ['rebuild'].concat(argv); + gyp.todo.push( { name: 'build', args: args } ); + process.nextTick(callback); +} + +function print_fallback_error(err,opts,package_json) { + var fallback_message = ' (falling back to source compile with node-gyp)'; + var full_message = ''; + if (err.statusCode !== undefined) { + // If we got a network response it but failed to download + // it means remote binaries are not available, so let's try to help + // the user/developer with the info to debug why + full_message = "Pre-built binaries not found for " + package_json.name + "@" + package_json.version; + full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")"; + full_message += fallback_message; + log.warn("Tried to download(" + err.statusCode + "): " + opts.hosted_tarball); + log.warn(full_message); + log.http(err.message); + } else { + // If we do not have a statusCode that means an unexpected error + // happened and prevented an http response, so we output the exact error + full_message = "Pre-built binaries not installable for " + package_json.name + "@" + package_json.version; + full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")"; + full_message += fallback_message; + log.warn(full_message); + log.warn("Hit error " + err.message); + } +} + +function install(gyp, argv, callback) { + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var napi_build_version = napi.get_napi_build_version_from_command_args(argv); + var source_build = gyp.opts['build-from-source'] || gyp.opts.build_from_source; + var update_binary = gyp.opts['update-binary'] || gyp.opts.update_binary; + var should_do_source_build = source_build === package_json.name || (source_build === true || source_build === 'true'); + if (should_do_source_build) { + log.info('build','requesting source compile'); + return do_build(gyp,argv,callback); + } else { + var fallback_to_build = gyp.opts['fallback-to-build'] || gyp.opts.fallback_to_build; + var should_do_fallback_build = fallback_to_build === package_json.name || (fallback_to_build === true || fallback_to_build === 'true'); + // but allow override from npm + if (process.env.npm_config_argv) { + var cooked = JSON.parse(process.env.npm_config_argv).cooked; + var match = cooked.indexOf("--fallback-to-build"); + if (match > -1 && cooked.length > match && cooked[match+1] == "false") { + should_do_fallback_build = false; + log.info('install','Build fallback disabled via npm flag: --fallback-to-build=false'); + } + } + var opts; + try { + opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); + } catch (err) { + return callback(err); + } + + opts.ca = gyp.opts.ca; + opts.cafile = gyp.opts.cafile; + + var from = opts.hosted_tarball; + var to = opts.module_path; + var binary_module = path.join(to,opts.module_name + '.node'); + existsAsync(binary_module,function(found) { + if (found && !update_binary) { + console.log('['+package_json.name+'] Success: "' + binary_module + '" already installed'); + console.log('Pass --update-binary to reinstall or --build-from-source to recompile'); + return callback(); + } else { + if (!update_binary) log.info('check','checked for "' + binary_module + '" (not found)'); + mkdirp(to,function(err) { + if (err) { + after_place(err); + } else { + place_binary(from,to,opts,after_place); + } + }); + } + function after_place(err) { + if (err && should_do_fallback_build) { + print_fallback_error(err,opts,package_json); + return do_build(gyp,argv,callback); + } else if (err) { + return callback(err); + } else { + console.log('['+package_json.name+'] Success: "' + binary_module + '" is installed via remote'); + return callback(); + } + } + }); + } +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/node-pre-gyp.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/node-pre-gyp.js new file mode 100644 index 0000000..7d09b5f --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/node-pre-gyp.js @@ -0,0 +1,203 @@ +"use strict"; + +/** + * Module exports. + */ + +module.exports = exports; + +/** + * Module dependencies. + */ + +var fs = require('fs'); +var path = require('path'); +var nopt = require('nopt'); +var log = require('npmlog'); +log.disableProgress(); +var napi = require('./util/napi.js'); + +var EE = require('events').EventEmitter; +var inherits = require('util').inherits; +var commands = [ + 'clean', + 'install', + 'reinstall', + 'build', + 'rebuild', + 'package', + 'testpackage', + 'publish', + 'unpublish', + 'info', + 'testbinary', + 'reveal', + 'configure' + ]; +var aliases = {}; + +// differentiate node-pre-gyp's logs from npm's +log.heading = 'node-pre-gyp'; + +exports.find = require('./pre-binding').find; + +function Run() { + var self = this; + + this.commands = {}; + + commands.forEach(function (command) { + self.commands[command] = function (argv, callback) { + log.verbose('command', command, argv); + return require('./' + command)(self, argv, callback); + }; + }); +} +inherits(Run, EE); +exports.Run = Run; +var proto = Run.prototype; + +/** + * Export the contents of the package.json. + */ + +proto.package = require('../package.json'); + +/** + * nopt configuration definitions + */ + +proto.configDefs = { + help: Boolean, // everywhere + arch: String, // 'configure' + debug: Boolean, // 'build' + directory: String, // bin + proxy: String, // 'install' + loglevel: String, // everywhere +}; + +/** + * nopt shorthands + */ + +proto.shorthands = { + release: '--no-debug', + C: '--directory', + debug: '--debug', + j: '--jobs', + silent: '--loglevel=silent', + silly: '--loglevel=silly', + verbose: '--loglevel=verbose', +}; + +/** + * expose the command aliases for the bin file to use. + */ + +proto.aliases = aliases; + +/** + * Parses the given argv array and sets the 'opts', + * 'argv' and 'command' properties. + */ + +proto.parseArgv = function parseOpts (argv) { + this.opts = nopt(this.configDefs, this.shorthands, argv); + this.argv = this.opts.argv.remain.slice(); + var commands = this.todo = []; + + // create a copy of the argv array with aliases mapped + argv = this.argv.map(function (arg) { + // is this an alias? + if (arg in this.aliases) { + arg = this.aliases[arg]; + } + return arg; + }, this); + + // process the mapped args into "command" objects ("name" and "args" props) + argv.slice().forEach(function (arg) { + if (arg in this.commands) { + var args = argv.splice(0, argv.indexOf(arg)); + argv.shift(); + if (commands.length > 0) { + commands[commands.length - 1].args = args; + } + commands.push({ name: arg, args: [] }); + } + }, this); + if (commands.length > 0) { + commands[commands.length - 1].args = argv.splice(0); + } + + // expand commands entries for multiple napi builds + var dir = this.opts.directory; + if (dir == null) dir = process.cwd(); + var package_json = JSON.parse(fs.readFileSync(path.join(dir,'package.json'))); + + this.todo = napi.expand_commands (package_json, this.opts, commands); + + // support for inheriting config env variables from npm + var npm_config_prefix = 'npm_config_'; + Object.keys(process.env).forEach(function (name) { + if (name.indexOf(npm_config_prefix) !== 0) return; + var val = process.env[name]; + if (name === npm_config_prefix + 'loglevel') { + log.level = val; + } else { + // add the user-defined options to the config + name = name.substring(npm_config_prefix.length); + // avoid npm argv clobber already present args + // which avoids problem of 'npm test' calling + // script that runs unique npm install commands + if (name === 'argv') { + if (this.opts.argv && + this.opts.argv.remain && + this.opts.argv.remain.length) { + // do nothing + } else { + this.opts[name] = val; + } + } else { + this.opts[name] = val; + } + } + }, this); + + if (this.opts.loglevel) { + log.level = this.opts.loglevel; + } + log.resume(); +}; + +/** + * Returns the usage instructions for node-pre-gyp. + */ + +proto.usage = function usage () { + var str = [ + '', + ' Usage: node-pre-gyp [options]', + '', + ' where is one of:', + commands.map(function (c) { + return ' - ' + c + ' - ' + require('./' + c).usage; + }).join('\n'), + '', + 'node-pre-gyp@' + this.version + ' ' + path.resolve(__dirname, '..'), + 'node@' + process.versions.node + ].join('\n'); + return str; +}; + +/** + * Version number getter. + */ + +Object.defineProperty(proto, 'version', { + get: function () { + return this.package.version; + }, + enumerable: true +}); + diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/package.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/package.js new file mode 100644 index 0000000..4959265 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/package.js @@ -0,0 +1,56 @@ +"use strict"; + +module.exports = exports = _package; + +exports.usage = 'Packs binary (and enclosing directory) into locally staged tarball'; + +var fs = require('fs'); +var path = require('path'); +var log = require('npmlog'); +var versioning = require('./util/versioning.js'); +var napi = require('./util/napi.js'); +var write = require('fs').createWriteStream; +var existsAsync = fs.exists || path.exists; +var mkdirp = require('mkdirp'); +var tar = require('tar'); + +function _package(gyp, argv, callback) { + var packlist = require('npm-packlist'); + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var napi_build_version = napi.get_napi_build_version_from_command_args(argv); + var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); + var from = opts.module_path; + var binary_module = path.join(from,opts.module_name + '.node'); + existsAsync(binary_module,function(found) { + if (!found) { + return callback(new Error("Cannot package because " + binary_module + " missing: run `node-pre-gyp rebuild` first")); + } + var tarball = opts.staged_tarball; + var filter_func = function(entry) { + // ensure directories are +x + // https://github.com/mapnik/node-mapnik/issues/262 + log.info('package','packing ' + entry.path); + return true; + }; + mkdirp(path.dirname(tarball),function(err) { + if (err) return callback(err); + packlist({ path: from }).then(function(files) { + var base = path.basename(from); + files = files.map(function(file) { + return path.join(base, file); + }); + tar.create({ + portable: true, + gzip: true, + onentry: filter_func, + file: tarball, + cwd: path.dirname(from) + }, files, function(err) { + if (err) console.error('['+package_json.name+'] ' + err.message); + else log.info('package','Binary staged at "' + tarball + '"'); + return callback(err); + }); + }, callback); + }); + }); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/pre-binding.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/pre-binding.js new file mode 100644 index 0000000..09e076d --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/pre-binding.js @@ -0,0 +1,30 @@ +"use strict"; + +var versioning = require('../lib/util/versioning.js'); +var napi = require('../lib/util/napi.js'); +var existsSync = require('fs').existsSync || require('path').existsSync; +var path = require('path'); + +module.exports = exports; + +exports.usage = 'Finds the require path for the node-pre-gyp installed module'; + +exports.validate = function(package_json,opts) { + versioning.validate_config(package_json,opts); +}; + +exports.find = function(package_json_path,opts) { + if (!existsSync(package_json_path)) { + throw new Error("package.json does not exist at " + package_json_path); + } + var package_json = require(package_json_path); + versioning.validate_config(package_json,opts); + var napi_build_version; + if (napi.get_napi_build_versions (package_json, opts)) { + napi_build_version = napi.get_best_napi_build_version(package_json, opts); + } + opts = opts || {}; + if (!opts.module_root) opts.module_root = path.dirname(package_json_path); + var meta = versioning.evaluate(package_json,opts,napi_build_version); + return meta.module; +}; diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/publish.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/publish.js new file mode 100644 index 0000000..376e398 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/publish.js @@ -0,0 +1,79 @@ +"use strict"; + +module.exports = exports = publish; + +exports.usage = 'Publishes pre-built binary (requires aws-sdk)'; + +var fs = require('fs'); +var path = require('path'); +var log = require('npmlog'); +var versioning = require('./util/versioning.js'); +var napi = require('./util/napi.js'); +var s3_setup = require('./util/s3_setup.js'); +var existsAsync = fs.exists || path.exists; +var url = require('url'); +var config = require('rc')("node_pre_gyp",{acl:"public-read"}); + +function publish(gyp, argv, callback) { + var AWS = require("aws-sdk"); + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var napi_build_version = napi.get_napi_build_version_from_command_args(argv); + var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); + var tarball = opts.staged_tarball; + existsAsync(tarball,function(found) { + if (!found) { + return callback(new Error("Cannot publish because " + tarball + " missing: run `node-pre-gyp package` first")); + } + log.info('publish', 'Detecting s3 credentials'); + s3_setup.detect(opts.hosted_path,config); + var key_name = url.resolve(config.prefix,opts.package_name); + log.info('publish', 'Authenticating with s3'); + AWS.config.update(config); + var s3 = new AWS.S3(); + var s3_opts = { Bucket: config.bucket, + Key: key_name + }; + var remote_package = 'https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key; + log.info('publish', 'Checking for existing binary at ' + remote_package); + s3.headObject(s3_opts, function(err, meta){ + if (meta) log.info('publish', JSON.stringify(meta)); + if (err && err.code == 'NotFound') { + // we are safe to publish because + // the object does not already exist + log.info('publish', 'Preparing to put object'); + var s3_put = new AWS.S3(); + var s3_put_opts = { ACL: config.acl, + Body: fs.createReadStream(tarball), + Bucket: config.bucket, + Key: key_name + }; + log.info('publish', 'Putting object'); + try { + s3_put.putObject(s3_put_opts, function(err, resp){ + log.info('publish', 'returned from putting object'); + if(err) { + log.info('publish', 's3 putObject error: "' + err + '"'); + return callback(err); + } + if (resp) log.info('publish', 's3 putObject response: "' + JSON.stringify(resp) + '"'); + log.info('publish', 'successfully put object'); + console.log('['+package_json.name+'] published to ' + remote_package); + return callback(); + }); + } catch (err) { + log.info('publish', 's3 putObject error: "' + err + '"'); + return callback(err); + } + } else if (err) { + log.info('publish', 's3 headObject error: "' + err + '"'); + return callback(err); + } else { + log.error('publish','Cannot publish over existing version'); + log.error('publish',"Update the 'version' field in package.json and try again"); + log.error('publish','If the previous version was published in error see:'); + log.error('publish','\t node-pre-gyp unpublish'); + return callback(new Error('Failed publishing to ' + remote_package)); + } + }); + }); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/rebuild.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/rebuild.js new file mode 100644 index 0000000..615a524 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/rebuild.js @@ -0,0 +1,21 @@ +"use strict"; + +module.exports = exports = rebuild; + +exports.usage = 'Runs "clean" and "build" at once'; + +var fs = require('fs'); +var napi = require('./util/napi.js'); + +function rebuild (gyp, argv, callback) { + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var commands = [ + { name: 'clean', args: [] }, + { name: 'build', args: ['rebuild'] } + ]; + commands = napi.expand_commands(package_json, gyp.opts, commands); + for (var i = commands.length; i !== 0; i--) { + gyp.todo.unshift(commands[i-1]); + } + process.nextTick(callback); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/reinstall.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/reinstall.js new file mode 100644 index 0000000..10e85fc --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/reinstall.js @@ -0,0 +1,20 @@ +"use strict"; + +module.exports = exports = rebuild; + +exports.usage = 'Runs "clean" and "install" at once'; + +var fs = require('fs'); +var napi = require('./util/napi.js'); + +function rebuild (gyp, argv, callback) { + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var installArgs = []; + var napi_build_version = napi.get_best_napi_build_version(package_json, gyp.opts); + if (napi_build_version != null) installArgs = [ napi.get_command_arg (napi_build_version) ]; + gyp.todo.unshift( + { name: 'clean', args: [] }, + { name: 'install', args: installArgs } + ); + process.nextTick(callback); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/reveal.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/reveal.js new file mode 100644 index 0000000..13d2f72 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/reveal.js @@ -0,0 +1,33 @@ +"use strict"; + +module.exports = exports = reveal; + +exports.usage = 'Reveals data on the versioned binary'; + +var fs = require('fs'); +var versioning = require('./util/versioning.js'); +var napi = require('./util/napi.js'); + +function unix_paths(key, val) { + return val && val.replace ? val.replace(/\\/g, '/') : val; +} + +function reveal(gyp, argv, callback) { + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var napi_build_version = napi.get_napi_build_version_from_command_args(argv); + var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); + var hit = false; + // if a second arg is passed look to see + // if it is a known option + //console.log(JSON.stringify(gyp.opts,null,1)) + var remain = gyp.opts.argv.remain[gyp.opts.argv.remain.length-1]; + if (remain && opts.hasOwnProperty(remain)) { + console.log(opts[remain].replace(/\\/g, '/')); + hit = true; + } + // otherwise return all options as json + if (!hit) { + console.log(JSON.stringify(opts,unix_paths,2)); + } + return callback(); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/testbinary.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/testbinary.js new file mode 100644 index 0000000..453987c --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/testbinary.js @@ -0,0 +1,81 @@ +"use strict"; + +module.exports = exports = testbinary; + +exports.usage = 'Tests that the binary.node can be required'; + +var fs = require('fs'); +var path = require('path'); +var log = require('npmlog'); +var cp = require('child_process'); +var versioning = require('./util/versioning.js'); +var napi = require('./util/napi.js'); +var path = require('path'); + +function testbinary(gyp, argv, callback) { + var args = []; + var options = {}; + var shell_cmd = process.execPath; + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var napi_build_version = napi.get_napi_build_version_from_command_args(argv); + var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); + // skip validation for runtimes we don't explicitly support (like electron) + if (opts.runtime && + opts.runtime !== 'node-webkit' && + opts.runtime !== 'node') { + return callback(); + } + var nw = (opts.runtime && opts.runtime === 'node-webkit'); + // ensure on windows that / are used for require path + var binary_module = opts.module.replace(/\\/g, '/'); + if ((process.arch != opts.target_arch) || + (process.platform != opts.target_platform)) { + var msg = "skipping validation since host platform/arch ("; + msg += process.platform+'/'+process.arch+")"; + msg += " does not match target ("; + msg += opts.target_platform+'/'+opts.target_arch+")"; + log.info('validate', msg); + return callback(); + } + if (nw) { + options.timeout = 5000; + if (process.platform === 'darwin') { + shell_cmd = 'node-webkit'; + } else if (process.platform === 'win32') { + shell_cmd = 'nw.exe'; + } else { + shell_cmd = 'nw'; + } + var modulePath = path.resolve(binary_module); + var appDir = path.join(__dirname, 'util', 'nw-pre-gyp'); + args.push(appDir); + args.push(modulePath); + log.info("validate","Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'"); + cp.execFile(shell_cmd, args, options, function(err, stdout, stderr) { + // check for normal timeout for node-webkit + if (err) { + if (err.killed === true && err.signal && err.signal.indexOf('SIG') > -1) { + return callback(); + } + var stderrLog = stderr.toString(); + log.info('stderr', stderrLog); + if( /^\s*Xlib:\s*extension\s*"RANDR"\s*missing\s*on\s*display\s*":\d+\.\d+"\.\s*$/.test(stderrLog) ){ + log.info('RANDR', 'stderr contains only RANDR error, ignored'); + return callback(); + } + return callback(err); + } + return callback(); + }); + return; + } + args.push('--eval'); + args.push("require('" + binary_module.replace(/'/g, '\'') +"')"); + log.info("validate","Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'"); + cp.execFile(shell_cmd, args, options, function(err, stdout, stderr) { + if (err) { + return callback(err, { stdout:stdout, stderr:stderr}); + } + return callback(); + }); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/testpackage.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/testpackage.js new file mode 100644 index 0000000..9091bc3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/testpackage.js @@ -0,0 +1,55 @@ +"use strict"; + +module.exports = exports = testpackage; + +exports.usage = 'Tests that the staged package is valid'; + +var fs = require('fs'); +var path = require('path'); +var log = require('npmlog'); +var existsAsync = fs.exists || path.exists; +var versioning = require('./util/versioning.js'); +var napi = require('./util/napi.js'); +var testbinary = require('./testbinary.js'); +var tar = require('tar'); +var mkdirp = require('mkdirp'); + +function testpackage(gyp, argv, callback) { + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var napi_build_version = napi.get_napi_build_version_from_command_args(argv); + var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); + var tarball = opts.staged_tarball; + existsAsync(tarball, function(found) { + if (!found) { + return callback(new Error("Cannot test package because " + tarball + " missing: run `node-pre-gyp package` first")); + } + var to = opts.module_path; + function filter_func(entry) { + log.info('install','unpacking [' + entry.path + ']'); + } + + mkdirp(to, function(err) { + if (err) { + return callback(err); + } else { + tar.extract({ + file: tarball, + cwd: to, + strip: 1, + onentry: filter_func + }).then(after_extract, callback); + } + }); + + function after_extract() { + testbinary(gyp,argv,function(err) { + if (err) { + return callback(err); + } else { + console.log('['+package_json.name+'] Package appears valid'); + return callback(); + } + }); + } + }); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/unpublish.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/unpublish.js new file mode 100644 index 0000000..94c93dd --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/unpublish.js @@ -0,0 +1,43 @@ +"use strict"; + +module.exports = exports = unpublish; + +exports.usage = 'Unpublishes pre-built binary (requires aws-sdk)'; + +var fs = require('fs'); +var log = require('npmlog'); +var versioning = require('./util/versioning.js'); +var napi = require('./util/napi.js'); +var s3_setup = require('./util/s3_setup.js'); +var url = require('url'); +var config = require('rc')("node_pre_gyp",{acl:"public-read"}); + +function unpublish(gyp, argv, callback) { + var AWS = require("aws-sdk"); + var package_json = JSON.parse(fs.readFileSync('./package.json')); + var napi_build_version = napi.get_napi_build_version_from_command_args(argv); + var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); + s3_setup.detect(opts.hosted_path,config); + AWS.config.update(config); + var key_name = url.resolve(config.prefix,opts.package_name); + var s3 = new AWS.S3(); + var s3_opts = { Bucket: config.bucket, + Key: key_name + }; + s3.headObject(s3_opts, function(err, meta) { + if (err && err.code == 'NotFound') { + console.log('['+package_json.name+'] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key); + return callback(); + } else if(err) { + return callback(err); + } else { + log.info('unpublish', JSON.stringify(meta)); + s3.deleteObject(s3_opts, function(err, resp) { + if (err) return callback(err); + log.info(JSON.stringify(resp)); + console.log('['+package_json.name+'] Success: removed https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key); + return callback(); + }); + } + }); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json new file mode 100644 index 0000000..a0c3af7 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json @@ -0,0 +1,1962 @@ +{ + "0.1.14": { + "node_abi": null, + "v8": "1.3" + }, + "0.1.15": { + "node_abi": null, + "v8": "1.3" + }, + "0.1.16": { + "node_abi": null, + "v8": "1.3" + }, + "0.1.17": { + "node_abi": null, + "v8": "1.3" + }, + "0.1.18": { + "node_abi": null, + "v8": "1.3" + }, + "0.1.19": { + "node_abi": null, + "v8": "2.0" + }, + "0.1.20": { + "node_abi": null, + "v8": "2.0" + }, + "0.1.21": { + "node_abi": null, + "v8": "2.0" + }, + "0.1.22": { + "node_abi": null, + "v8": "2.0" + }, + "0.1.23": { + "node_abi": null, + "v8": "2.0" + }, + "0.1.24": { + "node_abi": null, + "v8": "2.0" + }, + "0.1.25": { + "node_abi": null, + "v8": "2.0" + }, + "0.1.26": { + "node_abi": null, + "v8": "2.0" + }, + "0.1.27": { + "node_abi": null, + "v8": "2.1" + }, + "0.1.28": { + "node_abi": null, + "v8": "2.1" + }, + "0.1.29": { + "node_abi": null, + "v8": "2.1" + }, + "0.1.30": { + "node_abi": null, + "v8": "2.1" + }, + "0.1.31": { + "node_abi": null, + "v8": "2.1" + }, + "0.1.32": { + "node_abi": null, + "v8": "2.1" + }, + "0.1.33": { + "node_abi": null, + "v8": "2.1" + }, + "0.1.90": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.91": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.92": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.93": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.94": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.95": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.96": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.97": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.98": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.99": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.100": { + "node_abi": null, + "v8": "2.2" + }, + "0.1.101": { + "node_abi": null, + "v8": "2.3" + }, + "0.1.102": { + "node_abi": null, + "v8": "2.3" + }, + "0.1.103": { + "node_abi": null, + "v8": "2.3" + }, + "0.1.104": { + "node_abi": null, + "v8": "2.3" + }, + "0.2.0": { + "node_abi": 1, + "v8": "2.3" + }, + "0.2.1": { + "node_abi": 1, + "v8": "2.3" + }, + "0.2.2": { + "node_abi": 1, + "v8": "2.3" + }, + "0.2.3": { + "node_abi": 1, + "v8": "2.3" + }, + "0.2.4": { + "node_abi": 1, + "v8": "2.3" + }, + "0.2.5": { + "node_abi": 1, + "v8": "2.3" + }, + "0.2.6": { + "node_abi": 1, + "v8": "2.3" + }, + "0.3.0": { + "node_abi": 1, + "v8": "2.5" + }, + "0.3.1": { + "node_abi": 1, + "v8": "2.5" + }, + "0.3.2": { + "node_abi": 1, + "v8": "3.0" + }, + "0.3.3": { + "node_abi": 1, + "v8": "3.0" + }, + "0.3.4": { + "node_abi": 1, + "v8": "3.0" + }, + "0.3.5": { + "node_abi": 1, + "v8": "3.0" + }, + "0.3.6": { + "node_abi": 1, + "v8": "3.0" + }, + "0.3.7": { + "node_abi": 1, + "v8": "3.0" + }, + "0.3.8": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.0": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.1": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.2": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.3": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.4": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.5": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.6": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.7": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.8": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.9": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.10": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.11": { + "node_abi": 1, + "v8": "3.1" + }, + "0.4.12": { + "node_abi": 1, + "v8": "3.1" + }, + "0.5.0": { + "node_abi": 1, + "v8": "3.1" + }, + "0.5.1": { + "node_abi": 1, + "v8": "3.4" + }, + "0.5.2": { + "node_abi": 1, + "v8": "3.4" + }, + "0.5.3": { + "node_abi": 1, + "v8": "3.4" + }, + "0.5.4": { + "node_abi": 1, + "v8": "3.5" + }, + "0.5.5": { + "node_abi": 1, + "v8": "3.5" + }, + "0.5.6": { + "node_abi": 1, + "v8": "3.6" + }, + "0.5.7": { + "node_abi": 1, + "v8": "3.6" + }, + "0.5.8": { + "node_abi": 1, + "v8": "3.6" + }, + "0.5.9": { + "node_abi": 1, + "v8": "3.6" + }, + "0.5.10": { + "node_abi": 1, + "v8": "3.7" + }, + "0.6.0": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.1": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.2": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.3": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.4": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.5": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.6": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.7": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.8": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.9": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.10": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.11": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.12": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.13": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.14": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.15": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.16": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.17": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.18": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.19": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.20": { + "node_abi": 1, + "v8": "3.6" + }, + "0.6.21": { + "node_abi": 1, + "v8": "3.6" + }, + "0.7.0": { + "node_abi": 1, + "v8": "3.8" + }, + "0.7.1": { + "node_abi": 1, + "v8": "3.8" + }, + "0.7.2": { + "node_abi": 1, + "v8": "3.8" + }, + "0.7.3": { + "node_abi": 1, + "v8": "3.9" + }, + "0.7.4": { + "node_abi": 1, + "v8": "3.9" + }, + "0.7.5": { + "node_abi": 1, + "v8": "3.9" + }, + "0.7.6": { + "node_abi": 1, + "v8": "3.9" + }, + "0.7.7": { + "node_abi": 1, + "v8": "3.9" + }, + "0.7.8": { + "node_abi": 1, + "v8": "3.9" + }, + "0.7.9": { + "node_abi": 1, + "v8": "3.11" + }, + "0.7.10": { + "node_abi": 1, + "v8": "3.9" + }, + "0.7.11": { + "node_abi": 1, + "v8": "3.11" + }, + "0.7.12": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.0": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.1": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.2": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.3": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.4": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.5": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.6": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.7": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.8": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.9": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.10": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.11": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.12": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.13": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.14": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.15": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.16": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.17": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.18": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.19": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.20": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.21": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.22": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.23": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.24": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.25": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.26": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.27": { + "node_abi": 1, + "v8": "3.11" + }, + "0.8.28": { + "node_abi": 1, + "v8": "3.11" + }, + "0.9.0": { + "node_abi": 1, + "v8": "3.11" + }, + "0.9.1": { + "node_abi": 10, + "v8": "3.11" + }, + "0.9.2": { + "node_abi": 10, + "v8": "3.11" + }, + "0.9.3": { + "node_abi": 10, + "v8": "3.13" + }, + "0.9.4": { + "node_abi": 10, + "v8": "3.13" + }, + "0.9.5": { + "node_abi": 10, + "v8": "3.13" + }, + "0.9.6": { + "node_abi": 10, + "v8": "3.15" + }, + "0.9.7": { + "node_abi": 10, + "v8": "3.15" + }, + "0.9.8": { + "node_abi": 10, + "v8": "3.15" + }, + "0.9.9": { + "node_abi": 11, + "v8": "3.15" + }, + "0.9.10": { + "node_abi": 11, + "v8": "3.15" + }, + "0.9.11": { + "node_abi": 11, + "v8": "3.14" + }, + "0.9.12": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.0": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.1": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.2": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.3": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.4": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.5": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.6": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.7": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.8": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.9": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.10": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.11": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.12": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.13": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.14": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.15": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.16": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.17": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.18": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.19": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.20": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.21": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.22": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.23": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.24": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.25": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.26": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.27": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.28": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.29": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.30": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.31": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.32": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.33": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.34": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.35": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.36": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.37": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.38": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.39": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.40": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.41": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.42": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.43": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.44": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.45": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.46": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.47": { + "node_abi": 11, + "v8": "3.14" + }, + "0.10.48": { + "node_abi": 11, + "v8": "3.14" + }, + "0.11.0": { + "node_abi": 12, + "v8": "3.17" + }, + "0.11.1": { + "node_abi": 12, + "v8": "3.18" + }, + "0.11.2": { + "node_abi": 12, + "v8": "3.19" + }, + "0.11.3": { + "node_abi": 12, + "v8": "3.19" + }, + "0.11.4": { + "node_abi": 12, + "v8": "3.20" + }, + "0.11.5": { + "node_abi": 12, + "v8": "3.20" + }, + "0.11.6": { + "node_abi": 12, + "v8": "3.20" + }, + "0.11.7": { + "node_abi": 12, + "v8": "3.20" + }, + "0.11.8": { + "node_abi": 13, + "v8": "3.21" + }, + "0.11.9": { + "node_abi": 13, + "v8": "3.22" + }, + "0.11.10": { + "node_abi": 13, + "v8": "3.22" + }, + "0.11.11": { + "node_abi": 14, + "v8": "3.22" + }, + "0.11.12": { + "node_abi": 14, + "v8": "3.22" + }, + "0.11.13": { + "node_abi": 14, + "v8": "3.25" + }, + "0.11.14": { + "node_abi": 14, + "v8": "3.26" + }, + "0.11.15": { + "node_abi": 14, + "v8": "3.28" + }, + "0.11.16": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.0": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.1": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.2": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.3": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.4": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.5": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.6": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.7": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.8": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.9": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.10": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.11": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.12": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.13": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.14": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.15": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.16": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.17": { + "node_abi": 14, + "v8": "3.28" + }, + "0.12.18": { + "node_abi": 14, + "v8": "3.28" + }, + "1.0.0": { + "node_abi": 42, + "v8": "3.31" + }, + "1.0.1": { + "node_abi": 42, + "v8": "3.31" + }, + "1.0.2": { + "node_abi": 42, + "v8": "3.31" + }, + "1.0.3": { + "node_abi": 42, + "v8": "4.1" + }, + "1.0.4": { + "node_abi": 42, + "v8": "4.1" + }, + "1.1.0": { + "node_abi": 43, + "v8": "4.1" + }, + "1.2.0": { + "node_abi": 43, + "v8": "4.1" + }, + "1.3.0": { + "node_abi": 43, + "v8": "4.1" + }, + "1.4.1": { + "node_abi": 43, + "v8": "4.1" + }, + "1.4.2": { + "node_abi": 43, + "v8": "4.1" + }, + "1.4.3": { + "node_abi": 43, + "v8": "4.1" + }, + "1.5.0": { + "node_abi": 43, + "v8": "4.1" + }, + "1.5.1": { + "node_abi": 43, + "v8": "4.1" + }, + "1.6.0": { + "node_abi": 43, + "v8": "4.1" + }, + "1.6.1": { + "node_abi": 43, + "v8": "4.1" + }, + "1.6.2": { + "node_abi": 43, + "v8": "4.1" + }, + "1.6.3": { + "node_abi": 43, + "v8": "4.1" + }, + "1.6.4": { + "node_abi": 43, + "v8": "4.1" + }, + "1.7.1": { + "node_abi": 43, + "v8": "4.1" + }, + "1.8.1": { + "node_abi": 43, + "v8": "4.1" + }, + "1.8.2": { + "node_abi": 43, + "v8": "4.1" + }, + "1.8.3": { + "node_abi": 43, + "v8": "4.1" + }, + "1.8.4": { + "node_abi": 43, + "v8": "4.1" + }, + "2.0.0": { + "node_abi": 44, + "v8": "4.2" + }, + "2.0.1": { + "node_abi": 44, + "v8": "4.2" + }, + "2.0.2": { + "node_abi": 44, + "v8": "4.2" + }, + "2.1.0": { + "node_abi": 44, + "v8": "4.2" + }, + "2.2.0": { + "node_abi": 44, + "v8": "4.2" + }, + "2.2.1": { + "node_abi": 44, + "v8": "4.2" + }, + "2.3.0": { + "node_abi": 44, + "v8": "4.2" + }, + "2.3.1": { + "node_abi": 44, + "v8": "4.2" + }, + "2.3.2": { + "node_abi": 44, + "v8": "4.2" + }, + "2.3.3": { + "node_abi": 44, + "v8": "4.2" + }, + "2.3.4": { + "node_abi": 44, + "v8": "4.2" + }, + "2.4.0": { + "node_abi": 44, + "v8": "4.2" + }, + "2.5.0": { + "node_abi": 44, + "v8": "4.2" + }, + "3.0.0": { + "node_abi": 45, + "v8": "4.4" + }, + "3.1.0": { + "node_abi": 45, + "v8": "4.4" + }, + "3.2.0": { + "node_abi": 45, + "v8": "4.4" + }, + "3.3.0": { + "node_abi": 45, + "v8": "4.4" + }, + "3.3.1": { + "node_abi": 45, + "v8": "4.4" + }, + "4.0.0": { + "node_abi": 46, + "v8": "4.5" + }, + "4.1.0": { + "node_abi": 46, + "v8": "4.5" + }, + "4.1.1": { + "node_abi": 46, + "v8": "4.5" + }, + "4.1.2": { + "node_abi": 46, + "v8": "4.5" + }, + "4.2.0": { + "node_abi": 46, + "v8": "4.5" + }, + "4.2.1": { + "node_abi": 46, + "v8": "4.5" + }, + "4.2.2": { + "node_abi": 46, + "v8": "4.5" + }, + "4.2.3": { + "node_abi": 46, + "v8": "4.5" + }, + "4.2.4": { + "node_abi": 46, + "v8": "4.5" + }, + "4.2.5": { + "node_abi": 46, + "v8": "4.5" + }, + "4.2.6": { + "node_abi": 46, + "v8": "4.5" + }, + "4.3.0": { + "node_abi": 46, + "v8": "4.5" + }, + "4.3.1": { + "node_abi": 46, + "v8": "4.5" + }, + "4.3.2": { + "node_abi": 46, + "v8": "4.5" + }, + "4.4.0": { + "node_abi": 46, + "v8": "4.5" + }, + "4.4.1": { + "node_abi": 46, + "v8": "4.5" + }, + "4.4.2": { + "node_abi": 46, + "v8": "4.5" + }, + "4.4.3": { + "node_abi": 46, + "v8": "4.5" + }, + "4.4.4": { + "node_abi": 46, + "v8": "4.5" + }, + "4.4.5": { + "node_abi": 46, + "v8": "4.5" + }, + "4.4.6": { + "node_abi": 46, + "v8": "4.5" + }, + "4.4.7": { + "node_abi": 46, + "v8": "4.5" + }, + "4.5.0": { + "node_abi": 46, + "v8": "4.5" + }, + "4.6.0": { + "node_abi": 46, + "v8": "4.5" + }, + "4.6.1": { + "node_abi": 46, + "v8": "4.5" + }, + "4.6.2": { + "node_abi": 46, + "v8": "4.5" + }, + "4.7.0": { + "node_abi": 46, + "v8": "4.5" + }, + "4.7.1": { + "node_abi": 46, + "v8": "4.5" + }, + "4.7.2": { + "node_abi": 46, + "v8": "4.5" + }, + "4.7.3": { + "node_abi": 46, + "v8": "4.5" + }, + "4.8.0": { + "node_abi": 46, + "v8": "4.5" + }, + "4.8.1": { + "node_abi": 46, + "v8": "4.5" + }, + "4.8.2": { + "node_abi": 46, + "v8": "4.5" + }, + "4.8.3": { + "node_abi": 46, + "v8": "4.5" + }, + "4.8.4": { + "node_abi": 46, + "v8": "4.5" + }, + "4.8.5": { + "node_abi": 46, + "v8": "4.5" + }, + "4.8.6": { + "node_abi": 46, + "v8": "4.5" + }, + "4.8.7": { + "node_abi": 46, + "v8": "4.5" + }, + "4.9.0": { + "node_abi": 46, + "v8": "4.5" + }, + "4.9.1": { + "node_abi": 46, + "v8": "4.5" + }, + "5.0.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.1.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.1.1": { + "node_abi": 47, + "v8": "4.6" + }, + "5.2.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.3.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.4.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.4.1": { + "node_abi": 47, + "v8": "4.6" + }, + "5.5.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.6.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.7.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.7.1": { + "node_abi": 47, + "v8": "4.6" + }, + "5.8.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.9.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.9.1": { + "node_abi": 47, + "v8": "4.6" + }, + "5.10.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.10.1": { + "node_abi": 47, + "v8": "4.6" + }, + "5.11.0": { + "node_abi": 47, + "v8": "4.6" + }, + "5.11.1": { + "node_abi": 47, + "v8": "4.6" + }, + "5.12.0": { + "node_abi": 47, + "v8": "4.6" + }, + "6.0.0": { + "node_abi": 48, + "v8": "5.0" + }, + "6.1.0": { + "node_abi": 48, + "v8": "5.0" + }, + "6.2.0": { + "node_abi": 48, + "v8": "5.0" + }, + "6.2.1": { + "node_abi": 48, + "v8": "5.0" + }, + "6.2.2": { + "node_abi": 48, + "v8": "5.0" + }, + "6.3.0": { + "node_abi": 48, + "v8": "5.0" + }, + "6.3.1": { + "node_abi": 48, + "v8": "5.0" + }, + "6.4.0": { + "node_abi": 48, + "v8": "5.0" + }, + "6.5.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.6.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.7.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.8.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.8.1": { + "node_abi": 48, + "v8": "5.1" + }, + "6.9.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.9.1": { + "node_abi": 48, + "v8": "5.1" + }, + "6.9.2": { + "node_abi": 48, + "v8": "5.1" + }, + "6.9.3": { + "node_abi": 48, + "v8": "5.1" + }, + "6.9.4": { + "node_abi": 48, + "v8": "5.1" + }, + "6.9.5": { + "node_abi": 48, + "v8": "5.1" + }, + "6.10.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.10.1": { + "node_abi": 48, + "v8": "5.1" + }, + "6.10.2": { + "node_abi": 48, + "v8": "5.1" + }, + "6.10.3": { + "node_abi": 48, + "v8": "5.1" + }, + "6.11.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.11.1": { + "node_abi": 48, + "v8": "5.1" + }, + "6.11.2": { + "node_abi": 48, + "v8": "5.1" + }, + "6.11.3": { + "node_abi": 48, + "v8": "5.1" + }, + "6.11.4": { + "node_abi": 48, + "v8": "5.1" + }, + "6.11.5": { + "node_abi": 48, + "v8": "5.1" + }, + "6.12.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.12.1": { + "node_abi": 48, + "v8": "5.1" + }, + "6.12.2": { + "node_abi": 48, + "v8": "5.1" + }, + "6.12.3": { + "node_abi": 48, + "v8": "5.1" + }, + "6.13.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.13.1": { + "node_abi": 48, + "v8": "5.1" + }, + "6.14.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.14.1": { + "node_abi": 48, + "v8": "5.1" + }, + "6.14.2": { + "node_abi": 48, + "v8": "5.1" + }, + "6.14.3": { + "node_abi": 48, + "v8": "5.1" + }, + "6.14.4": { + "node_abi": 48, + "v8": "5.1" + }, + "6.15.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.15.1": { + "node_abi": 48, + "v8": "5.1" + }, + "6.16.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.17.0": { + "node_abi": 48, + "v8": "5.1" + }, + "6.17.1": { + "node_abi": 48, + "v8": "5.1" + }, + "7.0.0": { + "node_abi": 51, + "v8": "5.4" + }, + "7.1.0": { + "node_abi": 51, + "v8": "5.4" + }, + "7.2.0": { + "node_abi": 51, + "v8": "5.4" + }, + "7.2.1": { + "node_abi": 51, + "v8": "5.4" + }, + "7.3.0": { + "node_abi": 51, + "v8": "5.4" + }, + "7.4.0": { + "node_abi": 51, + "v8": "5.4" + }, + "7.5.0": { + "node_abi": 51, + "v8": "5.4" + }, + "7.6.0": { + "node_abi": 51, + "v8": "5.5" + }, + "7.7.0": { + "node_abi": 51, + "v8": "5.5" + }, + "7.7.1": { + "node_abi": 51, + "v8": "5.5" + }, + "7.7.2": { + "node_abi": 51, + "v8": "5.5" + }, + "7.7.3": { + "node_abi": 51, + "v8": "5.5" + }, + "7.7.4": { + "node_abi": 51, + "v8": "5.5" + }, + "7.8.0": { + "node_abi": 51, + "v8": "5.5" + }, + "7.9.0": { + "node_abi": 51, + "v8": "5.5" + }, + "7.10.0": { + "node_abi": 51, + "v8": "5.5" + }, + "7.10.1": { + "node_abi": 51, + "v8": "5.5" + }, + "8.0.0": { + "node_abi": 57, + "v8": "5.8" + }, + "8.1.0": { + "node_abi": 57, + "v8": "5.8" + }, + "8.1.1": { + "node_abi": 57, + "v8": "5.8" + }, + "8.1.2": { + "node_abi": 57, + "v8": "5.8" + }, + "8.1.3": { + "node_abi": 57, + "v8": "5.8" + }, + "8.1.4": { + "node_abi": 57, + "v8": "5.8" + }, + "8.2.0": { + "node_abi": 57, + "v8": "5.8" + }, + "8.2.1": { + "node_abi": 57, + "v8": "5.8" + }, + "8.3.0": { + "node_abi": 57, + "v8": "6.0" + }, + "8.4.0": { + "node_abi": 57, + "v8": "6.0" + }, + "8.5.0": { + "node_abi": 57, + "v8": "6.0" + }, + "8.6.0": { + "node_abi": 57, + "v8": "6.0" + }, + "8.7.0": { + "node_abi": 57, + "v8": "6.1" + }, + "8.8.0": { + "node_abi": 57, + "v8": "6.1" + }, + "8.8.1": { + "node_abi": 57, + "v8": "6.1" + }, + "8.9.0": { + "node_abi": 57, + "v8": "6.1" + }, + "8.9.1": { + "node_abi": 57, + "v8": "6.1" + }, + "8.9.2": { + "node_abi": 57, + "v8": "6.1" + }, + "8.9.3": { + "node_abi": 57, + "v8": "6.1" + }, + "8.9.4": { + "node_abi": 57, + "v8": "6.1" + }, + "8.10.0": { + "node_abi": 57, + "v8": "6.2" + }, + "8.11.0": { + "node_abi": 57, + "v8": "6.2" + }, + "8.11.1": { + "node_abi": 57, + "v8": "6.2" + }, + "8.11.2": { + "node_abi": 57, + "v8": "6.2" + }, + "8.11.3": { + "node_abi": 57, + "v8": "6.2" + }, + "8.11.4": { + "node_abi": 57, + "v8": "6.2" + }, + "8.12.0": { + "node_abi": 57, + "v8": "6.2" + }, + "8.13.0": { + "node_abi": 57, + "v8": "6.2" + }, + "8.14.0": { + "node_abi": 57, + "v8": "6.2" + }, + "8.14.1": { + "node_abi": 57, + "v8": "6.2" + }, + "8.15.0": { + "node_abi": 57, + "v8": "6.2" + }, + "8.15.1": { + "node_abi": 57, + "v8": "6.2" + }, + "8.16.0": { + "node_abi": 57, + "v8": "6.2" + }, + "9.0.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.1.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.2.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.2.1": { + "node_abi": 59, + "v8": "6.2" + }, + "9.3.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.4.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.5.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.6.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.6.1": { + "node_abi": 59, + "v8": "6.2" + }, + "9.7.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.7.1": { + "node_abi": 59, + "v8": "6.2" + }, + "9.8.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.9.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.10.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.10.1": { + "node_abi": 59, + "v8": "6.2" + }, + "9.11.0": { + "node_abi": 59, + "v8": "6.2" + }, + "9.11.1": { + "node_abi": 59, + "v8": "6.2" + }, + "9.11.2": { + "node_abi": 59, + "v8": "6.2" + }, + "10.0.0": { + "node_abi": 64, + "v8": "6.6" + }, + "10.1.0": { + "node_abi": 64, + "v8": "6.6" + }, + "10.2.0": { + "node_abi": 64, + "v8": "6.6" + }, + "10.2.1": { + "node_abi": 64, + "v8": "6.6" + }, + "10.3.0": { + "node_abi": 64, + "v8": "6.6" + }, + "10.4.0": { + "node_abi": 64, + "v8": "6.7" + }, + "10.4.1": { + "node_abi": 64, + "v8": "6.7" + }, + "10.5.0": { + "node_abi": 64, + "v8": "6.7" + }, + "10.6.0": { + "node_abi": 64, + "v8": "6.7" + }, + "10.7.0": { + "node_abi": 64, + "v8": "6.7" + }, + "10.8.0": { + "node_abi": 64, + "v8": "6.7" + }, + "10.9.0": { + "node_abi": 64, + "v8": "6.8" + }, + "10.10.0": { + "node_abi": 64, + "v8": "6.8" + }, + "10.11.0": { + "node_abi": 64, + "v8": "6.8" + }, + "10.12.0": { + "node_abi": 64, + "v8": "6.8" + }, + "10.13.0": { + "node_abi": 64, + "v8": "6.8" + }, + "10.14.0": { + "node_abi": 64, + "v8": "6.8" + }, + "10.14.1": { + "node_abi": 64, + "v8": "6.8" + }, + "10.14.2": { + "node_abi": 64, + "v8": "6.8" + }, + "10.15.0": { + "node_abi": 64, + "v8": "6.8" + }, + "10.15.1": { + "node_abi": 64, + "v8": "6.8" + }, + "10.15.2": { + "node_abi": 64, + "v8": "6.8" + }, + "10.15.3": { + "node_abi": 64, + "v8": "6.8" + }, + "11.0.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.1.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.2.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.3.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.4.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.5.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.6.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.7.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.8.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.9.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.10.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.10.1": { + "node_abi": 67, + "v8": "7.0" + }, + "11.11.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.12.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.13.0": { + "node_abi": 67, + "v8": "7.0" + }, + "11.14.0": { + "node_abi": 67, + "v8": "7.0" + }, + "12.0.0": { + "node_abi": 72, + "v8": "7.4" + } +} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/compile.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/compile.js new file mode 100644 index 0000000..0dc460c --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/compile.js @@ -0,0 +1,87 @@ +"use strict"; + +module.exports = exports; + +var fs = require('fs'); +var path = require('path'); +var win = process.platform == 'win32'; +var existsSync = fs.existsSync || path.existsSync; +var cp = require('child_process'); + +// try to build up the complete path to node-gyp +/* priority: + - node-gyp on ENV:npm_config_node_gyp (https://github.com/npm/npm/pull/4887) + - node-gyp on NODE_PATH + - node-gyp inside npm on NODE_PATH (ignore on iojs) + - node-gyp inside npm beside node exe +*/ +function which_node_gyp() { + var node_gyp_bin; + if (process.env.npm_config_node_gyp) { + try { + node_gyp_bin = process.env.npm_config_node_gyp; + if (existsSync(node_gyp_bin)) { + return node_gyp_bin; + } + } catch (err) { } + } + try { + var node_gyp_main = require.resolve('node-gyp'); + node_gyp_bin = path.join(path.dirname( + path.dirname(node_gyp_main)), + 'bin/node-gyp.js'); + if (existsSync(node_gyp_bin)) { + return node_gyp_bin; + } + } catch (err) { } + if (process.execPath.indexOf('iojs') === -1) { + try { + var npm_main = require.resolve('npm'); + node_gyp_bin = path.join(path.dirname( + path.dirname(npm_main)), + 'node_modules/node-gyp/bin/node-gyp.js'); + if (existsSync(node_gyp_bin)) { + return node_gyp_bin; + } + } catch (err) { } + } + var npm_base = path.join(path.dirname( + path.dirname(process.execPath)), + 'lib/node_modules/npm/'); + node_gyp_bin = path.join(npm_base, 'node_modules/node-gyp/bin/node-gyp.js'); + if (existsSync(node_gyp_bin)) { + return node_gyp_bin; + } +} + +module.exports.run_gyp = function(args,opts,callback) { + var shell_cmd = ''; + var cmd_args = []; + if (opts.runtime && opts.runtime == 'node-webkit') { + shell_cmd = 'nw-gyp'; + if (win) shell_cmd += '.cmd'; + } else { + var node_gyp_path = which_node_gyp(); + if (node_gyp_path) { + shell_cmd = process.execPath; + cmd_args.push(node_gyp_path); + } else { + shell_cmd = 'node-gyp'; + if (win) shell_cmd += '.cmd'; + } + } + var final_args = cmd_args.concat(args); + var cmd = cp.spawn(shell_cmd, final_args, {cwd: undefined, env: process.env, stdio: [ 0, 1, 2]}); + cmd.on('error', function (err) { + if (err) { + return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + err + ")")); + } + callback(null,opts); + }); + cmd.on('close', function (code) { + if (code && code !== 0) { + return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + code + ")")); + } + callback(null,opts); + }); +}; diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js new file mode 100644 index 0000000..9f76ea3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js @@ -0,0 +1,103 @@ +"use strict"; + +module.exports = exports = handle_gyp_opts; + +var fs = require('fs'); +var versioning = require('./versioning.js'); +var napi = require('./napi.js'); + +/* + +Here we gather node-pre-gyp generated options (from versioning) and pass them along to node-gyp. + +We massage the args and options slightly to account for differences in what commands mean between +node-pre-gyp and node-gyp (e.g. see the difference between "build" and "rebuild" below) + +Keep in mind: the values inside `argv` and `gyp.opts` below are different depending on whether +node-pre-gyp is called directory, or if it is called in a `run-script` phase of npm. + +We also try to preserve any command line options that might have been passed to npm or node-pre-gyp. +But this is fairly difficult without passing way to much through. For example `gyp.opts` contains all +the process.env and npm pushes a lot of variables into process.env which node-pre-gyp inherits. So we have +to be very selective about what we pass through. + +For example: + +`npm install --build-from-source` will give: + +argv == [ 'rebuild' ] +gyp.opts.argv == { remain: [ 'install' ], + cooked: [ 'install', '--fallback-to-build' ], + original: [ 'install', '--fallback-to-build' ] } + +`./bin/node-pre-gyp build` will give: + +argv == [] +gyp.opts.argv == { remain: [ 'build' ], + cooked: [ 'build' ], + original: [ '-C', 'test/app1', 'build' ] } + +*/ + +// select set of node-pre-gyp versioning info +// to share with node-gyp +var share_with_node_gyp = [ + 'module', + 'module_name', + 'module_path', + 'napi_version', + 'node_abi_napi', + 'napi_build_version', + 'node_napi_label' +]; + +function handle_gyp_opts(gyp, argv, callback) { + + // Collect node-pre-gyp specific variables to pass to node-gyp + var node_pre_gyp_options = []; + // generate custom node-pre-gyp versioning info + var napi_build_version = napi.get_napi_build_version_from_command_args(argv); + var opts = versioning.evaluate(JSON.parse(fs.readFileSync('./package.json')), gyp.opts, napi_build_version); + share_with_node_gyp.forEach(function(key) { + var val = opts[key]; + if (val) { + node_pre_gyp_options.push('--' + key + '=' + val); + } else if (key === 'napi_build_version') { + node_pre_gyp_options.push('--' + key + '=0'); + } else { + if (key !== 'napi_version' && key !== 'node_abi_napi') + return callback(new Error("Option " + key + " required but not found by node-pre-gyp")); + } + }); + + // Collect options that follow the special -- which disables nopt parsing + var unparsed_options = []; + var double_hyphen_found = false; + gyp.opts.argv.original.forEach(function(opt) { + if (double_hyphen_found) { + unparsed_options.push(opt); + } + if (opt == '--') { + double_hyphen_found = true; + } + }); + + // We try respect and pass through remaining command + // line options (like --foo=bar) to node-gyp + var cooked = gyp.opts.argv.cooked; + var node_gyp_options = []; + cooked.forEach(function(value) { + if (value.length > 2 && value.slice(0,2) == '--') { + var key = value.slice(2); + var val = cooked[cooked.indexOf(value)+1]; + if (val && val.indexOf('--') === -1) { // handle '--foo=bar' or ['--foo','bar'] + node_gyp_options.push('--' + key + '=' + val); + } else { // pass through --foo + node_gyp_options.push(value); + } + } + }); + + var result = {'opts':opts,'gyp':node_gyp_options,'pre':node_pre_gyp_options,'unparsed':unparsed_options}; + return callback(null,result); +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/napi.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/napi.js new file mode 100644 index 0000000..1e45ca0 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/napi.js @@ -0,0 +1,204 @@ +"use strict"; + +var fs = require('fs'); +var rm = require('rimraf'); +var log = require('npmlog'); + +module.exports = exports; + +var versionArray = process.version + .substr(1) + .replace(/-.*$/, '') + .split('.') + .map(function(item) { + return +item; + }); + +var napi_multiple_commands = [ + 'build', + 'clean', + 'configure', + 'package', + 'publish', + 'reveal', + 'testbinary', + 'testpackage', + 'unpublish' +]; + +var napi_build_version_tag = 'napi_build_version='; + +module.exports.get_napi_version = function(target) { // target may be undefined + // returns the non-zero numeric napi version or undefined if napi is not supported. + // correctly supporting target requires an updated cross-walk + var version = process.versions.napi; // can be undefined + if (!version) { // this code should never need to be updated + if (versionArray[0] === 9 && versionArray[1] >= 3) version = 2; // 9.3.0+ + else if (versionArray[0] === 8) version = 1; // 8.0.0+ + } + return version; +}; + +module.exports.get_napi_version_as_string = function(target) { + // returns the napi version as a string or an empty string if napi is not supported. + var version = module.exports.get_napi_version(target); + return version ? ''+version : ''; +}; + +module.exports.validate_package_json = function(package_json, opts) { // throws Error + + var binary = package_json.binary; + var module_path_ok = pathOK(binary.module_path); + var remote_path_ok = pathOK(binary.remote_path); + var package_name_ok = pathOK(binary.package_name); + var napi_build_versions = module.exports.get_napi_build_versions(package_json,opts,true); + var napi_build_versions_raw = module.exports.get_napi_build_versions_raw(package_json); + + if (napi_build_versions) { + napi_build_versions.forEach(function(napi_build_version){ + if (!(parseInt(napi_build_version,10) === napi_build_version && napi_build_version > 0)) { + throw new Error("All values specified in napi_versions must be positive integers."); + } + }); + } + + if (napi_build_versions && (!module_path_ok || (!remote_path_ok && !package_name_ok))) { + throw new Error("When napi_versions is specified; module_path and either remote_path or " + + "package_name must contain the substitution string '{napi_build_version}`."); + } + + if ((module_path_ok || remote_path_ok || package_name_ok) && !napi_build_versions_raw) { + throw new Error("When the substitution string '{napi_build_version}` is specified in " + + "module_path, remote_path, or package_name; napi_versions must also be specified."); + } + + if (napi_build_versions && !module.exports.get_best_napi_build_version(package_json, opts) && + module.exports.build_napi_only(package_json)) { + throw new Error( + 'The N-API version of this Node instance is ' + module.exports.get_napi_version(opts ? opts.target : undefined) + '. ' + + 'This module supports N-API version(s) ' + module.exports.get_napi_build_versions_raw(package_json) + '. ' + + 'This Node instance cannot run this module.'); + } + + if (napi_build_versions_raw && !napi_build_versions && module.exports.build_napi_only(package_json)) { + throw new Error( + 'The N-API version of this Node instance is ' + module.exports.get_napi_version(opts ? opts.target : undefined) + '. ' + + 'This module supports N-API version(s) ' + module.exports.get_napi_build_versions_raw(package_json) + '. ' + + 'This Node instance cannot run this module.'); + } + +}; + +function pathOK (path) { + return path && (path.indexOf('{napi_build_version}') !== -1 || path.indexOf('{node_napi_label}') !== -1); +} + +module.exports.expand_commands = function(package_json, opts, commands) { + var expanded_commands = []; + var napi_build_versions = module.exports.get_napi_build_versions(package_json, opts); + commands.forEach(function(command){ + if (napi_build_versions && command.name === 'install') { + var napi_build_version = module.exports.get_best_napi_build_version(package_json, opts); + var args = napi_build_version ? [ napi_build_version_tag+napi_build_version ] : [ ]; + expanded_commands.push ({ name: command.name, args: args }); + } else if (napi_build_versions && napi_multiple_commands.indexOf(command.name) !== -1) { + napi_build_versions.forEach(function(napi_build_version){ + var args = command.args.slice(); + args.push (napi_build_version_tag+napi_build_version); + expanded_commands.push ({ name: command.name, args: args }); + }); + } else { + expanded_commands.push (command); + } + }); + return expanded_commands; +}; + +module.exports.get_napi_build_versions = function(package_json, opts, warnings) { // opts may be undefined + var napi_build_versions = []; + var supported_napi_version = module.exports.get_napi_version(opts ? opts.target : undefined); + // remove duplicates, verify each napi version can actaully be built + if (package_json.binary && package_json.binary.napi_versions) { + package_json.binary.napi_versions.forEach(function(napi_version) { + var duplicated = napi_build_versions.indexOf(napi_version) !== -1; + if (!duplicated && supported_napi_version && napi_version <= supported_napi_version) { + napi_build_versions.push(napi_version); + } else if (warnings && !duplicated && supported_napi_version) { + log.info('This Node instance does not support builds for N-API version', napi_version); + } + }); + } + if (opts && opts["build-latest-napi-version-only"]) { + var latest_version = 0; + napi_build_versions.forEach(function(napi_version) { + if (napi_version > latest_version) latest_version = napi_version; + }); + napi_build_versions = latest_version ? [ latest_version ] : []; + } + return napi_build_versions.length ? napi_build_versions : undefined; +}; + +module.exports.get_napi_build_versions_raw = function(package_json) { + var napi_build_versions = []; + // remove duplicates + if (package_json.binary && package_json.binary.napi_versions) { + package_json.binary.napi_versions.forEach(function(napi_version) { + if (napi_build_versions.indexOf(napi_version) === -1) { + napi_build_versions.push(napi_version); + } + }); + } + return napi_build_versions.length ? napi_build_versions : undefined; +}; + +module.exports.get_command_arg = function(napi_build_version) { + return napi_build_version_tag + napi_build_version; +}; + +module.exports.get_napi_build_version_from_command_args = function(command_args) { + for (var i = 0; i < command_args.length; i++) { + var arg = command_args[i]; + if (arg.indexOf(napi_build_version_tag) === 0) { + return parseInt(arg.substr(napi_build_version_tag.length),10); + } + } + return undefined; +}; + +module.exports.swap_build_dir_out = function(napi_build_version) { + if (napi_build_version) { + rm.sync(module.exports.get_build_dir(napi_build_version)); + fs.renameSync('build', module.exports.get_build_dir(napi_build_version)); + } +}; + +module.exports.swap_build_dir_in = function(napi_build_version) { + if (napi_build_version) { + rm.sync('build'); + fs.renameSync(module.exports.get_build_dir(napi_build_version), 'build'); + } +}; + +module.exports.get_build_dir = function(napi_build_version) { + return 'build-tmp-napi-v'+napi_build_version; +}; + +module.exports.get_best_napi_build_version = function(package_json, opts) { + var best_napi_build_version = 0; + var napi_build_versions = module.exports.get_napi_build_versions (package_json, opts); + if (napi_build_versions) { + var our_napi_version = module.exports.get_napi_version(opts ? opts.target : undefined); + napi_build_versions.forEach(function(napi_build_version){ + if (napi_build_version > best_napi_build_version && + napi_build_version <= our_napi_version) { + best_napi_build_version = napi_build_version; + } + }); + } + return best_napi_build_version === 0 ? undefined : best_napi_build_version; +}; + +module.exports.build_napi_only = function(package_json) { + return package_json.binary && package_json.binary.package_name && + package_json.binary.package_name.indexOf('{node_napi_label}') === -1; +}; \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html new file mode 100644 index 0000000..244466c --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html @@ -0,0 +1,26 @@ + + + + +Node-webkit-based module test + + + +

Node-webkit-based module test

+ + diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json new file mode 100644 index 0000000..71d03f8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json @@ -0,0 +1,9 @@ +{ +"main": "index.html", +"name": "nw-pre-gyp-module-test", +"description": "Node-webkit-based module test.", +"version": "0.0.1", +"window": { + "show": false +} +} diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/s3_setup.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/s3_setup.js new file mode 100644 index 0000000..5bc42e9 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/s3_setup.js @@ -0,0 +1,27 @@ +"use strict"; + +module.exports = exports; + +var url = require('url'); + +var URI_REGEX="^(.*)\.(s3(?:-.*)?)\.amazonaws\.com$"; + +module.exports.detect = function(to,config) { + var uri = url.parse(to); + var hostname_matches = uri.hostname.match(URI_REGEX); + config.prefix = (!uri.pathname || uri.pathname == '/') ? '' : uri.pathname.replace('/',''); + if(!hostname_matches) { + return; + } + if (!config.bucket) { + config.bucket = hostname_matches[1]; + } + if (!config.region) { + var s3_domain = hostname_matches[2]; + if (s3_domain.slice(0,3) == 's3-' && + s3_domain.length >= 3) { + // it appears the region is explicit in the url + config.region = s3_domain.replace('s3-',''); + } + } +}; diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/versioning.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/versioning.js new file mode 100644 index 0000000..fafb0da --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/versioning.js @@ -0,0 +1,331 @@ +"use strict"; + +module.exports = exports; + +var path = require('path'); +var semver = require('semver'); +var url = require('url'); +var detect_libc = require('detect-libc'); +var napi = require('./napi.js'); + +var abi_crosswalk; + +// This is used for unit testing to provide a fake +// ABI crosswalk that emulates one that is not updated +// for the current version +if (process.env.NODE_PRE_GYP_ABI_CROSSWALK) { + abi_crosswalk = require(process.env.NODE_PRE_GYP_ABI_CROSSWALK); +} else { + abi_crosswalk = require('./abi_crosswalk.json'); +} + +var major_versions = {}; +Object.keys(abi_crosswalk).forEach(function(v) { + var major = v.split('.')[0]; + if (!major_versions[major]) { + major_versions[major] = v; + } +}); + +function get_electron_abi(runtime, target_version) { + if (!runtime) { + throw new Error("get_electron_abi requires valid runtime arg"); + } + if (typeof target_version === 'undefined') { + // erroneous CLI call + throw new Error("Empty target version is not supported if electron is the target."); + } + // Electron guarantees that patch version update won't break native modules. + var sem_ver = semver.parse(target_version); + return runtime + '-v' + sem_ver.major + '.' + sem_ver.minor; +} +module.exports.get_electron_abi = get_electron_abi; + +function get_node_webkit_abi(runtime, target_version) { + if (!runtime) { + throw new Error("get_node_webkit_abi requires valid runtime arg"); + } + if (typeof target_version === 'undefined') { + // erroneous CLI call + throw new Error("Empty target version is not supported if node-webkit is the target."); + } + return runtime + '-v' + target_version; +} +module.exports.get_node_webkit_abi = get_node_webkit_abi; + +function get_node_abi(runtime, versions) { + if (!runtime) { + throw new Error("get_node_abi requires valid runtime arg"); + } + if (!versions) { + throw new Error("get_node_abi requires valid process.versions object"); + } + var sem_ver = semver.parse(versions.node); + if (sem_ver.major === 0 && sem_ver.minor % 2) { // odd series + // https://github.com/mapbox/node-pre-gyp/issues/124 + return runtime+'-v'+versions.node; + } else { + // process.versions.modules added in >= v0.10.4 and v0.11.7 + // https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e + return versions.modules ? runtime+'-v' + (+versions.modules) : + 'v8-' + versions.v8.split('.').slice(0,2).join('.'); + } +} +module.exports.get_node_abi = get_node_abi; + +function get_runtime_abi(runtime, target_version) { + if (!runtime) { + throw new Error("get_runtime_abi requires valid runtime arg"); + } + if (runtime === 'node-webkit') { + return get_node_webkit_abi(runtime, target_version || process.versions['node-webkit']); + } else if (runtime === 'electron') { + return get_electron_abi(runtime, target_version || process.versions.electron); + } else { + if (runtime != 'node') { + throw new Error("Unknown Runtime: '" + runtime + "'"); + } + if (!target_version) { + return get_node_abi(runtime,process.versions); + } else { + var cross_obj; + // abi_crosswalk generated with ./scripts/abi_crosswalk.js + if (abi_crosswalk[target_version]) { + cross_obj = abi_crosswalk[target_version]; + } else { + var target_parts = target_version.split('.').map(function(i) { return +i; }); + if (target_parts.length != 3) { // parse failed + throw new Error("Unknown target version: " + target_version); + } + /* + The below code tries to infer the last known ABI compatible version + that we have recorded in the abi_crosswalk.json when an exact match + is not possible. The reasons for this to exist are complicated: + + - We support passing --target to be able to allow developers to package binaries for versions of node + that are not the same one as they are running. This might also be used in combination with the + --target_arch or --target_platform flags to also package binaries for alternative platforms + - When --target is passed we can't therefore determine the ABI (process.versions.modules) from the node + version that is running in memory + - So, therefore node-pre-gyp keeps an "ABI crosswalk" (lib/util/abi_crosswalk.json) to be able to look + this info up for all versions + - But we cannot easily predict what the future ABI will be for released versions + - And node-pre-gyp needs to be a `bundledDependency` in apps that depend on it in order to work correctly + by being fully available at install time. + - So, the speed of node releases and the bundled nature of node-pre-gyp mean that a new node-pre-gyp release + need to happen for every node.js/io.js/node-webkit/nw.js/atom-shell/etc release that might come online if + you want the `--target` flag to keep working for the latest version + - Which is impractical ^^ + - Hence the below code guesses about future ABI to make the need to update node-pre-gyp less demanding. + + In practice then you can have a dependency of your app like `node-sqlite3` that bundles a `node-pre-gyp` that + only knows about node v0.10.33 in the `abi_crosswalk.json` but target node v0.10.34 (which is assumed to be + ABI compatible with v0.10.33). + + TODO: use semver module instead of custom version parsing + */ + var major = target_parts[0]; + var minor = target_parts[1]; + var patch = target_parts[2]; + // io.js: yeah if node.js ever releases 1.x this will break + // but that is unlikely to happen: https://github.com/iojs/io.js/pull/253#issuecomment-69432616 + if (major === 1) { + // look for last release that is the same major version + // e.g. we assume io.js 1.x is ABI compatible with >= 1.0.0 + while (true) { + if (minor > 0) --minor; + if (patch > 0) --patch; + var new_iojs_target = '' + major + '.' + minor + '.' + patch; + if (abi_crosswalk[new_iojs_target]) { + cross_obj = abi_crosswalk[new_iojs_target]; + console.log('Warning: node-pre-gyp could not find exact match for ' + target_version); + console.log('Warning: but node-pre-gyp successfully choose ' + new_iojs_target + ' as ABI compatible target'); + break; + } + if (minor === 0 && patch === 0) { + break; + } + } + } else if (major >= 2) { + // look for last release that is the same major version + if (major_versions[major]) { + cross_obj = abi_crosswalk[major_versions[major]]; + console.log('Warning: node-pre-gyp could not find exact match for ' + target_version); + console.log('Warning: but node-pre-gyp successfully choose ' + major_versions[major] + ' as ABI compatible target'); + } + } else if (major === 0) { // node.js + if (target_parts[1] % 2 === 0) { // for stable/even node.js series + // look for the last release that is the same minor release + // e.g. we assume node 0.10.x is ABI compatible with >= 0.10.0 + while (--patch > 0) { + var new_node_target = '' + major + '.' + minor + '.' + patch; + if (abi_crosswalk[new_node_target]) { + cross_obj = abi_crosswalk[new_node_target]; + console.log('Warning: node-pre-gyp could not find exact match for ' + target_version); + console.log('Warning: but node-pre-gyp successfully choose ' + new_node_target + ' as ABI compatible target'); + break; + } + } + } + } + } + if (!cross_obj) { + throw new Error("Unsupported target version: " + target_version); + } + // emulate process.versions + var versions_obj = { + node: target_version, + v8: cross_obj.v8+'.0', + // abi_crosswalk uses 1 for node versions lacking process.versions.modules + // process.versions.modules added in >= v0.10.4 and v0.11.7 + modules: cross_obj.node_abi > 1 ? cross_obj.node_abi : undefined + }; + return get_node_abi(runtime, versions_obj); + } + } +} +module.exports.get_runtime_abi = get_runtime_abi; + +var required_parameters = [ + 'module_name', + 'module_path', + 'host' +]; + +function validate_config(package_json,opts) { + var msg = package_json.name + ' package.json is not node-pre-gyp ready:\n'; + var missing = []; + if (!package_json.main) { + missing.push('main'); + } + if (!package_json.version) { + missing.push('version'); + } + if (!package_json.name) { + missing.push('name'); + } + if (!package_json.binary) { + missing.push('binary'); + } + var o = package_json.binary; + required_parameters.forEach(function(p) { + if (missing.indexOf('binary') > -1) { + missing.pop('binary'); + } + if (!o || o[p] === undefined || o[p] === "") { + missing.push('binary.' + p); + } + }); + if (missing.length >= 1) { + throw new Error(msg+"package.json must declare these properties: \n" + missing.join('\n')); + } + if (o) { + // enforce https over http + var protocol = url.parse(o.host).protocol; + if (protocol === 'http:') { + throw new Error("'host' protocol ("+protocol+") is invalid - only 'https:' is accepted"); + } + } + napi.validate_package_json(package_json,opts); +} + +module.exports.validate_config = validate_config; + +function eval_template(template,opts) { + Object.keys(opts).forEach(function(key) { + var pattern = '{'+key+'}'; + while (template.indexOf(pattern) > -1) { + template = template.replace(pattern,opts[key]); + } + }); + return template; +} + +// url.resolve needs single trailing slash +// to behave correctly, otherwise a double slash +// may end up in the url which breaks requests +// and a lacking slash may not lead to proper joining +function fix_slashes(pathname) { + if (pathname.slice(-1) != '/') { + return pathname + '/'; + } + return pathname; +} + +// remove double slashes +// note: path.normalize will not work because +// it will convert forward to back slashes +function drop_double_slashes(pathname) { + return pathname.replace(/\/\//g,'/'); +} + +function get_process_runtime(versions) { + var runtime = 'node'; + if (versions['node-webkit']) { + runtime = 'node-webkit'; + } else if (versions.electron) { + runtime = 'electron'; + } + return runtime; +} + +module.exports.get_process_runtime = get_process_runtime; + +var default_package_name = '{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz'; +var default_remote_path = ''; + +module.exports.evaluate = function(package_json,options,napi_build_version) { + options = options || {}; + validate_config(package_json,options); // options is a suitable substitute for opts in this case + var v = package_json.version; + var module_version = semver.parse(v); + var runtime = options.runtime || get_process_runtime(process.versions); + var opts = { + name: package_json.name, + configuration: Boolean(options.debug) ? 'Debug' : 'Release', + debug: options.debug, + module_name: package_json.binary.module_name, + version: module_version.version, + prerelease: module_version.prerelease.length ? module_version.prerelease.join('.') : '', + build: module_version.build.length ? module_version.build.join('.') : '', + major: module_version.major, + minor: module_version.minor, + patch: module_version.patch, + runtime: runtime, + node_abi: get_runtime_abi(runtime,options.target), + node_abi_napi: napi.get_napi_version(options.target) ? 'napi' : get_runtime_abi(runtime,options.target), + napi_version: napi.get_napi_version(options.target), // non-zero numeric, undefined if unsupported + napi_build_version: napi_build_version || '', + node_napi_label: napi_build_version ? 'napi-v' + napi_build_version : get_runtime_abi(runtime,options.target), + target: options.target || '', + platform: options.target_platform || process.platform, + target_platform: options.target_platform || process.platform, + arch: options.target_arch || process.arch, + target_arch: options.target_arch || process.arch, + libc: options.target_libc || detect_libc.family || 'unknown', + module_main: package_json.main, + toolset : options.toolset || '' // address https://github.com/mapbox/node-pre-gyp/issues/119 + }; + // support host mirror with npm config `--{module_name}_binary_host_mirror` + // e.g.: https://github.com/node-inspector/v8-profiler/blob/master/package.json#L25 + // > npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/ + var host = process.env['npm_config_' + opts.module_name + '_binary_host_mirror'] || package_json.binary.host; + opts.host = fix_slashes(eval_template(host,opts)); + opts.module_path = eval_template(package_json.binary.module_path,opts); + // now we resolve the module_path to ensure it is absolute so that binding.gyp variables work predictably + if (options.module_root) { + // resolve relative to known module root: works for pre-binding require + opts.module_path = path.join(options.module_root,opts.module_path); + } else { + // resolve relative to current working directory: works for node-pre-gyp commands + opts.module_path = path.resolve(opts.module_path); + } + opts.module = path.join(opts.module_path,opts.module_name + '.node'); + opts.remote_path = package_json.binary.remote_path ? drop_double_slashes(fix_slashes(eval_template(package_json.binary.remote_path,opts))) : default_remote_path; + var package_name = package_json.binary.package_name ? package_json.binary.package_name : default_package_name; + opts.package_name = eval_template(package_name,opts); + opts.staged_tarball = path.join('build/stage',opts.remote_path,opts.package_name); + opts.hosted_path = url.resolve(opts.host,opts.remote_path); + opts.hosted_tarball = url.resolve(opts.hosted_path,opts.package_name); + return opts; +}; diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/package.json b/legacy-libs/grpc/node_modules/node-pre-gyp/package.json new file mode 100644 index 0000000..83f52c3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/node-pre-gyp/package.json @@ -0,0 +1,90 @@ +{ + "_from": "node-pre-gyp@^0.13.0", + "_id": "node-pre-gyp@0.13.0", + "_inBundle": false, + "_integrity": "sha512-Md1D3xnEne8b/HGVQkZZwV27WUi1ZRuZBij24TNaZwUPU3ZAFtvT6xxJGaUVillfmMKnn5oD1HoGsp2Ftik7SQ==", + "_location": "/grpc/node-pre-gyp", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "node-pre-gyp@^0.13.0", + "name": "node-pre-gyp", + "escapedName": "node-pre-gyp", + "rawSpec": "^0.13.0", + "saveSpec": null, + "fetchSpec": "^0.13.0" + }, + "_requiredBy": [ + "/grpc" + ], + "_resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.13.0.tgz", + "_shasum": "df9ab7b68dd6498137717838e4f92a33fc9daa42", + "_shrinkwrap": null, + "_spec": "node-pre-gyp@^0.13.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Dane Springmeyer", + "email": "dane@mapbox.com" + }, + "bin": { + "node-pre-gyp": "./bin/node-pre-gyp" + }, + "bugs": { + "url": "https://github.com/mapbox/node-pre-gyp/issues" + }, + "bundleDependencies": false, + "dependencies": { + "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" + }, + "deprecated": false, + "description": "Node.js native addon binary install tool", + "devDependencies": { + "aws-sdk": "^2.28.0", + "jshint": "^2.9.5", + "nock": "^9.2.3", + "tape": "^4.6.3" + }, + "homepage": "https://github.com/mapbox/node-pre-gyp#readme", + "jshintConfig": { + "node": true, + "globalstrict": true, + "undef": true, + "unused": false, + "noarg": true + }, + "keywords": [ + "native", + "addon", + "module", + "c", + "c++", + "bindings", + "binary" + ], + "license": "BSD-3-Clause", + "main": "./lib/node-pre-gyp.js", + "name": "node-pre-gyp", + "optionalDependencies": {}, + "readme": "# node-pre-gyp\n\n#### node-pre-gyp makes it easy to publish and install Node.js C++ addons from binaries\n\n[![NPM](https://nodei.co/npm/node-pre-gyp.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-pre-gyp/)\n\n[![Build Status](https://api.travis-ci.org/mapbox/node-pre-gyp.svg)](https://travis-ci.org/mapbox/node-pre-gyp)\n[![Build status](https://ci.appveyor.com/api/projects/status/3nxewb425y83c0gv)](https://ci.appveyor.com/project/Mapbox/node-pre-gyp)\n[![Dependencies](https://david-dm.org/mapbox/node-pre-gyp.svg)](https://david-dm.org/mapbox/node-pre-gyp)\n\n`node-pre-gyp` stands between [npm](https://github.com/npm/npm) and [node-gyp](https://github.com/Tootallnate/node-gyp) and offers a cross-platform method of binary deployment.\n\n### Features\n\n - A command line tool called `node-pre-gyp` that can install your package's C++ module from a binary.\n - A variety of developer targeted commands for packaging, testing, and publishing binaries.\n - A JavaScript module that can dynamically require your installed binary: `require('node-pre-gyp').find`\n\nFor a hello world example of a module packaged with `node-pre-gyp` see and [the wiki ](https://github.com/mapbox/node-pre-gyp/wiki/Modules-using-node-pre-gyp) for real world examples.\n\n## Credits\n\n - The module is modeled after [node-gyp](https://github.com/Tootallnate/node-gyp) by [@Tootallnate](https://github.com/Tootallnate)\n - Motivation for initial development came from [@ErisDS](https://github.com/ErisDS) and the [Ghost Project](https://github.com/TryGhost/Ghost).\n - Development is sponsored by [Mapbox](https://www.mapbox.com/)\n\n## FAQ\n\nSee the [Frequently Ask Questions](https://github.com/mapbox/node-pre-gyp/wiki/FAQ).\n\n## Depends\n\n - Node.js >= node v6.x\n\n## Install\n\n`node-pre-gyp` is designed to be installed as a local dependency of your Node.js C++ addon and accessed like:\n\n ./node_modules/.bin/node-pre-gyp --help\n\nBut you can also install it globally:\n\n npm install node-pre-gyp -g\n\n## Usage\n\n### Commands\n\nView all possible commands:\n\n node-pre-gyp --help\n\n- clean - Remove the entire folder containing the compiled .node module\n- install - Install pre-built binary for module\n- reinstall - Run \"clean\" and \"install\" at once\n- build - Compile the module by dispatching to node-gyp or nw-gyp\n- rebuild - Run \"clean\" and \"build\" at once\n- package - Pack binary into tarball\n- testpackage - Test that the staged package is valid\n- publish - Publish pre-built binary\n- unpublish - Unpublish pre-built binary\n- info - Fetch info on published binaries\n\nYou can also chain commands:\n\n node-pre-gyp clean build unpublish publish info\n\n### Options\n\nOptions include:\n\n - `-C/--directory`: run the command in this directory\n - `--build-from-source`: build from source instead of using pre-built binary\n - `--update-binary`: reinstall by replacing previously installed local binary with remote binary\n - `--runtime=node-webkit`: customize the runtime: `node`, `electron` and `node-webkit` are the valid options\n - `--fallback-to-build`: fallback to building from source if pre-built binary is not available\n - `--target=0.4.0`: Pass the target node or node-webkit version to compile against\n - `--target_arch=ia32`: Pass the target arch and override the host `arch`. Valid values are 'ia32','x64', or `arm`.\n - `--target_platform=win32`: Pass the target platform and override the host `platform`. Valid values are `linux`, `darwin`, `win32`, `sunos`, `freebsd`, `openbsd`, and `aix`.\n\nBoth `--build-from-source` and `--fallback-to-build` can be passed alone or they can provide values. You can pass `--fallback-to-build=false` to override the option as declared in package.json. In addition to being able to pass `--build-from-source` you can also pass `--build-from-source=myapp` where `myapp` is the name of your module.\n\nFor example: `npm install --build-from-source=myapp`. This is useful if:\n\n - `myapp` is referenced in the package.json of a larger app and therefore `myapp` is being installed as a dependency with `npm install`.\n - The larger app also depends on other modules installed with `node-pre-gyp`\n - You only want to trigger a source compile for `myapp` and the other modules.\n\n### Configuring\n\nThis is a guide to configuring your module to use node-pre-gyp.\n\n#### 1) Add new entries to your `package.json`\n\n - Add `node-pre-gyp` to `dependencies`\n - Add `aws-sdk` as a `devDependency`\n - Add a custom `install` script\n - Declare a `binary` object\n\nThis looks like:\n\n```js\n \"dependencies\" : {\n \"node-pre-gyp\": \"0.6.x\"\n },\n \"devDependencies\": {\n \"aws-sdk\": \"2.x\"\n }\n \"scripts\": {\n \"install\": \"node-pre-gyp install --fallback-to-build\"\n },\n \"binary\": {\n \"module_name\": \"your_module\",\n \"module_path\": \"./lib/binding/\",\n \"host\": \"https://your_module.s3-us-west-1.amazonaws.com\"\n }\n```\n\nFor a full example see [node-addon-examples's package.json](https://github.com/springmeyer/node-addon-example/blob/master/package.json).\n\nLet's break this down:\n\n - Dependencies need to list `node-pre-gyp`\n - Your devDependencies should list `aws-sdk` so that you can run `node-pre-gyp publish` locally or a CI system. We recommend using `devDependencies` only since `aws-sdk` is large and not needed for `node-pre-gyp install` since it only uses http to fetch binaries\n - Your `scripts` section should override the `install` target with `\"install\": \"node-pre-gyp install --fallback-to-build\"`. This allows node-pre-gyp to be used instead of the default npm behavior of always source compiling with `node-gyp` directly.\n - Your package.json should contain a `binary` section describing key properties you provide to allow node-pre-gyp to package optimally. They are detailed below.\n\nNote: in the past we recommended putting `node-pre-gyp` in the `bundledDependencies`, but we no longer recommend this. In the past there were npm bugs (with node versions 0.10.x) that could lead to node-pre-gyp not being available at the right time during install (unless we bundled). This should no longer be the case. Also, for a time we recommended using `\"preinstall\": \"npm install node-pre-gyp\"` as an alternative method to avoid needing to bundle. But this did not behave predictably across all npm versions - see https://github.com/mapbox/node-pre-gyp/issues/260 for the details. So we do not recommend using `preinstall` to install `node-pre-gyp`. More history on this at https://github.com/strongloop/fsevents/issues/157#issuecomment-265545908.\n\n##### The `binary` object has three required properties\n\n###### module_name\n\nThe name of your native node module. This value must:\n\n - Match the name passed to [the NODE_MODULE macro](http://nodejs.org/api/addons.html#addons_hello_world)\n - Must be a valid C variable name (e.g. it cannot contain `-`)\n - Should not include the `.node` extension.\n\n###### module_path\n\nThe location your native module is placed after a build. This should be an empty directory without other Javascript files. This entire directory will be packaged in the binary tarball. When installing from a remote package this directory will be overwritten with the contents of the tarball.\n\nNote: This property supports variables based on [Versioning](#versioning).\n\n###### host\n\nA url to the remote location where you've published tarball binaries (must be `https` not `http`).\n\nIt is highly recommended that you use Amazon S3. The reasons are:\n\n - Various node-pre-gyp commands like `publish` and `info` only work with an S3 host.\n - S3 is a very solid hosting platform for distributing large files.\n - We provide detail documentation for using [S3 hosting](#s3-hosting) with node-pre-gyp.\n\nWhy then not require S3? Because while some applications using node-pre-gyp need to distribute binaries as large as 20-30 MB, others might have very small binaries and might wish to store them in a GitHub repo. This is not recommended, but if an author really wants to host in a non-S3 location then it should be possible.\n\nIt should also be mentioned that there is an optional and entirely separate npm module called [node-pre-gyp-github](https://github.com/bchr02/node-pre-gyp-github) which is intended to complement node-pre-gyp and be installed along with it. It provides the ability to store and publish your binaries within your repositories GitHub Releases if you would rather not use S3 directly. Installation and usage instructions can be found [here](https://github.com/bchr02/node-pre-gyp-github), but the basic premise is that instead of using the ```node-pre-gyp publish``` command you would use ```node-pre-gyp-github publish```.\n\n##### The `binary` object has two optional properties\n\n###### remote_path\n\nIt **is recommended** that you customize this property. This is an extra path to use for publishing and finding remote tarballs. The default value for `remote_path` is `\"\"` meaning that if you do not provide it then all packages will be published at the base of the `host`. It is recommended to provide a value like `./{name}/v{version}` to help organize remote packages in the case that you choose to publish multiple node addons to the same `host`.\n\nNote: This property supports variables based on [Versioning](#versioning).\n\n###### package_name\n\nIt is **not recommended** to override this property unless you are also overriding the `remote_path`. This is the versioned name of the remote tarball containing the binary `.node` module and any supporting files you've placed inside the `module_path` directory. Unless you specify `package_name` in your `package.json` then it defaults to `{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz` which allows your binary to work across node versions, platforms, and architectures. If you are using `remote_path` that is also versioned by `./{module_name}/v{version}` then you could remove these variables from the `package_name` and just use: `{node_abi}-{platform}-{arch}.tar.gz`. Then your remote tarball will be looked up at, for example, `https://example.com/your-module/v0.1.0/node-v11-linux-x64.tar.gz`.\n\nAvoiding the version of your module in the `package_name` and instead only embedding in a directory name can be useful when you want to make a quick tag of your module that does not change any C++ code. In this case you can just copy binaries to the new version behind the scenes like:\n\n```sh\naws s3 sync --acl public-read s3://mapbox-node-binary/sqlite3/v3.0.3/ s3://mapbox-node-binary/sqlite3/v3.0.4/\n```\n\nNote: This property supports variables based on [Versioning](#versioning).\n\n#### 2) Add a new target to binding.gyp\n\n`node-pre-gyp` calls out to `node-gyp` to compile the module and passes variables along like [module_name](#module_name) and [module_path](#module_path).\n\nA new target must be added to `binding.gyp` that moves the compiled `.node` module from `./build/Release/module_name.node` into the directory specified by `module_path`.\n\nAdd a target like this at the end of your `targets` list:\n\n```js\n {\n \"target_name\": \"action_after_build\",\n \"type\": \"none\",\n \"dependencies\": [ \"<(module_name)\" ],\n \"copies\": [\n {\n \"files\": [ \"<(PRODUCT_DIR)/<(module_name).node\" ],\n \"destination\": \"<(module_path)\"\n }\n ]\n }\n```\n\nFor a full example see [node-addon-example's binding.gyp](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/binding.gyp).\n\n#### 3) Dynamically require your `.node`\n\nInside the main js file that requires your addon module you are likely currently doing:\n\n```js\nvar binding = require('../build/Release/binding.node');\n```\n\nor:\n\n```js\nvar bindings = require('./bindings')\n```\n\nChange those lines to:\n\n```js\nvar binary = require('node-pre-gyp');\nvar path = require('path');\nvar binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json')));\nvar binding = require(binding_path);\n```\n\nFor a full example see [node-addon-example's index.js](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/index.js#L1-L4)\n\n#### 4) Build and package your app\n\nNow build your module from source:\n\n npm install --build-from-source\n\nThe `--build-from-source` tells `node-pre-gyp` to not look for a remote package and instead dispatch to node-gyp to build.\n\nNow `node-pre-gyp` should now also be installed as a local dependency so the command line tool it offers can be found at `./node_modules/.bin/node-pre-gyp`.\n\n#### 5) Test\n\nNow `npm test` should work just as it did before.\n\n#### 6) Publish the tarball\n\nThen package your app:\n\n ./node_modules/.bin/node-pre-gyp package\n\nOnce packaged, now you can publish:\n\n ./node_modules/.bin/node-pre-gyp publish\n\nCurrently the `publish` command pushes your binary to S3. This requires:\n\n - You have installed `aws-sdk` with `npm install aws-sdk`\n - You have created a bucket already.\n - The `host` points to an S3 http or https endpoint.\n - You have configured node-pre-gyp to read your S3 credentials (see [S3 hosting](#s3-hosting) for details).\n\nYou can also host your binaries elsewhere. To do this requires:\n\n - You manually publish the binary created by the `package` command to an `https` endpoint\n - Ensure that the `host` value points to your custom `https` endpoint.\n\n#### 7) Automate builds\n\nNow you need to publish builds for all the platforms and node versions you wish to support. This is best automated.\n\n - See [Appveyor Automation](#appveyor-automation) for how to auto-publish builds on Windows.\n - See [Travis Automation](#travis-automation) for how to auto-publish builds on OS X and Linux.\n\n#### 8) You're done!\n\nNow publish your module to the npm registry. Users will now be able to install your module from a binary.\n\nWhat will happen is this:\n\n1. `npm install ` will pull from the npm registry\n2. npm will run the `install` script which will call out to `node-pre-gyp`\n3. `node-pre-gyp` will fetch the binary `.node` module and unpack in the right place\n4. Assuming that all worked, you are done\n\nIf a a binary was not available for a given platform and `--fallback-to-build` was used then `node-gyp rebuild` will be called to try to source compile the module.\n\n## N-API Considerations\n\n[N-API](https://nodejs.org/api/n-api.html#n_api_n_api) is an ABI-stable alternative to previous technologies such as [nan](https://github.com/nodejs/nan) which are tied to a specific Node runtime engine. N-API is Node runtime engine agnostic and guarantees modules created today will continue to run, without changes, into the future.\n\nUsing `node-pre-gyp` with N-API projects requires a handful of additional configuration values and imposes some additional requirements.\n\nThe most significant difference is that an N-API module can be coded to target multiple N-API versions. Therefore, an N-API module must declare in its `package.json` file which N-API versions the module is designed to run against. In addition, since multiple builds may be required for a single module, path and file names must be specified in way that avoids naming conflicts.\n\n### The `napi_versions` array property\n\nAn N-API modules must declare in its `package.json` file, the N-API versions the module is intended to support. This is accomplished by including an `napi-versions` array property in the `binary` object. For example:\n\n```js\n\"binary\": {\n \"module_name\": \"your_module\",\n \"module_path\": \"your_module_path\",\n \"host\": \"https://your_bucket.s3-us-west-1.amazonaws.com\",\n \"napi_versions\": [1,3]\n }\n```\n\nIf the `napi_versions` array property is *not* present, `node-pre-gyp` operates as it always has. Including the `napi_versions` array property instructs `node-pre-gyp` that this is a N-API module build.\n\nWhen the `napi_versions` array property is present, `node-pre-gyp` fires off multiple operations, one for each of the N-API versions in the array. In the example above, two operations are initiated, one for N-API version 1 and second for N-API version 3. How this version number is communicated is described next.\n\n### The `napi_build_version` value\n\nFor each of the N-API module operations `node-pre-gyp` initiates, it ensures that the `napi_build_version` is set appropriately.\n\nThis value is of importance in two areas:\n\n1. The C/C++ code which needs to know against which N-API version it should compile.\n2. `node-pre-gyp` itself which must assign appropriate path and file names to avoid collisions.\n\n### Defining `NAPI_VERSION` for the C/C++ code\n\nThe `napi_build_version` value is communicated to the C/C++ code by adding this code to the `binding.gyp` file:\n\n```\n\"defines\": [\n \"NAPI_VERSION=<(napi_build_version)\",\n]\n```\n\nThis ensures that `NAPI_VERSION`, an integer value, is declared appropriately to the C/C++ code for each build.\n\n> Note that earlier versions of this document recommended defining the symbol `NAPI_BUILD_VERSION`. `NAPI_VERSION` is prefered because it used by the N-API C/C++ headers to configure the specific N-API veriosn being requested. \n\n### Path and file naming requirements in `package.json`\n\nSince `node-pre-gyp` fires off multiple operations for each request, it is essential that path and file names be created in such a way as to avoid collisions. This is accomplished by imposing additional path and file naming requirements.\n\nSpecifically, when performing N-API builds, the `{napi_build_version}` text configuration value *must* be present in the `module_path` property. In addition, the `{napi_build_version}` text configuration value *must* be present in either the `remote_path` or `package_name` property. (No problem if it's in both.)\n\nHere's an example:\n\n```js\n\"binary\": {\n \"module_name\": \"your_module\",\n \"module_path\": \"./lib/binding/napi-v{napi_build_version}\",\n \"remote_path\": \"./{module_name}/v{version}/{configuration}/\",\n \"package_name\": \"{platform}-{arch}-napi-v{napi_build_version}.tar.gz\",\n \"host\": \"https://your_bucket.s3-us-west-1.amazonaws.com\",\n \"napi_versions\": [1,3]\n }\n```\n\n## Supporting both N-API and NAN builds\n\nYou may have a legacy native add-on that you wish to continue supporting for those versions of Node that do not support N-API, as you add N-API support for later Node versions. This can be accomplished by specifying the `node_napi_label` configuration value in the package.json `binary.package_name` property. \n\nPlacing the configuration value `node_napi_label` in the package.json `binary.package_name` property instructs `node-pre-gyp` to build all viable N-API binaries supported by the current Node instance. If the current Node instance does not support N-API, `node-pre-gyp` will request a traditional, non-N-API build. \n\nThe configuration value `node_napi_label` is set by `node-pre-gyp` to the type of build created, `napi` or `node`, and the version number. For N-API builds, the string contains the N-API version nad has values like `napi-v3`. For traditional, non-N-API builds, the string contains the ABI version with values like `node-v46`.\n\nHere's how the `binary` configuration above might be changed to support both N-API and NAN builds:\n\n```js\n\"binary\": {\n \"module_name\": \"your_module\",\n \"module_path\": \"./lib/binding/{node_napi_label}\",\n \"remote_path\": \"./{module_name}/v{version}/{configuration}/\",\n \"package_name\": \"{platform}-{arch}-{node_napi_label}.tar.gz\",\n \"host\": \"https://your_bucket.s3-us-west-1.amazonaws.com\",\n \"napi_versions\": [1,3]\n }\n```\n\nThe C/C++ symbol `NAPI_VERSION` can be used to distinguish N-API and non-N-API builds. The value of `NAPI_VERSION` is set to the integer N-API version for N-API builds and is set to `0` for non-N-API builds. \n\nFor example:\n \n```C\n#if NAPI_VERSION\n// N-API code goes here\n#else\n// NAN code goes here\n#endif\n```\n\n### Two additional configuration values\n\nThe following two configuration values, which were implemented in previous versions of `node-pre-gyp`, continue to exist, but have been replaced by the `node_napi_label` configuration value described above.\n\n1. `napi_version` If N-API is supported by the currently executing Node instance, this value is the N-API version number supported by Node. If N-API is not supported, this value is an empty string.\n\n2. `node_abi_napi` If the value returned for `napi_version` is non empty, this value is `'napi'`. If the value returned for `napi_version` is empty, this value is the value returned for `node_abi`.\n\nThese values are present for use in the `binding.gyp` file and may be used as `{napi_version}` and `{node_abi_napi}` for text substituion in the `binary` properties of the `package.json` file.\n\n## S3 Hosting\n\nYou can host wherever you choose but S3 is cheap, `node-pre-gyp publish` expects it, and S3 can be integrated well with [Travis.ci](http://travis-ci.org) to automate builds for OS X and Ubuntu, and with [Appveyor](http://appveyor.com) to automate builds for Windows. Here is an approach to do this:\n\nFirst, get setup locally and test the workflow:\n\n#### 1) Create an S3 bucket\n\nAnd have your **key** and **secret key** ready for writing to the bucket.\n\nIt is recommended to create a IAM user with a policy that only gives permissions to the specific bucket you plan to publish to. This can be done in the [IAM console](https://console.aws.amazon.com/iam/) by: 1) adding a new user, 2) choosing `Attach User Policy`, 3) Using the `Policy Generator`, 4) selecting `Amazon S3` for the service, 5) adding the actions: `DeleteObject`, `GetObject`, `GetObjectAcl`, `ListBucket`, `PutObject`, `PutObjectAcl`, 6) adding an ARN of `arn:aws:s3:::bucket/*` (replacing `bucket` with your bucket name), and finally 7) clicking `Add Statement` and saving the policy. It should generate a policy like:\n\n```js\n{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"Stmt1394587197000\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"s3:DeleteObject\",\n \"s3:GetObject\",\n \"s3:GetObjectAcl\",\n \"s3:ListBucket\",\n \"s3:PutObject\",\n \"s3:PutObjectAcl\"\n ],\n \"Resource\": [\n \"arn:aws:s3:::node-pre-gyp-tests/*\"\n ]\n }\n ]\n}\n```\n\n#### 2) Install node-pre-gyp\n\nEither install it globally:\n\n npm install node-pre-gyp -g\n\nOr put the local version on your PATH\n\n export PATH=`pwd`/node_modules/.bin/:$PATH\n\n#### 3) Configure AWS credentials\n\nThere are several ways to do this.\n\nYou can use any of the methods described at http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html.\n\nOr you can create a `~/.node_pre_gyprc`\n\nOr pass options in any way supported by [RC](https://github.com/dominictarr/rc#standards)\n\nA `~/.node_pre_gyprc` looks like:\n\n```js\n{\n \"accessKeyId\": \"xxx\",\n \"secretAccessKey\": \"xxx\"\n}\n```\n\nAnother way is to use your environment:\n\n export node_pre_gyp_accessKeyId=xxx\n export node_pre_gyp_secretAccessKey=xxx\n\nYou may also need to specify the `region` if it is not explicit in the `host` value you use. The `bucket` can also be specified but it is optional because `node-pre-gyp` will detect it from the `host` value.\n\n#### 4) Package and publish your build\n\nInstall the `aws-sdk`:\n\n npm install aws-sdk\n\nThen publish:\n\n node-pre-gyp package publish\n\nNote: if you hit an error like `Hostname/IP doesn't match certificate's altnames` it may mean that you need to provide the `region` option in your config.\n\n## Appveyor Automation\n\n[Appveyor](http://www.appveyor.com/) can build binaries and publish the results per commit and supports:\n\n - Windows Visual Studio 2013 and related compilers\n - Both 64 bit (x64) and 32 bit (x86) build configurations\n - Multiple Node.js versions\n\nFor an example of doing this see [node-sqlite3's appveyor.yml](https://github.com/mapbox/node-sqlite3/blob/master/appveyor.yml).\n\nBelow is a guide to getting set up:\n\n#### 1) Create a free Appveyor account\n\nGo to https://ci.appveyor.com/signup/free and sign in with your GitHub account.\n\n#### 2) Create a new project\n\nGo to https://ci.appveyor.com/projects/new and select the GitHub repo for your module\n\n#### 3) Add appveyor.yml and push it\n\nOnce you have committed an `appveyor.yml` ([appveyor.yml reference](http://www.appveyor.com/docs/appveyor-yml)) to your GitHub repo and pushed it AppVeyor should automatically start building your project.\n\n#### 4) Create secure variables\n\nEncrypt your S3 AWS keys by going to and hitting the `encrypt` button.\n\nThen paste the result into your `appveyor.yml`\n\n```yml\nenvironment:\n node_pre_gyp_accessKeyId:\n secure: Dn9HKdLNYvDgPdQOzRq/DqZ/MPhjknRHB1o+/lVU8MA=\n node_pre_gyp_secretAccessKey:\n secure: W1rwNoSnOku1r+28gnoufO8UA8iWADmL1LiiwH9IOkIVhDTNGdGPJqAlLjNqwLnL\n```\n\nNOTE: keys are per account but not per repo (this is difference than Travis where keys are per repo but not related to the account used to encrypt them).\n\n#### 5) Hook up publishing\n\nJust put `node-pre-gyp package publish` in your `appveyor.yml` after `npm install`.\n\n#### 6) Publish when you want\n\nYou might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`:\n\n SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE%\n if not \"%CM%\" == \"%CM:[publish binary]=%\" node-pre-gyp --msvs_version=2013 publish\n\nIf your commit message contains special characters (e.g. `&`) this method might fail. An alternative is to use PowerShell, which gives you additional possibilities, like ignoring case by using `ToLower()`:\n\n ps: if($env:APPVEYOR_REPO_COMMIT_MESSAGE.ToLower().Contains('[publish binary]')) { node-pre-gyp --msvs_version=2013 publish }\n\nRemember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package.\n\n## Travis Automation\n\n[Travis](https://travis-ci.org/) can push to S3 after a successful build and supports both:\n\n - Ubuntu Precise and OS X (64 bit)\n - Multiple Node.js versions\n\nFor an example of doing this see [node-add-example's .travis.yml](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/.travis.yml).\n\nNote: if you need 32 bit binaries, this can be done from a 64 bit Travis machine. See [the node-sqlite3 scripts for an example of doing this](https://github.com/mapbox/node-sqlite3/blob/bae122aa6a2b8a45f6b717fab24e207740e32b5d/scripts/build_against_node.sh#L54-L74).\n\nBelow is a guide to getting set up:\n\n#### 1) Install the Travis gem\n\n gem install travis\n\n#### 2) Create secure variables\n\nMake sure you run this command from within the directory of your module.\n\nUse `travis-encrypt` like:\n\n travis encrypt node_pre_gyp_accessKeyId=${node_pre_gyp_accessKeyId}\n travis encrypt node_pre_gyp_secretAccessKey=${node_pre_gyp_secretAccessKey}\n\nThen put those values in your `.travis.yml` like:\n\n```yaml\nenv:\n global:\n - secure: F+sEL/v56CzHqmCSSES4pEyC9NeQlkoR0Gs/ZuZxX1ytrj8SKtp3MKqBj7zhIclSdXBz4Ev966Da5ctmcTd410p0b240MV6BVOkLUtkjZJyErMBOkeb8n8yVfSoeMx8RiIhBmIvEn+rlQq+bSFis61/JkE9rxsjkGRZi14hHr4M=\n - secure: o2nkUQIiABD139XS6L8pxq3XO5gch27hvm/gOdV+dzNKc/s2KomVPWcOyXNxtJGhtecAkABzaW8KHDDi5QL1kNEFx6BxFVMLO8rjFPsMVaBG9Ks6JiDQkkmrGNcnVdxI/6EKTLHTH5WLsz8+J7caDBzvKbEfTux5EamEhxIWgrI=\n```\n\nMore details on Travis encryption at http://about.travis-ci.org/docs/user/encryption-keys/.\n\n#### 3) Hook up publishing\n\nJust put `node-pre-gyp package publish` in your `.travis.yml` after `npm install`.\n\n##### OS X publishing\n\nIf you want binaries for OS X in addition to linux you can enable [multi-os for Travis](http://docs.travis-ci.com/user/multi-os/#Setting-.travis.yml)\n\nUse a configuration like:\n\n```yml\n\nlanguage: cpp\n\nos:\n- linux\n- osx\n\nenv:\n matrix:\n - NODE_VERSION=\"4\"\n - NODE_VERSION=\"6\"\n\nbefore_install:\n- rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm\n- source ~/.nvm/nvm.sh\n- nvm install $NODE_VERSION\n- nvm use $NODE_VERSION\n```\n\nSee [Travis OS X Gotchas](#travis-os-x-gotchas) for why we replace `language: node_js` and `node_js:` sections with `language: cpp` and a custom matrix.\n\nAlso create platform specific sections for any deps that need install. For example if you need libpng:\n\n```yml\n- if [ $(uname -s) == 'Linux' ]; then apt-get install libpng-dev; fi;\n- if [ $(uname -s) == 'Darwin' ]; then brew install libpng; fi;\n```\n\nFor detailed multi-OS examples see [node-mapnik](https://github.com/mapnik/node-mapnik/blob/master/.travis.yml) and [node-sqlite3](https://github.com/mapbox/node-sqlite3/blob/master/.travis.yml).\n\n##### Travis OS X Gotchas\n\nFirst, unlike the Travis Linux machines, the OS X machines do not put `node-pre-gyp` on PATH by default. To do so you will need to:\n\n```sh\nexport PATH=$(pwd)/node_modules/.bin:${PATH}\n```\n\nSecond, the OS X machines do not support using a matrix for installing different Node.js versions. So you need to bootstrap the installation of Node.js in a cross platform way.\n\nBy doing:\n\n```yml\nenv:\n matrix:\n - NODE_VERSION=\"4\"\n - NODE_VERSION=\"6\"\n\nbefore_install:\n - rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm\n - source ~/.nvm/nvm.sh\n - nvm install $NODE_VERSION\n - nvm use $NODE_VERSION\n```\n\nYou can easily recreate the previous behavior of this matrix:\n\n```yml\nnode_js:\n - \"4\"\n - \"6\"\n```\n\n#### 4) Publish when you want\n\nYou might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`:\n\n COMMIT_MESSAGE=$(git log --format=%B --no-merges -n 1 | tr -d '\\n')\n if [[ ${COMMIT_MESSAGE} =~ \"[publish binary]\" ]]; then node-pre-gyp publish; fi;\n\nThen you can trigger new binaries to be built like:\n\n git commit -a -m \"[publish binary]\"\n\nOr, if you don't have any changes to make simply run:\n\n git commit --allow-empty -m \"[publish binary]\"\n\nWARNING: if you are working in a pull request and publishing binaries from there then you will want to avoid double publishing when Travis CI builds both the `push` and `pr`. You only want to run the publish on the `push` commit. See https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/is_pr_merge.sh which is called from https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/publish.sh for an example of how to do this.\n\nRemember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package. To automate the publishing of your entire package to npm on Travis see http://about.travis-ci.org/docs/user/deployment/npm/\n\n# Versioning\n\nThe `binary` properties of `module_path`, `remote_path`, and `package_name` support variable substitution. The strings are evaluated by `node-pre-gyp` depending on your system and any custom build flags you passed.\n\n - `node_abi`: The node C++ `ABI` number. This value is available in Javascript as `process.versions.modules` as of [`>= v0.10.4 >= v0.11.7`](https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e) and in C++ as the `NODE_MODULE_VERSION` define much earlier. For versions of Node before this was available we fallback to the V8 major and minor version.\n - `platform` matches node's `process.platform` like `linux`, `darwin`, and `win32` unless the user passed the `--target_platform` option to override.\n - `arch` matches node's `process.arch` like `x64` or `ia32` unless the user passes the `--target_arch` option to override.\n - `libc` matches `require('detect-libc').family` like `glibc` or `musl` unless the user passes the `--target_libc` option to override.\n - `configuration` - Either 'Release' or 'Debug' depending on if `--debug` is passed during the build.\n - `module_name` - the `binary.module_name` attribute from `package.json`.\n - `version` - the semver `version` value for your module from `package.json` (NOTE: ignores the `semver.build` property).\n - `major`, `minor`, `patch`, and `prelease` match the individual semver values for your module's `version`\n - `build` - the sevmer `build` value. For example it would be `this.that` if your package.json `version` was `v1.0.0+this.that`\n - `prerelease` - the semver `prerelease` value. For example it would be `alpha.beta` if your package.json `version` was `v1.0.0-alpha.beta`\n\n\nThe options are visible in the code at \n\n# Download binary files from a mirror\n\nS3 is broken in China for the well known reason.\n\nUsing the `npm` config argument: `--{module_name}_binary_host_mirror` can download binary files through a mirror.\n\ne.g.: Install [v8-profiler](https://www.npmjs.com/package/v8-profiler) from `npm`.\n\n```bash\n$ npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/\n```\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/mapbox/node-pre-gyp.git" + }, + "scripts": { + "pretest": "jshint test/build.test.js test/s3_setup.test.js test/versioning.test.js test/fetch.test.js lib lib/util scripts bin/node-pre-gyp", + "test": "jshint lib lib/util scripts bin/node-pre-gyp && tape test/*test.js", + "update-crosswalk": "node scripts/abi_crosswalk.js" + }, + "version": "0.13.0" +} diff --git a/legacy-libs/grpc/node_modules/nopt/CHANGELOG.md b/legacy-libs/grpc/node_modules/nopt/CHANGELOG.md new file mode 100644 index 0000000..82a09fb --- /dev/null +++ b/legacy-libs/grpc/node_modules/nopt/CHANGELOG.md @@ -0,0 +1,58 @@ +### v4.0.1 (2016-12-14) + +#### WHOOPS + +* [`fb9b1ce`](https://github.com/npm/nopt/commit/fb9b1ce57b3c69b4f7819015be87719204f77ef6) + Merged so many patches at once that the code fencing + ([@adius](https://github.com/adius)) added got broken. Sorry, + ([@adius](https://github.com/adius))! + ([@othiym23](https://github.com/othiym23)) + +### v4.0.0 (2016-12-13) + +#### BREAKING CHANGES + +* [`651d447`](https://github.com/npm/nopt/commit/651d4473946096d341a480bbe56793de3fc706aa) + When parsing String-typed arguments, if the next value is `""`, don't simply + swallow it. ([@samjonester](https://github.com/samjonester)) + +#### PERFORMANCE TWEAKS + +* [`3370ce8`](https://github.com/npm/nopt/commit/3370ce87a7618ba228883861db84ddbcdff252a9) + Simplify initialization. ([@elidoran](https://github.com/elidoran)) +* [`356e58e`](https://github.com/npm/nopt/commit/356e58e3b3b431a4b1af7fd7bdee44c2c0526a09) + Store `Array.isArray(types[arg])` for reuse. + ([@elidoran](https://github.com/elidoran)) +* [`0d95e90`](https://github.com/npm/nopt/commit/0d95e90515844f266015b56d2c80b94e5d14a07e) + Interpret single-item type arrays as a single type. + ([@samjonester](https://github.com/samjonester)) +* [`07c69d3`](https://github.com/npm/nopt/commit/07c69d38b5186450941fbb505550becb78a0e925) + Simplify key-value extraction. ([@elidoran](https://github.com/elidoran)) +* [`39b6e5c`](https://github.com/npm/nopt/commit/39b6e5c65ac47f60cd43a1fbeece5cd4c834c254) + Only call `Date.parse(val)` once. ([@elidoran](https://github.com/elidoran)) +* [`934943d`](https://github.com/npm/nopt/commit/934943dffecb55123a2b15959fe2a359319a5dbd) + Use `osenv.home()` to find a user's home directory instead of assuming it's + always `$HOME`. ([@othiym23](https://github.com/othiym23)) + +#### TEST & CI IMPROVEMENTS + +* [`326ffff`](https://github.com/npm/nopt/commit/326ffff7f78a00bcd316adecf69075f8a8093619) + Fix `/tmp` test to work on Windows. + ([@elidoran](https://github.com/elidoran)) +* [`c89d31a`](https://github.com/npm/nopt/commit/c89d31a49d14f2238bc6672db08da697bbc57f1b) + Only run Windows tests on Windows, only run Unix tests on a Unix. + ([@elidoran](https://github.com/elidoran)) +* [`affd3d1`](https://github.com/npm/nopt/commit/affd3d1d0addffa93006397b2013b18447339366) + Refresh Travis to run the tests against the currently-supported batch of npm + versions. ([@helio](https://github.com/helio)-frota) +* [`55f9449`](https://github.com/npm/nopt/commit/55f94497d163ed4d16dd55fd6c4fb95cc440e66d) + `tap@8.0.1` ([@othiym23](https://github.com/othiym23)) + +#### DOC TWEAKS + +* [`5271229`](https://github.com/npm/nopt/commit/5271229ee7c810217dd51616c086f5d9ab224581) + Use JavaScript code block for syntax highlighting. + ([@adius](https://github.com/adius)) +* [`c0d156f`](https://github.com/npm/nopt/commit/c0d156f229f9994c5dfcec4a8886eceff7a07682) + The code sample in the README had `many2: [ oneThing ]`, and now it has + `many2: [ two, things ]`. ([@silkentrance](https://github.com/silkentrance)) diff --git a/legacy-libs/grpc/node_modules/nopt/LICENSE b/legacy-libs/grpc/node_modules/nopt/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/nopt/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/nopt/README.md b/legacy-libs/grpc/node_modules/nopt/README.md new file mode 100644 index 0000000..a99531c --- /dev/null +++ b/legacy-libs/grpc/node_modules/nopt/README.md @@ -0,0 +1,213 @@ +If you want to write an option parser, and have it be good, there are +two ways to do it. The Right Way, and the Wrong Way. + +The Wrong Way is to sit down and write an option parser. We've all done +that. + +The Right Way is to write some complex configurable program with so many +options that you hit the limit of your frustration just trying to +manage them all, and defer it with duct-tape solutions until you see +exactly to the core of the problem, and finally snap and write an +awesome option parser. + +If you want to write an option parser, don't write an option parser. +Write a package manager, or a source control system, or a service +restarter, or an operating system. You probably won't end up with a +good one of those, but if you don't give up, and you are relentless and +diligent enough in your procrastination, you may just end up with a very +nice option parser. + +## USAGE + +```javascript +// my-program.js +var nopt = require("nopt") + , Stream = require("stream").Stream + , path = require("path") + , knownOpts = { "foo" : [String, null] + , "bar" : [Stream, Number] + , "baz" : path + , "bloo" : [ "big", "medium", "small" ] + , "flag" : Boolean + , "pick" : Boolean + , "many1" : [String, Array] + , "many2" : [path, Array] + } + , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] + , "b7" : ["--bar", "7"] + , "m" : ["--bloo", "medium"] + , "p" : ["--pick"] + , "f" : ["--flag"] + } + // everything is optional. + // knownOpts and shorthands default to {} + // arg list defaults to process.argv + // slice defaults to 2 + , parsed = nopt(knownOpts, shortHands, process.argv, 2) +console.log(parsed) +``` + +This would give you support for any of the following: + +```console +$ node my-program.js --foo "blerp" --no-flag +{ "foo" : "blerp", "flag" : false } + +$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag +{ bar: 7, foo: "Mr. Hand", flag: true } + +$ node my-program.js --foo "blerp" -f -----p +{ foo: "blerp", flag: true, pick: true } + +$ node my-program.js -fp --foofoo +{ foo: "Mr. Foo", flag: true, pick: true } + +$ node my-program.js --foofoo -- -fp # -- stops the flag parsing. +{ foo: "Mr. Foo", argv: { remain: ["-fp"] } } + +$ node my-program.js --blatzk -fp # unknown opts are ok. +{ blatzk: true, flag: true, pick: true } + +$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value +{ blatzk: 1000, flag: true, pick: true } + +$ node my-program.js --no-blatzk -fp # unless they start with "no-" +{ blatzk: false, flag: true, pick: true } + +$ node my-program.js --baz b/a/z # known paths are resolved. +{ baz: "/Users/isaacs/b/a/z" } + +# if Array is one of the types, then it can take many +# values, and will always be an array. The other types provided +# specify what types are allowed in the list. + +$ node my-program.js --many1 5 --many1 null --many1 foo +{ many1: ["5", "null", "foo"] } + +$ node my-program.js --many2 foo --many2 bar +{ many2: ["/path/to/foo", "path/to/bar"] } +``` + +Read the tests at the bottom of `lib/nopt.js` for more examples of +what this puppy can do. + +## Types + +The following types are supported, and defined on `nopt.typeDefs` + +* String: A normal string. No parsing is done. +* path: A file system path. Gets resolved against cwd if not absolute. +* url: A url. If it doesn't parse, it isn't accepted. +* Number: Must be numeric. +* Date: Must parse as a date. If it does, and `Date` is one of the options, + then it will return a Date object, not a string. +* Boolean: Must be either `true` or `false`. If an option is a boolean, + then it does not need a value, and its presence will imply `true` as + the value. To negate boolean flags, do `--no-whatever` or `--whatever + false` +* NaN: Means that the option is strictly not allowed. Any value will + fail. +* Stream: An object matching the "Stream" class in node. Valuable + for use when validating programmatically. (npm uses this to let you + supply any WriteStream on the `outfd` and `logfd` config options.) +* Array: If `Array` is specified as one of the types, then the value + will be parsed as a list of options. This means that multiple values + can be specified, and that the value will always be an array. + +If a type is an array of values not on this list, then those are +considered valid values. For instance, in the example above, the +`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`, +and any other value will be rejected. + +When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be +interpreted as their JavaScript equivalents. + +You can also mix types and values, or multiple types, in a list. For +instance `{ blah: [Number, null] }` would allow a value to be set to +either a Number or null. When types are ordered, this implies a +preference, and the first type that can be used to properly interpret +the value will be used. + +To define a new type, add it to `nopt.typeDefs`. Each item in that +hash is an object with a `type` member and a `validate` method. The +`type` member is an object that matches what goes in the type list. The +`validate` method is a function that gets called with `validate(data, +key, val)`. Validate methods should assign `data[key]` to the valid +value of `val` if it can be handled properly, or return boolean +`false` if it cannot. + +You can also call `nopt.clean(data, types, typeDefs)` to clean up a +config object and remove its invalid properties. + +## Error Handling + +By default, nopt outputs a warning to standard error when invalid values for +known options are found. You can change this behavior by assigning a method +to `nopt.invalidHandler`. This method will be called with +the offending `nopt.invalidHandler(key, val, types)`. + +If no `nopt.invalidHandler` is assigned, then it will console.error +its whining. If it is assigned to boolean `false` then the warning is +suppressed. + +## Abbreviations + +Yes, they are supported. If you define options like this: + +```javascript +{ "foolhardyelephants" : Boolean +, "pileofmonkeys" : Boolean } +``` + +Then this will work: + +```bash +node program.js --foolhar --pil +node program.js --no-f --pileofmon +# etc. +``` + +## Shorthands + +Shorthands are a hash of shorter option names to a snippet of args that +they expand to. + +If multiple one-character shorthands are all combined, and the +combination does not unambiguously match any other option or shorthand, +then they will be broken up into their constituent parts. For example: + +```json +{ "s" : ["--loglevel", "silent"] +, "g" : "--global" +, "f" : "--force" +, "p" : "--parseable" +, "l" : "--long" +} +``` + +```bash +npm ls -sgflp +# just like doing this: +npm ls --loglevel silent --global --force --long --parseable +``` + +## The Rest of the args + +The config object returned by nopt is given a special member called +`argv`, which is an object with the following fields: + +* `remain`: The remaining args after all the parsing has occurred. +* `original`: The args as they originally appeared. +* `cooked`: The args after flags and shorthands are expanded. + +## Slicing + +Node programs are called with more or less the exact argv as it appears +in C land, after the v8 and node-specific options have been plucked off. +As such, `argv[0]` is always `node` and `argv[1]` is always the +JavaScript program being run. + +That's usually not very useful to you. So they're sliced off by +default. If you want them, then you can pass in `0` as the last +argument, or any other number that you'd like to slice off the start of +the list. diff --git a/legacy-libs/grpc/node_modules/nopt/bin/nopt.js b/legacy-libs/grpc/node_modules/nopt/bin/nopt.js new file mode 100644 index 0000000..3232d4c --- /dev/null +++ b/legacy-libs/grpc/node_modules/nopt/bin/nopt.js @@ -0,0 +1,54 @@ +#!/usr/bin/env node +var nopt = require("../lib/nopt") + , path = require("path") + , types = { num: Number + , bool: Boolean + , help: Boolean + , list: Array + , "num-list": [Number, Array] + , "str-list": [String, Array] + , "bool-list": [Boolean, Array] + , str: String + , clear: Boolean + , config: Boolean + , length: Number + , file: path + } + , shorthands = { s: [ "--str", "astring" ] + , b: [ "--bool" ] + , nb: [ "--no-bool" ] + , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ] + , "?": ["--help"] + , h: ["--help"] + , H: ["--help"] + , n: [ "--num", "125" ] + , c: ["--config"] + , l: ["--length"] + , f: ["--file"] + } + , parsed = nopt( types + , shorthands + , process.argv + , 2 ) + +console.log("parsed", parsed) + +if (parsed.help) { + console.log("") + console.log("nopt cli tester") + console.log("") + console.log("types") + console.log(Object.keys(types).map(function M (t) { + var type = types[t] + if (Array.isArray(type)) { + return [t, type.map(function (type) { return type.name })] + } + return [t, type && type.name] + }).reduce(function (s, i) { + s[i[0]] = i[1] + return s + }, {})) + console.log("") + console.log("shorthands") + console.log(shorthands) +} diff --git a/legacy-libs/grpc/node_modules/nopt/examples/my-program.js b/legacy-libs/grpc/node_modules/nopt/examples/my-program.js new file mode 100644 index 0000000..142447e --- /dev/null +++ b/legacy-libs/grpc/node_modules/nopt/examples/my-program.js @@ -0,0 +1,30 @@ +#!/usr/bin/env node + +//process.env.DEBUG_NOPT = 1 + +// my-program.js +var nopt = require("../lib/nopt") + , Stream = require("stream").Stream + , path = require("path") + , knownOpts = { "foo" : [String, null] + , "bar" : [Stream, Number] + , "baz" : path + , "bloo" : [ "big", "medium", "small" ] + , "flag" : Boolean + , "pick" : Boolean + } + , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] + , "b7" : ["--bar", "7"] + , "m" : ["--bloo", "medium"] + , "p" : ["--pick"] + , "f" : ["--flag", "true"] + , "g" : ["--flag"] + , "s" : "--flag" + } + // everything is optional. + // knownOpts and shorthands default to {} + // arg list defaults to process.argv + // slice defaults to 2 + , parsed = nopt(knownOpts, shortHands, process.argv, 2) + +console.log("parsed =\n"+ require("util").inspect(parsed)) diff --git a/legacy-libs/grpc/node_modules/nopt/lib/nopt.js b/legacy-libs/grpc/node_modules/nopt/lib/nopt.js new file mode 100644 index 0000000..1fb1135 --- /dev/null +++ b/legacy-libs/grpc/node_modules/nopt/lib/nopt.js @@ -0,0 +1,436 @@ +// info about each config option. + +var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG + ? function () { console.error.apply(console, arguments) } + : function () {} + +var url = require("url") + , path = require("path") + , Stream = require("stream").Stream + , abbrev = require("abbrev") + , osenv = require("osenv") + +module.exports = exports = nopt +exports.clean = clean + +exports.typeDefs = + { String : { type: String, validate: validateString } + , Boolean : { type: Boolean, validate: validateBoolean } + , url : { type: url, validate: validateUrl } + , Number : { type: Number, validate: validateNumber } + , path : { type: path, validate: validatePath } + , Stream : { type: Stream, validate: validateStream } + , Date : { type: Date, validate: validateDate } + } + +function nopt (types, shorthands, args, slice) { + args = args || process.argv + types = types || {} + shorthands = shorthands || {} + if (typeof slice !== "number") slice = 2 + + debug(types, shorthands, args, slice) + + args = args.slice(slice) + var data = {} + , key + , argv = { + remain: [], + cooked: args, + original: args.slice(0) + } + + parse(args, data, argv.remain, types, shorthands) + // now data is full + clean(data, types, exports.typeDefs) + data.argv = argv + Object.defineProperty(data.argv, 'toString', { value: function () { + return this.original.map(JSON.stringify).join(" ") + }, enumerable: false }) + return data +} + +function clean (data, types, typeDefs) { + typeDefs = typeDefs || exports.typeDefs + var remove = {} + , typeDefault = [false, true, null, String, Array] + + Object.keys(data).forEach(function (k) { + if (k === "argv") return + var val = data[k] + , isArray = Array.isArray(val) + , type = types[k] + if (!isArray) val = [val] + if (!type) type = typeDefault + if (type === Array) type = typeDefault.concat(Array) + if (!Array.isArray(type)) type = [type] + + debug("val=%j", val) + debug("types=", type) + val = val.map(function (val) { + // if it's an unknown value, then parse false/true/null/numbers/dates + if (typeof val === "string") { + debug("string %j", val) + val = val.trim() + if ((val === "null" && ~type.indexOf(null)) + || (val === "true" && + (~type.indexOf(true) || ~type.indexOf(Boolean))) + || (val === "false" && + (~type.indexOf(false) || ~type.indexOf(Boolean)))) { + val = JSON.parse(val) + debug("jsonable %j", val) + } else if (~type.indexOf(Number) && !isNaN(val)) { + debug("convert to number", val) + val = +val + } else if (~type.indexOf(Date) && !isNaN(Date.parse(val))) { + debug("convert to date", val) + val = new Date(val) + } + } + + if (!types.hasOwnProperty(k)) { + return val + } + + // allow `--no-blah` to set 'blah' to null if null is allowed + if (val === false && ~type.indexOf(null) && + !(~type.indexOf(false) || ~type.indexOf(Boolean))) { + val = null + } + + var d = {} + d[k] = val + debug("prevalidated val", d, val, types[k]) + if (!validate(d, k, val, types[k], typeDefs)) { + if (exports.invalidHandler) { + exports.invalidHandler(k, val, types[k], data) + } else if (exports.invalidHandler !== false) { + debug("invalid: "+k+"="+val, types[k]) + } + return remove + } + debug("validated val", d, val, types[k]) + return d[k] + }).filter(function (val) { return val !== remove }) + + if (!val.length) delete data[k] + else if (isArray) { + debug(isArray, data[k], val) + data[k] = val + } else data[k] = val[0] + + debug("k=%s val=%j", k, val, data[k]) + }) +} + +function validateString (data, k, val) { + data[k] = String(val) +} + +function validatePath (data, k, val) { + if (val === true) return false + if (val === null) return true + + val = String(val) + + var isWin = process.platform === 'win32' + , homePattern = isWin ? /^~(\/|\\)/ : /^~\// + , home = osenv.home() + + if (home && val.match(homePattern)) { + data[k] = path.resolve(home, val.substr(2)) + } else { + data[k] = path.resolve(val) + } + return true +} + +function validateNumber (data, k, val) { + debug("validate Number %j %j %j", k, val, isNaN(val)) + if (isNaN(val)) return false + data[k] = +val +} + +function validateDate (data, k, val) { + var s = Date.parse(val) + debug("validate Date %j %j %j", k, val, s) + if (isNaN(s)) return false + data[k] = new Date(val) +} + +function validateBoolean (data, k, val) { + if (val instanceof Boolean) val = val.valueOf() + else if (typeof val === "string") { + if (!isNaN(val)) val = !!(+val) + else if (val === "null" || val === "false") val = false + else val = true + } else val = !!val + data[k] = val +} + +function validateUrl (data, k, val) { + val = url.parse(String(val)) + if (!val.host) return false + data[k] = val.href +} + +function validateStream (data, k, val) { + if (!(val instanceof Stream)) return false + data[k] = val +} + +function validate (data, k, val, type, typeDefs) { + // arrays are lists of types. + if (Array.isArray(type)) { + for (var i = 0, l = type.length; i < l; i ++) { + if (type[i] === Array) continue + if (validate(data, k, val, type[i], typeDefs)) return true + } + delete data[k] + return false + } + + // an array of anything? + if (type === Array) return true + + // NaN is poisonous. Means that something is not allowed. + if (type !== type) { + debug("Poison NaN", k, val, type) + delete data[k] + return false + } + + // explicit list of values + if (val === type) { + debug("Explicitly allowed %j", val) + // if (isArray) (data[k] = data[k] || []).push(val) + // else data[k] = val + data[k] = val + return true + } + + // now go through the list of typeDefs, validate against each one. + var ok = false + , types = Object.keys(typeDefs) + for (var i = 0, l = types.length; i < l; i ++) { + debug("test type %j %j %j", k, val, types[i]) + var t = typeDefs[types[i]] + if (t && + ((type && type.name && t.type && t.type.name) ? (type.name === t.type.name) : (type === t.type))) { + var d = {} + ok = false !== t.validate(d, k, val) + val = d[k] + if (ok) { + // if (isArray) (data[k] = data[k] || []).push(val) + // else data[k] = val + data[k] = val + break + } + } + } + debug("OK? %j (%j %j %j)", ok, k, val, types[i]) + + if (!ok) delete data[k] + return ok +} + +function parse (args, data, remain, types, shorthands) { + debug("parse", args, data, remain) + + var key = null + , abbrevs = abbrev(Object.keys(types)) + , shortAbbr = abbrev(Object.keys(shorthands)) + + for (var i = 0; i < args.length; i ++) { + var arg = args[i] + debug("arg", arg) + + if (arg.match(/^-{2,}$/)) { + // done with keys. + // the rest are args. + remain.push.apply(remain, args.slice(i + 1)) + args[i] = "--" + break + } + var hadEq = false + if (arg.charAt(0) === "-" && arg.length > 1) { + var at = arg.indexOf('=') + if (at > -1) { + hadEq = true + var v = arg.substr(at + 1) + arg = arg.substr(0, at) + args.splice(i, 1, arg, v) + } + + // see if it's a shorthand + // if so, splice and back up to re-parse it. + var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs) + debug("arg=%j shRes=%j", arg, shRes) + if (shRes) { + debug(arg, shRes) + args.splice.apply(args, [i, 1].concat(shRes)) + if (arg !== shRes[0]) { + i -- + continue + } + } + arg = arg.replace(/^-+/, "") + var no = null + while (arg.toLowerCase().indexOf("no-") === 0) { + no = !no + arg = arg.substr(3) + } + + if (abbrevs[arg]) arg = abbrevs[arg] + + var argType = types[arg] + var isTypeArray = Array.isArray(argType) + if (isTypeArray && argType.length === 1) { + isTypeArray = false + argType = argType[0] + } + + var isArray = argType === Array || + isTypeArray && argType.indexOf(Array) !== -1 + + // allow unknown things to be arrays if specified multiple times. + if (!types.hasOwnProperty(arg) && data.hasOwnProperty(arg)) { + if (!Array.isArray(data[arg])) + data[arg] = [data[arg]] + isArray = true + } + + var val + , la = args[i + 1] + + var isBool = typeof no === 'boolean' || + argType === Boolean || + isTypeArray && argType.indexOf(Boolean) !== -1 || + (typeof argType === 'undefined' && !hadEq) || + (la === "false" && + (argType === null || + isTypeArray && ~argType.indexOf(null))) + + if (isBool) { + // just set and move along + val = !no + // however, also support --bool true or --bool false + if (la === "true" || la === "false") { + val = JSON.parse(la) + la = null + if (no) val = !val + i ++ + } + + // also support "foo":[Boolean, "bar"] and "--foo bar" + if (isTypeArray && la) { + if (~argType.indexOf(la)) { + // an explicit type + val = la + i ++ + } else if ( la === "null" && ~argType.indexOf(null) ) { + // null allowed + val = null + i ++ + } else if ( !la.match(/^-{2,}[^-]/) && + !isNaN(la) && + ~argType.indexOf(Number) ) { + // number + val = +la + i ++ + } else if ( !la.match(/^-[^-]/) && ~argType.indexOf(String) ) { + // string + val = la + i ++ + } + } + + if (isArray) (data[arg] = data[arg] || []).push(val) + else data[arg] = val + + continue + } + + if (argType === String) { + if (la === undefined) { + la = "" + } else if (la.match(/^-{1,2}[^-]+/)) { + la = "" + i -- + } + } + + if (la && la.match(/^-{2,}$/)) { + la = undefined + i -- + } + + val = la === undefined ? true : la + if (isArray) (data[arg] = data[arg] || []).push(val) + else data[arg] = val + + i ++ + continue + } + remain.push(arg) + } +} + +function resolveShort (arg, shorthands, shortAbbr, abbrevs) { + // handle single-char shorthands glommed together, like + // npm ls -glp, but only if there is one dash, and only if + // all of the chars are single-char shorthands, and it's + // not a match to some other abbrev. + arg = arg.replace(/^-+/, '') + + // if it's an exact known option, then don't go any further + if (abbrevs[arg] === arg) + return null + + // if it's an exact known shortopt, same deal + if (shorthands[arg]) { + // make it an array, if it's a list of words + if (shorthands[arg] && !Array.isArray(shorthands[arg])) + shorthands[arg] = shorthands[arg].split(/\s+/) + + return shorthands[arg] + } + + // first check to see if this arg is a set of single-char shorthands + var singles = shorthands.___singles + if (!singles) { + singles = Object.keys(shorthands).filter(function (s) { + return s.length === 1 + }).reduce(function (l,r) { + l[r] = true + return l + }, {}) + shorthands.___singles = singles + debug('shorthand singles', singles) + } + + var chrs = arg.split("").filter(function (c) { + return singles[c] + }) + + if (chrs.join("") === arg) return chrs.map(function (c) { + return shorthands[c] + }).reduce(function (l, r) { + return l.concat(r) + }, []) + + + // if it's an arg abbrev, and not a literal shorthand, then prefer the arg + if (abbrevs[arg] && !shorthands[arg]) + return null + + // if it's an abbr for a shorthand, then use that + if (shortAbbr[arg]) + arg = shortAbbr[arg] + + // make it an array, if it's a list of words + if (shorthands[arg] && !Array.isArray(shorthands[arg])) + shorthands[arg] = shorthands[arg].split(/\s+/) + + return shorthands[arg] +} diff --git a/legacy-libs/grpc/node_modules/nopt/package.json b/legacy-libs/grpc/node_modules/nopt/package.json new file mode 100644 index 0000000..2f94136 --- /dev/null +++ b/legacy-libs/grpc/node_modules/nopt/package.json @@ -0,0 +1,65 @@ +{ + "_args": [ + [ + "nopt@4.0.1", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "nopt@4.0.1", + "_id": "nopt@4.0.1", + "_inBundle": false, + "_integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "_location": "/grpc/nopt", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "nopt@4.0.1", + "name": "nopt", + "escapedName": "nopt", + "rawSpec": "4.0.1", + "saveSpec": null, + "fetchSpec": "4.0.1" + }, + "_requiredBy": [ + "/grpc/node-pre-gyp" + ], + "_resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "_shrinkwrap": null, + "_spec": "4.0.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bin": { + "nopt": "./bin/nopt.js" + }, + "bugs": { + "url": "https://github.com/npm/nopt/issues" + }, + "dependencies": { + "abbrev": "1", + "osenv": "^0.1.4" + }, + "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", + "devDependencies": { + "tap": "^8.0.1" + }, + "homepage": "https://github.com/npm/nopt#readme", + "license": "ISC", + "main": "lib/nopt.js", + "name": "nopt", + "optionalDependencies": {}, + "readme": "If you want to write an option parser, and have it be good, there are\ntwo ways to do it. The Right Way, and the Wrong Way.\n\nThe Wrong Way is to sit down and write an option parser. We've all done\nthat.\n\nThe Right Way is to write some complex configurable program with so many\noptions that you hit the limit of your frustration just trying to\nmanage them all, and defer it with duct-tape solutions until you see\nexactly to the core of the problem, and finally snap and write an\nawesome option parser.\n\nIf you want to write an option parser, don't write an option parser.\nWrite a package manager, or a source control system, or a service\nrestarter, or an operating system. You probably won't end up with a\ngood one of those, but if you don't give up, and you are relentless and\ndiligent enough in your procrastination, you may just end up with a very\nnice option parser.\n\n## USAGE\n\n```javascript\n// my-program.js\nvar nopt = require(\"nopt\")\n , Stream = require(\"stream\").Stream\n , path = require(\"path\")\n , knownOpts = { \"foo\" : [String, null]\n , \"bar\" : [Stream, Number]\n , \"baz\" : path\n , \"bloo\" : [ \"big\", \"medium\", \"small\" ]\n , \"flag\" : Boolean\n , \"pick\" : Boolean\n , \"many1\" : [String, Array]\n , \"many2\" : [path, Array]\n }\n , shortHands = { \"foofoo\" : [\"--foo\", \"Mr. Foo\"]\n , \"b7\" : [\"--bar\", \"7\"]\n , \"m\" : [\"--bloo\", \"medium\"]\n , \"p\" : [\"--pick\"]\n , \"f\" : [\"--flag\"]\n }\n // everything is optional.\n // knownOpts and shorthands default to {}\n // arg list defaults to process.argv\n // slice defaults to 2\n , parsed = nopt(knownOpts, shortHands, process.argv, 2)\nconsole.log(parsed)\n```\n\nThis would give you support for any of the following:\n\n```console\n$ node my-program.js --foo \"blerp\" --no-flag\n{ \"foo\" : \"blerp\", \"flag\" : false }\n\n$ node my-program.js ---bar 7 --foo \"Mr. Hand\" --flag\n{ bar: 7, foo: \"Mr. Hand\", flag: true }\n\n$ node my-program.js --foo \"blerp\" -f -----p\n{ foo: \"blerp\", flag: true, pick: true }\n\n$ node my-program.js -fp --foofoo\n{ foo: \"Mr. Foo\", flag: true, pick: true }\n\n$ node my-program.js --foofoo -- -fp # -- stops the flag parsing.\n{ foo: \"Mr. Foo\", argv: { remain: [\"-fp\"] } }\n\n$ node my-program.js --blatzk -fp # unknown opts are ok.\n{ blatzk: true, flag: true, pick: true }\n\n$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value\n{ blatzk: 1000, flag: true, pick: true }\n\n$ node my-program.js --no-blatzk -fp # unless they start with \"no-\"\n{ blatzk: false, flag: true, pick: true }\n\n$ node my-program.js --baz b/a/z # known paths are resolved.\n{ baz: \"/Users/isaacs/b/a/z\" }\n\n# if Array is one of the types, then it can take many\n# values, and will always be an array. The other types provided\n# specify what types are allowed in the list.\n\n$ node my-program.js --many1 5 --many1 null --many1 foo\n{ many1: [\"5\", \"null\", \"foo\"] }\n\n$ node my-program.js --many2 foo --many2 bar\n{ many2: [\"/path/to/foo\", \"path/to/bar\"] }\n```\n\nRead the tests at the bottom of `lib/nopt.js` for more examples of\nwhat this puppy can do.\n\n## Types\n\nThe following types are supported, and defined on `nopt.typeDefs`\n\n* String: A normal string. No parsing is done.\n* path: A file system path. Gets resolved against cwd if not absolute.\n* url: A url. If it doesn't parse, it isn't accepted.\n* Number: Must be numeric.\n* Date: Must parse as a date. If it does, and `Date` is one of the options,\n then it will return a Date object, not a string.\n* Boolean: Must be either `true` or `false`. If an option is a boolean,\n then it does not need a value, and its presence will imply `true` as\n the value. To negate boolean flags, do `--no-whatever` or `--whatever\n false`\n* NaN: Means that the option is strictly not allowed. Any value will\n fail.\n* Stream: An object matching the \"Stream\" class in node. Valuable\n for use when validating programmatically. (npm uses this to let you\n supply any WriteStream on the `outfd` and `logfd` config options.)\n* Array: If `Array` is specified as one of the types, then the value\n will be parsed as a list of options. This means that multiple values\n can be specified, and that the value will always be an array.\n\nIf a type is an array of values not on this list, then those are\nconsidered valid values. For instance, in the example above, the\n`--bloo` option can only be one of `\"big\"`, `\"medium\"`, or `\"small\"`,\nand any other value will be rejected.\n\nWhen parsing unknown fields, `\"true\"`, `\"false\"`, and `\"null\"` will be\ninterpreted as their JavaScript equivalents.\n\nYou can also mix types and values, or multiple types, in a list. For\ninstance `{ blah: [Number, null] }` would allow a value to be set to\neither a Number or null. When types are ordered, this implies a\npreference, and the first type that can be used to properly interpret\nthe value will be used.\n\nTo define a new type, add it to `nopt.typeDefs`. Each item in that\nhash is an object with a `type` member and a `validate` method. The\n`type` member is an object that matches what goes in the type list. The\n`validate` method is a function that gets called with `validate(data,\nkey, val)`. Validate methods should assign `data[key]` to the valid\nvalue of `val` if it can be handled properly, or return boolean\n`false` if it cannot.\n\nYou can also call `nopt.clean(data, types, typeDefs)` to clean up a\nconfig object and remove its invalid properties.\n\n## Error Handling\n\nBy default, nopt outputs a warning to standard error when invalid values for\nknown options are found. You can change this behavior by assigning a method\nto `nopt.invalidHandler`. This method will be called with\nthe offending `nopt.invalidHandler(key, val, types)`.\n\nIf no `nopt.invalidHandler` is assigned, then it will console.error\nits whining. If it is assigned to boolean `false` then the warning is\nsuppressed.\n\n## Abbreviations\n\nYes, they are supported. If you define options like this:\n\n```javascript\n{ \"foolhardyelephants\" : Boolean\n, \"pileofmonkeys\" : Boolean }\n```\n\nThen this will work:\n\n```bash\nnode program.js --foolhar --pil\nnode program.js --no-f --pileofmon\n# etc.\n```\n\n## Shorthands\n\nShorthands are a hash of shorter option names to a snippet of args that\nthey expand to.\n\nIf multiple one-character shorthands are all combined, and the\ncombination does not unambiguously match any other option or shorthand,\nthen they will be broken up into their constituent parts. For example:\n\n```json\n{ \"s\" : [\"--loglevel\", \"silent\"]\n, \"g\" : \"--global\"\n, \"f\" : \"--force\"\n, \"p\" : \"--parseable\"\n, \"l\" : \"--long\"\n}\n```\n\n```bash\nnpm ls -sgflp\n# just like doing this:\nnpm ls --loglevel silent --global --force --long --parseable\n```\n\n## The Rest of the args\n\nThe config object returned by nopt is given a special member called\n`argv`, which is an object with the following fields:\n\n* `remain`: The remaining args after all the parsing has occurred.\n* `original`: The args as they originally appeared.\n* `cooked`: The args after flags and shorthands are expanded.\n\n## Slicing\n\nNode programs are called with more or less the exact argv as it appears\nin C land, after the v8 and node-specific options have been plucked off.\nAs such, `argv[0]` is always `node` and `argv[1]` is always the\nJavaScript program being run.\n\nThat's usually not very useful to you. So they're sliced off by\ndefault. If you want them, then you can pass in `0` as the last\nargument, or any other number that you'd like to slice off the start of\nthe list.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/nopt.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "4.0.1" +} diff --git a/legacy-libs/grpc/node_modules/nopt/test/basic.js b/legacy-libs/grpc/node_modules/nopt/test/basic.js new file mode 100644 index 0000000..5c18ac0 --- /dev/null +++ b/legacy-libs/grpc/node_modules/nopt/test/basic.js @@ -0,0 +1,303 @@ +var nopt = require("../") + , test = require('tap').test + , isWin = process.platform === 'win32' + +test("passing a string results in a string", function (t) { + var parsed = nopt({ key: String }, {}, ["--key", "myvalue"], 0) + t.same(parsed.key, "myvalue") + t.end() +}) + +// https://github.com/npm/nopt/issues/31 +test("Empty String results in empty string, not true", function (t) { + var parsed = nopt({ empty: String }, {}, ["--empty"], 0) + t.same(parsed.empty, "") + t.end() +}) + +// https://github.com/npm/nopt/issues/65 +test("Empty String should not swallow next flag", function (t) { + var parsed = nopt({ empty: String, foo: String }, {}, ["--empty", "--foo"], 0) + t.same(parsed.empty, "") + t.same(parsed.foo, "") + t.end() +}) + +// https://github.com/npm/nopt/issues/66 +test("Empty String should not be true when type is single item Array", function (t) { + var parsed = nopt({ 'foo': [String] }, {}, ["--foo"], 0) + t.same(parsed.foo, "") + t.end() +}) + +test("~ path is resolved to " + (isWin ? '%USERPROFILE%' : '$HOME'), function (t) { + var path = require("path") + , the + + if (isWin) { + the = { + key: 'USERPROFILE', + dir: 'C:\\temp', + val: '~\\val' + } + } else { + the = { + key: 'HOME', + dir: '/tmp', + val: '~/val' + } + } + if (!process.env[the.key]) process.env[the.key] = v.dir + var parsed = nopt({key: path}, {}, ["--key=" + the.val], 0) + t.same(parsed.key, path.resolve(process.env[the.key], "val")) + t.end() +}) + +// https://github.com/npm/nopt/issues/24 +test("Unknown options are not parsed as numbers", function (t) { + var parsed = nopt({"parse-me": Number}, null, ['--leave-as-is=1.20', '--parse-me=1.20'], 0) + t.equal(parsed['leave-as-is'], '1.20') + t.equal(parsed['parse-me'], 1.2) + t.end() +}); + +// https://github.com/npm/nopt/issues/48 +test("Check types based on name of type", function (t) { + var parsed = nopt({"parse-me": {name: "Number"}}, null, ['--parse-me=1.20'], 0) + t.equal(parsed['parse-me'], 1.2) + t.end() +}) + + +test("Missing types are not parsed", function (t) { + var parsed = nopt({"parse-me": {}}, null, ['--parse-me=1.20'], 0) + //should only contain argv + t.equal(Object.keys(parsed).length, 1) + t.end() +}) + +test("Types passed without a name are not parsed", function (t) { + var parsed = nopt({"parse-me": {}}, {}, ['--parse-me=1.20'], 0) + //should only contain argv + t.equal(Object.keys(parsed).length, 1) + t.end() +}) + +test("other tests", function (t) { + + var util = require("util") + , Stream = require("stream") + , path = require("path") + , url = require("url") + + , shorthands = + { s : ["--loglevel", "silent"] + , d : ["--loglevel", "info"] + , dd : ["--loglevel", "verbose"] + , ddd : ["--loglevel", "silly"] + , noreg : ["--no-registry"] + , reg : ["--registry"] + , "no-reg" : ["--no-registry"] + , silent : ["--loglevel", "silent"] + , verbose : ["--loglevel", "verbose"] + , h : ["--usage"] + , H : ["--usage"] + , "?" : ["--usage"] + , help : ["--usage"] + , v : ["--version"] + , f : ["--force"] + , desc : ["--description"] + , "no-desc" : ["--no-description"] + , "local" : ["--no-global"] + , l : ["--long"] + , p : ["--parseable"] + , porcelain : ["--parseable"] + , g : ["--global"] + } + + , types = + { aoa: Array + , nullstream: [null, Stream] + , date: Date + , str: String + , browser : String + , cache : path + , color : ["always", Boolean] + , depth : Number + , description : Boolean + , dev : Boolean + , editor : path + , force : Boolean + , global : Boolean + , globalconfig : path + , group : [String, Number] + , gzipbin : String + , logfd : [Number, Stream] + , loglevel : ["silent","win","error","warn","info","verbose","silly"] + , long : Boolean + , "node-version" : [false, String] + , npaturl : url + , npat : Boolean + , "onload-script" : [false, String] + , outfd : [Number, Stream] + , parseable : Boolean + , pre: Boolean + , prefix: path + , proxy : url + , "rebuild-bundle" : Boolean + , registry : url + , searchopts : String + , searchexclude: [null, String] + , shell : path + , t: [Array, String] + , tag : String + , tar : String + , tmp : path + , "unsafe-perm" : Boolean + , usage : Boolean + , user : String + , username : String + , userconfig : path + , version : Boolean + , viewer: path + , _exit : Boolean + , path: path + } + + ; [["-v", {version:true}, []] + ,["---v", {version:true}, []] + ,["ls -s --no-reg connect -d", + {loglevel:"info",registry:null},["ls","connect"]] + ,["ls ---s foo",{loglevel:"silent"},["ls","foo"]] + ,["ls --registry blargle", {}, ["ls"]] + ,["--no-registry", {registry:null}, []] + ,["--no-color true", {color:false}, []] + ,["--no-color false", {color:true}, []] + ,["--no-color", {color:false}, []] + ,["--color false", {color:false}, []] + ,["--color --logfd 7", {logfd:7,color:true}, []] + ,["--color=true", {color:true}, []] + ,["--logfd=10", {logfd:10}, []] + ,["--tmp=/tmp -tar=gtar", {tmp: isWin ? "C:\\tmp" : "/tmp",tar:"gtar"},[]] + ,["--tmp=tmp -tar=gtar", + {tmp:path.resolve(process.cwd(), "tmp"),tar:"gtar"},[]] + ,["--logfd x", {}, []] + ,["a -true -- -no-false", {true:true},["a","-no-false"]] + ,["a -no-false", {false:false},["a"]] + ,["a -no-no-true", {true:true}, ["a"]] + ,["a -no-no-no-false", {false:false}, ["a"]] + ,["---NO-no-No-no-no-no-nO-no-no"+ + "-No-no-no-no-no-no-no-no-no"+ + "-no-no-no-no-NO-NO-no-no-no-no-no-no"+ + "-no-body-can-do-the-boogaloo-like-I-do" + ,{"body-can-do-the-boogaloo-like-I-do":false}, []] + ,["we are -no-strangers-to-love "+ + "--you-know=the-rules --and=so-do-i "+ + "---im-thinking-of=a-full-commitment "+ + "--no-you-would-get-this-from-any-other-guy "+ + "--no-gonna-give-you-up "+ + "-no-gonna-let-you-down=true "+ + "--no-no-gonna-run-around false "+ + "--desert-you=false "+ + "--make-you-cry false "+ + "--no-tell-a-lie "+ + "--no-no-and-hurt-you false" + ,{"strangers-to-love":false + ,"you-know":"the-rules" + ,"and":"so-do-i" + ,"you-would-get-this-from-any-other-guy":false + ,"gonna-give-you-up":false + ,"gonna-let-you-down":false + ,"gonna-run-around":false + ,"desert-you":false + ,"make-you-cry":false + ,"tell-a-lie":false + ,"and-hurt-you":false + },["we", "are"]] + ,["-t one -t two -t three" + ,{t: ["one", "two", "three"]} + ,[]] + ,["-t one -t null -t three four five null" + ,{t: ["one", "null", "three"]} + ,["four", "five", "null"]] + ,["-t foo" + ,{t:["foo"]} + ,[]] + ,["--no-t" + ,{t:["false"]} + ,[]] + ,["-no-no-t" + ,{t:["true"]} + ,[]] + ,["-aoa one -aoa null -aoa 100" + ,{aoa:["one", null, '100']} + ,[]] + ,["-str 100" + ,{str:"100"} + ,[]] + ,["--color always" + ,{color:"always"} + ,[]] + ,["--no-nullstream" + ,{nullstream:null} + ,[]] + ,["--nullstream false" + ,{nullstream:null} + ,[]] + ,["--notadate=2011-01-25" + ,{notadate: "2011-01-25"} + ,[]] + ,["--date 2011-01-25" + ,{date: new Date("2011-01-25")} + ,[]] + ,["-cl 1" + ,{config: true, length: 1} + ,[] + ,{config: Boolean, length: Number, clear: Boolean} + ,{c: "--config", l: "--length"}] + ,["--acount bla" + ,{"acount":true} + ,["bla"] + ,{account: Boolean, credentials: Boolean, options: String} + ,{a:"--account", c:"--credentials",o:"--options"}] + ,["--clear" + ,{clear:true} + ,[] + ,{clear:Boolean,con:Boolean,len:Boolean,exp:Boolean,add:Boolean,rep:Boolean} + ,{c:"--con",l:"--len",e:"--exp",a:"--add",r:"--rep"}] + ,["--file -" + ,{"file":"-"} + ,[] + ,{file:String} + ,{}] + ,["--file -" + ,{"file":true} + ,["-"] + ,{file:Boolean} + ,{}] + ,["--path" + ,{"path":null} + ,[]] + ,["--path ." + ,{"path":process.cwd()} + ,[]] + ].forEach(function (test) { + var argv = test[0].split(/\s+/) + , opts = test[1] + , rem = test[2] + , actual = nopt(test[3] || types, test[4] || shorthands, argv, 0) + , parsed = actual.argv + delete actual.argv + for (var i in opts) { + var e = JSON.stringify(opts[i]) + , a = JSON.stringify(actual[i] === undefined ? null : actual[i]) + if (e && typeof e === "object") { + t.deepEqual(e, a) + } else { + t.equal(e, a) + } + } + t.deepEqual(rem, parsed.remain) + }) + t.end() +}) diff --git a/legacy-libs/grpc/node_modules/npm-bundled/LICENSE b/legacy-libs/grpc/node_modules/npm-bundled/LICENSE new file mode 100644 index 0000000..20a4762 --- /dev/null +++ b/legacy-libs/grpc/node_modules/npm-bundled/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) npm, Inc. 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/legacy-libs/grpc/node_modules/npm-bundled/README.md b/legacy-libs/grpc/node_modules/npm-bundled/README.md new file mode 100644 index 0000000..fcfb232 --- /dev/null +++ b/legacy-libs/grpc/node_modules/npm-bundled/README.md @@ -0,0 +1,48 @@ +# npm-bundled + +Run this in a node package, and it'll tell you which things in +node_modules are bundledDependencies, or transitive dependencies of +bundled dependencies. + +[![Build Status](https://travis-ci.org/npm/npm-bundled.svg?branch=master)](https://travis-ci.org/npm/npm-bundled) + +## USAGE + +To get the list of deps at the top level that are bundled (or +transitive deps of a bundled dep) run this: + +```js +const bundled = require('npm-bundled') + +// async version +bundled({ path: '/path/to/pkg/defaults/to/cwd'}, (er, list) => { + // er means it had an error, which is _hella_ weird + // list is a list of package names, like `fooblz` or `@corp/blerg` + // the might not all be deps of the top level, because transitives +}) + +// async promise version +bundled({ path: '/path/to/pkg/defaults/to/cwd'}).then(list => { + // so promisey! + // actually the callback version returns a promise, too, it just + // attaches the supplied callback to the promise +}) + +// sync version, throws if there's an error +const list = bundled({ path: '/path/to/pkg/defaults/to/cwd'}) +``` + +That's basically all you need to know. If you care to dig into it, +you can also use the `bundled.Walker` and `bundled.WalkerSync` +classes to get fancy. + +This library does not write anything to the filesystem, but it _may_ +have undefined behavior if the structure of `node_modules` changes +while it's reading deps. + +All symlinks are followed. This means that it can lead to surprising +results if a symlinked bundled dependency has a missing dependency +that is satisfied at the top level. Since package creation resolves +symlinks as well, this is an edge case where package creation and +development environment are not going to be aligned, and is best +avoided. diff --git a/legacy-libs/grpc/node_modules/npm-bundled/index.js b/legacy-libs/grpc/node_modules/npm-bundled/index.js new file mode 100644 index 0000000..bde0acd --- /dev/null +++ b/legacy-libs/grpc/node_modules/npm-bundled/index.js @@ -0,0 +1,241 @@ +'use strict' + +// walk the tree of deps starting from the top level list of bundled deps +// Any deps at the top level that are depended on by a bundled dep that +// does not have that dep in its own node_modules folder are considered +// bundled deps as well. This list of names can be passed to npm-packlist +// as the "bundled" argument. Additionally, packageJsonCache is shared so +// packlist doesn't have to re-read files already consumed in this pass + +const fs = require('fs') +const path = require('path') +const EE = require('events').EventEmitter + +class BundleWalker extends EE { + constructor (opt) { + opt = opt || {} + super(opt) + this.path = path.resolve(opt.path || process.cwd()) + + this.parent = opt.parent || null + if (this.parent) { + this.result = this.parent.result + // only collect results in node_modules folders at the top level + // since the node_modules in a bundled dep is included always + if (!this.parent.parent) { + const base = path.basename(this.path) + const scope = path.basename(path.dirname(this.path)) + this.result.add(/^@/.test(scope) ? scope + '/' + base : base) + } + this.root = this.parent.root + this.packageJsonCache = this.parent.packageJsonCache + } else { + this.result = new Set() + this.root = this.path + this.packageJsonCache = opt.packageJsonCache || new Map() + } + + this.seen = new Set() + this.didDone = false + this.children = 0 + this.node_modules = [] + this.package = null + this.bundle = null + } + + addListener (ev, fn) { + return this.on(ev, fn) + } + + on (ev, fn) { + const ret = super.on(ev, fn) + if (ev === 'done' && this.didDone) { + this.emit('done', this.result) + } + return ret + } + + done () { + if (!this.didDone) { + this.didDone = true + if (!this.parent) { + const res = Array.from(this.result) + this.result = res + this.emit('done', res) + } else { + this.emit('done') + } + } + } + + start () { + const pj = path.resolve(this.path, 'package.json') + if (this.packageJsonCache.has(pj)) + this.onPackage(this.packageJsonCache.get(pj)) + else + this.readPackageJson(pj) + return this + } + + readPackageJson (pj) { + fs.readFile(pj, (er, data) => + er ? this.done() : this.onPackageJson(pj, data)) + } + + onPackageJson (pj, data) { + try { + this.package = JSON.parse(data + '') + } catch (er) { + return this.done() + } + this.packageJsonCache.set(pj, this.package) + this.onPackage(this.package) + } + + onPackage (pkg) { + // all deps are bundled if we got here as a child. + // otherwise, only bundle bundledDeps + // Get a unique-ified array with a short-lived Set + const bdRaw = this.parent + ? Object.keys(pkg.dependencies || {}).concat( + Object.keys(pkg.optionalDependencies || {})) + : pkg.bundleDependencies || pkg.bundledDependencies || [] + + const bd = Array.from(new Set( + Array.isArray(bdRaw) ? bdRaw : Object.keys(bdRaw))) + + if (!bd.length) + return this.done() + + this.bundle = bd + const nm = this.path + '/node_modules' + this.readModules() + } + + readModules () { + readdirNodeModules(this.path + '/node_modules', (er, nm) => + er ? this.onReaddir([]) : this.onReaddir(nm)) + } + + onReaddir (nm) { + // keep track of what we have, in case children need it + this.node_modules = nm + + this.bundle.forEach(dep => this.childDep(dep)) + if (this.children === 0) + this.done() + } + + childDep (dep) { + if (this.node_modules.indexOf(dep) !== -1 && !this.seen.has(dep)) { + this.seen.add(dep) + this.child(dep) + } else if (this.parent) { + this.parent.childDep(dep) + } + } + + child (dep) { + const p = this.path + '/node_modules/' + dep + this.children += 1 + const child = new BundleWalker({ + path: p, + parent: this + }) + child.on('done', _ => { + if (--this.children === 0) + this.done() + }) + child.start() + } +} + +class BundleWalkerSync extends BundleWalker { + constructor (opt) { + super(opt) + } + + start () { + super.start() + this.done() + return this + } + + readPackageJson (pj) { + try { + this.onPackageJson(pj, fs.readFileSync(pj)) + } catch (er) {} + return this + } + + readModules () { + try { + this.onReaddir(readdirNodeModulesSync(this.path + '/node_modules')) + } catch (er) { + this.onReaddir([]) + } + } + + child (dep) { + new BundleWalkerSync({ + path: this.path + '/node_modules/' + dep, + parent: this + }).start() + } +} + +const readdirNodeModules = (nm, cb) => { + fs.readdir(nm, (er, set) => { + if (er) + cb(er) + else { + const scopes = set.filter(f => /^@/.test(f)) + if (!scopes.length) + cb(null, set) + else { + const unscoped = set.filter(f => !/^@/.test(f)) + let count = scopes.length + scopes.forEach(scope => { + fs.readdir(nm + '/' + scope, (er, pkgs) => { + if (er || !pkgs.length) + unscoped.push(scope) + else + unscoped.push.apply(unscoped, pkgs.map(p => scope + '/' + p)) + if (--count === 0) + cb(null, unscoped) + }) + }) + } + } + }) +} + +const readdirNodeModulesSync = nm => { + const set = fs.readdirSync(nm) + const unscoped = set.filter(f => !/^@/.test(f)) + const scopes = set.filter(f => /^@/.test(f)).map(scope => { + try { + const pkgs = fs.readdirSync(nm + '/' + scope) + return pkgs.length ? pkgs.map(p => scope + '/' + p) : [scope] + } catch (er) { + return [scope] + } + }).reduce((a, b) => a.concat(b), []) + return unscoped.concat(scopes) +} + +const walk = (options, callback) => { + const p = new Promise((resolve, reject) => { + new BundleWalker(options).on('done', resolve).on('error', reject).start() + }) + return callback ? p.then(res => callback(null, res), callback) : p +} + +const walkSync = options => { + return new BundleWalkerSync(options).start().result +} + +module.exports = walk +walk.sync = walkSync +walk.BundleWalker = BundleWalker +walk.BundleWalkerSync = BundleWalkerSync diff --git a/legacy-libs/grpc/node_modules/npm-bundled/package.json b/legacy-libs/grpc/node_modules/npm-bundled/package.json new file mode 100644 index 0000000..89e5388 --- /dev/null +++ b/legacy-libs/grpc/node_modules/npm-bundled/package.json @@ -0,0 +1,65 @@ +{ + "_from": "npm-bundled@^1.0.1", + "_id": "npm-bundled@1.0.6", + "_inBundle": false, + "_integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==", + "_location": "/grpc/npm-bundled", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "npm-bundled@^1.0.1", + "name": "npm-bundled", + "escapedName": "npm-bundled", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/grpc/npm-packlist" + ], + "_resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", + "_shasum": "e7ba9aadcef962bb61248f91721cd932b3fe6bdd", + "_shrinkwrap": null, + "_spec": "npm-bundled@^1.0.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/npm-packlist", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/npm/npm-bundled/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "list things in node_modules that are bundledDependencies, or transitive dependencies thereof", + "devDependencies": { + "mkdirp": "^0.5.1", + "mutate-fs": "^1.1.0", + "rimraf": "^2.6.1", + "tap": "^12.0.1" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/npm/npm-bundled#readme", + "license": "ISC", + "main": "index.js", + "name": "npm-bundled", + "optionalDependencies": {}, + "readme": "# npm-bundled\n\nRun this in a node package, and it'll tell you which things in\nnode_modules are bundledDependencies, or transitive dependencies of\nbundled dependencies.\n\n[![Build Status](https://travis-ci.org/npm/npm-bundled.svg?branch=master)](https://travis-ci.org/npm/npm-bundled)\n\n## USAGE\n\nTo get the list of deps at the top level that are bundled (or\ntransitive deps of a bundled dep) run this:\n\n```js\nconst bundled = require('npm-bundled')\n\n// async version\nbundled({ path: '/path/to/pkg/defaults/to/cwd'}, (er, list) => {\n // er means it had an error, which is _hella_ weird\n // list is a list of package names, like `fooblz` or `@corp/blerg`\n // the might not all be deps of the top level, because transitives\n})\n\n// async promise version\nbundled({ path: '/path/to/pkg/defaults/to/cwd'}).then(list => {\n // so promisey!\n // actually the callback version returns a promise, too, it just\n // attaches the supplied callback to the promise\n})\n\n// sync version, throws if there's an error\nconst list = bundled({ path: '/path/to/pkg/defaults/to/cwd'})\n```\n\nThat's basically all you need to know. If you care to dig into it,\nyou can also use the `bundled.Walker` and `bundled.WalkerSync`\nclasses to get fancy.\n\nThis library does not write anything to the filesystem, but it _may_\nhave undefined behavior if the structure of `node_modules` changes\nwhile it's reading deps.\n\nAll symlinks are followed. This means that it can lead to surprising\nresults if a symlinked bundled dependency has a missing dependency\nthat is satisfied at the top level. Since package creation resolves\nsymlinks as well, this is an edge case where package creation and\ndevelopment environment are not going to be aligned, and is best\navoided.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/npm-bundled.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js -J --100" + }, + "version": "1.0.6" +} diff --git a/legacy-libs/grpc/node_modules/npm-packlist/LICENSE b/legacy-libs/grpc/node_modules/npm-packlist/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/npm-packlist/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/npm-packlist/README.md b/legacy-libs/grpc/node_modules/npm-packlist/README.md new file mode 100644 index 0000000..ead5821 --- /dev/null +++ b/legacy-libs/grpc/node_modules/npm-packlist/README.md @@ -0,0 +1,68 @@ +# npm-packlist + +[![Build Status](https://travis-ci.com/npm/npm-packlist.svg?token=hHeDp9pQmz9kvsgRNVHy&branch=master)](https://travis-ci.com/npm/npm-packlist) + +Get a list of the files to add from a folder into an npm package + +These can be handed to [tar](http://npm.im/tar) like so to make an npm +package tarball: + +```js +const packlist = require('npm-packlist') +const tar = require('tar') +const packageDir = '/path/to/package' +const packageTarball = '/path/to/package.tgz' + +packlist({ path: packageDir }) + .then(files => tar.create({ + prefix: 'package/', + cwd: packageDir, + file: packageTarball, + gzip: true + }, files)) + .then(_ => { + // tarball has been created, continue with your day + }) +``` + +This uses the following rules: + +1. If a `package.json` file is found, and it has a `files` list, + then ignore everything that isn't in `files`. Always include the + readme, license, notice, changes, changelog, and history files, if + they exist, and the package.json file itself. +2. If there's no `package.json` file (or it has no `files` list), and + there is a `.npmignore` file, then ignore all the files in the + `.npmignore` file. +3. If there's no `package.json` with a `files` list, and there's no + `.npmignore` file, but there is a `.gitignore` file, then ignore + all the files in the `.gitignore` file. +4. Everything in the root `node_modules` is ignored, unless it's a + bundled dependency. If it IS a bundled dependency, and it's a + symbolic link, then the target of the link is included, not the + symlink itself. +4. Unless they're explicitly included (by being in a `files` list, or + a `!negated` rule in a relevant `.npmignore` or `.gitignore`), + always ignore certain common cruft files: + + 1. .npmignore and .gitignore files (their effect is in the package + already, there's no need to include them in the package) + 2. editor junk like `.*.swp`, `._*` and `.*.orig` files + 3. `.npmrc` files (these may contain private configs) + 4. The `node_modules/.bin` folder + 5. Waf and gyp cruft like `/build/config.gypi` and `.lock-wscript` + 6. Darwin's `.DS_Store` files because wtf are those even + 7. `npm-debug.log` files at the root of a project + + You can explicitly re-include any of these with a `files` list in + `package.json` or a negated ignore file rule. + +## API + +Same API as [ignore-walk](http://npm.im/ignore-walk), just hard-coded +file list and rule sets. + +The `Walker` and `WalkerSync` classes take a `bundled` argument, which +is a list of package names to include from node_modules. When calling +the top-level `packlist()` and `packlist.sync()` functions, this +module calls into `npm-bundled` directly. diff --git a/legacy-libs/grpc/node_modules/npm-packlist/index.js b/legacy-libs/grpc/node_modules/npm-packlist/index.js new file mode 100644 index 0000000..777b585 --- /dev/null +++ b/legacy-libs/grpc/node_modules/npm-packlist/index.js @@ -0,0 +1,250 @@ +'use strict' + +// Do a two-pass walk, first to get the list of packages that need to be +// bundled, then again to get the actual files and folders. +// Keep a cache of node_modules content and package.json data, so that the +// second walk doesn't have to re-do all the same work. + +const bundleWalk = require('npm-bundled') +const BundleWalker = bundleWalk.BundleWalker +const BundleWalkerSync = bundleWalk.BundleWalkerSync + +const ignoreWalk = require('ignore-walk') +const IgnoreWalker = ignoreWalk.Walker +const IgnoreWalkerSync = ignoreWalk.WalkerSync + +const rootBuiltinRules = Symbol('root-builtin-rules') +const packageNecessaryRules = Symbol('package-necessary-rules') +const path = require('path') + +const defaultRules = [ + '.npmignore', + '.gitignore', + '**/.git', + '**/.svn', + '**/.hg', + '**/CVS', + '**/.git/**', + '**/.svn/**', + '**/.hg/**', + '**/CVS/**', + '/.lock-wscript', + '/.wafpickle-*', + '/build/config.gypi', + 'npm-debug.log', + '**/.npmrc', + '.*.swp', + '**/.DS_Store/**', + '._*', + '**/._*/**', + '*.orig', + '/package-lock.json', + '/yarn.lock', + 'archived-packages/**', + 'core', + '!core/', + '!**/core/', + '*.core', + '*.vgcore', + 'vgcore.*', + 'core.+([0-9])', +] + +// a decorator that applies our custom rules to an ignore walker +const npmWalker = Class => class Walker extends Class { + constructor (opt) { + opt = opt || {} + + // the order in which rules are applied. + opt.ignoreFiles = [ + rootBuiltinRules, + 'package.json', + '.npmignore', + '.gitignore', + packageNecessaryRules + ] + + opt.includeEmpty = false + opt.path = opt.path || process.cwd() + const dirName = path.basename(opt.path) + const parentName = path.basename(path.dirname(opt.path)) + opt.follow = + dirName === 'node_modules' || + (parentName === 'node_modules' && /^@/.test(dirName)) + super(opt) + + // ignore a bunch of things by default at the root level. + // also ignore anything in node_modules, except bundled dependencies + if (!this.parent) { + this.bundled = opt.bundled || [] + this.bundledScopes = Array.from(new Set( + this.bundled.filter(f => /^@/.test(f)) + .map(f => f.split('/')[0]))) + const rules = defaultRules.join('\n') + '\n' + this.packageJsonCache = opt.packageJsonCache || new Map() + super.onReadIgnoreFile(rootBuiltinRules, rules, _=>_) + } else { + this.bundled = [] + this.bundledScopes = [] + this.packageJsonCache = this.parent.packageJsonCache + } + } + + filterEntry (entry, partial) { + // get the partial path from the root of the walk + const p = this.path.substr(this.root.length + 1) + const pkgre = /^node_modules\/(@[^\/]+\/?[^\/]+|[^\/]+)(\/.*)?$/ + const isRoot = !this.parent + const pkg = isRoot && pkgre.test(entry) ? + entry.replace(pkgre, '$1') : null + const rootNM = isRoot && entry === 'node_modules' + const rootPJ = isRoot && entry === 'package.json' + + return ( + // if we're in a bundled package, check with the parent. + /^node_modules($|\/)/i.test(p) ? this.parent.filterEntry( + this.basename + '/' + entry, partial) + + // if package is bundled, all files included + // also include @scope dirs for bundled scoped deps + // they'll be ignored if no files end up in them. + // However, this only matters if we're in the root. + // node_modules folders elsewhere, like lib/node_modules, + // should be included normally unless ignored. + : pkg ? -1 !== this.bundled.indexOf(pkg) || + -1 !== this.bundledScopes.indexOf(pkg) + + // only walk top node_modules if we want to bundle something + : rootNM ? !!this.bundled.length + + // always include package.json at the root. + : rootPJ ? true + + // otherwise, follow ignore-walk's logic + : super.filterEntry(entry, partial) + ) + } + + filterEntries () { + if (this.ignoreRules['package.json']) + this.ignoreRules['.gitignore'] = this.ignoreRules['.npmignore'] = null + else if (this.ignoreRules['.npmignore']) + this.ignoreRules['.gitignore'] = null + this.filterEntries = super.filterEntries + super.filterEntries() + } + + addIgnoreFile (file, then) { + const ig = path.resolve(this.path, file) + if (this.packageJsonCache.has(ig)) + this.onPackageJson(ig, this.packageJsonCache.get(ig), then) + else + super.addIgnoreFile(file, then) + } + + onPackageJson (ig, pkg, then) { + this.packageJsonCache.set(ig, pkg) + + // if there's a bin, browser or main, make sure we don't ignore it + // also, don't ignore the package.json itself! + const rules = [ + pkg.browser ? '!' + pkg.browser : '', + pkg.main ? '!' + pkg.main : '', + '!package.json', + '!@(readme|copying|license|licence|notice|changes|changelog|history){,.*[^~$]}' + ] + if (pkg.bin) + if (typeof pkg.bin === "object") + for (const key in pkg.bin) + rules.push('!' + pkg.bin[key]) + else + rules.push('!' + pkg.bin) + + const data = rules.filter(f => f).join('\n') + '\n' + super.onReadIgnoreFile(packageNecessaryRules, data, _=>_) + + if (Array.isArray(pkg.files)) + super.onReadIgnoreFile('package.json', '*\n' + pkg.files.map( + f => '!' + f + '\n!' + f.replace(/\/+$/, '') + '/**' + ).join('\n') + '\n', then) + else + then() + } + + // override parent onstat function to nix all symlinks + onstat (st, entry, file, dir, then) { + if (st.isSymbolicLink()) + then() + else + super.onstat(st, entry, file, dir, then) + } + + onReadIgnoreFile (file, data, then) { + if (file === 'package.json') + try { + const ig = path.resolve(this.path, file) + this.onPackageJson(ig, JSON.parse(data), then) + } catch (er) { + // ignore package.json files that are not json + then() + } + else + super.onReadIgnoreFile(file, data, then) + } + + sort (a, b) { + return sort(a, b) + } +} + +class Walker extends npmWalker(IgnoreWalker) { + walker (entry, then) { + new Walker(this.walkerOpt(entry)).on('done', then).start() + } +} + +class WalkerSync extends npmWalker(IgnoreWalkerSync) { + walker (entry, then) { + new WalkerSync(this.walkerOpt(entry)).start() + then() + } +} + +const walk = (options, callback) => { + options = options || {} + const p = new Promise((resolve, reject) => { + const bw = new BundleWalker(options) + bw.on('done', bundled => { + options.bundled = bundled + options.packageJsonCache = bw.packageJsonCache + new Walker(options).on('done', resolve).on('error', reject).start() + }) + bw.start() + }) + return callback ? p.then(res => callback(null, res), callback) : p +} + +const walkSync = options => { + options = options || {} + const bw = new BundleWalkerSync(options).start() + options.bundled = bw.result + options.packageJsonCache = bw.packageJsonCache + const walker = new WalkerSync(options) + walker.start() + return walker.result +} + +// package.json first, node_modules last, files before folders, alphasort +const sort = (a, b) => + a === 'package.json' ? -1 + : b === 'package.json' ? 1 + : /^node_modules/.test(a) && !/^node_modules/.test(b) ? 1 + : /^node_modules/.test(b) && !/^node_modules/.test(a) ? -1 + : path.dirname(a) === '.' && path.dirname(b) !== '.' ? -1 + : path.dirname(b) === '.' && path.dirname(a) !== '.' ? 1 + : a.localeCompare(b) + +module.exports = walk +walk.sync = walkSync +walk.Walker = Walker +walk.WalkerSync = WalkerSync diff --git a/legacy-libs/grpc/node_modules/npm-packlist/package.json b/legacy-libs/grpc/node_modules/npm-packlist/package.json new file mode 100644 index 0000000..7304578 --- /dev/null +++ b/legacy-libs/grpc/node_modules/npm-packlist/package.json @@ -0,0 +1,70 @@ +{ + "_from": "npm-packlist@^1.1.6", + "_id": "npm-packlist@1.4.1", + "_inBundle": false, + "_integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==", + "_location": "/grpc/npm-packlist", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "npm-packlist@^1.1.6", + "name": "npm-packlist", + "escapedName": "npm-packlist", + "rawSpec": "^1.1.6", + "saveSpec": null, + "fetchSpec": "^1.1.6" + }, + "_requiredBy": [ + "/grpc/node-pre-gyp" + ], + "_resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.1.tgz", + "_shasum": "19064cdf988da80ea3cee45533879d90192bbfbc", + "_shrinkwrap": null, + "_spec": "npm-packlist@^1.1.6", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/node-pre-gyp", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/npm/npm-packlist/issues" + }, + "bundleDependencies": false, + "dependencies": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + }, + "deprecated": false, + "description": "Get a list of the files to add from a folder into an npm package", + "devDependencies": { + "mkdirp": "^0.5.1", + "rimraf": "^2.6.1", + "tap": "^12.0.1" + }, + "directories": { + "test": "test" + }, + "files": [ + "index.js" + ], + "homepage": "https://www.npmjs.com/package/npm-packlist", + "license": "ISC", + "main": "index.js", + "name": "npm-packlist", + "optionalDependencies": {}, + "readme": "# npm-packlist\n\n[![Build Status](https://travis-ci.com/npm/npm-packlist.svg?token=hHeDp9pQmz9kvsgRNVHy&branch=master)](https://travis-ci.com/npm/npm-packlist)\n\nGet a list of the files to add from a folder into an npm package\n\nThese can be handed to [tar](http://npm.im/tar) like so to make an npm\npackage tarball:\n\n```js\nconst packlist = require('npm-packlist')\nconst tar = require('tar')\nconst packageDir = '/path/to/package'\nconst packageTarball = '/path/to/package.tgz'\n\npacklist({ path: packageDir })\n .then(files => tar.create({\n prefix: 'package/',\n cwd: packageDir,\n file: packageTarball,\n gzip: true\n }, files))\n .then(_ => {\n // tarball has been created, continue with your day\n })\n```\n\nThis uses the following rules:\n\n1. If a `package.json` file is found, and it has a `files` list,\n then ignore everything that isn't in `files`. Always include the\n readme, license, notice, changes, changelog, and history files, if\n they exist, and the package.json file itself.\n2. If there's no `package.json` file (or it has no `files` list), and\n there is a `.npmignore` file, then ignore all the files in the\n `.npmignore` file.\n3. If there's no `package.json` with a `files` list, and there's no\n `.npmignore` file, but there is a `.gitignore` file, then ignore\n all the files in the `.gitignore` file.\n4. Everything in the root `node_modules` is ignored, unless it's a\n bundled dependency. If it IS a bundled dependency, and it's a\n symbolic link, then the target of the link is included, not the\n symlink itself.\n4. Unless they're explicitly included (by being in a `files` list, or\n a `!negated` rule in a relevant `.npmignore` or `.gitignore`),\n always ignore certain common cruft files:\n\n 1. .npmignore and .gitignore files (their effect is in the package\n already, there's no need to include them in the package)\n 2. editor junk like `.*.swp`, `._*` and `.*.orig` files\n 3. `.npmrc` files (these may contain private configs)\n 4. The `node_modules/.bin` folder\n 5. Waf and gyp cruft like `/build/config.gypi` and `.lock-wscript`\n 6. Darwin's `.DS_Store` files because wtf are those even\n 7. `npm-debug.log` files at the root of a project\n\n You can explicitly re-include any of these with a `files` list in\n `package.json` or a negated ignore file rule.\n\n## API\n\nSame API as [ignore-walk](http://npm.im/ignore-walk), just hard-coded\nfile list and rule sets.\n\nThe `Walker` and `WalkerSync` classes take a `bundled` argument, which\nis a list of package names to include from node_modules. When calling\nthe top-level `packlist()` and `packlist.sync()` functions, this\nmodule calls into `npm-bundled` directly.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/npm-packlist.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --100 -J" + }, + "version": "1.4.1" +} diff --git a/legacy-libs/grpc/node_modules/npmlog/CHANGELOG.md b/legacy-libs/grpc/node_modules/npmlog/CHANGELOG.md new file mode 100644 index 0000000..51e4abc --- /dev/null +++ b/legacy-libs/grpc/node_modules/npmlog/CHANGELOG.md @@ -0,0 +1,49 @@ +### v4.0.2 + +* Added installation instructions. + +### v4.0.1 + +* Fix bugs where `log.progressEnabled` got out of sync with how `gauge` kept + track of these things resulting in a progressbar that couldn't be disabled. + +### v4.0.0 + +* Allow creating log levels that are an empty string or 0. + +### v3.1.2 + +* Update to `gauge@1.6.0` adding support for default values for template + items. + +### v3.1.1 + +* Update to `gauge@1.5.3` to fix to `1.x` compatibility when it comes to + when a progress bar is enabled. In `1.x` if you didn't have a TTY the + progress bar was never shown. In `2.x` it merely defaults to disabled, + but you can enable it explicitly if you still want progress updates. + +### v3.1.0 + +* Update to `gauge@2.5.2`: + * Updates the `signal-exit` dependency which fixes an incompatibility with + the node profiler. + * Uses externalizes its ansi code generation in `console-control-strings` +* Make the default progress bar include the last line printed, colored as it + would be when printing to a tty. + +### v3.0.0 + +* Switch to `gauge@2.0.0`, for better performance, better look. +* Set stderr/stdout blocking if they're tty's, so that we can hide a + progress bar going to stderr and then safely print to stdout. Without + this the two can end up overlapping producing confusing and sometimes + corrupted output. + +### v2.0.0 + +* Make the `error` event non-fatal so that folks can use it as a prefix. + +### v1.0.0 + +* Add progress bar with `gauge@1.1.0` diff --git a/legacy-libs/grpc/node_modules/npmlog/LICENSE b/legacy-libs/grpc/node_modules/npmlog/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/npmlog/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/npmlog/README.md b/legacy-libs/grpc/node_modules/npmlog/README.md new file mode 100644 index 0000000..268a4af --- /dev/null +++ b/legacy-libs/grpc/node_modules/npmlog/README.md @@ -0,0 +1,216 @@ +# npmlog + +The logger util that npm uses. + +This logger is very basic. It does the logging for npm. It supports +custom levels and colored output. + +By default, logs are written to stderr. If you want to send log messages +to outputs other than streams, then you can change the `log.stream` +member, or you can just listen to the events that it emits, and do +whatever you want with them. + +# Installation + +```console +npm install npmlog --save +``` + +# Basic Usage + +```javascript +var log = require('npmlog') + +// additional stuff ---------------------------+ +// message ----------+ | +// prefix ----+ | | +// level -+ | | | +// v v v v + log.info('fyi', 'I have a kitty cat: %j', myKittyCat) +``` + +## log.level + +* {String} + +The level to display logs at. Any logs at or above this level will be +displayed. The special level `silent` will prevent anything from being +displayed ever. + +## log.record + +* {Array} + +An array of all the log messages that have been entered. + +## log.maxRecordSize + +* {Number} + +The maximum number of records to keep. If log.record gets bigger than +10% over this value, then it is sliced down to 90% of this value. + +The reason for the 10% window is so that it doesn't have to resize a +large array on every log entry. + +## log.prefixStyle + +* {Object} + +A style object that specifies how prefixes are styled. (See below) + +## log.headingStyle + +* {Object} + +A style object that specifies how the heading is styled. (See below) + +## log.heading + +* {String} Default: "" + +If set, a heading that is printed at the start of every line. + +## log.stream + +* {Stream} Default: `process.stderr` + +The stream where output is written. + +## log.enableColor() + +Force colors to be used on all messages, regardless of the output +stream. + +## log.disableColor() + +Disable colors on all messages. + +## log.enableProgress() + +Enable the display of log activity spinner and progress bar + +## log.disableProgress() + +Disable the display of a progress bar + +## log.enableUnicode() + +Force the unicode theme to be used for the progress bar. + +## log.disableUnicode() + +Disable the use of unicode in the progress bar. + +## log.setGaugeTemplate(template) + +Set a template for outputting the progress bar. See the [gauge documentation] for details. + +[gauge documentation]: https://npmjs.com/package/gauge + +## log.setGaugeThemeset(themes) + +Select a themeset to pick themes from for the progress bar. See the [gauge documentation] for details. + +## log.pause() + +Stop emitting messages to the stream, but do not drop them. + +## log.resume() + +Emit all buffered messages that were written while paused. + +## log.log(level, prefix, message, ...) + +* `level` {String} The level to emit the message at +* `prefix` {String} A string prefix. Set to "" to skip. +* `message...` Arguments to `util.format` + +Emit a log message at the specified level. + +## log\[level](prefix, message, ...) + +For example, + +* log.silly(prefix, message, ...) +* log.verbose(prefix, message, ...) +* log.info(prefix, message, ...) +* log.http(prefix, message, ...) +* log.warn(prefix, message, ...) +* log.error(prefix, message, ...) + +Like `log.log(level, prefix, message, ...)`. In this way, each level is +given a shorthand, so you can do `log.info(prefix, message)`. + +## log.addLevel(level, n, style, disp) + +* `level` {String} Level indicator +* `n` {Number} The numeric level +* `style` {Object} Object with fg, bg, inverse, etc. +* `disp` {String} Optional replacement for `level` in the output. + +Sets up a new level with a shorthand function and so forth. + +Note that if the number is `Infinity`, then setting the level to that +will cause all log messages to be suppressed. If the number is +`-Infinity`, then the only way to show it is to enable all log messages. + +## log.newItem(name, todo, weight) + +* `name` {String} Optional; progress item name. +* `todo` {Number} Optional; total amount of work to be done. Default 0. +* `weight` {Number} Optional; the weight of this item relative to others. Default 1. + +This adds a new `are-we-there-yet` item tracker to the progress tracker. The +object returned has the `log[level]` methods but is otherwise an +`are-we-there-yet` `Tracker` object. + +## log.newStream(name, todo, weight) + +This adds a new `are-we-there-yet` stream tracker to the progress tracker. The +object returned has the `log[level]` methods but is otherwise an +`are-we-there-yet` `TrackerStream` object. + +## log.newGroup(name, weight) + +This adds a new `are-we-there-yet` tracker group to the progress tracker. The +object returned has the `log[level]` methods but is otherwise an +`are-we-there-yet` `TrackerGroup` object. + +# Events + +Events are all emitted with the message object. + +* `log` Emitted for all messages +* `log.` Emitted for all messages with the `` level. +* `` Messages with prefixes also emit their prefix as an event. + +# Style Objects + +Style objects can have the following fields: + +* `fg` {String} Color for the foreground text +* `bg` {String} Color for the background +* `bold`, `inverse`, `underline` {Boolean} Set the associated property +* `bell` {Boolean} Make a noise (This is pretty annoying, probably.) + +# Message Objects + +Every log event is emitted with a message object, and the `log.record` +list contains all of them that have been created. They have the +following fields: + +* `id` {Number} +* `level` {String} +* `prefix` {String} +* `message` {String} Result of `util.format()` +* `messageRaw` {Array} Arguments to `util.format()` + +# Blocking TTYs + +We use [`set-blocking`](https://npmjs.com/package/set-blocking) to set +stderr and stdout blocking if they are tty's and have the setBlocking call. +This is a work around for an issue in early versions of Node.js 6.x, which +made stderr and stdout non-blocking on OSX. (They are always blocking +Windows and were never blocking on Linux.) `npmlog` needs them to be blocking +so that it can allow output to stdout and stderr to be interlaced. diff --git a/legacy-libs/grpc/node_modules/npmlog/log.js b/legacy-libs/grpc/node_modules/npmlog/log.js new file mode 100644 index 0000000..341f331 --- /dev/null +++ b/legacy-libs/grpc/node_modules/npmlog/log.js @@ -0,0 +1,309 @@ +'use strict' +var Progress = require('are-we-there-yet') +var Gauge = require('gauge') +var EE = require('events').EventEmitter +var log = exports = module.exports = new EE() +var util = require('util') + +var setBlocking = require('set-blocking') +var consoleControl = require('console-control-strings') + +setBlocking(true) +var stream = process.stderr +Object.defineProperty(log, 'stream', { + set: function (newStream) { + stream = newStream + if (this.gauge) this.gauge.setWriteTo(stream, stream) + }, + get: function () { + return stream + } +}) + +// by default, decide based on tty-ness. +var colorEnabled +log.useColor = function () { + return colorEnabled != null ? colorEnabled : stream.isTTY +} + +log.enableColor = function () { + colorEnabled = true + this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled}) +} +log.disableColor = function () { + colorEnabled = false + this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled}) +} + +// default level +log.level = 'info' + +log.gauge = new Gauge(stream, { + enabled: false, // no progress bars unless asked + theme: {hasColor: log.useColor()}, + template: [ + {type: 'progressbar', length: 20}, + {type: 'activityIndicator', kerning: 1, length: 1}, + {type: 'section', default: ''}, + ':', + {type: 'logline', kerning: 1, default: ''} + ] +}) + +log.tracker = new Progress.TrackerGroup() + +// we track this separately as we may need to temporarily disable the +// display of the status bar for our own loggy purposes. +log.progressEnabled = log.gauge.isEnabled() + +var unicodeEnabled + +log.enableUnicode = function () { + unicodeEnabled = true + this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled}) +} + +log.disableUnicode = function () { + unicodeEnabled = false + this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled}) +} + +log.setGaugeThemeset = function (themes) { + this.gauge.setThemeset(themes) +} + +log.setGaugeTemplate = function (template) { + this.gauge.setTemplate(template) +} + +log.enableProgress = function () { + if (this.progressEnabled) return + this.progressEnabled = true + this.tracker.on('change', this.showProgress) + if (this._pause) return + this.gauge.enable() +} + +log.disableProgress = function () { + if (!this.progressEnabled) return + this.progressEnabled = false + this.tracker.removeListener('change', this.showProgress) + this.gauge.disable() +} + +var trackerConstructors = ['newGroup', 'newItem', 'newStream'] + +var mixinLog = function (tracker) { + // mixin the public methods from log into the tracker + // (except: conflicts and one's we handle specially) + Object.keys(log).forEach(function (P) { + if (P[0] === '_') return + if (trackerConstructors.filter(function (C) { return C === P }).length) return + if (tracker[P]) return + if (typeof log[P] !== 'function') return + var func = log[P] + tracker[P] = function () { + return func.apply(log, arguments) + } + }) + // if the new tracker is a group, make sure any subtrackers get + // mixed in too + if (tracker instanceof Progress.TrackerGroup) { + trackerConstructors.forEach(function (C) { + var func = tracker[C] + tracker[C] = function () { return mixinLog(func.apply(tracker, arguments)) } + }) + } + return tracker +} + +// Add tracker constructors to the top level log object +trackerConstructors.forEach(function (C) { + log[C] = function () { return mixinLog(this.tracker[C].apply(this.tracker, arguments)) } +}) + +log.clearProgress = function (cb) { + if (!this.progressEnabled) return cb && process.nextTick(cb) + this.gauge.hide(cb) +} + +log.showProgress = function (name, completed) { + if (!this.progressEnabled) return + var values = {} + if (name) values.section = name + var last = log.record[log.record.length - 1] + if (last) { + values.subsection = last.prefix + var disp = log.disp[last.level] || last.level + var logline = this._format(disp, log.style[last.level]) + if (last.prefix) logline += ' ' + this._format(last.prefix, this.prefixStyle) + logline += ' ' + last.message.split(/\r?\n/)[0] + values.logline = logline + } + values.completed = completed || this.tracker.completed() + this.gauge.show(values) +}.bind(log) // bind for use in tracker's on-change listener + +// temporarily stop emitting, but don't drop +log.pause = function () { + this._paused = true + if (this.progressEnabled) this.gauge.disable() +} + +log.resume = function () { + if (!this._paused) return + this._paused = false + + var b = this._buffer + this._buffer = [] + b.forEach(function (m) { + this.emitLog(m) + }, this) + if (this.progressEnabled) this.gauge.enable() +} + +log._buffer = [] + +var id = 0 +log.record = [] +log.maxRecordSize = 10000 +log.log = function (lvl, prefix, message) { + var l = this.levels[lvl] + if (l === undefined) { + return this.emit('error', new Error(util.format( + 'Undefined log level: %j', lvl))) + } + + var a = new Array(arguments.length - 2) + var stack = null + for (var i = 2; i < arguments.length; i++) { + var arg = a[i - 2] = arguments[i] + + // resolve stack traces to a plain string. + if (typeof arg === 'object' && arg && + (arg instanceof Error) && arg.stack) { + + Object.defineProperty(arg, 'stack', { + value: stack = arg.stack + '', + enumerable: true, + writable: true + }) + } + } + if (stack) a.unshift(stack + '\n') + message = util.format.apply(util, a) + + var m = { id: id++, + level: lvl, + prefix: String(prefix || ''), + message: message, + messageRaw: a } + + this.emit('log', m) + this.emit('log.' + lvl, m) + if (m.prefix) this.emit(m.prefix, m) + + this.record.push(m) + var mrs = this.maxRecordSize + var n = this.record.length - mrs + if (n > mrs / 10) { + var newSize = Math.floor(mrs * 0.9) + this.record = this.record.slice(-1 * newSize) + } + + this.emitLog(m) +}.bind(log) + +log.emitLog = function (m) { + if (this._paused) { + this._buffer.push(m) + return + } + if (this.progressEnabled) this.gauge.pulse(m.prefix) + var l = this.levels[m.level] + if (l === undefined) return + if (l < this.levels[this.level]) return + if (l > 0 && !isFinite(l)) return + + // If 'disp' is null or undefined, use the lvl as a default + // Allows: '', 0 as valid disp + var disp = log.disp[m.level] != null ? log.disp[m.level] : m.level + this.clearProgress() + m.message.split(/\r?\n/).forEach(function (line) { + if (this.heading) { + this.write(this.heading, this.headingStyle) + this.write(' ') + } + this.write(disp, log.style[m.level]) + var p = m.prefix || '' + if (p) this.write(' ') + this.write(p, this.prefixStyle) + this.write(' ' + line + '\n') + }, this) + this.showProgress() +} + +log._format = function (msg, style) { + if (!stream) return + + var output = '' + if (this.useColor()) { + style = style || {} + var settings = [] + if (style.fg) settings.push(style.fg) + if (style.bg) settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1)) + if (style.bold) settings.push('bold') + if (style.underline) settings.push('underline') + if (style.inverse) settings.push('inverse') + if (settings.length) output += consoleControl.color(settings) + if (style.beep) output += consoleControl.beep() + } + output += msg + if (this.useColor()) { + output += consoleControl.color('reset') + } + return output +} + +log.write = function (msg, style) { + if (!stream) return + + stream.write(this._format(msg, style)) +} + +log.addLevel = function (lvl, n, style, disp) { + // If 'disp' is null or undefined, use the lvl as a default + if (disp == null) disp = lvl + this.levels[lvl] = n + this.style[lvl] = style + if (!this[lvl]) { + this[lvl] = function () { + var a = new Array(arguments.length + 1) + a[0] = lvl + for (var i = 0; i < arguments.length; i++) { + a[i + 1] = arguments[i] + } + return this.log.apply(this, a) + }.bind(this) + } + this.disp[lvl] = disp +} + +log.prefixStyle = { fg: 'magenta' } +log.headingStyle = { fg: 'white', bg: 'black' } + +log.style = {} +log.levels = {} +log.disp = {} +log.addLevel('silly', -Infinity, { inverse: true }, 'sill') +log.addLevel('verbose', 1000, { fg: 'blue', bg: 'black' }, 'verb') +log.addLevel('info', 2000, { fg: 'green' }) +log.addLevel('timing', 2500, { fg: 'green', bg: 'black' }) +log.addLevel('http', 3000, { fg: 'green', bg: 'black' }) +log.addLevel('notice', 3500, { fg: 'blue', bg: 'black' }) +log.addLevel('warn', 4000, { fg: 'black', bg: 'yellow' }, 'WARN') +log.addLevel('error', 5000, { fg: 'red', bg: 'black' }, 'ERR!') +log.addLevel('silent', Infinity) + +// allow 'error' prefix +log.on('error', function () {}) diff --git a/legacy-libs/grpc/node_modules/npmlog/package.json b/legacy-libs/grpc/node_modules/npmlog/package.json new file mode 100644 index 0000000..2cd8149 --- /dev/null +++ b/legacy-libs/grpc/node_modules/npmlog/package.json @@ -0,0 +1,68 @@ +{ + "_args": [ + [ + "npmlog@4.1.2", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "npmlog@4.1.2", + "_id": "npmlog@4.1.2", + "_inBundle": false, + "_integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "_location": "/grpc/npmlog", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "npmlog@4.1.2", + "name": "npmlog", + "escapedName": "npmlog", + "rawSpec": "4.1.2", + "saveSpec": null, + "fetchSpec": "4.1.2" + }, + "_requiredBy": [ + "/grpc/node-pre-gyp" + ], + "_resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "_shrinkwrap": null, + "_spec": "4.1.2", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/npm/npmlog/issues" + }, + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + }, + "description": "logger for npm", + "devDependencies": { + "standard": "~7.1.2", + "tap": "~5.7.3" + }, + "files": [ + "log.js" + ], + "homepage": "https://github.com/npm/npmlog#readme", + "license": "ISC", + "main": "log.js", + "name": "npmlog", + "optionalDependencies": {}, + "readme": "# npmlog\n\nThe logger util that npm uses.\n\nThis logger is very basic. It does the logging for npm. It supports\ncustom levels and colored output.\n\nBy default, logs are written to stderr. If you want to send log messages\nto outputs other than streams, then you can change the `log.stream`\nmember, or you can just listen to the events that it emits, and do\nwhatever you want with them.\n\n# Installation\n\n```console\nnpm install npmlog --save\n```\n\n# Basic Usage\n\n```javascript\nvar log = require('npmlog')\n\n// additional stuff ---------------------------+\n// message ----------+ |\n// prefix ----+ | |\n// level -+ | | |\n// v v v v\n log.info('fyi', 'I have a kitty cat: %j', myKittyCat)\n```\n\n## log.level\n\n* {String}\n\nThe level to display logs at. Any logs at or above this level will be\ndisplayed. The special level `silent` will prevent anything from being\ndisplayed ever.\n\n## log.record\n\n* {Array}\n\nAn array of all the log messages that have been entered.\n\n## log.maxRecordSize\n\n* {Number}\n\nThe maximum number of records to keep. If log.record gets bigger than\n10% over this value, then it is sliced down to 90% of this value.\n\nThe reason for the 10% window is so that it doesn't have to resize a\nlarge array on every log entry.\n\n## log.prefixStyle\n\n* {Object}\n\nA style object that specifies how prefixes are styled. (See below)\n\n## log.headingStyle\n\n* {Object}\n\nA style object that specifies how the heading is styled. (See below)\n\n## log.heading\n\n* {String} Default: \"\"\n\nIf set, a heading that is printed at the start of every line.\n\n## log.stream\n\n* {Stream} Default: `process.stderr`\n\nThe stream where output is written.\n\n## log.enableColor()\n\nForce colors to be used on all messages, regardless of the output\nstream.\n\n## log.disableColor()\n\nDisable colors on all messages.\n\n## log.enableProgress()\n\nEnable the display of log activity spinner and progress bar\n\n## log.disableProgress()\n\nDisable the display of a progress bar\n\n## log.enableUnicode()\n\nForce the unicode theme to be used for the progress bar.\n\n## log.disableUnicode()\n\nDisable the use of unicode in the progress bar.\n\n## log.setGaugeTemplate(template)\n\nSet a template for outputting the progress bar. See the [gauge documentation] for details.\n\n[gauge documentation]: https://npmjs.com/package/gauge\n\n## log.setGaugeThemeset(themes)\n\nSelect a themeset to pick themes from for the progress bar. See the [gauge documentation] for details.\n\n## log.pause()\n\nStop emitting messages to the stream, but do not drop them.\n\n## log.resume()\n\nEmit all buffered messages that were written while paused.\n\n## log.log(level, prefix, message, ...)\n\n* `level` {String} The level to emit the message at\n* `prefix` {String} A string prefix. Set to \"\" to skip.\n* `message...` Arguments to `util.format`\n\nEmit a log message at the specified level.\n\n## log\\[level](prefix, message, ...)\n\nFor example,\n\n* log.silly(prefix, message, ...)\n* log.verbose(prefix, message, ...)\n* log.info(prefix, message, ...)\n* log.http(prefix, message, ...)\n* log.warn(prefix, message, ...)\n* log.error(prefix, message, ...)\n\nLike `log.log(level, prefix, message, ...)`. In this way, each level is\ngiven a shorthand, so you can do `log.info(prefix, message)`.\n\n## log.addLevel(level, n, style, disp)\n\n* `level` {String} Level indicator\n* `n` {Number} The numeric level\n* `style` {Object} Object with fg, bg, inverse, etc.\n* `disp` {String} Optional replacement for `level` in the output.\n\nSets up a new level with a shorthand function and so forth.\n\nNote that if the number is `Infinity`, then setting the level to that\nwill cause all log messages to be suppressed. If the number is\n`-Infinity`, then the only way to show it is to enable all log messages.\n\n## log.newItem(name, todo, weight)\n\n* `name` {String} Optional; progress item name.\n* `todo` {Number} Optional; total amount of work to be done. Default 0.\n* `weight` {Number} Optional; the weight of this item relative to others. Default 1.\n\nThis adds a new `are-we-there-yet` item tracker to the progress tracker. The\nobject returned has the `log[level]` methods but is otherwise an\n`are-we-there-yet` `Tracker` object.\n\n## log.newStream(name, todo, weight)\n\nThis adds a new `are-we-there-yet` stream tracker to the progress tracker. The\nobject returned has the `log[level]` methods but is otherwise an\n`are-we-there-yet` `TrackerStream` object.\n\n## log.newGroup(name, weight)\n\nThis adds a new `are-we-there-yet` tracker group to the progress tracker. The\nobject returned has the `log[level]` methods but is otherwise an\n`are-we-there-yet` `TrackerGroup` object.\n\n# Events\n\nEvents are all emitted with the message object.\n\n* `log` Emitted for all messages\n* `log.` Emitted for all messages with the `` level.\n* `` Messages with prefixes also emit their prefix as an event.\n\n# Style Objects\n\nStyle objects can have the following fields:\n\n* `fg` {String} Color for the foreground text\n* `bg` {String} Color for the background\n* `bold`, `inverse`, `underline` {Boolean} Set the associated property\n* `bell` {Boolean} Make a noise (This is pretty annoying, probably.)\n\n# Message Objects\n\nEvery log event is emitted with a message object, and the `log.record`\nlist contains all of them that have been created. They have the\nfollowing fields:\n\n* `id` {Number}\n* `level` {String}\n* `prefix` {String}\n* `message` {String} Result of `util.format()`\n* `messageRaw` {Array} Arguments to `util.format()`\n\n# Blocking TTYs\n\nWe use [`set-blocking`](https://npmjs.com/package/set-blocking) to set\nstderr and stdout blocking if they are tty's and have the setBlocking call.\nThis is a work around for an issue in early versions of Node.js 6.x, which\nmade stderr and stdout non-blocking on OSX. (They are always blocking\nWindows and were never blocking on Linux.) `npmlog` needs them to be blocking\nso that it can allow output to stdout and stderr to be interlaced.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/npmlog.git" + }, + "scripts": { + "test": "standard && tap test/*.js" + }, + "version": "4.1.2" +} diff --git a/legacy-libs/grpc/node_modules/number-is-nan/index.js b/legacy-libs/grpc/node_modules/number-is-nan/index.js new file mode 100644 index 0000000..79be4b9 --- /dev/null +++ b/legacy-libs/grpc/node_modules/number-is-nan/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = Number.isNaN || function (x) { + return x !== x; +}; diff --git a/legacy-libs/grpc/node_modules/number-is-nan/license b/legacy-libs/grpc/node_modules/number-is-nan/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/legacy-libs/grpc/node_modules/number-is-nan/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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/legacy-libs/grpc/node_modules/number-is-nan/package.json b/legacy-libs/grpc/node_modules/number-is-nan/package.json new file mode 100644 index 0000000..48b5bde --- /dev/null +++ b/legacy-libs/grpc/node_modules/number-is-nan/package.json @@ -0,0 +1,75 @@ +{ + "_args": [ + [ + "number-is-nan@1.0.1", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "number-is-nan@1.0.1", + "_id": "number-is-nan@1.0.1", + "_inBundle": false, + "_integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "_location": "/grpc/number-is-nan", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "number-is-nan@1.0.1", + "name": "number-is-nan", + "escapedName": "number-is-nan", + "rawSpec": "1.0.1", + "saveSpec": null, + "fetchSpec": "1.0.1" + }, + "_requiredBy": [ + "/grpc/is-fullwidth-code-point" + ], + "_resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "_shrinkwrap": null, + "_spec": "1.0.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/number-is-nan/issues" + }, + "dependencies": {}, + "description": "ES2015 Number.isNaN() ponyfill", + "devDependencies": { + "ava": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/number-is-nan#readme", + "keywords": [ + "es2015", + "ecmascript", + "ponyfill", + "polyfill", + "shim", + "number", + "is", + "nan", + "not" + ], + "license": "MIT", + "name": "number-is-nan", + "optionalDependencies": {}, + "readme": "# number-is-nan [![Build Status](https://travis-ci.org/sindresorhus/number-is-nan.svg?branch=master)](https://travis-ci.org/sindresorhus/number-is-nan)\n\n> ES2015 [`Number.isNaN()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) [ponyfill](https://ponyfill.com)\n\n\n## Install\n\n```\n$ npm install --save number-is-nan\n```\n\n\n## Usage\n\n```js\nvar numberIsNan = require('number-is-nan');\n\nnumberIsNan(NaN);\n//=> true\n\nnumberIsNan('unicorn');\n//=> false\n```\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/number-is-nan.git" + }, + "scripts": { + "test": "ava" + }, + "version": "1.0.1" +} diff --git a/legacy-libs/grpc/node_modules/number-is-nan/readme.md b/legacy-libs/grpc/node_modules/number-is-nan/readme.md new file mode 100644 index 0000000..2463508 --- /dev/null +++ b/legacy-libs/grpc/node_modules/number-is-nan/readme.md @@ -0,0 +1,28 @@ +# number-is-nan [![Build Status](https://travis-ci.org/sindresorhus/number-is-nan.svg?branch=master)](https://travis-ci.org/sindresorhus/number-is-nan) + +> ES2015 [`Number.isNaN()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save number-is-nan +``` + + +## Usage + +```js +var numberIsNan = require('number-is-nan'); + +numberIsNan(NaN); +//=> true + +numberIsNan('unicorn'); +//=> false +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/legacy-libs/grpc/node_modules/object-assign/index.js b/legacy-libs/grpc/node_modules/object-assign/index.js new file mode 100644 index 0000000..0930cf8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/object-assign/index.js @@ -0,0 +1,90 @@ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; diff --git a/legacy-libs/grpc/node_modules/object-assign/license b/legacy-libs/grpc/node_modules/object-assign/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/legacy-libs/grpc/node_modules/object-assign/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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/legacy-libs/grpc/node_modules/object-assign/package.json b/legacy-libs/grpc/node_modules/object-assign/package.json new file mode 100644 index 0000000..5475db3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/object-assign/package.json @@ -0,0 +1,82 @@ +{ + "_args": [ + [ + "object-assign@4.1.1", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "object-assign@4.1.1", + "_id": "object-assign@4.1.1", + "_inBundle": false, + "_integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "_location": "/grpc/object-assign", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "object-assign@4.1.1", + "name": "object-assign", + "escapedName": "object-assign", + "rawSpec": "4.1.1", + "saveSpec": null, + "fetchSpec": "4.1.1" + }, + "_requiredBy": [ + "/grpc/gauge" + ], + "_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "_shrinkwrap": null, + "_spec": "4.1.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/object-assign/issues" + }, + "dependencies": {}, + "description": "ES2015 `Object.assign()` ponyfill", + "devDependencies": { + "ava": "^0.16.0", + "lodash": "^4.16.4", + "matcha": "^0.7.0", + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/object-assign#readme", + "keywords": [ + "object", + "assign", + "extend", + "properties", + "es2015", + "ecmascript", + "harmony", + "ponyfill", + "prollyfill", + "polyfill", + "shim", + "browser" + ], + "license": "MIT", + "name": "object-assign", + "optionalDependencies": {}, + "readme": "# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign)\n\n> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com)\n\n\n## Use the built-in\n\nNode.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari),\nsupport `Object.assign()` :tada:. If you target only those environments, then by all\nmeans, use `Object.assign()` instead of this package.\n\n\n## Install\n\n```\n$ npm install --save object-assign\n```\n\n\n## Usage\n\n```js\nconst objectAssign = require('object-assign');\n\nobjectAssign({foo: 0}, {bar: 1});\n//=> {foo: 0, bar: 1}\n\n// multiple sources\nobjectAssign({foo: 0}, {bar: 1}, {baz: 2});\n//=> {foo: 0, bar: 1, baz: 2}\n\n// overwrites equal keys\nobjectAssign({foo: 0}, {foo: 1}, {foo: 2});\n//=> {foo: 2}\n\n// ignores null and undefined sources\nobjectAssign({foo: 0}, null, {bar: 1}, undefined);\n//=> {foo: 0, bar: 1}\n```\n\n\n## API\n\n### objectAssign(target, [source, ...])\n\nAssigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones.\n\n\n## Resources\n\n- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)\n\n\n## Related\n\n- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()`\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/object-assign.git" + }, + "scripts": { + "bench": "matcha bench.js", + "test": "xo && ava" + }, + "version": "4.1.1" +} diff --git a/legacy-libs/grpc/node_modules/object-assign/readme.md b/legacy-libs/grpc/node_modules/object-assign/readme.md new file mode 100644 index 0000000..1be09d3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/object-assign/readme.md @@ -0,0 +1,61 @@ +# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) + +> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) + + +## Use the built-in + +Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), +support `Object.assign()` :tada:. If you target only those environments, then by all +means, use `Object.assign()` instead of this package. + + +## Install + +``` +$ npm install --save object-assign +``` + + +## Usage + +```js +const objectAssign = require('object-assign'); + +objectAssign({foo: 0}, {bar: 1}); +//=> {foo: 0, bar: 1} + +// multiple sources +objectAssign({foo: 0}, {bar: 1}, {baz: 2}); +//=> {foo: 0, bar: 1, baz: 2} + +// overwrites equal keys +objectAssign({foo: 0}, {foo: 1}, {foo: 2}); +//=> {foo: 2} + +// ignores null and undefined sources +objectAssign({foo: 0}, null, {bar: 1}, undefined); +//=> {foo: 0, bar: 1} +``` + + +## API + +### objectAssign(target, [source, ...]) + +Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. + + +## Resources + +- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) + + +## Related + +- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/legacy-libs/grpc/node_modules/once/LICENSE b/legacy-libs/grpc/node_modules/once/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/once/README.md b/legacy-libs/grpc/node_modules/once/README.md new file mode 100644 index 0000000..1f1ffca --- /dev/null +++ b/legacy-libs/grpc/node_modules/once/README.md @@ -0,0 +1,79 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` + +## `once.strict(func)` + +Throw an error if the function is called twice. + +Some functions are expected to be called only once. Using `once` for them would +potentially hide logical errors. + +In the example below, the `greet` function has to call the callback only once: + +```javascript +function greet (name, cb) { + // return is missing from the if statement + // when no name is passed, the callback is called twice + if (!name) cb('Hello anonymous') + cb('Hello ' + name) +} + +function log (msg) { + console.log(msg) +} + +// this will print 'Hello anonymous' but the logical error will be missed +greet(null, once(msg)) + +// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time +greet(null, once.strict(msg)) +``` diff --git a/legacy-libs/grpc/node_modules/once/once.js b/legacy-libs/grpc/node_modules/once/once.js new file mode 100644 index 0000000..2354067 --- /dev/null +++ b/legacy-libs/grpc/node_modules/once/once.js @@ -0,0 +1,42 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} diff --git a/legacy-libs/grpc/node_modules/once/package.json b/legacy-libs/grpc/node_modules/once/package.json new file mode 100644 index 0000000..2788f96 --- /dev/null +++ b/legacy-libs/grpc/node_modules/once/package.json @@ -0,0 +1,74 @@ +{ + "_args": [ + [ + "once@1.4.0", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "once@1.4.0", + "_id": "once@1.4.0", + "_inBundle": false, + "_integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "_location": "/grpc/once", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "once@1.4.0", + "name": "once", + "escapedName": "once", + "rawSpec": "1.4.0", + "saveSpec": null, + "fetchSpec": "1.4.0" + }, + "_requiredBy": [ + "/grpc/inflight", + "/grpc/rimraf/glob" + ], + "_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "_shrinkwrap": null, + "_spec": "1.4.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/once/issues" + }, + "dependencies": { + "wrappy": "1" + }, + "description": "Run a function exactly one time", + "devDependencies": { + "tap": "^7.0.1" + }, + "directories": { + "test": "test" + }, + "files": [ + "once.js" + ], + "homepage": "https://github.com/isaacs/once#readme", + "keywords": [ + "once", + "function", + "one", + "single" + ], + "license": "ISC", + "main": "once.js", + "name": "once", + "optionalDependencies": {}, + "readme": "# once\n\nOnly call a function once.\n\n## usage\n\n```javascript\nvar once = require('once')\n\nfunction load (file, cb) {\n cb = once(cb)\n loader.load('file')\n loader.once('load', cb)\n loader.once('error', cb)\n}\n```\n\nOr add to the Function.prototype in a responsible way:\n\n```javascript\n// only has to be done once\nrequire('once').proto()\n\nfunction load (file, cb) {\n cb = cb.once()\n loader.load('file')\n loader.once('load', cb)\n loader.once('error', cb)\n}\n```\n\nIronically, the prototype feature makes this module twice as\ncomplicated as necessary.\n\nTo check whether you function has been called, use `fn.called`. Once the\nfunction is called for the first time the return value of the original\nfunction is saved in `fn.value` and subsequent calls will continue to\nreturn this value.\n\n```javascript\nvar once = require('once')\n\nfunction load (cb) {\n cb = once(cb)\n var stream = createStream()\n stream.once('data', cb)\n stream.once('end', function () {\n if (!cb.called) cb(new Error('not found'))\n })\n}\n```\n\n## `once.strict(func)`\n\nThrow an error if the function is called twice.\n\nSome functions are expected to be called only once. Using `once` for them would\npotentially hide logical errors.\n\nIn the example below, the `greet` function has to call the callback only once:\n\n```javascript\nfunction greet (name, cb) {\n // return is missing from the if statement\n // when no name is passed, the callback is called twice\n if (!name) cb('Hello anonymous')\n cb('Hello ' + name)\n}\n\nfunction log (msg) {\n console.log(msg)\n}\n\n// this will print 'Hello anonymous' but the logical error will be missed\ngreet(null, once(msg))\n\n// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time\ngreet(null, once.strict(msg))\n```\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "1.4.0" +} diff --git a/legacy-libs/grpc/node_modules/os-homedir/index.js b/legacy-libs/grpc/node_modules/os-homedir/index.js new file mode 100644 index 0000000..3306616 --- /dev/null +++ b/legacy-libs/grpc/node_modules/os-homedir/index.js @@ -0,0 +1,24 @@ +'use strict'; +var os = require('os'); + +function homedir() { + var env = process.env; + var home = env.HOME; + var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME; + + if (process.platform === 'win32') { + return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null; + } + + if (process.platform === 'darwin') { + return home || (user ? '/Users/' + user : null); + } + + if (process.platform === 'linux') { + return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); + } + + return home || null; +} + +module.exports = typeof os.homedir === 'function' ? os.homedir : homedir; diff --git a/legacy-libs/grpc/node_modules/os-homedir/license b/legacy-libs/grpc/node_modules/os-homedir/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/legacy-libs/grpc/node_modules/os-homedir/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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/legacy-libs/grpc/node_modules/os-homedir/package.json b/legacy-libs/grpc/node_modules/os-homedir/package.json new file mode 100644 index 0000000..b9fdeec --- /dev/null +++ b/legacy-libs/grpc/node_modules/os-homedir/package.json @@ -0,0 +1,81 @@ +{ + "_args": [ + [ + "os-homedir@1.0.2", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "os-homedir@1.0.2", + "_id": "os-homedir@1.0.2", + "_inBundle": false, + "_integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "_location": "/grpc/os-homedir", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "os-homedir@1.0.2", + "name": "os-homedir", + "escapedName": "os-homedir", + "rawSpec": "1.0.2", + "saveSpec": null, + "fetchSpec": "1.0.2" + }, + "_requiredBy": [ + "/grpc/osenv" + ], + "_resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "_shrinkwrap": null, + "_spec": "1.0.2", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/os-homedir/issues" + }, + "dependencies": {}, + "description": "Node.js 4 `os.homedir()` ponyfill", + "devDependencies": { + "ava": "*", + "path-exists": "^2.0.0", + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/os-homedir#readme", + "keywords": [ + "builtin", + "core", + "ponyfill", + "polyfill", + "shim", + "os", + "homedir", + "home", + "dir", + "directory", + "folder", + "user", + "path" + ], + "license": "MIT", + "name": "os-homedir", + "optionalDependencies": {}, + "readme": "# os-homedir [![Build Status](https://travis-ci.org/sindresorhus/os-homedir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-homedir)\n\n> Node.js 4 [`os.homedir()`](https://nodejs.org/api/os.html#os_os_homedir) [ponyfill](https://ponyfill.com)\n\n\n## Install\n\n```\n$ npm install --save os-homedir\n```\n\n\n## Usage\n\n```js\nconst osHomedir = require('os-homedir');\n\nconsole.log(osHomedir());\n//=> '/Users/sindresorhus'\n```\n\n\n## Related\n\n- [user-home](https://github.com/sindresorhus/user-home) - Same as this module but caches the result\n- [home-or-tmp](https://github.com/sindresorhus/home-or-tmp) - Get the user home directory with fallback to the system temp directory\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/os-homedir.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.2" +} diff --git a/legacy-libs/grpc/node_modules/os-homedir/readme.md b/legacy-libs/grpc/node_modules/os-homedir/readme.md new file mode 100644 index 0000000..856ae61 --- /dev/null +++ b/legacy-libs/grpc/node_modules/os-homedir/readme.md @@ -0,0 +1,31 @@ +# os-homedir [![Build Status](https://travis-ci.org/sindresorhus/os-homedir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-homedir) + +> Node.js 4 [`os.homedir()`](https://nodejs.org/api/os.html#os_os_homedir) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save os-homedir +``` + + +## Usage + +```js +const osHomedir = require('os-homedir'); + +console.log(osHomedir()); +//=> '/Users/sindresorhus' +``` + + +## Related + +- [user-home](https://github.com/sindresorhus/user-home) - Same as this module but caches the result +- [home-or-tmp](https://github.com/sindresorhus/home-or-tmp) - Get the user home directory with fallback to the system temp directory + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/legacy-libs/grpc/node_modules/os-tmpdir/index.js b/legacy-libs/grpc/node_modules/os-tmpdir/index.js new file mode 100644 index 0000000..2077b1c --- /dev/null +++ b/legacy-libs/grpc/node_modules/os-tmpdir/index.js @@ -0,0 +1,25 @@ +'use strict'; +var isWindows = process.platform === 'win32'; +var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/; + +// https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43 +module.exports = function () { + var path; + + if (isWindows) { + path = process.env.TEMP || + process.env.TMP || + (process.env.SystemRoot || process.env.windir) + '\\temp'; + } else { + path = process.env.TMPDIR || + process.env.TMP || + process.env.TEMP || + '/tmp'; + } + + if (trailingSlashRe.test(path)) { + path = path.slice(0, -1); + } + + return path; +}; diff --git a/legacy-libs/grpc/node_modules/os-tmpdir/license b/legacy-libs/grpc/node_modules/os-tmpdir/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/legacy-libs/grpc/node_modules/os-tmpdir/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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/legacy-libs/grpc/node_modules/os-tmpdir/package.json b/legacy-libs/grpc/node_modules/os-tmpdir/package.json new file mode 100644 index 0000000..f7dea91 --- /dev/null +++ b/legacy-libs/grpc/node_modules/os-tmpdir/package.json @@ -0,0 +1,81 @@ +{ + "_args": [ + [ + "os-tmpdir@1.0.2", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "os-tmpdir@1.0.2", + "_id": "os-tmpdir@1.0.2", + "_inBundle": false, + "_integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "_location": "/grpc/os-tmpdir", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "os-tmpdir@1.0.2", + "name": "os-tmpdir", + "escapedName": "os-tmpdir", + "rawSpec": "1.0.2", + "saveSpec": null, + "fetchSpec": "1.0.2" + }, + "_requiredBy": [ + "/grpc/osenv" + ], + "_resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "_shrinkwrap": null, + "_spec": "1.0.2", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/os-tmpdir/issues" + }, + "dependencies": {}, + "description": "Node.js os.tmpdir() ponyfill", + "devDependencies": { + "ava": "*", + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/os-tmpdir#readme", + "keywords": [ + "built-in", + "core", + "ponyfill", + "polyfill", + "shim", + "os", + "tmpdir", + "tempdir", + "tmp", + "temp", + "dir", + "directory", + "env", + "environment" + ], + "license": "MIT", + "name": "os-tmpdir", + "optionalDependencies": {}, + "readme": "# os-tmpdir [![Build Status](https://travis-ci.org/sindresorhus/os-tmpdir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-tmpdir)\n\n> Node.js [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) [ponyfill](https://ponyfill.com)\n\nUse this instead of `require('os').tmpdir()` to get a consistent behavior on different Node.js versions (even 0.8).\n\n\n## Install\n\n```\n$ npm install --save os-tmpdir\n```\n\n\n## Usage\n\n```js\nconst osTmpdir = require('os-tmpdir');\n\nosTmpdir();\n//=> '/var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T'\n```\n\n\n## API\n\nSee the [`os.tmpdir()` docs](https://nodejs.org/api/os.html#os_os_tmpdir).\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/os-tmpdir.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.2" +} diff --git a/legacy-libs/grpc/node_modules/os-tmpdir/readme.md b/legacy-libs/grpc/node_modules/os-tmpdir/readme.md new file mode 100644 index 0000000..c09f7ed --- /dev/null +++ b/legacy-libs/grpc/node_modules/os-tmpdir/readme.md @@ -0,0 +1,32 @@ +# os-tmpdir [![Build Status](https://travis-ci.org/sindresorhus/os-tmpdir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-tmpdir) + +> Node.js [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) [ponyfill](https://ponyfill.com) + +Use this instead of `require('os').tmpdir()` to get a consistent behavior on different Node.js versions (even 0.8). + + +## Install + +``` +$ npm install --save os-tmpdir +``` + + +## Usage + +```js +const osTmpdir = require('os-tmpdir'); + +osTmpdir(); +//=> '/var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T' +``` + + +## API + +See the [`os.tmpdir()` docs](https://nodejs.org/api/os.html#os_os_tmpdir). + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/legacy-libs/grpc/node_modules/osenv/LICENSE b/legacy-libs/grpc/node_modules/osenv/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/osenv/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/osenv/README.md b/legacy-libs/grpc/node_modules/osenv/README.md new file mode 100644 index 0000000..08fd900 --- /dev/null +++ b/legacy-libs/grpc/node_modules/osenv/README.md @@ -0,0 +1,63 @@ +# osenv + +Look up environment settings specific to different operating systems. + +## Usage + +```javascript +var osenv = require('osenv') +var path = osenv.path() +var user = osenv.user() +// etc. + +// Some things are not reliably in the env, and have a fallback command: +var h = osenv.hostname(function (er, hostname) { + h = hostname +}) +// This will still cause it to be memoized, so calling osenv.hostname() +// is now an immediate operation. + +// You can always send a cb, which will get called in the nextTick +// if it's been memoized, or wait for the fallback data if it wasn't +// found in the environment. +osenv.hostname(function (er, hostname) { + if (er) console.error('error looking up hostname') + else console.log('this machine calls itself %s', hostname) +}) +``` + +## osenv.hostname() + +The machine name. Calls `hostname` if not found. + +## osenv.user() + +The currently logged-in user. Calls `whoami` if not found. + +## osenv.prompt() + +Either PS1 on unix, or PROMPT on Windows. + +## osenv.tmpdir() + +The place where temporary files should be created. + +## osenv.home() + +No place like it. + +## osenv.path() + +An array of the places that the operating system will search for +executables. + +## osenv.editor() + +Return the executable name of the editor program. This uses the EDITOR +and VISUAL environment variables, and falls back to `vi` on Unix, or +`notepad.exe` on Windows. + +## osenv.shell() + +The SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash' +or 'cmd'. diff --git a/legacy-libs/grpc/node_modules/osenv/osenv.js b/legacy-libs/grpc/node_modules/osenv/osenv.js new file mode 100644 index 0000000..702a95b --- /dev/null +++ b/legacy-libs/grpc/node_modules/osenv/osenv.js @@ -0,0 +1,72 @@ +var isWindows = process.platform === 'win32' +var path = require('path') +var exec = require('child_process').exec +var osTmpdir = require('os-tmpdir') +var osHomedir = require('os-homedir') + +// looking up envs is a bit costly. +// Also, sometimes we want to have a fallback +// Pass in a callback to wait for the fallback on failures +// After the first lookup, always returns the same thing. +function memo (key, lookup, fallback) { + var fell = false + var falling = false + exports[key] = function (cb) { + var val = lookup() + if (!val && !fell && !falling && fallback) { + fell = true + falling = true + exec(fallback, function (er, output, stderr) { + falling = false + if (er) return // oh well, we tried + val = output.trim() + }) + } + exports[key] = function (cb) { + if (cb) process.nextTick(cb.bind(null, null, val)) + return val + } + if (cb && !falling) process.nextTick(cb.bind(null, null, val)) + return val + } +} + +memo('user', function () { + return ( isWindows + ? process.env.USERDOMAIN + '\\' + process.env.USERNAME + : process.env.USER + ) +}, 'whoami') + +memo('prompt', function () { + return isWindows ? process.env.PROMPT : process.env.PS1 +}) + +memo('hostname', function () { + return isWindows ? process.env.COMPUTERNAME : process.env.HOSTNAME +}, 'hostname') + +memo('tmpdir', function () { + return osTmpdir() +}) + +memo('home', function () { + return osHomedir() +}) + +memo('path', function () { + return (process.env.PATH || + process.env.Path || + process.env.path).split(isWindows ? ';' : ':') +}) + +memo('editor', function () { + return process.env.EDITOR || + process.env.VISUAL || + (isWindows ? 'notepad.exe' : 'vi') +}) + +memo('shell', function () { + return isWindows ? process.env.ComSpec || 'cmd' + : process.env.SHELL || 'bash' +}) diff --git a/legacy-libs/grpc/node_modules/osenv/package.json b/legacy-libs/grpc/node_modules/osenv/package.json new file mode 100644 index 0000000..abd077a --- /dev/null +++ b/legacy-libs/grpc/node_modules/osenv/package.json @@ -0,0 +1,80 @@ +{ + "_args": [ + [ + "osenv@0.1.5", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "osenv@0.1.5", + "_id": "osenv@0.1.5", + "_inBundle": false, + "_integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "_location": "/grpc/osenv", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "osenv@0.1.5", + "name": "osenv", + "escapedName": "osenv", + "rawSpec": "0.1.5", + "saveSpec": null, + "fetchSpec": "0.1.5" + }, + "_requiredBy": [ + "/grpc/nopt" + ], + "_resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "_shrinkwrap": null, + "_spec": "0.1.5", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/npm/osenv/issues" + }, + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + }, + "description": "Look up environment settings specific to different operating systems", + "devDependencies": { + "tap": "^11.1.0" + }, + "directories": { + "test": "test" + }, + "files": [ + "osenv.js" + ], + "homepage": "https://github.com/npm/osenv#readme", + "keywords": [ + "environment", + "variable", + "home", + "tmpdir", + "path", + "prompt", + "ps1" + ], + "license": "ISC", + "main": "osenv.js", + "name": "osenv", + "optionalDependencies": {}, + "readme": "# osenv\n\nLook up environment settings specific to different operating systems.\n\n## Usage\n\n```javascript\nvar osenv = require('osenv')\nvar path = osenv.path()\nvar user = osenv.user()\n// etc.\n\n// Some things are not reliably in the env, and have a fallback command:\nvar h = osenv.hostname(function (er, hostname) {\n h = hostname\n})\n// This will still cause it to be memoized, so calling osenv.hostname()\n// is now an immediate operation.\n\n// You can always send a cb, which will get called in the nextTick\n// if it's been memoized, or wait for the fallback data if it wasn't\n// found in the environment.\nosenv.hostname(function (er, hostname) {\n if (er) console.error('error looking up hostname')\n else console.log('this machine calls itself %s', hostname)\n})\n```\n\n## osenv.hostname()\n\nThe machine name. Calls `hostname` if not found.\n\n## osenv.user()\n\nThe currently logged-in user. Calls `whoami` if not found.\n\n## osenv.prompt()\n\nEither PS1 on unix, or PROMPT on Windows.\n\n## osenv.tmpdir()\n\nThe place where temporary files should be created.\n\n## osenv.home()\n\nNo place like it.\n\n## osenv.path()\n\nAn array of the places that the operating system will search for\nexecutables.\n\n## osenv.editor() \n\nReturn the executable name of the editor program. This uses the EDITOR\nand VISUAL environment variables, and falls back to `vi` on Unix, or\n`notepad.exe` on Windows.\n\n## osenv.shell()\n\nThe SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash'\nor 'cmd'.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/osenv.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js" + }, + "version": "0.1.5" +} diff --git a/legacy-libs/grpc/node_modules/path-is-absolute/index.js b/legacy-libs/grpc/node_modules/path-is-absolute/index.js new file mode 100644 index 0000000..22aa6c3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/path-is-absolute/index.js @@ -0,0 +1,20 @@ +'use strict'; + +function posix(path) { + return path.charAt(0) === '/'; +} + +function win32(path) { + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = Boolean(device && device.charAt(1) !== ':'); + + // UNC paths are always absolute + return Boolean(result[2] || isUnc); +} + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/legacy-libs/grpc/node_modules/path-is-absolute/license b/legacy-libs/grpc/node_modules/path-is-absolute/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/legacy-libs/grpc/node_modules/path-is-absolute/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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/legacy-libs/grpc/node_modules/path-is-absolute/package.json b/legacy-libs/grpc/node_modules/path-is-absolute/package.json new file mode 100644 index 0000000..0e28975 --- /dev/null +++ b/legacy-libs/grpc/node_modules/path-is-absolute/package.json @@ -0,0 +1,83 @@ +{ + "_args": [ + [ + "path-is-absolute@1.0.1", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "path-is-absolute@1.0.1", + "_id": "path-is-absolute@1.0.1", + "_inBundle": false, + "_integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "_location": "/grpc/path-is-absolute", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "path-is-absolute@1.0.1", + "name": "path-is-absolute", + "escapedName": "path-is-absolute", + "rawSpec": "1.0.1", + "saveSpec": null, + "fetchSpec": "1.0.1" + }, + "_requiredBy": [ + "/grpc/rimraf/glob" + ], + "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "_shrinkwrap": null, + "_spec": "1.0.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/path-is-absolute/issues" + }, + "dependencies": {}, + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "devDependencies": { + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/path-is-absolute#readme", + "keywords": [ + "path", + "paths", + "file", + "dir", + "absolute", + "isabsolute", + "is-absolute", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim", + "is", + "detect", + "check" + ], + "license": "MIT", + "name": "path-is-absolute", + "optionalDependencies": {}, + "readme": "# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute)\n\n> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com)\n\n\n## Install\n\n```\n$ npm install --save path-is-absolute\n```\n\n\n## Usage\n\n```js\nconst pathIsAbsolute = require('path-is-absolute');\n\n// Running on Linux\npathIsAbsolute('/home/foo');\n//=> true\npathIsAbsolute('C:/Users/foo');\n//=> false\n\n// Running on Windows\npathIsAbsolute('C:/Users/foo');\n//=> true\npathIsAbsolute('/home/foo');\n//=> false\n\n// Running on any OS\npathIsAbsolute.posix('/home/foo');\n//=> true\npathIsAbsolute.posix('C:/Users/foo');\n//=> false\npathIsAbsolute.win32('C:/Users/foo');\n//=> true\npathIsAbsolute.win32('/home/foo');\n//=> false\n```\n\n\n## API\n\nSee the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path).\n\n### pathIsAbsolute(path)\n\n### pathIsAbsolute.posix(path)\n\nPOSIX specific version.\n\n### pathIsAbsolute.win32(path)\n\nWindows specific version.\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/path-is-absolute.git" + }, + "scripts": { + "test": "xo && node test.js" + }, + "version": "1.0.1" +} diff --git a/legacy-libs/grpc/node_modules/path-is-absolute/readme.md b/legacy-libs/grpc/node_modules/path-is-absolute/readme.md new file mode 100644 index 0000000..8dbdf5f --- /dev/null +++ b/legacy-libs/grpc/node_modules/path-is-absolute/readme.md @@ -0,0 +1,59 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +const pathIsAbsolute = require('path-is-absolute'); + +// Running on Linux +pathIsAbsolute('/home/foo'); +//=> true +pathIsAbsolute('C:/Users/foo'); +//=> false + +// Running on Windows +pathIsAbsolute('C:/Users/foo'); +//=> true +pathIsAbsolute('/home/foo'); +//=> false + +// Running on any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +pathIsAbsolute.posix('C:/Users/foo'); +//=> false +pathIsAbsolute.win32('C:/Users/foo'); +//=> true +pathIsAbsolute.win32('/home/foo'); +//=> false +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +POSIX specific version. + +### pathIsAbsolute.win32(path) + +Windows specific version. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/legacy-libs/grpc/node_modules/process-nextick-args/index.js b/legacy-libs/grpc/node_modules/process-nextick-args/index.js new file mode 100644 index 0000000..3eecf11 --- /dev/null +++ b/legacy-libs/grpc/node_modules/process-nextick-args/index.js @@ -0,0 +1,45 @@ +'use strict'; + +if (typeof process === 'undefined' || + !process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = { nextTick: nextTick }; +} else { + module.exports = process +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + diff --git a/legacy-libs/grpc/node_modules/process-nextick-args/license.md b/legacy-libs/grpc/node_modules/process-nextick-args/license.md new file mode 100644 index 0000000..c67e353 --- /dev/null +++ b/legacy-libs/grpc/node_modules/process-nextick-args/license.md @@ -0,0 +1,19 @@ +# Copyright (c) 2015 Calvin Metcalf + +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/legacy-libs/grpc/node_modules/process-nextick-args/package.json b/legacy-libs/grpc/node_modules/process-nextick-args/package.json new file mode 100644 index 0000000..d1bf0b2 --- /dev/null +++ b/legacy-libs/grpc/node_modules/process-nextick-args/package.json @@ -0,0 +1,55 @@ +{ + "_from": "process-nextick-args@~2.0.0", + "_id": "process-nextick-args@2.0.1", + "_inBundle": false, + "_integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "_location": "/grpc/process-nextick-args", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "process-nextick-args@~2.0.0", + "name": "process-nextick-args", + "escapedName": "process-nextick-args", + "rawSpec": "~2.0.0", + "saveSpec": null, + "fetchSpec": "~2.0.0" + }, + "_requiredBy": [ + "/grpc/readable-stream" + ], + "_resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "_shasum": "7820d9b16120cc55ca9ae7792680ae7dba6d7fe2", + "_shrinkwrap": null, + "_spec": "process-nextick-args@~2.0.0", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/readable-stream", + "author": "", + "bugs": { + "url": "https://github.com/calvinmetcalf/process-nextick-args/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "process.nextTick but always with args", + "devDependencies": { + "tap": "~0.2.6" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/calvinmetcalf/process-nextick-args", + "license": "MIT", + "main": "index.js", + "name": "process-nextick-args", + "optionalDependencies": {}, + "readme": "process-nextick-args\n=====\n\n[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args)\n\n```bash\nnpm install --save process-nextick-args\n```\n\nAlways be able to pass arguments to process.nextTick, no matter the platform\n\n```js\nvar pna = require('process-nextick-args');\n\npna.nextTick(function (a, b, c) {\n console.log(a, b, c);\n}, 'step', 3, 'profit');\n```\n", + "readmeFilename": "readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/calvinmetcalf/process-nextick-args.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "2.0.1" +} diff --git a/legacy-libs/grpc/node_modules/process-nextick-args/readme.md b/legacy-libs/grpc/node_modules/process-nextick-args/readme.md new file mode 100644 index 0000000..ecb432c --- /dev/null +++ b/legacy-libs/grpc/node_modules/process-nextick-args/readme.md @@ -0,0 +1,18 @@ +process-nextick-args +===== + +[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args) + +```bash +npm install --save process-nextick-args +``` + +Always be able to pass arguments to process.nextTick, no matter the platform + +```js +var pna = require('process-nextick-args'); + +pna.nextTick(function (a, b, c) { + console.log(a, b, c); +}, 'step', 3, 'profit'); +``` diff --git a/legacy-libs/grpc/node_modules/protobufjs/LICENSE b/legacy-libs/grpc/node_modules/protobufjs/LICENSE new file mode 100644 index 0000000..75b5248 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/LICENSE @@ -0,0 +1,202 @@ + + 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/legacy-libs/grpc/node_modules/protobufjs/README.md b/legacy-libs/grpc/node_modules/protobufjs/README.md new file mode 100644 index 0000000..1cf6661 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/README.md @@ -0,0 +1,184 @@ +protobuf.js 5 [![Build Status](https://travis-ci.org/dcodeIO/protobuf.js.svg?branch=ProtoBuf5)](https://travis-ci.org/dcodeIO/protobuf.js) [![Donate](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=dcode%40dcode.io&item_name=%3C3%20protobuf.js) +===================================== +**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/docs/overview)). + +**protobuf.js** is a pure JavaScript implementation on top of [bytebuffer.js](https://github.com/dcodeIO/bytebuffer.js) +including a .proto parser, message class building and simple encoding and decoding. There is no compilation step +required, it's super easy to use and it works out of the box on .proto files! + +Getting started +--------------- +* **Step 1:** Become familar with [Google's Protocol Buffers (protobuf)](https://developers.google.com/protocol-buffers/docs/overview) +* **Step 2:** Read on or head straight to [our wiki](https://github.com/dcodeIO/protobuf.js/wiki) for additional information +* **Step 3:** Build something cool! :-) + +Features +-------- +* [RequireJS](http://requirejs.org/)/AMD compatible +* [node.js](http://nodejs.org)/CommonJS compatible, also available via [npm](https://npmjs.org/package/protobufjs) +* Browser compatible +* [Closure Compiler](https://developers.google.com/closure/compiler/) compatible (fully annotated, [externs](https://github.com/dcodeIO/protobuf.js/tree/master/externs)) +* Fully documented using [jsdoc3](https://github.com/jsdoc3/jsdoc) +* Well tested through [test.js](https://github.com/dcodeIO/test.js) +* [bytebuffer.js](https://github.com/dcodeIO/bytebuffer.js) is the only production dependency +* Fully compatible to the official implementation including advanced features +* proto2js command line utility + +Installation +------------ + +### node.js / CommonJS + +``` +$> npm install protobufjs +``` + +```js +var ProtoBuf = require("protobufjs"); +... +``` + +### RequireJS / AMD + +Requires [bytebuffer.js](http://github.com/dcodeIO/bytebuffer.js). Optionally depends on [long.js](https://github.com/dcodeIO/long.js) for long (int64) support. If you do not require long support, you can skip the Long.js config. RequireJS example: + +```js +require(["protobuf"], function(ProtoBuf) { + ... +}); +``` + +Or as a module dependency: + +```js +define("MyModule", ["protobuf"], function(ProtoBuf) { + ... +}); +``` + +### Browser + +Requires [bytebuffer.js](http://github.com/dcodeIO/bytebuffer.js). Optionally depends on [long.js](https://github.com/dcodeIO/long.js) for long (int64) support. If you do not require long support, you can skip the Long.js include. + +```html + + + + +``` + +```js +var ProtoBuf = dcodeIO.ProtoBuf; +... +``` + +Getting started +--------------- + +*Note:* You'll need the full build to load .proto data. light builds are able to load JSON only. + +### Loading .proto files + +To load a .proto file, use: + +**API:** `ProtoBuf.loadProtoFile(source[, callback[, builder]]):Builder|undefined` + +```js +// Synchronously +var builder = ProtoBuf.loadProtoFile("path/to/file.proto"); + +// Asynchronously +ProtoBuf.loadProtoFile("path/to/file.proto", function(err, builder) { + ... +}); +``` + +`ProtoBuf.loadProtoFile` also accepts an object specifying the import root directory and the file to load as its first parameter: `{root: string, file: string}`. Additionally, an already created and then reused builder can be specified as the last argument, which is useful if all the definitions shall reside in a single namespace. + +### Loading .proto strings + +**API:** `ProtoBuf.loadProto(source[, builder][, filename]):Builder` + +```js +var builder = ProtoBuf.loadProto(...protoString..., "myproto.proto"); +``` + +### Loading JSON files and strings + +To load the (raw) JSON counterpart generated through pbjs, use `ProtoBuf.loadJsonFile` respectively `ProtoBuf.loadJson`. It's the same API. + +If you generated classes or modules with it, loading is done just by including respectively requiring the resulting file. Loading is handled transparently in this case. + +When using JSON only, you can use protobuf-light.js or protobuf-light.min.js instead, which do NOT include the ProtoBuf.DotProto package for parsing and are therefore smaller. + +Command line +------------ +Since ProtoBuf.js 4.0.0 the library ships with the `pbjs` command line utility. With it it's possible to convert between .proto and JSON descriptors and even to generate the code required to access runtime structures as pure JS (classes), an AMD module or a CommonJS module. + +``` + + _ |_ . _ +|_)|_)|_) ProtoBuf.js v4.0.0-b3 https://github.com/dcodeIO/ProtoBuf.js +| ' + +CLI utility to convert between .proto and JSON syntax / to generate classes. + +Usage: pbjs [options] [> outFile] + +Options: + --help, -h Show help [boolean] + --version, -v Show version number [boolean] + --source, -s Specifies the source format. Valid formats are: + + json Plain JSON descriptor + proto Plain .proto descriptor + + --target, -t Specifies the target format. Valid formats are: + + amd Runtime structures as AMD module + commonjs Runtime structures as CommonJS module + js Runtime structures + json Plain JSON descriptor + proto Plain .proto descriptor + + --using, -u Specifies an option to apply to the volatile builder + loading the source, e.g. convertFieldsToCamelCase. + --min, -m Minifies the output. [default: false] + --path, -p Adds a directory to the include path. + --legacy, -l Includes legacy descriptors from google/protobuf/ if + explicitly referenced. [default: false] + --quiet, -q Suppresses any informatory output to stderr. [default: false] + --use, -i Specifies an option to apply to the emitted builder + utilized by your program, e.g. populateAccessors. + --exports, -e Specifies the namespace to export. Defaults to export + the root namespace. + --dependency, -d Library dependency to use when generating classes. + Defaults to 'protobufjs' for CommonJS, 'ProtoBuf' for + AMD modules and 'dcodeIO.ProtoBuf' for classes. +``` + +Documentation +------------- +* [Read the official protobuf guide](https://developers.google.com/protocol-buffers/docs/overview) +* [Read the API docs](http://htmlpreview.github.io/?https://raw.githubusercontent.com/dcodeIO/protobuf.js/ProtoBuf5/docs/ProtoBuf.html) +* [Check out the examples](https://github.com/dcodeIO/protobuf.js/tree/ProtoBuf5/examples) + +Tests +----- +* [View source](https://github.com/dcodeIO/protobuf.js/blob/ProtoBuf5/tests/suite.js) + +Downloads +--------- +* [Distributions](https://github.com/dcodeIO/protobuf.js/tree/ProtoBuf5/dist) +* [ZIP-Archive](https://github.com/dcodeIO/protobuf.js/archive/ProtoBuf5.zip) +* [Tarball](https://github.com/dcodeIO/protobuf.js/tarball/ProtoBuf5) + +CDN usage +--------- +```html + +``` +With the version pointing to the exact [release](https://github.com/dcodeIO/protobuf.js/releases) your project depends upon. + +**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) diff --git a/legacy-libs/grpc/node_modules/protobufjs/bin/pbjs b/legacy-libs/grpc/node_modules/protobufjs/bin/pbjs new file mode 100644 index 0000000..73ebc4a --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/bin/pbjs @@ -0,0 +1,2 @@ +#!/usr/bin/env node +process.exit(require(__dirname+"/../cli/pbjs.js").main(process.argv)); diff --git a/legacy-libs/grpc/node_modules/protobufjs/bower.json b/legacy-libs/grpc/node_modules/protobufjs/bower.json new file mode 100644 index 0000000..30f074c --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/bower.json @@ -0,0 +1,19 @@ +{ + "name": "protobuf", + "description": "Protocol Buffers for JavaScript. Finally.", + "version": "5.0.3", + "main": "dist/protobuf.js", + "license": "Apache-2.0", + "homepage": "http://dcode.io/", + "dependencies": { + "bytebuffer": "~5" + }, + "keywords": ["net", "buffer", "protobuf", "serialization", "bytebuffer", "websocket", "webrtc"], + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs.js b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs.js new file mode 100644 index 0000000..e90798b --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs.js @@ -0,0 +1,281 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 ProtoBuf = require(__dirname+"/../index.js"), + fs = require("fs"), + path = require("path"), + cli = require("ascli")("pbjs"), + yargs = require("yargs"), + util = require("./pbjs/util.js"), + glob = require("glob"), + pkg = require("../package.json"); + +/** + * pbjs namespace. + * @exports pbjs + * @namespace + */ +var pbjs = module.exports = {}; + +/** + * @alias pbjs/util + */ +pbjs.util = util; + +/** + * Source formats. + * @type {!Object.)>} + */ +pbjs.sources = {}; +fs.readdirSync(__dirname+"/pbjs/sources").forEach(function(source) { + if (/\.js$/.test(source)) { + var src = require(__dirname + "/pbjs/sources/" + source); + if (!src.exclude) + pbjs.sources[source.substring(0, source.lastIndexOf("."))] = src; + } +}); + +/** + * Target formats. + * @type {!Object.)>} + */ +pbjs.targets = {}; +fs.readdirSync(__dirname+"/pbjs/targets").forEach(function(target) { + if (/\.js$/.test(target)) + pbjs.targets[target.substring(0, target.lastIndexOf("."))] = require(__dirname + "/pbjs/targets/" + target); +}); + +/** + * Status code: Operation successful + * @type {number} + */ +pbjs.STATUS_OK = 0; + +/** + * Status code: Displaying usage information + * @type {number} + */ +pbjs.STATUS_USAGE = 1; + +/** + * Status code: No such include directory + * @type {number} + */ +pbjs.STATUS_ERR_INCLUDE_DIR = 2; + +/** + * Status code: No such source format + * @type {number} + */ +pbjs.STATUS_ERR_SOURCE_FORMAT = 3; + +/** + * Status code: No such target format + * @type {number} + */ +pbjs.STATUS_ERR_TARGET_FORMAT = 4; + +/** + * Status code: No such namespace + * @type {number} + */ +pbjs.STATUS_ERR_NAMESPACE = 5; + +/** + * Status code: Illegal dependency + * @type {number} + */ +pbjs.STATUS_ERR_DEPENDENCY = 6; + +/** + * Status code: No matching source files + * @type {number} + */ +pbjs.STATUS_ERR_NOSOURCE = 7; + +// Makes a table of available source or target formats +function mkOptions(obj) { + var str = ''; + Object.keys(obj).forEach(function(key) { + str += "\n "+util.pad(key, 10)+" "+obj[key].description; + }); + return str; +} + +/** + * Executes the program. + * @param {!Array.} argv Command line arguments + * @returns {number} Status code + */ +pbjs.main = function(argv) { + var options = yargs + .usage(cli("pb".white.bold+"js".green.bold, util.pad("ProtoBuf.js v"+pkg['version'], 31, true)+" "+pkg['homepage'].grey) + "\n" + + "CLI utility to convert between .proto and JSON syntax / to generate classes.\n\n" + + "Usage: ".white.bold+path.basename(argv[1]).green.bold+" [options] [> outFile]") + .help("help") + .version(pkg["version"]) + .wrap(null) + .options({ + source: { + alias: "s", + describe: "Specifies the source format. Valid formats are:\n" + mkOptions(pbjs.sources)+"\n" + }, + target: { + alias: "t", + describe: "Specifies the target format. Valid formats are:\n" + mkOptions(pbjs.targets)+"\n" + }, + using: { + alias: "u", + describe: "Specifies an option to apply to the volatile builder\nloading the source, e.g. convertFieldsToCamelCase.", + type: "array" + }, + min: { + alias: "m", + describe: "Minifies the output.", + default: false + }, + path: { + alias: "p", + describe: "Adds a directory to the include path." + }, + legacy: { + alias: "l", + describe: "Includes legacy descriptors from google/protobuf/ if\nexplicitly referenced.", + default: false + }, + quiet: { + alias: "q", + describe: "Suppresses any informatory output to stderr.", + default: false + }, + out: { + alias: "o", + describe: "Send output to file instead of stdout.", + }, + use: { + alias: "i", + describe: "Specifies an option to apply to the emitted builder\nutilized by your program, e.g. populateAccessors.", + type: "array" + }, + exports: { + alias: "e", + describe: "Specifies the namespace to export. Defaults to export\nthe root namespace." + }, + dependency: { + alias: "d", + describe: "Library dependency to use when generating classes.\nDefaults to 'protobufjs' for CommonJS, 'protobuf' for\nAMD modules and 'dcodeIO.ProtoBuf' for classes." + } + }) + .alias("help", "h") + .alias("version", "v") + .check(function (args) { + if (args.source && typeof pbjs.sources[args.source] !== "function") { + return "Unrecognized source format: '" + args.source + "'"; + } + + if (args.target && typeof pbjs.targets[args.target] !== "function") { + return "Unrecognized target format: '" + args.target + "'"; + } + + if (args._.length < 3) { + return "The filename to parse is required."; + } + + return true; + }) + .parse(argv); + + var start = Date.now(), + sourceFiles = options._.slice(2); + + // Expand glob expressions + var sourceFilesExpand = []; + for (var i=0; i + + 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 description = "Binary descriptor set"; + +var ProtoBuf = require(__dirname+"/../../../index.js"), + util = require(__dirname+"/../util.js"), + node_path = require("path"), + fs = require("fs"); + +/** + * pbjs source: Binary descriptor + * @exports pbjs/sources/binary + * @function + * @param {!Array.} filenames Source files + * @param {!Object.=} options Options + * @returns {!ProtoBuf.Builder} + */ +var binary = module.exports = function(filenames, options) { + options = options || []; + var builder = ProtoBuf.newBuilder(util.getBuilderOptions(options, "using")), + loaded = []; + filenames.forEach(function(filename) { + var data = binary.load(filename, options, loaded); + builder["import"](data, filename); + }); + builder.resolveAll(); + return builder; +}; + +/** + * Module description. + * @type {string} + */ +binary.description = description; + +binary.exclude = true; // Unfinished + +/** + * Loads a binary descriptor. + * @param {string} filename Source file + * @param {!Object.} options Options + * @param {!Array.=} loaded An array of already loaded filenames + * @returns {*} JSON descriptor + */ +binary.load = function(filename, options, loaded) { + filename = node_path.resolve(filename); + loaded = loaded || []; + if (loaded.indexOf(filename) >= 0) + return {}; + var data = fs.readFileSync(filename); + loaded.push(filename); + var builder = ProtoBuf.loadProtoFile(node_path.join("..", "..", "..", "src", "google", "protobuf", "descriptor.proto")), + FileDescriptorSet = builder.build("google.protobuf.FileDescriptorSet"); + var fds = FileDescriptorSet.decode(data), + imports = []; + var json = { + "package": null, + "imports": imports + }; + fds.file.forEach(function(fdp) { + imports.push(buildFileDescriptorProto(fdp)); + }); + return json; +}; + +function buildFileDescriptorProto(fdp) { + var pkg = fdp.package, + messages = [], + enums = [], + services = [], + extensions = [], + options = {}, + imports = []; + fdp.message_type.forEach(function(dp) { + messages.push(buildMessageDescriptorProto(dp)); + }); + fdp.enum_type.forEach(function(edp) { + enums.push(buildEnumDescriptorProto(edp)); + }); + fdp.service.forEach(function(sdp) { + enums.push(buildServiceDescriptorProto(sdp)); + }); + fdp.extension.forEach(function(fdp) { + extensions.push(buildFieldDescriptorProtoAsExtension(fdp)); + }); + fdp.options.forEach(function(fo) { + // TODO + }); + fdp.dependency.forEach(function(filename) { + // TODO + }); + return { + "package": pkg, + "messages": messages, + "enums": enums, + "services": services, + "extensions": extensions, + "options": options, + "imports": imports + }; +} + +function buildMessageDescriptorProto(mdp) { + +} + +function buildEnumDescriptorProto(edp) { + +} + +function buildServiceDescriptorProto(sdp) { + +} + +function buildFieldDescriptorProtoAsExtension(fdp) { + +} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/sources/json.js b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/sources/json.js new file mode 100644 index 0000000..86df60f --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/sources/json.js @@ -0,0 +1,84 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 description = "Plain JSON descriptor"; + +var ProtoBuf = require(__dirname+"/../../../index.js"), + util = require(__dirname+"/../util.js"), + node_path = require("path"), + fs = require("fs"); + +/** + * pbjs source: Plain JSON descriptor + * @exports pbjs/sources/json + * @function + * @param {!Array.} filenames Source files + * @param {!Object.=} options Options + * @returns {!ProtoBuf.Builder} + */ +var json = module.exports = function(filenames, options) { + options = options || []; + var builder = ProtoBuf.newBuilder(util.getBuilderOptions(options, "using")), + loaded = []; + filenames.forEach(function(filename) { + var data = json.load(filename, options, loaded); + builder["import"](data, filename); + }); + builder.resolveAll(); + return builder; +}; + +/** + * Module description. + * @type {string} + */ +json.description = description; + +/** + * Loads a JSON descriptor including imports. + * @param {string} filename Source file + * @param {!Object.} options Options + * @param {!Array.=} loaded An array of already loaded filenames + * @returns {*} JSON descriptor + */ +json.load = function(filename, options, loaded) { + filename = node_path.resolve(filename); + loaded = loaded || []; + if (loaded.indexOf(filename) >= 0) + return {}; + var data = JSON.parse(fs.readFileSync(filename).toString("utf8")), + imports = data['imports']; + loaded.push(filename); + if (Array.isArray(imports)) { + for (var i=0; i + + 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 description = "Plain .proto descriptor"; + +var ProtoBuf = require(__dirname+"/../../../index.js"), + util = require(__dirname+"/../util.js"), + fs = require("fs"), + node_path = require("path"); + +/** + * pbjs source: Plain .proto descriptor + * @exports pbjs/sources/proto + * @function + * @param {!Array.} filenames Source files + * @param {!Object.=} options Options + * @returns {!ProtoBuf.Builder} + */ +var proto = module.exports = function(filenames, options) { + options = options || []; + var builder = ProtoBuf.newBuilder(util.getBuilderOptions(options, "using")), + loaded = []; + filenames.forEach(function(filename) { + var data = proto.load(filename, options, loaded); + builder["import"](data, filename); + }); + builder.resolveAll(); + return builder; +}; + +/** + * Module description. + * @type {string} + */ +proto.description = description; + +/** + * Loads a .proto descriptor including imports. + * @param {string} filename Source file + * @param {!Object.} options Options + * @param {!Array.=} loaded An array of already loaded filenames + * @returns {*} JSON descriptor + */ +proto.load = function(filename, options, loaded) { + filename = node_path.resolve(filename); + loaded = loaded || []; + if (loaded.indexOf(filename) >= 0) + return {}; + var data = ProtoBuf.DotProto.Parser.parse(fs.readFileSync(filename).toString("utf8")); + loaded.push(filename); + if (Array.isArray(data['imports'])) { + var imports = data['imports']; + for (var i=0; i + + 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 description = "Runtime structures as AMD module"; + +var ProtoBuf = require("../../../index.js"), + util = require("../util.js"), + js = require("./js.js"); + +/** + * pbjs target: Runtime structures as an AMD module + * @exports pbjs/targets/amd + * @function + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +var amd = module.exports = function(builder, options) { + options = options || {}; + return [ + "define([", JSON.stringify(options.dependency || "protobuf"), "]", options.min ? "," : ", ", + "function(ProtoBuf)", options.min ? "{" : " {\n ", + "return ProtoBuf", + util.indent(js.build(builder, options), options.min ? "" : " "), options.min ? "" : "\n", + "});" + ].join(''); +}; + +/** + * Module description. + * @type {string} + */ +amd.description = description; diff --git a/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/commonjs.js b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/commonjs.js new file mode 100644 index 0000000..11d1cfd --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/commonjs.js @@ -0,0 +1,42 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 description = "Runtime structures as CommonJS module"; + +var util = require("../util.js"), + js = require("./js.js"); + +/** + * pbjs target: Runtime structures as a CommonJS module + * @exports pbjs/targets/commonjs + * @function + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +var commonjs = module.exports = function(builder, options) { + options = options || {}; + return [ + "module.exports", options.min ? "=" : " = ", + "require(", JSON.stringify(options.dependency || "protobufjs"), ")", + js.build(builder, options) + ].join(''); +}; + +/** + * Module description. + * @type {string} + */ +commonjs.description = description; diff --git a/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/js.js b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/js.js new file mode 100644 index 0000000..4f9ee12 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/js.js @@ -0,0 +1,63 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 description = "Runtime structures"; + +var util = require("../util.js"), + json = require("./json.js"); + +/** + * pbjs target: Runtime structures + * @exports pbjs/targets/js + * @function + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +var js = module.exports = function(builder, options) { + options = options || {}; + var varName = "_root"; + if (options.exports) + varName = options.exports.substring(options.exports.lastIndexOf(".")+1); + return [ + "var ", varName, options.min ? "=" : " = ", options.dependency || "dcodeIO.ProtoBuf", + js.build(builder, options) + ].join(''); +}; + +/** + * Builds the core js target. + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +js.build = function(builder, options) { + options = options || {}; + return [ + ".newBuilder(", + JSON.stringify(util.getBuilderOptions(options, "use"), null, options.min ? 0 : 4), + ")['import'](", + json(builder, options), + ").build(", + typeof options.exports === 'string' ? JSON.stringify(options.exports.split(".")) : "", + ");" + ].join(''); +}; + +/** + * Module description. + * @type {string} + */ +js.description = description; diff --git a/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/json.js b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/json.js new file mode 100644 index 0000000..39e4c6d --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/json.js @@ -0,0 +1,260 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 description = "Plain JSON descriptor"; + +var ProtoBuf = require(__dirname+"/../../../index.js"), + util = require("../util.js"); + +/** + * pbjs target: Plain JSON descriptor + * @exports pbjs/targets/json + * @function + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +var json = module.exports = function(builder, options) { + options = options || {}; + builder.resolveAll(); + + // Set the pointer to the lowest common namespace (with options) + var ptr = builder.ns; + while (ptr.children.length === 1 && Object.keys(ptr.options).length === 0 && ptr.children[0].className === "Namespace") + ptr = ptr.children[0]; + + // Start by building the package namespace + var pkg = ptr.fqn().substring(1), + out = { + "package": pkg !== "" ? pkg : null + }; + buildNamespace(ptr, out); + return JSON.stringify(out, null, options.min ? 0 : 4); +}; + +/** + * Module description. + * @type {string} + */ +json.description = description; + +/** + * Builds all structures in a namespace. + * @param {!ProtoBuf.Reflect.Namespace} ns Namespace to build + * @param {!Object.} out Extended output object + */ +function buildNamespace(ns, out) { + var messages, enums, services; + util.extend(out, { + "syntax" : ns.syntax || 'proto2', + "options" : out.options || {}, + "messages" : messages = [], + "enums" : enums = [], + "services" : services = [] + }); + if (!(ns instanceof ProtoBuf.Reflect.Message)) + out['isNamespace'] = true; + util.extend(out["options"], buildOptions(ns.options)); + ns.getChildren(ProtoBuf.Reflect.Enum).forEach(function(enm) { + enums.push(buildEnum(enm)); + }); + if (enums.length === 0) + delete out["enums"]; + ns.getChildren(ProtoBuf.Reflect.Message).forEach(function(msg) { + messages.push(buildMessage(msg)); + }); + ns.getChildren(ProtoBuf.Reflect.Service).forEach(function(svc) { + services.push(buildService(svc)); + }); + if (services.length === 0) + delete out["services"]; + Array.prototype.push.apply(messages, buildExtensions(ns)); + ns.getChildren(ProtoBuf.Reflect.Namespace).forEach(function(innerNs) { + if (innerNs.className !== "Namespace") + return; + var emptyMessage = { + "name": innerNs.name, + "fields": [] + }; + buildNamespace(innerNs, emptyMessage); + messages.push(emptyMessage); + }); + if (messages.length === 0) + delete out["messages"]; + if (Object.keys(out["options"]).length === 0) + delete out["options"]; +} + +/** + * Builds extensions declared in the specified namespace. + * @param {!ProtoBuf.Reflect.Namespace} ns Namespace + * @returns {!Array.} + */ +function buildExtensions(ns) { + var exts = util.groupExtensions(ns); + if (exts === null) + return []; + var messages = []; + Object.keys(exts).forEach(function(extFqn) { + var extMsg = ns.resolve(extFqn), + extFields = exts[extFqn]; + var fields, ext = { + "ref" : ns.qn(extMsg), + "fields" : fields = [] + }; + extFields.forEach(function(extField) { + fields.push(buildMessageField(extField)); + }); + messages.push(ext); + }); + return messages; +} + +/** + * Builds block-level options. + * @param {!Object.} options Options + * @returns {!Object.} + */ +function buildOptions(options) { + Object.keys(options = options || {}).forEach(function(key) { + var val = options[key]; + switch (typeof val) { + case 'string': + case 'number': + case 'boolean': + case 'object': + break; + default: + throw Error("Illegal option type: "+typeof(val)); + } + }); + return options; +} + +/** + * Builds a message. + * @param {!ProtoBuf.Reflect.Message} msg Message + * @returns {!*} + */ +function buildMessage(msg) { + var fields, oneofs; + var out = { + "name" : msg.name, + "syntax" : msg.syntax || 'proto2', + "options" : {}, + "fields" : fields = [], + "oneofs" : oneofs = {} + }; + msg.getChildren(ProtoBuf.Reflect.Message.Field).forEach(function(fld) { + if (fld instanceof ProtoBuf.Reflect.Message.ExtensionField) + return; + fields.push(buildMessageField(fld)); + }); + msg.getChildren(ProtoBuf.Reflect.Message.OneOf).forEach(function(oneof) { + oneofs[oneof.name] = buildMessageOneof(oneof); + }); + if (msg.extensions) + out["extensions"] = msg.extensions; + if (Object.keys(oneofs).length === 0) + delete out["oneofs"]; + buildNamespace(msg, out); + return out; +} + +/** + * Builds a message field. + * @param {!ProtoBuf.Reflect.Message.Field} fld Message field + * @returns {!*} + */ +function buildMessageField(fld) { + return { + "rule" : fld.map ? "map" : (fld.repeated ? "repeated" : (fld.required ? "required" : "optional")), + "type" : fld.resolvedType ? fld.parent.qn(fld.resolvedType) : fld.type['name'], + "keytype" : (typeof(fld.keyType) === 'string') ? fld.keyType : (fld.keyType !== null ? fld.keyType.name : undefined), + "name" : fld instanceof ProtoBuf.Reflect.Message.ExtensionField ? fld.name.substring(fld.name.lastIndexOf(".")+1): fld.name, + "id" : fld.id, + "options" : Object.keys(fld.options).length > 0 ? buildOptions(fld.options) : undefined, + "oneof" : fld.oneof ? fld.oneof.name : undefined + }; +} + +/** + * Builds a message oneof. + * @param {!ProtoBuf.Reflect.message.OneOf} oneof Message oneof + * @returns {!Array.} + */ +function buildMessageOneof(oneof) { + var out = []; + oneof.fields.forEach(function(fld) { + out.push(fld.id); + }); + return out; +} + +/** + * Builds an enum. + * @param {!ProtoBuf.Reflect.Enum} enm Enum + * @returns {!*} + */ +function buildEnum(enm) { + var values; + var out = { + "name" : enm.name, + "syntax" : enm.syntax || 'proto2', + "values" : values = [] + }; + enm.getChildren(ProtoBuf.Reflect.Enum.Value).forEach(function(val) { + values.push(buildEnumValue(val)); + }); + if (Object.keys(enm.options).length > 0) + out["options"] = buildOptions(enm.options); + return out; +} + +/** + * Builds an enum value. + * @param {!ProtoBuf.Reflect.Enum.Value} val Enum value + * @returns {!*} + */ +function buildEnumValue(val) { + return { + "name" : val.name, + "id" : val.id + }; +} + +/** + * Builds a service. + * @param {!ProtoBuf.Reflect.Service} svc Service + * @returns {!*} + */ +function buildService(svc) { + var rpc; + var out = { + "name": svc.name, + "options": buildOptions(svc.options), + "rpc": rpc = {} + }; + svc.getChildren(ProtoBuf.Reflect.Service.RPCMethod).forEach(function(mtd) { + rpc[mtd.name] = { + "request": svc.qn(mtd.resolvedRequestType), + "request_stream": mtd.requestStream, + "response": svc.qn(mtd.resolvedResponseType), + "response_stream": mtd.responseStream, + "options": buildOptions(mtd.options) + }; + }); + return out; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/proto.js b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/proto.js new file mode 100644 index 0000000..abfce36 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/targets/proto.js @@ -0,0 +1,267 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 description = "Plain .proto descriptor"; + +var ProtoBuf = require(__dirname+"/../../../index.js"), + util = require("../util.js"); + +/** + * pbjs target: Plain .proto descriptor + * @exports pbjs/targets/proto + * @function + * @param {!ProtoBuf.Builder} builder Builder + * @param {!Object.=} options Options + * @returns {string} + */ +var proto = module.exports = function(builder, options) { + options = options || {}; + builder.resolveAll(); + + // Set the pointer to the lowest common namespace (with options) + var ptr = builder.ns; + while (ptr.children.length === 1 && Object.keys(ptr.options).length === 0 && ptr.children[0].className === "Namespace") + ptr = ptr.children[0]; + + var out = []; + + function trim() { + out[out.length-1] = out[out.length-1].replace(/\n{2,}$/, "\n"); + } + + // Builds a set of top level options + function buildOptions(opt, indent) { + var keys; + if ((keys = Object.keys(opt)).length === 0) + return; + keys.forEach(function(key) { + if (!options.min) + out.push(indent); + out.push("option ", key, options.min ? "=" : " = ", value(opt[key]), options.min ? ";" : ";\n"); + }); + if (!options.min) + out[out.length-1] += "\n"; + } + + // Builds everything within a namespace + function buildNamespace(ns, indent) { + ns.getChildren(ProtoBuf.Reflect.Enum).forEach(function(enm) { + buildEnum(enm, indent); + }); + ns.getChildren(ProtoBuf.Reflect.Message).forEach(function(msg) { + if (!msg.isGroup) // legacy groups are build within the respective field + buildMessage(msg, indent); + }); + var exts = util.groupExtensions(ns); + if (exts !== null) { + Object.keys(exts).forEach(function(extFqn) { + var extMsg = ns.resolve(extFqn), + extFields = exts[extFqn]; + if (!options.min) + out.push(indent); + out.push("extend ", ns.qn(extMsg), options.min ? "{" : " {\n"); + extFields.forEach(function(extField) { + buildMessageField(ns, extField, indent+" ", false); + }); + if (!options.min) + out.push(indent); + out.push(options.min ? "}" : "}\n\n"); + }); + } + ns.getChildren(ProtoBuf.Reflect.Service).forEach(function(svc) { + buildService(svc, indent); + }); + ns.getChildren(ProtoBuf.Reflect.Namespace).forEach(function(innerNs) { + if (innerNs.className !== "Namespace") + return; + if (!options.min) + out.push(indent); + out.push("message ", innerNs.name, options.min ? "{" : " {\n"); + buildNamespace(innerNs, indent+" "); + if (!options.min) + out.push(indent); + out.push(options.min ? "}" : "}\n"); + }); + trim(); + } + + // Builds a message + function buildMessage(msg, indent) { + if (!msg.isGroup) { + if (!options.min) + out.push(indent); + out.push("message ", msg.name); + } + out.push(options.min ? "{" : " {\n"); + buildOptions(msg.options, indent+" "); + var n = 0, oneofFields = []; + msg.getChildren(ProtoBuf.Reflect.Message.OneOf).forEach(function(oneof) { + if (!options.min) + out.push(indent, " "); + out.push("oneof ", oneof.name, options.min ? "{" : " {\n"); + oneof.fields.forEach(function(fld) { + buildMessageField(msg, fld, indent+" ", true); + oneofFields.push(fld); + }); + if (!options.min) + out.push(indent, " "); + out.push(options.min ? "}" : "}\n"); + }); + msg.getChildren(ProtoBuf.Reflect.Message.Field).forEach(function(fld) { + if (fld instanceof ProtoBuf.Reflect.Message.ExtensionField) + return; + if (oneofFields.indexOf(fld) >= 0) + return; + buildMessageField(msg, fld, indent+" ", false); + n++; + }); + if (n > 0 && !options.min) + out[out.length-1] += "\n"; + if (msg.extensions) { // array of ranges + if (!options.min) + out.push(indent, " "); + out.push("extensions "); + msg.extensions.forEach(function(range, index) { + if (index > 0) + out.push(options.min ? "," : ", "); + out.push(value(range[0])); + if (range[1] !== range[0]) + out.push(" to ", range[1] === ProtoBuf.ID_MAX ? "max" : value(range[1])); + }); + out.push(options.min ? ";" : ";\n\n"); + } + buildNamespace(msg, indent+" "); + if (!options.min) + out.push(indent); + out.push(options.min ? "}" : "}\n\n"); + } + + // Builds a message field + function buildMessageField(msg, fld, indent, isOneOf) { + var isGroup = false; + if (!options.min) + out.push(indent); + if (!isOneOf) + out.push(fld.required ? "required " : (fld.repeated ? "repeated " : "optional ")); + if (fld.resolvedType !== null) { + if (fld.resolvedType instanceof ProtoBuf.Reflect.Message && fld.resolvedType.isGroup) { + // inline legacy groups + out.push("group "); + isGroup = true; + } + out.push(msg.qn(fld.resolvedType)); + } else + out.push(fld.type['name']); + if (!isGroup) + out.push(" ", fld instanceof ProtoBuf.Reflect.Message.ExtensionField ? fld.name.substring(fld.name.lastIndexOf(".")+1) : fld.name); + out.push(options.min ? "=" : " = ", fld.id); + if (isGroup) // inline + buildMessage(fld.resolvedType, indent); + else { + var keys = Object.keys(fld.options); + if (keys.length > 0) { + out.push(options.min ? "[" : " ["); + var n = 0; + keys.forEach(function (key) { + if (n > 0) + out.push(options.min ? "," : ", "); + out.push(key, options.min ? "=" : " = ", + // BEWARE: Monkey patch for string enum defaults + key === "default" && fld.type === ProtoBuf.TYPES["enum"] && typeof fld.options[key] === 'string' ? fld.options[key] : value(fld.options[key]) + ); + n++; + }); + out.push("]"); + } + out.push(options.min ? ";" : ";\n"); + } + } + + // Builds an enum + function buildEnum(enm, indent) { + if (!options.min) + out.push(indent); + out.push("enum ", enm.name, options.min ? "{" : " {\n"); + buildOptions(enm.options, indent+" "); + enm.getChildren(ProtoBuf.Reflect.Enum.Value).forEach(function(val) { + if (!options.min) + out.push(indent, " "); + out.push(val.name, options.min ? "=" : " = ", val.id, options.min? ";" : ";\n"); + }); + if (!options.min) + out.push(indent); + out.push(options.min ? "}" : "}\n\n"); + } + + // Builds a service + function buildService(svc, indent) { + if (!options.min) + out.push(indent); + out.push("service ", svc.name, options.min ? "{" : " {\n"); + buildOptions(svc.options, indent+" "); + svc.getChildren(ProtoBuf.Reflect.Service.RPCMethod).forEach(function(rpc) { + if (!options.min) + out.push(indent+" "); + out.push("rpc ", rpc.name, "(", svc.qn(rpc.resolvedRequestType), ") returns(", svc.qn(rpc.resolvedResponseType), ")"); + var keys = Object.keys(rpc.options); + if (keys.length === 0) { + out.push(options.min ? ";" : ";\n") + } else { + out.push(options.min ? "{" : " {\n"); + buildOptions(rpc.options, indent+" "); + trim(); + if (!options.min) + out.push(indent+" "); + out.push(options.min ? "}" : "}\n"); + } + if (!options.min) + out[out.length-1] += "\n"; + }); + trim(); + out.push(options.min ? "}" : "}\n"); + } + + // Start by building the package namespace + var pkg = ptr.fqn().substring(1); + if (pkg !== "") + out.push("package ", pkg, options.min ? ";" : ";\n\n"); + buildOptions(ptr.options, ""); + buildNamespace(ptr, ""); + return out.join(''); +}; + +/** + * Module description. + * @type {string} + */ +proto.description = description; + +/** + * Converts a JavaScript value to a .proto value. + * @param {*} v Value + * @returns {string} Dot proto value + */ +function value(v) { + switch (typeof v) { + case 'boolean': + return v ? 'true' : 'false'; + case 'number': + return v.toString(); + case 'string': + return '"'+v.replace(/"/g, '\\"')+'"'; + default: + throw new Error("illegal value type: "+typeof(v)); + } +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/util.js b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/util.js new file mode 100644 index 0000000..26715c1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/cli/pbjs/util.js @@ -0,0 +1,128 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 ProtoBuf = require("../../index.js"); + +/** + * Utility namespace. + * @exports pbjs/util + * @namespace + */ +var util = module.exports = {}; + +/** + * Extracts builder options with the specified prefix from a set of CLI options. + * @param {!Object.} options CLI options + * @param {string} prefix Prefix + * @returns {!Object.} + */ +util.getBuilderOptions = function(options, prefix) { + if (!options[prefix]) + return {}; + var builderOptions = {}; + options[prefix].forEach(function(kv) { + var key, val; + var p = kv.indexOf("="); + if (p < 0) { + key = kv; + val = true; + } else { + key = kv.substring(0, p); + val = kv.substring(p+1); + if (val === "true") + val = true; + else if (val === "false") + val = false; + else { + var intval = parseInt(val, 10); + if (intval == val) + val = intval; + } + } + builderOptions[key] = val; + }); + return builderOptions; +}; + +/** + * Pads a string to the specified length. + * @param {string} str String to pad + * @param {number} len Pad length + * @param {boolean=} left Whether to pad to the left, defaults to `false` + * @returns {string} + */ +util.pad = function(str, len, left) { + while (str.length < len) + left ? str = " "+str : str += " "; + return str; +}; + +/** + * Indents a string by the specified whitespace. + * @param {string} str String to indent + * @param {string|number} ws Whitespace string or number of whitespaces + * @returns {string} + */ +util.indent = function(str, ws) { + if (ws === 0 || ws === "") + return str; + var lines = str.split(/\r?\n/); + if (typeof ws === 'number') { + var n = ws; ws = ""; + while (ws.length < n) ws += " "; + } + for (var i=1; i} subject Subject to extend + * @param {!Object.} extension Extensions to apply + */ +util.extend = function(subject, extension) { + Object.keys(extension).forEach(function(key) { + subject[key] = extension[key]; + }); +}; + +/** + * Groups extensions by extended message. + * @param {!ProtoBuf.Reflect.Namespace} ns Namespace + * @returns {?Object.>} + */ +util.groupExtensions = function(ns) { + var exts = {}, + n = 0; + ns.getChildren(ProtoBuf.Reflect.Extension).forEach(function(ext) { + var msg = ext.field.parent, + fqn = msg.fqn(); + if (!exts[fqn]) + exts[fqn] = []; + exts[fqn].push(ext.field); + n++; + }); + return n > 0 ? exts : null; +}; + +/** + * Tests if the specified import name is referencing an internal descriptor. + * @param {string} name Import name + * @returns {boolean} + */ +util.isDescriptor = function(name) { + return /^google\/protobuf\/descriptor/.test(name); +}; \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Builder.Message.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Builder.Message.html new file mode 100644 index 0000000..c129b8e --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Builder.Message.html @@ -0,0 +1,5815 @@ + + + + + JSDoc: Class: Message + + + + + + + + + + +
+ +

Class: Message

+ + + + + + +
+ +
+ +

+ ProtoBuf.Builder. + + Message +

+ +

Barebone of all runtime messages.

+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Message(values, …var_args)

+ + + + + +
+

Constructs a new runtime Message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
values + + +!Object.<string, *> +| + +string + + + + + + + + + +

Preset values

var_args + + +string + + + + + + + + + + <repeatable>
+ +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be created

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static) $options :Object.<string, *>

+ + + + +
+

Message options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, non-null) $type :ProtoBuf.Reflect.Message

+ + + + +
+

Reflection type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

$options :Object.<string, *>

+ + + + +
+

Message options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) $type :ProtoBuf.Reflect.Message

+ + + + +
+

Reflection type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buffer, lengthopt, encopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes a message from the specified buffer or string.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buffer + + +ByteBuffer +| + +ArrayBuffer +| + +Buffer +| + +string + + + + + + + + + +

Buffer to decode from

length + + +number +| + +string + + + + + + <optional>
+ + + + + +

Message length. Defaults to decode all the remainig data.

enc + + +string + + + + + + <optional>
+ + + + + +

Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded or if required fields are missing. The later still + returns the decoded message with missing fields in the decoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(static) decode64(str) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes the message from the specified base64 encoded string.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
str + + +string + + + +

String to decode from

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded or if required fields are missing. The later still + returns the decoded message with missing fields in the decoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(static) decodeDelimited(buffer, encopt) → {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes a varint32 length-delimited message from the specified buffer or string.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buffer + + +ByteBuffer +| + +ArrayBuffer +| + +Buffer +| + +string + + + + + + + + + +

Buffer to decode from

enc + + +string + + + + + + <optional>
+ + + + + +

Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded or if required fields are missing. The later still + returns the decoded message with missing fields in the decoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message or null if not enough bytes are available yet

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(static) decodeHex(str) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes the message from the specified hex encoded string.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
str + + +string + + + +

String to decode from

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded or if required fields are missing. The later still + returns the decoded message with missing fields in the decoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(static) decodeJSON(str) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes the message from a JSON string.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
str + + +string + + + +

String to decode from

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded or if required fields are +missing.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

$add(key, value, noAssertopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Adds a value to a repeated field. This is an alias for ProtoBuf.Builder.Message#add.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
key + + +string + + + + + + + + + +

Field name

value + + +* + + + + + + + + + +

Value to add

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to assert the value or not (asserts by default)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be added

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

$encode(bufferopt, noVerifyopt) → (non-null) {ByteBuffer}

+ + + + + +
+

Encodes the message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buffer + + +ByteBuffer +| + +boolean + + + + + + <optional>
+ + + + + +

ByteBuffer to encode to. Will create a new one and flip it if omitted.

noVerify + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not verify field values, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded ByteBuffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Encoded message as a ByteBuffer

+
+ + + +
+
+ Type +
+
+ +ByteBuffer + + +
+
+ + + + + + + + + + +

$get(key) → {*}

+ + + + + +
+

Gets a field's value. This is an alias for ProtoBuf.Builder.Message#$get.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
key + + +string + + + +

Key

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If there is no such field

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

$set(keyOrObj, valueopt, noAssertopt)

+ + + + + +
+

Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
keyOrObj + + +string +| + +!Object.<string, *> + + + + + + + + + +

String key or plain object holding multiple values

value + + +* +| + +boolean + + + + + + <optional>
+ + + + + +

Value to set if key is a string, otherwise omitted

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not assert the value, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

add(key, value, noAssertopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Adds a value to a repeated field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
key + + +string + + + + + + + + + +

Field name

value + + +* + + + + + + + + + +

Value to add

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to assert the value or not (asserts by default)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be added

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

calculate() → {number}

+ + + + + +
+

Calculates the byte length of the message.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be calculated or if required fields are missing.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Byte length

+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + +

encode64() → {string}

+ + + + + +
+

Directly encodes the message to a base64 encoded string.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the underlying buffer cannot be encoded or if required fields are missing. The later + still returns the encoded base64 string in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Base64 encoded string

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

encodeAB() → {ArrayBuffer}

+ + + + + +
+

Directly encodes the message to an ArrayBuffer.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded ArrayBuffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Encoded message as ArrayBuffer

+
+ + + +
+
+ Type +
+
+ +ArrayBuffer + + +
+
+ + + + + + + + + + +

encodeDelimited(bufferopt, noVerifyopt) → (non-null) {ByteBuffer}

+ + + + + +
+

Encodes the varint32 length-delimited message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buffer + + +ByteBuffer +| + +boolean + + + + + + <optional>
+ + + + + +

ByteBuffer to encode to. Will create a new one and flip it if omitted.

noVerify + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not verify field values, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded ByteBuffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Encoded message as a ByteBuffer

+
+ + + +
+
+ Type +
+
+ +ByteBuffer + + +
+
+ + + + + + + + + + +

encodeHex() → {string}

+ + + + + +
+

Directly encodes the message to a hex encoded string.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the underlying buffer cannot be encoded or if required fields are missing. The later + still returns the encoded hex string in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Hex encoded string

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

encodeJSON() → {string}

+ + + + + +
+

Encodes a message to JSON.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

JSON string

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

encodeNB() → (non-null) {Buffer}

+ + + + + +
+

Directly encodes the message to a node Buffer.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded, not running under node.js or if required fields are + missing. The later still returns the encoded node Buffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

get(key, noAssertopt) → {*}

+ + + + + +
+

Gets a field's value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
key + + +string + + + + + + + + + +

Key

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not assert for an actual field, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If there is no such field

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

(abstract) get[SomeField]() → {*}

+ + + + + +
+

Gets a value. This method is present for each field, but only if there is no name conflict with + another field.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

(abstract) get_[some_field]() → {*}

+ + + + + +
+

Gets a value. This method is present for each field, but only if there is no name conflict with + another field.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

set(keyOrObj, valueopt, noAssertopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Sets a field's value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
keyOrObj + + +string +| + +!Object.<string, *> + + + + + + + + + +

String key or plain object holding multiple values

value + + +* +| + +boolean + + + + + + <optional>
+ + + + + +

Value to set if key is a string, otherwise omitted

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not assert for an actual field / proper value type, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(abstract) set[SomeField](value, noAssertopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Sets a value. This method is present for each field, but only if there is no name conflict with + another field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
value + + +* + + + + + + + + + +

Value to set

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not assert the value, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

(abstract) set_[some_field](value, noAssertopt) → (non-null) {ProtoBuf.Builder.Message}

+ + + + + +
+

Sets a value. This method is present for each field, but only if there is no name conflict with + another field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
value + + +* + + + + + + + + + +

Value to set

noAssert + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not assert the value, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

toArrayBuffer() → {ArrayBuffer}

+ + + + + +
+

Returns the message as an ArrayBuffer. This is an alias for ProtoBuf.Builder.Message#encodeAB.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded ArrayBuffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Encoded message as ArrayBuffer

+
+ + + +
+
+ Type +
+
+ +ArrayBuffer + + +
+
+ + + + + + + + + + +

toBase64() → {string}

+ + + + + +
+

Returns the message as a base64 encoded string. This is an alias for ProtoBuf.Builder.Message#encode64.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded base64 string in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Base64 encoded string

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toBuffer() → (non-null) {Buffer}

+ + + + + +
+

Returns the message as a node Buffer. This is an alias for ProtoBuf.Builder.Message#encodeNB.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded node Buffer in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

toHex() → {string}

+ + + + + +
+

Returns the message as a hex encoded string. This is an alias for ProtoBuf.Builder.Message#encodeHex.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be encoded or if required fields are missing. The later still + returns the encoded hex string in the encoded property on the error.

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Hex encoded string

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toRaw(binaryAsBase64opt, longsAsStrings) → {Object.<string, *>}

+ + + + + +
+

Returns the message's raw payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
binaryAsBase64 + + +boolean + + + + + + <optional>
+ + + + + +

Whether to include binary data as base64 strings instead of Buffers, defaults to false

longsAsStrings + + +boolean + + + + + + + + + +

Whether to encode longs as strings

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Raw payload

+
+ + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

toString() → {string}

+ + + + + +
+

Returns a string representation of this Message.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation as of ".Fully.Qualified.MessageName"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Builder.Service.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Builder.Service.html new file mode 100644 index 0000000..85a5262 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Builder.Service.html @@ -0,0 +1,961 @@ + + + + + JSDoc: Class: Service + + + + + + + + + + +
+ +

Class: Service

+ + + + + + +
+ +
+ +

+ ProtoBuf.Builder. + + Service +

+ +

Barebone of all runtime services.

+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Service(rpcImplopt)

+ + + + + +
+

Constructs a new runtime Service.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
rpcImpl + + +function + + + + + + <optional>
+ + + + + +

RPC implementation receiving the method name and the message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the service cannot be created

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static) $options :Object.<string, *>

+ + + + +
+

Service options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, non-null) $type :ProtoBuf.Reflect.Service

+ + + + +
+

Reflection type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

$options :Object.<string, *>

+ + + + +
+

Service options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) $type :ProtoBuf.Reflect.Service

+ + + + +
+

Reflection type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) rpcImpl :function

+ + + + +
+

Service implementation.

+
+ + + +
Type:
+
    +
  • + +function + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(abstract, static) [Method](rpcImplnon-null, req, callback)

+ + + + + +
+

Asynchronously performs an RPC call using the given RPC implementation.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rpcImpl + + +function + + + +

RPC implementation

req + + +ProtoBuf.Builder.Message + + + +

Request

callback + + +function + + + +

Callback receiving + the error if any and the response either as a pre-parsed message or as its raw bytes

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(abstract) [Method](req, callback)

+ + + + + +
+

Asynchronously performs an RPC call using the instance's RPC implementation.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
req + + +ProtoBuf.Builder.Message + + + +

Request

callback + + +function + + + +

Callback receiving + the error if any and the response either as a pre-parsed message or as its raw bytes

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Builder.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Builder.html new file mode 100644 index 0000000..9a5a4ee --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Builder.html @@ -0,0 +1,2800 @@ + + + + + JSDoc: Class: Builder + + + + + + + + + + +
+ +

Class: Builder

+ + + + + + +
+ +
+ +

+ ProtoBuf. + + Builder +

+ +

Provides the functionality to build protocol messages.

+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Builder(optionsopt)

+ + + + + +
+

Constructs a new Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + +

Classes

+ +
+
Message
+
+ +
Service
+
+
+ + + + + + + +

Members

+ + + +

files :Array.<string>

+ + + + +
+

Imported files.

+
+ + + +
Type:
+
    +
  • + +Array.<string> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) importRoot :string

+ + + + +
+

Import root override.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

ns :ProtoBuf.Reflect.Namespace

+ + + + +
+

Namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

ptr :ProtoBuf.Reflect.T

+ + + + +
+

Namespace pointer.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolved :boolean

+ + + + +
+

Resolved flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

result :Object.<string, (ProtoBuf.Builder.Message|Object)>|null

+ + + + +
+

The current building result.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) isEnum(defnon-null) → {boolean}

+ + + + + +
+

Tests if a definition most likely describes an enum.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
def + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) isExtend(defnon-null) → {boolean}

+ + + + + +
+

Tests if a definition most likely describes an extended message

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
def + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) isMessage(defnon-null) → {boolean}

+ + + + + +
+

Tests if a definition most likely describes a message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
def + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) isMessageField(defnon-null) → {boolean}

+ + + + + +
+

Tests if a definition most likely describes a message field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
def + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) isService(defnon-null) → {boolean}

+ + + + + +
+

Tests if a definition most likely describes a service.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
def + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

"import"](json, filenameopt) → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Imports another definition into this builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
json + + +Object.<string, *> + + + + + + + + + +

Parsed import

filename + + +string +| + +Object + + + + + + <optional>
+ + + + + +

Imported file name

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the definition or file cannot be imported

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

build(pathopt) → {ProtoBuf.Builder.Message|!Object.<string, *>}

+ + + + + +
+

Builds the protocol. This will first try to resolve all definitions and, if this has been successful, +return the built package.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
path + + +string +| + +Array.<string> + + + + + + <optional>
+ + + + + +

Specifies what to return. If omitted, the entire namespace will be returned.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If a type could not be resolved

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message +| + +!Object.<string, *> + + +
+
+ + + + + + + + + + +

create(defsnon-null) → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Creates the specified definitions at the current pointer position.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
defs + + +Array.<!Object> + + + +

Messages, enums or services to create

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If a message definition is invalid

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

define(namespace) → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Defines a namespace on top of the current pointer position and places the pointer on it.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
namespace + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

lookup(pathopt, excludeNonNamespaceopt) → (nullable) {ProtoBuf.Reflect.T}

+ + + + + +
+

Similar to ProtoBuf.Builder#build, but looks up the internal reflection descriptor.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
path + + +string + + + + + + <optional>
+ + + + + +

Specifies what to return. If omitted, the entire namespace wiil be returned.

excludeNonNamespace + + +boolean + + + + + + <optional>
+ + + + + +

Excludes non-namespace types like fields, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Reflection descriptor or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.T + + +
+
+ + + + + + + + + + +

reset() → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Resets the pointer to the root namespace.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

resolveAll() → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Resolves all namespace objects.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If a type cannot be resolved

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

this

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

toString() → {string}

+ + + + + +
+

Returns a string representation of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation as of "Builder"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.DotProto.Parser.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.DotProto.Parser.html new file mode 100644 index 0000000..81cdf38 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.DotProto.Parser.html @@ -0,0 +1,729 @@ + + + + + JSDoc: Class: Parser + + + + + + + + + + +
+ +

Class: Parser

+ + + + + + +
+ +
+ +

+ ProtoBuf.DotProto. + + Parser +

+ +

prototype parser

+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Parser(source)

+ + + + + +
+

Constructs a new Parser.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
source + + +string + + + +

Source

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

proto3 :boolean

+ + + + +
+

Whether parsing proto3 or not.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) tn :ProtoBuf.DotProto.Tokenizer

+ + + + +
+

Tokenizer.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) parse() → (non-null) {Object}

+ + + + + +
+

Parses the specified source.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the source cannot be parsed

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

parse() → (non-null) {Object}

+ + + + + +
+

Parses the source.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the source cannot be parsed

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

toString() → {string}

+ + + + + +
+

Returns a string representation of this parser.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.DotProto.Tokenizer.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.DotProto.Tokenizer.html new file mode 100644 index 0000000..8ad8727 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.DotProto.Tokenizer.html @@ -0,0 +1,1140 @@ + + + + + JSDoc: Class: Tokenizer + + + + + + + + + + +
+ +

Class: Tokenizer

+ + + + + + +
+ +
+ +

+ ProtoBuf.DotProto. + + Tokenizer +

+ +

prototype tokenizer

+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Tokenizer(proto)

+ + + + + +
+

Constructs a new Tokenizer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
proto + + +string + + + +

Proto to tokenize

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

index :number

+ + + + +
+

Current index.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

line :number

+ + + + +
+

Current line.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

source :string

+ + + + +
+

Source to parse.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) stack :Array.<string>

+ + + + +
+

Token stack.

+
+ + + +
Type:
+
    +
  • + +Array.<string> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

next() → (nullable) {string}

+ + + + + +
+

Gets the next token and advances by one.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Token or null on EOF

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

omit(expected) → {boolean}

+ + + + + +
+

Omits an optional token.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
expected + + +string + + + +

Expected optional token

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

true if the token exists

+
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

peek() → (nullable) {string}

+ + + + + +
+

Peeks for the next token.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Token or null on EOF

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

skip(expected)

+ + + + + +
+

Skips a specific token and throws if it differs.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
expected + + +string + + + +

Expected token

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the actual token differs

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

toString() → {string}

+ + + + + +
+

Returns a string representation of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation as of "Tokenizer(index/length)"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.DotProto.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.DotProto.html new file mode 100644 index 0000000..744f956 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.DotProto.html @@ -0,0 +1,144 @@ + + + + + JSDoc: Namespace: DotProto + + + + + + + + + + +
+ +

Namespace: DotProto

+ + + + + + +
+ +
+ +

+ ProtoBuf. + + DotProto +

+ + +
+ +
+
+ + +

Utilities to parse .proto files.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + +

Classes

+ +
+
Parser
+
+ +
Tokenizer
+
+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Element.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Element.html new file mode 100644 index 0000000..24ef9bb --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Element.html @@ -0,0 +1,555 @@ + + + + + JSDoc: Class: Element + + + + + + + + + + +
+ +

Class: Element

+ + + + + +
+ +
+

+ ProtoBuf. + + Element +

+ +
+ +
+
+ + + + +
+

new Element(type, resolvedType, isMapKey, syntax)

+ + +
+
+ + +
+

Constructs a new Element implementation that checks and converts values for a +particular field type, as appropriate.

+

An Element represents a single value: either the value of a singular field, +or a value contained in one entry of a repeated field or map field. This +class does not implement these higher-level concepts; it only encapsulates +the low-level typechecking and conversion.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +Object + + + +

Resolved data type

resolvedType + + +ProtoBuf.Reflect.T +| + +null + + + +

Resolved type, if relevant +(e.g. submessage field).

isMapKey + + +boolean + + + +

Is this element a Map key? The value will be +converted to string form if so.

syntax + + +string + + + +

Syntax level of defining message type, e.g., +proto2 or proto3.

+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Members

+ +
+ +
+

isMapKey :boolean

+ + +
+
+ +
+

Element is a map key.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + +
+ + + +
+

resolvedType :ProtoBuf.Reflect.T|null

+ + +
+
+ +
+

Element type reference to submessage or enum definition, if needed.

+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + +
+ + + +
+

syntax :string

+ + +
+
+ +
+

Syntax level of defining message type, e.g., proto2 or proto3.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + +
+ + + +
+

type :Object

+ + +
+
+ +
+

Element type, as a string (e.g., int32).

+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + +
+ +
+ + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.0-alpha9 on Mon Jun 01 2015 01:15:14 GMT+0200 (Mitteleuropäische Sommerzeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Map.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Map.html new file mode 100644 index 0000000..bf81c46 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Map.html @@ -0,0 +1,561 @@ + + + + + JSDoc: Class: Map + + + + + + + + + + +
+ +

Class: Map

+ + + + + + +
+ +
+ +

+ ProtoBuf. + + Map +

+ + +
+ +
+
+ + + + + +

new Map(fieldnon-null, contentsopt)

+ + + + + +
+

Constructs a new Map. A Map is a container that is used to implement map +fields on message objects. It closely follows the ES6 Map API; however, +it is distinct because we do not want to depend on external polyfills or +on ES6 itself.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
field + + +ProtoBuf.Reflect.Field + + + + + + + + + +

Map field

contents + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Initial contents

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(non-null) field :ProtoBuf.Reflect.Field

+ + + + +
+

The field corresponding to this map.

+
+ + + +
Type:
+
    +
  • + +ProtoBuf.Reflect.Field + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) keyElem :ProtoBuf.Reflect.Element

+ + + + +
+

Element instance corresponding to key type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) map :Object.<string, {key: *, value: *}>

+ + + + +
+

Internal map: stores mapping of (string form of key) -> (key, value) +pair.

+

We provide map semantics for arbitrary key types, but we build on top +of an Object, which has only string keys. In order to avoid the need +to convert a string key back to its native type in many situations, +we store the native key value alongside the value. Thus, we only need +a one-way mapping from a key type to its string form that guarantees +uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1 +=== K2).

+
+ + + +
Type:
+
    +
  • + +Object.<string, {key: *, value: *}> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) valueElem :ProtoBuf.Reflect.Element

+ + + + +
+

Element instance corresponding to value type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Element.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Element.html new file mode 100644 index 0000000..b1ab780 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Element.html @@ -0,0 +1,846 @@ + + + + + JSDoc: Class: Element + + + + + + + + + + +
+ +

Class: Element

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Element +

+ + +
+ +
+
+ + + + + +

new Element(type, resolvedType, isMapKey, syntax, name)

+ + + + + +
+

Constructs a new Element implementation that checks and converts values for a +particular field type, as appropriate.

+

An Element represents a single value: either the value of a singular field, +or a value contained in one entry of a repeated field or map field. This +class does not implement these higher-level concepts; it only encapsulates +the low-level typechecking and conversion.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +Object + + + +

Resolved data type

resolvedType + + +ProtoBuf.Reflect.T +| + +null + + + +

Resolved type, if relevant +(e.g. submessage field).

isMapKey + + +boolean + + + +

Is this element a Map key? The value will be +converted to string form if so.

syntax + + +string + + + +

Syntax level of defining message type, e.g., +proto2 or proto3.

name + + +string + + + +

Name of the field containing this element (for error +messages)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

isMapKey :boolean

+ + + + +
+

Element is a map key.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Name of the field containing this element (for error messages)

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolvedType :ProtoBuf.Reflect.T|null

+ + + + +
+

Element type reference to submessage or enum definition, if needed.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

syntax :string

+ + + + +
+

Syntax level of defining message type, e.g., proto2 or proto3.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

type :Object

+ + + + +
+

Element type, as a string (e.g., int32).

+
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) defaultFieldValue(type) → {*}

+ + + + + +
+

Returns the default value for this field in proto3.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string +| + +Object + + + +

the field type

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Default value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.Value.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.Value.html new file mode 100644 index 0000000..a88498f --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.Value.html @@ -0,0 +1,1066 @@ + + + + + JSDoc: Class: Value + + + + + + + + + + +
+ +

Class: Value

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Enum. + + Value +

+ + +
+ +
+
+ + + + + +

new Value(buildernon-null, enmnon-null, name, id)

+ + + + + +
+

Constructs a new Enum Value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
builder + + +ProtoBuf.Builder + + + +

Builder reference

enm + + +ProtoBuf.Reflect.Enum + + + +

Enum reference

name + + +string + + + +

Field name

id + + +number + + + +

Unique field id

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

id :number

+ + + + +
+

Unique enum value id.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.html new file mode 100644 index 0000000..366a0ab --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Enum.html @@ -0,0 +1,2722 @@ + + + + + JSDoc: Class: Enum + + + + + + + + + + +
+ +

Class: Enum

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Enum +

+ + +
+ +
+
+ + + + + +

new Enum(buildernon-null, parentnon-null, name, optionsopt, syntaxnullable)

+ + + + + +
+

Constructs a new Enum.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

parent + + +ProtoBuf.Reflect.T + + + + + + + + + +

Parent Reflect object

name + + +string + + + + + + + + + +

Enum name

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Enum options

syntax + + +string + + + + + + + + <nullable>
+ + + +

The syntax level (e.g., proto3)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + +

Classes

+ +
+
Value
+
+
+ + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) children :Array.<ProtoBuf.Reflect.T>

+ + + + +
+

Children inside the namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

object :Object.<string, number>|null

+ + + + +
+

Runtime enum object.

+
+ + + +
Type:
+
    +
  • + +Object.<string, number> +| + +null + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) syntax :string

+ + + + +
+

Syntax level (e.g., proto2 or proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) getName(enmnon-null, value) → (nullable) {string}

+ + + + + +
+

Gets the string name of an enum value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
enm + + +ProtoBuf.Builder.Enum + + + +

Runtime enum

value + + +number + + + +

Enum value

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Name or null if not present

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

addChild(child)

+ + + + + +
+

Adds a child to the namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
child + + +ProtoBuf.Reflect.T + + + +

Child

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the child cannot be added (duplicate)

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

build(rebuild) → (non-null) {Object.<string, number>}

+ + + + + +
+

Builds this enum and returns the runtime counterpart.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rebuild + + +boolean + + + +

Whether to rebuild or not, defaults to false

+ + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, number> + + +
+
+ + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the namespace's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

getChild(nameOrId) → (nullable) {ProtoBuf.Reflect.T}

+ + + + + +
+

Gets a child by its name or id.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nameOrId + + +string +| + +number + + + +

Child name or id

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The child or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.T + + +
+
+ + + + + + + + + + +

getChildren(typeopt) → {Array.<ProtoBuf.Reflect.T>}

+ + + + + +
+

Returns an array of the namespace's children.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
type + + +ProtoBuf.Reflect.T + + + + + + <optional>
+ + + + + +

Filter type (returns instances of this type only). Defaults to null (all children).

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<ProtoBuf.Reflect.T> + + +
+
+ + + + + + + + + + +

getOption(nameopt) → {*|Object.<string, *>}

+ + + + + +
+

Gets the value assigned to the option with the specified name.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
name + + +string + + + + + + <optional>
+ + + + + +

Returns the option value if specified, otherwise all options are returned.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

null} Option value or NULL if there is no such option

+
+ + + +
+
+ Type +
+
+ +* +| + +Object.<string, *> + + +
+
+ + + + + + + + + + +

qn(tnon-null) → {string}

+ + + + + +
+

Determines the shortest qualified name of the specified type, if any, relative to this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
t + + +ProtoBuf.Reflect.T + + + +

Reflection type

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The shortest qualified name or, if there is none, the fqn

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

resolve(qn, excludeNonNamespaceopt) → (nullable) {ProtoBuf.Reflect.Namespace}

+ + + + + +
+

Resolves a reflect object inside of this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
qn + + +string +| + +!Array.<string> + + + + + + + + + +

Qualified name to resolve

excludeNonNamespace + + +boolean + + + + + + <optional>
+ + + + + +

Excludes non-namespace types, defaults to false

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The resolved type or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.Namespace + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Extension.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Extension.html new file mode 100644 index 0000000..29afcb1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Extension.html @@ -0,0 +1,360 @@ + + + + + JSDoc: Class: Extension + + + + + + + + + + +
+ +

Class: Extension

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Extension +

+ + +
+ +
+
+ + + + + +

new Extension(buildernon-null, parentnon-null, name, fieldnon-null)

+ + + + + +
+

An extension (field).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
builder + + +ProtoBuf.Builder + + + +

Builder reference

parent + + +ProtoBuf.Reflect.T + + + +

Parent object

name + + +string + + + +

Object name

field + + +ProtoBuf.Reflect.Message.Field + + + +

Extension field

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(non-null) field :ProtoBuf.Reflect.Message.Field

+ + + + +
+

Extended message field.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.ExtensionField.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.ExtensionField.html new file mode 100644 index 0000000..259cc9c --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.ExtensionField.html @@ -0,0 +1,3376 @@ + + + + + JSDoc: Class: ExtensionField + + + + + + + + + + +
+ +

Class: ExtensionField

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Message. + + ExtensionField +

+ + +
+ +
+
+ + + + + +

new ExtensionField(buildernon-null, messagenon-null, rule, type, name, id, optionsopt, non-null)

+ + + + + +
+

Constructs a new Message ExtensionField.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

message + + +ProtoBuf.Reflect.Message + + + + + + + + + +

Message reference

rule + + +string + + + + + + + + + +

Rule, one of requried, optional, repeated

type + + +string + + + + + + + + + +

Data type, e.g. int32

name + + +string + + + + + + + + + +

Field name

id + + +number + + + + + + + + + +

Unique field id

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

defaultValue :*

+ + + + +
+

Default value.

+
+ + + +
Type:
+
    +
  • + +* + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

element :ProtoBuf.Element

+ + + + +
+

Element implementation. Created in build() after types are resolved.

+
+ + + +
Type:
+
    +
  • + +ProtoBuf.Element + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) extension :ProtoBuf.Reflect.Extension

+ + + + +
+

Extension reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

id :number

+ + + + +
+

Unique message field id.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

keyElement :ProtoBuf.Element

+ + + + +
+

Key element implementation, for map fields. Created in build() after +types are resolved.

+
+ + + +
Type:
+
    +
  • + +ProtoBuf.Element + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

keyType :string|Object|null

+ + + + +
+

Message field key type. Type reference string if unresolved, protobuf +type if resolved. Valid only if this.map === true, null otherwise.

+
+ + + +
Type:
+
    +
  • + +string +| + +Object +| + +null + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

map :boolean

+ + + + +
+

Message field map flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) oneof :ProtoBuf.Reflect.Message.OneOf

+ + + + +
+

Enclosing OneOf.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Message field options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

originalName :string

+ + + + +
+

Original field name.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

repeated :boolean

+ + + + +
+

Message field repeated flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

required :boolean

+ + + + +
+

Message field required flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolvedType :ProtoBuf.Reflect.T|null

+ + + + +
+

Resolved type reference inside the global namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

syntax :string

+ + + + +
+

Syntax level of this definition (e.g., proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

type :string|Object

+ + + + +
+

Message field type. Type reference string if unresolved, protobuf type if +resolved. In a map field, this is the value type.

+
+ + + +
Type:
+
    +
  • + +string +| + +Object + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

calculate(value, messagenon-null) → {number}

+ + + + + +
+

Calculates the length of this field's value on the network level.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Field value

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Byte length

+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + +

decode(wireType, buffer, skipRepeatedopt) → {*}

+ + + + + +
+

Decode the field value from the specified buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
wireType + + +number + + + + + + + + + +

Leading wire type

buffer + + +ByteBuffer + + + + + + + + + +

ByteBuffer to decode from

skipRepeated + + +boolean + + + + + + <optional>
+ + + + + +

Whether to skip the repeated check or not. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the field cannot be decoded

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded value: array for packed repeated fields, [key, value] for + map fields, or an individual value otherwise.

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

encode(value, buffer, messagenon-null) → {ByteBuffer}

+ + + + + +
+

Encodes the specified field value to the specified buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Verified field value

buffer + + +ByteBuffer + + + +

ByteBuffer to encode to

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the field cannot be encoded

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

The ByteBuffer for chaining

+
+ + + +
+
+ Type +
+
+ +ByteBuffer + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

hasWirePresence(value, messagenon-null) → {boolean}

+ + + + + +
+

Determines whether the field will have a presence on the wire given its +value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Verified field value

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Whether the field will be present on the wire

+
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + +

verifyValue(value, skipRepeatedopt) → {*}

+ + + + + +
+

Checks if the given value can be set for this field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
value + + +* + + + + + + + + + +

Value to check

skipRepeated + + +boolean + + + + + + <optional>
+ + + + + +

Whether to skip the repeated value check or not. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set for this field

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Verified, maybe adjusted, value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.Field.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.Field.html new file mode 100644 index 0000000..f9c678b --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.Field.html @@ -0,0 +1,3308 @@ + + + + + JSDoc: Class: Field + + + + + + + + + + +
+ +

Class: Field

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Message. + + Field +

+ + +
+ +
+
+ + + + + +

new Field(buildernon-null, messagenon-null, rule, keytypenullable, type, name, id, optionsopt, oneofopt, non-null, syntaxnullable)

+ + + + + +
+

Constructs a new Message Field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

message + + +ProtoBuf.Reflect.Message + + + + + + + + + +

Message reference

rule + + +string + + + + + + + + + +

Rule, one of requried, optional, repeated

keytype + + +string + + + + + + + + <nullable>
+ + + +

Key data type, if any.

type + + +string + + + + + + + + + +

Data type, e.g. int32

name + + +string + + + + + + + + + +

Field name

id + + +number + + + + + + + + + +

Unique field id

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

oneof + + +ProtoBuf.Reflect.Message.OneOf + + + + + + <optional>
+ + + + + +

Enclosing OneOf

syntax + + +string + + + + + + + + <nullable>
+ + + +

The syntax level of this definition (e.g., proto3)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

defaultValue :*

+ + + + +
+

Default value.

+
+ + + +
Type:
+
    +
  • + +* + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

element :ProtoBuf.Element

+ + + + +
+

Element implementation. Created in build() after types are resolved.

+
+ + + +
Type:
+
    +
  • + +ProtoBuf.Element + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

id :number

+ + + + +
+

Unique message field id.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

keyElement :ProtoBuf.Element

+ + + + +
+

Key element implementation, for map fields. Created in build() after +types are resolved.

+
+ + + +
Type:
+
    +
  • + +ProtoBuf.Element + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

keyType :string|Object|null

+ + + + +
+

Message field key type. Type reference string if unresolved, protobuf +type if resolved. Valid only if this.map === true, null otherwise.

+
+ + + +
Type:
+
    +
  • + +string +| + +Object +| + +null + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

map :boolean

+ + + + +
+

Message field map flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) oneof :ProtoBuf.Reflect.Message.OneOf

+ + + + +
+

Enclosing OneOf.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Message field options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

originalName :string

+ + + + +
+

Original field name.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

repeated :boolean

+ + + + +
+

Message field repeated flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

required :boolean

+ + + + +
+

Message field required flag.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolvedType :ProtoBuf.Reflect.T|null

+ + + + +
+

Resolved type reference inside the global namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

syntax :string

+ + + + +
+

Syntax level of this definition (e.g., proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

type :string|Object

+ + + + +
+

Message field type. Type reference string if unresolved, protobuf type if +resolved. In a map field, this is the value type.

+
+ + + +
Type:
+
    +
  • + +string +| + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

calculate(value, messagenon-null) → {number}

+ + + + + +
+

Calculates the length of this field's value on the network level.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Field value

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Byte length

+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + +

decode(wireType, buffer, skipRepeatedopt) → {*}

+ + + + + +
+

Decode the field value from the specified buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
wireType + + +number + + + + + + + + + +

Leading wire type

buffer + + +ByteBuffer + + + + + + + + + +

ByteBuffer to decode from

skipRepeated + + +boolean + + + + + + <optional>
+ + + + + +

Whether to skip the repeated check or not. Defaults to false.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the field cannot be decoded

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded value: array for packed repeated fields, [key, value] for + map fields, or an individual value otherwise.

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + +

encode(value, buffer, messagenon-null) → {ByteBuffer}

+ + + + + +
+

Encodes the specified field value to the specified buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Verified field value

buffer + + +ByteBuffer + + + +

ByteBuffer to encode to

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the field cannot be encoded

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

The ByteBuffer for chaining

+
+ + + +
+
+ Type +
+
+ +ByteBuffer + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

hasWirePresence(value, messagenon-null) → {boolean}

+ + + + + +
+

Determines whether the field will have a presence on the wire given its +value.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

Verified field value

message + + +ProtoBuf.Builder.Message + + + +

Runtime message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Whether the field will be present on the wire

+
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + +

verifyValue(value, skipRepeatedopt) → {*}

+ + + + + +
+

Checks if the given value can be set for this field.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
value + + +* + + + + + + + + + +

Value to check

skipRepeated + + +boolean + + + + + + <optional>
+ + + + + +

Whether to skip the repeated value check or not. Defaults to false.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the value cannot be set for this field

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Verified, maybe adjusted, value

+
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.OneOf.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.OneOf.html new file mode 100644 index 0000000..9c8d042 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.OneOf.html @@ -0,0 +1,1043 @@ + + + + + JSDoc: Class: OneOf + + + + + + + + + + +
+ +

Class: OneOf

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Message. + + OneOf +

+ + +
+ +
+
+ + + + + +

new OneOf(buildernon-null, messagenon-null, name)

+ + + + + +
+

Constructs a new Message OneOf.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
builder + + +ProtoBuf.Builder + + + +

Builder reference

message + + +ProtoBuf.Reflect.Message + + + +

Message reference

name + + +string + + + +

OneOf name

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) fields :Array.<!ProtoBuf.Reflect.Message.Field>

+ + + + +
+

Enclosed fields.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.html new file mode 100644 index 0000000..48292bc --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Message.html @@ -0,0 +1,3477 @@ + + + + + JSDoc: Class: Message + + + + + + + + + + +
+ +

Class: Message

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Message +

+ + +
+ +
+
+ + + + + +

new Message(buildernon-null, parentnon-null, name, optionsopt, isGroupopt, syntaxnullable)

+ + + + + +
+

Constructs a new Message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

parent + + +ProtoBuf.Reflect.Namespace + + + + + + + + + +

Parent message or namespace

name + + +string + + + + + + + + + +

Message name

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Message options

isGroup + + +boolean + + + + + + <optional>
+ + + + + +

true if this is a legacy group

syntax + + +string + + + + + + + + <nullable>
+ + + +

The syntax level of this definition (e.g., proto3)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + +

Classes

+ +
+
ExtensionField
+
+ +
Field
+
+ +
OneOf
+
+
+ + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) children :Array.<ProtoBuf.Reflect.T>

+ + + + +
+

Children inside the namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) clazz :function

+ + + + +
+

Runtime message class.

+
+ + + +
Type:
+
    +
  • + +function + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

extensions :!Array.<number>|undefined

+ + + + +
+

Extensions range.

+
+ + + +
Type:
+
    +
  • + +!Array.<number> +| + +undefined + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

isGroup :boolean

+ + + + +
+

Whether this is a legacy group or not.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) syntax :string

+ + + + +
+

Syntax level (e.g., proto2 or proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

addChild(child)

+ + + + + +
+

Adds a child to the namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
child + + +ProtoBuf.Reflect.T + + + +

Child

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the child cannot be added (duplicate)

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

build(rebuildopt) → {ProtoBuf.Reflect.Message}

+ + + + + +
+

Builds the message and returns the runtime counterpart, which is a fully functional class.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
rebuild + + +boolean + + + + + + <optional>
+ + + + + +

Whether to rebuild or not, defaults to false

+ + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be built

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Message class

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.Message + + +
+
+ + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the namespace's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

calculate(messagenon-null) → {number}

+ + + + + +
+

Calculates a runtime message's byte length.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
message + + +ProtoBuf.Builder.Message + + + +

Runtime message to encode

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If required fields are missing or the message cannot be calculated for another reason

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Byte length

+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + +

decode(buffer, lengthopt, expectedGroupEndIdopt) → {ProtoBuf.Builder.Message}

+ + + + + +
+

Decodes an encoded message and returns the decoded message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buffer + + +ByteBuffer + + + + + + + + + +

ByteBuffer to decode from

length + + +number + + + + + + <optional>
+ + + + + +

Message length. Defaults to decode all remaining data.

expectedGroupEndId + + +number + + + + + + <optional>
+ + + + + +

Expected GROUPEND id if this is a legacy group

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be decoded

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Decoded message

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder.Message + + +
+
+ + + + + + + + + + +

encode(messagenon-null, buffer, noVerifyopt) → {ByteBuffer}

+ + + + + +
+

Encodes a runtime message's contents to the specified buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
message + + +ProtoBuf.Builder.Message + + + + + + + + + +

Runtime message to encode

buffer + + +ByteBuffer + + + + + + + + + +

ByteBuffer to write to

noVerify + + +boolean + + + + + + <optional>
+ + + + + +

Whether to not verify field values, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If required fields are missing or the message cannot be encoded for another reason

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

The ByteBuffer for chaining

+
+ + + +
+
+ Type +
+
+ +ByteBuffer + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

getChild(nameOrId) → (nullable) {ProtoBuf.Reflect.T}

+ + + + + +
+

Gets a child by its name or id.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nameOrId + + +string +| + +number + + + +

Child name or id

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The child or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.T + + +
+
+ + + + + + + + + + +

getChildren(typeopt) → {Array.<ProtoBuf.Reflect.T>}

+ + + + + +
+

Returns an array of the namespace's children.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
type + + +ProtoBuf.Reflect.T + + + + + + <optional>
+ + + + + +

Filter type (returns instances of this type only). Defaults to null (all children).

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<ProtoBuf.Reflect.T> + + +
+
+ + + + + + + + + + +

getOption(nameopt) → {*|Object.<string, *>}

+ + + + + +
+

Gets the value assigned to the option with the specified name.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
name + + +string + + + + + + <optional>
+ + + + + +

Returns the option value if specified, otherwise all options are returned.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

null} Option value or NULL if there is no such option

+
+ + + +
+
+ Type +
+
+ +* +| + +Object.<string, *> + + +
+
+ + + + + + + + + + +

qn(tnon-null) → {string}

+ + + + + +
+

Determines the shortest qualified name of the specified type, if any, relative to this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
t + + +ProtoBuf.Reflect.T + + + +

Reflection type

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The shortest qualified name or, if there is none, the fqn

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

resolve(qn, excludeNonNamespaceopt) → (nullable) {ProtoBuf.Reflect.Namespace}

+ + + + + +
+

Resolves a reflect object inside of this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
qn + + +string +| + +!Array.<string> + + + + + + + + + +

Qualified name to resolve

excludeNonNamespace + + +boolean + + + + + + <optional>
+ + + + + +

Excludes non-namespace types, defaults to false

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The resolved type or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.Namespace + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Namespace.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Namespace.html new file mode 100644 index 0000000..6fce414 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Namespace.html @@ -0,0 +1,2371 @@ + + + + + JSDoc: Class: Namespace + + + + + + + + + + +
+ +

Class: Namespace

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Namespace +

+ + +
+ +
+
+ + + + + +

new Namespace(buildernon-null, parentnullable, name, optionsopt, syntaxnullable)

+ + + + + +
+

Constructs a new Namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

parent + + +ProtoBuf.Reflect.Namespace + + + + + + + + <nullable>
+ + + +

Namespace parent

name + + +string + + + + + + + + + +

Namespace name

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Namespace options

syntax + + +string + + + + + + + + <nullable>
+ + + +

The syntax level of this definition (e.g., proto3)

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) children :Array.<ProtoBuf.Reflect.T>

+ + + + +
+

Children inside the namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) syntax :string

+ + + + +
+

Syntax level (e.g., proto2 or proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

addChild(child)

+ + + + + +
+

Adds a child to the namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
child + + +ProtoBuf.Reflect.T + + + +

Child

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the child cannot be added (duplicate)

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

build() → {Object.<string, (function()|Object)>}

+ + + + + +
+

Builds the namespace and returns the runtime counterpart.

+
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Runtime namespace

+
+ + + +
+
+ Type +
+
+ +Object.<string, (function()|Object)> + + +
+
+ + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the namespace's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

getChild(nameOrId) → (nullable) {ProtoBuf.Reflect.T}

+ + + + + +
+

Gets a child by its name or id.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nameOrId + + +string +| + +number + + + +

Child name or id

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The child or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.T + + +
+
+ + + + + + + + + + +

getChildren(typeopt) → {Array.<ProtoBuf.Reflect.T>}

+ + + + + +
+

Returns an array of the namespace's children.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
type + + +ProtoBuf.Reflect.T + + + + + + <optional>
+ + + + + +

Filter type (returns instances of this type only). Defaults to null (all children).

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<ProtoBuf.Reflect.T> + + +
+
+ + + + + + + + + + +

getOption(nameopt) → {*|Object.<string, *>}

+ + + + + +
+

Gets the value assigned to the option with the specified name.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
name + + +string + + + + + + <optional>
+ + + + + +

Returns the option value if specified, otherwise all options are returned.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

null} Option value or NULL if there is no such option

+
+ + + +
+
+ Type +
+
+ +* +| + +Object.<string, *> + + +
+
+ + + + + + + + + + +

qn(tnon-null) → {string}

+ + + + + +
+

Determines the shortest qualified name of the specified type, if any, relative to this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
t + + +ProtoBuf.Reflect.T + + + +

Reflection type

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The shortest qualified name or, if there is none, the fqn

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

resolve(qn, excludeNonNamespaceopt) → (nullable) {ProtoBuf.Reflect.Namespace}

+ + + + + +
+

Resolves a reflect object inside of this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
qn + + +string +| + +!Array.<string> + + + + + + + + + +

Qualified name to resolve

excludeNonNamespace + + +boolean + + + + + + <optional>
+ + + + + +

Excludes non-namespace types, defaults to false

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The resolved type or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.Namespace + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.Method.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.Method.html new file mode 100644 index 0000000..72a5ed3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.Method.html @@ -0,0 +1,1202 @@ + + + + + JSDoc: Class: Method + + + + + + + + + + +
+ +

Class: Method

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Service. + + Method +

+ + +
+ +
+
+ + + + + +

new Method(buildernon-null, svcnon-null, name, optionsopt)

+ + + + + +
+

Abstract service method.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

svc + + +ProtoBuf.Reflect.Service + + + + + + + + + +

Service

name + + +string + + + + + + + + + +

Method name

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the method's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.RPCMethod.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.RPCMethod.html new file mode 100644 index 0000000..e58dc69 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.RPCMethod.html @@ -0,0 +1,1768 @@ + + + + + JSDoc: Class: RPCMethod + + + + + + + + + + +
+ +

Class: RPCMethod

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect.Service. + + RPCMethod +

+ + +
+ +
+
+ + + + + +

new RPCMethod(buildernon-null, svcnon-null, name, request, response, request_stream, response_stream, optionsopt)

+ + + + + +
+

RPC service method.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

svc + + +ProtoBuf.Reflect.Service + + + + + + + + + +

Service

name + + +string + + + + + + + + + +

Method name

request + + +string + + + + + + + + + +

Request message name

response + + +string + + + + + + + + + +

Response message name

request_stream + + +boolean + + + + + + + + + +

Whether requests are streamed

response_stream + + +boolean + + + + + + + + + +

Whether responses are streamed

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

requestName :string

+ + + + +
+

Request message name.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

requestStream :bool

+ + + + +
+

Whether requests are streamed

+
+ + + +
Type:
+
    +
  • + +bool + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolvedRequestType :ProtoBuf.Reflect.Message

+ + + + +
+

Resolved request message type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

resolvedResponseType :ProtoBuf.Reflect.Message

+ + + + +
+

Resolved response message type.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

responseName :string

+ + + + +
+

Response message name.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

responseStream :bool

+ + + + +
+

Whether responses are streamed

+
+ + + +
Type:
+
    +
  • + +bool + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the method's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.html new file mode 100644 index 0000000..8cb30c6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.Service.html @@ -0,0 +1,2565 @@ + + + + + JSDoc: Class: Service + + + + + + + + + + +
+ +

Class: Service

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + Service +

+ + +
+ +
+
+ + + + + +

new Service(buildernon-null, rootnon-null, name, optionsopt)

+ + + + + +
+

Constructs a new Service.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

root + + +ProtoBuf.Reflect.Namespace + + + + + + + + + +

Root

name + + +string + + + + + + + + + +

Service name

options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + +

Classes

+ +
+
Method
+
+ +
RPCMethod
+
+
+ + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) children :Array.<ProtoBuf.Reflect.T>

+ + + + +
+

Children inside the namespace.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) clazz :function

+ + + + +
+

Built runtime service class.

+
+ + + +
Type:
+
    +
  • + +function + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) options :Object.<string, *>

+ + + + +
+

Options.

+
+ + + +
Type:
+
    +
  • + +Object.<string, *> + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(non-null) syntax :string

+ + + + +
+

Syntax level (e.g., proto2 or proto3).

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

addChild(child)

+ + + + + +
+

Adds a child to the namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
child + + +ProtoBuf.Reflect.T + + + +

Child

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the child cannot be added (duplicate)

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

build(rebuildopt) → {function}

+ + + + + +
+

Builds the service and returns the runtime counterpart, which is a fully functional class.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
rebuild + + +boolean + + + + + + <optional>
+ + + + + +

Whether to rebuild or not

+ + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the message cannot be built

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Service class

+
+ + + +
+
+ Type +
+
+ +function + + +
+
+ + + + + + + + + + +

buildOpt() → {Object.<string, *>}

+ + + + + +
+

Builds the namespace's '$options' property.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object.<string, *> + + +
+
+ + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

getChild(nameOrId) → (nullable) {ProtoBuf.Reflect.T}

+ + + + + +
+

Gets a child by its name or id.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nameOrId + + +string +| + +number + + + +

Child name or id

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The child or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.T + + +
+
+ + + + + + + + + + +

getChildren(typeopt) → {Array.<ProtoBuf.Reflect.T>}

+ + + + + +
+

Returns an array of the namespace's children.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
type + + +ProtoBuf.Reflect.T + + + + + + <optional>
+ + + + + +

Filter type (returns instances of this type only). Defaults to null (all children).

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<ProtoBuf.Reflect.T> + + +
+
+ + + + + + + + + + +

getOption(nameopt) → {*|Object.<string, *>}

+ + + + + +
+

Gets the value assigned to the option with the specified name.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
name + + +string + + + + + + <optional>
+ + + + + +

Returns the option value if specified, otherwise all options are returned.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

null} Option value or NULL if there is no such option

+
+ + + +
+
+ Type +
+
+ +* +| + +Object.<string, *> + + +
+
+ + + + + + + + + + +

qn(tnon-null) → {string}

+ + + + + +
+

Determines the shortest qualified name of the specified type, if any, relative to this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
t + + +ProtoBuf.Reflect.T + + + +

Reflection type

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The shortest qualified name or, if there is none, the fqn

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

resolve(qn, excludeNonNamespaceopt) → (nullable) {ProtoBuf.Reflect.Namespace}

+ + + + + +
+

Resolves a reflect object inside of this namespace.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
qn + + +string +| + +!Array.<string> + + + + + + + + + +

Qualified name to resolve

excludeNonNamespace + + +boolean + + + + + + <optional>
+ + + + + +

Excludes non-namespace types, defaults to false

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The resolved type or null if not found

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Reflect.Namespace + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.T.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.T.html new file mode 100644 index 0000000..bf94703 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.T.html @@ -0,0 +1,953 @@ + + + + + JSDoc: Class: T + + + + + + + + + + +
+ +

Class: T

+ + + + + + +
+ +
+ +

+ ProtoBuf.Reflect. + + T +

+ + +
+ +
+
+ + + + + +

(abstract) new T(buildernon-null, parentnullable, name)

+ + + + + +
+

Constructs a Reflect base class.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
builder + + +ProtoBuf.Builder + + + + + + + + + +

Builder reference

parent + + +ProtoBuf.Reflect.T + + + + + + + + <nullable>
+ + + +

Parent object

name + + +string + + + + + + + + + +

Object name

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(non-null) builder :ProtoBuf.Builder

+ + + + +
+

Builder reference.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

className :string

+ + + + +
+

Fully qualified class name

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + +
+

Object name in namespace.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(nullable) parent :ProtoBuf.Reflect.T

+ + + + +
+

Parent object.

+
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

build()

+ + + + + +
+

Builds this type.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If this type cannot be built directly

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + + + + + + + + + +

fqn() → {string}

+ + + + + +
+

Returns the fully qualified name of this object.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Fully qualified name as of ".PATH.TO.THIS"

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

toString(includeClassopt)

+ + + + + +
+

Returns a string representation of this Reflect object (its fully qualified name).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
includeClass + + +boolean + + + + + + <optional>
+ + + + + +

Set to true to include the class name. Defaults to false.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

String representation

+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.html new file mode 100644 index 0000000..7bc4751 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Reflect.html @@ -0,0 +1,159 @@ + + + + + JSDoc: Namespace: Reflect + + + + + + + + + + +
+ +

Namespace: Reflect

+ + + + + + +
+ +
+ +

+ ProtoBuf. + + Reflect +

+ + +
+ + + +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Util.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Util.html new file mode 100644 index 0000000..46a958c --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.Util.html @@ -0,0 +1,692 @@ + + + + + JSDoc: Namespace: Util + + + + + + + + + + +
+ +

Namespace: Util

+ + + + + + +
+ +
+ +

+ ProtoBuf. + + Util +

+ + +
+ +
+
+ + +

ProtoBuf utilities.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static, constant) IS_NODE :boolean

+ + + + +
+

Flag if running in node or not.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) fetch(path, callbackopt) → {string|undefined}

+ + + + + +
+

Fetches a resource.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
path + + +string + + + + + + + + + +

Resource path

callback + + +function + + + + + + <optional>
+ + + + + +

Callback receiving the resource's contents. If omitted the resource will + be fetched synchronously. If the request failed, contents will be null.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resource contents if callback is omitted (null if the request failed), else undefined.

+
+ + + +
+
+ Type +
+
+ +string +| + +undefined + + +
+
+ + + + + + + + + + +

(static) toCamelCase(str) → {string}

+ + + + + +
+

Converts a string to camel case.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
str + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

(static) XHR() → {XMLHttpRequest}

+ + + + + +
+

Constructs a XMLHttpRequest object.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If XMLHttpRequest is not supported

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +XMLHttpRequest + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.html new file mode 100644 index 0000000..855809c --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.html @@ -0,0 +1,3209 @@ + + + + + JSDoc: Namespace: ProtoBuf + + + + + + + + + + +
+ +

Namespace: ProtoBuf

+ + + + + + +
+ +
+ +

+ ProtoBuf +

+ + +
+ +
+
+ + +

The ProtoBuf namespace.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + +

Classes

+ +
+
Builder
+
+ +
Map
+
+
+ + + + + +

Namespaces

+ +
+
DotProto
+
+ +
Reflect
+
+ +
Util
+
+
+ + + +

Members

+ + + +

(static, non-null) ByteBuffer :function

+ + + + + + +
Type:
+
    +
  • + +function + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) convertFieldsToCamelCase :boolean

+ + + + +
+

If set to true, field names will be converted from underscore notation to camel case. Defaults to false. + Must be set prior to parsing.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) ID_MAX :number

+ + + + +
+

Maximum field id.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) ID_MIN :number

+ + + + +
+

Minimum field id.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, non-null) Lang :Object.<string, !RegExp>

+ + + + +
+

Language expressions.

+
+ + + +
Type:
+
    +
  • + +Object.<string, !RegExp> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, nullable) Long :function

+ + + + + + +
Type:
+
    +
  • + +function + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant, non-null) MAP_KEY_TYPES :Array.<!Object.<string, {name: string, wireType: number, defaultValue: *}>>

+ + + + +
+

Valid map key types.

+
+ + + +
Type:
+
    +
  • + +Array.<!Object.<string, {name: string, wireType: number, defaultValue: *}>> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant, non-null) PACKABLE_WIRE_TYPES :Array.<number>

+ + + + +
+

Packable wire types.

+
+ + + +
Type:
+
    +
  • + +Array.<number> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) populateAccessors :boolean

+ + + + +
+

By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by + setting this to false prior to building messages.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) populateDefaults :boolean

+ + + + +
+

By default, messages are populated with default values if a field is not present on the wire. To disable + this behavior, set this setting to false.

+
+ + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant, non-null) TYPES :Object.<string, {name: string, wireType: number, defaultValue: *}>

+ + + + +
+

Types.

+
+ + + +
Type:
+
    +
  • + +Object.<string, {name: string, wireType: number, defaultValue: *}> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) VERSION :string

+ + + + +
+

ProtoBuf.js version.

+
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES :Object.<string, number>

+ + + + +
+

Wire types.

+
+ + + +
Type:
+
    +
  • + +Object.<string, number> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES.BITS32 :number

+ + + + +
+

Fixed 32 bits wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES.BITS64 :number

+ + + + +
+

Fixed 64 bits wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES.ENDGROUP :number

+ + + + +
+

End group wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES.LDELIM :number

+ + + + +
+

Length delimited wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WIRE_TYPES.STARTGROUP :number

+ + + + +
+

Start group wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) WIRE_TYPES.VARINT :number

+ + + + +
+

Varint wire type.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) loadJson(json, builderopt, filenameopt) → {ProtoBuf.Builder}

+ + + + + +
+

Loads a .json definition and returns the Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
json + + +* +| + +string + + + + + + + + + +

JSON definition

builder + + +ProtoBuf.Builder +| + +string +| + +Object + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

filename + + +string +| + +Object + + + + + + <optional>
+ + + + + +

The corresponding file name if known. Must be specified for imports.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the definition cannot be parsed or built

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Builder to create new messages

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

(static) loadJsonFile(filename, callbackopt, builderopt) → {ProtoBuf.Builder|undefined}

+ + + + + +
+

Loads a .json file and returns the Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
filename + + +string +| + +Object + + + + + + + + + +

Path to json file or an object specifying 'file' with + an overridden 'root' path for all imported files.

callback + + +function + + + + + + <optional>
+ + + + + +

Callback that will receive null as the first and + the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + file will be read synchronously and this function will return the Builder.

builder + + +ProtoBuf.Builder + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The Builder if synchronous (no callback specified, will be NULL if the + request has failed), else undefined

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder +| + +undefined + + +
+
+ + + + + + + + + + +

(static) loadProto(proto, builderopt, filenameopt) → {ProtoBuf.Builder}

+ + + + + +
+

Loads a .proto string and returns the Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
proto + + +string + + + + + + + + + +

.proto file contents

builder + + +ProtoBuf.Builder +| + +string +| + +Object + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

filename + + +string +| + +Object + + + + + + <optional>
+ + + + + +

The corresponding file name if known. Must be specified for imports.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the definition cannot be parsed or built

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Builder to create new messages

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

(static) loadProtoFile(filename, callbackopt, builderopt) → {ProtoBuf.Builder|undefined}

+ + + + + +
+

Loads a .proto file and returns the Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
filename + + +string +| + +Object + + + + + + + + + +

Path to proto file or an object specifying 'file' with + an overridden 'root' path for all imported files.

callback + + +function + + + + + + <optional>
+ + + + + +

Callback that will receive null as the first and + the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + file will be read synchronously and this function will return the Builder.

builder + + +ProtoBuf.Builder + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The Builder if synchronous (no callback specified, will be NULL if the + request has failed), else undefined

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder +| + +undefined + + +
+
+ + + + + + + + + + +

(static) newBuilder(optionsopt) → (non-null) {ProtoBuf.Builder}

+ + + + + +
+

Constructs a new empty Builder.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + +Object.<string, *> + + + + + + <optional>
+ + + + + +

Builder options, defaults to global options set on ProtoBuf

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Builder

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + +

(static) protoFromFile(filename, callbackopt, builderopt) → {ProtoBuf.Builder|undefined}

+ + + + + +
+

Loads a .proto file and returns the Builder. This is an alias of ProtoBuf.loadProtoFile.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
filename + + +string +| + +Object + + + + + + + + + +

Path to proto file or an object specifying 'file' with + an overridden 'root' path for all imported files.

callback + + +function + + + + + + <optional>
+ + + + + +

Callback that will receive null as the first and + the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + file will be read synchronously and this function will return the Builder.

builder + + +ProtoBuf.Builder + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The Builder if synchronous (no callback specified, will be NULL if the + request has failed), else undefined

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder +| + +undefined + + +
+
+ + + + + + + + + + +

(static) protoFromString(proto, builderopt, filenameopt) → {ProtoBuf.Builder}

+ + + + + +
+

Loads a .proto string and returns the Builder. This is an alias of ProtoBuf.loadProto.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
proto + + +string + + + + + + + + + +

.proto file contents

builder + + +ProtoBuf.Builder +| + +string + + + + + + <optional>
+ + + + + +

Builder to append to. Will create a new one if omitted.

filename + + +string +| + +Object + + + + + + <optional>
+ + + + + +

The corresponding file name if known. Must be specified for imports.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

If the definition cannot be parsed or built

+
+
+
+
+
+
+ Type +
+
+ +Error + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+

Builder to create new messages

+
+ + + +
+
+ Type +
+
+ +ProtoBuf.Builder + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.js.html b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.js.html new file mode 100644 index 0000000..c2f28a9 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/ProtoBuf.js.html @@ -0,0 +1,5316 @@ + + + + + JSDoc: Source: protobuf.js + + + + + + + + + + +
+ +

Source: protobuf.js

+ + + + + + +
+
+
/*
+ Copyright 2013 Daniel Wirtz <dcode@dcode.io>
+
+ 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.
+ */
+
+/**
+ * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
+ * Released under the Apache License, Version 2.0
+ * see: https://github.com/dcodeIO/protobuf.js for details
+ */
+(function(global, factory) {
+
+    /* AMD */ if (typeof define === 'function' && define["amd"])
+        define(["bytebuffer"], factory);
+    /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
+        module["exports"] = factory(require("bytebuffer"), true);
+    /* Global */ else
+        (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
+
+})(this, function(ByteBuffer, isCommonJS) {
+    "use strict";
+
+    /**
+     * The ProtoBuf namespace.
+     * @exports ProtoBuf
+     * @namespace
+     * @expose
+     */
+    var ProtoBuf = {};
+
+    /**
+     * @type {!function(new: ByteBuffer, ...[*])}
+     * @expose
+     */
+    ProtoBuf.ByteBuffer = ByteBuffer;
+
+    /**
+     * @type {?function(new: Long, ...[*])}
+     * @expose
+     */
+    ProtoBuf.Long = ByteBuffer.Long || null;
+
+    /**
+     * ProtoBuf.js version.
+     * @type {string}
+     * @const
+     * @expose
+     */
+    ProtoBuf.VERSION = "5.0.2";
+
+    /**
+     * Wire types.
+     * @type {Object.<string,number>}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES = {};
+
+    /**
+     * Varint wire type.
+     * @type {number}
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.VARINT = 0;
+
+    /**
+     * Fixed 64 bits wire type.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.BITS64 = 1;
+
+    /**
+     * Length delimited wire type.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.LDELIM = 2;
+
+    /**
+     * Start group wire type.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
+
+    /**
+     * End group wire type.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
+
+    /**
+     * Fixed 32 bits wire type.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.WIRE_TYPES.BITS32 = 5;
+
+    /**
+     * Packable wire types.
+     * @type {!Array.<number>}
+     * @const
+     * @expose
+     */
+    ProtoBuf.PACKABLE_WIRE_TYPES = [
+        ProtoBuf.WIRE_TYPES.VARINT,
+        ProtoBuf.WIRE_TYPES.BITS64,
+        ProtoBuf.WIRE_TYPES.BITS32
+    ];
+
+    /**
+     * Types.
+     * @dict
+     * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
+     * @const
+     * @expose
+     */
+    ProtoBuf.TYPES = {
+        // According to the protobuf spec.
+        "int32": {
+            name: "int32",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: 0
+        },
+        "uint32": {
+            name: "uint32",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: 0
+        },
+        "sint32": {
+            name: "sint32",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: 0
+        },
+        "int64": {
+            name: "int64",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
+        },
+        "uint64": {
+            name: "uint64",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
+        },
+        "sint64": {
+            name: "sint64",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
+        },
+        "bool": {
+            name: "bool",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: false
+        },
+        "double": {
+            name: "double",
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,
+            defaultValue: 0
+        },
+        "string": {
+            name: "string",
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,
+            defaultValue: ""
+        },
+        "bytes": {
+            name: "bytes",
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,
+            defaultValue: null // overridden in the code, must be a unique instance
+        },
+        "fixed32": {
+            name: "fixed32",
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,
+            defaultValue: 0
+        },
+        "sfixed32": {
+            name: "sfixed32",
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,
+            defaultValue: 0
+        },
+        "fixed64": {
+            name: "fixed64",
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,
+            defaultValue:  ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
+        },
+        "sfixed64": {
+            name: "sfixed64",
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
+        },
+        "float": {
+            name: "float",
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,
+            defaultValue: 0
+        },
+        "enum": {
+            name: "enum",
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,
+            defaultValue: 0
+        },
+        "message": {
+            name: "message",
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,
+            defaultValue: null
+        },
+        "group": {
+            name: "group",
+            wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
+            defaultValue: null
+        }
+    };
+
+    /**
+     * Valid map key types.
+     * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
+     * @const
+     * @expose
+     */
+    ProtoBuf.MAP_KEY_TYPES = [
+        ProtoBuf.TYPES["int32"],
+        ProtoBuf.TYPES["sint32"],
+        ProtoBuf.TYPES["sfixed32"],
+        ProtoBuf.TYPES["uint32"],
+        ProtoBuf.TYPES["fixed32"],
+        ProtoBuf.TYPES["int64"],
+        ProtoBuf.TYPES["sint64"],
+        ProtoBuf.TYPES["sfixed64"],
+        ProtoBuf.TYPES["uint64"],
+        ProtoBuf.TYPES["fixed64"],
+        ProtoBuf.TYPES["bool"],
+        ProtoBuf.TYPES["string"],
+        ProtoBuf.TYPES["bytes"]
+    ];
+
+    /**
+     * Minimum field id.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.ID_MIN = 1;
+
+    /**
+     * Maximum field id.
+     * @type {number}
+     * @const
+     * @expose
+     */
+    ProtoBuf.ID_MAX = 0x1FFFFFFF;
+
+    /**
+     * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
+     *  Must be set prior to parsing.
+     * @type {boolean}
+     * @expose
+     */
+    ProtoBuf.convertFieldsToCamelCase = false;
+
+    /**
+     * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
+     *  setting this to `false` prior to building messages.
+     * @type {boolean}
+     * @expose
+     */
+    ProtoBuf.populateAccessors = true;
+
+    /**
+     * By default, messages are populated with default values if a field is not present on the wire. To disable
+     *  this behavior, set this setting to `false`.
+     * @type {boolean}
+     * @expose
+     */
+    ProtoBuf.populateDefaults = true;
+
+    /**
+     * @alias ProtoBuf.Util
+     * @expose
+     */
+    ProtoBuf.Util = (function() {
+        "use strict";
+
+        /**
+         * ProtoBuf utilities.
+         * @exports ProtoBuf.Util
+         * @namespace
+         */
+        var Util = {};
+
+        /**
+         * Flag if running in node or not.
+         * @type {boolean}
+         * @const
+         * @expose
+         */
+        Util.IS_NODE = !!(
+            typeof process === 'object' && process+'' === '[object process]' && !process['browser']
+        );
+
+        /**
+         * Constructs a XMLHttpRequest object.
+         * @return {XMLHttpRequest}
+         * @throws {Error} If XMLHttpRequest is not supported
+         * @expose
+         */
+        Util.XHR = function() {
+            // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
+            var XMLHttpFactories = [
+                function () {return new XMLHttpRequest()},
+                function () {return new ActiveXObject("Msxml2.XMLHTTP")},
+                function () {return new ActiveXObject("Msxml3.XMLHTTP")},
+                function () {return new ActiveXObject("Microsoft.XMLHTTP")}
+            ];
+            /** @type {?XMLHttpRequest} */
+            var xhr = null;
+            for (var i=0;i<XMLHttpFactories.length;i++) {
+                try { xhr = XMLHttpFactories[i](); }
+                catch (e) { continue; }
+                break;
+            }
+            if (!xhr)
+                throw Error("XMLHttpRequest is not supported");
+            return xhr;
+        };
+
+        /**
+         * Fetches a resource.
+         * @param {string} path Resource path
+         * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
+         *   be fetched synchronously. If the request failed, contents will be null.
+         * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
+         * @expose
+         */
+        Util.fetch = function(path, callback) {
+            if (callback && typeof callback != 'function')
+                callback = null;
+            if (Util.IS_NODE) {
+                var fs = require("fs");
+                if (callback) {
+                    fs.readFile(path, function(err, data) {
+                        if (err)
+                            callback(null);
+                        else
+                            callback(""+data);
+                    });
+                } else
+                    try {
+                        return fs.readFileSync(path);
+                    } catch (e) {
+                        return null;
+                    }
+            } else {
+                var xhr = Util.XHR();
+                xhr.open('GET', path, callback ? true : false);
+                // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
+                xhr.setRequestHeader('Accept', 'text/plain');
+                if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
+                if (callback) {
+                    xhr.onreadystatechange = function() {
+                        if (xhr.readyState != 4) return;
+                        if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
+                            callback(xhr.responseText);
+                        else
+                            callback(null);
+                    };
+                    if (xhr.readyState == 4)
+                        return;
+                    xhr.send(null);
+                } else {
+                    xhr.send(null);
+                    if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
+                        return xhr.responseText;
+                    return null;
+                }
+            }
+        };
+
+        /**
+         * Converts a string to camel case.
+         * @param {string} str
+         * @returns {string}
+         * @expose
+         */
+        Util.toCamelCase = function(str) {
+            return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
+                return $1.toUpperCase();
+            });
+        };
+
+        return Util;
+    })();
+
+    /**
+     * Language expressions.
+     * @type {!Object.<string,!RegExp>}
+     * @expose
+     */
+    ProtoBuf.Lang = {
+
+        // Characters always ending a statement
+        DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
+
+        // Field rules
+        RULE: /^(?:required|optional|repeated|map)$/,
+
+        // Field types
+        TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
+
+        // Names
+        NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
+
+        // Type definitions
+        TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
+
+        // Type references
+        TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,
+
+        // Fully qualified type references
+        FQTYPEREF: /^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,
+
+        // All numbers
+        NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
+
+        // Decimal numbers
+        NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
+
+        // Hexadecimal numbers
+        NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
+
+        // Octal numbers
+        NUMBER_OCT: /^0[0-7]+$/,
+
+        // Floating point numbers
+        NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
+
+        // Booleans
+        BOOL: /^(?:true|false)$/i,
+
+        // Id numbers
+        ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
+
+        // Negative id numbers (enum values)
+        NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
+
+        // Whitespaces
+        WHITESPACE: /\s/,
+
+        // All strings
+        STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
+
+        // Double quoted strings
+        STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
+
+        // Single quoted strings
+        STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
+    };
+
+    /**
+     * @alias ProtoBuf.DotProto
+     * @expose
+     */
+    ProtoBuf.DotProto = (function(ProtoBuf, Lang) {
+        "use strict";
+
+        /**
+         * Utilities to parse .proto files.
+         * @exports ProtoBuf.DotProto
+         * @namespace
+         */
+        var DotProto = {};
+
+        /**
+         * Constructs a new Tokenizer.
+         * @exports ProtoBuf.DotProto.Tokenizer
+         * @class prototype tokenizer
+         * @param {string} proto Proto to tokenize
+         * @constructor
+         */
+        var Tokenizer = function(proto) {
+
+            /**
+             * Source to parse.
+             * @type {string}
+             * @expose
+             */
+            this.source = proto+"";
+
+            /**
+             * Current index.
+             * @type {number}
+             * @expose
+             */
+            this.index = 0;
+
+            /**
+             * Current line.
+             * @type {number}
+             * @expose
+             */
+            this.line = 1;
+
+            /**
+             * Token stack.
+             * @type {!Array.<string>}
+             * @expose
+             */
+            this.stack = [];
+
+            /**
+             * Opening character of the current string read, if any.
+             * @type {?string}
+             * @private
+             */
+            this._stringOpen = null;
+        };
+
+        /**
+         * @alias ProtoBuf.DotProto.Tokenizer.prototype
+         * @inner
+         */
+        var TokenizerPrototype = Tokenizer.prototype;
+
+        /**
+         * Reads a string beginning at the current index.
+         * @return {string}
+         * @private
+         */
+        TokenizerPrototype._readString = function() {
+            var re = this._stringOpen === '"'
+                ? Lang.STRING_DQ
+                : Lang.STRING_SQ;
+            re.lastIndex = this.index - 1; // Include the open quote
+            var match = re.exec(this.source);
+            if (!match)
+                throw Error("unterminated string");
+            this.index = re.lastIndex;
+            this.stack.push(this._stringOpen);
+            this._stringOpen = null;
+            return match[1];
+        };
+
+        /**
+         * Gets the next token and advances by one.
+         * @return {?string} Token or `null` on EOF
+         * @expose
+         */
+        TokenizerPrototype.next = function() {
+            if (this.stack.length > 0)
+                return this.stack.shift();
+            if (this.index >= this.source.length)
+                return null;
+            if (this._stringOpen !== null)
+                return this._readString();
+
+            var repeat,
+                prev,
+                next;
+            do {
+                repeat = false;
+
+                // Strip white spaces
+                while (Lang.WHITESPACE.test(next = this.source.charAt(this.index))) {
+                    if (next === '\n')
+                        ++this.line;
+                    if (++this.index === this.source.length)
+                        return null;
+                }
+
+                // Strip comments
+                if (this.source.charAt(this.index) === '/') {
+                    ++this.index;
+                    if (this.source.charAt(this.index) === '/') { // Line
+                        while (this.source.charAt(++this.index) !== '\n')
+                            if (this.index == this.source.length)
+                                return null;
+                        ++this.index;
+                        ++this.line;
+                        repeat = true;
+                    } else if ((next = this.source.charAt(this.index)) === '*') { /* Block */
+                        do {
+                            if (next === '\n')
+                                ++this.line;
+                            if (++this.index === this.source.length)
+                                return null;
+                            prev = next;
+                            next = this.source.charAt(this.index);
+                        } while (prev !== '*' || next !== '/');
+                        ++this.index;
+                        repeat = true;
+                    } else
+                        return '/';
+                }
+            } while (repeat);
+
+            if (this.index === this.source.length)
+                return null;
+
+            // Read the next token
+            var end = this.index;
+            Lang.DELIM.lastIndex = 0;
+            var delim = Lang.DELIM.test(this.source.charAt(end++));
+            if (!delim)
+                while(end < this.source.length && !Lang.DELIM.test(this.source.charAt(end)))
+                    ++end;
+            var token = this.source.substring(this.index, this.index = end);
+            if (token === '"' || token === "'")
+                this._stringOpen = token;
+            return token;
+        };
+
+        /**
+         * Peeks for the next token.
+         * @return {?string} Token or `null` on EOF
+         * @expose
+         */
+        TokenizerPrototype.peek = function() {
+            if (this.stack.length === 0) {
+                var token = this.next();
+                if (token === null)
+                    return null;
+                this.stack.push(token);
+            }
+            return this.stack[0];
+        };
+
+        /**
+         * Skips a specific token and throws if it differs.
+         * @param {string} expected Expected token
+         * @throws {Error} If the actual token differs
+         */
+        TokenizerPrototype.skip = function(expected) {
+            var actual = this.next();
+            if (actual !== expected)
+                throw Error("illegal '"+actual+"', '"+expected+"' expected");
+        };
+
+        /**
+         * Omits an optional token.
+         * @param {string} expected Expected optional token
+         * @returns {boolean} `true` if the token exists
+         */
+        TokenizerPrototype.omit = function(expected) {
+            if (this.peek() === expected) {
+                this.next();
+                return true;
+            }
+            return false;
+        };
+
+        /**
+         * Returns a string representation of this object.
+         * @return {string} String representation as of "Tokenizer(index/length)"
+         * @expose
+         */
+        TokenizerPrototype.toString = function() {
+            return "Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")";
+        };
+
+        /**
+         * @alias ProtoBuf.DotProto.Tokenizer
+         * @expose
+         */
+        DotProto.Tokenizer = Tokenizer;
+
+        /**
+         * Constructs a new Parser.
+         * @exports ProtoBuf.DotProto.Parser
+         * @class prototype parser
+         * @param {string} source Source
+         * @constructor
+         */
+        var Parser = function(source) {
+
+            /**
+             * Tokenizer.
+             * @type {!ProtoBuf.DotProto.Tokenizer}
+             * @expose
+             */
+            this.tn = new Tokenizer(source);
+
+            /**
+             * Whether parsing proto3 or not.
+             * @type {boolean}
+             */
+            this.proto3 = false;
+        };
+
+        /**
+         * @alias ProtoBuf.DotProto.Parser.prototype
+         * @inner
+         */
+        var ParserPrototype = Parser.prototype;
+
+        /**
+         * Parses the source.
+         * @returns {!Object}
+         * @throws {Error} If the source cannot be parsed
+         * @expose
+         */
+        ParserPrototype.parse = function() {
+            var topLevel = {
+                "name": "[ROOT]", // temporary
+                "package": null,
+                "messages": [],
+                "enums": [],
+                "imports": [],
+                "options": {},
+                "services": []
+                // "syntax": undefined
+            };
+            var token,
+                head = true,
+                weak;
+            try {
+                while (token = this.tn.next()) {
+                    switch (token) {
+                        case 'package':
+                            if (!head || topLevel["package"] !== null)
+                                throw Error("unexpected 'package'");
+                            token = this.tn.next();
+                            if (!Lang.TYPEREF.test(token))
+                                throw Error("illegal package name: " + token);
+                            this.tn.skip(";");
+                            topLevel["package"] = token;
+                            break;
+                        case 'import':
+                            if (!head)
+                                throw Error("unexpected 'import'");
+                            token = this.tn.peek();
+                            if (token === "public" || (weak = token === "weak")) // token ignored
+                                this.tn.next();
+                            token = this._readString();
+                            this.tn.skip(";");
+                            if (!weak) // import ignored
+                                topLevel["imports"].push(token);
+                            break;
+                        case 'syntax':
+                            if (!head)
+                                throw Error("unexpected 'syntax'");
+                            this.tn.skip("=");
+                            if ((topLevel["syntax"] = this._readString()) === "proto3")
+                                this.proto3 = true;
+                            this.tn.skip(";");
+                            break;
+                        case 'message':
+                            this._parseMessage(topLevel, null);
+                            head = false;
+                            break;
+                        case 'enum':
+                            this._parseEnum(topLevel);
+                            head = false;
+                            break;
+                        case 'option':
+                            this._parseOption(topLevel);
+                            break;
+                        case 'service':
+                            this._parseService(topLevel);
+                            break;
+                        case 'extend':
+                            this._parseExtend(topLevel);
+                            break;
+                        default:
+                            throw Error("unexpected '" + token + "'");
+                    }
+                }
+            } catch (e) {
+                e.message = "Parse error at line "+this.tn.line+": " + e.message;
+                throw e;
+            }
+            delete topLevel["name"];
+            return topLevel;
+        };
+
+        /**
+         * Parses the specified source.
+         * @returns {!Object}
+         * @throws {Error} If the source cannot be parsed
+         * @expose
+         */
+        Parser.parse = function(source) {
+            return new Parser(source).parse();
+        };
+
+        // ----- Conversion ------
+
+        /**
+         * Converts a numerical string to an id.
+         * @param {string} value
+         * @param {boolean=} mayBeNegative
+         * @returns {number}
+         * @inner
+         */
+        function mkId(value, mayBeNegative) {
+            var id = -1,
+                sign = 1;
+            if (value.charAt(0) == '-') {
+                sign = -1;
+                value = value.substring(1);
+            }
+            if (Lang.NUMBER_DEC.test(value))
+                id = parseInt(value);
+            else if (Lang.NUMBER_HEX.test(value))
+                id = parseInt(value.substring(2), 16);
+            else if (Lang.NUMBER_OCT.test(value))
+                id = parseInt(value.substring(1), 8);
+            else
+                throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value);
+            id = (sign*id)|0; // Force to 32bit
+            if (!mayBeNegative && id < 0)
+                throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value);
+            return id;
+        }
+
+        /**
+         * Converts a numerical string to a number.
+         * @param {string} val
+         * @returns {number}
+         * @inner
+         */
+        function mkNumber(val) {
+            var sign = 1;
+            if (val.charAt(0) == '-') {
+                sign = -1;
+                val = val.substring(1);
+            }
+            if (Lang.NUMBER_DEC.test(val))
+                return sign * parseInt(val, 10);
+            else if (Lang.NUMBER_HEX.test(val))
+                return sign * parseInt(val.substring(2), 16);
+            else if (Lang.NUMBER_OCT.test(val))
+                return sign * parseInt(val.substring(1), 8);
+            else if (val === 'inf')
+                return sign * Infinity;
+            else if (val === 'nan')
+                return NaN;
+            else if (Lang.NUMBER_FLT.test(val))
+                return sign * parseFloat(val);
+            throw Error("illegal number value: " + (sign < 0 ? '-' : '') + val);
+        }
+
+        // ----- Reading ------
+
+        /**
+         * Reads a string.
+         * @returns {string}
+         * @private
+         */
+        ParserPrototype._readString = function() {
+            var value = "",
+                token,
+                delim;
+            do {
+                delim = this.tn.next();
+                if (delim !== "'" && delim !== '"')
+                    throw Error("illegal string delimiter: "+delim);
+                value += this.tn.next();
+                this.tn.skip(delim);
+                token = this.tn.peek();
+            } while (token === '"' || token === '"'); // multi line?
+            return value;
+        };
+
+        /**
+         * Reads a value.
+         * @param {boolean=} mayBeTypeRef
+         * @returns {number|boolean|string}
+         * @private
+         */
+        ParserPrototype._readValue = function(mayBeTypeRef) {
+            var token = this.tn.peek(),
+                value;
+            if (token === '"' || token === "'")
+                return this._readString();
+            this.tn.next();
+            if (Lang.NUMBER.test(token))
+                return mkNumber(token);
+            if (Lang.BOOL.test(token))
+                return (token.toLowerCase() === 'true');
+            if (mayBeTypeRef && Lang.TYPEREF.test(token))
+                return token;
+            throw Error("illegal value: "+token);
+
+        };
+
+        // ----- Parsing constructs -----
+
+        /**
+         * Parses a namespace option.
+         * @param {!Object} parent Parent definition
+         * @param {boolean=} isList
+         * @private
+         */
+        ParserPrototype._parseOption = function(parent, isList) {
+            var token = this.tn.next(),
+                custom = false;
+            if (token === '(') {
+                custom = true;
+                token = this.tn.next();
+            }
+            if (!Lang.TYPEREF.test(token))
+                // we can allow options of the form google.protobuf.* since they will just get ignored anyways
+                // if (!/google\.protobuf\./.test(token)) // FIXME: Why should that not be a valid typeref?
+                    throw Error("illegal option name: "+token);
+            var name = token;
+            if (custom) { // (my_method_option).foo, (my_method_option), some_method_option, (foo.my_option).bar
+                this.tn.skip(')');
+                name = '('+name+')';
+                token = this.tn.peek();
+                if (Lang.FQTYPEREF.test(token)) {
+                    name += token;
+                    this.tn.next();
+                }
+            }
+            this.tn.skip('=');
+            this._parseOptionValue(parent, name);
+            if (!isList)
+                this.tn.skip(";");
+        };
+
+        /**
+         * Sets an option on the specified options object.
+         * @param {!Object.<string,*>} options
+         * @param {string} name
+         * @param {string|number|boolean} value
+         * @inner
+         */
+        function setOption(options, name, value) {
+            if (typeof options[name] === 'undefined')
+                options[name] = value;
+            else {
+                if (!Array.isArray(options[name]))
+                    options[name] = [ options[name] ];
+                options[name].push(value);
+            }
+        }
+
+        /**
+         * Parses an option value.
+         * @param {!Object} parent
+         * @param {string} name
+         * @private
+         */
+        ParserPrototype._parseOptionValue = function(parent, name) {
+            var token = this.tn.peek();
+            if (token !== '{') { // Plain value
+                setOption(parent["options"], name, this._readValue(true));
+            } else { // Aggregate options
+                this.tn.skip("{");
+                while ((token = this.tn.next()) !== '}') {
+                    if (!Lang.NAME.test(token))
+                        throw Error("illegal option name: " + name + "." + token);
+                    if (this.tn.omit(":"))
+                        setOption(parent["options"], name + "." + token, this._readValue(true));
+                    else
+                        this._parseOptionValue(parent, name + "." + token);
+                }
+            }
+        };
+
+        /**
+         * Parses a service definition.
+         * @param {!Object} parent Parent definition
+         * @private
+         */
+        ParserPrototype._parseService = function(parent) {
+            var token = this.tn.next();
+            if (!Lang.NAME.test(token))
+                throw Error("illegal service name at line "+this.tn.line+": "+token);
+            var name = token;
+            var svc = {
+                "name": name,
+                "rpc": {},
+                "options": {}
+            };
+            this.tn.skip("{");
+            while ((token = this.tn.next()) !== '}') {
+                if (token === "option")
+                    this._parseOption(svc);
+                else if (token === 'rpc')
+                    this._parseServiceRPC(svc);
+                else
+                    throw Error("illegal service token: "+token);
+            }
+            this.tn.omit(";");
+            parent["services"].push(svc);
+        };
+
+        /**
+         * Parses a RPC service definition of the form ['rpc', name, (request), 'returns', (response)].
+         * @param {!Object} svc Service definition
+         * @private
+         */
+        ParserPrototype._parseServiceRPC = function(svc) {
+            var type = "rpc",
+                token = this.tn.next();
+            if (!Lang.NAME.test(token))
+                throw Error("illegal rpc service method name: "+token);
+            var name = token;
+            var method = {
+                "request": null,
+                "response": null,
+                "request_stream": false,
+                "response_stream": false,
+                "options": {}
+            };
+            this.tn.skip("(");
+            token = this.tn.next();
+            if (token.toLowerCase() === "stream") {
+              method["request_stream"] = true;
+              token = this.tn.next();
+            }
+            if (!Lang.TYPEREF.test(token))
+                throw Error("illegal rpc service request type: "+token);
+            method["request"] = token;
+            this.tn.skip(")");
+            token = this.tn.next();
+            if (token.toLowerCase() !== "returns")
+                throw Error("illegal rpc service request type delimiter: "+token);
+            this.tn.skip("(");
+            token = this.tn.next();
+            if (token.toLowerCase() === "stream") {
+              method["response_stream"] = true;
+              token = this.tn.next();
+            }
+            method["response"] = token;
+            this.tn.skip(")");
+            token = this.tn.peek();
+            if (token === '{') {
+                this.tn.next();
+                while ((token = this.tn.next()) !== '}') {
+                    if (token === 'option')
+                        this._parseOption(method);
+                    else
+                        throw Error("illegal rpc service token: " + token);
+                }
+                this.tn.omit(";");
+            } else
+                this.tn.skip(";");
+            if (typeof svc[type] === 'undefined')
+                svc[type] = {};
+            svc[type][name] = method;
+        };
+
+        /**
+         * Parses a message definition.
+         * @param {!Object} parent Parent definition
+         * @param {!Object=} fld Field definition if this is a group
+         * @returns {!Object}
+         * @private
+         */
+        ParserPrototype._parseMessage = function(parent, fld) {
+            var isGroup = !!fld,
+                token = this.tn.next();
+            var msg = {
+                "name": "",
+                "fields": [],
+                "enums": [],
+                "messages": [],
+                "options": {},
+                "services": [],
+                "oneofs": {}
+                // "extensions": undefined
+            };
+            if (!Lang.NAME.test(token))
+                throw Error("illegal "+(isGroup ? "group" : "message")+" name: "+token);
+            msg["name"] = token;
+            if (isGroup) {
+                this.tn.skip("=");
+                fld["id"] = mkId(this.tn.next());
+                msg["isGroup"] = true;
+            }
+            token = this.tn.peek();
+            if (token === '[' && fld)
+                this._parseFieldOptions(fld);
+            this.tn.skip("{");
+            while ((token = this.tn.next()) !== '}') {
+                if (Lang.RULE.test(token))
+                    this._parseMessageField(msg, token);
+                else if (token === "oneof")
+                    this._parseMessageOneOf(msg);
+                else if (token === "enum")
+                    this._parseEnum(msg);
+                else if (token === "message")
+                    this._parseMessage(msg);
+                else if (token === "option")
+                    this._parseOption(msg);
+                else if (token === "service")
+                    this._parseService(msg);
+                else if (token === "extensions")
+                    if (msg.hasOwnProperty("extensions")) {
+                        msg["extensions"] = msg["extensions"].concat(this._parseExtensionRanges())
+                    } else {
+                        msg["extensions"] = this._parseExtensionRanges();
+                    }
+                else if (token === "reserved")
+                    this._parseIgnored(); // TODO
+                else if (token === "extend")
+                    this._parseExtend(msg);
+                else if (Lang.TYPEREF.test(token)) {
+                    if (!this.proto3)
+                        throw Error("illegal field rule: "+token);
+                    this._parseMessageField(msg, "optional", token);
+                } else
+                    throw Error("illegal message token: "+token);
+            }
+            this.tn.omit(";");
+            parent["messages"].push(msg);
+            return msg;
+        };
+
+        /**
+         * Parses an ignored statement.
+         * @private
+         */
+        ParserPrototype._parseIgnored = function() {
+            while (this.tn.peek() !== ';')
+                this.tn.next();
+            this.tn.skip(";");
+        };
+
+        /**
+         * Parses a message field.
+         * @param {!Object} msg Message definition
+         * @param {string} rule Field rule
+         * @param {string=} type Field type if already known (never known for maps)
+         * @returns {!Object} Field descriptor
+         * @private
+         */
+        ParserPrototype._parseMessageField = function(msg, rule, type) {
+            if (!Lang.RULE.test(rule))
+                throw Error("illegal message field rule: "+rule);
+            var fld = {
+                "rule": rule,
+                "type": "",
+                "name": "",
+                "options": {},
+                "id": 0
+            };
+            var token;
+            if (rule === "map") {
+
+                if (type)
+                    throw Error("illegal type: " + type);
+                this.tn.skip('<');
+                token = this.tn.next();
+                if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token))
+                    throw Error("illegal message field type: " + token);
+                fld["keytype"] = token;
+                this.tn.skip(',');
+                token = this.tn.next();
+                if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token))
+                    throw Error("illegal message field: " + token);
+                fld["type"] = token;
+                this.tn.skip('>');
+                token = this.tn.next();
+                if (!Lang.NAME.test(token))
+                    throw Error("illegal message field name: " + token);
+                fld["name"] = token;
+                this.tn.skip("=");
+                fld["id"] = mkId(this.tn.next());
+                token = this.tn.peek();
+                if (token === '[')
+                    this._parseFieldOptions(fld);
+                this.tn.skip(";");
+
+            } else {
+
+                type = typeof type !== 'undefined' ? type : this.tn.next();
+
+                if (type === "group") {
+
+                    // "A [legacy] group simply combines a nested message type and a field into a single declaration. In your
+                    // code, you can treat this message just as if it had a Result type field called result (the latter name is
+                    // converted to lower-case so that it does not conflict with the former)."
+                    var grp = this._parseMessage(msg, fld);
+                    if (!/^[A-Z]/.test(grp["name"]))
+                        throw Error('illegal group name: '+grp["name"]);
+                    fld["type"] = grp["name"];
+                    fld["name"] = grp["name"].toLowerCase();
+                    this.tn.omit(";");
+
+                } else {
+
+                    if (!Lang.TYPE.test(type) && !Lang.TYPEREF.test(type))
+                        throw Error("illegal message field type: " + type);
+                    fld["type"] = type;
+                    token = this.tn.next();
+                    if (!Lang.NAME.test(token))
+                        throw Error("illegal message field name: " + token);
+                    fld["name"] = token;
+                    this.tn.skip("=");
+                    fld["id"] = mkId(this.tn.next());
+                    token = this.tn.peek();
+                    if (token === "[")
+                        this._parseFieldOptions(fld);
+                    this.tn.skip(";");
+
+                }
+            }
+            msg["fields"].push(fld);
+            return fld;
+        };
+
+        /**
+         * Parses a message oneof.
+         * @param {!Object} msg Message definition
+         * @private
+         */
+        ParserPrototype._parseMessageOneOf = function(msg) {
+            var token = this.tn.next();
+            if (!Lang.NAME.test(token))
+                throw Error("illegal oneof name: "+token);
+            var name = token,
+                fld;
+            var fields = [];
+            this.tn.skip("{");
+            while ((token = this.tn.next()) !== "}") {
+                fld = this._parseMessageField(msg, "optional", token);
+                fld["oneof"] = name;
+                fields.push(fld["id"]);
+            }
+            this.tn.omit(";");
+            msg["oneofs"][name] = fields;
+        };
+
+        /**
+         * Parses a set of field option definitions.
+         * @param {!Object} fld Field definition
+         * @private
+         */
+        ParserPrototype._parseFieldOptions = function(fld) {
+            this.tn.skip("[");
+            var token,
+                first = true;
+            while ((token = this.tn.peek()) !== ']') {
+                if (!first)
+                    this.tn.skip(",");
+                this._parseOption(fld, true);
+                first = false;
+            }
+            this.tn.next();
+        };
+
+        /**
+         * Parses an enum.
+         * @param {!Object} msg Message definition
+         * @private
+         */
+        ParserPrototype._parseEnum = function(msg) {
+            var enm = {
+                "name": "",
+                "values": [],
+                "options": {}
+            };
+            var token = this.tn.next();
+            if (!Lang.NAME.test(token))
+                throw Error("illegal name: "+token);
+            enm["name"] = token;
+            this.tn.skip("{");
+            while ((token = this.tn.next()) !== '}') {
+                if (token === "option")
+                    this._parseOption(enm);
+                else {
+                    if (!Lang.NAME.test(token))
+                        throw Error("illegal name: "+token);
+                    this.tn.skip("=");
+                    var val = {
+                        "name": token,
+                        "id": mkId(this.tn.next(), true)
+                    };
+                    token = this.tn.peek();
+                    if (token === "[")
+                        this._parseFieldOptions({ "options": {} });
+                    this.tn.skip(";");
+                    enm["values"].push(val);
+                }
+            }
+            this.tn.omit(";");
+            msg["enums"].push(enm);
+        };
+
+        /**
+         * Parses extension / reserved ranges.
+         * @returns {!Array.<!Array.<number>>}
+         * @private
+         */
+        ParserPrototype._parseExtensionRanges = function() {
+            var ranges = [];
+            var token,
+                range,
+                value;
+            do {
+                range = [];
+                while (true) {
+                    token = this.tn.next();
+                    switch (token) {
+                        case "min":
+                            value = ProtoBuf.ID_MIN;
+                            break;
+                        case "max":
+                            value = ProtoBuf.ID_MAX;
+                            break;
+                        default:
+                            value = mkNumber(token);
+                            break;
+                    }
+                    range.push(value);
+                    if (range.length === 2)
+                        break;
+                    if (this.tn.peek() !== "to") {
+                        range.push(value);
+                        break;
+                    }
+                    this.tn.next();
+                }
+                ranges.push(range);
+            } while (this.tn.omit(","));
+            this.tn.skip(";");
+            return ranges;
+        };
+
+        /**
+         * Parses an extend block.
+         * @param {!Object} parent Parent object
+         * @private
+         */
+        ParserPrototype._parseExtend = function(parent) {
+            var token = this.tn.next();
+            if (!Lang.TYPEREF.test(token))
+                throw Error("illegal extend reference: "+token);
+            var ext = {
+                "ref": token,
+                "fields": []
+            };
+            this.tn.skip("{");
+            while ((token = this.tn.next()) !== '}') {
+                if (Lang.RULE.test(token))
+                    this._parseMessageField(ext, token);
+                else if (Lang.TYPEREF.test(token)) {
+                    if (!this.proto3)
+                        throw Error("illegal field rule: "+token);
+                    this._parseMessageField(ext, "optional", token);
+                } else
+                    throw Error("illegal extend token: "+token);
+            }
+            this.tn.omit(";");
+            parent["messages"].push(ext);
+            return ext;
+        };
+
+        // ----- General -----
+
+        /**
+         * Returns a string representation of this parser.
+         * @returns {string}
+         */
+        ParserPrototype.toString = function() {
+            return "Parser at line "+this.tn.line;
+        };
+
+        /**
+         * @alias ProtoBuf.DotProto.Parser
+         * @expose
+         */
+        DotProto.Parser = Parser;
+
+        return DotProto;
+
+    })(ProtoBuf, ProtoBuf.Lang);
+
+    /**
+     * @alias ProtoBuf.Reflect
+     * @expose
+     */
+    ProtoBuf.Reflect = (function(ProtoBuf) {
+        "use strict";
+
+        /**
+         * Reflection types.
+         * @exports ProtoBuf.Reflect
+         * @namespace
+         */
+        var Reflect = {};
+
+        /**
+         * Constructs a Reflect base class.
+         * @exports ProtoBuf.Reflect.T
+         * @constructor
+         * @abstract
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {?ProtoBuf.Reflect.T} parent Parent object
+         * @param {string} name Object name
+         */
+        var T = function(builder, parent, name) {
+
+            /**
+             * Builder reference.
+             * @type {!ProtoBuf.Builder}
+             * @expose
+             */
+            this.builder = builder;
+
+            /**
+             * Parent object.
+             * @type {?ProtoBuf.Reflect.T}
+             * @expose
+             */
+            this.parent = parent;
+
+            /**
+             * Object name in namespace.
+             * @type {string}
+             * @expose
+             */
+            this.name = name;
+
+            /**
+             * Fully qualified class name
+             * @type {string}
+             * @expose
+             */
+            this.className;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.T.prototype
+         * @inner
+         */
+        var TPrototype = T.prototype;
+
+        /**
+         * Returns the fully qualified name of this object.
+         * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
+         * @expose
+         */
+        TPrototype.fqn = function() {
+            var name = this.name,
+                ptr = this;
+            do {
+                ptr = ptr.parent;
+                if (ptr == null)
+                    break;
+                name = ptr.name+"."+name;
+            } while (true);
+            return name;
+        };
+
+        /**
+         * Returns a string representation of this Reflect object (its fully qualified name).
+         * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
+         * @return String representation
+         * @expose
+         */
+        TPrototype.toString = function(includeClass) {
+            return (includeClass ? this.className + " " : "") + this.fqn();
+        };
+
+        /**
+         * Builds this type.
+         * @throws {Error} If this type cannot be built directly
+         * @expose
+         */
+        TPrototype.build = function() {
+            throw Error(this.toString(true)+" cannot be built directly");
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.T
+         * @expose
+         */
+        Reflect.T = T;
+
+        /**
+         * Constructs a new Namespace.
+         * @exports ProtoBuf.Reflect.Namespace
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
+         * @param {string} name Namespace name
+         * @param {Object.<string,*>=} options Namespace options
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)
+         * @constructor
+         * @extends ProtoBuf.Reflect.T
+         */
+        var Namespace = function(builder, parent, name, options, syntax) {
+            T.call(this, builder, parent, name);
+
+            /**
+             * @override
+             */
+            this.className = "Namespace";
+
+            /**
+             * Children inside the namespace.
+             * @type {!Array.<ProtoBuf.Reflect.T>}
+             */
+            this.children = [];
+
+            /**
+             * Options.
+             * @type {!Object.<string, *>}
+             */
+            this.options = options || {};
+
+            /**
+             * Syntax level (e.g., proto2 or proto3).
+             * @type {!string}
+             */
+            this.syntax = syntax || "proto2";
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Namespace.prototype
+         * @inner
+         */
+        var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
+
+        /**
+         * Returns an array of the namespace's children.
+         * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
+         * @return {Array.<ProtoBuf.Reflect.T>}
+         * @expose
+         */
+        NamespacePrototype.getChildren = function(type) {
+            type = type || null;
+            if (type == null)
+                return this.children.slice();
+            var children = [];
+            for (var i=0, k=this.children.length; i<k; ++i)
+                if (this.children[i] instanceof type)
+                    children.push(this.children[i]);
+            return children;
+        };
+
+        /**
+         * Adds a child to the namespace.
+         * @param {ProtoBuf.Reflect.T} child Child
+         * @throws {Error} If the child cannot be added (duplicate)
+         * @expose
+         */
+        NamespacePrototype.addChild = function(child) {
+            var other;
+            if (other = this.getChild(child.name)) {
+                // Try to revert camelcase transformation on collision
+                if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
+                    other.name = other.originalName; // Revert previous first (effectively keeps both originals)
+                else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
+                    child.name = child.originalName;
+                else
+                    throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
+            }
+            this.children.push(child);
+        };
+
+        /**
+         * Gets a child by its name or id.
+         * @param {string|number} nameOrId Child name or id
+         * @return {?ProtoBuf.Reflect.T} The child or null if not found
+         * @expose
+         */
+        NamespacePrototype.getChild = function(nameOrId) {
+            var key = typeof nameOrId === 'number' ? 'id' : 'name';
+            for (var i=0, k=this.children.length; i<k; ++i)
+                if (this.children[i][key] === nameOrId)
+                    return this.children[i];
+            return null;
+        };
+
+        /**
+         * Resolves a reflect object inside of this namespace.
+         * @param {string|!Array.<string>} qn Qualified name to resolve
+         * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
+         * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
+         * @expose
+         */
+        NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
+            var part = typeof qn === 'string' ? qn.split(".") : qn,
+                ptr = this,
+                i = 0;
+            if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
+                while (ptr.parent !== null)
+                    ptr = ptr.parent;
+                i++;
+            }
+            var child;
+            do {
+                do {
+                    if (!(ptr instanceof Reflect.Namespace)) {
+                        ptr = null;
+                        break;
+                    }
+                    child = ptr.getChild(part[i]);
+                    if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
+                        ptr = null;
+                        break;
+                    }
+                    ptr = child; i++;
+                } while (i < part.length);
+                if (ptr != null)
+                    break; // Found
+                // Else search the parent
+                if (this.parent !== null)
+                    return this.parent.resolve(qn, excludeNonNamespace);
+            } while (ptr != null);
+            return ptr;
+        };
+
+        /**
+         * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
+         * @param {!ProtoBuf.Reflect.T} t Reflection type
+         * @returns {string} The shortest qualified name or, if there is none, the fqn
+         * @expose
+         */
+        NamespacePrototype.qn = function(t) {
+            var part = [], ptr = t;
+            do {
+                part.unshift(ptr.name);
+                ptr = ptr.parent;
+            } while (ptr !== null);
+            for (var len=1; len <= part.length; len++) {
+                var qn = part.slice(part.length-len);
+                if (t === this.resolve(qn, t instanceof Reflect.Namespace))
+                    return qn.join(".");
+            }
+            return t.fqn();
+        };
+
+        /**
+         * Builds the namespace and returns the runtime counterpart.
+         * @return {Object.<string,Function|Object>} Runtime namespace
+         * @expose
+         */
+        NamespacePrototype.build = function() {
+            /** @dict */
+            var ns = {};
+            var children = this.children;
+            for (var i=0, k=children.length, child; i<k; ++i) {
+                child = children[i];
+                if (child instanceof Namespace)
+                    ns[child.name] = child.build();
+            }
+            if (Object.defineProperty)
+                Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
+            return ns;
+        };
+
+        /**
+         * Builds the namespace's '$options' property.
+         * @return {Object.<string,*>}
+         */
+        NamespacePrototype.buildOpt = function() {
+            var opt = {},
+                keys = Object.keys(this.options);
+            for (var i=0, k=keys.length; i<k; ++i) {
+                var key = keys[i],
+                    val = this.options[keys[i]];
+                // TODO: Options are not resolved, yet.
+                // if (val instanceof Namespace) {
+                //     opt[key] = val.build();
+                // } else {
+                opt[key] = val;
+                // }
+            }
+            return opt;
+        };
+
+        /**
+         * Gets the value assigned to the option with the specified name.
+         * @param {string=} name Returns the option value if specified, otherwise all options are returned.
+         * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
+         */
+        NamespacePrototype.getOption = function(name) {
+            if (typeof name === 'undefined')
+                return this.options;
+            return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Namespace
+         * @expose
+         */
+        Reflect.Namespace = Namespace;
+
+        /**
+         * Constructs a new Element implementation that checks and converts values for a
+         * particular field type, as appropriate.
+         *
+         * An Element represents a single value: either the value of a singular field,
+         * or a value contained in one entry of a repeated field or map field. This
+         * class does not implement these higher-level concepts; it only encapsulates
+         * the low-level typechecking and conversion.
+         *
+         * @exports ProtoBuf.Reflect.Element
+         * @param {{name: string, wireType: number}} type Resolved data type
+         * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
+         * (e.g. submessage field).
+         * @param {boolean} isMapKey Is this element a Map key? The value will be
+         * converted to string form if so.
+         * @param {string} syntax Syntax level of defining message type, e.g.,
+         * proto2 or proto3.
+         * @param {string} name Name of the field containing this element (for error
+         * messages)
+         * @constructor
+         */
+        var Element = function(type, resolvedType, isMapKey, syntax, name) {
+
+            /**
+             * Element type, as a string (e.g., int32).
+             * @type {{name: string, wireType: number}}
+             */
+            this.type = type;
+
+            /**
+             * Element type reference to submessage or enum definition, if needed.
+             * @type {ProtoBuf.Reflect.T|null}
+             */
+            this.resolvedType = resolvedType;
+
+            /**
+             * Element is a map key.
+             * @type {boolean}
+             */
+            this.isMapKey = isMapKey;
+
+            /**
+             * Syntax level of defining message type, e.g., proto2 or proto3.
+             * @type {string}
+             */
+            this.syntax = syntax;
+
+            /**
+             * Name of the field containing this element (for error messages)
+             * @type {string}
+             */
+            this.name = name;
+
+            if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
+                throw Error("Invalid map key type: " + type.name);
+        };
+
+        var ElementPrototype = Element.prototype;
+
+        /**
+         * Obtains a (new) default value for the specified type.
+         * @param type {string|{name: string, wireType: number}} Field type
+         * @returns {*} Default value
+         * @inner
+         */
+        function mkDefault(type) {
+            if (typeof type === 'string')
+                type = ProtoBuf.TYPES[type];
+            if (typeof type.defaultValue === 'undefined')
+                throw Error("default value for type "+type.name+" is not supported");
+            if (type == ProtoBuf.TYPES["bytes"])
+                return new ByteBuffer(0);
+            return type.defaultValue;
+        }
+
+        /**
+         * Returns the default value for this field in proto3.
+         * @function
+         * @param type {string|{name: string, wireType: number}} the field type
+         * @returns {*} Default value
+         */
+        Element.defaultFieldValue = mkDefault;
+
+        /**
+         * Makes a Long from a value.
+         * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
+         * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
+         *  strings and numbers
+         * @returns {!Long}
+         * @throws {Error} If the value cannot be converted to a Long
+         * @inner
+         */
+        function mkLong(value, unsigned) {
+            if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
+                && value.low === value.low && value.high === value.high)
+                return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
+            if (typeof value === 'string')
+                return ProtoBuf.Long.fromString(value, unsigned || false, 10);
+            if (typeof value === 'number')
+                return ProtoBuf.Long.fromNumber(value, unsigned || false);
+            throw Error("not convertible to Long");
+        }
+
+        ElementPrototype.toString = function() {
+            return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';
+        }
+
+        /**
+         * Checks if the given value can be set for an element of this type (singular
+         * field or one element of a repeated field or map).
+         * @param {*} value Value to check
+         * @return {*} Verified, maybe adjusted, value
+         * @throws {Error} If the value cannot be verified for this element slot
+         * @expose
+         */
+        ElementPrototype.verifyValue = function(value) {
+            var self = this;
+            function fail(val, msg) {
+                throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
+            }
+            switch (this.type) {
+                // Signed 32bit
+                case ProtoBuf.TYPES["int32"]:
+                case ProtoBuf.TYPES["sint32"]:
+                case ProtoBuf.TYPES["sfixed32"]:
+                    // Account for !NaN: value === value
+                    if (typeof value !== 'number' || (value === value && value % 1 !== 0))
+                        fail(typeof value, "not an integer");
+                    return value > 4294967295 ? value | 0 : value;
+
+                // Unsigned 32bit
+                case ProtoBuf.TYPES["uint32"]:
+                case ProtoBuf.TYPES["fixed32"]:
+                    if (typeof value !== 'number' || (value === value && value % 1 !== 0))
+                        fail(typeof value, "not an integer");
+                    return value < 0 ? value >>> 0 : value;
+
+                // Signed 64bit
+                case ProtoBuf.TYPES["int64"]:
+                case ProtoBuf.TYPES["sint64"]:
+                case ProtoBuf.TYPES["sfixed64"]: {
+                    if (ProtoBuf.Long)
+                        try {
+                            return mkLong(value, false);
+                        } catch (e) {
+                            fail(typeof value, e.message);
+                        }
+                    else
+                        fail(typeof value, "requires Long.js");
+                }
+
+                // Unsigned 64bit
+                case ProtoBuf.TYPES["uint64"]:
+                case ProtoBuf.TYPES["fixed64"]: {
+                    if (ProtoBuf.Long)
+                        try {
+                            return mkLong(value, true);
+                        } catch (e) {
+                            fail(typeof value, e.message);
+                        }
+                    else
+                        fail(typeof value, "requires Long.js");
+                }
+
+                // Bool
+                case ProtoBuf.TYPES["bool"]:
+                    if (typeof value !== 'boolean')
+                        fail(typeof value, "not a boolean");
+                    return value;
+
+                // Float
+                case ProtoBuf.TYPES["float"]:
+                case ProtoBuf.TYPES["double"]:
+                    if (typeof value !== 'number')
+                        fail(typeof value, "not a number");
+                    return value;
+
+                // Length-delimited string
+                case ProtoBuf.TYPES["string"]:
+                    if (typeof value !== 'string' && !(value && value instanceof String))
+                        fail(typeof value, "not a string");
+                    return ""+value; // Convert String object to string
+
+                // Length-delimited bytes
+                case ProtoBuf.TYPES["bytes"]:
+                    if (ByteBuffer.isByteBuffer(value))
+                        return value;
+                    return ByteBuffer.wrap(value, "base64");
+
+                // Constant enum value
+                case ProtoBuf.TYPES["enum"]: {
+                    var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
+                    for (i=0; i<values.length; i++)
+                        if (values[i].name == value)
+                            return values[i].id;
+                        else if (values[i].id == value)
+                            return values[i].id;
+
+                    if (this.syntax === 'proto3') {
+                        // proto3: just make sure it's an integer.
+                        if (typeof value !== 'number' || (value === value && value % 1 !== 0))
+                            fail(typeof value, "not an integer");
+                        if (value > 4294967295 || value < 0)
+                            fail(typeof value, "not in range for uint32")
+                        return value;
+                    } else {
+                        // proto2 requires enum values to be valid.
+                        fail(value, "not a valid enum value");
+                    }
+                }
+                // Embedded message
+                case ProtoBuf.TYPES["group"]:
+                case ProtoBuf.TYPES["message"]: {
+                    if (!value || typeof value !== 'object')
+                        fail(typeof value, "object expected");
+                    if (value instanceof this.resolvedType.clazz)
+                        return value;
+                    if (value instanceof ProtoBuf.Builder.Message) {
+                        // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
+                        var obj = {};
+                        for (var i in value)
+                            if (value.hasOwnProperty(i))
+                                obj[i] = value[i];
+                        value = obj;
+                    }
+                    // Else let's try to construct one from a key-value object
+                    return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
+                }
+            }
+
+            // We should never end here
+            throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
+        };
+
+        /**
+         * Calculates the byte length of an element on the wire.
+         * @param {number} id Field number
+         * @param {*} value Field value
+         * @returns {number} Byte length
+         * @throws {Error} If the value cannot be calculated
+         * @expose
+         */
+        ElementPrototype.calculateLength = function(id, value) {
+            if (value === null) return 0; // Nothing to encode
+            // Tag has already been written
+            var n;
+            switch (this.type) {
+                case ProtoBuf.TYPES["int32"]:
+                    return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
+                case ProtoBuf.TYPES["uint32"]:
+                    return ByteBuffer.calculateVarint32(value);
+                case ProtoBuf.TYPES["sint32"]:
+                    return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
+                case ProtoBuf.TYPES["fixed32"]:
+                case ProtoBuf.TYPES["sfixed32"]:
+                case ProtoBuf.TYPES["float"]:
+                    return 4;
+                case ProtoBuf.TYPES["int64"]:
+                case ProtoBuf.TYPES["uint64"]:
+                    return ByteBuffer.calculateVarint64(value);
+                case ProtoBuf.TYPES["sint64"]:
+                    return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
+                case ProtoBuf.TYPES["fixed64"]:
+                case ProtoBuf.TYPES["sfixed64"]:
+                    return 8;
+                case ProtoBuf.TYPES["bool"]:
+                    return 1;
+                case ProtoBuf.TYPES["enum"]:
+                    return ByteBuffer.calculateVarint32(value);
+                case ProtoBuf.TYPES["double"]:
+                    return 8;
+                case ProtoBuf.TYPES["string"]:
+                    n = ByteBuffer.calculateUTF8Bytes(value);
+                    return ByteBuffer.calculateVarint32(n) + n;
+                case ProtoBuf.TYPES["bytes"]:
+                    if (value.remaining() < 0)
+                        throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
+                    return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
+                case ProtoBuf.TYPES["message"]:
+                    n = this.resolvedType.calculate(value);
+                    return ByteBuffer.calculateVarint32(n) + n;
+                case ProtoBuf.TYPES["group"]:
+                    n = this.resolvedType.calculate(value);
+                    return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
+            }
+            // We should never end here
+            throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
+        };
+
+        /**
+         * Encodes a value to the specified buffer. Does not encode the key.
+         * @param {number} id Field number
+         * @param {*} value Field value
+         * @param {ByteBuffer} buffer ByteBuffer to encode to
+         * @return {ByteBuffer} The ByteBuffer for chaining
+         * @throws {Error} If the value cannot be encoded
+         * @expose
+         */
+        ElementPrototype.encodeValue = function(id, value, buffer) {
+            if (value === null) return buffer; // Nothing to encode
+            // Tag has already been written
+
+            switch (this.type) {
+                // 32bit signed varint
+                case ProtoBuf.TYPES["int32"]:
+                    // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
+                    // long – it is, effectively, treated like a very large unsigned integer." (see #122)
+                    if (value < 0)
+                        buffer.writeVarint64(value);
+                    else
+                        buffer.writeVarint32(value);
+                    break;
+
+                // 32bit unsigned varint
+                case ProtoBuf.TYPES["uint32"]:
+                    buffer.writeVarint32(value);
+                    break;
+
+                // 32bit varint zig-zag
+                case ProtoBuf.TYPES["sint32"]:
+                    buffer.writeVarint32ZigZag(value);
+                    break;
+
+                // Fixed unsigned 32bit
+                case ProtoBuf.TYPES["fixed32"]:
+                    buffer.writeUint32(value);
+                    break;
+
+                // Fixed signed 32bit
+                case ProtoBuf.TYPES["sfixed32"]:
+                    buffer.writeInt32(value);
+                    break;
+
+                // 64bit varint as-is
+                case ProtoBuf.TYPES["int64"]:
+                case ProtoBuf.TYPES["uint64"]:
+                    buffer.writeVarint64(value); // throws
+                    break;
+
+                // 64bit varint zig-zag
+                case ProtoBuf.TYPES["sint64"]:
+                    buffer.writeVarint64ZigZag(value); // throws
+                    break;
+
+                // Fixed unsigned 64bit
+                case ProtoBuf.TYPES["fixed64"]:
+                    buffer.writeUint64(value); // throws
+                    break;
+
+                // Fixed signed 64bit
+                case ProtoBuf.TYPES["sfixed64"]:
+                    buffer.writeInt64(value); // throws
+                    break;
+
+                // Bool
+                case ProtoBuf.TYPES["bool"]:
+                    if (typeof value === 'string')
+                        buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
+                    else
+                        buffer.writeVarint32(value ? 1 : 0);
+                    break;
+
+                // Constant enum value
+                case ProtoBuf.TYPES["enum"]:
+                    buffer.writeVarint32(value);
+                    break;
+
+                // 32bit float
+                case ProtoBuf.TYPES["float"]:
+                    buffer.writeFloat32(value);
+                    break;
+
+                // 64bit float
+                case ProtoBuf.TYPES["double"]:
+                    buffer.writeFloat64(value);
+                    break;
+
+                // Length-delimited string
+                case ProtoBuf.TYPES["string"]:
+                    buffer.writeVString(value);
+                    break;
+
+                // Length-delimited bytes
+                case ProtoBuf.TYPES["bytes"]:
+                    if (value.remaining() < 0)
+                        throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
+                    var prevOffset = value.offset;
+                    buffer.writeVarint32(value.remaining());
+                    buffer.append(value);
+                    value.offset = prevOffset;
+                    break;
+
+                // Embedded message
+                case ProtoBuf.TYPES["message"]:
+                    var bb = new ByteBuffer().LE();
+                    this.resolvedType.encode(value, bb);
+                    buffer.writeVarint32(bb.offset);
+                    buffer.append(bb.flip());
+                    break;
+
+                // Legacy group
+                case ProtoBuf.TYPES["group"]:
+                    this.resolvedType.encode(value, buffer);
+                    buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
+                    break;
+
+                default:
+                    // We should never end here
+                    throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
+            }
+            return buffer;
+        };
+
+        /**
+         * Decode one element value from the specified buffer.
+         * @param {ByteBuffer} buffer ByteBuffer to decode from
+         * @param {number} wireType The field wire type
+         * @param {number} id The field number
+         * @return {*} Decoded value
+         * @throws {Error} If the field cannot be decoded
+         * @expose
+         */
+        ElementPrototype.decode = function(buffer, wireType, id) {
+            if (wireType != this.type.wireType)
+                throw Error("Unexpected wire type for element");
+
+            var value, nBytes;
+            switch (this.type) {
+                // 32bit signed varint
+                case ProtoBuf.TYPES["int32"]:
+                    return buffer.readVarint32() | 0;
+
+                // 32bit unsigned varint
+                case ProtoBuf.TYPES["uint32"]:
+                    return buffer.readVarint32() >>> 0;
+
+                // 32bit signed varint zig-zag
+                case ProtoBuf.TYPES["sint32"]:
+                    return buffer.readVarint32ZigZag() | 0;
+
+                // Fixed 32bit unsigned
+                case ProtoBuf.TYPES["fixed32"]:
+                    return buffer.readUint32() >>> 0;
+
+                case ProtoBuf.TYPES["sfixed32"]:
+                    return buffer.readInt32() | 0;
+
+                // 64bit signed varint
+                case ProtoBuf.TYPES["int64"]:
+                    return buffer.readVarint64();
+
+                // 64bit unsigned varint
+                case ProtoBuf.TYPES["uint64"]:
+                    return buffer.readVarint64().toUnsigned();
+
+                // 64bit signed varint zig-zag
+                case ProtoBuf.TYPES["sint64"]:
+                    return buffer.readVarint64ZigZag();
+
+                // Fixed 64bit unsigned
+                case ProtoBuf.TYPES["fixed64"]:
+                    return buffer.readUint64();
+
+                // Fixed 64bit signed
+                case ProtoBuf.TYPES["sfixed64"]:
+                    return buffer.readInt64();
+
+                // Bool varint
+                case ProtoBuf.TYPES["bool"]:
+                    return !!buffer.readVarint32();
+
+                // Constant enum value (varint)
+                case ProtoBuf.TYPES["enum"]:
+                    // The following Builder.Message#set will already throw
+                    return buffer.readVarint32();
+
+                // 32bit float
+                case ProtoBuf.TYPES["float"]:
+                    return buffer.readFloat();
+
+                // 64bit float
+                case ProtoBuf.TYPES["double"]:
+                    return buffer.readDouble();
+
+                // Length-delimited string
+                case ProtoBuf.TYPES["string"]:
+                    return buffer.readVString();
+
+                // Length-delimited bytes
+                case ProtoBuf.TYPES["bytes"]: {
+                    nBytes = buffer.readVarint32();
+                    if (buffer.remaining() < nBytes)
+                        throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
+                    value = buffer.clone(); // Offset already set
+                    value.limit = value.offset+nBytes;
+                    buffer.offset += nBytes;
+                    return value;
+                }
+
+                // Length-delimited embedded message
+                case ProtoBuf.TYPES["message"]: {
+                    nBytes = buffer.readVarint32();
+                    return this.resolvedType.decode(buffer, nBytes);
+                }
+
+                // Legacy group
+                case ProtoBuf.TYPES["group"]:
+                    return this.resolvedType.decode(buffer, -1, id);
+            }
+
+            // We should never end here
+            throw Error("[INTERNAL] Illegal decode type");
+        };
+
+        /**
+         * Converts a value from a string to the canonical element type.
+         *
+         * Legal only when isMapKey is true.
+         *
+         * @param {string} str The string value
+         * @returns {*} The value
+         */
+        ElementPrototype.valueFromString = function(str) {
+            if (!this.isMapKey) {
+                throw Error("valueFromString() called on non-map-key element");
+            }
+
+            switch (this.type) {
+                case ProtoBuf.TYPES["int32"]:
+                case ProtoBuf.TYPES["sint32"]:
+                case ProtoBuf.TYPES["sfixed32"]:
+                case ProtoBuf.TYPES["uint32"]:
+                case ProtoBuf.TYPES["fixed32"]:
+                    return this.verifyValue(parseInt(str));
+
+                case ProtoBuf.TYPES["int64"]:
+                case ProtoBuf.TYPES["sint64"]:
+                case ProtoBuf.TYPES["sfixed64"]:
+                case ProtoBuf.TYPES["uint64"]:
+                case ProtoBuf.TYPES["fixed64"]:
+                      // Long-based fields support conversions from string already.
+                      return this.verifyValue(str);
+
+                case ProtoBuf.TYPES["bool"]:
+                      return str === "true";
+
+                case ProtoBuf.TYPES["string"]:
+                      return this.verifyValue(str);
+
+                case ProtoBuf.TYPES["bytes"]:
+                      return ByteBuffer.fromBinary(str);
+            }
+        };
+
+        /**
+         * Converts a value from the canonical element type to a string.
+         *
+         * It should be the case that `valueFromString(valueToString(val))` returns
+         * a value equivalent to `verifyValue(val)` for every legal value of `val`
+         * according to this element type.
+         *
+         * This may be used when the element must be stored or used as a string,
+         * e.g., as a map key on an Object.
+         *
+         * Legal only when isMapKey is true.
+         *
+         * @param {*} val The value
+         * @returns {string} The string form of the value.
+         */
+        ElementPrototype.valueToString = function(value) {
+            if (!this.isMapKey) {
+                throw Error("valueToString() called on non-map-key element");
+            }
+
+            if (this.type === ProtoBuf.TYPES["bytes"]) {
+                return value.toString("binary");
+            } else {
+                return value.toString();
+            }
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Element
+         * @expose
+         */
+        Reflect.Element = Element;
+
+        /**
+         * Constructs a new Message.
+         * @exports ProtoBuf.Reflect.Message
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
+         * @param {string} name Message name
+         * @param {Object.<string,*>=} options Message options
+         * @param {boolean=} isGroup `true` if this is a legacy group
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)
+         * @constructor
+         * @extends ProtoBuf.Reflect.Namespace
+         */
+        var Message = function(builder, parent, name, options, isGroup, syntax) {
+            Namespace.call(this, builder, parent, name, options, syntax);
+
+            /**
+             * @override
+             */
+            this.className = "Message";
+
+            /**
+             * Extensions range.
+             * @type {!Array.<number>|undefined}
+             * @expose
+             */
+            this.extensions = undefined;
+
+            /**
+             * Runtime message class.
+             * @type {?function(new:ProtoBuf.Builder.Message)}
+             * @expose
+             */
+            this.clazz = null;
+
+            /**
+             * Whether this is a legacy group or not.
+             * @type {boolean}
+             * @expose
+             */
+            this.isGroup = !!isGroup;
+
+            // The following cached collections are used to efficiently iterate over or look up fields when decoding.
+
+            /**
+             * Cached fields.
+             * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
+             * @private
+             */
+            this._fields = null;
+
+            /**
+             * Cached fields by id.
+             * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
+             * @private
+             */
+            this._fieldsById = null;
+
+            /**
+             * Cached fields by name.
+             * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
+             * @private
+             */
+            this._fieldsByName = null;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Message.prototype
+         * @inner
+         */
+        var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
+
+        /**
+         * Builds the message and returns the runtime counterpart, which is a fully functional class.
+         * @see ProtoBuf.Builder.Message
+         * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
+         * @return {ProtoBuf.Reflect.Message} Message class
+         * @throws {Error} If the message cannot be built
+         * @expose
+         */
+        MessagePrototype.build = function(rebuild) {
+            if (this.clazz && !rebuild)
+                return this.clazz;
+
+            // Create the runtime Message class in its own scope
+            var clazz = (function(ProtoBuf, T) {
+
+                var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
+                    oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
+
+                /**
+                 * Constructs a new runtime Message.
+                 * @name ProtoBuf.Builder.Message
+                 * @class Barebone of all runtime messages.
+                 * @param {!Object.<string,*>|string} values Preset values
+                 * @param {...string} var_args
+                 * @constructor
+                 * @throws {Error} If the message cannot be created
+                 */
+                var Message = function(values, var_args) {
+                    ProtoBuf.Builder.Message.call(this);
+
+                    // Create virtual oneof properties
+                    for (var i=0, k=oneofs.length; i<k; ++i)
+                        this[oneofs[i].name] = null;
+                    // Create fields and set default values
+                    for (i=0, k=fields.length; i<k; ++i) {
+                        var field = fields[i];
+                        this[field.name] =
+                            field.repeated ? [] :
+                            (field.map ? new ProtoBuf.Map(field) : null);
+                        if ((field.required || T.syntax === 'proto3') &&
+                            field.defaultValue !== null)
+                            this[field.name] = field.defaultValue;
+                    }
+
+                    if (arguments.length > 0) {
+                        var value;
+                        // Set field values from a values object
+                        if (arguments.length === 1 && values !== null && typeof values === 'object' &&
+                            /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
+                            /* not a repeated field */ !Array.isArray(values) &&
+                            /* not a Map */ !(values instanceof ProtoBuf.Map) &&
+                            /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
+                            /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
+                            /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
+                            this.$set(values);
+                        } else // Set field values from arguments, in declaration order
+                            for (i=0, k=arguments.length; i<k; ++i)
+                                if (typeof (value = arguments[i]) !== 'undefined')
+                                    this.$set(fields[i].name, value); // May throw
+                    }
+                };
+
+                /**
+                 * @alias ProtoBuf.Builder.Message.prototype
+                 * @inner
+                 */
+                var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
+
+                /**
+                 * Adds a value to a repeated field.
+                 * @name ProtoBuf.Builder.Message#add
+                 * @function
+                 * @param {string} key Field name
+                 * @param {*} value Value to add
+                 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
+                 * @returns {!ProtoBuf.Builder.Message} this
+                 * @throws {Error} If the value cannot be added
+                 * @expose
+                 */
+                MessagePrototype.add = function(key, value, noAssert) {
+                    var field = T._fieldsByName[key];
+                    if (!noAssert) {
+                        if (!field)
+                            throw Error(this+"#"+key+" is undefined");
+                        if (!(field instanceof ProtoBuf.Reflect.Message.Field))
+                            throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
+                        if (!field.repeated)
+                            throw Error(this+"#"+key+" is not a repeated field");
+                        value = field.verifyValue(value, true);
+                    }
+                    if (this[key] === null)
+                        this[key] = [];
+                    this[key].push(value);
+                    return this;
+                };
+
+                /**
+                 * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
+                 * @name ProtoBuf.Builder.Message#$add
+                 * @function
+                 * @param {string} key Field name
+                 * @param {*} value Value to add
+                 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
+                 * @returns {!ProtoBuf.Builder.Message} this
+                 * @throws {Error} If the value cannot be added
+                 * @expose
+                 */
+                MessagePrototype.$add = MessagePrototype.add;
+
+                /**
+                 * Sets a field's value.
+                 * @name ProtoBuf.Builder.Message#set
+                 * @function
+                 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
+                 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
+                 * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
+                 * @returns {!ProtoBuf.Builder.Message} this
+                 * @throws {Error} If the value cannot be set
+                 * @expose
+                 */
+                MessagePrototype.set = function(keyOrObj, value, noAssert) {
+                    if (keyOrObj && typeof keyOrObj === 'object') {
+                        noAssert = value;
+                        for (var ikey in keyOrObj) {
+                            // Check if virtual oneof field - don't set these
+                            if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)
+                                this.$set(ikey, value, noAssert);
+                        }
+                        return this;
+                    }
+                    var field = T._fieldsByName[keyOrObj];
+                    if (!noAssert) {
+                        if (!field)
+                            throw Error(this+"#"+keyOrObj+" is not a field: undefined");
+                        if (!(field instanceof ProtoBuf.Reflect.Message.Field))
+                            throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
+                        this[field.name] = (value = field.verifyValue(value)); // May throw
+                    } else
+                        this[keyOrObj] = value;
+                    if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
+                        var currentField = this[field.oneof.name]; // Virtual field references currently set field
+                        if (value !== null) {
+                            if (currentField !== null && currentField !== field.name)
+                                this[currentField] = null; // Clear currently set field
+                            this[field.oneof.name] = field.name; // Point virtual field at this field
+                        } else if (/* value === null && */currentField === keyOrObj)
+                            this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
+                    }
+                    return this;
+                };
+
+                /**
+                 * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
+                 * @name ProtoBuf.Builder.Message#$set
+                 * @function
+                 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
+                 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
+                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
+                 * @throws {Error} If the value cannot be set
+                 * @expose
+                 */
+                MessagePrototype.$set = MessagePrototype.set;
+
+                /**
+                 * Gets a field's value.
+                 * @name ProtoBuf.Builder.Message#get
+                 * @function
+                 * @param {string} key Key
+                 * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
+                 * @return {*} Value
+                 * @throws {Error} If there is no such field
+                 * @expose
+                 */
+                MessagePrototype.get = function(key, noAssert) {
+                    if (noAssert)
+                        return this[key];
+                    var field = T._fieldsByName[key];
+                    if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
+                        throw Error(this+"#"+key+" is not a field: undefined");
+                    if (!(field instanceof ProtoBuf.Reflect.Message.Field))
+                        throw Error(this+"#"+key+" is not a field: "+field.toString(true));
+                    return this[field.name];
+                };
+
+                /**
+                 * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
+                 * @name ProtoBuf.Builder.Message#$get
+                 * @function
+                 * @param {string} key Key
+                 * @return {*} Value
+                 * @throws {Error} If there is no such field
+                 * @expose
+                 */
+                MessagePrototype.$get = MessagePrototype.get;
+
+                // Getters and setters
+
+                for (var i=0; i<fields.length; i++) {
+                    var field = fields[i];
+                    // no setters for extension fields as these are named by their fqn
+                    if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
+                        continue;
+
+                    if (T.builder.options['populateAccessors'])
+                        (function(field) {
+                            // set/get[SomeValue]
+                            var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
+                                return match.toUpperCase().replace('_','');
+                            });
+                            Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
+
+                            // set/get_[some_value] FIXME: Do we really need these?
+                            var name = field.originalName.replace(/([A-Z])/g, function(match) {
+                                return "_"+match;
+                            });
+
+                            /**
+                             * The current field's unbound setter function.
+                             * @function
+                             * @param {*} value
+                             * @param {boolean=} noAssert
+                             * @returns {!ProtoBuf.Builder.Message}
+                             * @inner
+                             */
+                            var setter = function(value, noAssert) {
+                                this[field.name] = noAssert ? value : field.verifyValue(value);
+                                return this;
+                            };
+
+                            /**
+                             * The current field's unbound getter function.
+                             * @function
+                             * @returns {*}
+                             * @inner
+                             */
+                            var getter = function() {
+                                return this[field.name];
+                            };
+
+                            if (T.getChild("set"+Name) === null)
+                                /**
+                                 * Sets a value. This method is present for each field, but only if there is no name conflict with
+                                 *  another field.
+                                 * @name ProtoBuf.Builder.Message#set[SomeField]
+                                 * @function
+                                 * @param {*} value Value to set
+                                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
+                                 * @returns {!ProtoBuf.Builder.Message} this
+                                 * @abstract
+                                 * @throws {Error} If the value cannot be set
+                                 */
+                                MessagePrototype["set"+Name] = setter;
+
+                            if (T.getChild("set_"+name) === null)
+                                /**
+                                 * Sets a value. This method is present for each field, but only if there is no name conflict with
+                                 *  another field.
+                                 * @name ProtoBuf.Builder.Message#set_[some_field]
+                                 * @function
+                                 * @param {*} value Value to set
+                                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
+                                 * @returns {!ProtoBuf.Builder.Message} this
+                                 * @abstract
+                                 * @throws {Error} If the value cannot be set
+                                 */
+                                MessagePrototype["set_"+name] = setter;
+
+                            if (T.getChild("get"+Name) === null)
+                                /**
+                                 * Gets a value. This method is present for each field, but only if there is no name conflict with
+                                 *  another field.
+                                 * @name ProtoBuf.Builder.Message#get[SomeField]
+                                 * @function
+                                 * @abstract
+                                 * @return {*} The value
+                                 */
+                                MessagePrototype["get"+Name] = getter;
+
+                            if (T.getChild("get_"+name) === null)
+                                /**
+                                 * Gets a value. This method is present for each field, but only if there is no name conflict with
+                                 *  another field.
+                                 * @name ProtoBuf.Builder.Message#get_[some_field]
+                                 * @function
+                                 * @return {*} The value
+                                 * @abstract
+                                 */
+                                MessagePrototype["get_"+name] = getter;
+
+                        })(field);
+                }
+
+                // En-/decoding
+
+                /**
+                 * Encodes the message.
+                 * @name ProtoBuf.Builder.Message#$encode
+                 * @function
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded ByteBuffer in the `encoded` property on the error.
+                 * @expose
+                 * @see ProtoBuf.Builder.Message#encode64
+                 * @see ProtoBuf.Builder.Message#encodeHex
+                 * @see ProtoBuf.Builder.Message#encodeAB
+                 */
+                MessagePrototype.encode = function(buffer, noVerify) {
+                    if (typeof buffer === 'boolean')
+                        noVerify = buffer,
+                        buffer = undefined;
+                    var isNew = false;
+                    if (!buffer)
+                        buffer = new ByteBuffer(),
+                        isNew = true;
+                    var le = buffer.littleEndian;
+                    try {
+                        T.encode(this, buffer.LE(), noVerify);
+                        return (isNew ? buffer.flip() : buffer).LE(le);
+                    } catch (e) {
+                        buffer.LE(le);
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Encodes a message using the specified data payload.
+                 * @param {!Object.<string,*>} data Data payload
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer
+                 * @expose
+                 */
+                Message.encode = function(data, buffer, noVerify) {
+                    return new Message(data).encode(buffer, noVerify);
+                };
+
+                /**
+                 * Calculates the byte length of the message.
+                 * @name ProtoBuf.Builder.Message#calculate
+                 * @function
+                 * @returns {number} Byte length
+                 * @throws {Error} If the message cannot be calculated or if required fields are missing.
+                 * @expose
+                 */
+                MessagePrototype.calculate = function() {
+                    return T.calculate(this);
+                };
+
+                /**
+                 * Encodes the varint32 length-delimited message.
+                 * @name ProtoBuf.Builder.Message#encodeDelimited
+                 * @function
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded ByteBuffer in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.encodeDelimited = function(buffer, noVerify) {
+                    var isNew = false;
+                    if (!buffer)
+                        buffer = new ByteBuffer(),
+                        isNew = true;
+                    var enc = new ByteBuffer().LE();
+                    T.encode(this, enc, noVerify).flip();
+                    buffer.writeVarint32(enc.remaining());
+                    buffer.append(enc);
+                    return isNew ? buffer.flip() : buffer;
+                };
+
+                /**
+                 * Directly encodes the message to an ArrayBuffer.
+                 * @name ProtoBuf.Builder.Message#encodeAB
+                 * @function
+                 * @return {ArrayBuffer} Encoded message as ArrayBuffer
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded ArrayBuffer in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.encodeAB = function() {
+                    try {
+                        return this.encode().toArrayBuffer();
+                    } catch (e) {
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
+                 * @name ProtoBuf.Builder.Message#toArrayBuffer
+                 * @function
+                 * @return {ArrayBuffer} Encoded message as ArrayBuffer
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded ArrayBuffer in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
+
+                /**
+                 * Directly encodes the message to a node Buffer.
+                 * @name ProtoBuf.Builder.Message#encodeNB
+                 * @function
+                 * @return {!Buffer}
+                 * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
+                 *  missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.encodeNB = function() {
+                    try {
+                        return this.encode().toBuffer();
+                    } catch (e) {
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
+                 * @name ProtoBuf.Builder.Message#toBuffer
+                 * @function
+                 * @return {!Buffer}
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded node Buffer in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.toBuffer = MessagePrototype.encodeNB;
+
+                /**
+                 * Directly encodes the message to a base64 encoded string.
+                 * @name ProtoBuf.Builder.Message#encode64
+                 * @function
+                 * @return {string} Base64 encoded string
+                 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
+                 *  still returns the encoded base64 string in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.encode64 = function() {
+                    try {
+                        return this.encode().toBase64();
+                    } catch (e) {
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
+                 * @name ProtoBuf.Builder.Message#toBase64
+                 * @function
+                 * @return {string} Base64 encoded string
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded base64 string in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.toBase64 = MessagePrototype.encode64;
+
+                /**
+                 * Directly encodes the message to a hex encoded string.
+                 * @name ProtoBuf.Builder.Message#encodeHex
+                 * @function
+                 * @return {string} Hex encoded string
+                 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
+                 *  still returns the encoded hex string in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.encodeHex = function() {
+                    try {
+                        return this.encode().toHex();
+                    } catch (e) {
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
+                 * @name ProtoBuf.Builder.Message#toHex
+                 * @function
+                 * @return {string} Hex encoded string
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+                 *  returns the encoded hex string in the `encoded` property on the error.
+                 * @expose
+                 */
+                MessagePrototype.toHex = MessagePrototype.encodeHex;
+
+                /**
+                 * Clones a message object or field value to a raw object.
+                 * @param {*} obj Object to clone
+                 * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
+                 * @param {boolean} longsAsStrings Whether to encode longs as strings
+                 * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
+                 * @returns {*} Cloned object
+                 * @inner
+                 */
+                function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
+                    if (obj === null || typeof obj !== 'object') {
+                        // Convert enum values to their respective names
+                        if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
+                            var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
+                            if (name !== null)
+                                return name;
+                        }
+                        // Pass-through string, number, boolean, null...
+                        return obj;
+                    }
+                    // Convert ByteBuffers to raw buffer or strings
+                    if (ByteBuffer.isByteBuffer(obj))
+                        return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
+                    // Convert Longs to proper objects or strings
+                    if (ProtoBuf.Long.isLong(obj))
+                        return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
+                    var clone;
+                    // Clone arrays
+                    if (Array.isArray(obj)) {
+                        clone = [];
+                        obj.forEach(function(v, k) {
+                            clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
+                        });
+                        return clone;
+                    }
+                    clone = {};
+                    // Convert maps to objects
+                    if (obj instanceof ProtoBuf.Map) {
+                        var it = obj.entries();
+                        for (var e = it.next(); !e.done; e = it.next())
+                            clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
+                        return clone;
+                    }
+                    // Everything else is a non-null object
+                    var type = obj.$type,
+                        field = undefined;
+                    for (var i in obj)
+                        if (obj.hasOwnProperty(i)) {
+                            if (type && (field = type.getChild(i)))
+                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
+                            else
+                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
+                        }
+                    return clone;
+                }
+
+                /**
+                 * Returns the message's raw payload.
+                 * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
+                 * @param {boolean} longsAsStrings Whether to encode longs as strings
+                 * @returns {Object.<string,*>} Raw payload
+                 * @expose
+                 */
+                MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
+                    return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
+                };
+
+                /**
+                 * Encodes a message to JSON.
+                 * @returns {string} JSON string
+                 * @expose
+                 */
+                MessagePrototype.encodeJSON = function() {
+                    return JSON.stringify(
+                        cloneRaw(this,
+                             /* binary-as-base64 */ true,
+                             /* longs-as-strings */ true,
+                             this.$type
+                        )
+                    );
+                };
+
+                /**
+                 * Decodes a message from the specified buffer or string.
+                 * @name ProtoBuf.Builder.Message.decode
+                 * @function
+                 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
+                 * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
+                 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
+                 * @return {!ProtoBuf.Builder.Message} Decoded message
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.
+                 * @expose
+                 * @see ProtoBuf.Builder.Message.decode64
+                 * @see ProtoBuf.Builder.Message.decodeHex
+                 */
+                Message.decode = function(buffer, length, enc) {
+                    if (typeof length === 'string')
+                        enc = length,
+                        length = -1;
+                    if (typeof buffer === 'string')
+                        buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
+                    else if (!ByteBuffer.isByteBuffer(buffer))
+                        buffer = ByteBuffer.wrap(buffer); // May throw
+                    var le = buffer.littleEndian;
+                    try {
+                        var msg = T.decode(buffer.LE(), length);
+                        buffer.LE(le);
+                        return msg;
+                    } catch (e) {
+                        buffer.LE(le);
+                        throw(e);
+                    }
+                };
+
+                /**
+                 * Decodes a varint32 length-delimited message from the specified buffer or string.
+                 * @name ProtoBuf.Builder.Message.decodeDelimited
+                 * @function
+                 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
+                 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
+                 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.
+                 * @expose
+                 */
+                Message.decodeDelimited = function(buffer, enc) {
+                    if (typeof buffer === 'string')
+                        buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
+                    else if (!ByteBuffer.isByteBuffer(buffer))
+                        buffer = ByteBuffer.wrap(buffer); // May throw
+                    if (buffer.remaining() < 1)
+                        return null;
+                    var off = buffer.offset,
+                        len = buffer.readVarint32();
+                    if (buffer.remaining() < len) {
+                        buffer.offset = off;
+                        return null;
+                    }
+                    try {
+                        var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
+                        buffer.offset += len;
+                        return msg;
+                    } catch (err) {
+                        buffer.offset += len;
+                        throw err;
+                    }
+                };
+
+                /**
+                 * Decodes the message from the specified base64 encoded string.
+                 * @name ProtoBuf.Builder.Message.decode64
+                 * @function
+                 * @param {string} str String to decode from
+                 * @return {!ProtoBuf.Builder.Message} Decoded message
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.
+                 * @expose
+                 */
+                Message.decode64 = function(str) {
+                    return Message.decode(str, "base64");
+                };
+
+                /**
+                 * Decodes the message from the specified hex encoded string.
+                 * @name ProtoBuf.Builder.Message.decodeHex
+                 * @function
+                 * @param {string} str String to decode from
+                 * @return {!ProtoBuf.Builder.Message} Decoded message
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.
+                 * @expose
+                 */
+                Message.decodeHex = function(str) {
+                    return Message.decode(str, "hex");
+                };
+
+                /**
+                 * Decodes the message from a JSON string.
+                 * @name ProtoBuf.Builder.Message.decodeJSON
+                 * @function
+                 * @param {string} str String to decode from
+                 * @return {!ProtoBuf.Builder.Message} Decoded message
+                 * @throws {Error} If the message cannot be decoded or if required fields are
+                 * missing.
+                 * @expose
+                 */
+                Message.decodeJSON = function(str) {
+                    return new Message(JSON.parse(str));
+                };
+
+                // Utility
+
+                /**
+                 * Returns a string representation of this Message.
+                 * @name ProtoBuf.Builder.Message#toString
+                 * @function
+                 * @return {string} String representation as of ".Fully.Qualified.MessageName"
+                 * @expose
+                 */
+                MessagePrototype.toString = function() {
+                    return T.toString();
+                };
+
+                // Properties
+
+                /**
+                 * Message options.
+                 * @name ProtoBuf.Builder.Message.$options
+                 * @type {Object.<string,*>}
+                 * @expose
+                 */
+                var $optionsS; // cc needs this
+
+                /**
+                 * Message options.
+                 * @name ProtoBuf.Builder.Message#$options
+                 * @type {Object.<string,*>}
+                 * @expose
+                 */
+                var $options;
+
+                /**
+                 * Reflection type.
+                 * @name ProtoBuf.Builder.Message.$type
+                 * @type {!ProtoBuf.Reflect.Message}
+                 * @expose
+                 */
+                var $typeS;
+
+                /**
+                 * Reflection type.
+                 * @name ProtoBuf.Builder.Message#$type
+                 * @type {!ProtoBuf.Reflect.Message}
+                 * @expose
+                 */
+                var $type;
+
+                if (Object.defineProperty)
+                    Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
+                    Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
+                    Object.defineProperty(Message, "$type", { "value": T }),
+                    Object.defineProperty(MessagePrototype, "$type", { "value": T });
+
+                return Message;
+
+            })(ProtoBuf, this);
+
+            // Static enums and prototyped sub-messages / cached collections
+            this._fields = [];
+            this._fieldsById = {};
+            this._fieldsByName = {};
+            this._oneofsByName = {};
+            for (var i=0, k=this.children.length, child; i<k; i++) {
+                child = this.children[i];
+                if (child instanceof Enum || child instanceof Message || child instanceof Service) {
+                    if (clazz.hasOwnProperty(child.name))
+                        throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
+                    clazz[child.name] = child.build();
+                } else if (child instanceof Message.Field)
+                    child.build(),
+                    this._fields.push(child),
+                    this._fieldsById[child.id] = child,
+                    this._fieldsByName[child.name] = child;
+                else if (child instanceof Message.OneOf) {
+                    this._oneofsByName[child.name] = child;
+                }
+                else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
+                    throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
+            }
+
+            return this.clazz = clazz;
+        };
+
+        /**
+         * Encodes a runtime message's contents to the specified buffer.
+         * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
+         * @param {ByteBuffer} buffer ByteBuffer to write to
+         * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+         * @return {ByteBuffer} The ByteBuffer for chaining
+         * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
+         * @expose
+         */
+        MessagePrototype.encode = function(message, buffer, noVerify) {
+            var fieldMissing = null,
+                field;
+            for (var i=0, k=this._fields.length, val; i<k; ++i) {
+                field = this._fields[i];
+                val = message[field.name];
+                if (field.required && val === null) {
+                    if (fieldMissing === null)
+                        fieldMissing = field;
+                } else
+                    field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
+            }
+            if (fieldMissing !== null) {
+                var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
+                err["encoded"] = buffer; // Still expose what we got
+                throw(err);
+            }
+            return buffer;
+        };
+
+        /**
+         * Calculates a runtime message's byte length.
+         * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
+         * @returns {number} Byte length
+         * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
+         * @expose
+         */
+        MessagePrototype.calculate = function(message) {
+            for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
+                field = this._fields[i];
+                val = message[field.name];
+                if (field.required && val === null)
+                   throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
+                else
+                    n += field.calculate(val, message);
+            }
+            return n;
+        };
+
+        /**
+         * Skips all data until the end of the specified group has been reached.
+         * @param {number} expectedId Expected GROUPEND id
+         * @param {!ByteBuffer} buf ByteBuffer
+         * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
+         * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
+         * @inner
+         */
+        function skipTillGroupEnd(expectedId, buf) {
+            var tag = buf.readVarint32(), // Throws on OOB
+                wireType = tag & 0x07,
+                id = tag >>> 3;
+            switch (wireType) {
+                case ProtoBuf.WIRE_TYPES.VARINT:
+                    do tag = buf.readUint8();
+                    while ((tag & 0x80) === 0x80);
+                    break;
+                case ProtoBuf.WIRE_TYPES.BITS64:
+                    buf.offset += 8;
+                    break;
+                case ProtoBuf.WIRE_TYPES.LDELIM:
+                    tag = buf.readVarint32(); // reads the varint
+                    buf.offset += tag;        // skips n bytes
+                    break;
+                case ProtoBuf.WIRE_TYPES.STARTGROUP:
+                    skipTillGroupEnd(id, buf);
+                    break;
+                case ProtoBuf.WIRE_TYPES.ENDGROUP:
+                    if (id === expectedId)
+                        return false;
+                    else
+                        throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
+                case ProtoBuf.WIRE_TYPES.BITS32:
+                    buf.offset += 4;
+                    break;
+                default:
+                    throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
+            }
+            return true;
+        }
+
+        /**
+         * Decodes an encoded message and returns the decoded message.
+         * @param {ByteBuffer} buffer ByteBuffer to decode from
+         * @param {number=} length Message length. Defaults to decode all remaining data.
+         * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
+         * @return {ProtoBuf.Builder.Message} Decoded message
+         * @throws {Error} If the message cannot be decoded
+         * @expose
+         */
+        MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
+            if (typeof length !== 'number')
+                length = -1;
+            var start = buffer.offset,
+                msg = new (this.clazz)(),
+                tag, wireType, id, field;
+            while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
+                tag = buffer.readVarint32();
+                wireType = tag & 0x07;
+                id = tag >>> 3;
+                if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
+                    if (id !== expectedGroupEndId)
+                        throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
+                    break;
+                }
+                if (!(field = this._fieldsById[id])) {
+                    // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
+                    switch (wireType) {
+                        case ProtoBuf.WIRE_TYPES.VARINT:
+                            buffer.readVarint32();
+                            break;
+                        case ProtoBuf.WIRE_TYPES.BITS32:
+                            buffer.offset += 4;
+                            break;
+                        case ProtoBuf.WIRE_TYPES.BITS64:
+                            buffer.offset += 8;
+                            break;
+                        case ProtoBuf.WIRE_TYPES.LDELIM:
+                            var len = buffer.readVarint32();
+                            buffer.offset += len;
+                            break;
+                        case ProtoBuf.WIRE_TYPES.STARTGROUP:
+                            while (skipTillGroupEnd(id, buffer)) {}
+                            break;
+                        default:
+                            throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
+                    }
+                    continue;
+                }
+                if (field.repeated && !field.options["packed"]) {
+                    msg[field.name].push(field.decode(wireType, buffer));
+                } else if (field.map) {
+                    var keyval = field.decode(wireType, buffer);
+                    msg[field.name].set(keyval[0], keyval[1]);
+                } else {
+                    msg[field.name] = field.decode(wireType, buffer);
+                    if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
+                        var currentField = msg[field.oneof.name]; // Virtual field references currently set field
+                        if (currentField !== null && currentField !== field.name)
+                            msg[currentField] = null; // Clear currently set field
+                        msg[field.oneof.name] = field.name; // Point virtual field at this field
+                    }
+                }
+            }
+
+            // Check if all required fields are present and set default values for optional fields that are not
+            for (var i=0, k=this._fields.length; i<k; ++i) {
+                field = this._fields[i];
+                if (msg[field.name] === null) {
+                    if (this.syntax === "proto3") { // Proto3 sets default values by specification
+                        msg[field.name] = field.defaultValue;
+                    } else if (field.required) {
+                        var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
+                        err["decoded"] = msg; // Still expose what we got
+                        throw(err);
+                    } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
+                        msg[field.name] = field.defaultValue;
+                }
+            }
+            return msg;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Message
+         * @expose
+         */
+        Reflect.Message = Message;
+
+        /**
+         * Constructs a new Message Field.
+         * @exports ProtoBuf.Reflect.Message.Field
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Message} message Message reference
+         * @param {string} rule Rule, one of requried, optional, repeated
+         * @param {string?} keytype Key data type, if any.
+         * @param {string} type Data type, e.g. int32
+         * @param {string} name Field name
+         * @param {number} id Unique field id
+         * @param {Object.<string,*>=} options Options
+         * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)
+         * @constructor
+         * @extends ProtoBuf.Reflect.T
+         */
+        var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
+            T.call(this, builder, message, name);
+
+            /**
+             * @override
+             */
+            this.className = "Message.Field";
+
+            /**
+             * Message field required flag.
+             * @type {boolean}
+             * @expose
+             */
+            this.required = rule === "required";
+
+            /**
+             * Message field repeated flag.
+             * @type {boolean}
+             * @expose
+             */
+            this.repeated = rule === "repeated";
+
+            /**
+             * Message field map flag.
+             * @type {boolean}
+             * @expose
+             */
+            this.map = rule === "map";
+
+            /**
+             * Message field key type. Type reference string if unresolved, protobuf
+             * type if resolved. Valid only if this.map === true, null otherwise.
+             * @type {string|{name: string, wireType: number}|null}
+             * @expose
+             */
+            this.keyType = keytype || null;
+
+            /**
+             * Message field type. Type reference string if unresolved, protobuf type if
+             * resolved. In a map field, this is the value type.
+             * @type {string|{name: string, wireType: number}}
+             * @expose
+             */
+            this.type = type;
+
+            /**
+             * Resolved type reference inside the global namespace.
+             * @type {ProtoBuf.Reflect.T|null}
+             * @expose
+             */
+            this.resolvedType = null;
+
+            /**
+             * Unique message field id.
+             * @type {number}
+             * @expose
+             */
+            this.id = id;
+
+            /**
+             * Message field options.
+             * @type {!Object.<string,*>}
+             * @dict
+             * @expose
+             */
+            this.options = options || {};
+
+            /**
+             * Default value.
+             * @type {*}
+             * @expose
+             */
+            this.defaultValue = null;
+
+            /**
+             * Enclosing OneOf.
+             * @type {?ProtoBuf.Reflect.Message.OneOf}
+             * @expose
+             */
+            this.oneof = oneof || null;
+
+            /**
+             * Syntax level of this definition (e.g., proto3).
+             * @type {string}
+             * @expose
+             */
+            this.syntax = syntax || 'proto2';
+
+            /**
+             * Original field name.
+             * @type {string}
+             * @expose
+             */
+            this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
+
+            /**
+             * Element implementation. Created in build() after types are resolved.
+             * @type {ProtoBuf.Element}
+             * @expose
+             */
+            this.element = null;
+
+            /**
+             * Key element implementation, for map fields. Created in build() after
+             * types are resolved.
+             * @type {ProtoBuf.Element}
+             * @expose
+             */
+            this.keyElement = null;
+
+            // Convert field names to camel case notation if the override is set
+            if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
+                this.name = ProtoBuf.Util.toCamelCase(this.name);
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Message.Field.prototype
+         * @inner
+         */
+        var FieldPrototype = Field.prototype = Object.create(T.prototype);
+
+        /**
+         * Builds the field.
+         * @override
+         * @expose
+         */
+        FieldPrototype.build = function() {
+            this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);
+            if (this.map)
+                this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);
+
+            // In proto3, fields do not have field presence, and every field is set to
+            // its type's default value ("", 0, 0.0, or false).
+            if (this.syntax === 'proto3' && !this.repeated && !this.map)
+                this.defaultValue = Element.defaultFieldValue(this.type);
+
+            // Otherwise, default values are present when explicitly specified
+            else if (typeof this.options['default'] !== 'undefined')
+                this.defaultValue = this.verifyValue(this.options['default']);
+        };
+
+        /**
+         * Checks if the given value can be set for this field.
+         * @param {*} value Value to check
+         * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
+         * @return {*} Verified, maybe adjusted, value
+         * @throws {Error} If the value cannot be set for this field
+         * @expose
+         */
+        FieldPrototype.verifyValue = function(value, skipRepeated) {
+            skipRepeated = skipRepeated || false;
+            var self = this;
+            function fail(val, msg) {
+                throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
+            }
+            if (value === null) { // NULL values for optional fields
+                if (this.required)
+                    fail(typeof value, "required");
+                if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
+                    fail(typeof value, "proto3 field without field presence cannot be null");
+                return null;
+            }
+            var i;
+            if (this.repeated && !skipRepeated) { // Repeated values as arrays
+                if (!Array.isArray(value))
+                    value = [value];
+                var res = [];
+                for (i=0; i<value.length; i++)
+                    res.push(this.element.verifyValue(value[i]));
+                return res;
+            }
+            if (this.map && !skipRepeated) { // Map values as objects
+                if (!(value instanceof ProtoBuf.Map)) {
+                    // If not already a Map, attempt to convert.
+                    if (!(value instanceof Object)) {
+                        fail(typeof value,
+                             "expected ProtoBuf.Map or raw object for map field");
+                    }
+                    return new ProtoBuf.Map(this, value);
+                } else {
+                    return value;
+                }
+            }
+            // All non-repeated fields expect no array
+            if (!this.repeated && Array.isArray(value))
+                fail(typeof value, "no array expected");
+
+            return this.element.verifyValue(value);
+        };
+
+        /**
+         * Determines whether the field will have a presence on the wire given its
+         * value.
+         * @param {*} value Verified field value
+         * @param {!ProtoBuf.Builder.Message} message Runtime message
+         * @return {boolean} Whether the field will be present on the wire
+         */
+        FieldPrototype.hasWirePresence = function(value, message) {
+            if (this.syntax !== 'proto3')
+                return (value !== null);
+            if (this.oneof && message[this.oneof.name] === this.name)
+                return true;
+            switch (this.type) {
+                case ProtoBuf.TYPES["int32"]:
+                case ProtoBuf.TYPES["sint32"]:
+                case ProtoBuf.TYPES["sfixed32"]:
+                case ProtoBuf.TYPES["uint32"]:
+                case ProtoBuf.TYPES["fixed32"]:
+                    return value !== 0;
+
+                case ProtoBuf.TYPES["int64"]:
+                case ProtoBuf.TYPES["sint64"]:
+                case ProtoBuf.TYPES["sfixed64"]:
+                case ProtoBuf.TYPES["uint64"]:
+                case ProtoBuf.TYPES["fixed64"]:
+                    return value.low !== 0 || value.high !== 0;
+
+                case ProtoBuf.TYPES["bool"]:
+                    return value;
+
+                case ProtoBuf.TYPES["float"]:
+                case ProtoBuf.TYPES["double"]:
+                    return value !== 0.0;
+
+                case ProtoBuf.TYPES["string"]:
+                    return value.length > 0;
+
+                case ProtoBuf.TYPES["bytes"]:
+                    return value.remaining() > 0;
+
+                case ProtoBuf.TYPES["enum"]:
+                    return value !== 0;
+
+                case ProtoBuf.TYPES["message"]:
+                    return value !== null;
+                default:
+                    return true;
+            }
+        };
+
+        /**
+         * Encodes the specified field value to the specified buffer.
+         * @param {*} value Verified field value
+         * @param {ByteBuffer} buffer ByteBuffer to encode to
+         * @param {!ProtoBuf.Builder.Message} message Runtime message
+         * @return {ByteBuffer} The ByteBuffer for chaining
+         * @throws {Error} If the field cannot be encoded
+         * @expose
+         */
+        FieldPrototype.encode = function(value, buffer, message) {
+            if (this.type === null || typeof this.type !== 'object')
+                throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
+            if (value === null || (this.repeated && value.length == 0))
+                return buffer; // Optional omitted
+            try {
+                if (this.repeated) {
+                    var i;
+                    // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
+                    // types) can be declared 'packed'."
+                    if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
+                        // "All of the elements of the field are packed into a single key-value pair with wire type 2
+                        // (length-delimited). Each element is encoded the same way it would be normally, except without a
+                        // tag preceding it."
+                        buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+                        buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
+                        var start = buffer.offset; // Remember where the contents begin
+                        for (i=0; i<value.length; i++)
+                            this.element.encodeValue(this.id, value[i], buffer);
+                        var len = buffer.offset-start,
+                            varintLen = ByteBuffer.calculateVarint32(len);
+                        if (varintLen > 1) { // We need to move the contents
+                            var contents = buffer.slice(start, buffer.offset);
+                            start += varintLen-1;
+                            buffer.offset = start;
+                            buffer.append(contents);
+                        }
+                        buffer.writeVarint32(len, start-varintLen);
+                    } else {
+                        // "If your message definition has repeated elements (without the [packed=true] option), the encoded
+                        // message has zero or more key-value pairs with the same tag number"
+                        for (i=0; i<value.length; i++)
+                            buffer.writeVarint32((this.id << 3) | this.type.wireType),
+                            this.element.encodeValue(this.id, value[i], buffer);
+                    }
+                } else if (this.map) {
+                    // Write out each map entry as a submessage.
+                    value.forEach(function(val, key, m) {
+                        // Compute the length of the submessage (key, val) pair.
+                        var length =
+                            ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
+                            this.keyElement.calculateLength(1, key) +
+                            ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
+                            this.element.calculateLength(2, val);
+
+                        // Submessage with wire type of length-delimited.
+                        buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+                        buffer.writeVarint32(length);
+
+                        // Write out the key and val.
+                        buffer.writeVarint32((1 << 3) | this.keyType.wireType);
+                        this.keyElement.encodeValue(1, key, buffer);
+                        buffer.writeVarint32((2 << 3) | this.type.wireType);
+                        this.element.encodeValue(2, val, buffer);
+                    }, this);
+                } else {
+                    if (this.hasWirePresence(value, message)) {
+                        buffer.writeVarint32((this.id << 3) | this.type.wireType);
+                        this.element.encodeValue(this.id, value, buffer);
+                    }
+                }
+            } catch (e) {
+                throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
+            }
+            return buffer;
+        };
+
+        /**
+         * Calculates the length of this field's value on the network level.
+         * @param {*} value Field value
+         * @param {!ProtoBuf.Builder.Message} message Runtime message
+         * @returns {number} Byte length
+         * @expose
+         */
+        FieldPrototype.calculate = function(value, message) {
+            value = this.verifyValue(value); // May throw
+            if (this.type === null || typeof this.type !== 'object')
+                throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
+            if (value === null || (this.repeated && value.length == 0))
+                return 0; // Optional omitted
+            var n = 0;
+            try {
+                if (this.repeated) {
+                    var i, ni;
+                    if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+                        ni = 0;
+                        for (i=0; i<value.length; i++)
+                            ni += this.element.calculateLength(this.id, value[i]);
+                        n += ByteBuffer.calculateVarint32(ni);
+                        n += ni;
+                    } else {
+                        for (i=0; i<value.length; i++)
+                            n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
+                            n += this.element.calculateLength(this.id, value[i]);
+                    }
+                } else if (this.map) {
+                    // Each map entry becomes a submessage.
+                    value.forEach(function(val, key, m) {
+                        // Compute the length of the submessage (key, val) pair.
+                        var length =
+                            ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
+                            this.keyElement.calculateLength(1, key) +
+                            ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
+                            this.element.calculateLength(2, val);
+
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+                        n += ByteBuffer.calculateVarint32(length);
+                        n += length;
+                    }, this);
+                } else {
+                    if (this.hasWirePresence(value, message)) {
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
+                        n += this.element.calculateLength(this.id, value);
+                    }
+                }
+            } catch (e) {
+                throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
+            }
+            return n;
+        };
+
+        /**
+         * Decode the field value from the specified buffer.
+         * @param {number} wireType Leading wire type
+         * @param {ByteBuffer} buffer ByteBuffer to decode from
+         * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
+         * @return {*} Decoded value: array for packed repeated fields, [key, value] for
+         *             map fields, or an individual value otherwise.
+         * @throws {Error} If the field cannot be decoded
+         * @expose
+         */
+        FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
+            var value, nBytes;
+
+            // We expect wireType to match the underlying type's wireType unless we see
+            // a packed repeated field, or unless this is a map field.
+            var wireTypeOK =
+                (!this.map && wireType == this.type.wireType) ||
+                (!skipRepeated && this.repeated && this.options["packed"] &&
+                 wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
+                (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
+            if (!wireTypeOK)
+                throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
+
+            // Handle packed repeated fields.
+            if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
+                if (!skipRepeated) {
+                    nBytes = buffer.readVarint32();
+                    nBytes = buffer.offset + nBytes; // Limit
+                    var values = [];
+                    while (buffer.offset < nBytes)
+                        values.push(this.decode(this.type.wireType, buffer, true));
+                    return values;
+                }
+                // Read the next value otherwise...
+            }
+
+            // Handle maps.
+            if (this.map) {
+                // Read one (key, value) submessage, and return [key, value]
+                var key = Element.defaultFieldValue(this.keyType);
+                value = Element.defaultFieldValue(this.type);
+
+                // Read the length
+                nBytes = buffer.readVarint32();
+                if (buffer.remaining() < nBytes)
+                    throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
+
+                // Get a sub-buffer of this key/value submessage
+                var msgbuf = buffer.clone();
+                msgbuf.limit = msgbuf.offset + nBytes;
+                buffer.offset += nBytes;
+
+                while (msgbuf.remaining() > 0) {
+                    var tag = msgbuf.readVarint32();
+                    wireType = tag & 0x07;
+                    var id = tag >>> 3;
+                    if (id === 1) {
+                        key = this.keyElement.decode(msgbuf, wireType, id);
+                    } else if (id === 2) {
+                        value = this.element.decode(msgbuf, wireType, id);
+                    } else {
+                        throw Error("Unexpected tag in map field key/value submessage");
+                    }
+                }
+
+                return [key, value];
+            }
+
+            // Handle singular and non-packed repeated field values.
+            return this.element.decode(buffer, wireType, this.id);
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Message.Field
+         * @expose
+         */
+        Reflect.Message.Field = Field;
+
+        /**
+         * Constructs a new Message ExtensionField.
+         * @exports ProtoBuf.Reflect.Message.ExtensionField
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Message} message Message reference
+         * @param {string} rule Rule, one of requried, optional, repeated
+         * @param {string} type Data type, e.g. int32
+         * @param {string} name Field name
+         * @param {number} id Unique field id
+         * @param {!Object.<string,*>=} options Options
+         * @constructor
+         * @extends ProtoBuf.Reflect.Message.Field
+         */
+        var ExtensionField = function(builder, message, rule, type, name, id, options) {
+            Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
+
+            /**
+             * Extension reference.
+             * @type {!ProtoBuf.Reflect.Extension}
+             * @expose
+             */
+            this.extension;
+        };
+
+        // Extends Field
+        ExtensionField.prototype = Object.create(Field.prototype);
+
+        /**
+         * @alias ProtoBuf.Reflect.Message.ExtensionField
+         * @expose
+         */
+        Reflect.Message.ExtensionField = ExtensionField;
+
+        /**
+         * Constructs a new Message OneOf.
+         * @exports ProtoBuf.Reflect.Message.OneOf
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Message} message Message reference
+         * @param {string} name OneOf name
+         * @constructor
+         * @extends ProtoBuf.Reflect.T
+         */
+        var OneOf = function(builder, message, name) {
+            T.call(this, builder, message, name);
+
+            /**
+             * Enclosed fields.
+             * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
+             * @expose
+             */
+            this.fields = [];
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Message.OneOf
+         * @expose
+         */
+        Reflect.Message.OneOf = OneOf;
+
+        /**
+         * Constructs a new Enum.
+         * @exports ProtoBuf.Reflect.Enum
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
+         * @param {string} name Enum name
+         * @param {Object.<string,*>=} options Enum options
+         * @param {string?} syntax The syntax level (e.g., proto3)
+         * @constructor
+         * @extends ProtoBuf.Reflect.Namespace
+         */
+        var Enum = function(builder, parent, name, options, syntax) {
+            Namespace.call(this, builder, parent, name, options, syntax);
+
+            /**
+             * @override
+             */
+            this.className = "Enum";
+
+            /**
+             * Runtime enum object.
+             * @type {Object.<string,number>|null}
+             * @expose
+             */
+            this.object = null;
+        };
+
+        /**
+         * Gets the string name of an enum value.
+         * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
+         * @param {number} value Enum value
+         * @returns {?string} Name or `null` if not present
+         * @expose
+         */
+        Enum.getName = function(enm, value) {
+            var keys = Object.keys(enm);
+            for (var i=0, key; i<keys.length; ++i)
+                if (enm[key = keys[i]] === value)
+                    return key;
+            return null;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Enum.prototype
+         * @inner
+         */
+        var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
+
+        /**
+         * Builds this enum and returns the runtime counterpart.
+         * @param {boolean} rebuild Whether to rebuild or not, defaults to false
+         * @returns {!Object.<string,number>}
+         * @expose
+         */
+        EnumPrototype.build = function(rebuild) {
+            if (this.object && !rebuild)
+                return this.object;
+            var enm = new ProtoBuf.Builder.Enum(),
+                values = this.getChildren(Enum.Value);
+            for (var i=0, k=values.length; i<k; ++i)
+                enm[values[i]['name']] = values[i]['id'];
+            if (Object.defineProperty)
+                Object.defineProperty(enm, '$options', {
+                    "value": this.buildOpt(),
+                    "enumerable": false
+                });
+            return this.object = enm;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Enum
+         * @expose
+         */
+        Reflect.Enum = Enum;
+
+        /**
+         * Constructs a new Enum Value.
+         * @exports ProtoBuf.Reflect.Enum.Value
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
+         * @param {string} name Field name
+         * @param {number} id Unique field id
+         * @constructor
+         * @extends ProtoBuf.Reflect.T
+         */
+        var Value = function(builder, enm, name, id) {
+            T.call(this, builder, enm, name);
+
+            /**
+             * @override
+             */
+            this.className = "Enum.Value";
+
+            /**
+             * Unique enum value id.
+             * @type {number}
+             * @expose
+             */
+            this.id = id;
+        };
+
+        // Extends T
+        Value.prototype = Object.create(T.prototype);
+
+        /**
+         * @alias ProtoBuf.Reflect.Enum.Value
+         * @expose
+         */
+        Reflect.Enum.Value = Value;
+
+        /**
+         * An extension (field).
+         * @exports ProtoBuf.Reflect.Extension
+         * @constructor
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.T} parent Parent object
+         * @param {string} name Object name
+         * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
+         */
+        var Extension = function(builder, parent, name, field) {
+            T.call(this, builder, parent, name);
+
+            /**
+             * Extended message field.
+             * @type {!ProtoBuf.Reflect.Message.Field}
+             * @expose
+             */
+            this.field = field;
+        };
+
+        // Extends T
+        Extension.prototype = Object.create(T.prototype);
+
+        /**
+         * @alias ProtoBuf.Reflect.Extension
+         * @expose
+         */
+        Reflect.Extension = Extension;
+
+        /**
+         * Constructs a new Service.
+         * @exports ProtoBuf.Reflect.Service
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Namespace} root Root
+         * @param {string} name Service name
+         * @param {Object.<string,*>=} options Options
+         * @constructor
+         * @extends ProtoBuf.Reflect.Namespace
+         */
+        var Service = function(builder, root, name, options) {
+            Namespace.call(this, builder, root, name, options);
+
+            /**
+             * @override
+             */
+            this.className = "Service";
+
+            /**
+             * Built runtime service class.
+             * @type {?function(new:ProtoBuf.Builder.Service)}
+             */
+            this.clazz = null;
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Service.prototype
+         * @inner
+         */
+        var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
+
+        /**
+         * Builds the service and returns the runtime counterpart, which is a fully functional class.
+         * @see ProtoBuf.Builder.Service
+         * @param {boolean=} rebuild Whether to rebuild or not
+         * @return {Function} Service class
+         * @throws {Error} If the message cannot be built
+         * @expose
+         */
+        ServicePrototype.build = function(rebuild) {
+            if (this.clazz && !rebuild)
+                return this.clazz;
+
+            // Create the runtime Service class in its own scope
+            return this.clazz = (function(ProtoBuf, T) {
+
+                /**
+                 * Constructs a new runtime Service.
+                 * @name ProtoBuf.Builder.Service
+                 * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
+                 * @class Barebone of all runtime services.
+                 * @constructor
+                 * @throws {Error} If the service cannot be created
+                 */
+                var Service = function(rpcImpl) {
+                    ProtoBuf.Builder.Service.call(this);
+
+                    /**
+                     * Service implementation.
+                     * @name ProtoBuf.Builder.Service#rpcImpl
+                     * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
+                     * @expose
+                     */
+                    this.rpcImpl = rpcImpl || function(name, msg, callback) {
+                        // This is what a user has to implement: A function receiving the method name, the actual message to
+                        // send (type checked) and the callback that's either provided with the error as its first
+                        // argument or null and the actual response message.
+                        setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
+                    };
+                };
+
+                /**
+                 * @alias ProtoBuf.Builder.Service.prototype
+                 * @inner
+                 */
+                var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
+
+                /**
+                 * Asynchronously performs an RPC call using the given RPC implementation.
+                 * @name ProtoBuf.Builder.Service.[Method]
+                 * @function
+                 * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
+                 * @param {ProtoBuf.Builder.Message} req Request
+                 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
+                 *  the error if any and the response either as a pre-parsed message or as its raw bytes
+                 * @abstract
+                 */
+
+                /**
+                 * Asynchronously performs an RPC call using the instance's RPC implementation.
+                 * @name ProtoBuf.Builder.Service#[Method]
+                 * @function
+                 * @param {ProtoBuf.Builder.Message} req Request
+                 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
+                 *  the error if any and the response either as a pre-parsed message or as its raw bytes
+                 * @abstract
+                 */
+
+                var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
+                for (var i=0; i<rpc.length; i++) {
+                    (function(method) {
+
+                        // service#Method(message, callback)
+                        ServicePrototype[method.name] = function(req, callback) {
+                            try {
+                                try {
+                                    // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
+                                    req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
+                                } catch (err) {
+                                    if (!(err instanceof TypeError))
+                                        throw err;
+                                }
+                                if (req === null || typeof req !== 'object')
+                                    throw Error("Illegal arguments");
+                                if (!(req instanceof method.resolvedRequestType.clazz))
+                                    req = new method.resolvedRequestType.clazz(req);
+                                this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
+                                    if (err) {
+                                        callback(err);
+                                        return;
+                                    }
+                                    // Coalesce to empty string when service response has empty content
+                                    if (res === null)
+                                        res = ''
+                                    try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
+                                    if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
+                                        callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
+                                        return;
+                                    }
+                                    callback(null, res);
+                                });
+                            } catch (err) {
+                                setTimeout(callback.bind(this, err), 0);
+                            }
+                        };
+
+                        // Service.Method(rpcImpl, message, callback)
+                        Service[method.name] = function(rpcImpl, req, callback) {
+                            new Service(rpcImpl)[method.name](req, callback);
+                        };
+
+                        if (Object.defineProperty)
+                            Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
+                            Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
+                    })(rpc[i]);
+                }
+
+                // Properties
+
+                /**
+                 * Service options.
+                 * @name ProtoBuf.Builder.Service.$options
+                 * @type {Object.<string,*>}
+                 * @expose
+                 */
+                var $optionsS; // cc needs this
+
+                /**
+                 * Service options.
+                 * @name ProtoBuf.Builder.Service#$options
+                 * @type {Object.<string,*>}
+                 * @expose
+                 */
+                var $options;
+
+                /**
+                 * Reflection type.
+                 * @name ProtoBuf.Builder.Service.$type
+                 * @type {!ProtoBuf.Reflect.Service}
+                 * @expose
+                 */
+                var $typeS;
+
+                /**
+                 * Reflection type.
+                 * @name ProtoBuf.Builder.Service#$type
+                 * @type {!ProtoBuf.Reflect.Service}
+                 * @expose
+                 */
+                var $type;
+
+                if (Object.defineProperty)
+                    Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
+                    Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
+                    Object.defineProperty(Service, "$type", { "value": T }),
+                    Object.defineProperty(ServicePrototype, "$type", { "value": T });
+
+                return Service;
+
+            })(ProtoBuf, this);
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Service
+         * @expose
+         */
+        Reflect.Service = Service;
+
+        /**
+         * Abstract service method.
+         * @exports ProtoBuf.Reflect.Service.Method
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Service} svc Service
+         * @param {string} name Method name
+         * @param {Object.<string,*>=} options Options
+         * @constructor
+         * @extends ProtoBuf.Reflect.T
+         */
+        var Method = function(builder, svc, name, options) {
+            T.call(this, builder, svc, name);
+
+            /**
+             * @override
+             */
+            this.className = "Service.Method";
+
+            /**
+             * Options.
+             * @type {Object.<string, *>}
+             * @expose
+             */
+            this.options = options || {};
+        };
+
+        /**
+         * @alias ProtoBuf.Reflect.Service.Method.prototype
+         * @inner
+         */
+        var MethodPrototype = Method.prototype = Object.create(T.prototype);
+
+        /**
+         * Builds the method's '$options' property.
+         * @name ProtoBuf.Reflect.Service.Method#buildOpt
+         * @function
+         * @return {Object.<string,*>}
+         */
+        MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
+
+        /**
+         * @alias ProtoBuf.Reflect.Service.Method
+         * @expose
+         */
+        Reflect.Service.Method = Method;
+
+        /**
+         * RPC service method.
+         * @exports ProtoBuf.Reflect.Service.RPCMethod
+         * @param {!ProtoBuf.Builder} builder Builder reference
+         * @param {!ProtoBuf.Reflect.Service} svc Service
+         * @param {string} name Method name
+         * @param {string} request Request message name
+         * @param {string} response Response message name
+         * @param {boolean} request_stream Whether requests are streamed
+         * @param {boolean} response_stream Whether responses are streamed
+         * @param {Object.<string,*>=} options Options
+         * @constructor
+         * @extends ProtoBuf.Reflect.Service.Method
+         */
+        var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
+            Method.call(this, builder, svc, name, options);
+
+            /**
+             * @override
+             */
+            this.className = "Service.RPCMethod";
+
+            /**
+             * Request message name.
+             * @type {string}
+             * @expose
+             */
+            this.requestName = request;
+
+            /**
+             * Response message name.
+             * @type {string}
+             * @expose
+             */
+            this.responseName = response;
+
+            /**
+             * Whether requests are streamed
+             * @type {bool}
+             * @expose
+             */
+            this.requestStream = request_stream;
+
+            /**
+             * Whether responses are streamed
+             * @type {bool}
+             * @expose
+             */
+            this.responseStream = response_stream;
+
+            /**
+             * Resolved request message type.
+             * @type {ProtoBuf.Reflect.Message}
+             * @expose
+             */
+            this.resolvedRequestType = null;
+
+            /**
+             * Resolved response message type.
+             * @type {ProtoBuf.Reflect.Message}
+             * @expose
+             */
+            this.resolvedResponseType = null;
+        };
+
+        // Extends Method
+        RPCMethod.prototype = Object.create(Method.prototype);
+
+        /**
+         * @alias ProtoBuf.Reflect.Service.RPCMethod
+         * @expose
+         */
+        Reflect.Service.RPCMethod = RPCMethod;
+
+        return Reflect;
+
+    })(ProtoBuf);
+
+    /**
+     * @alias ProtoBuf.Builder
+     * @expose
+     */
+    ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
+        "use strict";
+
+        /**
+         * Constructs a new Builder.
+         * @exports ProtoBuf.Builder
+         * @class Provides the functionality to build protocol messages.
+         * @param {Object.<string,*>=} options Options
+         * @constructor
+         */
+        var Builder = function(options) {
+
+            /**
+             * Namespace.
+             * @type {ProtoBuf.Reflect.Namespace}
+             * @expose
+             */
+            this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
+
+            /**
+             * Namespace pointer.
+             * @type {ProtoBuf.Reflect.T}
+             * @expose
+             */
+            this.ptr = this.ns;
+
+            /**
+             * Resolved flag.
+             * @type {boolean}
+             * @expose
+             */
+            this.resolved = false;
+
+            /**
+             * The current building result.
+             * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
+             * @expose
+             */
+            this.result = null;
+
+            /**
+             * Imported files.
+             * @type {Array.<string>}
+             * @expose
+             */
+            this.files = {};
+
+            /**
+             * Import root override.
+             * @type {?string}
+             * @expose
+             */
+            this.importRoot = null;
+
+            /**
+             * Options.
+             * @type {!Object.<string, *>}
+             * @expose
+             */
+            this.options = options || {};
+        };
+
+        /**
+         * @alias ProtoBuf.Builder.prototype
+         * @inner
+         */
+        var BuilderPrototype = Builder.prototype;
+
+        // ----- Definition tests -----
+
+        /**
+         * Tests if a definition most likely describes a message.
+         * @param {!Object} def
+         * @returns {boolean}
+         * @expose
+         */
+        Builder.isMessage = function(def) {
+            // Messages require a string name
+            if (typeof def["name"] !== 'string')
+                return false;
+            // Messages do not contain values (enum) or rpc methods (service)
+            if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
+                return false;
+            return true;
+        };
+
+        /**
+         * Tests if a definition most likely describes a message field.
+         * @param {!Object} def
+         * @returns {boolean}
+         * @expose
+         */
+        Builder.isMessageField = function(def) {
+            // Message fields require a string rule, name and type and an id
+            if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
+                return false;
+            return true;
+        };
+
+        /**
+         * Tests if a definition most likely describes an enum.
+         * @param {!Object} def
+         * @returns {boolean}
+         * @expose
+         */
+        Builder.isEnum = function(def) {
+            // Enums require a string name
+            if (typeof def["name"] !== 'string')
+                return false;
+            // Enums require at least one value
+            if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
+                return false;
+            return true;
+        };
+
+        /**
+         * Tests if a definition most likely describes a service.
+         * @param {!Object} def
+         * @returns {boolean}
+         * @expose
+         */
+        Builder.isService = function(def) {
+            // Services require a string name and an rpc object
+            if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
+                return false;
+            return true;
+        };
+
+        /**
+         * Tests if a definition most likely describes an extended message
+         * @param {!Object} def
+         * @returns {boolean}
+         * @expose
+         */
+        Builder.isExtend = function(def) {
+            // Extends rquire a string ref
+            if (typeof def["ref"] !== 'string')
+                return false;
+            return true;
+        };
+
+        // ----- Building -----
+
+        /**
+         * Resets the pointer to the root namespace.
+         * @returns {!ProtoBuf.Builder} this
+         * @expose
+         */
+        BuilderPrototype.reset = function() {
+            this.ptr = this.ns;
+            return this;
+        };
+
+        /**
+         * Defines a namespace on top of the current pointer position and places the pointer on it.
+         * @param {string} namespace
+         * @return {!ProtoBuf.Builder} this
+         * @expose
+         */
+        BuilderPrototype.define = function(namespace) {
+            if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
+                throw Error("illegal namespace: "+namespace);
+            namespace.split(".").forEach(function(part) {
+                var ns = this.ptr.getChild(part);
+                if (ns === null) // Keep existing
+                    this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
+                this.ptr = ns;
+            }, this);
+            return this;
+        };
+
+        /**
+         * Creates the specified definitions at the current pointer position.
+         * @param {!Array.<!Object>} defs Messages, enums or services to create
+         * @returns {!ProtoBuf.Builder} this
+         * @throws {Error} If a message definition is invalid
+         * @expose
+         */
+        BuilderPrototype.create = function(defs) {
+            if (!defs)
+                return this; // Nothing to create
+            if (!Array.isArray(defs))
+                defs = [defs];
+            else {
+                if (defs.length === 0)
+                    return this;
+                defs = defs.slice();
+            }
+
+            // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
+            var stack = [defs];
+            while (stack.length > 0) {
+                defs = stack.pop();
+
+                if (!Array.isArray(defs)) // Stack always contains entire namespaces
+                    throw Error("not a valid namespace: "+JSON.stringify(defs));
+
+                while (defs.length > 0) {
+                    var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
+
+                    if (Builder.isMessage(def)) {
+                        var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
+
+                        // Create OneOfs
+                        var oneofs = {};
+                        if (def["oneofs"])
+                            Object.keys(def["oneofs"]).forEach(function(name) {
+                                obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
+                            }, this);
+
+                        // Create fields
+                        if (def["fields"])
+                            def["fields"].forEach(function(fld) {
+                                if (obj.getChild(fld["id"]|0) !== null)
+                                    throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
+                                if (fld["options"] && typeof fld["options"] !== 'object')
+                                    throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
+                                var oneof = null;
+                                if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
+                                    throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
+                                fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
+                                if (oneof)
+                                    oneof.fields.push(fld);
+                                obj.addChild(fld);
+                            }, this);
+
+                        // Push children to stack
+                        var subObj = [];
+                        if (def["enums"])
+                            def["enums"].forEach(function(enm) {
+                                subObj.push(enm);
+                            });
+                        if (def["messages"])
+                            def["messages"].forEach(function(msg) {
+                                subObj.push(msg);
+                            });
+                        if (def["services"])
+                            def["services"].forEach(function(svc) {
+                                subObj.push(svc);
+                            });
+
+                        // Set extension ranges
+                        if (def["extensions"]) {
+                            if (typeof def["extensions"][0] === 'number') // pre 5.0.1
+                                obj.extensions = [ def["extensions"] ];
+                            else
+                                obj.extensions = def["extensions"];
+                        }
+
+                        // Create on top of current namespace
+                        this.ptr.addChild(obj);
+                        if (subObj.length > 0) {
+                            stack.push(defs); // Push the current level back
+                            defs = subObj; // Continue processing sub level
+                            subObj = null;
+                            this.ptr = obj; // And move the pointer to this namespace
+                            obj = null;
+                            continue;
+                        }
+                        subObj = null;
+
+                    } else if (Builder.isEnum(def)) {
+
+                        obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
+                        def["values"].forEach(function(val) {
+                            obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
+                        }, this);
+                        this.ptr.addChild(obj);
+
+                    } else if (Builder.isService(def)) {
+
+                        obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
+                        Object.keys(def["rpc"]).forEach(function(name) {
+                            var mtd = def["rpc"][name];
+                            obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
+                        }, this);
+                        this.ptr.addChild(obj);
+
+                    } else if (Builder.isExtend(def)) {
+
+                        obj = this.ptr.resolve(def["ref"], true);
+                        if (obj) {
+                            def["fields"].forEach(function(fld) {
+                                if (obj.getChild(fld['id']|0) !== null)
+                                    throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
+                                // Check if field id is allowed to be extended
+                                if (obj.extensions) {
+                                    var valid = false;
+                                    obj.extensions.forEach(function(range) {
+                                        if (fld["id"] >= range[0] && fld["id"] <= range[1])
+                                            valid = true;
+                                    });
+                                    if (!valid)
+                                        throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
+                                }
+                                // Convert extension field names to camel case notation if the override is set
+                                var name = fld["name"];
+                                if (this.options['convertFieldsToCamelCase'])
+                                    name = ProtoBuf.Util.toCamelCase(name);
+                                // see #161: Extensions use their fully qualified name as their runtime key and...
+                                var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
+                                // ...are added on top of the current namespace as an extension which is used for
+                                // resolving their type later on (the extension always keeps the original name to
+                                // prevent naming collisions)
+                                var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
+                                field.extension = ext;
+                                this.ptr.addChild(ext);
+                                obj.addChild(field);
+                            }, this);
+
+                        } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
+                            throw Error("extended message "+def["ref"]+" is not defined");
+
+                    } else
+                        throw Error("not a valid definition: "+JSON.stringify(def));
+
+                    def = null;
+                    obj = null;
+                }
+                // Break goes here
+                defs = null;
+                this.ptr = this.ptr.parent; // Namespace done, continue at parent
+            }
+            this.resolved = false; // Require re-resolve
+            this.result = null; // Require re-build
+            return this;
+        };
+
+        /**
+         * Propagates syntax to all children.
+         * @param {!Object} parent
+         * @inner
+         */
+        function propagateSyntax(parent) {
+            if (parent['messages']) {
+                parent['messages'].forEach(function(child) {
+                    child["syntax"] = parent["syntax"];
+                    propagateSyntax(child);
+                });
+            }
+            if (parent['enums']) {
+                parent['enums'].forEach(function(child) {
+                    child["syntax"] = parent["syntax"];
+                });
+            }
+        }
+
+        /**
+         * Imports another definition into this builder.
+         * @param {Object.<string,*>} json Parsed import
+         * @param {(string|{root: string, file: string})=} filename Imported file name
+         * @returns {!ProtoBuf.Builder} this
+         * @throws {Error} If the definition or file cannot be imported
+         * @expose
+         */
+        BuilderPrototype["import"] = function(json, filename) {
+            var delim = '/';
+
+            // Make sure to skip duplicate imports
+
+            if (typeof filename === 'string') {
+
+                if (ProtoBuf.Util.IS_NODE)
+                    filename = require("path")['resolve'](filename);
+                if (this.files[filename] === true)
+                    return this.reset();
+                this.files[filename] = true;
+
+            } else if (typeof filename === 'object') { // Object with root, file.
+
+                var root = filename.root;
+                if (ProtoBuf.Util.IS_NODE)
+                    root = require("path")['resolve'](root);
+                if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
+                    delim = '\\';
+                var fname;
+                if (ProtoBuf.Util.IS_NODE)
+                    fname = require("path")['join'](root, filename.file);
+                else
+                    fname = root + delim + filename.file;
+                if (this.files[fname] === true)
+                    return this.reset();
+                this.files[fname] = true;
+            }
+
+            // Import imports
+
+            if (json['imports'] && json['imports'].length > 0) {
+                var importRoot,
+                    resetRoot = false;
+
+                if (typeof filename === 'object') { // If an import root is specified, override
+
+                    this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
+                    importRoot = this.importRoot;
+                    filename = filename["file"];
+                    if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
+                        delim = '\\';
+
+                } else if (typeof filename === 'string') {
+
+                    if (this.importRoot) // If import root is overridden, use it
+                        importRoot = this.importRoot;
+                    else { // Otherwise compute from filename
+                        if (filename.indexOf("/") >= 0) { // Unix
+                            importRoot = filename.replace(/\/[^\/]*$/, "");
+                            if (/* /file.proto */ importRoot === "")
+                                importRoot = "/";
+                        } else if (filename.indexOf("\\") >= 0) { // Windows
+                            importRoot = filename.replace(/\\[^\\]*$/, "");
+                            delim = '\\';
+                        } else
+                            importRoot = ".";
+                    }
+
+                } else
+                    importRoot = null;
+
+                for (var i=0; i<json['imports'].length; i++) {
+                    if (typeof json['imports'][i] === 'string') { // Import file
+                        if (!importRoot)
+                            throw Error("cannot determine import root");
+                        var importFilename = json['imports'][i];
+                        if (importFilename === "google/protobuf/descriptor.proto")
+                            continue; // Not needed and therefore not used
+                        if (ProtoBuf.Util.IS_NODE)
+                            importFilename = require("path")['join'](importRoot, importFilename);
+                        else
+                            importFilename = importRoot + delim + importFilename;
+                        if (this.files[importFilename] === true)
+                            continue; // Already imported
+                        if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto)       // If this is a light build
+                            importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
+                        var contents = ProtoBuf.Util.fetch(importFilename);
+                        if (contents === null)
+                            throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
+                        if (/\.json$/i.test(importFilename)) // Always possible
+                            this["import"](JSON.parse(contents+""), importFilename); // May throw
+                        else
+                            this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
+                    } else // Import structure
+                        if (!filename)
+                            this["import"](json['imports'][i]);
+                        else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
+                            this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
+                        else // Without extension: Append _importN to make it unique
+                            this["import"](json['imports'][i], filename+"_import"+i);
+                }
+                if (resetRoot) // Reset import root override when all imports are done
+                    this.importRoot = null;
+            }
+
+            // Import structures
+
+            if (json['package'])
+                this.define(json['package']);
+            if (json['syntax'])
+                propagateSyntax(json);
+            var base = this.ptr;
+            if (json['options'])
+                Object.keys(json['options']).forEach(function(key) {
+                    base.options[key] = json['options'][key];
+                });
+            if (json['messages'])
+                this.create(json['messages']),
+                this.ptr = base;
+            if (json['enums'])
+                this.create(json['enums']),
+                this.ptr = base;
+            if (json['services'])
+                this.create(json['services']),
+                this.ptr = base;
+            if (json['extends'])
+                this.create(json['extends']);
+
+            return this.reset();
+        };
+
+        /**
+         * Resolves all namespace objects.
+         * @throws {Error} If a type cannot be resolved
+         * @returns {!ProtoBuf.Builder} this
+         * @expose
+         */
+        BuilderPrototype.resolveAll = function() {
+            // Resolve all reflected objects
+            var res;
+            if (this.ptr == null || typeof this.ptr.type === 'object')
+                return this; // Done (already resolved)
+
+            if (this.ptr instanceof Reflect.Namespace) { // Resolve children
+
+                this.ptr.children.forEach(function(child) {
+                    this.ptr = child;
+                    this.resolveAll();
+                }, this);
+
+            } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
+
+                if (!Lang.TYPE.test(this.ptr.type)) {
+                    if (!Lang.TYPEREF.test(this.ptr.type))
+                        throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
+                    res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
+                    if (!res)
+                        throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
+                    this.ptr.resolvedType = res;
+                    if (res instanceof Reflect.Enum) {
+                        this.ptr.type = ProtoBuf.TYPES["enum"];
+                        if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
+                            throw Error("proto3 message cannot reference proto2 enum");
+                    }
+                    else if (res instanceof Reflect.Message)
+                        this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
+                    else
+                        throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
+                } else
+                    this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
+
+                // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
+                // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
+                if (this.ptr.map) {
+                    if (!Lang.TYPE.test(this.ptr.keyType))
+                        throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
+                    this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
+                }
+
+                // If it's a repeated and packable field then proto3 mandates it should be packed by
+                // default
+                if (
+                  this.ptr.syntax === 'proto3' &&
+                  this.ptr.repeated && this.ptr.options.packed === undefined &&
+                  ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1
+                ) {
+                  this.ptr.options.packed = true;
+                }
+
+            } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
+
+                if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
+                    res = this.ptr.parent.resolve(this.ptr.requestName, true);
+                    if (!res || !(res instanceof ProtoBuf.Reflect.Message))
+                        throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
+                    this.ptr.resolvedRequestType = res;
+                    res = this.ptr.parent.resolve(this.ptr.responseName, true);
+                    if (!res || !(res instanceof ProtoBuf.Reflect.Message))
+                        throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
+                    this.ptr.resolvedResponseType = res;
+                } else // Should not happen as nothing else is implemented
+                    throw Error("illegal service type in "+this.ptr.toString(true));
+
+            } else if (
+                !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
+                !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
+                !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
+            )
+                throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
+
+            return this.reset();
+        };
+
+        /**
+         * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
+         * return the built package.
+         * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
+         * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
+         * @throws {Error} If a type could not be resolved
+         * @expose
+         */
+        BuilderPrototype.build = function(path) {
+            this.reset();
+            if (!this.resolved)
+                this.resolveAll(),
+                this.resolved = true,
+                this.result = null; // Require re-build
+            if (this.result === null) // (Re-)Build
+                this.result = this.ns.build();
+            if (!path)
+                return this.result;
+            var part = typeof path === 'string' ? path.split(".") : path,
+                ptr = this.result; // Build namespace pointer (no hasChild etc.)
+            for (var i=0; i<part.length; i++)
+                if (ptr[part[i]])
+                    ptr = ptr[part[i]];
+                else {
+                    ptr = null;
+                    break;
+                }
+            return ptr;
+        };
+
+        /**
+         * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
+         * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
+         * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
+         * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
+         */
+        BuilderPrototype.lookup = function(path, excludeNonNamespace) {
+            return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
+        };
+
+        /**
+         * Returns a string representation of this object.
+         * @return {string} String representation as of "Builder"
+         * @expose
+         */
+        BuilderPrototype.toString = function() {
+            return "Builder";
+        };
+
+        // ----- Base classes -----
+        // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
+
+        /**
+         * @alias ProtoBuf.Builder.Message
+         */
+        Builder.Message = function() {};
+
+        /**
+         * @alias ProtoBuf.Builder.Enum
+         */
+        Builder.Enum = function() {};
+
+        /**
+         * @alias ProtoBuf.Builder.Message
+         */
+        Builder.Service = function() {};
+
+        return Builder;
+
+    })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
+
+    /**
+     * @alias ProtoBuf.Map
+     * @expose
+     */
+    ProtoBuf.Map = (function(ProtoBuf, Reflect) {
+        "use strict";
+
+        /**
+         * Constructs a new Map. A Map is a container that is used to implement map
+         * fields on message objects. It closely follows the ES6 Map API; however,
+         * it is distinct because we do not want to depend on external polyfills or
+         * on ES6 itself.
+         *
+         * @exports ProtoBuf.Map
+         * @param {!ProtoBuf.Reflect.Field} field Map field
+         * @param {Object.<string,*>=} contents Initial contents
+         * @constructor
+         */
+        var Map = function(field, contents) {
+            if (!field.map)
+                throw Error("field is not a map");
+
+            /**
+             * The field corresponding to this map.
+             * @type {!ProtoBuf.Reflect.Field}
+             */
+            this.field = field;
+
+            /**
+             * Element instance corresponding to key type.
+             * @type {!ProtoBuf.Reflect.Element}
+             */
+            this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
+
+            /**
+             * Element instance corresponding to value type.
+             * @type {!ProtoBuf.Reflect.Element}
+             */
+            this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
+
+            /**
+             * Internal map: stores mapping of (string form of key) -> (key, value)
+             * pair.
+             *
+             * We provide map semantics for arbitrary key types, but we build on top
+             * of an Object, which has only string keys. In order to avoid the need
+             * to convert a string key back to its native type in many situations,
+             * we store the native key value alongside the value. Thus, we only need
+             * a one-way mapping from a key type to its string form that guarantees
+             * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
+             * === K2).
+             *
+             * @type {!Object<string, {key: *, value: *}>}
+             */
+            this.map = {};
+
+            /**
+             * Returns the number of elements in the map.
+             */
+            Object.defineProperty(this, "size", {
+                get: function() { return Object.keys(this.map).length; }
+            });
+
+            // Fill initial contents from a raw object.
+            if (contents) {
+                var keys = Object.keys(contents);
+                for (var i = 0; i < keys.length; i++) {
+                    var key = this.keyElem.valueFromString(keys[i]);
+                    var val = this.valueElem.verifyValue(contents[keys[i]]);
+                    this.map[this.keyElem.valueToString(key)] =
+                        { key: key, value: val };
+                }
+            }
+        };
+
+        var MapPrototype = Map.prototype;
+
+        /**
+         * Helper: return an iterator over an array.
+         * @param {!Array<*>} arr the array
+         * @returns {!Object} an iterator
+         * @inner
+         */
+        function arrayIterator(arr) {
+            var idx = 0;
+            return {
+                next: function() {
+                    if (idx < arr.length)
+                        return { done: false, value: arr[idx++] };
+                    return { done: true };
+                }
+            }
+        }
+
+        /**
+         * Clears the map.
+         */
+        MapPrototype.clear = function() {
+            this.map = {};
+        };
+
+        /**
+         * Deletes a particular key from the map.
+         * @returns {boolean} Whether any entry with this key was deleted.
+         */
+        MapPrototype["delete"] = function(key) {
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
+            var hadKey = keyValue in this.map;
+            delete this.map[keyValue];
+            return hadKey;
+        };
+
+        /**
+         * Returns an iterator over [key, value] pairs in the map.
+         * @returns {Object} The iterator
+         */
+        MapPrototype.entries = function() {
+            var entries = [];
+            var strKeys = Object.keys(this.map);
+            for (var i = 0, entry; i < strKeys.length; i++)
+                entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
+            return arrayIterator(entries);
+        };
+
+        /**
+         * Returns an iterator over keys in the map.
+         * @returns {Object} The iterator
+         */
+        MapPrototype.keys = function() {
+            var keys = [];
+            var strKeys = Object.keys(this.map);
+            for (var i = 0; i < strKeys.length; i++)
+                keys.push(this.map[strKeys[i]].key);
+            return arrayIterator(keys);
+        };
+
+        /**
+         * Returns an iterator over values in the map.
+         * @returns {!Object} The iterator
+         */
+        MapPrototype.values = function() {
+            var values = [];
+            var strKeys = Object.keys(this.map);
+            for (var i = 0; i < strKeys.length; i++)
+                values.push(this.map[strKeys[i]].value);
+            return arrayIterator(values);
+        };
+
+        /**
+         * Iterates over entries in the map, calling a function on each.
+         * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
+         * @param {Object=} thisArg The `this` value for the callback
+         */
+        MapPrototype.forEach = function(cb, thisArg) {
+            var strKeys = Object.keys(this.map);
+            for (var i = 0, entry; i < strKeys.length; i++)
+                cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
+        };
+
+        /**
+         * Sets a key in the map to the given value.
+         * @param {*} key The key
+         * @param {*} value The value
+         * @returns {!ProtoBuf.Map} The map instance
+         */
+        MapPrototype.set = function(key, value) {
+            var keyValue = this.keyElem.verifyValue(key);
+            var valValue = this.valueElem.verifyValue(value);
+            this.map[this.keyElem.valueToString(keyValue)] =
+                { key: keyValue, value: valValue };
+            return this;
+        };
+
+        /**
+         * Gets the value corresponding to a key in the map.
+         * @param {*} key The key
+         * @returns {*|undefined} The value, or `undefined` if key not present
+         */
+        MapPrototype.get = function(key) {
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
+            if (!(keyValue in this.map))
+                return undefined;
+            return this.map[keyValue].value;
+        };
+
+        /**
+         * Determines whether the given key is present in the map.
+         * @param {*} key The key
+         * @returns {boolean} `true` if the key is present
+         */
+        MapPrototype.has = function(key) {
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
+            return (keyValue in this.map);
+        };
+
+        return Map;
+    })(ProtoBuf, ProtoBuf.Reflect);
+
+
+    /**
+     * Loads a .proto string and returns the Builder.
+     * @param {string} proto .proto file contents
+     * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
+     * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
+     * @return {ProtoBuf.Builder} Builder to create new messages
+     * @throws {Error} If the definition cannot be parsed or built
+     * @expose
+     */
+    ProtoBuf.loadProto = function(proto, builder, filename) {
+        if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
+            filename = builder,
+            builder = undefined;
+        return ProtoBuf.loadJson(ProtoBuf.DotProto.Parser.parse(proto), builder, filename);
+    };
+
+    /**
+     * Loads a .proto string and returns the Builder. This is an alias of {@link ProtoBuf.loadProto}.
+     * @function
+     * @param {string} proto .proto file contents
+     * @param {(ProtoBuf.Builder|string)=} builder Builder to append to. Will create a new one if omitted.
+     * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
+     * @return {ProtoBuf.Builder} Builder to create new messages
+     * @throws {Error} If the definition cannot be parsed or built
+     * @expose
+     */
+    ProtoBuf.protoFromString = ProtoBuf.loadProto; // Legacy
+
+    /**
+     * Loads a .proto file and returns the Builder.
+     * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with
+     *  an overridden 'root' path for all imported files.
+     * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
+     *  the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
+     *  file will be read synchronously and this function will return the Builder.
+     * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
+     * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
+     *   request has failed), else undefined
+     * @expose
+     */
+    ProtoBuf.loadProtoFile = function(filename, callback, builder) {
+        if (callback && typeof callback === 'object')
+            builder = callback,
+            callback = null;
+        else if (!callback || typeof callback !== 'function')
+            callback = null;
+        if (callback)
+            return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
+                if (contents === null) {
+                    callback(Error("Failed to fetch file"));
+                    return;
+                }
+                try {
+                    callback(null, ProtoBuf.loadProto(contents, builder, filename));
+                } catch (e) {
+                    callback(e);
+                }
+            });
+        var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
+        return contents === null ? null : ProtoBuf.loadProto(contents, builder, filename);
+    };
+
+    /**
+     * Loads a .proto file and returns the Builder. This is an alias of {@link ProtoBuf.loadProtoFile}.
+     * @function
+     * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with
+     *  an overridden 'root' path for all imported files.
+     * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
+     *  the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
+     *  file will be read synchronously and this function will return the Builder.
+     * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
+     * @return {!ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
+     *   request has failed), else undefined
+     * @expose
+     */
+    ProtoBuf.protoFromFile = ProtoBuf.loadProtoFile; // Legacy
+
+
+    /**
+     * Constructs a new empty Builder.
+     * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
+     * @return {!ProtoBuf.Builder} Builder
+     * @expose
+     */
+    ProtoBuf.newBuilder = function(options) {
+        options = options || {};
+        if (typeof options['convertFieldsToCamelCase'] === 'undefined')
+            options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
+        if (typeof options['populateAccessors'] === 'undefined')
+            options['populateAccessors'] = ProtoBuf.populateAccessors;
+        return new ProtoBuf.Builder(options);
+    };
+
+    /**
+     * Loads a .json definition and returns the Builder.
+     * @param {!*|string} json JSON definition
+     * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
+     * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
+     * @return {ProtoBuf.Builder} Builder to create new messages
+     * @throws {Error} If the definition cannot be parsed or built
+     * @expose
+     */
+    ProtoBuf.loadJson = function(json, builder, filename) {
+        if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
+            filename = builder,
+            builder = null;
+        if (!builder || typeof builder !== 'object')
+            builder = ProtoBuf.newBuilder();
+        if (typeof json === 'string')
+            json = JSON.parse(json);
+        builder["import"](json, filename);
+        builder.resolveAll();
+        return builder;
+    };
+
+    /**
+     * Loads a .json file and returns the Builder.
+     * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
+     *  an overridden 'root' path for all imported files.
+     * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
+     *  the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
+     *  file will be read synchronously and this function will return the Builder.
+     * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
+     * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
+     *   request has failed), else undefined
+     * @expose
+     */
+    ProtoBuf.loadJsonFile = function(filename, callback, builder) {
+        if (callback && typeof callback === 'object')
+            builder = callback,
+            callback = null;
+        else if (!callback || typeof callback !== 'function')
+            callback = null;
+        if (callback)
+            return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
+                if (contents === null) {
+                    callback(Error("Failed to fetch file"));
+                    return;
+                }
+                try {
+                    callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
+                } catch (e) {
+                    callback(e);
+                }
+            });
+        var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
+        return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
+    };
+
+    return ProtoBuf;
+});
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.eot b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.eot new file mode 100644 index 0000000..5d20d91 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.eot differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.svg b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.svg new file mode 100644 index 0000000..3ed7be4 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.woff b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.woff new file mode 100644 index 0000000..1205787 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Bold-webfont.woff differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.eot b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.eot new file mode 100644 index 0000000..1f639a1 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.eot differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.svg b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.svg new file mode 100644 index 0000000..6a2607b --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.woff b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.woff new file mode 100644 index 0000000..ed760c0 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-BoldItalic-webfont.woff differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.eot b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.eot new file mode 100644 index 0000000..0c8a0ae Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.eot differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.svg b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.svg new file mode 100644 index 0000000..e1075dc --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.woff b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.woff new file mode 100644 index 0000000..ff652e6 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Italic-webfont.woff differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.eot b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.eot new file mode 100644 index 0000000..1486840 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.eot differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.svg b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.svg new file mode 100644 index 0000000..11a472c --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.woff b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.woff new file mode 100644 index 0000000..e786074 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Light-webfont.woff differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.eot b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.eot new file mode 100644 index 0000000..8f44592 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.eot differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.svg b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.svg new file mode 100644 index 0000000..431d7e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.svg @@ -0,0 +1,1835 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.woff b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.woff new file mode 100644 index 0000000..43e8b9e Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-LightItalic-webfont.woff differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.eot b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.eot new file mode 100644 index 0000000..6bbc3cf Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.eot differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.svg b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.svg new file mode 100644 index 0000000..25a3952 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.woff b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.woff new file mode 100644 index 0000000..e231183 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/docs/fonts/OpenSans-Regular-webfont.woff differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/index.html b/legacy-libs/grpc/node_modules/protobufjs/docs/index.html new file mode 100644 index 0000000..3493d2f --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/index.html @@ -0,0 +1,65 @@ + + + + + JSDoc: Home + + + + + + + + + + +
+ +

Home

+ + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) +
+ + + + + \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/linenumber.js b/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/linenumber.js new file mode 100644 index 0000000..8d52f7e --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/linenumber.js @@ -0,0 +1,25 @@ +/*global document */ +(function() { + var source = document.getElementsByClassName('prettyprint source linenums'); + var i = 0; + var lineNumber = 0; + var lineId; + var lines; + var totalLines; + var anchorHash; + + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; + + for (; i < totalLines; i++) { + lineNumber++; + lineId = 'line' + lineNumber; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } + } +})(); diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/prettify/Apache-License-2.0.txt b/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + 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/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/prettify/lang-css.js b/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/prettify/lang-css.js new file mode 100644 index 0000000..041e1f5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/prettify/lang-css.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", +/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/prettify/prettify.js b/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/prettify/prettify.js new file mode 100644 index 0000000..eef5ad7 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/scripts/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"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"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"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"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"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"], +J=[v,"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"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"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"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["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"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["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"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"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",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"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", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p p:first-child, +.props td.description > p:first-child +{ + margin-top: 0; + padding-top: 0; +} + +.params td.description > p:last-child, +.props td.description > p:last-child +{ + margin-bottom: 0; + padding-bottom: 0; +} + +.disabled { + color: #454545; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/styles/prettify-jsdoc.css b/legacy-libs/grpc/node_modules/protobufjs/docs/styles/prettify-jsdoc.css new file mode 100644 index 0000000..5a2526e --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/docs/styles/prettify-tomorrow.css b/legacy-libs/grpc/node_modules/protobufjs/docs/styles/prettify-tomorrow.css new file mode 100644 index 0000000..b6f92a7 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/docs/styles/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@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; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/legacy-libs/grpc/node_modules/protobufjs/donate.png b/legacy-libs/grpc/node_modules/protobufjs/donate.png new file mode 100644 index 0000000..207d001 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/donate.png differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/README.md b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/README.md new file mode 100644 index 0000000..e82333b --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/README.md @@ -0,0 +1,28 @@ +ProtoBuf.js protoify example +============================ +This example shows the general usage of ProtoBuf.js by converting JSON structures to protocol buffers and vice versa +using a definition describing JSON itself. While this works as an example, it does not provide any real world benefits +(well, this is if you are not building a protobuf-backed database for JSON data, using inter-field substitution to +minimize redundancy - nevermind, forget that). + +Instructions +------------ +1. Set up dependencies: `npm install` +2. Run: `npm test` + +Now you know no more and no less than that it works and you might want to inspect the following files to get the 'how': + +* **[index.js](https://github.com/dcodeIO/ProtoBuf.js/blob/master/examples/protoify/index.js)** + contains the sample's source code + +* **[json.proto](https://github.com/dcodeIO/ProtoBuf.js/blob/master/examples/protoify/json.proto)** + contains the protobuf definition used + +* **[json.json](https://github.com/dcodeIO/ProtoBuf.js/blob/master/examples/protoify/json.json)** + contains the protobuf definition converted through `proto2js json.proto > json.json` + +* **[json.js](https://github.com/dcodeIO/ProtoBuf.js/blob/master/examples/protoify/json.js)** + contains the protobuf definition converted through `proto2js json.proto -commonjs=js > json.js` + +* **[test.js](https://github.com/dcodeIO/ProtoBuf.js/blob/master/examples/protoify/test.js)** + contains our simple test suite diff --git a/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/index.js b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/index.js new file mode 100644 index 0000000..94f066a --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/index.js @@ -0,0 +1,147 @@ +var ProtoBuf = require("protobufjs"), + ByteBuffer = ProtoBuf.ByteBuffer, // ProtoBuf.js uses and also exposes ByteBuffer.js + Long = ProtoBuf.Long; // as well as Long.js (not used in this example) + +// Option 1: Loading the .proto file directly +var builder = ProtoBuf.loadProtoFile("./json.proto"), // Creates the Builder + JS = builder.build("js"); // Returns just the 'js' namespace if that's all we need + +// Option 2: Loading the .json file generated through 'proto2js json.proto > json.json' +var root = ProtoBuf.loadJsonFile("./json.json").build(), // Here we make the Builder return the root namespace + JS = root.js; // then we reference 'js' inside. Both is possible. + +// Option 3: Loading the module generated through 'proto2js json.proto -commonjs=js > json.js' +var JS = require("./json.js"); // Returns what is specified with -commonjs[=XX] (omitted=root) + +// `JS` now contains the js namespace from json.proto: Value, Array and Object + +// This is how we use these classes: + +/** + * Converts a JSON-like structure to JS-Namespace values. + * @param {*} val JSON + * @returns {!JS.Value} JS-Namespace value + * @inner + */ +function _protoify(val) { + switch (typeof val) { + case 'number': + if (val%1 === 0 && val >= (0x80000000|0) && val <= (0x7fffffff|0)) + return new JS.Value(val); // sets the first field declared in .js.Value + else + return new JS.Value(null, val); // sets the second field + case 'string': + return new JS.Value({ 'string': val }); // uses object notation instead + case 'boolean': + return new JS.Value({ 'boolean': val }); + case 'object': + if (val === null) + return new JS.Value({ 'null': true }); + if (Object.prototype.toString.call(val) === "[object Array]") { + var arr = new JS.Array(); + for (var i=0; i 2048) + tempBuffer = ByteBuffer.allocate(1024); + // In case this module is running inside of a daemon, we'd just call this + // method every now and then to discard the tempBuffer if it becomes too + // large. This is just an example on how to reuse ByteBuffers effectively. + // You may consider something like this for the performance benefit, which + // is decreasing the memory allocation footprint of your app. +}; + +// Have a nice day! diff --git a/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/json.js b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/json.js new file mode 100644 index 0000000..3f78846 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/json.js @@ -0,0 +1,123 @@ +module.exports = require("protobufjs").newBuilder({})["import"]({ + "package": "js", + "messages": [ + { + "name": "Value", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "sint32", + "name": "integer", + "id": 1, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "double", + "name": "double", + "id": 2, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "string", + "id": 3, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "boolean", + "id": 4, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "null", + "id": 5, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "Array", + "name": "array", + "id": 6, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "Object", + "name": "object", + "id": 7, + "oneof": "type" + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": { + "type": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ] + } + }, + { + "name": "Array", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "values", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Object", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "keys", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "values", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] +}).build("js"); diff --git a/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/json.json b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/json.json new file mode 100644 index 0000000..26ed18f --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/json.json @@ -0,0 +1,123 @@ +{ + "package": "js", + "messages": [ + { + "name": "Value", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "sint32", + "name": "integer", + "id": 1, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "double", + "name": "double", + "id": 2, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "string", + "id": 3, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "boolean", + "id": 4, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "null", + "id": 5, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "Array", + "name": "array", + "id": 6, + "oneof": "type" + }, + { + "rule": "optional", + "options": {}, + "type": "Object", + "name": "object", + "id": 7, + "oneof": "type" + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": { + "type": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ] + } + }, + { + "name": "Array", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "values", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Object", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "keys", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "Value", + "name": "values", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/json.proto b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/json.proto new file mode 100644 index 0000000..d543392 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/json.proto @@ -0,0 +1,30 @@ +// Everything below is located in the js-namespace +package js; + +// Represents a JavaScript value. +// Contains exactly one or zero fields. +message Value { + oneof type { + sint32 integer = 1; + double double = 2; + string string = 3; + bool boolean = 4; + bool null = 5; + Array array = 6; + Object object = 7; + // if none is set: undefined + } +} + +// Represents a JavaScript array. +// Contains zero to N values. +message Array { + repeated Value values = 1; +} + +// Represents a JavaScript object. +// Contains zero to N keys with associated values. +message Object { + repeated Value keys = 1; + repeated Value values = 2; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/package.json b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/package.json new file mode 100644 index 0000000..f03b843 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/package.json @@ -0,0 +1,15 @@ +{ + "name": "protobufjs-protoify-example", + "version": "1.0.0", + "main": "index.js", + "dependencies": { + "protobufjs": "~3.7" + }, + "engines": { + "node": ">=0.8" + }, + "scripts": { + "test": "node test.js" + }, + "private": true +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/test.js b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/test.js new file mode 100644 index 0000000..c6c9e0d --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/examples/protoify/test.js @@ -0,0 +1,56 @@ +var protoify = require("./index.js"), + ByteBuffer = require("protobufjs").ByteBuffer, + assert = require("assert"); + +// Array of samples to test +var samples = [ + 1, -1, 0x80000000|0, 0x7fffffff|0, // Integers + 0.1, 0.2, 1.234, // Doubles + "John", // String + true, false, // Booleans + null, // null + [], // Array + {}, // Object + undefined, // undefined + [ // Array holding each data type + 1, + 0.1, + "John", + true, + false, + null, + [], + {}, + undefined + ], + { // Object holding each data type + 1: 1, + 0.1: 0.1, + "John": "John", + true: true, + false: false, + null: null, + array: [], + object: {}, + undefined: undefined + } +]; + +samples.forEach(function(sample) { + // Encode each sample to a Buffer + var buf = protoify(sample); + + // Print some nice debugging information + console.log(JSON.stringify(sample)); + console.log("-------------------------------------------------------------------"); + console.log(ByteBuffer.wrap(buf).toDebug(true)); + + // Decode the Buffer back to JSON + var decodedSample = protoify.parse(buf); + + // And assert that it's actually equal + assert.deepEqual(decodedSample, sample); +}); + +// If no assertion errors are thrown, print +console.log("OK"); diff --git a/legacy-libs/grpc/node_modules/protobufjs/examples/websocket/README.md b/legacy-libs/grpc/node_modules/protobufjs/examples/websocket/README.md new file mode 100644 index 0000000..6a2c403 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/examples/websocket/README.md @@ -0,0 +1,9 @@ +ProtoBuf.js WebSocket example +============================= +This example shows how to use binary websockets to transfer protocol buffers. + +Instructions +------------ +1. Set up dependencies: `npm install` +2. Run: `node server.js` +3. Open [http://localhost:8080/](http://localhost:8080/) in a recent browser diff --git a/legacy-libs/grpc/node_modules/protobufjs/examples/websocket/package.json b/legacy-libs/grpc/node_modules/protobufjs/examples/websocket/package.json new file mode 100644 index 0000000..3090d31 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/examples/websocket/package.json @@ -0,0 +1,16 @@ +{ + "name": "protobufjs-websocket-example", + "version": "1.1.0", + "dependencies": { + "protobufjs": "~3", + "ws": "~0.4", + "open": "0.0.3" + }, + "engines": { + "node": ">=0.8" + }, + "scripts": { + "run": "node server.js" + }, + "private": true +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/examples/websocket/server.js b/legacy-libs/grpc/node_modules/protobufjs/examples/websocket/server.js new file mode 100644 index 0000000..514cb15 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/examples/websocket/server.js @@ -0,0 +1,97 @@ +// Set up: npm install +var http = require("http"), + fs = require("fs"), + path = require("path"), + ws = require("ws"), + open = require("open"), + ProtoBuf = require("protobufjs"); + +// Copy dependencies to "www/" (example specific, you usually don't have to care +var deps = [ + ["Long.min.js", "./node_modules/long/dist/Long.min.js"], + ["ByteBufferAB.min.js", "./node_modules/bytebuffer/dist/ByteBufferAB.min.js"], + ["ProtoBuf.min.js", "./node_modules/protobufjs/dist/ProtoBuf.min.js"] +]; +for (var i=0, dep, data; i + + + + + + + + +
+ + + + + diff --git a/legacy-libs/grpc/node_modules/protobufjs/externs/fs.js b/legacy-libs/grpc/node_modules/protobufjs/externs/fs.js new file mode 100644 index 0000000..04b422d --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/externs/fs.js @@ -0,0 +1,644 @@ +/* + * Copyright 2012 The Closure Compiler 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. + */ + +/** + * @fileoverview Definitions for node's "fs" module. + * @see http://nodejs.org/api/fs.html + * @externs + * @author Daniel Wirtz + */ + +/** + BEGIN_NODE_INCLUDE + var fs = require('fs'); + END_NODE_INCLUDE + */ + +var fs = {}; + +/** + * @param {string} oldPath + * @param {string} newPath + * @param {function(...)=} callback + */ +fs.rename = function(oldPath, newPath, callback) {}; + +/** + * @param {string} oldPath + * @param {string} newPath + */ +fs.renameSync = function(oldPath, newPath) {}; + +/** + * @param {*} fd + * @param {number} len + * @param {function(...)=} callback + */ +fs.truncate = function(fd, len, callback) {}; + +/** + * @param {*} fd + * @param {number} len + */ +fs.truncateSync = function(fd, len) {}; + +/** + * @param {string} path + * @param {number} uid + * @param {number} gid + * @param {function(...)=} callback + */ +fs.chown = function(path, uid, gid, callback) {}; + +/** + * @param {string} path + * @param {number} uid + * @param {number} gid + */ +fs.chownSync = function(path, uid, gid) {}; + +/** + * @param {*} fd + * @param {number} uid + * @param {number} gid + * @param {function(...)=} callback + */ +fs.fchown = function(fd, uid, gid, callback) {}; + +/** + * @param {*} fd + * @param {number} uid + * @param {number} gid + */ +fs.fchownSync = function(fd, uid, gid) {}; + +/** + * @param {string} path + * @param {number} uid + * @param {number} gid + * @param {function(...)=} callback + */ +fs.lchown = function(path, uid, gid, callback) {}; + +/** + * @param {string} path + * @param {number} uid + * @param {number} gid + */ +fs.lchownSync = function(path, uid, gid) {}; + +/** + * @param {string} path + * @param {number} mode + * @param {function(...)=} callback + */ +fs.chmod = function(path, mode, callback) {}; + +/** + * @param {string} path + * @param {number} mode + */ +fs.chmodSync = function(path, mode) {}; + +/** + * @param {*} fd + * @param {number} mode + * @param {function(...)=} callback + */ +fs.fchmod = function(fd, mode, callback) {}; + +/** + * @param {*} fd + * @param {number} mode + */ +fs.fchmodSync = function(fd, mode) {}; + +/** + * @param {string} path + * @param {number} mode + * @param {function(...)=} callback + */ +fs.lchmod = function(path, mode, callback) {}; + +/** + * @param {string} path + * @param {number} mode + */ +fs.lchmodSync = function(path, mode) {}; + +/** + * @param {string} path + * @param {function(string, fs.Stats)=} callback + * @nosideeffects + */ +fs.stat = function(path, callback) {}; + +/** + * @param {string} path + * @return {fs.Stats} + * @nosideeffects + */ +fs.statSync = function(path) {} + +/** + * @param {*} fd + * @param {function(string, fs.Stats)=} callback + * @nosideeffects + */ +fs.fstat = function(fd, callback) {}; + +/** + * @param {*} fd + * @return {fs.Stats} + * @nosideeffects + */ +fs.fstatSync = function(fd) {} + +/** + * @param {string} path + * @param {function(string, fs.Stats)=} callback + * @nosideeffects + */ +fs.lstat = function(path, callback) {}; + +/** + * @param {string} path + * @return {fs.Stats} + * @nosideeffects + */ +fs.lstatSync = function(path) {} + +/** + * @param {string} srcpath + * @param {string} dstpath + * @param {function(...)=} callback + */ +fs.link = function(srcpath, dstpath, callback) {}; + +/** + * @param {string} srcpath + * @param {string} dstpath + */ +fs.linkSync = function(srcpath, dstpath) {}; + +/** + * @param {string} srcpath + * @param {string} dstpath + * @param {string=} type + * @param {function(...)=} callback + */ +fs.symlink = function(srcpath, dstpath, type, callback) {}; + +/** + * @param {string} srcpath + * @param {string} dstpath + * @param {string=} type + */ +fs.symlinkSync = function(srcpath, dstpath, type) {}; + +/** + * @param {string} path + * @param {function(string, string)=} callback + * @nosideeffects + */ +fs.readlink = function(path, callback) {}; + +/** + * @param {string} path + * @return {string} + * @nosideeffects + */ +fs.readlinkSync = function(path) {}; + +/** + * @param {string} path + * @param {object.=|function(string, string)=} cache + * @param {function(string, string)=} callback + * @nosideeffects + */ +fs.realpath = function(path, cache, callback) {}; + +/** + * @param {string} path + * @param {object.=} cache + * @return {string} + * @nosideeffects + */ +fs.realpathSync = function(path, cache) {}; + +/** + * @param {string} path + * @param {function(...)=} callback + */ +fs.unlink = function(path, callback) {}; + +/** + * @param {string} path + */ +fs.unlinkSync = function(path) {}; + +/** + * @param {string} path + * @param {function(...)=} callback + */ +fs.rmdir = function(path, callback) {}; + +/** + * @param {string} path + */ +fs.rmdirSync = function(path) {}; + +/** + * @param {string} path + * @param {number=} mode + * @param {function(...)=} callback + */ +fs.mkdir = function(path, mode, callback) {}; + +/** + * @param {string} path + * @param {number=} mode + */ +fs.mkdirSync = function(path, mode) {}; + +/** + * @param {string} path + * @param {function(string,array.)=} callback + * @nosideeffects + */ +fs.readdir = function(path, callback) {}; + +/** + * @param {string} path + * @return {array.} + * @nosideeffects + */ +fs.readdirSync = function(path) {}; + +/** + * @param {*} fd + * @param {function(...)=} callback + */ +fs.close = function(fd, callback) {}; + +/** + * @param {*} fd + */ +fs.closeSync = function(fd) {}; + +/** + * @param {string} path + * @param {string} flags + * @param {number=} mode + * @param {function(string, *)=} callback + * @nosideeffects + */ +fs.open = function(path, flags, mode, callback) {}; + +/** + * @param {string} path + * @param {string} flags + * @param {number=} mode + * @return {*} + * @nosideeffects + */ +fs.openSync = function(path, flags, mode) {}; + +/** + * @param {string} path + * @param {number} atime + * @param {number} mtime + * @param {function(...)=} callback + * @nosideeffects + */ +fs.utimes = function(path, atime, mtime, callback) {}; + +/** + * @param {string} path + * @param {number} atime + * @param {number} mtime + * @nosideeffects + */ +fs.utimesSync = function(path, atime, mtime) {}; + +/** + * @param {*} fd + * @param {number} atime + * @param {number} mtime + * @param {function(...)=} callback + * @nosideeffects + */ +fs.futimes = function(fd, atime, mtime, callback) {}; + +/** + * @param {*} fd + * @param {number} atime + * @param {number} mtime + * @nosideeffects + */ +fs.futimesSync = function(fd, atime, mtime) {}; + +/** + * @param {*} fd + * @param {function(...)=} callback + */ +fs.fsync = function(fd, callback) {}; + +/** + * @param {*} fd + */ +fs.fsyncSync = function(fd) {}; + +/** + * @param {*} fd + * @param {*} buffer + * @param {number} offset + * @param {number} length + * @param {number} position + * @param {function(string, number, *)=} callback + */ +fs.write = function(fd, buffer, offset, length, position, callback) {}; + +/** + * @param {*} fd + * @param {*} buffer + * @param {number} offset + * @param {number} length + * @param {number} position + * @return {number} + */ +fs.writeSync = function(fd, buffer, offset, length, position) {}; + +/** + * @param {*} fd + * @param {*} buffer + * @param {number} offset + * @param {number} length + * @param {number} position + * @param {function(string, number, *)=} callback + * @nosideeffects + */ +fs.read = function(fd, buffer, offset, length, position, callback) {}; + +/** + * @param {*} fd + * @param {*} buffer + * @param {number} offset + * @param {number} length + * @param {number} position + * @return {number} + * @nosideeffects + */ +fs.readSync = function(fd, buffer, offset, length, position) {}; + +/** + * @param {string} filename + * @param {string=|function(string, *)=}encoding + * @param {function(string, *)=} callback + * @nosideeffects + */ +fs.readFile = function(filename, encoding, callback) {}; + +/** + * @param {string} filename + * @param {string=} encoding + * @nosideeffects + */ +fs.readFileSync = function(filename, encoding) {}; + +/** + * @param {string} filename + * @param {*} data + * @param {string=|function(string)=} encoding + * @param {function(string)=} callback + */ +fs.writeFile = function(filename, data, encoding, callback) {}; + +/** + * @param {string} filename + * @param {*} data + * @param {string=} encoding + */ +fs.writeFileSync = function(filename, data, encoding) {}; + +/** + * @param {string} filename + * @param {*} data + * @param {string=|function(string)=} encoding + * @param {function(string)=} callback + */ +fs.appendFile = function(filename, data, encoding, callback) {}; + +/** + * @param {string} filename + * @param {*} data + * @param {string=|function(string)=} encoding + */ +fs.appendFileSync = function(filename, data, encoding) {}; + +/** + * @param {string} filename + * @param {{persistent: boolean, interval: number}=|function(*,*)} options + * @param {function(*,*)=} listener + */ +fs.watchFile = function(filename, options, listener) {}; + +/** + * @param {string} filename + * @param {function=} listener + */ +fs.unwatchFile = function(filename, listener) {}; + +/** + * + * @param {string} filename + * @param {{persistent: boolean}=|function(string, string)} options + * @param {function(string, string)=} listener + * @return {fs.FSWatcher} + */ +fs.watch = function(filename, options, listener) {}; + +/** + * @param {string} path + * @param {function(boolean)} callback + * @nosideeffects + */ +fs.exists = function(path, callback) {}; + +/** + * @param {string} path + * @nosideeffects + */ +fs.existsSync = function(path) {}; + +/** + * @constructor + */ +fs.Stats = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isFile = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isDirectory = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isBlockDevice = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isCharacterDevice = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isSymbolicLink = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isFIFO = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +fs.Stats.prototype.isSocket = function() {}; + +/** + * @type {number} + */ +fs.Stats.prototype.dev = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.ino = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.mode = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.nlink = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.uid = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.gid = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.rdev = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.size = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.blkSize = 0; + +/** + * @type {number} + */ +fs.Stats.prototype.blocks = 0; + +/** + * @type {Date} + */ +fs.Stats.prototype.atime = 0; + +/** + * @type {Date} + */ +fs.Stats.prototype.mtime = 0; + +/** + * @type {Date} + */ +fs.Stats.prototype.ctime = 0; + +/** + * @param {string} path + * @param {{flags: string, encoding: ?string, fd: *, mode: number, bufferSize: number}=} options + * @nosideeffects + */ +fs.createReadStream = function(path, options) {}; + +/** + * @constructor + * @extends {stream.ReadableStream} + */ +fs.ReadStream = function() {}; + +/** + * @param {string} path + * @param {{flags: string, encoding: ?string, mode: number}=} options + * @nosideeffects + */ +fs.createWriteStream = function(path, options) {}; + +/** + * @constructor + * @extends {stream.WritableStream} + */ +fs.WriteStream = function() {}; + +/** + * @param {string} event + * @param {function(...)} callback + */ +fs.WriteStream.prototype.on = function(event, callback) {}; + +/** + * @constructor + */ +fs.FSWatcher = function() {}; + +/** + */ +fs.FSWatcher.prototype.close = function() {}; + +/** + * @param {string} event + * @param {function(...)} callback + */ +fs.FSWatcher.prototype.on = function(event, callback) {}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/externs/protobuf.js b/legacy-libs/grpc/node_modules/protobufjs/externs/protobuf.js new file mode 100644 index 0000000..a2ad4d1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/externs/protobuf.js @@ -0,0 +1,933 @@ +/* + * Copyright 2012 The Closure Compiler 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. + */ + +/** + * @fileoverview Externs for ProtoBuf.js. + * @see https://github.com/dcodeIO/ProtoBuf.js + * @externs + */ + +/** + BEGIN_NODE_INCLUDE + var ProtoBuf = require('protobufjs'); + END_NODE_INCLUDE + */ + +/** + * @typedef {Array} + */ +var Buffer; + +/** + * @typedef {Object} + */ +var dcodeIO; + +/** + * {@type Object.} + */ +var ProtoBuf = {}; + +/** + * @type {string} + * @const + */ +ProtoBuf.VERSION; + +/** + * @type {!Object.} + * @const + */ +ProtoBuf.WIRE_TYPES = {}; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.VARINT; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.BITS64; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.LDELIM; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.STARTGROUP; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.ENDGROUP; + +/** + * @type {number} + * @const + */ +ProtoBuf.WIRE_TYPES.BITS32; + +/** + * @type {!Array.} + * @const + */ +ProtoBuf.PACKABLE_WIRE_TYPES; + +/** + * @type {boolean} + */ +ProtoBuf.convertFieldsToCamelCase; + +/** + * @type {boolean} + */ +ProtoBuf.populateAccessors; + +/** + * @dict + * @type {!Object} + * @const + */ +ProtoBuf.TYPES; + +/** + * @type {number} + */ +ProtoBuf.ID_MIN; + +/** + * @type {number} + */ +ProtoBuf.ID_MAX; + +/** + * @type {!function(new: ByteBuffer, ...*)} + */ +ProtoBuf.ByteBuffer; + +/** + * @type {?function(new: Long, ...*)} + */ +ProtoBuf.Long; + +/** + * @type {!Object} + */ +ProtoBuf.Lang; + +/** + * @type {Object} + */ +ProtoBuf.DotProto; + +/** + * @param {string} proto + * @constructor + */ +ProtoBuf.DotProto.Tokenizer = function(proto) {}; + +/** + * @type {string} + */ +ProtoBuf.DotProto.Tokenizer.prototype.source; + +/** + * @type {number} + */ +ProtoBuf.DotProto.Tokenizer.prototype.index; + +/** + * @type {number} + */ +ProtoBuf.DotProto.Tokenizer.prototype.line; + +/** + * @type {Array.} + */ +ProtoBuf.DotProto.Tokenizer.prototype.stack; + +/** + * @type {boolean} + */ +ProtoBuf.DotProto.Tokenizer.prototype.readingString; + +/** + * @return {?string} + * @throws {Error} + */ +ProtoBuf.DotProto.Tokenizer.prototype.next = function() {}; + +/** + * @return {?string} + * @throws {Error} + */ +ProtoBuf.DotProto.Tokenizer.prototype.peek = function() {}; + +/** + * @return {string} + * @nosideeffects + */ +ProtoBuf.DotProto.Tokenizer.prototype.toString = function() {}; + +/** + * @param {string} proto + * @constructor + */ +ProtoBuf.DotProto.Parser = function(proto) {}; + +/** + * @type {!ProtoBuf.DotProto.Tokenizer} + */ +ProtoBuf.DotProto.Parser.prototype.tn; + +/** + * @return {{package: (string|null), messages: Array., enums: Array., imports: Array., options: Object}} + * @throws {Error} + */ +ProtoBuf.DotProto.Parser.prototype.parse = function() {}; + +/** + * @return {string} + * @nosideeffects + */ +ProtoBuf.DotProto.Parser.prototype.toString = function() {}; + +/** + * @type {Object} + */ +ProtoBuf.Reflect.Reflect = {}; + +/** + * @constructor + * @param {ProtoBuf.Reflect.T} parent + * @param {string} name Object name + */ +ProtoBuf.Reflect.T = function(parent, name) {}; + +/** + * @type {?ProtoBuf.Reflect.T} + */ +ProtoBuf.Reflect.T.prototype.parent; + +/** + * @type {string} + */ +ProtoBuf.Reflect.T.prototype.name; + +/** + * @returns {string} + * @nosideeffects + */ +ProtoBuf.Reflect.T.prototype.fqn = function() {}; + +/** + * @param {boolean=} includeClass + * @returns {string} + * @nosideeffects + */ +ProtoBuf.Reflect.T.prototype.toString = function(includeClass) {}; + +/** + * @throws {Error} + */ +ProtoBuf.Reflect.T.prototype.build = function() {}; + +/** + * @param {?ProtoBuf.Reflect.Namespace} parent + * @param {string} name + * @constructor + * @extends ProtoBuf.Reflect.T + */ +ProtoBuf.Reflect.Namespace = function(parent, name) {}; + +/** + * @type {Array.} + */ +ProtoBuf.Reflect.Namespace.prototype.children; + +/** + * @param {ProtoBuf.Reflect.T=} type + * @return {Array.} + * @nosideeffects + */ +ProtoBuf.Reflect.Namespace.prototype.getChildren = function(type) {}; + +/** + * @param {ProtoBuf.Reflect.T} child + * @throws {Error} + */ +ProtoBuf.Reflect.Namespace.prototype.addChild = function(child) {}; + +/** + * @param {string|number} nameOrId + * @returns {boolean} + * @nosideeffects + */ +ProtoBuf.Reflect.Namespace.prototype.hasChild = function(nameOrId) {}; + +/** + * @param {string|number} nameOrId + * @return {?ProtoBuf.Reflect.T} + * @nosideeffects + */ +ProtoBuf.Reflect.Namespace.prototype.getChild = function(nameOrId) {}; + +/** + * @param {string} qn + * @param {boolean=} excludeFields + * @return {?ProtoBuf.Reflect.Namespace} + * @nosideeffects + */ +ProtoBuf.Reflect.Namespace.prototype.resolve = function(qn, excludeFields) {}; + +/** + * @return {Object.} + */ +ProtoBuf.Reflect.Namespace.prototype.build = function() {}; + +/** + * @param {!ProtoBuf.Reflect.Namespace} parent + * @param {string} name + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +ProtoBuf.Reflect.Message = function(parent, name) {}; + +/** + * @type {?Array.} + */ +ProtoBuf.Reflect.Message.prototype.extensions; + +/** + * @type {?ProtoBuf.Builder.Message} + */ +ProtoBuf.Reflect.Message.prototype.clazz; + +/** + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.build = function() {}; + +/** + * @param {!ProtoBuf.Builder.Message} message + * @param {!ByteBuffer} buffer + * @return {!ByteBuffer} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.encode = function(message, buffer) {}; + +/** + * @param {!ProtoBuf.Builder.Message} message + * @return {number} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.calculate = function(message) {}; + +/** + * @param {!ProtoBuf.Builder.Message} message + * @param {!ByteBuffer} buffer + * @param {boolean} noVerify + * @return {!ByteBuffer} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.encodeDelimited = function(message, buffer, noVerify) {}; + +/** + * @param {!ByteBuffer} buffer + * @param {number=} length + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.decode = function(buffer, length) {}; + +/** + * @param {!ByteBuffer} buffer + * @param {number=} length + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.prototype.decodeDelimited = function(buffer, length) {}; + +/** + * @param {!ProtoBuf.Reflect.Message} message + * @param {string} rule + * @param {string} type + * @param {string} name + * @param {number} id + * @param {Object=} options + * @constructor + * @extends ProtoBuf.Reflect.T + */ +ProtoBuf.Reflect.Message.Field = function(message, rule, type, name, id, options) {}; + +/** + * @type {boolean} + */ +ProtoBuf.Reflect.Message.Field.prototype.required; + +/** + * @type {boolean} + */ +ProtoBuf.Reflect.Message.Field.prototype.repeated; + +/** + * @type {string|{name: string, wireType: number}} + */ +ProtoBuf.Reflect.Message.Field.prototype.type; + +/** + * @type {number} + */ +ProtoBuf.Reflect.Message.Field.prototype.id; + +/** + * @type {!Object.} + */ +ProtoBuf.Reflect.Message.Field.prototype.options; + +/** + * @type {?ProtoBuf.Reflect.T} + */ +ProtoBuf.Reflect.Message.Field.prototype.resolvedType; + +/** + * @type {string} + */ +ProtoBuf.Reflect.Message.Field.prototype.originalName; + +/** + * @param {*} value + * @param {boolean=} skipRepeated + * @return {*} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Reflect.Message.Field.prototype.verifyValue = function(value, skipRepeated) {}; + +/** + * @param {*} value + * @param {!ByteBuffer} buffer + * @return {!ByteBuffer} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.Field.prototype.encode = function(value, buffer) {}; + +/** + * @param {*} value + * @return {number} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Reflect.Message.Field.prototype.calculate = function(value) {}; + +/** + * @param {number} wireType + * @param {!ByteBuffer} buffer + * @return {*} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.Field.prototype.decode = function(wireType, buffer) {}; + +/** + * @param {*} value + * @param {!ByteBuffer} buffer + * @return {!ByteBuffer} + * @throws {Error} + */ +ProtoBuf.Reflect.Message.Field.prototype.encodeValue = function(value, buffer) {}; + +/** + * @param {!ProtoBuf.Reflect.T} parent + * @param {string} name + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +ProtoBuf.Reflect.Enum = function(parent, name) {}; + +/** + * @return {Object} + */ +ProtoBuf.Reflect.Enum.prototype.build = function() {}; + +/** + * @type {?Object.} + */ +ProtoBuf.Reflect.Enum.prototype.object; + +/** + * @param {!ProtoBuf.Reflect.Enum} enm + * @param {string} name + * @param {number} id + * @constructor + * @extends ProtoBuf.Reflect.T + */ +ProtoBuf.Reflect.Enum.Value = function(enm, name, id) {}; + +/** + * @type {number} + */ +ProtoBuf.Reflect.Enum.Value.prototype.id; + +/** + * @param {!ProtoBuf.Reflect.Namespace} root + * @param {string} name Service name + * @param {Object.=} options + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +ProtoBuf.Reflect.Service = function(root, name, options) {}; + +/** + * @type {ProtoBuf.Builder.Service} + */ +ProtoBuf.Reflect.Service.prototype.clazz; + +/** + * @return {!ProtoBuf.Builder.Service} + * @throws {Error} + */ +ProtoBuf.Reflect.Service.prototype.build = function() {}; + +/** + * @param {!ProtoBuf.Reflect.Service} svc + * @param {string} name + * @param {Object.=} options + * @constructor + * @extends ProtoBuf.Reflect.T + */ +ProtoBuf.Reflect.Service.Method = function(svc, name, options) {}; + +/** + * @return {Object.} + */ +ProtoBuf.Reflect.Service.Method.prototype.buildOpt = function() {}; + +/** + * @param {!ProtoBuf.Reflect.Service} svc + * @param {string} name + * @param {string} request + * @param {string} response + * @param {Object.=} options + * @constructor + * @extends ProtoBuf.Reflect.Service.Method + */ +ProtoBuf.Reflect.Service.RPCMethod = function(svc, name, request, response, options) {}; + +/** + * @type {string} + */ +ProtoBuf.Reflect.Service.RPCMethod.prototype.requestName; + +/** + * @type {string} + */ +ProtoBuf.Reflect.Service.RPCMethod.prototype.responseName; + +/** + * @type {ProtoBuf.Reflect.Message} + */ +ProtoBuf.Reflect.Service.RPCMethod.prototype.resolvedRequestType; + +/** + * @type {ProtoBuf.Reflect.Message} + */ +ProtoBuf.Reflect.Service.RPCMethod.prototype.resolvedResponseType; + +/** + * @constructor + */ +ProtoBuf.Builder = function() {}; + +/** + * @type {!ProtoBuf.Reflect.Namespace} + */ +ProtoBuf.Builder.prototype.ns; + +/** + * @type {?ProtoBuf.Reflect.T} + */ +ProtoBuf.Builder.prototype.ptr; + +/** + * @type {boolean} + */ +ProtoBuf.Builder.prototype.resolved; + +/** + * @type {Object.|null} + */ +ProtoBuf.Builder.prototype.result; + +/** + * @type {Array.} + */ +ProtoBuf.Builder.prototype.files; + +/** + * @type {?string} + */ +ProtoBuf.Builder.prototype.importRoot; + +/** + */ +ProtoBuf.Builder.prototype.reset = function() {}; + +/** + * @param {string} pkg + * @return {!ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.Builder.prototype.define = function(pkg) {}; + +/** + * @param {Object.} def + * @return {boolean} + * @nosideeffects + */ +ProtoBuf.Builder.isValidMessage = function(def) {}; + +/** + * @param {Object.} def + * @return {boolean} + * @nosideeffects + */ +ProtoBuf.Builder.isValidMessageField = function(def) {}; + +/** + * @param {Object.} def + * @return {boolean} + */ +ProtoBuf.Builder.isValidEnum = function(def) {}; + +/** + * @param {Object.} def + * @return {boolean} + */ +ProtoBuf.Builder.isValidService = function(def) {}; + +/** + * @param {Object.} def + * @return {boolean} + */ +ProtoBuf.Builder.isValidExtend = function(def) {}; + +/** + * @param {Array.>} messages + * @return {ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.Builder.prototype.create = function(messages) {}; + +/** + * @name ProtoBuf.Builder.prototype.import + * @function + * @param {ProtoBuf.Builder} builder + * @param {(string|{root: string, file: string})=} filename + * @return {!ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.Builder.prototype["import"] = function(builder, filename) {}; + +/** + * @throws {Error} + */ +ProtoBuf.Builder.prototype.resolveAll = function() {}; + +/** + * @param {string=} path + * @return {ProtoBuf.Builder.Message|Object.} + * @throws {Error} + */ +ProtoBuf.Builder.prototype.build = function(path) {}; + +/** + * @param {string=} path + * @return {?ProtoBuf.Reflect.T} + */ +ProtoBuf.Builder.prototype.lookup = function(path) {}; + +/** + * @return {string} + * @nosideeffects + */ +ProtoBuf.Builder.prototype.toString = function() {}; + +/** + * @param {Object.} values + * @constructor + * @throws {Error} + */ +ProtoBuf.Builder.Message = function(values) {}; + +/** + * @param {string} key + * @param {*} value + * @param {boolean=} noAssert + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.add = function(key, value, noAssert) {}; + +/** + * @param {string} key + * @param {*} value + * @param {boolean=} noAssert + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.$add = function(key, value, noAssert) {}; + +/** + * @param {string} key + * @param {*} value + * @param {boolean=} noAssert + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.set = function(key, value, noAssert) {}; + +/** + * @param {string} key + * @param {*} value + * @param {boolean=} noAssert + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.$set = function(key, value, noAssert) {}; + +/** + * @param {string} key + * @return {*} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.get = function(key) {}; + +/** + * @param {string} key + * @return {*} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.$get = function(key) {}; + +/** + * @param {ByteBuffer=} buffer + * @return {!ByteBuffer} + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.encode = function(buffer) {}; + +/** + * @return {number} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.calculate = function() {}; + +/** + * @return {!ArrayBuffer} + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.encodeAB = function() {}; + +/** + * @return {!ArrayBuffer} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toArrayBuffer = function() {}; + +/** + * @return {!Buffer} + * @throws {Error} + */ +ProtoBuf.Builder.Message.prototype.encodeNB = function() {}; + +/** + * @return {!Buffer} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toBuffer = function() {}; + +/** + * @return {string} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.encode64 = function() {}; + +/** + * @return {string} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toBase64 = function() {}; + +/** + * @return {string} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.encodeHex = function() {}; + +/** + * @return {string} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toHex = function() {}; + +/** + * @param {boolean=} includeBuffers + * @return {Object.} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toRaw = function(includeBuffers) {}; + +/** + * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer + * @param {string=} enc + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.decode = function(buffer, enc) {}; + +/** + * @param {string} str + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.decode64 = function(str) {}; + +/** + * @param {string} str + * @return {!ProtoBuf.Builder.Message} + * @throws {Error} + * @nosideeffects + */ +ProtoBuf.Builder.Message.decodeHex = function(str) {}; + +/** + * @return {string} + * @nosideeffects + */ +ProtoBuf.Builder.Message.prototype.toString = function() {}; + +/** + * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl + * @constructor + */ +ProtoBuf.Builder.Service = function(rpcImpl) {}; + +/** + * @type {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} + */ +ProtoBuf.Builder.prototype.rpcImpl; + +/** + * @param {string} proto + * @param {(ProtoBuf.Builder|string)=} builder + * @param {(string|{root: string, file: string})=} filename + * @return {!ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.loadProto = function(proto, builder, filename) {}; + +/** + * @param {string} proto + * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder + * @param {(string|{root: string, file: string})=} filename + * @return {!ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.protoFromString = function(proto, builder, filename) {}; + +/** + * @param {string|{root: string, file: string}} filename + * @param {(function(ProtoBuf.Builder)|ProtoBuf.Builder)=} callback + * @param {ProtoBuf.Builder=} builder + * @return {ProtoBuf.Builder|undefined} + * @throws {Error} + */ +ProtoBuf.loadProtoFile = function(filename, callback, builder) {}; + +/** + * @param {string|{root: string, file: string}} filename + * @param {(function(ProtoBuf.Builder)|ProtoBuf.Builder)=} callback + * @param {ProtoBuf.Builder=} builder + * @return {ProtoBuf.Builder|undefined} + * @throws {Error} + */ +ProtoBuf.protoFromFile = function(filename, callback, builder) {}; + +/** + * @param {!*|string} json + * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder + * @param {(string|{root: string, file: string})=} filename + * @return {!ProtoBuf.Builder} + * @throws {Error} + */ +ProtoBuf.loadJson = function(json, builder, filename) {}; + +/** + * @param {string|{root: string, file: string}} filename + * @param {(function(ProtoBuf.Builder)|ProtoBuf.Builder)=} callback + * @param {ProtoBuf.Builder=} builder + * @return {ProtoBuf.Builder|undefined} + * @throws {Error} + */ +ProtoBuf.loadJsonFile = function(filename, callback, builder) {}; + +/** + * @param {string=} pkg + * @return {!ProtoBuf.Builder} + */ +ProtoBuf.newBuilder = function(pkg) {}; + +ProtoBuf.Util = {}; + +/** + * @type {boolean} + */ +ProtoBuf.Util.IS_NODE; + +/** + * @return {XMLHttpRequest} + */ +ProtoBuf.Util.XHR = function() {}; + +/** + * @param {string} path + * @param {function(?string)=} callback + * @return {?string|undefined} + */ +ProtoBuf.Util.fetch = function(path, callback) {}; + +/** + * @param {*} obj + * @return {boolean} + */ +ProtoBuf.Util.isArray = function(obj) {}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/index.js b/legacy-libs/grpc/node_modules/protobufjs/index.js new file mode 100644 index 0000000..989d3b0 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/index.js @@ -0,0 +1 @@ +module.exports = require("./dist/protobuf.js"); diff --git a/legacy-libs/grpc/node_modules/protobufjs/jsdoc.json b/legacy-libs/grpc/node_modules/protobufjs/jsdoc.json new file mode 100644 index 0000000..5527efd --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/jsdoc.json @@ -0,0 +1,12 @@ +{ + "tags": { + "allowUnknownTags": true + }, + "source": { + "include": ["dist/protobuf.js"] + }, + "opts": { + "destination": "docs" + }, + "plugins": ["plugins/markdown"] +} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/package.json b/legacy-libs/grpc/node_modules/protobufjs/package.json new file mode 100644 index 0000000..f775a72 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/package.json @@ -0,0 +1,95 @@ +{ + "author": { + "name": "Daniel Wirtz", + "email": "dcode@dcode.io" + }, + "bin": { + "pbjs": "./bin/pbjs" + }, + "browser": { + "fs": false, + "path": false + }, + "bugs": { + "url": "https://github.com/dcodeIO/protobuf.js/issues" + }, + "contributors": [ + { + "name": "Frank Xu", + "email": "yyfrankyy@gmail.com" + } + ], + "dependencies": { + "ascli": "~1", + "bytebuffer": "~5", + "glob": "^7.0.5", + "yargs": "^3.10.0" + }, + "description": "Protocol Buffers for JavaScript. Finally.", + "devDependencies": { + "closurecompiler": "~1", + "fixture-stdout": "^0.2.1", + "jsdoc": "~3.3.0-alpha10", + "metascript": ">=0.18 <1", + "testjs": "~1 >=1.0.4" + }, + "directories": {}, + "dist": { + "integrity": "sha512-55Kcx1MhPZX0zTbVosMQEO5R6/rikNXd9b6RQK4KSPcrSIIwoXTtebIczUrXlwaSrbz4x8XUVThGPob1n8I4QA==", + "shasum": "e4dfe9fb67c90b2630d15868249bcc4961467a17", + "tarball": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz", + "fileCount": 189, + "unpackedSize": 3128808, + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa+/gjCRA9TVsSAnZWagAA4lAQAIQu/R1fQv2iN0SAWNaR\nDe6nwKeB3BTkxeIB/HNfwzhVEmSepbskJrzx4ZSGlnSKLI/R/RPjh1yvx6dG\nQ1+1ddWcSTbAj85enFcR1WIb3/rV92W+61sba8vh8+yYlPs/HO2aXc7RqjuH\nnWAHJ/WgQItMdiOLbXxtm1s0oFiK2/l9tLVU+xzIIjADzNjPSD/tHZkc4S1a\n7b+6AX0lviG2A9AxyQgF/WLoY8sY7xEHiukE6mFfu0l8c9u0IeM9zx/wtzyB\nPKaBjzjDgEkqbrLGVARuYTOT5oFd/DNESLfkpYRJWsYgTHluY+RUyxCM2n61\nRRSqNedYavPi602su160AQnANLH8wyQG+KSdaPPR9TmCYE+5+B1TZU77jYKL\nyCmwoNi/SV8U9HNESFrgh/lMqizYOyLjfmhdeegEw4+p6fDBcW6//JWRBo2k\no5hQgsgmcSDV3wPrZoRMOC5z1x0hm9DlojZ7lJk5fuoVYjT1/K4BhcM4OFFu\ndy77gZl9MSEQWxMDp8VHPYVCsnEjJtKdqPJgiB9sD9qqM+b9BxC2eiGjh5rw\n5/3zecpFTtdJ0zn4XlFk/JrBTF9+WNTI4akHqWmzOkFmrqdn8d+JgPD+FJph\nfPHLENcZ+AqwDhZhMxV4LKHZ8t2XlhCfvFu26nQ6sfXmpPUfo/Qj5gj5DIcS\nUf1W\r\n=4WLx\r\n-----END PGP SIGNATURE-----\r\n", + "signatures": [ + { + "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA", + "sig": "MEYCIQCNjjw2GRdwG2F1J+hRI7YlyVJLp0awdgnwPxYsNu2SAQIhAJPM4WJeeyQWZfqlB8MzoC+Pk9qBCiFiYBX6WSwTVgIk" + } + ] + }, + "engines": { + "node": ">=0.8" + }, + "gitHead": "2c2ffbc084cb36c971885707c559cccdb242d08f", + "homepage": "https://github.com/dcodeIO/protobuf.js", + "keywords": [ + "net", + "buffer", + "protobuf", + "serialization", + "bytebuffer", + "websocket", + "webrtc" + ], + "license": "Apache-2.0", + "main": "./dist/protobuf.js", + "maintainers": [ + { + "name": "dcode", + "email": "dcode@dcode.io" + } + ], + "name": "protobufjs", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/dcodeIO/protobuf.js.git" + }, + "scripts": { + "build": "node scripts/build.js", + "compile": "npm run-script compile-full && npm run-script compile-light", + "compile-full": "ccjs dist/protobuf.js --create_source_map=dist/protobuf.min.map --compilation_level=SIMPLE_OPTIMIZATIONS > dist/protobuf.min.js", + "compile-light": "ccjs dist/protobuf-light.js --create_source_map=dist/protobuf-light.min.map --compilation_level=SIMPLE_OPTIMIZATIONS > dist/protobuf-light.min.js", + "compress": "npm run-script compress-full && npm run-script compress-light", + "compress-full": "gzip -c -9 dist/protobuf.min.js > dist/protobuf.min.js.gz", + "compress-light": "gzip -c -9 dist/protobuf-light.min.js > dist/protobuf-light.min.js.gz", + "descriptor2json": "node bin/pbjs src/google/protobuf/descriptor.proto --target=json > src/google/protobuf/descriptor.json", + "jsdoc": "node node_modules/jsdoc/jsdoc.js -c jsdoc.json", + "make": "npm run-script build && npm run-script compile && npm run-script descriptor2json && npm run-script compress && npm test && npm run-script jsdoc", + "prepublish": "npm test", + "test": "node bin/pbjs tests/complex.proto --target=json > tests/complex.json && node node_modules/testjs/bin/testjs tests/suite.js" + }, + "version": "5.0.3" +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/protobuf.png b/legacy-libs/grpc/node_modules/protobufjs/protobuf.png new file mode 100644 index 0000000..7569a93 Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/protobuf.png differ diff --git a/legacy-libs/grpc/node_modules/protobufjs/scripts/build.js b/legacy-libs/grpc/node_modules/protobufjs/scripts/build.js new file mode 100644 index 0000000..db3ab95 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/scripts/build.js @@ -0,0 +1,53 @@ +/* + Copyright 2013 Daniel Wirtz + + 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 MetaScript = require("metascript"), + path = require("path"), + fs = require("fs"); + +var rootDir = path.join(__dirname, ".."), + srcDir = path.join(rootDir, "src"), + distDir = path.join(rootDir, "dist"), + pkg = require(path.join(rootDir, "package.json")), + filename; + +var scope = { + VERSION: pkg.version, // Version + DOTPROTO: true // Whether to include the ProtoBuf.DotProto package for .proto syntax support +}; + +// Make full build +console.log("Building protobuf.js with scope", JSON.stringify(scope, null, 2)); +fs.writeFileSync( + path.join(distDir, "protobuf.js"), + MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap.js")), filename, scope, srcDir) +); + +// Make light build +scope.DOTPROTO = false; +console.log("Building protobuf-light.js with scope", JSON.stringify(scope, null, 2)); +fs.writeFileSync( + path.join(distDir, "protobuf-light.js"), + MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap.js")), filename, scope, srcDir) +); + +// Update bower.json +scope = { VERSION: pkg.version }; +console.log("Updating bower.json with scope", JSON.stringify(scope, null, 2)); +fs.writeFileSync( + path.join(rootDir, "bower.json"), + MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "bower.json.in")), filename, scope, srcDir) +); diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Builder.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Builder.js new file mode 100644 index 0000000..18eeba8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Builder.js @@ -0,0 +1,634 @@ +/** + * @alias ProtoBuf.Builder + * @expose + */ +ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) { + "use strict"; + + /** + * Constructs a new Builder. + * @exports ProtoBuf.Builder + * @class Provides the functionality to build protocol messages. + * @param {Object.=} options Options + * @constructor + */ + var Builder = function(options) { + + /** + * Namespace. + * @type {ProtoBuf.Reflect.Namespace} + * @expose + */ + this.ns = new Reflect.Namespace(this, null, ""); // Global namespace + + /** + * Namespace pointer. + * @type {ProtoBuf.Reflect.T} + * @expose + */ + this.ptr = this.ns; + + /** + * Resolved flag. + * @type {boolean} + * @expose + */ + this.resolved = false; + + /** + * The current building result. + * @type {Object.|null} + * @expose + */ + this.result = null; + + /** + * Imported files. + * @type {Array.} + * @expose + */ + this.files = {}; + + /** + * Import root override. + * @type {?string} + * @expose + */ + this.importRoot = null; + + /** + * Options. + * @type {!Object.} + * @expose + */ + this.options = options || {}; + }; + + /** + * @alias ProtoBuf.Builder.prototype + * @inner + */ + var BuilderPrototype = Builder.prototype; + + // ----- Definition tests ----- + + /** + * Tests if a definition most likely describes a message. + * @param {!Object} def + * @returns {boolean} + * @expose + */ + Builder.isMessage = function(def) { + // Messages require a string name + if (typeof def["name"] !== 'string') + return false; + // Messages do not contain values (enum) or rpc methods (service) + if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined') + return false; + return true; + }; + + /** + * Tests if a definition most likely describes a message field. + * @param {!Object} def + * @returns {boolean} + * @expose + */ + Builder.isMessageField = function(def) { + // Message fields require a string rule, name and type and an id + if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined') + return false; + return true; + }; + + /** + * Tests if a definition most likely describes an enum. + * @param {!Object} def + * @returns {boolean} + * @expose + */ + Builder.isEnum = function(def) { + // Enums require a string name + if (typeof def["name"] !== 'string') + return false; + // Enums require at least one value + if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0) + return false; + return true; + }; + + /** + * Tests if a definition most likely describes a service. + * @param {!Object} def + * @returns {boolean} + * @expose + */ + Builder.isService = function(def) { + // Services require a string name and an rpc object + if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"]) + return false; + return true; + }; + + /** + * Tests if a definition most likely describes an extended message + * @param {!Object} def + * @returns {boolean} + * @expose + */ + Builder.isExtend = function(def) { + // Extends rquire a string ref + if (typeof def["ref"] !== 'string') + return false; + return true; + }; + + // ----- Building ----- + + /** + * Resets the pointer to the root namespace. + * @returns {!ProtoBuf.Builder} this + * @expose + */ + BuilderPrototype.reset = function() { + this.ptr = this.ns; + return this; + }; + + /** + * Defines a namespace on top of the current pointer position and places the pointer on it. + * @param {string} namespace + * @return {!ProtoBuf.Builder} this + * @expose + */ + BuilderPrototype.define = function(namespace) { + if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace)) + throw Error("illegal namespace: "+namespace); + namespace.split(".").forEach(function(part) { + var ns = this.ptr.getChild(part); + if (ns === null) // Keep existing + this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part)); + this.ptr = ns; + }, this); + return this; + }; + + /** + * Creates the specified definitions at the current pointer position. + * @param {!Array.} defs Messages, enums or services to create + * @returns {!ProtoBuf.Builder} this + * @throws {Error} If a message definition is invalid + * @expose + */ + BuilderPrototype.create = function(defs) { + if (!defs) + return this; // Nothing to create + if (!Array.isArray(defs)) + defs = [defs]; + else { + if (defs.length === 0) + return this; + defs = defs.slice(); + } + + // It's quite hard to keep track of scopes and memory here, so let's do this iteratively. + var stack = [defs]; + while (stack.length > 0) { + defs = stack.pop(); + + if (!Array.isArray(defs)) // Stack always contains entire namespaces + throw Error("not a valid namespace: "+JSON.stringify(defs)); + + while (defs.length > 0) { + var def = defs.shift(); // Namespaces always contain an array of messages, enums and services + + if (Builder.isMessage(def)) { + var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]); + + // Create OneOfs + var oneofs = {}; + if (def["oneofs"]) + Object.keys(def["oneofs"]).forEach(function(name) { + obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name)); + }, this); + + // Create fields + if (def["fields"]) + def["fields"].forEach(function(fld) { + if (obj.getChild(fld["id"]|0) !== null) + throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']); + if (fld["options"] && typeof fld["options"] !== 'object') + throw Error("illegal field options in "+obj.name+"#"+fld["name"]); + var oneof = null; + if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]])) + throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]); + fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]); + if (oneof) + oneof.fields.push(fld); + obj.addChild(fld); + }, this); + + // Push children to stack + var subObj = []; + if (def["enums"]) + def["enums"].forEach(function(enm) { + subObj.push(enm); + }); + if (def["messages"]) + def["messages"].forEach(function(msg) { + subObj.push(msg); + }); + if (def["services"]) + def["services"].forEach(function(svc) { + subObj.push(svc); + }); + + // Set extension ranges + if (def["extensions"]) { + if (typeof def["extensions"][0] === 'number') // pre 5.0.1 + obj.extensions = [ def["extensions"] ]; + else + obj.extensions = def["extensions"]; + } + + // Create on top of current namespace + this.ptr.addChild(obj); + if (subObj.length > 0) { + stack.push(defs); // Push the current level back + defs = subObj; // Continue processing sub level + subObj = null; + this.ptr = obj; // And move the pointer to this namespace + obj = null; + continue; + } + subObj = null; + + } else if (Builder.isEnum(def)) { + + obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]); + def["values"].forEach(function(val) { + obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"])); + }, this); + this.ptr.addChild(obj); + + } else if (Builder.isService(def)) { + + obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]); + Object.keys(def["rpc"]).forEach(function(name) { + var mtd = def["rpc"][name]; + obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"])); + }, this); + this.ptr.addChild(obj); + + } else if (Builder.isExtend(def)) { + + obj = this.ptr.resolve(def["ref"], true); + if (obj) { + def["fields"].forEach(function(fld) { + if (obj.getChild(fld['id']|0) !== null) + throw Error("duplicate extended field id in "+obj.name+": "+fld['id']); + // Check if field id is allowed to be extended + if (obj.extensions) { + var valid = false; + obj.extensions.forEach(function(range) { + if (fld["id"] >= range[0] && fld["id"] <= range[1]) + valid = true; + }); + if (!valid) + throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)"); + } + // Convert extension field names to camel case notation if the override is set + var name = fld["name"]; + if (this.options['convertFieldsToCamelCase']) + name = ProtoBuf.Util.toCamelCase(name); + // see #161: Extensions use their fully qualified name as their runtime key and... + var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]); + // ...are added on top of the current namespace as an extension which is used for + // resolving their type later on (the extension always keeps the original name to + // prevent naming collisions) + var ext = new Reflect.Extension(this, this.ptr, fld["name"], field); + field.extension = ext; + this.ptr.addChild(ext); + obj.addChild(field); + }, this); + + } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions + throw Error("extended message "+def["ref"]+" is not defined"); + + } else + throw Error("not a valid definition: "+JSON.stringify(def)); + + def = null; + obj = null; + } + // Break goes here + defs = null; + this.ptr = this.ptr.parent; // Namespace done, continue at parent + } + this.resolved = false; // Require re-resolve + this.result = null; // Require re-build + return this; + }; + + /** + * Propagates syntax to all children. + * @param {!Object} parent + * @inner + */ + function propagateSyntax(parent) { + if (parent['messages']) { + parent['messages'].forEach(function(child) { + child["syntax"] = parent["syntax"]; + propagateSyntax(child); + }); + } + if (parent['enums']) { + parent['enums'].forEach(function(child) { + child["syntax"] = parent["syntax"]; + }); + } + } + + /** + * Imports another definition into this builder. + * @param {Object.} json Parsed import + * @param {(string|{root: string, file: string})=} filename Imported file name + * @returns {!ProtoBuf.Builder} this + * @throws {Error} If the definition or file cannot be imported + * @expose + */ + BuilderPrototype["import"] = function(json, filename) { + var delim = '/'; + + // Make sure to skip duplicate imports + + if (typeof filename === 'string') { + + if (ProtoBuf.Util.IS_NODE) + filename = require("path")['resolve'](filename); + if (this.files[filename] === true) + return this.reset(); + this.files[filename] = true; + + } else if (typeof filename === 'object') { // Object with root, file. + + var root = filename.root; + if (ProtoBuf.Util.IS_NODE) + root = require("path")['resolve'](root); + if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0) + delim = '\\'; + var fname; + if (ProtoBuf.Util.IS_NODE) + fname = require("path")['join'](root, filename.file); + else + fname = root + delim + filename.file; + if (this.files[fname] === true) + return this.reset(); + this.files[fname] = true; + } + + // Import imports + + if (json['imports'] && json['imports'].length > 0) { + var importRoot, + resetRoot = false; + + if (typeof filename === 'object') { // If an import root is specified, override + + this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards + importRoot = this.importRoot; + filename = filename["file"]; + if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0) + delim = '\\'; + + } else if (typeof filename === 'string') { + + if (this.importRoot) // If import root is overridden, use it + importRoot = this.importRoot; + else { // Otherwise compute from filename + if (filename.indexOf("/") >= 0) { // Unix + importRoot = filename.replace(/\/[^\/]*$/, ""); + if (/* /file.proto */ importRoot === "") + importRoot = "/"; + } else if (filename.indexOf("\\") >= 0) { // Windows + importRoot = filename.replace(/\\[^\\]*$/, ""); + delim = '\\'; + } else + importRoot = "."; + } + + } else + importRoot = null; + + for (var i=0; i)=} path Specifies what to return. If omitted, the entire namespace will be returned. + * @returns {!ProtoBuf.Builder.Message|!Object.} + * @throws {Error} If a type could not be resolved + * @expose + */ + BuilderPrototype.build = function(path) { + this.reset(); + if (!this.resolved) + this.resolveAll(), + this.resolved = true, + this.result = null; // Require re-build + if (this.result === null) // (Re-)Build + this.result = this.ns.build(); + if (!path) + return this.result; + var part = typeof path === 'string' ? path.split(".") : path, + ptr = this.result; // Build namespace pointer (no hasChild etc.) + for (var i=0; i|string} values Preset values + * @param {...string} var_args + * @constructor + * @throws {Error} If the message cannot be created + */ +var Message = function(values, var_args) { + ProtoBuf.Builder.Message.call(this); + + // Create virtual oneof properties + for (var i=0, k=oneofs.length; i 0) { + var value; + // Set field values from a values object + if (arguments.length === 1 && values !== null && typeof values === 'object' && + /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) && + /* not a repeated field */ !Array.isArray(values) && + /* not a Map */ !(values instanceof ProtoBuf.Map) && + /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) && + /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) && + /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) { + this.$set(values); + } else // Set field values from arguments, in declaration order + for (i=0, k=arguments.length; i} keyOrObj String key or plain object holding multiple values + * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted + * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false` + * @returns {!ProtoBuf.Builder.Message} this + * @throws {Error} If the value cannot be set + * @expose + */ +MessagePrototype.set = function(keyOrObj, value, noAssert) { + if (keyOrObj && typeof keyOrObj === 'object') { + noAssert = value; + for (var ikey in keyOrObj) { + // Check if virtual oneof field - don't set these + if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined) + this.$set(ikey, value, noAssert); + } + return this; + } + var field = T._fieldsByName[keyOrObj]; + if (!noAssert) { + if (!field) + throw Error(this+"#"+keyOrObj+" is not a field: undefined"); + if (!(field instanceof ProtoBuf.Reflect.Message.Field)) + throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true)); + this[field.name] = (value = field.verifyValue(value)); // May throw + } else + this[keyOrObj] = value; + if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field) + var currentField = this[field.oneof.name]; // Virtual field references currently set field + if (value !== null) { + if (currentField !== null && currentField !== field.name) + this[currentField] = null; // Clear currently set field + this[field.oneof.name] = field.name; // Point virtual field at this field + } else if (/* value === null && */currentField === keyOrObj) + this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared) + } + return this; +}; + +/** + * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}. + * @name ProtoBuf.Builder.Message#$set + * @function + * @param {string|!Object.} keyOrObj String key or plain object holding multiple values + * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted + * @param {boolean=} noAssert Whether to not assert the value, defaults to `false` + * @throws {Error} If the value cannot be set + * @expose + */ +MessagePrototype.$set = MessagePrototype.set; + +/** + * Gets a field's value. + * @name ProtoBuf.Builder.Message#get + * @function + * @param {string} key Key + * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false` + * @return {*} Value + * @throws {Error} If there is no such field + * @expose + */ +MessagePrototype.get = function(key, noAssert) { + if (noAssert) + return this[key]; + var field = T._fieldsByName[key]; + if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field)) + throw Error(this+"#"+key+" is not a field: undefined"); + if (!(field instanceof ProtoBuf.Reflect.Message.Field)) + throw Error(this+"#"+key+" is not a field: "+field.toString(true)); + return this[field.name]; +}; + +/** + * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}. + * @name ProtoBuf.Builder.Message#$get + * @function + * @param {string} key Key + * @return {*} Value + * @throws {Error} If there is no such field + * @expose + */ +MessagePrototype.$get = MessagePrototype.get; + +// Getters and setters + +for (var i=0; i} data Data payload + * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted. + * @param {boolean=} noVerify Whether to not verify field values, defaults to `false` + * @return {!ByteBuffer} Encoded message as a ByteBuffer + * @expose + */ +Message.encode = function(data, buffer, noVerify) { + return new Message(data).encode(buffer, noVerify); +}; + +/** + * Calculates the byte length of the message. + * @name ProtoBuf.Builder.Message#calculate + * @function + * @returns {number} Byte length + * @throws {Error} If the message cannot be calculated or if required fields are missing. + * @expose + */ +MessagePrototype.calculate = function() { + return T.calculate(this); +}; + +/** + * Encodes the varint32 length-delimited message. + * @name ProtoBuf.Builder.Message#encodeDelimited + * @function + * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted. + * @param {boolean=} noVerify Whether to not verify field values, defaults to `false` + * @return {!ByteBuffer} Encoded message as a ByteBuffer + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded ByteBuffer in the `encoded` property on the error. + * @expose + */ +MessagePrototype.encodeDelimited = function(buffer, noVerify) { + var isNew = false; + if (!buffer) + buffer = new ByteBuffer(), + isNew = true; + var enc = new ByteBuffer().LE(); + T.encode(this, enc, noVerify).flip(); + buffer.writeVarint32(enc.remaining()); + buffer.append(enc); + return isNew ? buffer.flip() : buffer; +}; + +/** + * Directly encodes the message to an ArrayBuffer. + * @name ProtoBuf.Builder.Message#encodeAB + * @function + * @return {ArrayBuffer} Encoded message as ArrayBuffer + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded ArrayBuffer in the `encoded` property on the error. + * @expose + */ +MessagePrototype.encodeAB = function() { + try { + return this.encode().toArrayBuffer(); + } catch (e) { + if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer(); + throw(e); + } +}; + +/** + * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}. + * @name ProtoBuf.Builder.Message#toArrayBuffer + * @function + * @return {ArrayBuffer} Encoded message as ArrayBuffer + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded ArrayBuffer in the `encoded` property on the error. + * @expose + */ +MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB; + +/** + * Directly encodes the message to a node Buffer. + * @name ProtoBuf.Builder.Message#encodeNB + * @function + * @return {!Buffer} + * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are + * missing. The later still returns the encoded node Buffer in the `encoded` property on the error. + * @expose + */ +MessagePrototype.encodeNB = function() { + try { + return this.encode().toBuffer(); + } catch (e) { + if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer(); + throw(e); + } +}; + +/** + * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}. + * @name ProtoBuf.Builder.Message#toBuffer + * @function + * @return {!Buffer} + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded node Buffer in the `encoded` property on the error. + * @expose + */ +MessagePrototype.toBuffer = MessagePrototype.encodeNB; + +/** + * Directly encodes the message to a base64 encoded string. + * @name ProtoBuf.Builder.Message#encode64 + * @function + * @return {string} Base64 encoded string + * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later + * still returns the encoded base64 string in the `encoded` property on the error. + * @expose + */ +MessagePrototype.encode64 = function() { + try { + return this.encode().toBase64(); + } catch (e) { + if (e["encoded"]) e["encoded"] = e["encoded"].toBase64(); + throw(e); + } +}; + +/** + * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}. + * @name ProtoBuf.Builder.Message#toBase64 + * @function + * @return {string} Base64 encoded string + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded base64 string in the `encoded` property on the error. + * @expose + */ +MessagePrototype.toBase64 = MessagePrototype.encode64; + +/** + * Directly encodes the message to a hex encoded string. + * @name ProtoBuf.Builder.Message#encodeHex + * @function + * @return {string} Hex encoded string + * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later + * still returns the encoded hex string in the `encoded` property on the error. + * @expose + */ +MessagePrototype.encodeHex = function() { + try { + return this.encode().toHex(); + } catch (e) { + if (e["encoded"]) e["encoded"] = e["encoded"].toHex(); + throw(e); + } +}; + +/** + * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}. + * @name ProtoBuf.Builder.Message#toHex + * @function + * @return {string} Hex encoded string + * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still + * returns the encoded hex string in the `encoded` property on the error. + * @expose + */ +MessagePrototype.toHex = MessagePrototype.encodeHex; + +/** + * Clones a message object or field value to a raw object. + * @param {*} obj Object to clone + * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise + * @param {boolean} longsAsStrings Whether to encode longs as strings + * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field + * @returns {*} Cloned object + * @inner + */ +function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) { + if (obj === null || typeof obj !== 'object') { + // Convert enum values to their respective names + if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) { + var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj); + if (name !== null) + return name; + } + // Pass-through string, number, boolean, null... + return obj; + } + // Convert ByteBuffers to raw buffer or strings + if (ByteBuffer.isByteBuffer(obj)) + return binaryAsBase64 ? obj.toBase64() : obj.toBuffer(); + // Convert Longs to proper objects or strings + if (ProtoBuf.Long.isLong(obj)) + return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj); + var clone; + // Clone arrays + if (Array.isArray(obj)) { + clone = []; + obj.forEach(function(v, k) { + clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType); + }); + return clone; + } + clone = {}; + // Convert maps to objects + if (obj instanceof ProtoBuf.Map) { + var it = obj.entries(); + for (var e = it.next(); !e.done; e = it.next()) + clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType); + return clone; + } + // Everything else is a non-null object + var type = obj.$type, + field = undefined; + for (var i in obj) + if (obj.hasOwnProperty(i)) { + if (type && (field = type.getChild(i))) + clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType); + else + clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings); + } + return clone; +} + +/** + * Returns the message's raw payload. + * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false` + * @param {boolean} longsAsStrings Whether to encode longs as strings + * @returns {Object.} Raw payload + * @expose + */ +MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) { + return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type); +}; + +/** + * Encodes a message to JSON. + * @returns {string} JSON string + * @expose + */ +MessagePrototype.encodeJSON = function() { + return JSON.stringify( + cloneRaw(this, + /* binary-as-base64 */ true, + /* longs-as-strings */ true, + this.$type + ) + ); +}; + +/** + * Decodes a message from the specified buffer or string. + * @name ProtoBuf.Builder.Message.decode + * @function + * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from + * @param {(number|string)=} length Message length. Defaults to decode all the remainig data. + * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64 + * @return {!ProtoBuf.Builder.Message} Decoded message + * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still + * returns the decoded message with missing fields in the `decoded` property on the error. + * @expose + * @see ProtoBuf.Builder.Message.decode64 + * @see ProtoBuf.Builder.Message.decodeHex + */ +Message.decode = function(buffer, length, enc) { + if (typeof length === 'string') + enc = length, + length = -1; + if (typeof buffer === 'string') + buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64"); + else if (!ByteBuffer.isByteBuffer(buffer)) + buffer = ByteBuffer.wrap(buffer); // May throw + var le = buffer.littleEndian; + try { + var msg = T.decode(buffer.LE(), length); + buffer.LE(le); + return msg; + } catch (e) { + buffer.LE(le); + throw(e); + } +}; + +/** + * Decodes a varint32 length-delimited message from the specified buffer or string. + * @name ProtoBuf.Builder.Message.decodeDelimited + * @function + * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from + * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64 + * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet + * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still + * returns the decoded message with missing fields in the `decoded` property on the error. + * @expose + */ +Message.decodeDelimited = function(buffer, enc) { + if (typeof buffer === 'string') + buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64"); + else if (!ByteBuffer.isByteBuffer(buffer)) + buffer = ByteBuffer.wrap(buffer); // May throw + if (buffer.remaining() < 1) + return null; + var off = buffer.offset, + len = buffer.readVarint32(); + if (buffer.remaining() < len) { + buffer.offset = off; + return null; + } + try { + var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE()); + buffer.offset += len; + return msg; + } catch (err) { + buffer.offset += len; + throw err; + } +}; + +/** + * Decodes the message from the specified base64 encoded string. + * @name ProtoBuf.Builder.Message.decode64 + * @function + * @param {string} str String to decode from + * @return {!ProtoBuf.Builder.Message} Decoded message + * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still + * returns the decoded message with missing fields in the `decoded` property on the error. + * @expose + */ +Message.decode64 = function(str) { + return Message.decode(str, "base64"); +}; + +/** + * Decodes the message from the specified hex encoded string. + * @name ProtoBuf.Builder.Message.decodeHex + * @function + * @param {string} str String to decode from + * @return {!ProtoBuf.Builder.Message} Decoded message + * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still + * returns the decoded message with missing fields in the `decoded` property on the error. + * @expose + */ +Message.decodeHex = function(str) { + return Message.decode(str, "hex"); +}; + +/** + * Decodes the message from a JSON string. + * @name ProtoBuf.Builder.Message.decodeJSON + * @function + * @param {string} str String to decode from + * @return {!ProtoBuf.Builder.Message} Decoded message + * @throws {Error} If the message cannot be decoded or if required fields are + * missing. + * @expose + */ +Message.decodeJSON = function(str) { + return new Message(JSON.parse(str)); +}; + +// Utility + +/** + * Returns a string representation of this Message. + * @name ProtoBuf.Builder.Message#toString + * @function + * @return {string} String representation as of ".Fully.Qualified.MessageName" + * @expose + */ +MessagePrototype.toString = function() { + return T.toString(); +}; + +// Properties + +/** + * Message options. + * @name ProtoBuf.Builder.Message.$options + * @type {Object.} + * @expose + */ +var $optionsS; // cc needs this + +/** + * Message options. + * @name ProtoBuf.Builder.Message#$options + * @type {Object.} + * @expose + */ +var $options; + +/** + * Reflection type. + * @name ProtoBuf.Builder.Message.$type + * @type {!ProtoBuf.Reflect.Message} + * @expose + */ +var $typeS; + +/** + * Reflection type. + * @name ProtoBuf.Builder.Message#$type + * @type {!ProtoBuf.Reflect.Message} + * @expose + */ +var $type; + +if (Object.defineProperty) + Object.defineProperty(Message, '$options', { "value": T.buildOpt() }), + Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }), + Object.defineProperty(Message, "$type", { "value": T }), + Object.defineProperty(MessagePrototype, "$type", { "value": T }); diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Builder/Service.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Builder/Service.js new file mode 100644 index 0000000..43de942 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Builder/Service.js @@ -0,0 +1,144 @@ +/*? + // --- Scope ------------------ + // T : Reflect.Service instance + */ +/** + * Constructs a new runtime Service. + * @name ProtoBuf.Builder.Service + * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message + * @class Barebone of all runtime services. + * @constructor + * @throws {Error} If the service cannot be created + */ +var Service = function(rpcImpl) { + ProtoBuf.Builder.Service.call(this); + + /** + * Service implementation. + * @name ProtoBuf.Builder.Service#rpcImpl + * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} + * @expose + */ + this.rpcImpl = rpcImpl || function(name, msg, callback) { + // This is what a user has to implement: A function receiving the method name, the actual message to + // send (type checked) and the callback that's either provided with the error as its first + // argument or null and the actual response message. + setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async! + }; +}; + +/** + * @alias ProtoBuf.Builder.Service.prototype + * @inner + */ +var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype); + +/** + * Asynchronously performs an RPC call using the given RPC implementation. + * @name ProtoBuf.Builder.Service.[Method] + * @function + * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation + * @param {ProtoBuf.Builder.Message} req Request + * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving + * the error if any and the response either as a pre-parsed message or as its raw bytes + * @abstract + */ + +/** + * Asynchronously performs an RPC call using the instance's RPC implementation. + * @name ProtoBuf.Builder.Service#[Method] + * @function + * @param {ProtoBuf.Builder.Message} req Request + * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving + * the error if any and the response either as a pre-parsed message or as its raw bytes + * @abstract + */ + +var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod); +for (var i=0; i} + * @expose + */ +var $optionsS; // cc needs this + +/** + * Service options. + * @name ProtoBuf.Builder.Service#$options + * @type {Object.} + * @expose + */ +var $options; + +/** + * Reflection type. + * @name ProtoBuf.Builder.Service.$type + * @type {!ProtoBuf.Reflect.Service} + * @expose + */ +var $typeS; + +/** + * Reflection type. + * @name ProtoBuf.Builder.Service#$type + * @type {!ProtoBuf.Reflect.Service} + * @expose + */ +var $type; + +if (Object.defineProperty) + Object.defineProperty(Service, "$options", { "value": T.buildOpt() }), + Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }), + Object.defineProperty(Service, "$type", { "value": T }), + Object.defineProperty(ServicePrototype, "$type", { "value": T }); diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/DotProto.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/DotProto.js new file mode 100644 index 0000000..f3cea78 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/DotProto.js @@ -0,0 +1,33 @@ +/** + * @alias ProtoBuf.DotProto + * @expose + */ +ProtoBuf.DotProto = (function(ProtoBuf, Lang) { + "use strict"; + + /** + * Utilities to parse .proto files. + * @exports ProtoBuf.DotProto + * @namespace + */ + var DotProto = {}; + + //? include("DotProto/Tokenizer.js"); + + /** + * @alias ProtoBuf.DotProto.Tokenizer + * @expose + */ + DotProto.Tokenizer = Tokenizer; + + //? include("DotProto/Parser.js"); + + /** + * @alias ProtoBuf.DotProto.Parser + * @expose + */ + DotProto.Parser = Parser; + + return DotProto; + +})(ProtoBuf, ProtoBuf.Lang); diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/DotProto/Parser.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/DotProto/Parser.js new file mode 100644 index 0000000..36595ee --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/DotProto/Parser.js @@ -0,0 +1,700 @@ +/*? + // --- Scope ---------------------- + // Lang : Language expressions + // Tokenizer : DotProto Tokenizer + */ +/** + * Constructs a new Parser. + * @exports ProtoBuf.DotProto.Parser + * @class prototype parser + * @param {string} source Source + * @constructor + */ +var Parser = function(source) { + + /** + * Tokenizer. + * @type {!ProtoBuf.DotProto.Tokenizer} + * @expose + */ + this.tn = new Tokenizer(source); + + /** + * Whether parsing proto3 or not. + * @type {boolean} + */ + this.proto3 = false; +}; + +/** + * @alias ProtoBuf.DotProto.Parser.prototype + * @inner + */ +var ParserPrototype = Parser.prototype; + +/** + * Parses the source. + * @returns {!Object} + * @throws {Error} If the source cannot be parsed + * @expose + */ +ParserPrototype.parse = function() { + var topLevel = { + "name": "[ROOT]", // temporary + "package": null, + "messages": [], + "enums": [], + "imports": [], + "options": {}, + "services": [] + // "syntax": undefined + }; + var token, + head = true, + weak; + try { + while (token = this.tn.next()) { + switch (token) { + case 'package': + if (!head || topLevel["package"] !== null) + throw Error("unexpected 'package'"); + token = this.tn.next(); + if (!Lang.TYPEREF.test(token)) + throw Error("illegal package name: " + token); + this.tn.skip(";"); + topLevel["package"] = token; + break; + case 'import': + if (!head) + throw Error("unexpected 'import'"); + token = this.tn.peek(); + if (token === "public" || (weak = token === "weak")) // token ignored + this.tn.next(); + token = this._readString(); + this.tn.skip(";"); + if (!weak) // import ignored + topLevel["imports"].push(token); + break; + case 'syntax': + if (!head) + throw Error("unexpected 'syntax'"); + this.tn.skip("="); + if ((topLevel["syntax"] = this._readString()) === "proto3") + this.proto3 = true; + this.tn.skip(";"); + break; + case 'message': + this._parseMessage(topLevel, null); + head = false; + break; + case 'enum': + this._parseEnum(topLevel); + head = false; + break; + case 'option': + this._parseOption(topLevel); + break; + case 'service': + this._parseService(topLevel); + break; + case 'extend': + this._parseExtend(topLevel); + break; + default: + throw Error("unexpected '" + token + "'"); + } + } + } catch (e) { + e.message = "Parse error at line "+this.tn.line+": " + e.message; + throw e; + } + delete topLevel["name"]; + return topLevel; +}; + +/** + * Parses the specified source. + * @returns {!Object} + * @throws {Error} If the source cannot be parsed + * @expose + */ +Parser.parse = function(source) { + return new Parser(source).parse(); +}; + +// ----- Conversion ------ + +/** + * Converts a numerical string to an id. + * @param {string} value + * @param {boolean=} mayBeNegative + * @returns {number} + * @inner + */ +function mkId(value, mayBeNegative) { + var id = -1, + sign = 1; + if (value.charAt(0) == '-') { + sign = -1; + value = value.substring(1); + } + if (Lang.NUMBER_DEC.test(value)) + id = parseInt(value); + else if (Lang.NUMBER_HEX.test(value)) + id = parseInt(value.substring(2), 16); + else if (Lang.NUMBER_OCT.test(value)) + id = parseInt(value.substring(1), 8); + else + throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value); + id = (sign*id)|0; // Force to 32bit + if (!mayBeNegative && id < 0) + throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value); + return id; +} + +/** + * Converts a numerical string to a number. + * @param {string} val + * @returns {number} + * @inner + */ +function mkNumber(val) { + var sign = 1; + if (val.charAt(0) == '-') { + sign = -1; + val = val.substring(1); + } + if (Lang.NUMBER_DEC.test(val)) + return sign * parseInt(val, 10); + else if (Lang.NUMBER_HEX.test(val)) + return sign * parseInt(val.substring(2), 16); + else if (Lang.NUMBER_OCT.test(val)) + return sign * parseInt(val.substring(1), 8); + else if (val === 'inf') + return sign * Infinity; + else if (val === 'nan') + return NaN; + else if (Lang.NUMBER_FLT.test(val)) + return sign * parseFloat(val); + throw Error("illegal number value: " + (sign < 0 ? '-' : '') + val); +} + +// ----- Reading ------ + +/** + * Reads a string. + * @returns {string} + * @private + */ +ParserPrototype._readString = function() { + var value = "", + token, + delim; + do { + delim = this.tn.next(); + if (delim !== "'" && delim !== '"') + throw Error("illegal string delimiter: "+delim); + value += this.tn.next(); + this.tn.skip(delim); + token = this.tn.peek(); + } while (token === '"' || token === '"'); // multi line? + return value; +}; + +/** + * Reads a value. + * @param {boolean=} mayBeTypeRef + * @returns {number|boolean|string} + * @private + */ +ParserPrototype._readValue = function(mayBeTypeRef) { + var token = this.tn.peek(), + value; + if (token === '"' || token === "'") + return this._readString(); + this.tn.next(); + if (Lang.NUMBER.test(token)) + return mkNumber(token); + if (Lang.BOOL.test(token)) + return (token.toLowerCase() === 'true'); + if (mayBeTypeRef && Lang.TYPEREF.test(token)) + return token; + throw Error("illegal value: "+token); + +}; + +// ----- Parsing constructs ----- + +/** + * Parses a namespace option. + * @param {!Object} parent Parent definition + * @param {boolean=} isList + * @private + */ +ParserPrototype._parseOption = function(parent, isList) { + var token = this.tn.next(), + custom = false; + if (token === '(') { + custom = true; + token = this.tn.next(); + } + if (!Lang.TYPEREF.test(token)) + // we can allow options of the form google.protobuf.* since they will just get ignored anyways + // if (!/google\.protobuf\./.test(token)) // FIXME: Why should that not be a valid typeref? + throw Error("illegal option name: "+token); + var name = token; + if (custom) { // (my_method_option).foo, (my_method_option), some_method_option, (foo.my_option).bar + this.tn.skip(')'); + name = '('+name+')'; + token = this.tn.peek(); + if (Lang.FQTYPEREF.test(token)) { + name += token; + this.tn.next(); + } + } + this.tn.skip('='); + this._parseOptionValue(parent, name); + if (!isList) + this.tn.skip(";"); +}; + +/** + * Sets an option on the specified options object. + * @param {!Object.} options + * @param {string} name + * @param {string|number|boolean} value + * @inner + */ +function setOption(options, name, value) { + if (typeof options[name] === 'undefined') + options[name] = value; + else { + if (!Array.isArray(options[name])) + options[name] = [ options[name] ]; + options[name].push(value); + } +} + +/** + * Parses an option value. + * @param {!Object} parent + * @param {string} name + * @private + */ +ParserPrototype._parseOptionValue = function(parent, name) { + var token = this.tn.peek(); + if (token !== '{') { // Plain value + setOption(parent["options"], name, this._readValue(true)); + } else { // Aggregate options + this.tn.skip("{"); + while ((token = this.tn.next()) !== '}') { + if (!Lang.NAME.test(token)) + throw Error("illegal option name: " + name + "." + token); + if (this.tn.omit(":")) + setOption(parent["options"], name + "." + token, this._readValue(true)); + else + this._parseOptionValue(parent, name + "." + token); + } + } +}; + +/** + * Parses a service definition. + * @param {!Object} parent Parent definition + * @private + */ +ParserPrototype._parseService = function(parent) { + var token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal service name at line "+this.tn.line+": "+token); + var name = token; + var svc = { + "name": name, + "rpc": {}, + "options": {} + }; + this.tn.skip("{"); + while ((token = this.tn.next()) !== '}') { + if (token === "option") + this._parseOption(svc); + else if (token === 'rpc') + this._parseServiceRPC(svc); + else + throw Error("illegal service token: "+token); + } + this.tn.omit(";"); + parent["services"].push(svc); +}; + +/** + * Parses a RPC service definition of the form ['rpc', name, (request), 'returns', (response)]. + * @param {!Object} svc Service definition + * @private + */ +ParserPrototype._parseServiceRPC = function(svc) { + var type = "rpc", + token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal rpc service method name: "+token); + var name = token; + var method = { + "request": null, + "response": null, + "request_stream": false, + "response_stream": false, + "options": {} + }; + this.tn.skip("("); + token = this.tn.next(); + if (token.toLowerCase() === "stream") { + method["request_stream"] = true; + token = this.tn.next(); + } + if (!Lang.TYPEREF.test(token)) + throw Error("illegal rpc service request type: "+token); + method["request"] = token; + this.tn.skip(")"); + token = this.tn.next(); + if (token.toLowerCase() !== "returns") + throw Error("illegal rpc service request type delimiter: "+token); + this.tn.skip("("); + token = this.tn.next(); + if (token.toLowerCase() === "stream") { + method["response_stream"] = true; + token = this.tn.next(); + } + method["response"] = token; + this.tn.skip(")"); + token = this.tn.peek(); + if (token === '{') { + this.tn.next(); + while ((token = this.tn.next()) !== '}') { + if (token === 'option') + this._parseOption(method); + else + throw Error("illegal rpc service token: " + token); + } + this.tn.omit(";"); + } else + this.tn.skip(";"); + if (typeof svc[type] === 'undefined') + svc[type] = {}; + svc[type][name] = method; +}; + +/** + * Parses a message definition. + * @param {!Object} parent Parent definition + * @param {!Object=} fld Field definition if this is a group + * @returns {!Object} + * @private + */ +ParserPrototype._parseMessage = function(parent, fld) { + var isGroup = !!fld, + token = this.tn.next(); + var msg = { + "name": "", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "services": [], + "oneofs": {} + // "extensions": undefined + }; + if (!Lang.NAME.test(token)) + throw Error("illegal "+(isGroup ? "group" : "message")+" name: "+token); + msg["name"] = token; + if (isGroup) { + this.tn.skip("="); + fld["id"] = mkId(this.tn.next()); + msg["isGroup"] = true; + } + token = this.tn.peek(); + if (token === '[' && fld) + this._parseFieldOptions(fld); + this.tn.skip("{"); + while ((token = this.tn.next()) !== '}') { + if (Lang.RULE.test(token)) + this._parseMessageField(msg, token); + else if (token === "oneof") + this._parseMessageOneOf(msg); + else if (token === "enum") + this._parseEnum(msg); + else if (token === "message") + this._parseMessage(msg); + else if (token === "option") + this._parseOption(msg); + else if (token === "service") + this._parseService(msg); + else if (token === "extensions") + if (msg.hasOwnProperty("extensions")) { + msg["extensions"] = msg["extensions"].concat(this._parseExtensionRanges()) + } else { + msg["extensions"] = this._parseExtensionRanges(); + } + else if (token === "reserved") + this._parseIgnored(); // TODO + else if (token === "extend") + this._parseExtend(msg); + else if (Lang.TYPEREF.test(token)) { + if (!this.proto3) + throw Error("illegal field rule: "+token); + this._parseMessageField(msg, "optional", token); + } else + throw Error("illegal message token: "+token); + } + this.tn.omit(";"); + parent["messages"].push(msg); + return msg; +}; + +/** + * Parses an ignored statement. + * @private + */ +ParserPrototype._parseIgnored = function() { + while (this.tn.peek() !== ';') + this.tn.next(); + this.tn.skip(";"); +}; + +/** + * Parses a message field. + * @param {!Object} msg Message definition + * @param {string} rule Field rule + * @param {string=} type Field type if already known (never known for maps) + * @returns {!Object} Field descriptor + * @private + */ +ParserPrototype._parseMessageField = function(msg, rule, type) { + if (!Lang.RULE.test(rule)) + throw Error("illegal message field rule: "+rule); + var fld = { + "rule": rule, + "type": "", + "name": "", + "options": {}, + "id": 0 + }; + var token; + if (rule === "map") { + + if (type) + throw Error("illegal type: " + type); + this.tn.skip('<'); + token = this.tn.next(); + if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token)) + throw Error("illegal message field type: " + token); + fld["keytype"] = token; + this.tn.skip(','); + token = this.tn.next(); + if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token)) + throw Error("illegal message field: " + token); + fld["type"] = token; + this.tn.skip('>'); + token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal message field name: " + token); + fld["name"] = token; + this.tn.skip("="); + fld["id"] = mkId(this.tn.next()); + token = this.tn.peek(); + if (token === '[') + this._parseFieldOptions(fld); + this.tn.skip(";"); + + } else { + + type = typeof type !== 'undefined' ? type : this.tn.next(); + + if (type === "group") { + + // "A [legacy] group simply combines a nested message type and a field into a single declaration. In your + // code, you can treat this message just as if it had a Result type field called result (the latter name is + // converted to lower-case so that it does not conflict with the former)." + var grp = this._parseMessage(msg, fld); + if (!/^[A-Z]/.test(grp["name"])) + throw Error('illegal group name: '+grp["name"]); + fld["type"] = grp["name"]; + fld["name"] = grp["name"].toLowerCase(); + this.tn.omit(";"); + + } else { + + if (!Lang.TYPE.test(type) && !Lang.TYPEREF.test(type)) + throw Error("illegal message field type: " + type); + fld["type"] = type; + token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal message field name: " + token); + fld["name"] = token; + this.tn.skip("="); + fld["id"] = mkId(this.tn.next()); + token = this.tn.peek(); + if (token === "[") + this._parseFieldOptions(fld); + this.tn.skip(";"); + + } + } + msg["fields"].push(fld); + return fld; +}; + +/** + * Parses a message oneof. + * @param {!Object} msg Message definition + * @private + */ +ParserPrototype._parseMessageOneOf = function(msg) { + var token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal oneof name: "+token); + var name = token, + fld; + var fields = []; + this.tn.skip("{"); + while ((token = this.tn.next()) !== "}") { + fld = this._parseMessageField(msg, "optional", token); + fld["oneof"] = name; + fields.push(fld["id"]); + } + this.tn.omit(";"); + msg["oneofs"][name] = fields; +}; + +/** + * Parses a set of field option definitions. + * @param {!Object} fld Field definition + * @private + */ +ParserPrototype._parseFieldOptions = function(fld) { + this.tn.skip("["); + var token, + first = true; + while ((token = this.tn.peek()) !== ']') { + if (!first) + this.tn.skip(","); + this._parseOption(fld, true); + first = false; + } + this.tn.next(); +}; + +/** + * Parses an enum. + * @param {!Object} msg Message definition + * @private + */ +ParserPrototype._parseEnum = function(msg) { + var enm = { + "name": "", + "values": [], + "options": {} + }; + var token = this.tn.next(); + if (!Lang.NAME.test(token)) + throw Error("illegal name: "+token); + enm["name"] = token; + this.tn.skip("{"); + while ((token = this.tn.next()) !== '}') { + if (token === "option") + this._parseOption(enm); + else { + if (!Lang.NAME.test(token)) + throw Error("illegal name: "+token); + this.tn.skip("="); + var val = { + "name": token, + "id": mkId(this.tn.next(), true) + }; + token = this.tn.peek(); + if (token === "[") + this._parseFieldOptions({ "options": {} }); + this.tn.skip(";"); + enm["values"].push(val); + } + } + this.tn.omit(";"); + msg["enums"].push(enm); +}; + +/** + * Parses extension / reserved ranges. + * @returns {!Array.>} + * @private + */ +ParserPrototype._parseExtensionRanges = function() { + var ranges = []; + var token, + range, + value; + do { + range = []; + while (true) { + token = this.tn.next(); + switch (token) { + case "min": + value = ProtoBuf.ID_MIN; + break; + case "max": + value = ProtoBuf.ID_MAX; + break; + default: + value = mkNumber(token); + break; + } + range.push(value); + if (range.length === 2) + break; + if (this.tn.peek() !== "to") { + range.push(value); + break; + } + this.tn.next(); + } + ranges.push(range); + } while (this.tn.omit(",")); + this.tn.skip(";"); + return ranges; +}; + +/** + * Parses an extend block. + * @param {!Object} parent Parent object + * @private + */ +ParserPrototype._parseExtend = function(parent) { + var token = this.tn.next(); + if (!Lang.TYPEREF.test(token)) + throw Error("illegal extend reference: "+token); + var ext = { + "ref": token, + "fields": [] + }; + this.tn.skip("{"); + while ((token = this.tn.next()) !== '}') { + if (Lang.RULE.test(token)) + this._parseMessageField(ext, token); + else if (Lang.TYPEREF.test(token)) { + if (!this.proto3) + throw Error("illegal field rule: "+token); + this._parseMessageField(ext, "optional", token); + } else + throw Error("illegal extend token: "+token); + } + this.tn.omit(";"); + parent["messages"].push(ext); + return ext; +}; + +// ----- General ----- + +/** + * Returns a string representation of this parser. + * @returns {string} + */ +ParserPrototype.toString = function() { + return "Parser at line "+this.tn.line; +}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/DotProto/Tokenizer.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/DotProto/Tokenizer.js new file mode 100644 index 0000000..10c1a1d --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/DotProto/Tokenizer.js @@ -0,0 +1,190 @@ +/*? + // --- Scope ----------------- + // Lang : Language expressions +*/ +/** + * Constructs a new Tokenizer. + * @exports ProtoBuf.DotProto.Tokenizer + * @class prototype tokenizer + * @param {string} proto Proto to tokenize + * @constructor + */ +var Tokenizer = function(proto) { + + /** + * Source to parse. + * @type {string} + * @expose + */ + this.source = proto+""; + + /** + * Current index. + * @type {number} + * @expose + */ + this.index = 0; + + /** + * Current line. + * @type {number} + * @expose + */ + this.line = 1; + + /** + * Token stack. + * @type {!Array.} + * @expose + */ + this.stack = []; + + /** + * Opening character of the current string read, if any. + * @type {?string} + * @private + */ + this._stringOpen = null; +}; + +/** + * @alias ProtoBuf.DotProto.Tokenizer.prototype + * @inner + */ +var TokenizerPrototype = Tokenizer.prototype; + +/** + * Reads a string beginning at the current index. + * @return {string} + * @private + */ +TokenizerPrototype._readString = function() { + var re = this._stringOpen === '"' + ? Lang.STRING_DQ + : Lang.STRING_SQ; + re.lastIndex = this.index - 1; // Include the open quote + var match = re.exec(this.source); + if (!match) + throw Error("unterminated string"); + this.index = re.lastIndex; + this.stack.push(this._stringOpen); + this._stringOpen = null; + return match[1]; +}; + +/** + * Gets the next token and advances by one. + * @return {?string} Token or `null` on EOF + * @expose + */ +TokenizerPrototype.next = function() { + if (this.stack.length > 0) + return this.stack.shift(); + if (this.index >= this.source.length) + return null; + if (this._stringOpen !== null) + return this._readString(); + + var repeat, + prev, + next; + do { + repeat = false; + + // Strip white spaces + while (Lang.WHITESPACE.test(next = this.source.charAt(this.index))) { + if (next === '\n') + ++this.line; + if (++this.index === this.source.length) + return null; + } + + // Strip comments + if (this.source.charAt(this.index) === '/') { + ++this.index; + if (this.source.charAt(this.index) === '/') { // Line + while (this.source.charAt(++this.index) !== '\n') + if (this.index == this.source.length) + return null; + ++this.index; + ++this.line; + repeat = true; + } else if ((next = this.source.charAt(this.index)) === '*') { /* Block */ + do { + if (next === '\n') + ++this.line; + if (++this.index === this.source.length) + return null; + prev = next; + next = this.source.charAt(this.index); + } while (prev !== '*' || next !== '/'); + ++this.index; + repeat = true; + } else + return '/'; + } + } while (repeat); + + if (this.index === this.source.length) + return null; + + // Read the next token + var end = this.index; + Lang.DELIM.lastIndex = 0; + var delim = Lang.DELIM.test(this.source.charAt(end++)); + if (!delim) + while(end < this.source.length && !Lang.DELIM.test(this.source.charAt(end))) + ++end; + var token = this.source.substring(this.index, this.index = end); + if (token === '"' || token === "'") + this._stringOpen = token; + return token; +}; + +/** + * Peeks for the next token. + * @return {?string} Token or `null` on EOF + * @expose + */ +TokenizerPrototype.peek = function() { + if (this.stack.length === 0) { + var token = this.next(); + if (token === null) + return null; + this.stack.push(token); + } + return this.stack[0]; +}; + +/** + * Skips a specific token and throws if it differs. + * @param {string} expected Expected token + * @throws {Error} If the actual token differs + */ +TokenizerPrototype.skip = function(expected) { + var actual = this.next(); + if (actual !== expected) + throw Error("illegal '"+actual+"', '"+expected+"' expected"); +}; + +/** + * Omits an optional token. + * @param {string} expected Expected optional token + * @returns {boolean} `true` if the token exists + */ +TokenizerPrototype.omit = function(expected) { + if (this.peek() === expected) { + this.next(); + return true; + } + return false; +}; + +/** + * Returns a string representation of this object. + * @return {string} String representation as of "Tokenizer(index/length)" + * @expose + */ +TokenizerPrototype.toString = function() { + return "Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"; +}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Lang.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Lang.js new file mode 100644 index 0000000..a0fb768 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Lang.js @@ -0,0 +1,64 @@ +/** + * Language expressions. + * @type {!Object.} + * @expose + */ +ProtoBuf.Lang = { + + // Characters always ending a statement + DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g, + + // Field rules + RULE: /^(?:required|optional|repeated|map)$/, + + // Field types + TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/, + + // Names + NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/, + + // Type definitions + TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/, + + // Type references + TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/, + + // Fully qualified type references + FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/, + + // All numbers + NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/, + + // Decimal numbers + NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/, + + // Hexadecimal numbers + NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/, + + // Octal numbers + NUMBER_OCT: /^0[0-7]+$/, + + // Floating point numbers + NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/, + + // Booleans + BOOL: /^(?:true|false)$/i, + + // Id numbers + ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/, + + // Negative id numbers (enum values) + NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/, + + // Whitespaces + WHITESPACE: /\s/, + + // All strings + STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g, + + // Double quoted strings + STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g, + + // Single quoted strings + STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g +}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Map.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Map.js new file mode 100644 index 0000000..ca2e88a --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Map.js @@ -0,0 +1,197 @@ +/** + * @alias ProtoBuf.Map + * @expose + */ +ProtoBuf.Map = (function(ProtoBuf, Reflect) { + "use strict"; + + /** + * Constructs a new Map. A Map is a container that is used to implement map + * fields on message objects. It closely follows the ES6 Map API; however, + * it is distinct because we do not want to depend on external polyfills or + * on ES6 itself. + * + * @exports ProtoBuf.Map + * @param {!ProtoBuf.Reflect.Field} field Map field + * @param {Object.=} contents Initial contents + * @constructor + */ + var Map = function(field, contents) { + if (!field.map) + throw Error("field is not a map"); + + /** + * The field corresponding to this map. + * @type {!ProtoBuf.Reflect.Field} + */ + this.field = field; + + /** + * Element instance corresponding to key type. + * @type {!ProtoBuf.Reflect.Element} + */ + this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax); + + /** + * Element instance corresponding to value type. + * @type {!ProtoBuf.Reflect.Element} + */ + this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax); + + /** + * Internal map: stores mapping of (string form of key) -> (key, value) + * pair. + * + * We provide map semantics for arbitrary key types, but we build on top + * of an Object, which has only string keys. In order to avoid the need + * to convert a string key back to its native type in many situations, + * we store the native key value alongside the value. Thus, we only need + * a one-way mapping from a key type to its string form that guarantees + * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1 + * === K2). + * + * @type {!Object} + */ + this.map = {}; + + /** + * Returns the number of elements in the map. + */ + Object.defineProperty(this, "size", { + get: function() { return Object.keys(this.map).length; } + }); + + // Fill initial contents from a raw object. + if (contents) { + var keys = Object.keys(contents); + for (var i = 0; i < keys.length; i++) { + var key = this.keyElem.valueFromString(keys[i]); + var val = this.valueElem.verifyValue(contents[keys[i]]); + this.map[this.keyElem.valueToString(key)] = + { key: key, value: val }; + } + } + }; + + var MapPrototype = Map.prototype; + + /** + * Helper: return an iterator over an array. + * @param {!Array<*>} arr the array + * @returns {!Object} an iterator + * @inner + */ + function arrayIterator(arr) { + var idx = 0; + return { + next: function() { + if (idx < arr.length) + return { done: false, value: arr[idx++] }; + return { done: true }; + } + } + } + + /** + * Clears the map. + */ + MapPrototype.clear = function() { + this.map = {}; + }; + + /** + * Deletes a particular key from the map. + * @returns {boolean} Whether any entry with this key was deleted. + */ + MapPrototype["delete"] = function(key) { + var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key)); + var hadKey = keyValue in this.map; + delete this.map[keyValue]; + return hadKey; + }; + + /** + * Returns an iterator over [key, value] pairs in the map. + * @returns {Object} The iterator + */ + MapPrototype.entries = function() { + var entries = []; + var strKeys = Object.keys(this.map); + for (var i = 0, entry; i < strKeys.length; i++) + entries.push([(entry=this.map[strKeys[i]]).key, entry.value]); + return arrayIterator(entries); + }; + + /** + * Returns an iterator over keys in the map. + * @returns {Object} The iterator + */ + MapPrototype.keys = function() { + var keys = []; + var strKeys = Object.keys(this.map); + for (var i = 0; i < strKeys.length; i++) + keys.push(this.map[strKeys[i]].key); + return arrayIterator(keys); + }; + + /** + * Returns an iterator over values in the map. + * @returns {!Object} The iterator + */ + MapPrototype.values = function() { + var values = []; + var strKeys = Object.keys(this.map); + for (var i = 0; i < strKeys.length; i++) + values.push(this.map[strKeys[i]].value); + return arrayIterator(values); + }; + + /** + * Iterates over entries in the map, calling a function on each. + * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments. + * @param {Object=} thisArg The `this` value for the callback + */ + MapPrototype.forEach = function(cb, thisArg) { + var strKeys = Object.keys(this.map); + for (var i = 0, entry; i < strKeys.length; i++) + cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this); + }; + + /** + * Sets a key in the map to the given value. + * @param {*} key The key + * @param {*} value The value + * @returns {!ProtoBuf.Map} The map instance + */ + MapPrototype.set = function(key, value) { + var keyValue = this.keyElem.verifyValue(key); + var valValue = this.valueElem.verifyValue(value); + this.map[this.keyElem.valueToString(keyValue)] = + { key: keyValue, value: valValue }; + return this; + }; + + /** + * Gets the value corresponding to a key in the map. + * @param {*} key The key + * @returns {*|undefined} The value, or `undefined` if key not present + */ + MapPrototype.get = function(key) { + var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key)); + if (!(keyValue in this.map)) + return undefined; + return this.map[keyValue].value; + }; + + /** + * Determines whether the given key is present in the map. + * @param {*} key The key + * @returns {boolean} `true` if the key is present + */ + MapPrototype.has = function(key) { + var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key)); + return (keyValue in this.map); + }; + + return Map; +})(ProtoBuf, ProtoBuf.Reflect); diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect.js new file mode 100644 index 0000000..8172bb9 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect.js @@ -0,0 +1,121 @@ +/** + * @alias ProtoBuf.Reflect + * @expose + */ +ProtoBuf.Reflect = (function(ProtoBuf) { + "use strict"; + + /** + * Reflection types. + * @exports ProtoBuf.Reflect + * @namespace + */ + var Reflect = {}; + + //? include("Reflect/T.js"); + + /** + * @alias ProtoBuf.Reflect.T + * @expose + */ + Reflect.T = T; + + //? include("Reflect/Namespace.js"); + + /** + * @alias ProtoBuf.Reflect.Namespace + * @expose + */ + Reflect.Namespace = Namespace; + + //? include("Reflect/Element.js"); + + /** + * @alias ProtoBuf.Reflect.Element + * @expose + */ + Reflect.Element = Element; + + //? include("Reflect/Message.js"); + + /** + * @alias ProtoBuf.Reflect.Message + * @expose + */ + Reflect.Message = Message; + + //? include("Reflect/Message/Field.js"); + + /** + * @alias ProtoBuf.Reflect.Message.Field + * @expose + */ + Reflect.Message.Field = Field; + + //? include("Reflect/Message/ExtensionField.js"); + + /** + * @alias ProtoBuf.Reflect.Message.ExtensionField + * @expose + */ + Reflect.Message.ExtensionField = ExtensionField; + + //? include("Reflect/Message/OneOf.js"); + + /** + * @alias ProtoBuf.Reflect.Message.OneOf + * @expose + */ + Reflect.Message.OneOf = OneOf; + + //? include("Reflect/Enum.js"); + + /** + * @alias ProtoBuf.Reflect.Enum + * @expose + */ + Reflect.Enum = Enum; + + //? include("Reflect/Enum/Value.js"); + + /** + * @alias ProtoBuf.Reflect.Enum.Value + * @expose + */ + Reflect.Enum.Value = Value; + + //? include("Reflect/Extension.js"); + + /** + * @alias ProtoBuf.Reflect.Extension + * @expose + */ + Reflect.Extension = Extension; + + //? include("Reflect/Service.js"); + + /** + * @alias ProtoBuf.Reflect.Service + * @expose + */ + Reflect.Service = Service; + + //? include("Reflect/Service/Method.js"); + + /** + * @alias ProtoBuf.Reflect.Service.Method + * @expose + */ + Reflect.Service.Method = Method; + + //? include("Reflect/Service/RPCMethod.js"); + + /** + * @alias ProtoBuf.Reflect.Service.RPCMethod + * @expose + */ + Reflect.Service.RPCMethod = RPCMethod; + + return Reflect; + +})(ProtoBuf); diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Element.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Element.js new file mode 100644 index 0000000..0e7b8ee --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Element.js @@ -0,0 +1,580 @@ +/** + * Constructs a new Element implementation that checks and converts values for a + * particular field type, as appropriate. + * + * An Element represents a single value: either the value of a singular field, + * or a value contained in one entry of a repeated field or map field. This + * class does not implement these higher-level concepts; it only encapsulates + * the low-level typechecking and conversion. + * + * @exports ProtoBuf.Reflect.Element + * @param {{name: string, wireType: number}} type Resolved data type + * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant + * (e.g. submessage field). + * @param {boolean} isMapKey Is this element a Map key? The value will be + * converted to string form if so. + * @param {string} syntax Syntax level of defining message type, e.g., + * proto2 or proto3. + * @param {string} name Name of the field containing this element (for error + * messages) + * @constructor + */ +var Element = function(type, resolvedType, isMapKey, syntax, name) { + + /** + * Element type, as a string (e.g., int32). + * @type {{name: string, wireType: number}} + */ + this.type = type; + + /** + * Element type reference to submessage or enum definition, if needed. + * @type {ProtoBuf.Reflect.T|null} + */ + this.resolvedType = resolvedType; + + /** + * Element is a map key. + * @type {boolean} + */ + this.isMapKey = isMapKey; + + /** + * Syntax level of defining message type, e.g., proto2 or proto3. + * @type {string} + */ + this.syntax = syntax; + + /** + * Name of the field containing this element (for error messages) + * @type {string} + */ + this.name = name; + + if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0) + throw Error("Invalid map key type: " + type.name); +}; + +var ElementPrototype = Element.prototype; + +/** + * Obtains a (new) default value for the specified type. + * @param type {string|{name: string, wireType: number}} Field type + * @returns {*} Default value + * @inner + */ +function mkDefault(type) { + if (typeof type === 'string') + type = ProtoBuf.TYPES[type]; + if (typeof type.defaultValue === 'undefined') + throw Error("default value for type "+type.name+" is not supported"); + if (type == ProtoBuf.TYPES["bytes"]) + return new ByteBuffer(0); + return type.defaultValue; +} + +/** + * Returns the default value for this field in proto3. + * @function + * @param type {string|{name: string, wireType: number}} the field type + * @returns {*} Default value + */ +Element.defaultFieldValue = mkDefault; + +/** + * Makes a Long from a value. + * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value + * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for + * strings and numbers + * @returns {!Long} + * @throws {Error} If the value cannot be converted to a Long + * @inner + */ +function mkLong(value, unsigned) { + if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean' + && value.low === value.low && value.high === value.high) + return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned); + if (typeof value === 'string') + return ProtoBuf.Long.fromString(value, unsigned || false, 10); + if (typeof value === 'number') + return ProtoBuf.Long.fromNumber(value, unsigned || false); + throw Error("not convertible to Long"); +} + +ElementPrototype.toString = function() { + return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element'; +} + +/** + * Checks if the given value can be set for an element of this type (singular + * field or one element of a repeated field or map). + * @param {*} value Value to check + * @return {*} Verified, maybe adjusted, value + * @throws {Error} If the value cannot be verified for this element slot + * @expose + */ +ElementPrototype.verifyValue = function(value) { + var self = this; + function fail(val, msg) { + throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")"); + } + switch (this.type) { + // Signed 32bit + case ProtoBuf.TYPES["int32"]: + case ProtoBuf.TYPES["sint32"]: + case ProtoBuf.TYPES["sfixed32"]: + // Account for !NaN: value === value + if (typeof value !== 'number' || (value === value && value % 1 !== 0)) + fail(typeof value, "not an integer"); + return value > 4294967295 ? value | 0 : value; + + // Unsigned 32bit + case ProtoBuf.TYPES["uint32"]: + case ProtoBuf.TYPES["fixed32"]: + if (typeof value !== 'number' || (value === value && value % 1 !== 0)) + fail(typeof value, "not an integer"); + return value < 0 ? value >>> 0 : value; + + // Signed 64bit + case ProtoBuf.TYPES["int64"]: + case ProtoBuf.TYPES["sint64"]: + case ProtoBuf.TYPES["sfixed64"]: { + if (ProtoBuf.Long) + try { + return mkLong(value, false); + } catch (e) { + fail(typeof value, e.message); + } + else + fail(typeof value, "requires Long.js"); + } + + // Unsigned 64bit + case ProtoBuf.TYPES["uint64"]: + case ProtoBuf.TYPES["fixed64"]: { + if (ProtoBuf.Long) + try { + return mkLong(value, true); + } catch (e) { + fail(typeof value, e.message); + } + else + fail(typeof value, "requires Long.js"); + } + + // Bool + case ProtoBuf.TYPES["bool"]: + if (typeof value !== 'boolean') + fail(typeof value, "not a boolean"); + return value; + + // Float + case ProtoBuf.TYPES["float"]: + case ProtoBuf.TYPES["double"]: + if (typeof value !== 'number') + fail(typeof value, "not a number"); + return value; + + // Length-delimited string + case ProtoBuf.TYPES["string"]: + if (typeof value !== 'string' && !(value && value instanceof String)) + fail(typeof value, "not a string"); + return ""+value; // Convert String object to string + + // Length-delimited bytes + case ProtoBuf.TYPES["bytes"]: + if (ByteBuffer.isByteBuffer(value)) + return value; + return ByteBuffer.wrap(value, "base64"); + + // Constant enum value + case ProtoBuf.TYPES["enum"]: { + var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value); + for (i=0; i 4294967295 || value < 0) + fail(typeof value, "not in range for uint32") + return value; + } else { + // proto2 requires enum values to be valid. + fail(value, "not a valid enum value"); + } + } + // Embedded message + case ProtoBuf.TYPES["group"]: + case ProtoBuf.TYPES["message"]: { + if (!value || typeof value !== 'object') + fail(typeof value, "object expected"); + if (value instanceof this.resolvedType.clazz) + return value; + if (value instanceof ProtoBuf.Builder.Message) { + // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180) + var obj = {}; + for (var i in value) + if (value.hasOwnProperty(i)) + obj[i] = value[i]; + value = obj; + } + // Else let's try to construct one from a key-value object + return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons + } + } + + // We should never end here + throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")"); +}; + +/** + * Calculates the byte length of an element on the wire. + * @param {number} id Field number + * @param {*} value Field value + * @returns {number} Byte length + * @throws {Error} If the value cannot be calculated + * @expose + */ +ElementPrototype.calculateLength = function(id, value) { + if (value === null) return 0; // Nothing to encode + // Tag has already been written + var n; + switch (this.type) { + case ProtoBuf.TYPES["int32"]: + return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value); + case ProtoBuf.TYPES["uint32"]: + return ByteBuffer.calculateVarint32(value); + case ProtoBuf.TYPES["sint32"]: + return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value)); + case ProtoBuf.TYPES["fixed32"]: + case ProtoBuf.TYPES["sfixed32"]: + case ProtoBuf.TYPES["float"]: + return 4; + case ProtoBuf.TYPES["int64"]: + case ProtoBuf.TYPES["uint64"]: + return ByteBuffer.calculateVarint64(value); + case ProtoBuf.TYPES["sint64"]: + return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value)); + case ProtoBuf.TYPES["fixed64"]: + case ProtoBuf.TYPES["sfixed64"]: + return 8; + case ProtoBuf.TYPES["bool"]: + return 1; + case ProtoBuf.TYPES["enum"]: + return ByteBuffer.calculateVarint32(value); + case ProtoBuf.TYPES["double"]: + return 8; + case ProtoBuf.TYPES["string"]: + n = ByteBuffer.calculateUTF8Bytes(value); + return ByteBuffer.calculateVarint32(n) + n; + case ProtoBuf.TYPES["bytes"]: + if (value.remaining() < 0) + throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining"); + return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining(); + case ProtoBuf.TYPES["message"]: + n = this.resolvedType.calculate(value); + return ByteBuffer.calculateVarint32(n) + n; + case ProtoBuf.TYPES["group"]: + n = this.resolvedType.calculate(value); + return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP); + } + // We should never end here + throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)"); +}; + +/** + * Encodes a value to the specified buffer. Does not encode the key. + * @param {number} id Field number + * @param {*} value Field value + * @param {ByteBuffer} buffer ByteBuffer to encode to + * @return {ByteBuffer} The ByteBuffer for chaining + * @throws {Error} If the value cannot be encoded + * @expose + */ +ElementPrototype.encodeValue = function(id, value, buffer) { + if (value === null) return buffer; // Nothing to encode + // Tag has already been written + + switch (this.type) { + // 32bit signed varint + case ProtoBuf.TYPES["int32"]: + // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes + // long – it is, effectively, treated like a very large unsigned integer." (see #122) + if (value < 0) + buffer.writeVarint64(value); + else + buffer.writeVarint32(value); + break; + + // 32bit unsigned varint + case ProtoBuf.TYPES["uint32"]: + buffer.writeVarint32(value); + break; + + // 32bit varint zig-zag + case ProtoBuf.TYPES["sint32"]: + buffer.writeVarint32ZigZag(value); + break; + + // Fixed unsigned 32bit + case ProtoBuf.TYPES["fixed32"]: + buffer.writeUint32(value); + break; + + // Fixed signed 32bit + case ProtoBuf.TYPES["sfixed32"]: + buffer.writeInt32(value); + break; + + // 64bit varint as-is + case ProtoBuf.TYPES["int64"]: + case ProtoBuf.TYPES["uint64"]: + buffer.writeVarint64(value); // throws + break; + + // 64bit varint zig-zag + case ProtoBuf.TYPES["sint64"]: + buffer.writeVarint64ZigZag(value); // throws + break; + + // Fixed unsigned 64bit + case ProtoBuf.TYPES["fixed64"]: + buffer.writeUint64(value); // throws + break; + + // Fixed signed 64bit + case ProtoBuf.TYPES["sfixed64"]: + buffer.writeInt64(value); // throws + break; + + // Bool + case ProtoBuf.TYPES["bool"]: + if (typeof value === 'string') + buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value); + else + buffer.writeVarint32(value ? 1 : 0); + break; + + // Constant enum value + case ProtoBuf.TYPES["enum"]: + buffer.writeVarint32(value); + break; + + // 32bit float + case ProtoBuf.TYPES["float"]: + buffer.writeFloat32(value); + break; + + // 64bit float + case ProtoBuf.TYPES["double"]: + buffer.writeFloat64(value); + break; + + // Length-delimited string + case ProtoBuf.TYPES["string"]: + buffer.writeVString(value); + break; + + // Length-delimited bytes + case ProtoBuf.TYPES["bytes"]: + if (value.remaining() < 0) + throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining"); + var prevOffset = value.offset; + buffer.writeVarint32(value.remaining()); + buffer.append(value); + value.offset = prevOffset; + break; + + // Embedded message + case ProtoBuf.TYPES["message"]: + var bb = new ByteBuffer().LE(); + this.resolvedType.encode(value, bb); + buffer.writeVarint32(bb.offset); + buffer.append(bb.flip()); + break; + + // Legacy group + case ProtoBuf.TYPES["group"]: + this.resolvedType.encode(value, buffer); + buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP); + break; + + default: + // We should never end here + throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)"); + } + return buffer; +}; + +/** + * Decode one element value from the specified buffer. + * @param {ByteBuffer} buffer ByteBuffer to decode from + * @param {number} wireType The field wire type + * @param {number} id The field number + * @return {*} Decoded value + * @throws {Error} If the field cannot be decoded + * @expose + */ +ElementPrototype.decode = function(buffer, wireType, id) { + if (wireType != this.type.wireType) + throw Error("Unexpected wire type for element"); + + var value, nBytes; + switch (this.type) { + // 32bit signed varint + case ProtoBuf.TYPES["int32"]: + return buffer.readVarint32() | 0; + + // 32bit unsigned varint + case ProtoBuf.TYPES["uint32"]: + return buffer.readVarint32() >>> 0; + + // 32bit signed varint zig-zag + case ProtoBuf.TYPES["sint32"]: + return buffer.readVarint32ZigZag() | 0; + + // Fixed 32bit unsigned + case ProtoBuf.TYPES["fixed32"]: + return buffer.readUint32() >>> 0; + + case ProtoBuf.TYPES["sfixed32"]: + return buffer.readInt32() | 0; + + // 64bit signed varint + case ProtoBuf.TYPES["int64"]: + return buffer.readVarint64(); + + // 64bit unsigned varint + case ProtoBuf.TYPES["uint64"]: + return buffer.readVarint64().toUnsigned(); + + // 64bit signed varint zig-zag + case ProtoBuf.TYPES["sint64"]: + return buffer.readVarint64ZigZag(); + + // Fixed 64bit unsigned + case ProtoBuf.TYPES["fixed64"]: + return buffer.readUint64(); + + // Fixed 64bit signed + case ProtoBuf.TYPES["sfixed64"]: + return buffer.readInt64(); + + // Bool varint + case ProtoBuf.TYPES["bool"]: + return !!buffer.readVarint32(); + + // Constant enum value (varint) + case ProtoBuf.TYPES["enum"]: + // The following Builder.Message#set will already throw + return buffer.readVarint32(); + + // 32bit float + case ProtoBuf.TYPES["float"]: + return buffer.readFloat(); + + // 64bit float + case ProtoBuf.TYPES["double"]: + return buffer.readDouble(); + + // Length-delimited string + case ProtoBuf.TYPES["string"]: + return buffer.readVString(); + + // Length-delimited bytes + case ProtoBuf.TYPES["bytes"]: { + nBytes = buffer.readVarint32(); + if (buffer.remaining() < nBytes) + throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining()); + value = buffer.clone(); // Offset already set + value.limit = value.offset+nBytes; + buffer.offset += nBytes; + return value; + } + + // Length-delimited embedded message + case ProtoBuf.TYPES["message"]: { + nBytes = buffer.readVarint32(); + return this.resolvedType.decode(buffer, nBytes); + } + + // Legacy group + case ProtoBuf.TYPES["group"]: + return this.resolvedType.decode(buffer, -1, id); + } + + // We should never end here + throw Error("[INTERNAL] Illegal decode type"); +}; + +/** + * Converts a value from a string to the canonical element type. + * + * Legal only when isMapKey is true. + * + * @param {string} str The string value + * @returns {*} The value + */ +ElementPrototype.valueFromString = function(str) { + if (!this.isMapKey) { + throw Error("valueFromString() called on non-map-key element"); + } + + switch (this.type) { + case ProtoBuf.TYPES["int32"]: + case ProtoBuf.TYPES["sint32"]: + case ProtoBuf.TYPES["sfixed32"]: + case ProtoBuf.TYPES["uint32"]: + case ProtoBuf.TYPES["fixed32"]: + return this.verifyValue(parseInt(str)); + + case ProtoBuf.TYPES["int64"]: + case ProtoBuf.TYPES["sint64"]: + case ProtoBuf.TYPES["sfixed64"]: + case ProtoBuf.TYPES["uint64"]: + case ProtoBuf.TYPES["fixed64"]: + // Long-based fields support conversions from string already. + return this.verifyValue(str); + + case ProtoBuf.TYPES["bool"]: + return str === "true"; + + case ProtoBuf.TYPES["string"]: + return this.verifyValue(str); + + case ProtoBuf.TYPES["bytes"]: + return ByteBuffer.fromBinary(str); + } +}; + +/** + * Converts a value from the canonical element type to a string. + * + * It should be the case that `valueFromString(valueToString(val))` returns + * a value equivalent to `verifyValue(val)` for every legal value of `val` + * according to this element type. + * + * This may be used when the element must be stored or used as a string, + * e.g., as a map key on an Object. + * + * Legal only when isMapKey is true. + * + * @param {*} val The value + * @returns {string} The string form of the value. + */ +ElementPrototype.valueToString = function(value) { + if (!this.isMapKey) { + throw Error("valueToString() called on non-map-key element"); + } + + if (this.type === ProtoBuf.TYPES["bytes"]) { + return value.toString("binary"); + } else { + return value.toString(); + } +}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Enum.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Enum.js new file mode 100644 index 0000000..87c05e6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Enum.js @@ -0,0 +1,68 @@ +/** + * Constructs a new Enum. + * @exports ProtoBuf.Reflect.Enum + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object + * @param {string} name Enum name + * @param {Object.=} options Enum options + * @param {string?} syntax The syntax level (e.g., proto3) + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +var Enum = function(builder, parent, name, options, syntax) { + Namespace.call(this, builder, parent, name, options, syntax); + + /** + * @override + */ + this.className = "Enum"; + + /** + * Runtime enum object. + * @type {Object.|null} + * @expose + */ + this.object = null; +}; + +/** + * Gets the string name of an enum value. + * @param {!ProtoBuf.Builder.Enum} enm Runtime enum + * @param {number} value Enum value + * @returns {?string} Name or `null` if not present + * @expose + */ +Enum.getName = function(enm, value) { + var keys = Object.keys(enm); + for (var i=0, key; i} + * @expose + */ +EnumPrototype.build = function(rebuild) { + if (this.object && !rebuild) + return this.object; + var enm = new ProtoBuf.Builder.Enum(), + values = this.getChildren(Enum.Value); + for (var i=0, k=values.length; i=} options Message options + * @param {boolean=} isGroup `true` if this is a legacy group + * @param {string?} syntax The syntax level of this definition (e.g., proto3) + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +var Message = function(builder, parent, name, options, isGroup, syntax) { + Namespace.call(this, builder, parent, name, options, syntax); + + /** + * @override + */ + this.className = "Message"; + + /** + * Extensions range. + * @type {!Array.|undefined} + * @expose + */ + this.extensions = undefined; + + /** + * Runtime message class. + * @type {?function(new:ProtoBuf.Builder.Message)} + * @expose + */ + this.clazz = null; + + /** + * Whether this is a legacy group or not. + * @type {boolean} + * @expose + */ + this.isGroup = !!isGroup; + + // The following cached collections are used to efficiently iterate over or look up fields when decoding. + + /** + * Cached fields. + * @type {?Array.} + * @private + */ + this._fields = null; + + /** + * Cached fields by id. + * @type {?Object.} + * @private + */ + this._fieldsById = null; + + /** + * Cached fields by name. + * @type {?Object.} + * @private + */ + this._fieldsByName = null; +}; + +/** + * @alias ProtoBuf.Reflect.Message.prototype + * @inner + */ +var MessagePrototype = Message.prototype = Object.create(Namespace.prototype); + +/** + * Builds the message and returns the runtime counterpart, which is a fully functional class. + * @see ProtoBuf.Builder.Message + * @param {boolean=} rebuild Whether to rebuild or not, defaults to false + * @return {ProtoBuf.Reflect.Message} Message class + * @throws {Error} If the message cannot be built + * @expose + */ +MessagePrototype.build = function(rebuild) { + if (this.clazz && !rebuild) + return this.clazz; + + // Create the runtime Message class in its own scope + var clazz = (function(ProtoBuf, T) { + + //? include("../Builder/Message.js"); + + return Message; + + })(ProtoBuf, this); + + // Static enums and prototyped sub-messages / cached collections + this._fields = []; + this._fieldsById = {}; + this._fieldsByName = {}; + this._oneofsByName = {}; + for (var i=0, k=this.children.length, child; i>> 3; + switch (wireType) { + case ProtoBuf.WIRE_TYPES.VARINT: + do tag = buf.readUint8(); + while ((tag & 0x80) === 0x80); + break; + case ProtoBuf.WIRE_TYPES.BITS64: + buf.offset += 8; + break; + case ProtoBuf.WIRE_TYPES.LDELIM: + tag = buf.readVarint32(); // reads the varint + buf.offset += tag; // skips n bytes + break; + case ProtoBuf.WIRE_TYPES.STARTGROUP: + skipTillGroupEnd(id, buf); + break; + case ProtoBuf.WIRE_TYPES.ENDGROUP: + if (id === expectedId) + return false; + else + throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)"); + case ProtoBuf.WIRE_TYPES.BITS32: + buf.offset += 4; + break; + default: + throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType); + } + return true; +} + +/** + * Decodes an encoded message and returns the decoded message. + * @param {ByteBuffer} buffer ByteBuffer to decode from + * @param {number=} length Message length. Defaults to decode all remaining data. + * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group + * @return {ProtoBuf.Builder.Message} Decoded message + * @throws {Error} If the message cannot be decoded + * @expose + */ +MessagePrototype.decode = function(buffer, length, expectedGroupEndId) { + if (typeof length !== 'number') + length = -1; + var start = buffer.offset, + msg = new (this.clazz)(), + tag, wireType, id, field; + while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) { + tag = buffer.readVarint32(); + wireType = tag & 0x07; + id = tag >>> 3; + if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) { + if (id !== expectedGroupEndId) + throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")"); + break; + } + if (!(field = this._fieldsById[id])) { + // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing." + switch (wireType) { + case ProtoBuf.WIRE_TYPES.VARINT: + buffer.readVarint32(); + break; + case ProtoBuf.WIRE_TYPES.BITS32: + buffer.offset += 4; + break; + case ProtoBuf.WIRE_TYPES.BITS64: + buffer.offset += 8; + break; + case ProtoBuf.WIRE_TYPES.LDELIM: + var len = buffer.readVarint32(); + buffer.offset += len; + break; + case ProtoBuf.WIRE_TYPES.STARTGROUP: + while (skipTillGroupEnd(id, buffer)) {} + break; + default: + throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType); + } + continue; + } + if (field.repeated && !field.options["packed"]) { + msg[field.name].push(field.decode(wireType, buffer)); + } else if (field.map) { + var keyval = field.decode(wireType, buffer); + msg[field.name].set(keyval[0], keyval[1]); + } else { + msg[field.name] = field.decode(wireType, buffer); + if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field) + var currentField = msg[field.oneof.name]; // Virtual field references currently set field + if (currentField !== null && currentField !== field.name) + msg[currentField] = null; // Clear currently set field + msg[field.oneof.name] = field.name; // Point virtual field at this field + } + } + } + + // Check if all required fields are present and set default values for optional fields that are not + for (var i=0, k=this._fields.length; i=} options Options + * @constructor + * @extends ProtoBuf.Reflect.Message.Field + */ +var ExtensionField = function(builder, message, rule, type, name, id, options) { + Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options); + + /** + * Extension reference. + * @type {!ProtoBuf.Reflect.Extension} + * @expose + */ + this.extension; +}; + +// Extends Field +ExtensionField.prototype = Object.create(Field.prototype); diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/Field.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/Field.js new file mode 100644 index 0000000..d7c3b64 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/Field.js @@ -0,0 +1,458 @@ +/** + * Constructs a new Message Field. + * @exports ProtoBuf.Reflect.Message.Field + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.Message} message Message reference + * @param {string} rule Rule, one of requried, optional, repeated + * @param {string?} keytype Key data type, if any. + * @param {string} type Data type, e.g. int32 + * @param {string} name Field name + * @param {number} id Unique field id + * @param {Object.=} options Options + * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf + * @param {string?} syntax The syntax level of this definition (e.g., proto3) + * @constructor + * @extends ProtoBuf.Reflect.T + */ +var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) { + T.call(this, builder, message, name); + + /** + * @override + */ + this.className = "Message.Field"; + + /** + * Message field required flag. + * @type {boolean} + * @expose + */ + this.required = rule === "required"; + + /** + * Message field repeated flag. + * @type {boolean} + * @expose + */ + this.repeated = rule === "repeated"; + + /** + * Message field map flag. + * @type {boolean} + * @expose + */ + this.map = rule === "map"; + + /** + * Message field key type. Type reference string if unresolved, protobuf + * type if resolved. Valid only if this.map === true, null otherwise. + * @type {string|{name: string, wireType: number}|null} + * @expose + */ + this.keyType = keytype || null; + + /** + * Message field type. Type reference string if unresolved, protobuf type if + * resolved. In a map field, this is the value type. + * @type {string|{name: string, wireType: number}} + * @expose + */ + this.type = type; + + /** + * Resolved type reference inside the global namespace. + * @type {ProtoBuf.Reflect.T|null} + * @expose + */ + this.resolvedType = null; + + /** + * Unique message field id. + * @type {number} + * @expose + */ + this.id = id; + + /** + * Message field options. + * @type {!Object.} + * @dict + * @expose + */ + this.options = options || {}; + + /** + * Default value. + * @type {*} + * @expose + */ + this.defaultValue = null; + + /** + * Enclosing OneOf. + * @type {?ProtoBuf.Reflect.Message.OneOf} + * @expose + */ + this.oneof = oneof || null; + + /** + * Syntax level of this definition (e.g., proto3). + * @type {string} + * @expose + */ + this.syntax = syntax || 'proto2'; + + /** + * Original field name. + * @type {string} + * @expose + */ + this.originalName = this.name; // Used to revert camelcase transformation on naming collisions + + /** + * Element implementation. Created in build() after types are resolved. + * @type {ProtoBuf.Element} + * @expose + */ + this.element = null; + + /** + * Key element implementation, for map fields. Created in build() after + * types are resolved. + * @type {ProtoBuf.Element} + * @expose + */ + this.keyElement = null; + + // Convert field names to camel case notation if the override is set + if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField)) + this.name = ProtoBuf.Util.toCamelCase(this.name); +}; + +/** + * @alias ProtoBuf.Reflect.Message.Field.prototype + * @inner + */ +var FieldPrototype = Field.prototype = Object.create(T.prototype); + +/** + * Builds the field. + * @override + * @expose + */ +FieldPrototype.build = function() { + this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name); + if (this.map) + this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name); + + // In proto3, fields do not have field presence, and every field is set to + // its type's default value ("", 0, 0.0, or false). + if (this.syntax === 'proto3' && !this.repeated && !this.map) + this.defaultValue = Element.defaultFieldValue(this.type); + + // Otherwise, default values are present when explicitly specified + else if (typeof this.options['default'] !== 'undefined') + this.defaultValue = this.verifyValue(this.options['default']); +}; + +/** + * Checks if the given value can be set for this field. + * @param {*} value Value to check + * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false. + * @return {*} Verified, maybe adjusted, value + * @throws {Error} If the value cannot be set for this field + * @expose + */ +FieldPrototype.verifyValue = function(value, skipRepeated) { + skipRepeated = skipRepeated || false; + var self = this; + function fail(val, msg) { + throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")"); + } + if (value === null) { // NULL values for optional fields + if (this.required) + fail(typeof value, "required"); + if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"]) + fail(typeof value, "proto3 field without field presence cannot be null"); + return null; + } + var i; + if (this.repeated && !skipRepeated) { // Repeated values as arrays + if (!Array.isArray(value)) + value = [value]; + var res = []; + for (i=0; i 0; + + case ProtoBuf.TYPES["bytes"]: + return value.remaining() > 0; + + case ProtoBuf.TYPES["enum"]: + return value !== 0; + + case ProtoBuf.TYPES["message"]: + return value !== null; + default: + return true; + } +}; + +/** + * Encodes the specified field value to the specified buffer. + * @param {*} value Verified field value + * @param {ByteBuffer} buffer ByteBuffer to encode to + * @param {!ProtoBuf.Builder.Message} message Runtime message + * @return {ByteBuffer} The ByteBuffer for chaining + * @throws {Error} If the field cannot be encoded + * @expose + */ +FieldPrototype.encode = function(value, buffer, message) { + if (this.type === null || typeof this.type !== 'object') + throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type); + if (value === null || (this.repeated && value.length == 0)) + return buffer; // Optional omitted + try { + if (this.repeated) { + var i; + // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire + // types) can be declared 'packed'." + if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) { + // "All of the elements of the field are packed into a single key-value pair with wire type 2 + // (length-delimited). Each element is encoded the same way it would be normally, except without a + // tag preceding it." + buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM); + buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1 + var start = buffer.offset; // Remember where the contents begin + for (i=0; i 1) { // We need to move the contents + var contents = buffer.slice(start, buffer.offset); + start += varintLen-1; + buffer.offset = start; + buffer.append(contents); + } + buffer.writeVarint32(len, start-varintLen); + } else { + // "If your message definition has repeated elements (without the [packed=true] option), the encoded + // message has zero or more key-value pairs with the same tag number" + for (i=0; i= 0) { + n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM); + ni = 0; + for (i=0; i= 0) { + if (!skipRepeated) { + nBytes = buffer.readVarint32(); + nBytes = buffer.offset + nBytes; // Limit + var values = []; + while (buffer.offset < nBytes) + values.push(this.decode(this.type.wireType, buffer, true)); + return values; + } + // Read the next value otherwise... + } + + // Handle maps. + if (this.map) { + // Read one (key, value) submessage, and return [key, value] + var key = Element.defaultFieldValue(this.keyType); + value = Element.defaultFieldValue(this.type); + + // Read the length + nBytes = buffer.readVarint32(); + if (buffer.remaining() < nBytes) + throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining()); + + // Get a sub-buffer of this key/value submessage + var msgbuf = buffer.clone(); + msgbuf.limit = msgbuf.offset + nBytes; + buffer.offset += nBytes; + + while (msgbuf.remaining() > 0) { + var tag = msgbuf.readVarint32(); + wireType = tag & 0x07; + var id = tag >>> 3; + if (id === 1) { + key = this.keyElement.decode(msgbuf, wireType, id); + } else if (id === 2) { + value = this.element.decode(msgbuf, wireType, id); + } else { + throw Error("Unexpected tag in map field key/value submessage"); + } + } + + return [key, value]; + } + + // Handle singular and non-packed repeated field values. + return this.element.decode(buffer, wireType, this.id); +}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/OneOf.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/OneOf.js new file mode 100644 index 0000000..07a896f --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Message/OneOf.js @@ -0,0 +1,19 @@ +/** + * Constructs a new Message OneOf. + * @exports ProtoBuf.Reflect.Message.OneOf + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.Message} message Message reference + * @param {string} name OneOf name + * @constructor + * @extends ProtoBuf.Reflect.T + */ +var OneOf = function(builder, message, name) { + T.call(this, builder, message, name); + + /** + * Enclosed fields. + * @type {!Array.} + * @expose + */ + this.fields = []; +}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Namespace.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Namespace.js new file mode 100644 index 0000000..b5c96c9 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Namespace.js @@ -0,0 +1,203 @@ +/** + * Constructs a new Namespace. + * @exports ProtoBuf.Reflect.Namespace + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent + * @param {string} name Namespace name + * @param {Object.=} options Namespace options + * @param {string?} syntax The syntax level of this definition (e.g., proto3) + * @constructor + * @extends ProtoBuf.Reflect.T + */ +var Namespace = function(builder, parent, name, options, syntax) { + T.call(this, builder, parent, name); + + /** + * @override + */ + this.className = "Namespace"; + + /** + * Children inside the namespace. + * @type {!Array.} + */ + this.children = []; + + /** + * Options. + * @type {!Object.} + */ + this.options = options || {}; + + /** + * Syntax level (e.g., proto2 or proto3). + * @type {!string} + */ + this.syntax = syntax || "proto2"; +}; + +/** + * @alias ProtoBuf.Reflect.Namespace.prototype + * @inner + */ +var NamespacePrototype = Namespace.prototype = Object.create(T.prototype); + +/** + * Returns an array of the namespace's children. + * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children). + * @return {Array.} + * @expose + */ +NamespacePrototype.getChildren = function(type) { + type = type || null; + if (type == null) + return this.children.slice(); + var children = []; + for (var i=0, k=this.children.length; i} qn Qualified name to resolve + * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false` + * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found + * @expose + */ +NamespacePrototype.resolve = function(qn, excludeNonNamespace) { + var part = typeof qn === 'string' ? qn.split(".") : qn, + ptr = this, + i = 0; + if (part[i] === "") { // Fully qualified name, e.g. ".My.Message' + while (ptr.parent !== null) + ptr = ptr.parent; + i++; + } + var child; + do { + do { + if (!(ptr instanceof Reflect.Namespace)) { + ptr = null; + break; + } + child = ptr.getChild(part[i]); + if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) { + ptr = null; + break; + } + ptr = child; i++; + } while (i < part.length); + if (ptr != null) + break; // Found + // Else search the parent + if (this.parent !== null) + return this.parent.resolve(qn, excludeNonNamespace); + } while (ptr != null); + return ptr; +}; + +/** + * Determines the shortest qualified name of the specified type, if any, relative to this namespace. + * @param {!ProtoBuf.Reflect.T} t Reflection type + * @returns {string} The shortest qualified name or, if there is none, the fqn + * @expose + */ +NamespacePrototype.qn = function(t) { + var part = [], ptr = t; + do { + part.unshift(ptr.name); + ptr = ptr.parent; + } while (ptr !== null); + for (var len=1; len <= part.length; len++) { + var qn = part.slice(part.length-len); + if (t === this.resolve(qn, t instanceof Reflect.Namespace)) + return qn.join("."); + } + return t.fqn(); +}; + +/** + * Builds the namespace and returns the runtime counterpart. + * @return {Object.} Runtime namespace + * @expose + */ +NamespacePrototype.build = function() { + /** @dict */ + var ns = {}; + var children = this.children; + for (var i=0, k=children.length, child; i} + */ +NamespacePrototype.buildOpt = function() { + var opt = {}, + keys = Object.keys(this.options); + for (var i=0, k=keys.length; i}null} Option value or NULL if there is no such option + */ +NamespacePrototype.getOption = function(name) { + if (typeof name === 'undefined') + return this.options; + return typeof this.options[name] !== 'undefined' ? this.options[name] : null; +}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Service.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Service.js new file mode 100644 index 0000000..025df11 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Service.js @@ -0,0 +1,52 @@ +/** + * Constructs a new Service. + * @exports ProtoBuf.Reflect.Service + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.Namespace} root Root + * @param {string} name Service name + * @param {Object.=} options Options + * @constructor + * @extends ProtoBuf.Reflect.Namespace + */ +var Service = function(builder, root, name, options) { + Namespace.call(this, builder, root, name, options); + + /** + * @override + */ + this.className = "Service"; + + /** + * Built runtime service class. + * @type {?function(new:ProtoBuf.Builder.Service)} + */ + this.clazz = null; +}; + +/** + * @alias ProtoBuf.Reflect.Service.prototype + * @inner + */ +var ServicePrototype = Service.prototype = Object.create(Namespace.prototype); + +/** + * Builds the service and returns the runtime counterpart, which is a fully functional class. + * @see ProtoBuf.Builder.Service + * @param {boolean=} rebuild Whether to rebuild or not + * @return {Function} Service class + * @throws {Error} If the message cannot be built + * @expose + */ +ServicePrototype.build = function(rebuild) { + if (this.clazz && !rebuild) + return this.clazz; + + // Create the runtime Service class in its own scope + return this.clazz = (function(ProtoBuf, T) { + + //? include("../Builder/Service.js"); + + return Service; + + })(ProtoBuf, this); +}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/Method.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/Method.js new file mode 100644 index 0000000..9d56ef6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/Method.js @@ -0,0 +1,39 @@ +/** + * Abstract service method. + * @exports ProtoBuf.Reflect.Service.Method + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.Service} svc Service + * @param {string} name Method name + * @param {Object.=} options Options + * @constructor + * @extends ProtoBuf.Reflect.T + */ +var Method = function(builder, svc, name, options) { + T.call(this, builder, svc, name); + + /** + * @override + */ + this.className = "Service.Method"; + + /** + * Options. + * @type {Object.} + * @expose + */ + this.options = options || {}; +}; + +/** + * @alias ProtoBuf.Reflect.Service.Method.prototype + * @inner + */ +var MethodPrototype = Method.prototype = Object.create(T.prototype); + +/** + * Builds the method's '$options' property. + * @name ProtoBuf.Reflect.Service.Method#buildOpt + * @function + * @return {Object.} + */ +MethodPrototype.buildOpt = NamespacePrototype.buildOpt; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/RPCMethod.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/RPCMethod.js new file mode 100644 index 0000000..3c12b02 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/Service/RPCMethod.js @@ -0,0 +1,67 @@ +/** + * RPC service method. + * @exports ProtoBuf.Reflect.Service.RPCMethod + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {!ProtoBuf.Reflect.Service} svc Service + * @param {string} name Method name + * @param {string} request Request message name + * @param {string} response Response message name + * @param {boolean} request_stream Whether requests are streamed + * @param {boolean} response_stream Whether responses are streamed + * @param {Object.=} options Options + * @constructor + * @extends ProtoBuf.Reflect.Service.Method + */ +var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) { + Method.call(this, builder, svc, name, options); + + /** + * @override + */ + this.className = "Service.RPCMethod"; + + /** + * Request message name. + * @type {string} + * @expose + */ + this.requestName = request; + + /** + * Response message name. + * @type {string} + * @expose + */ + this.responseName = response; + + /** + * Whether requests are streamed + * @type {bool} + * @expose + */ + this.requestStream = request_stream; + + /** + * Whether responses are streamed + * @type {bool} + * @expose + */ + this.responseStream = response_stream; + + /** + * Resolved request message type. + * @type {ProtoBuf.Reflect.Message} + * @expose + */ + this.resolvedRequestType = null; + + /** + * Resolved response message type. + * @type {ProtoBuf.Reflect.Message} + * @expose + */ + this.resolvedResponseType = null; +}; + +// Extends Method +RPCMethod.prototype = Object.create(Method.prototype); diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/T.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/T.js new file mode 100644 index 0000000..12d2b13 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/T.js @@ -0,0 +1,81 @@ +/** + * Constructs a Reflect base class. + * @exports ProtoBuf.Reflect.T + * @constructor + * @abstract + * @param {!ProtoBuf.Builder} builder Builder reference + * @param {?ProtoBuf.Reflect.T} parent Parent object + * @param {string} name Object name + */ +var T = function(builder, parent, name) { + + /** + * Builder reference. + * @type {!ProtoBuf.Builder} + * @expose + */ + this.builder = builder; + + /** + * Parent object. + * @type {?ProtoBuf.Reflect.T} + * @expose + */ + this.parent = parent; + + /** + * Object name in namespace. + * @type {string} + * @expose + */ + this.name = name; + + /** + * Fully qualified class name + * @type {string} + * @expose + */ + this.className; +}; + +/** + * @alias ProtoBuf.Reflect.T.prototype + * @inner + */ +var TPrototype = T.prototype; + +/** + * Returns the fully qualified name of this object. + * @returns {string} Fully qualified name as of ".PATH.TO.THIS" + * @expose + */ +TPrototype.fqn = function() { + var name = this.name, + ptr = this; + do { + ptr = ptr.parent; + if (ptr == null) + break; + name = ptr.name+"."+name; + } while (true); + return name; +}; + +/** + * Returns a string representation of this Reflect object (its fully qualified name). + * @param {boolean=} includeClass Set to true to include the class name. Defaults to false. + * @return String representation + * @expose + */ +TPrototype.toString = function(includeClass) { + return (includeClass ? this.className + " " : "") + this.fqn(); +}; + +/** + * Builds this type. + * @throws {Error} If this type cannot be built directly + * @expose + */ +TPrototype.build = function() { + throw Error(this.toString(true)+" cannot be built directly"); +}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Util.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Util.js new file mode 100644 index 0000000..d8dc06e --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Util.js @@ -0,0 +1,116 @@ +/** + * @alias ProtoBuf.Util + * @expose + */ +ProtoBuf.Util = (function() { + "use strict"; + + /** + * ProtoBuf utilities. + * @exports ProtoBuf.Util + * @namespace + */ + var Util = {}; + + /** + * Flag if running in node or not. + * @type {boolean} + * @const + * @expose + */ + Util.IS_NODE = !!( + typeof process === 'object' && process+'' === '[object process]' && !process['browser'] + ); + + /** + * Constructs a XMLHttpRequest object. + * @return {XMLHttpRequest} + * @throws {Error} If XMLHttpRequest is not supported + * @expose + */ + Util.XHR = function() { + // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html + var XMLHttpFactories = [ + function () {return new XMLHttpRequest()}, + function () {return new ActiveXObject("Msxml2.XMLHTTP")}, + function () {return new ActiveXObject("Msxml3.XMLHTTP")}, + function () {return new ActiveXObject("Microsoft.XMLHTTP")} + ]; + /** @type {?XMLHttpRequest} */ + var xhr = null; + for (var i=0;i 1) + throw Error('illegal number of arguments'); + function F() {} + F.prototype = o; + return new F(); + }; + +// ref: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray +if (!Array.isArray) + /** @expose */ + Array.isArray = function(o) { + return Object.prototype.toString.call(o) === "[object Array]"; + }; + +// ref: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach +if (!Array.prototype.forEach) + /** @expose */ + Array.prototype.forEach = function(callback, thisArg) { + var T, k; + if (this == null) + throw new TypeError('this is null or not defined'); + var O = Object(this); + var len = O.length >>> 0; + if (typeof callback !== "function") + throw new TypeError(callback + ' is not a function'); + if (arguments.length > 1) + T = thisArg; + k = 0; + while (k < len) { + var kValue; + if (k in O) + kValue = O[k], + callback.call(T, kValue, k, O); + k++; + } + }; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/google/protobuf/README.md b/legacy-libs/grpc/node_modules/protobufjs/src/google/protobuf/README.md new file mode 100644 index 0000000..9f0c426 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/google/protobuf/README.md @@ -0,0 +1,13 @@ +These files are by default not used by ProtoBuf.js and are here for the purpose of completeness. The library does not +need and therefore does not use these files by design. In most use cases including the descriptor isn't even required +and would just add about 10KB (minified JSON) to your application. + +### Though it's possible to include them: + +1. You may explicitly reference them by providing a relative or absolute path in your .proto files. E.g. use + `./google/protobuf/descriptor.proto` and bundle the file with your application. + +2. If you use the `proto2js` command line utility with the `-legacy` option and the descriptor namespace is explicitly + referenced, it is included in the generated output. + +You are then able to work with it as if it'd be no more and no less than a standard import. diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/google/protobuf/descriptor.json b/legacy-libs/grpc/node_modules/protobufjs/src/google/protobuf/descriptor.json new file mode 100644 index 0000000..2cb3cc1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/google/protobuf/descriptor.json @@ -0,0 +1,849 @@ +{ + "package": "google.protobuf", + "syntax": "proto2", + "options": { + "java_package": "com.google.protobuf", + "java_outer_classname": "DescriptorProtos", + "optimize_for": "SPEED" + }, + "messages": [ + { + "name": "FileDescriptorSet", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "FileDescriptorProto", + "name": "file", + "id": 1 + } + ] + }, + { + "name": "FileDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "type": "string", + "name": "package", + "id": 2 + }, + { + "rule": "repeated", + "type": "string", + "name": "dependency", + "id": 3 + }, + { + "rule": "repeated", + "type": "int32", + "name": "public_dependency", + "id": 10 + }, + { + "rule": "repeated", + "type": "int32", + "name": "weak_dependency", + "id": 11 + }, + { + "rule": "repeated", + "type": "DescriptorProto", + "name": "message_type", + "id": 4 + }, + { + "rule": "repeated", + "type": "EnumDescriptorProto", + "name": "enum_type", + "id": 5 + }, + { + "rule": "repeated", + "type": "ServiceDescriptorProto", + "name": "service", + "id": 6 + }, + { + "rule": "repeated", + "type": "FieldDescriptorProto", + "name": "extension", + "id": 7 + }, + { + "rule": "optional", + "type": "FileOptions", + "name": "options", + "id": 8 + }, + { + "rule": "optional", + "type": "SourceCodeInfo", + "name": "source_code_info", + "id": 9 + } + ] + }, + { + "name": "DescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "repeated", + "type": "FieldDescriptorProto", + "name": "field", + "id": 2 + }, + { + "rule": "repeated", + "type": "FieldDescriptorProto", + "name": "extension", + "id": 6 + }, + { + "rule": "repeated", + "type": "DescriptorProto", + "name": "nested_type", + "id": 3 + }, + { + "rule": "repeated", + "type": "EnumDescriptorProto", + "name": "enum_type", + "id": 4 + }, + { + "rule": "repeated", + "type": "ExtensionRange", + "name": "extension_range", + "id": 5 + }, + { + "rule": "optional", + "type": "MessageOptions", + "name": "options", + "id": 7 + } + ], + "messages": [ + { + "name": "ExtensionRange", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "int32", + "name": "start", + "id": 1 + }, + { + "rule": "optional", + "type": "int32", + "name": "end", + "id": 2 + } + ] + } + ] + }, + { + "name": "FieldDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "type": "int32", + "name": "number", + "id": 3 + }, + { + "rule": "optional", + "type": "Label", + "name": "label", + "id": 4 + }, + { + "rule": "optional", + "type": "Type", + "name": "type", + "id": 5 + }, + { + "rule": "optional", + "type": "string", + "name": "type_name", + "id": 6 + }, + { + "rule": "optional", + "type": "string", + "name": "extendee", + "id": 2 + }, + { + "rule": "optional", + "type": "string", + "name": "default_value", + "id": 7 + }, + { + "rule": "optional", + "type": "FieldOptions", + "name": "options", + "id": 8 + } + ], + "enums": [ + { + "name": "Type", + "syntax": "proto2", + "values": [ + { + "name": "TYPE_DOUBLE", + "id": 1 + }, + { + "name": "TYPE_FLOAT", + "id": 2 + }, + { + "name": "TYPE_INT64", + "id": 3 + }, + { + "name": "TYPE_UINT64", + "id": 4 + }, + { + "name": "TYPE_INT32", + "id": 5 + }, + { + "name": "TYPE_FIXED64", + "id": 6 + }, + { + "name": "TYPE_FIXED32", + "id": 7 + }, + { + "name": "TYPE_BOOL", + "id": 8 + }, + { + "name": "TYPE_STRING", + "id": 9 + }, + { + "name": "TYPE_GROUP", + "id": 10 + }, + { + "name": "TYPE_MESSAGE", + "id": 11 + }, + { + "name": "TYPE_BYTES", + "id": 12 + }, + { + "name": "TYPE_UINT32", + "id": 13 + }, + { + "name": "TYPE_ENUM", + "id": 14 + }, + { + "name": "TYPE_SFIXED32", + "id": 15 + }, + { + "name": "TYPE_SFIXED64", + "id": 16 + }, + { + "name": "TYPE_SINT32", + "id": 17 + }, + { + "name": "TYPE_SINT64", + "id": 18 + } + ] + }, + { + "name": "Label", + "syntax": "proto2", + "values": [ + { + "name": "LABEL_OPTIONAL", + "id": 1 + }, + { + "name": "LABEL_REQUIRED", + "id": 2 + }, + { + "name": "LABEL_REPEATED", + "id": 3 + } + ] + } + ] + }, + { + "name": "EnumDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "repeated", + "type": "EnumValueDescriptorProto", + "name": "value", + "id": 2 + }, + { + "rule": "optional", + "type": "EnumOptions", + "name": "options", + "id": 3 + } + ] + }, + { + "name": "EnumValueDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "type": "int32", + "name": "number", + "id": 2 + }, + { + "rule": "optional", + "type": "EnumValueOptions", + "name": "options", + "id": 3 + } + ] + }, + { + "name": "ServiceDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "repeated", + "type": "MethodDescriptorProto", + "name": "method", + "id": 2 + }, + { + "rule": "optional", + "type": "ServiceOptions", + "name": "options", + "id": 3 + } + ] + }, + { + "name": "MethodDescriptorProto", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "type": "string", + "name": "input_type", + "id": 2 + }, + { + "rule": "optional", + "type": "string", + "name": "output_type", + "id": 3 + }, + { + "rule": "optional", + "type": "MethodOptions", + "name": "options", + "id": 4 + } + ] + }, + { + "name": "FileOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "java_package", + "id": 1 + }, + { + "rule": "optional", + "type": "string", + "name": "java_outer_classname", + "id": 8 + }, + { + "rule": "optional", + "type": "bool", + "name": "java_multiple_files", + "id": 10, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "bool", + "name": "java_generate_equals_and_hash", + "id": 20, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "OptimizeMode", + "name": "optimize_for", + "id": 9, + "options": { + "default": "SPEED" + } + }, + { + "rule": "optional", + "type": "string", + "name": "go_package", + "id": 11 + }, + { + "rule": "optional", + "type": "bool", + "name": "cc_generic_services", + "id": 16, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "bool", + "name": "java_generic_services", + "id": 17, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "bool", + "name": "py_generic_services", + "id": 18, + "options": { + "default": false + } + }, + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "enums": [ + { + "name": "OptimizeMode", + "syntax": "proto2", + "values": [ + { + "name": "SPEED", + "id": 1 + }, + { + "name": "CODE_SIZE", + "id": 2 + }, + { + "name": "LITE_RUNTIME", + "id": 3 + } + ] + } + ] + }, + { + "name": "MessageOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "bool", + "name": "message_set_wire_format", + "id": 1, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "bool", + "name": "no_standard_descriptor_accessor", + "id": 2, + "options": { + "default": false + } + }, + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + { + "name": "FieldOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "CType", + "name": "ctype", + "id": 1, + "options": { + "default": "STRING" + } + }, + { + "rule": "optional", + "type": "bool", + "name": "packed", + "id": 2 + }, + { + "rule": "optional", + "type": "bool", + "name": "lazy", + "id": 5, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "bool", + "name": "deprecated", + "id": 3, + "options": { + "default": false + } + }, + { + "rule": "optional", + "type": "string", + "name": "experimental_map_key", + "id": 9 + }, + { + "rule": "optional", + "type": "bool", + "name": "weak", + "id": 10, + "options": { + "default": false + } + }, + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "enums": [ + { + "name": "CType", + "syntax": "proto2", + "values": [ + { + "name": "STRING", + "id": 0 + }, + { + "name": "CORD", + "id": 1 + }, + { + "name": "STRING_PIECE", + "id": 2 + } + ] + } + ] + }, + { + "name": "EnumOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "bool", + "name": "allow_alias", + "id": 2, + "options": { + "default": true + } + }, + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + { + "name": "EnumValueOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + { + "name": "ServiceOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + { + "name": "MethodOptions", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "UninterpretedOption", + "name": "uninterpreted_option", + "id": 999 + } + ], + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + { + "name": "UninterpretedOption", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "NamePart", + "name": "name", + "id": 2 + }, + { + "rule": "optional", + "type": "string", + "name": "identifier_value", + "id": 3 + }, + { + "rule": "optional", + "type": "uint64", + "name": "positive_int_value", + "id": 4 + }, + { + "rule": "optional", + "type": "int64", + "name": "negative_int_value", + "id": 5 + }, + { + "rule": "optional", + "type": "double", + "name": "double_value", + "id": 6 + }, + { + "rule": "optional", + "type": "bytes", + "name": "string_value", + "id": 7 + }, + { + "rule": "optional", + "type": "string", + "name": "aggregate_value", + "id": 8 + } + ], + "messages": [ + { + "name": "NamePart", + "syntax": "proto2", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "name_part", + "id": 1 + }, + { + "rule": "required", + "type": "bool", + "name": "is_extension", + "id": 2 + } + ] + } + ] + }, + { + "name": "SourceCodeInfo", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "Location", + "name": "location", + "id": 1 + } + ], + "messages": [ + { + "name": "Location", + "syntax": "proto2", + "fields": [ + { + "rule": "repeated", + "type": "int32", + "name": "path", + "id": 1, + "options": { + "packed": true + } + }, + { + "rule": "repeated", + "type": "int32", + "name": "span", + "id": 2, + "options": { + "packed": true + } + }, + { + "rule": "optional", + "type": "string", + "name": "leading_comments", + "id": 3 + }, + { + "rule": "optional", + "type": "string", + "name": "trailing_comments", + "id": 4 + } + ] + } + ] + } + ], + "isNamespace": true +} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/google/protobuf/descriptor.proto b/legacy-libs/grpc/node_modules/protobufjs/src/google/protobuf/descriptor.proto new file mode 100644 index 0000000..83fe2e1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/google/protobuf/descriptor.proto @@ -0,0 +1,620 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + + + +package google.protobuf; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field whithout harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; + optional int32 end = 2; + } + repeated ExtensionRange extension_range = 5; + + optional MessageOptions options = 7; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + TYPE_GROUP = 10; // Tag-delimited aggregate. + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + }; + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + // TODO(sanjay): Should we add LABEL_MAP? + }; + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be either TYPE_ENUM or TYPE_MESSAGE. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + optional string default_value = 7; + + optional FieldOptions options = 8; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; +} + + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Object-C plugin) and your porject website (if available) -- there's no need +// to explain how you intend to use them. Usually you only need one extension +// number. You can declare multiple options with only one extension number by +// putting them in a sub-message. See the Custom Options section of the docs +// for examples: +// http://code.google.com/apis/protocolbuffers/docs/proto.html#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default=false]; + + // If set true, then the Java code generator will generate equals() and + // hashCode() methods for all messages defined in the .proto file. This is + // purely a speed optimization, as the AbstractMessage base class includes + // reflection-based implementations of these methods. + optional bool java_generate_equals_and_hash = 20 [default=false]; + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default=SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. There is no default. + optional string go_package = 11; + + + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of proto2. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default=false]; + optional bool java_generic_services = 17 [default=false]; + optional bool py_generic_services = 18 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default=false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. + optional bool packed = 2; + + + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outher message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default=false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default=false]; + + // EXPERIMENTAL. DO NOT USE. + // For "map" fields, the name of the field in the enclosed type that + // is the key for this map. For example, suppose we have: + // message Item { + // required string name = 1; + // required string value = 2; + // } + // message Config { + // repeated Item items = 1 [experimental_map_key="name"]; + // } + // In this situation, the map key for Item will be set to "name". + // TODO: Fully-implement this, then remove the "experimental_" prefix. + optional string experimental_map_key = 9; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // Set this option to false to disallow mapping different tag names to a same + // value. + optional bool allow_alias = 2 [default=true]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + 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; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed=true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed=true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + optional string leading_comments = 3; + optional string trailing_comments = 4; + } +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/protobuf.js b/legacy-libs/grpc/node_modules/protobufjs/src/protobuf.js new file mode 100644 index 0000000..6efc681 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/protobuf.js @@ -0,0 +1,421 @@ +/** + * The ProtoBuf namespace. + * @exports ProtoBuf + * @namespace + * @expose + */ +var ProtoBuf = {}; + +/** + * @type {!function(new: ByteBuffer, ...[*])} + * @expose + */ +ProtoBuf.ByteBuffer = ByteBuffer; + +/** + * @type {?function(new: Long, ...[*])} + * @expose + */ +ProtoBuf.Long = ByteBuffer.Long || null; + +/** + * ProtoBuf.js version. + * @type {string} + * @const + * @expose + */ +ProtoBuf.VERSION = "/*?= VERSION */"; + +/** + * Wire types. + * @type {Object.} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES = {}; + +/** + * Varint wire type. + * @type {number} + * @expose + */ +ProtoBuf.WIRE_TYPES.VARINT = 0; + +/** + * Fixed 64 bits wire type. + * @type {number} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES.BITS64 = 1; + +/** + * Length delimited wire type. + * @type {number} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES.LDELIM = 2; + +/** + * Start group wire type. + * @type {number} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES.STARTGROUP = 3; + +/** + * End group wire type. + * @type {number} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES.ENDGROUP = 4; + +/** + * Fixed 32 bits wire type. + * @type {number} + * @const + * @expose + */ +ProtoBuf.WIRE_TYPES.BITS32 = 5; + +/** + * Packable wire types. + * @type {!Array.} + * @const + * @expose + */ +ProtoBuf.PACKABLE_WIRE_TYPES = [ + ProtoBuf.WIRE_TYPES.VARINT, + ProtoBuf.WIRE_TYPES.BITS64, + ProtoBuf.WIRE_TYPES.BITS32 +]; + +/** + * Types. + * @dict + * @type {!Object.} + * @const + * @expose + */ +ProtoBuf.TYPES = { + // According to the protobuf spec. + "int32": { + name: "int32", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: 0 + }, + "uint32": { + name: "uint32", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: 0 + }, + "sint32": { + name: "sint32", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: 0 + }, + "int64": { + name: "int64", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined + }, + "uint64": { + name: "uint64", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined + }, + "sint64": { + name: "sint64", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined + }, + "bool": { + name: "bool", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: false + }, + "double": { + name: "double", + wireType: ProtoBuf.WIRE_TYPES.BITS64, + defaultValue: 0 + }, + "string": { + name: "string", + wireType: ProtoBuf.WIRE_TYPES.LDELIM, + defaultValue: "" + }, + "bytes": { + name: "bytes", + wireType: ProtoBuf.WIRE_TYPES.LDELIM, + defaultValue: null // overridden in the code, must be a unique instance + }, + "fixed32": { + name: "fixed32", + wireType: ProtoBuf.WIRE_TYPES.BITS32, + defaultValue: 0 + }, + "sfixed32": { + name: "sfixed32", + wireType: ProtoBuf.WIRE_TYPES.BITS32, + defaultValue: 0 + }, + "fixed64": { + name: "fixed64", + wireType: ProtoBuf.WIRE_TYPES.BITS64, + defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined + }, + "sfixed64": { + name: "sfixed64", + wireType: ProtoBuf.WIRE_TYPES.BITS64, + defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined + }, + "float": { + name: "float", + wireType: ProtoBuf.WIRE_TYPES.BITS32, + defaultValue: 0 + }, + "enum": { + name: "enum", + wireType: ProtoBuf.WIRE_TYPES.VARINT, + defaultValue: 0 + }, + "message": { + name: "message", + wireType: ProtoBuf.WIRE_TYPES.LDELIM, + defaultValue: null + }, + "group": { + name: "group", + wireType: ProtoBuf.WIRE_TYPES.STARTGROUP, + defaultValue: null + } +}; + +/** + * Valid map key types. + * @type {!Array.>} + * @const + * @expose + */ +ProtoBuf.MAP_KEY_TYPES = [ + ProtoBuf.TYPES["int32"], + ProtoBuf.TYPES["sint32"], + ProtoBuf.TYPES["sfixed32"], + ProtoBuf.TYPES["uint32"], + ProtoBuf.TYPES["fixed32"], + ProtoBuf.TYPES["int64"], + ProtoBuf.TYPES["sint64"], + ProtoBuf.TYPES["sfixed64"], + ProtoBuf.TYPES["uint64"], + ProtoBuf.TYPES["fixed64"], + ProtoBuf.TYPES["bool"], + ProtoBuf.TYPES["string"], + ProtoBuf.TYPES["bytes"] +]; + +/** + * Minimum field id. + * @type {number} + * @const + * @expose + */ +ProtoBuf.ID_MIN = 1; + +/** + * Maximum field id. + * @type {number} + * @const + * @expose + */ +ProtoBuf.ID_MAX = 0x1FFFFFFF; + +/** + * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`. + * Must be set prior to parsing. + * @type {boolean} + * @expose + */ +ProtoBuf.convertFieldsToCamelCase = false; + +/** + * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by + * setting this to `false` prior to building messages. + * @type {boolean} + * @expose + */ +ProtoBuf.populateAccessors = true; + +/** + * By default, messages are populated with default values if a field is not present on the wire. To disable + * this behavior, set this setting to `false`. + * @type {boolean} + * @expose + */ +ProtoBuf.populateDefaults = true; + +//? include("ProtoBuf/Util.js"); + +//? include("ProtoBuf/Lang.js"); + +//? if (DOTPROTO) include("ProtoBuf/DotProto.js"); + +//? include("ProtoBuf/Reflect.js"); + +//? include("ProtoBuf/Builder.js"); + +//? include("ProtoBuf/Map.js"); + +//? if (DOTPROTO) { + +/** + * Loads a .proto string and returns the Builder. + * @param {string} proto .proto file contents + * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted. + * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports. + * @return {ProtoBuf.Builder} Builder to create new messages + * @throws {Error} If the definition cannot be parsed or built + * @expose + */ +ProtoBuf.loadProto = function(proto, builder, filename) { + if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string')) + filename = builder, + builder = undefined; + return ProtoBuf.loadJson(ProtoBuf.DotProto.Parser.parse(proto), builder, filename); +}; + +/** + * Loads a .proto string and returns the Builder. This is an alias of {@link ProtoBuf.loadProto}. + * @function + * @param {string} proto .proto file contents + * @param {(ProtoBuf.Builder|string)=} builder Builder to append to. Will create a new one if omitted. + * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports. + * @return {ProtoBuf.Builder} Builder to create new messages + * @throws {Error} If the definition cannot be parsed or built + * @expose + */ +ProtoBuf.protoFromString = ProtoBuf.loadProto; // Legacy + +/** + * Loads a .proto file and returns the Builder. + * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with + * an overridden 'root' path for all imported files. + * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and + * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + * file will be read synchronously and this function will return the Builder. + * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted. + * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the + * request has failed), else undefined + * @expose + */ +ProtoBuf.loadProtoFile = function(filename, callback, builder) { + if (callback && typeof callback === 'object') + builder = callback, + callback = null; + else if (!callback || typeof callback !== 'function') + callback = null; + if (callback) + return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) { + if (contents === null) { + callback(Error("Failed to fetch file")); + return; + } + try { + callback(null, ProtoBuf.loadProto(contents, builder, filename)); + } catch (e) { + callback(e); + } + }); + var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename); + return contents === null ? null : ProtoBuf.loadProto(contents, builder, filename); +}; + +/** + * Loads a .proto file and returns the Builder. This is an alias of {@link ProtoBuf.loadProtoFile}. + * @function + * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with + * an overridden 'root' path for all imported files. + * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and + * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + * file will be read synchronously and this function will return the Builder. + * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted. + * @return {!ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the + * request has failed), else undefined + * @expose + */ +ProtoBuf.protoFromFile = ProtoBuf.loadProtoFile; // Legacy + +//? } // DOTPROTO + +/** + * Constructs a new empty Builder. + * @param {Object.=} options Builder options, defaults to global options set on ProtoBuf + * @return {!ProtoBuf.Builder} Builder + * @expose + */ +ProtoBuf.newBuilder = function(options) { + options = options || {}; + if (typeof options['convertFieldsToCamelCase'] === 'undefined') + options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase; + if (typeof options['populateAccessors'] === 'undefined') + options['populateAccessors'] = ProtoBuf.populateAccessors; + return new ProtoBuf.Builder(options); +}; + +/** + * Loads a .json definition and returns the Builder. + * @param {!*|string} json JSON definition + * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted. + * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports. + * @return {ProtoBuf.Builder} Builder to create new messages + * @throws {Error} If the definition cannot be parsed or built + * @expose + */ +ProtoBuf.loadJson = function(json, builder, filename) { + if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string')) + filename = builder, + builder = null; + if (!builder || typeof builder !== 'object') + builder = ProtoBuf.newBuilder(); + if (typeof json === 'string') + json = JSON.parse(json); + builder["import"](json, filename); + builder.resolveAll(); + return builder; +}; + +/** + * Loads a .json file and returns the Builder. + * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with + * an overridden 'root' path for all imported files. + * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and + * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the + * file will be read synchronously and this function will return the Builder. + * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted. + * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the + * request has failed), else undefined + * @expose + */ +ProtoBuf.loadJsonFile = function(filename, callback, builder) { + if (callback && typeof callback === 'object') + builder = callback, + callback = null; + else if (!callback || typeof callback !== 'function') + callback = null; + if (callback) + return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) { + if (contents === null) { + callback(Error("Failed to fetch file")); + return; + } + try { + callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename)); + } catch (e) { + callback(e); + } + }); + var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename); + return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename); +}; diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/wrap.js b/legacy-libs/grpc/node_modules/protobufjs/src/wrap.js new file mode 100644 index 0000000..3fabafd --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/src/wrap.js @@ -0,0 +1,37 @@ +/* + Copyright 2013 Daniel Wirtz + + 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. + */ + +/** + * @license protobuf.js (c) 2013 Daniel Wirtz + * Released under the Apache License, Version 2.0 + * see: https://github.com/dcodeIO/protobuf.js for details + */ +(function(global, factory) { + + /* AMD */ if (typeof define === 'function' && define["amd"]) + define(["bytebuffer"], factory); + /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"]) + module["exports"] = factory(require("bytebuffer"), true); + /* Global */ else + (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]); + +})(this, function(ByteBuffer, isCommonJS) { + "use strict"; + + //? include("protobuf.js"); + + return ProtoBuf; +}); diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/PingExample.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/PingExample.proto new file mode 100644 index 0000000..013c362 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/PingExample.proto @@ -0,0 +1,12 @@ +message Message { + optional Ping ping = 1; + optional Pong pong = 2; + + message Ping { + required uint32 time = 1; + } + + message Pong { + required uint32 time = 1; + } +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/T139.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/T139.proto new file mode 100644 index 0000000..d0c0599 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/T139.proto @@ -0,0 +1,4 @@ +message T139 { + required int32 a = 1; + required uint32 b = 2; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/T263.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/T263.proto new file mode 100644 index 0000000..db0c4eb --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/T263.proto @@ -0,0 +1,13 @@ +package services; + +message resume { + message Resume { + repeated string experience = 1; + } +} + +message profile { + message Profile { + optional services.resume.Resume resume = 1; + } +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/annotations.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/annotations.proto new file mode 100644 index 0000000..d7d2896 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/annotations.proto @@ -0,0 +1,29 @@ +// Copyright (c) 2015, Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +// import "google/api/http.proto"; +// import "google/protobuf/descriptor.proto"; + +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.api"; + +extend google.protobuf.MethodOptions { + // See `HttpRule`. + HttpRule http = 72295728; +} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/bench.js b/legacy-libs/grpc/node_modules/protobufjs/tests/bench.js new file mode 100644 index 0000000..7f3c0cd --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/bench.js @@ -0,0 +1,48 @@ +var ProtoBuf = require("../index.js"); + +var sample = { + id: 1, + name: "John123", + password: "helloworld" +}; + +console.log("Sample: `"+JSON.stringify(sample, null, 4)); +console.log("\n"); + +var proto = " message Sample {" + + "required uint32 id = 1;" + + "required string name = 2;" + + "required string password = 3;" + + "}"; + +var builder = ProtoBuf.loadProto(proto, "bench.proto"), + Sample = builder.build("Sample"); + +// Compare size +console.log("Encoding size"); +console.log("-------------"); +var jsonData = new Buffer(JSON.stringify(sample), "utf8"), + protoData = new Sample(sample).toBuffer(); +console.log("* Encoded sample size as JSON: "+jsonData.length+" bytes"); +console.log("* Encoded sample size as protocol buffer: "+protoData.length+" bytes"); +console.log(""); + +// Compare encoding speed +console.log("Encoding speed"); +console.log("--------------"); +(function() { + // Assuming that a receive buffer is used + var buf = ProtoBuf.ByteBuffer.allocate(64); + var protoSample = new Sample(sample), + n = 100000, k = (n/1000)+'k'; + console.time("* ProtoBuf encode "+k); + for (var i=0; i native string.js:36 + 15 1.0% 1.0% LazyCompile: *module.exports.ByteBuffer.readVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1932 + 11 0.7% 0.7% Stub: InstanceofStub + 11 0.7% 0.7% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 11 0.7% 0.7% KeyedLoadIC: A keyed load IC from the snapshot + 10 0.6% 0.6% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 9 0.6% 0.6% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 9 0.6% 0.6% LazyCompile: *module.exports.ByteBuffer.flip x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2252 + 8 0.5% 0.5% LazyCompile: ~NativeModule.compile node.js:892 + 7 0.5% 0.5% Stub: KeyedLoadElementStub + 6 0.4% 0.4% Stub: CompareICStub {2} + 6 0.4% 0.4% LazyCompile: *module.exports.ByteBuffer.LE x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2299 + 6 0.4% 0.4% LazyCompile: *isFinite native v8natives.js:103 + 5 0.3% 0.3% Stub: ToBooleanStub_UndefinedSpecObject + 5 0.3% 0.3% LazyCompile: ~Module._compile module.js:374 + 5 0.3% 0.3% Builtin: A builtin from the snapshot {3} + 4 0.3% 0.3% Stub: ToBooleanStub + 4 0.3% 0.3% Stub: KeyedLoadElementStub {1} + 4 0.3% 0.3% LazyCompile: *module.exports.ByteBuffer.remaining x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2397 + 3 0.2% 0.2% KeyedStoreIC: A keyed store IC from the snapshot + 2 0.1% 0.1% Stub: BinaryOpStub_SHR_Alloc_SMI + 2 0.1% 0.1% Stub: BinaryOpStub_SHL_Alloc_SMI + 2 0.1% 0.1% LazyCompile: ~ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 2 0.1% 0.1% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 2 0.1% 0.1% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferAB.js:23 + 2 0.1% 0.1% Function: ~ x:\public\ProtoBuf\dist\ProtoBuf.js:22 + 2 0.1% 0.1% Function: ~ net.js:1 + 1 0.1% 0.1% Stub: ToBooleanStub {1} + 1 0.1% 0.1% Stub: CompareICStub {1} + 1 0.1% 0.1% Stub: CallConstructStub + 1 0.1% 0.1% Stub: BinaryOpStub_MUL_Alloc_SMI + 1 0.1% 0.1% Stub: BinaryOpStub_BIT_OR_OverwriteLeft_SMI + 1 0.1% 0.1% LazyCompile: ~tryFile module.js:138 + 1 0.1% 0.1% LazyCompile: ~nextTick node.js:334 + 1 0.1% 0.1% LazyCompile: ~module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 1 0.1% 0.1% LazyCompile: ~join native array.js:410 + 1 0.1% 0.1% LazyCompile: ~fs.statSync fs.js:687 + 1 0.1% 0.1% LazyCompile: ~fs.openSync fs.js:429 + 1 0.1% 0.1% LazyCompile: ~fs.fstatSync fs.js:678 + 1 0.1% 0.1% LazyCompile: ~filter native array.js:1036 + 1 0.1% 0.1% LazyCompile: ~exec native regexp.js:168 + 1 0.1% 0.1% LazyCompile: ~createWriteReq net.js:658 + 1 0.1% 0.1% LazyCompile: ~createWritableStdioStream node.js:550 + 1 0.1% 0.1% LazyCompile: ~bind native v8natives.js:1578 + 1 0.1% 0.1% LazyCompile: ~StringSplitOnRegExp native string.js:591 + 1 0.1% 0.1% LazyCompile: ~ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 1 0.1% 0.1% LazyCompile: ~ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 1 0.1% 0.1% LazyCompile: ~ProtoBuf.Reflect.Field x:\public\ProtoBuf\dist\ProtoBuf.js:2401 + 1 0.1% 0.1% LazyCompile: ~ProtoBuf.DotProto.Parser._parseId x:\public\ProtoBuf\dist\ProtoBuf.js:724 + 1 0.1% 0.1% LazyCompile: ~Message x:\public\ProtoBuf\dist\ProtoBuf.js:1629 + 1 0.1% 0.1% LazyCompile: ~Buffer.write buffer.js:315 + 1 0.1% 0.1% LazyCompile: ~Buffer buffer.js:156 + 1 0.1% 0.1% LazyCompile: statPath module.js:88 + 1 0.1% 0.1% KeyedLoadIC: args_count: 0 + 1 0.1% 0.1% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 1 0.1% 0.1% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\node_modules\long\dist\Long.js:23 + 1 0.1% 0.1% Function: ~ fs.js:1 + 1 0.1% 0.1% Builtin: A builtin from the snapshot {2} + 1 0.1% 0.1% Builtin: A builtin from the snapshot {1} + + [C++]: + ticks total nonlib name + + [GC]: + ticks total nonlib name + 2 0.1% + + [Bottom up (heavy) profile]: + Note: percentage shows a share of a particular caller in the total + amount of its parent calls. + Callers occupying less than 2.0% are not shown. + + ticks parent name + 248 16.1% LazyCompile: *Buffer.write buffer.js:315 + 247 99.6% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 247 100.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 247 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 247 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 247 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + + 190 12.3% LazyCompile: *Message x:\public\ProtoBuf\dist\ProtoBuf.js:1629 + 190 100.0% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 190 100.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 182 95.8% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 182 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 182 100.0% LazyCompile: ~Module._compile module.js:374 + 8 4.2% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 8 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 8 100.0% LazyCompile: ~Module._compile module.js:374 + + 189 12.2% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 189 100.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 183 96.8% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 183 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 183 100.0% LazyCompile: ~Module._compile module.js:374 + 183 100.0% LazyCompile: ~Module._extensions..js module.js:472 + 6 3.2% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 6 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 6 100.0% LazyCompile: ~Module._compile module.js:374 + 6 100.0% LazyCompile: ~Module._extensions..js module.js:472 + + 188 12.2% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 188 100.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 188 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 187 99.5% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 187 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 178 95.2% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 9 4.8% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + + 142 9.2% LazyCompile: *Buffer.toString buffer.js:392 + 142 100.0% LazyCompile: *module.exports.ByteBuffer.readVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1932 + 141 99.3% LazyCompile: ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 141 100.0% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 141 100.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 132 93.6% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 9 6.4% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + + 84 5.4% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 82 97.6% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 82 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 82 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 79 96.3% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 79 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 3 3.7% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 3 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 2 2.4% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 2 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 2 100.0% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 2 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 2 100.0% LazyCompile: ~Module._compile module.js:374 + + 62 4.0% LazyCompile: *toLowerCase native string.js:739 + 36 58.1% LazyCompile: *Buffer.write buffer.js:315 + 36 100.0% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 36 100.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 36 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 36 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 23 37.1% LazyCompile: *Buffer.toString buffer.js:392 + 23 100.0% LazyCompile: *module.exports.ByteBuffer.readVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1932 + 23 100.0% LazyCompile: ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 23 100.0% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 23 100.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 2 3.2% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 2 100.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 2 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 2 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 2 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + + 47 3.0% LazyCompile: ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 46 97.9% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 46 100.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 44 95.7% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 44 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 44 100.0% LazyCompile: ~Module._compile module.js:374 + 2 4.3% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 2 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 2 100.0% LazyCompile: ~Module._compile module.js:374 + + 38 2.5% LazyCompile: *module.exports.ByteBuffer.writeVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1193 + 26 68.4% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 26 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 26 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 26 100.0% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 26 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 6 15.8% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 6 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 6 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 6 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 6 100.0% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 6 15.8% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 6 100.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 6 100.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 6 100.0% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 6 100.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + + 36 2.3% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 35 97.2% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 32 91.4% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 32 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 32 100.0% LazyCompile: ~Module._compile module.js:374 + 32 100.0% LazyCompile: ~Module._extensions..js module.js:472 + 3 8.6% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 3 100.0% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 3 100.0% LazyCompile: ~Module._compile module.js:374 + 3 100.0% LazyCompile: ~Module._extensions..js module.js:472 + + + [Top down (heavy) profile]: + Note: callees occupying less than 0.1% are not shown. + + inclusive self name + ticks total ticks total + 1533 99.3% 0 0.0% Function: ~ node.js:27 + 1533 99.3% 0 0.0% LazyCompile: ~startup node.js:30 + 1527 98.9% 0 0.0% LazyCompile: ~Module.runMain module.js:495 + 1527 98.9% 0 0.0% LazyCompile: Module._load module.js:275 + 1524 98.7% 0 0.0% LazyCompile: ~Module.load module.js:346 + 1523 98.6% 0 0.0% LazyCompile: ~Module._extensions..js module.js:472 + 1523 98.6% 0 0.0% LazyCompile: ~Module._compile module.js:374 + 1523 98.6% 1 0.1% Function: ~ x:\public\ProtoBuf\tests\bench.js:1 + 1413 91.5% 11 0.7% LazyCompile: * x:\public\ProtoBuf\tests\bench.js:33 + 701 45.4% 9 0.6% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 681 44.1% 32 2.1% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 631 40.9% 22 1.4% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 576 37.3% 79 5.1% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 473 30.6% 178 11.5% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 286 18.5% 236 15.3% LazyCompile: *Buffer.write buffer.js:315 + 37 2.4% 35 2.3% LazyCompile: *toLowerCase native string.js:739 + 2 0.1% 2 0.1% Stub: CEntryStub + 5 0.3% 5 0.3% LazyCompile: *isFinite native v8natives.js:103 + 3 0.2% 3 0.2% Stub: CompareICStub {2} + 3 0.2% 2 0.1% LazyCompile: native string.js:36 + 6 0.4% 6 0.4% LazyCompile: *module.exports.ByteBuffer.writeVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1193 + 2 0.1% 2 0.1% LazyCompile: *toLowerCase native string.js:739 + 13 0.8% 13 0.8% Stub: CompareICStub + 6 0.4% 6 0.4% LazyCompile: *module.exports.ByteBuffer.writeVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1193 + 4 0.3% 4 0.3% Builtin: A builtin from the snapshot + 26 1.7% 26 1.7% LazyCompile: *module.exports.ByteBuffer.writeVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1193 + 3 0.2% 3 0.2% Builtin: A builtin from the snapshot + 2 0.1% 2 0.1% Stub: BinaryOpStub_SHL_Alloc_SMI + 8 0.5% 8 0.5% Stub: InstanceofStub + 6 0.4% 6 0.4% KeyedLoadIC: A keyed load IC from the snapshot + 2 0.1% 2 0.1% Stub: CEntryStub + 2 0.1% 2 0.1% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 5 0.3% 5 0.3% Stub: ToBooleanStub_UndefinedSpecObject + 3 0.2% 3 0.2% LazyCompile: *module.exports.ByteBuffer.LE x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2299 + 2 0.1% 2 0.1% Stub: ToBooleanStub + 697 45.1% 10 0.6% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 679 44.0% 183 11.9% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 257 16.6% 44 2.8% LazyCompile: ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 199 12.9% 15 1.0% LazyCompile: *module.exports.ByteBuffer.readVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1932 + 173 11.2% 132 8.5% LazyCompile: *Buffer.toString buffer.js:392 + 23 1.5% 21 1.4% LazyCompile: *toLowerCase native string.js:739 + 2 0.1% 2 0.1% Stub: CEntryStub + 13 0.8% 13 0.8% LazyCompile: native string.js:36 + 3 0.2% 3 0.2% Stub: CompareICStub {2} + 10 0.6% 10 0.6% LazyCompile: *module.exports.ByteBuffer.readVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1272 + 9 0.6% 9 0.6% Stub: CompareICStub + 3 0.2% 3 0.2% Builtin: A builtin from the snapshot + 183 11.9% 182 11.8% LazyCompile: *Message x:\public\ProtoBuf\dist\ProtoBuf.js:1629 + 14 0.9% 14 0.9% LazyCompile: *module.exports.ByteBuffer.readVarint32 x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1272 + 8 0.5% 8 0.5% Builtin: A builtin from the snapshot + 7 0.5% 7 0.5% Stub: KeyedLoadElementStub + 5 0.3% 5 0.3% Builtin: A builtin from the snapshot {3} + 4 0.3% 4 0.3% Stub: KeyedLoadElementStub {1} + 4 0.3% 4 0.3% Stub: CEntryStub + 4 0.3% 4 0.3% LazyCompile: *module.exports.ByteBuffer.remaining x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2397 + 4 0.3% 4 0.3% KeyedLoadIC: A keyed load IC from the snapshot + 2 0.1% 2 0.1% KeyedStoreIC: A keyed store IC from the snapshot + 3 0.2% 3 0.2% Stub: InstanceofStub + 3 0.2% 3 0.2% Builtin: A builtin from the snapshot + 2 0.1% 2 0.1% LazyCompile: *module.exports.ByteBuffer.LE x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2299 + 3 0.2% 3 0.2% LazyCompile: *module.exports.ByteBuffer.flip x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2252 + 77 5.0% 2 0.1% Function: ~ x:\public\ProtoBuf\tests\bench.js:33 + 37 2.4% 0 0.0% LazyCompile: Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:1870 + 32 2.1% 3 0.2% LazyCompile: *ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 29 1.9% 4 0.3% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 25 1.6% 3 0.2% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 21 1.4% 9 0.6% LazyCompile: *module.exports.ByteBuffer.writeVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1893 + 12 0.8% 11 0.7% LazyCompile: *Buffer.write buffer.js:315 + 5 0.3% 1 0.1% LazyCompile: ~ProtoBuf.Reflect.Message.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2233 + 4 0.3% 0 0.0% LazyCompile: ProtoBuf.Reflect.Field.encode x:\public\ProtoBuf\dist\ProtoBuf.js:2651 + 2 0.1% 0 0.0% LazyCompile: ProtoBuf.Reflect.Field.encodeValue x:\public\ProtoBuf\dist\ProtoBuf.js:2703 + 37 2.4% 0 0.0% LazyCompile: Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2083 + 34 2.2% 6 0.4% LazyCompile: ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 16 1.0% 2 0.1% LazyCompile: ProtoBuf.Reflect.Field.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2919 + 12 0.8% 0 0.0% LazyCompile: *module.exports.ByteBuffer.readVString x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1932 + 12 0.8% 9 0.6% LazyCompile: *Buffer.toString buffer.js:392 + 3 0.2% 2 0.1% LazyCompile: *toLowerCase native string.js:739 + 9 0.6% 8 0.5% LazyCompile: *Message x:\public\ProtoBuf\dist\ProtoBuf.js:1629 + 2 0.1% 1 0.1% LazyCompile: ~ProtoBuf.Reflect.Message.decode x:\public\ProtoBuf\dist\ProtoBuf.js:2325 + 17 1.1% 0 0.0% LazyCompile: ~require module.js:379 + 17 1.1% 0 0.0% LazyCompile: ~Module.require module.js:361 + 17 1.1% 0 0.0% LazyCompile: Module._load module.js:275 + 17 1.1% 0 0.0% LazyCompile: ~Module.load module.js:346 + 17 1.1% 0 0.0% LazyCompile: ~Module._extensions..js module.js:472 + 17 1.1% 0 0.0% LazyCompile: ~Module._compile module.js:374 + 17 1.1% 0 0.0% Function: ~ x:\public\ProtoBuf\index.js:1 + 17 1.1% 0 0.0% LazyCompile: ~require module.js:379 + 17 1.1% 0 0.0% LazyCompile: ~Module.require module.js:361 + 17 1.1% 0 0.0% LazyCompile: Module._load module.js:275 + 17 1.1% 0 0.0% LazyCompile: ~Module.load module.js:346 + 17 1.1% 0 0.0% LazyCompile: ~Module._extensions..js module.js:472 + 16 1.0% 2 0.1% LazyCompile: ~Module._compile module.js:374 + 14 0.9% 0 0.0% Function: ~ x:\public\ProtoBuf\dist\ProtoBuf.js:1 + 14 0.9% 2 0.1% Function: ~ x:\public\ProtoBuf\dist\ProtoBuf.js:22 + 12 0.8% 0 0.0% LazyCompile: ~require module.js:379 + 12 0.8% 0 0.0% LazyCompile: ~Module.require module.js:361 + 12 0.8% 0 0.0% LazyCompile: Module._load module.js:275 + 11 0.7% 0 0.0% LazyCompile: ~Module.load module.js:346 + 11 0.7% 0 0.0% LazyCompile: ~Module._extensions..js module.js:472 + 11 0.7% 0 0.0% LazyCompile: ~Module._compile module.js:374 + 11 0.7% 0 0.0% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\index.js:1 + 11 0.7% 0 0.0% LazyCompile: ~require module.js:379 + 11 0.7% 0 0.0% LazyCompile: ~Module.require module.js:361 + 11 0.7% 0 0.0% LazyCompile: Module._load module.js:275 + 10 0.6% 0 0.0% LazyCompile: ~Module.load module.js:346 + 10 0.6% 0 0.0% LazyCompile: ~Module._extensions..js module.js:472 + 9 0.6% 3 0.2% LazyCompile: ~Module._compile module.js:374 + 4 0.3% 0 0.0% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:1 + 4 0.3% 0 0.0% Function: x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:23 + 4 0.3% 0 0.0% LazyCompile: ~require module.js:379 + 4 0.3% 0 0.0% LazyCompile: ~Module.require module.js:361 + 4 0.3% 0 0.0% LazyCompile: Module._load module.js:275 + 3 0.2% 0 0.0% LazyCompile: ~Module._resolveFilename module.js:323 + 3 0.2% 0 0.0% LazyCompile: ~Module._findPath module.js:160 + 2 0.1% 0 0.0% LazyCompile: ~tryExtensions module.js:148 + 2 0.1% 0 0.0% LazyCompile: ~tryFile module.js:138 + 2 0.1% 1 0.1% LazyCompile: statPath module.js:88 + 2 0.1% 0 0.0% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferAB.js:1 + 2 0.1% 2 0.1% Function: ~ x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferAB.js:23 + 6 0.4% 0 0.0% LazyCompile: ~ node.js:204 + 6 0.4% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 6 0.4% 1 0.1% LazyCompile: ~NativeModule.compile node.js:892 + 5 0.3% 0 0.0% Function: ~ console.js:1 + 4 0.3% 0 0.0% LazyCompile: ~ node.js:615 + 4 0.3% 1 0.1% LazyCompile: ~createWritableStdioStream node.js:550 + 3 0.2% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 3 0.2% 0 0.0% LazyCompile: ~NativeModule.compile node.js:892 + 3 0.2% 0 0.0% Function: ~ tty.js:1 + 3 0.2% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 3 0.2% 1 0.1% LazyCompile: ~NativeModule.compile node.js:892 + 2 0.1% 2 0.1% Function: ~ net.js:1 + 2 0.1% 0 0.0% LazyCompile: ~b native v8natives.js:1582 + 2 0.1% 0 0.0% LazyCompile: ~Console.log console.js:52 + 2 0.1% 0 0.0% LazyCompile: ~Socket.write net.js:612 + 2 0.1% 0 0.0% LazyCompile: ~Writable.write _stream_writable.js:162 + 2 0.1% 0 0.0% LazyCompile: ~writeOrBuffer _stream_writable.js:199 + 2 0.1% 0 0.0% LazyCompile: ~doWrite _stream_writable.js:220 + 2 0.1% 0 0.0% LazyCompile: ~Socket._write net.js:619 + 2 0.1% 0 0.0% LazyCompile: ~ProtoBuf.loadProto x:\public\ProtoBuf\dist\ProtoBuf.js:3983 + 2 0.1% 2 0.1% LazyCompile: *module.exports.ByteBuffer.flip x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2252 + 2 0.1% 2 0.1% Builtin: A builtin from the snapshot + 3 0.2% 0 0.0% LazyCompile: ~Module._resolveFilename module.js:323 + 3 0.2% 0 0.0% LazyCompile: ~Module._findPath module.js:160 + 3 0.2% 0 0.0% LazyCompile: ~tryFile module.js:138 + 3 0.2% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 3 0.2% 1 0.1% LazyCompile: ~NativeModule.compile node.js:892 + 2 0.1% 1 0.1% Function: ~ fs.js:1 + 3 0.2% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 3 0.2% 2 0.1% LazyCompile: ~NativeModule.compile node.js:892 + 2 0.1% 0 0.0% LazyCompile: ~startup.globalVariables node.js:160 + 2 0.1% 0 0.0% LazyCompile: ~NativeModule.require node.js:847 + 2 0.1% 1 0.1% LazyCompile: ~NativeModule.compile node.js:892 + + 3 0.2% 3 0.2% LazyCompile: *module.exports.ByteBuffer.flip x:\public\ProtoBuf\node_modules\bytebuffer\dist\ByteBufferNB.js:2252 + diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/camelcase.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/camelcase.proto new file mode 100644 index 0000000..03de070 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/camelcase.proto @@ -0,0 +1,14 @@ +message Test { + + // Case 1: Revert 1st + required int32 some_field = 1; // -> someField, reverted + required int32 someField = 2; // kept + + // Case 2: Revert 2nd + required int32 aField = 3; // kept + required int32 a_field = 4; // -> aField, reverted + + // No revert + required int32 its_a_field = 5; // -> itsAField + +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/comments.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/comments.proto new file mode 100644 index 0000000..9f808f7 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/comments.proto @@ -0,0 +1,10 @@ +// single line comment + +/** + * Naranjas. + */ +message TestC { // one more + required /***** uncommon block ****/int32 a = 1; // another more +} + +// the end. \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/complex.json b/legacy-libs/grpc/node_modules/protobufjs/tests/complex.json new file mode 100644 index 0000000..534f1ba --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/complex.json @@ -0,0 +1,114 @@ +{ + "package": "Game.Cars", + "syntax": "proto2", + "messages": [ + { + "name": "Car", + "syntax": "proto2", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "model", + "id": 1 + }, + { + "rule": "required", + "type": "Vendor", + "name": "vendor", + "id": 2 + }, + { + "rule": "optional", + "type": "Speed", + "name": "speed", + "id": 3, + "options": { + "default": "FAST" + } + } + ], + "messages": [ + { + "name": "Vendor", + "syntax": "proto2", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "type": "Address", + "name": "address", + "id": 2 + }, + { + "rule": "repeated", + "type": "string", + "name": "models", + "id": 3 + } + ], + "messages": [ + { + "name": "Address", + "syntax": "proto2", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "country", + "id": 1 + } + ] + } + ] + }, + { + "name": "Holder", + "syntax": "proto2", + "fields": [ + { + "rule": "optional", + "type": "string", + "name": "first_name", + "id": 1 + }, + { + "rule": "required", + "type": "string", + "name": "last_name", + "id": 2 + }, + { + "rule": "optional", + "type": "Vendor.Address", + "name": "address", + "id": 3 + } + ] + } + ], + "enums": [ + { + "name": "Speed", + "syntax": "proto2", + "values": [ + { + "name": "FAST", + "id": 1 + }, + { + "name": "SUPERFAST", + "id": 2 + } + ] + } + ] + } + ], + "isNamespace": true +} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/complex.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/complex.proto new file mode 100644 index 0000000..4e55c59 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/complex.proto @@ -0,0 +1,35 @@ +package Game.Cars; + +// Car +message Car { + + // Car Vendor + message Vendor { + required string name = 1; + + // Car Vendor Address + message Address { + required string country = 1; + } + + optional Address address = 2; + repeated string models = 3; // The models sold here. + } + + required string model = 1; // Model name + required Vendor vendor = 2; // Vendor information + optional Speed speed = 3 [default=FAST]; // Car speed + + // Car speed enum + enum Speed { + FAST = 1; + SUPERFAST = 2; + } + + // Car Holder + message Holder { + optional string first_name = 1; + required string last_name = 2; + optional Vendor.Address address = 3; + } +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/custom-options.json b/legacy-libs/grpc/node_modules/protobufjs/tests/custom-options.json new file mode 100644 index 0000000..d60c0ba --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/custom-options.json @@ -0,0 +1,169 @@ +{ + "package": null, + "messages": [ + { + "ref": "google.protobuf.FileOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "my_file_option", + "id": 50000 + } + ] + }, + { + "ref": "google.protobuf.MessageOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "int32", + "name": "my_message_option", + "id": 50001 + } + ] + }, + { + "ref": "google.protobuf.FieldOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "float", + "name": "my_field_option", + "id": 50002 + } + ] + }, + { + "ref": "google.protobuf.EnumOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "my_enum_option", + "id": 50003 + } + ] + }, + { + "ref": "google.protobuf.EnumValueOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "my_enum_value_option", + "id": 50004 + } + ] + }, + { + "ref": "google.protobuf.ServiceOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "MyEnum", + "name": "my_service_option", + "id": 50005 + } + ] + }, + { + "ref": "google.protobuf.MethodOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "MyMessage", + "name": "my_method_option", + "id": 50006 + } + ] + }, + { + "name": "MyMessage", + "fields": [ + { + "rule": "optional", + "options": { + "(my_field_option)": 4.5 + }, + "type": "int32", + "name": "foo", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "bar", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": { + "(my_message_option)": 1234 + } + }, + { + "name": "RequestType", + "fields": [], + "enums": [], + "messages": [], + "options": {} + }, + { + "name": "ResponseType", + "fields": [], + "enums": [], + "messages": [], + "options": {} + } + ], + "enums": [ + { + "name": "MyEnum", + "values": [ + { + "name": "FOO", + "id": 1 + }, + { + "name": "BAR", + "id": 2 + } + ], + "options": { + "(my_enum_option)": true + } + } + ], + "imports": [], + "options": { + "(my_file_option)": "Hello world!" + }, + "services": [ + { + "name": "MyService", + "rpc": { + "MyMethod": { + "request": "RequestType", + "response": "ResponseType", + "options": { + "(my_method_option).foo": 567, + "(my_method_option).bar": "Some string" + } + } + }, + "options": { + "(my_service_option)": "FOO" + } + } + ] +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/custom-options.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/custom-options.proto new file mode 100644 index 0000000..01f9773 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/custom-options.proto @@ -0,0 +1,53 @@ +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FileOptions { + optional string my_file_option = 50000; +} +extend google.protobuf.MessageOptions { + optional int32 my_message_option = 50001; +} +extend google.protobuf.FieldOptions { + optional float my_field_option = 50002; +} +extend google.protobuf.EnumOptions { + optional bool my_enum_option = 50003; +} +extend google.protobuf.EnumValueOptions { + optional uint32 my_enum_value_option = 50004; +} +extend google.protobuf.ServiceOptions { + optional MyEnum my_service_option = 50005; +} +extend google.protobuf.MethodOptions { + optional MyMessage my_method_option = 50006; +} + +option (my_file_option) = "Hello world!"; + +message MyMessage { + option (my_message_option) = 1234; + + optional int32 foo = 1 [(my_field_option) = 4.5]; + optional string bar = 2; +} + +enum MyEnum { + option (my_enum_option) = true; + + FOO = 1 [(my_enum_value_option) = 321]; + BAR = 2; +} + +message RequestType {} +message ResponseType {} + +service MyService { + option (my_service_option) = FOO; + + rpc MyMethod(RequestType) returns(ResponseType) { + // Note: my_method_option has type MyMessage. We can set each field + // within it using a separate "option" line. + option (my_method_option).foo = 567; + option (my_method_option).bar = "Some string"; + } +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/common.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/common.proto new file mode 100644 index 0000000..7845c1d --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/common.proto @@ -0,0 +1,5 @@ +package main; + +message Common { + optional string commonField = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/dep1.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/dep1.proto new file mode 100644 index 0000000..897916f --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/dep1.proto @@ -0,0 +1,7 @@ +package main; + +import "common.proto"; + +message Dep1 { + optional main.Common test1 = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/dep2.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/dep2.proto new file mode 100644 index 0000000..5f6ff6b --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/dep2.proto @@ -0,0 +1,8 @@ +package main; + +import "dep1.proto"; + +message Dep2 { + optional main.Dep1 test1 = 1; + optional main.Common test2 = 2; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/main.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/main.proto new file mode 100644 index 0000000..fc2c7b5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/dupimport/main.proto @@ -0,0 +1,11 @@ +package main; + +import "dep1.proto"; +import "dep2.proto"; +import "common.proto"; + +message MainMessage { + optional main.Dep1 test1 = 1; + optional main.Dep2 test2 = 2; + optional main.Common test3 = 3; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/example1.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/example1.proto new file mode 100644 index 0000000..dd3c96e --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/example1.proto @@ -0,0 +1,5 @@ +message Test1 { + required int32 a = 1; +} + +// Test1 should encode to "08 96 01" with Test1#a=150 diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/example1u.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/example1u.proto new file mode 100644 index 0000000..2b91e8b --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/example1u.proto @@ -0,0 +1,3 @@ +message Test1u { + required uint32 a = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/example2.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/example2.proto new file mode 100644 index 0000000..e00c4d2 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/example2.proto @@ -0,0 +1,5 @@ +message Test2 { + required string b = 2; +} + +// Test2 should encode to "12 07 74 65 73 74 69 6e 67" with Test2#b="testing" diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/example3.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/example3.proto new file mode 100644 index 0000000..2ec5a97 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/example3.proto @@ -0,0 +1,9 @@ +message Test1 { + required int32 a = 1; +} + +message Test3 { + required Test1 c = 3; +} + +// Test3 should encode to "1a 03 08 96 01" with Test1#a=150 diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/example4.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/example4.proto new file mode 100644 index 0000000..455ae94 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/example4.proto @@ -0,0 +1,5 @@ +message Test4 { + repeated int32 d = 4 [packed=true]; +} + +// Test4 should encode to "<22 06 03 8E 02 9E A7 05>" with d=[3, 270, 86942] diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/example5.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/example5.proto new file mode 100644 index 0000000..22a8156 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/example5.proto @@ -0,0 +1,29 @@ +package Datastore; + +message LookupRequest { + repeated string key = 1; +} + +message LookupResponse { + repeated string results = 1; +} + +message RunQueryRequest { + required string query = 1; +} + +message RunQueryResponse { + repeated string results = 1; +} + +service LookupService { + // Look up some entities by key. + rpc Lookup(LookupRequest) returns (LookupResponse) { + } +} + +service RunQueryService { + // Query for entities. + rpc RunQuery(RunQueryRequest) returns (RunQueryResponse) { + }; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/extend.json b/legacy-libs/grpc/node_modules/protobufjs/tests/extend.json new file mode 100644 index 0000000..5027fd5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/extend.json @@ -0,0 +1,71 @@ +{ + "package": null, + "messages": [ + { + "ref": "google.protobuf.MessageOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "int32", + "name": "foo", + "id": 1001 + } + ] + }, + { + "name": "Foo", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "extensions": [ + 2, + 536870911 + ] + }, + { + "ref": "Foo", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "bar", + "id": 2 + } + ] + }, + { + "name": "Bar", + "fields": [], + "enums": [], + "messages": [ + { + "name": "Foo", + "fields": [], + "enums": [], + "messages": [], + "options": {} + }, + { + "ref": "Foo", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "Foo", + "name": "foo", + "id": 3 + } + ] + } + ], + "options": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/extend.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/extend.proto new file mode 100644 index 0000000..20ea830 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/extend.proto @@ -0,0 +1,23 @@ +import "google/protobuf/descriptor.proto"; // Ignored +// import "./google/protobuf/descriptor.proto"; // Not ignored + +extend google.protobuf.MessageOptions { + optional int32 foo = 1001; +} + +message Foo { + extensions 2 to max; +} + +extend Foo { + optional string bar = 2; +} + +message Bar { + message Foo { + } + + extend .Foo { + optional Foo foo = 3; // references Bar.Foo + } +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/field_name_same_as_package/main.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/field_name_same_as_package/main.proto new file mode 100644 index 0000000..6be8ba4 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/field_name_same_as_package/main.proto @@ -0,0 +1,7 @@ +package main; + +import "sub.proto"; + +message MainMessage { + optional main.sub.Sub sub = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/field_name_same_as_package/sub.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/field_name_same_as_package/sub.proto new file mode 100644 index 0000000..1c7ba4f --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/field_name_same_as_package/sub.proto @@ -0,0 +1,5 @@ +package main.sub; + +message Sub { + optional string test1 = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/google/protobuf/descriptor.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/google/protobuf/descriptor.proto new file mode 100644 index 0000000..83fe2e1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/google/protobuf/descriptor.proto @@ -0,0 +1,620 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + + + +package google.protobuf; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field whithout harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; + optional int32 end = 2; + } + repeated ExtensionRange extension_range = 5; + + optional MessageOptions options = 7; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + TYPE_GROUP = 10; // Tag-delimited aggregate. + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + }; + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + // TODO(sanjay): Should we add LABEL_MAP? + }; + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be either TYPE_ENUM or TYPE_MESSAGE. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + optional string default_value = 7; + + optional FieldOptions options = 8; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; +} + + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Object-C plugin) and your porject website (if available) -- there's no need +// to explain how you intend to use them. Usually you only need one extension +// number. You can declare multiple options with only one extension number by +// putting them in a sub-message. See the Custom Options section of the docs +// for examples: +// http://code.google.com/apis/protocolbuffers/docs/proto.html#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default=false]; + + // If set true, then the Java code generator will generate equals() and + // hashCode() methods for all messages defined in the .proto file. This is + // purely a speed optimization, as the AbstractMessage base class includes + // reflection-based implementations of these methods. + optional bool java_generate_equals_and_hash = 20 [default=false]; + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default=SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. There is no default. + optional string go_package = 11; + + + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of proto2. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default=false]; + optional bool java_generic_services = 17 [default=false]; + optional bool py_generic_services = 18 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default=false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. + optional bool packed = 2; + + + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outher message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default=false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default=false]; + + // EXPERIMENTAL. DO NOT USE. + // For "map" fields, the name of the field in the enclosed type that + // is the key for this map. For example, suppose we have: + // message Item { + // required string name = 1; + // required string value = 2; + // } + // message Config { + // repeated Item items = 1 [experimental_map_key="name"]; + // } + // In this situation, the map key for Item will be set to "name". + // TODO: Fully-implement this, then remove the "experimental_" prefix. + optional string experimental_map_key = 9; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // Set this option to false to disallow mapping different tag names to a same + // value. + optional bool allow_alias = 2 [default=true]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + 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; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed=true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed=true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + optional string leading_comments = 3; + optional string trailing_comments = 4; + } +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/groups.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/groups.proto new file mode 100644 index 0000000..9e96720 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/groups.proto @@ -0,0 +1,13 @@ +message Outer { + required string before = 1; + repeated group MyInner = 2 [deprecated=true] { + required string a = 3; + } + required string after = 4; + optional MyInner myInner2 = 5; +} + +message OuterSparse { + required string before = 1; + required string after = 4; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/importRoot/file1.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/importRoot/file1.proto new file mode 100644 index 0000000..eaf02ee --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/importRoot/file1.proto @@ -0,0 +1 @@ +import "importRoot/file2.proto"; diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/importRoot/file2.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/importRoot/file2.proto new file mode 100644 index 0000000..44c7794 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/importRoot/file2.proto @@ -0,0 +1 @@ +import "importRoot/file3.proto"; diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/importRoot/file3.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/importRoot/file3.proto new file mode 100644 index 0000000..24377d9 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/importRoot/file3.proto @@ -0,0 +1 @@ +message Test {} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/import_a.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/import_a.proto new file mode 100644 index 0000000..f50242f --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/import_a.proto @@ -0,0 +1,5 @@ +import "import_common.proto"; + +message A { + optional Common common = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/import_a_single_quote.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/import_a_single_quote.proto new file mode 100644 index 0000000..6ea6844 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/import_a_single_quote.proto @@ -0,0 +1,5 @@ +import 'import_common.proto'; + +message A { + optional Common common = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/import_b.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/import_b.proto new file mode 100644 index 0000000..4809bfd --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/import_b.proto @@ -0,0 +1,5 @@ +import "import_common.proto"; + +message B { + optional Common common = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/import_common.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/import_common.proto new file mode 100644 index 0000000..ad9bfe7 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/import_common.proto @@ -0,0 +1,2 @@ +message Common { +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/imports-toplevel.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/imports-toplevel.proto new file mode 100644 index 0000000..ebca0ff --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/imports-toplevel.proto @@ -0,0 +1,13 @@ +import "toplevel.proto"; + +package My; + +enum MyEnum1 { + ONE = 1; + TWO = 2; +} + +message Test1 { + required MyEnum num = 1 [default=ONE]; + required MyEnum1 num1 = 2 [default=ONE]; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/imports-weak.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/imports-weak.proto new file mode 100644 index 0000000..a5986f1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/imports-weak.proto @@ -0,0 +1,7 @@ +package My; + +import weak "example1.proto"; + +message Test2 { + required Test1 test1 = 1; +} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/imports.json b/legacy-libs/grpc/node_modules/protobufjs/tests/imports.json new file mode 100644 index 0000000..c92a99c --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/imports.json @@ -0,0 +1,83 @@ +{ + "package": "My", + "messages": [ + { + "name": "Test3", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "Test1", + "name": "test1", + "id": 1 + }, + { + "rule": "required", + "options": {}, + "type": ".Test2", + "name": "test2", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "enums": [], + "imports": [ + { + "package": null, + "messages": [ + { + "name": "Test1", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "int32", + "name": "a", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] + }, + { + "package": null, + "messages": [ + { + "name": "Test2", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "string", + "name": "b", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] + } + ], + "options": {}, + "services": [] +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/imports.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/imports.proto new file mode 100644 index 0000000..e604dac --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/imports.proto @@ -0,0 +1,9 @@ +package My; + +import public "example1.proto"; +import "example2.proto"; + +message Test3 { + required Test1 test1 = 1; + required .Test2 test2 = 2; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/inner.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/inner.proto new file mode 100644 index 0000000..c750f28 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/inner.proto @@ -0,0 +1,10 @@ +message Foo { + required Bar bar = 1; + required Baz baz = 2; +} +message Bar { + required string blah = 1; +} +message Baz { + required string blah = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/negid.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/negid.proto new file mode 100644 index 0000000..9b6a2ec --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/negid.proto @@ -0,0 +1,9 @@ +message Test { + required LobbyType type = 1 [default=INVALID]; + + enum LobbyType { + INVALID = -1; + MATCH = 0; + PRACTICE = 1; + } +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/nodeunit-browser/LICENSE b/legacy-libs/grpc/node_modules/protobufjs/tests/nodeunit-browser/LICENSE new file mode 100644 index 0000000..5dfdc43 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/nodeunit-browser/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2010 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/legacy-libs/grpc/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.css b/legacy-libs/grpc/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.css new file mode 100644 index 0000000..4c3f20c --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.css @@ -0,0 +1,70 @@ +/*! + * Styles taken from qunit.css + */ + +h1#nodeunit-header, h1.nodeunit-header { + padding: 15px; + font-size: large; + background-color: #06b; + color: white; + font-family: 'trebuchet ms', verdana, arial; + margin: 0; +} + +h1#nodeunit-header a { + color: white; +} + +h2#nodeunit-banner { + height: 2em; + border-bottom: 1px solid white; + background-color: #eee; + margin: 0; + font-family: 'trebuchet ms', verdana, arial; +} +h2#nodeunit-banner.pass { + background-color: green; +} +h2#nodeunit-banner.fail { + background-color: red; +} + +h2#nodeunit-userAgent, h2.nodeunit-userAgent { + padding: 10px; + background-color: #eee; + color: black; + margin: 0; + font-size: small; + font-weight: normal; + font-family: 'trebuchet ms', verdana, arial; + font-size: 10pt; +} + +div#nodeunit-testrunner-toolbar { + background: #eee; + border-top: 1px solid black; + padding: 10px; + font-family: 'trebuchet ms', verdana, arial; + margin: 0; + font-size: 10pt; +} + +ol#nodeunit-tests { + font-family: 'trebuchet ms', verdana, arial; + font-size: 10pt; +} +ol#nodeunit-tests li strong { + cursor:pointer; +} +ol#nodeunit-tests .pass { + color: green; +} +ol#nodeunit-tests .fail { + color: red; +} + +p#nodeunit-testresult { + margin-left: 1em; + font-size: 10pt; + font-family: 'trebuchet ms', verdana, arial; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.js b/legacy-libs/grpc/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.js new file mode 100644 index 0000000..2f8f20d --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/nodeunit-browser/nodeunit.js @@ -0,0 +1,2108 @@ +/*! + * Nodeunit + * https://github.com/caolan/nodeunit + * Copyright (c) 2010 Caolan McMahon + * MIT Licensed + * + * json2.js + * http://www.JSON.org/json2.js + * Public Domain. + * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. + */ +nodeunit = (function(){ +/* + http://www.JSON.org/json2.js + 2010-11-17 + + 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, strict: false, regexp: false */ + +/*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 = {}; + +(function () { + "use strict"; + + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + if (typeof Date.prototype.toJSON !== 'function') { + + Date.prototype.toJSON = function (key) { + + return isFinite(this.valueOf()) ? + this.getUTCFullYear() + '-' + + f(this.getUTCMonth() + 1) + '-' + + f(this.getUTCDate()) + 'T' + + f(this.getUTCHours()) + ':' + + f(this.getUTCMinutes()) + ':' + + f(this.getUTCSeconds()) + 'Z' : null; + }; + + String.prototype.toJSON = + Number.prototype.toJSON = + Boolean.prototype.toJSON = function (key) { + return this.valueOf(); + }; + } + + 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]; + +// 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': + 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': + +// 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) { + k = rep[i]; + if (typeof k === 'string') { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + +// Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.hasOwnProperty.call(value, k)) { + 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}); + }; + } + + +// If the JSON object does not yet have a parse method, give it one. + + if (typeof JSON.parse !== 'function') { + JSON.parse = function (text, reviver) { + +// The parse method takes a text and an optional reviver function, and returns +// a JavaScript value if the text is a valid JSON text. + + var j; + + function walk(holder, key) { + +// The walk method is used to recursively walk the resulting structure so +// that modifications can be made. + + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + +// Parsing happens in four stages. In the first stage, we replace certain +// Unicode characters with escape sequences. JavaScript handles many characters +// incorrectly, either silently deleting them, or treating them as line endings. + + text = String(text); + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function (a) { + return '\\u' + + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + +// In the second stage, we run the text against regular expressions that look +// for non-JSON patterns. We are especially concerned with '()' and 'new' +// because they can cause invocation, and '=' because it can cause mutation. +// But just to be safe, we want to reject all unexpected forms. + +// We split the second stage into 4 regexp operations in order to work around +// crippling inefficiencies in IE's and Safari's regexp engines. First we +// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we +// replace all simple value tokens with ']' characters. Third, we delete all +// open brackets that follow a colon or comma or that begin the text. Finally, +// we look to see that the remaining characters are only whitespace or ']' or +// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. + + if (/^[\],:{}\s]*$/ +.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') +.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') +.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + +// In the third stage we use the eval function to compile the text into a +// JavaScript structure. The '{' operator is subject to a syntactic ambiguity +// in JavaScript: it can begin a block or an object literal. We wrap the text +// in parens to eliminate the ambiguity. + + j = eval('(' + text + ')'); + +// In the optional fourth stage, we recursively walk the new structure, passing +// each name/value pair to a reviver function for possible transformation. + + return typeof reviver === 'function' ? + walk({'': j}, '') : j; + } + +// If the text is not JSON parseable, then a SyntaxError is thrown. + + throw new SyntaxError('JSON.parse'); + }; + } +}()); +var assert = this.assert = {}; +var types = {}; +var core = {}; +var nodeunit = {}; +var reporter = {}; +/*global setTimeout: false, console: false */ +(function () { + + var async = {}; + + // global on the server, window in the browser + var root = this, + previous_async = root.async; + + if (typeof module !== 'undefined' && module.exports) { + module.exports = async; + } + else { + root.async = async; + } + + async.noConflict = function () { + root.async = previous_async; + return async; + }; + + //// cross-browser compatiblity functions //// + + var _forEach = function (arr, iterator) { + if (arr.forEach) { + return arr.forEach(iterator); + } + for (var i = 0; i < arr.length; i += 1) { + iterator(arr[i], i, arr); + } + }; + + var _map = function (arr, iterator) { + if (arr.map) { + return arr.map(iterator); + } + var results = []; + _forEach(arr, function (x, i, a) { + results.push(iterator(x, i, a)); + }); + return results; + }; + + var _reduce = function (arr, iterator, memo) { + if (arr.reduce) { + return arr.reduce(iterator, memo); + } + _forEach(arr, function (x, i, a) { + memo = iterator(memo, x, i, a); + }); + return memo; + }; + + var _keys = function (obj) { + if (Object.keys) { + return Object.keys(obj); + } + var keys = []; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + keys.push(k); + } + } + return keys; + }; + + var _indexOf = function (arr, item) { + if (arr.indexOf) { + return arr.indexOf(item); + } + for (var i = 0; i < arr.length; i += 1) { + if (arr[i] === item) { + return i; + } + } + return -1; + }; + + //// exported async module functions //// + + //// nextTick implementation with browser-compatible fallback //// + if (typeof process === 'undefined' || !(process.nextTick)) { + async.nextTick = function (fn) { + setTimeout(fn, 0); + }; + } + else { + async.nextTick = process.nextTick; + } + + async.forEach = function (arr, iterator, callback) { + if (!arr.length) { + return callback(); + } + var completed = 0; + _forEach(arr, function (x) { + iterator(x, function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + completed += 1; + if (completed === arr.length) { + callback(); + } + } + }); + }); + }; + + async.forEachSeries = function (arr, iterator, callback) { + if (!arr.length) { + return callback(); + } + var completed = 0; + var iterate = function () { + iterator(arr[completed], function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + completed += 1; + if (completed === arr.length) { + callback(); + } + else { + iterate(); + } + } + }); + }; + iterate(); + }; + + + var doParallel = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + return fn.apply(null, [async.forEach].concat(args)); + }; + }; + var doSeries = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + return fn.apply(null, [async.forEachSeries].concat(args)); + }; + }; + + + var _asyncMap = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (err, v) { + results[x.index] = v; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + }; + async.map = doParallel(_asyncMap); + async.mapSeries = doSeries(_asyncMap); + + + // reduce only has a series version, as doing reduce in parallel won't + // work in many situations. + async.reduce = function (arr, memo, iterator, callback) { + async.forEachSeries(arr, function (x, callback) { + iterator(memo, x, function (err, v) { + memo = v; + callback(err); + }); + }, function (err) { + callback(err, memo); + }); + }; + // inject alias + async.inject = async.reduce; + // foldl alias + async.foldl = async.reduce; + + async.reduceRight = function (arr, memo, iterator, callback) { + var reversed = _map(arr, function (x) { + return x; + }).reverse(); + async.reduce(reversed, memo, iterator, callback); + }; + // foldr alias + async.foldr = async.reduceRight; + + var _filter = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (v) { + if (v) { + results.push(x); + } + callback(); + }); + }, function (err) { + callback(_map(results.sort(function (a, b) { + return a.index - b.index; + }), function (x) { + return x.value; + })); + }); + }; + async.filter = doParallel(_filter); + async.filterSeries = doSeries(_filter); + // select alias + async.select = async.filter; + async.selectSeries = async.filterSeries; + + var _reject = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (v) { + if (!v) { + results.push(x); + } + callback(); + }); + }, function (err) { + callback(_map(results.sort(function (a, b) { + return a.index - b.index; + }), function (x) { + return x.value; + })); + }); + }; + async.reject = doParallel(_reject); + async.rejectSeries = doSeries(_reject); + + var _detect = function (eachfn, arr, iterator, main_callback) { + eachfn(arr, function (x, callback) { + iterator(x, function (result) { + if (result) { + main_callback(x); + } + else { + callback(); + } + }); + }, function (err) { + main_callback(); + }); + }; + async.detect = doParallel(_detect); + async.detectSeries = doSeries(_detect); + + async.some = function (arr, iterator, main_callback) { + async.forEach(arr, function (x, callback) { + iterator(x, function (v) { + if (v) { + main_callback(true); + main_callback = function () {}; + } + callback(); + }); + }, function (err) { + main_callback(false); + }); + }; + // any alias + async.any = async.some; + + async.every = function (arr, iterator, main_callback) { + async.forEach(arr, function (x, callback) { + iterator(x, function (v) { + if (!v) { + main_callback(false); + main_callback = function () {}; + } + callback(); + }); + }, function (err) { + main_callback(true); + }); + }; + // all alias + async.all = async.every; + + async.sortBy = function (arr, iterator, callback) { + async.map(arr, function (x, callback) { + iterator(x, function (err, criteria) { + if (err) { + callback(err); + } + else { + callback(null, {value: x, criteria: criteria}); + } + }); + }, function (err, results) { + if (err) { + return callback(err); + } + else { + var fn = function (left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }; + callback(null, _map(results.sort(fn), function (x) { + return x.value; + })); + } + }); + }; + + async.auto = function (tasks, callback) { + callback = callback || function () {}; + var keys = _keys(tasks); + if (!keys.length) { + return callback(null); + } + + var completed = []; + + var listeners = []; + var addListener = function (fn) { + listeners.unshift(fn); + }; + var removeListener = function (fn) { + for (var i = 0; i < listeners.length; i += 1) { + if (listeners[i] === fn) { + listeners.splice(i, 1); + return; + } + } + }; + var taskComplete = function () { + _forEach(listeners, function (fn) { + fn(); + }); + }; + + addListener(function () { + if (completed.length === keys.length) { + callback(null); + } + }); + + _forEach(keys, function (k) { + var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; + var taskCallback = function (err) { + if (err) { + callback(err); + // stop subsequent errors hitting callback multiple times + callback = function () {}; + } + else { + completed.push(k); + taskComplete(); + } + }; + var requires = task.slice(0, Math.abs(task.length - 1)) || []; + var ready = function () { + return _reduce(requires, function (a, x) { + return (a && _indexOf(completed, x) !== -1); + }, true); + }; + if (ready()) { + task[task.length - 1](taskCallback); + } + else { + var listener = function () { + if (ready()) { + removeListener(listener); + task[task.length - 1](taskCallback); + } + }; + addListener(listener); + } + }); + }; + + async.waterfall = function (tasks, callback) { + if (!tasks.length) { + return callback(); + } + callback = callback || function () {}; + var wrapIterator = function (iterator) { + return function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + var args = Array.prototype.slice.call(arguments, 1); + var next = iterator.next(); + if (next) { + args.push(wrapIterator(next)); + } + else { + args.push(callback); + } + async.nextTick(function () { + iterator.apply(null, args); + }); + } + }; + }; + wrapIterator(async.iterator(tasks))(); + }; + + async.parallel = function (tasks, callback) { + callback = callback || function () {}; + if (tasks.constructor === Array) { + async.map(tasks, function (fn, callback) { + if (fn) { + fn(function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + callback.call(null, err, args || null); + }); + } + }, callback); + } + else { + var results = {}; + async.forEach(_keys(tasks), function (k, callback) { + tasks[k](function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + results[k] = args; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + + async.series = function (tasks, callback) { + callback = callback || function () {}; + if (tasks.constructor === Array) { + async.mapSeries(tasks, function (fn, callback) { + if (fn) { + fn(function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + callback.call(null, err, args || null); + }); + } + }, callback); + } + else { + var results = {}; + async.forEachSeries(_keys(tasks), function (k, callback) { + tasks[k](function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + results[k] = args; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + + async.iterator = function (tasks) { + var makeCallback = function (index) { + var fn = function () { + if (tasks.length) { + tasks[index].apply(null, arguments); + } + return fn.next(); + }; + fn.next = function () { + return (index < tasks.length - 1) ? makeCallback(index + 1): null; + }; + return fn; + }; + return makeCallback(0); + }; + + async.apply = function (fn) { + var args = Array.prototype.slice.call(arguments, 1); + return function () { + return fn.apply( + null, args.concat(Array.prototype.slice.call(arguments)) + ); + }; + }; + + var _concat = function (eachfn, arr, fn, callback) { + var r = []; + eachfn(arr, function (x, cb) { + fn(x, function (err, y) { + r = r.concat(y || []); + cb(err); + }); + }, function (err) { + callback(err, r); + }); + }; + async.concat = doParallel(_concat); + async.concatSeries = doSeries(_concat); + + async.whilst = function (test, iterator, callback) { + if (test()) { + iterator(function (err) { + if (err) { + return callback(err); + } + async.whilst(test, iterator, callback); + }); + } + else { + callback(); + } + }; + + async.until = function (test, iterator, callback) { + if (!test()) { + iterator(function (err) { + if (err) { + return callback(err); + } + async.until(test, iterator, callback); + }); + } + else { + callback(); + } + }; + + async.queue = function (worker, concurrency) { + var workers = 0; + var tasks = []; + var q = { + concurrency: concurrency, + push: function (data, callback) { + tasks.push({data: data, callback: callback}); + async.nextTick(q.process); + }, + process: function () { + if (workers < q.concurrency && tasks.length) { + var task = tasks.splice(0, 1)[0]; + workers += 1; + worker(task.data, function () { + workers -= 1; + if (task.callback) { + task.callback.apply(task, arguments); + } + q.process(); + }); + } + }, + length: function () { + return tasks.length; + } + }; + return q; + }; + + var _console_fn = function (name) { + return function (fn) { + var args = Array.prototype.slice.call(arguments, 1); + fn.apply(null, args.concat([function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (typeof console !== 'undefined') { + if (err) { + if (console.error) { + console.error(err); + } + } + else if (console[name]) { + _forEach(args, function (x) { + console[name](x); + }); + } + } + }])); + }; + }; + async.log = _console_fn('log'); + async.dir = _console_fn('dir'); + /*async.info = _console_fn('info'); + async.warn = _console_fn('warn'); + async.error = _console_fn('error');*/ + + async.memoize = function (fn, hasher) { + var memo = {}; + hasher = hasher || function (x) { + return x; + }; + return function () { + var args = Array.prototype.slice.call(arguments); + var callback = args.pop(); + var key = hasher.apply(null, args); + if (key in memo) { + callback.apply(null, memo[key]); + } + else { + fn.apply(null, args.concat([function () { + memo[key] = arguments; + callback.apply(null, arguments); + }])); + } + }; + }; + +}()); +(function(exports){ +/** + * This file is based on the node.js assert module, but with some small + * changes for browser-compatibility + * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! + */ + + +/** + * Added for browser compatibility + */ + +var _keys = function(obj){ + if(Object.keys) return Object.keys(obj); + if (typeof obj != 'object' && typeof obj != 'function') { + throw new TypeError('-'); + } + var keys = []; + for(var k in obj){ + if(obj.hasOwnProperty(k)) keys.push(k); + } + return keys; +}; + + + +// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 +// +// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! +// +// Originally from narwhal.js (http://narwhaljs.org) +// Copyright (c) 2009 Thomas Robinson <280north.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 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 pSlice = Array.prototype.slice; + +// 1. The assert module provides functions that throw +// AssertionError's when particular conditions are not met. The +// assert module must conform to the following interface. + +var assert = exports; + +// 2. The AssertionError is defined in assert. +// new assert.AssertionError({message: message, actual: actual, expected: expected}) + +assert.AssertionError = function AssertionError (options) { + this.name = "AssertionError"; + this.message = options.message; + this.actual = options.actual; + this.expected = options.expected; + this.operator = options.operator; + var stackStartFunction = options.stackStartFunction || fail; + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, stackStartFunction); + } +}; +// code from util.inherits in node +assert.AssertionError.super_ = Error; + + +// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call +// TODO: test what effect this may have +var ctor = function () { this.constructor = assert.AssertionError; }; +ctor.prototype = Error.prototype; +assert.AssertionError.prototype = new ctor(); + + +assert.AssertionError.prototype.toString = function() { + if (this.message) { + return [this.name+":", this.message].join(' '); + } else { + return [ this.name+":" + , JSON.stringify(this.expected ) + , this.operator + , JSON.stringify(this.actual) + ].join(" "); + } +}; + +// assert.AssertionError instanceof Error + +assert.AssertionError.__proto__ = Error.prototype; + +// At present only the three keys mentioned above are used and +// understood by the spec. Implementations or sub modules can pass +// other keys to the AssertionError's constructor - they will be +// ignored. + +// 3. All of the following functions must throw an AssertionError +// when a corresponding condition is not met, with a message that +// may be undefined if not provided. All assertion methods provide +// both the actual and expected values to the assertion error for +// display purposes. + +function fail(actual, expected, message, operator, stackStartFunction) { + throw new assert.AssertionError({ + message: message, + actual: actual, + expected: expected, + operator: operator, + stackStartFunction: stackStartFunction + }); +} + +// EXTENSION! allows for well behaved errors defined elsewhere. +assert.fail = fail; + +// 4. Pure assertion tests whether a value is truthy, as determined +// by !!guard. +// assert.ok(guard, message_opt); +// This statement is equivalent to assert.equal(true, guard, +// message_opt);. To test strictly for the value true, use +// assert.strictEqual(true, guard, message_opt);. + +assert.ok = function ok(value, message) { + if (!!!value) fail(value, true, message, "==", assert.ok); +}; + +// 5. The equality assertion tests shallow, coercive equality with +// ==. +// assert.equal(actual, expected, message_opt); + +assert.equal = function equal(actual, expected, message) { + if (actual != expected) fail(actual, expected, message, "==", assert.equal); +}; + +// 6. The non-equality assertion tests for whether two objects are not equal +// with != assert.notEqual(actual, expected, message_opt); + +assert.notEqual = function notEqual(actual, expected, message) { + if (actual == expected) { + fail(actual, expected, message, "!=", assert.notEqual); + } +}; + +// 7. The equivalence assertion tests a deep equality relation. +// assert.deepEqual(actual, expected, message_opt); + +assert.deepEqual = function deepEqual(actual, expected, message) { + if (!_deepEqual(actual, expected)) { + fail(actual, expected, message, "deepEqual", assert.deepEqual); + } +}; + +var Buffer = null; +if (typeof require !== 'undefined' && typeof process !== 'undefined') { + try { + Buffer = require('buffer').Buffer; + } + catch (e) { + // May be a CommonJS environment other than Node.js + Buffer = null; + } +} + +function _deepEqual(actual, expected) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.2.1 If the expcted value is a RegExp object, the actual value is + // equivalent if it is also a RegExp object that refers to the same source and options + } else if (actual instanceof RegExp && expected instanceof RegExp) { + return actual.source === expected.source && + actual.global === expected.global && + actual.ignoreCase === expected.ignoreCase && + actual.multiline === expected.multiline; + + } else if (Buffer && actual instanceof Buffer && expected instanceof Buffer) { + return (function() { + var i, len; + + for (i = 0, len = expected.length; i < len; i++) { + if (actual[i] !== expected[i]) { + return false; + } + } + return actual.length === expected.length; + })(); + // 7.3. Other pairs that do not both pass typeof value == "object", + // equivalence is determined by ==. + } else if (typeof actual != 'object' && typeof expected != 'object') { + return actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical "prototype" property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected); + } +} + +function isUndefinedOrNull (value) { + return value === null || value === undefined; +} + +function isArguments (object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +} + +function objEquiv (a, b) { + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical "prototype" property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return _deepEqual(a, b); + } + try{ + var ka = _keys(a), + kb = _keys(b), + key, i; + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!_deepEqual(a[key], b[key] )) + return false; + } + return true; +} + +// 8. The non-equivalence assertion tests for any deep inequality. +// assert.notDeepEqual(actual, expected, message_opt); + +assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (_deepEqual(actual, expected)) { + fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual); + } +}; + +// 9. The strict equality assertion tests strict equality, as determined by ===. +// assert.strictEqual(actual, expected, message_opt); + +assert.strictEqual = function strictEqual(actual, expected, message) { + if (actual !== expected) { + fail(actual, expected, message, "===", assert.strictEqual); + } +}; + +// 10. The strict non-equality assertion tests for strict inequality, as determined by !==. +// assert.notStrictEqual(actual, expected, message_opt); + +assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (actual === expected) { + fail(actual, expected, message, "!==", assert.notStrictEqual); + } +}; + +function expectedException(actual, expected) { + if (!actual || !expected) { + return false; + } + + if (expected instanceof RegExp) { + return expected.test(actual.message || actual); + } else if (actual instanceof expected) { + return true; + } else if (expected.call({}, actual) === true) { + return true; + } + + return false; +} + +function _throws(shouldThrow, block, expected, message) { + var actual; + + if (typeof expected === 'string') { + message = expected; + expected = null; + } + + try { + block(); + } catch (e) { + actual = e; + } + + message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + + (message ? ' ' + message : '.'); + + if (shouldThrow && !actual) { + fail('Missing expected exception' + message); + } + + if (!shouldThrow && expectedException(actual, expected)) { + fail('Got unwanted exception' + message); + } + + if ((shouldThrow && actual && expected && + !expectedException(actual, expected)) || (!shouldThrow && actual)) { + throw actual; + } +} + +// 11. Expected to throw an error: +// assert.throws(block, Error_opt, message_opt); + +assert.throws = function(block, /*optional*/error, /*optional*/message) { + _throws.apply(this, [true].concat(pSlice.call(arguments))); +}; + +// EXTENSION! This is annoying to write outside this module. +assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { + _throws.apply(this, [false].concat(pSlice.call(arguments))); +}; + +assert.ifError = function (err) { if (err) {throw err;}}; +})(assert); +(function(exports){ +/*! + * Nodeunit + * Copyright (c) 2010 Caolan McMahon + * MIT Licensed + * + * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! + * Only code on that line will be removed, it's mostly to avoid requiring code + * that is node specific + */ + +/** + * Module dependencies + */ + + + +/** + * Creates assertion objects representing the result of an assert call. + * Accepts an object or AssertionError as its argument. + * + * @param {object} obj + * @api public + */ + +exports.assertion = function (obj) { + return { + method: obj.method || '', + message: obj.message || (obj.error && obj.error.message) || '', + error: obj.error, + passed: function () { + return !this.error; + }, + failed: function () { + return Boolean(this.error); + } + }; +}; + +/** + * Creates an assertion list object representing a group of assertions. + * Accepts an array of assertion objects. + * + * @param {Array} arr + * @param {Number} duration + * @api public + */ + +exports.assertionList = function (arr, duration) { + var that = arr || []; + that.failures = function () { + var failures = 0; + for (var i = 0; i < this.length; i += 1) { + if (this[i].failed()) { + failures += 1; + } + } + return failures; + }; + that.passes = function () { + return that.length - that.failures(); + }; + that.duration = duration || 0; + return that; +}; + +/** + * Create a wrapper function for assert module methods. Executes a callback + * after it's complete with an assertion object representing the result. + * + * @param {Function} callback + * @api private + */ + +var assertWrapper = function (callback) { + return function (new_method, assert_method, arity) { + return function () { + var message = arguments[arity - 1]; + var a = exports.assertion({method: new_method, message: message}); + try { + assert[assert_method].apply(null, arguments); + } + catch (e) { + a.error = e; + } + callback(a); + }; + }; +}; + +/** + * Creates the 'test' object that gets passed to every test function. + * Accepts the name of the test function as its first argument, followed by + * the start time in ms, the options object and a callback function. + * + * @param {String} name + * @param {Number} start + * @param {Object} options + * @param {Function} callback + * @api public + */ + +exports.test = function (name, start, options, callback) { + var expecting; + var a_list = []; + + var wrapAssert = assertWrapper(function (a) { + a_list.push(a); + if (options.log) { + async.nextTick(function () { + options.log(a); + }); + } + }); + + var test = { + done: function (err) { + if (expecting !== undefined && expecting !== a_list.length) { + var e = new Error( + 'Expected ' + expecting + ' assertions, ' + + a_list.length + ' ran' + ); + var a1 = exports.assertion({method: 'expect', error: e}); + a_list.push(a1); + if (options.log) { + async.nextTick(function () { + options.log(a1); + }); + } + } + if (err) { + var a2 = exports.assertion({error: err}); + a_list.push(a2); + if (options.log) { + async.nextTick(function () { + options.log(a2); + }); + } + } + var end = new Date().getTime(); + async.nextTick(function () { + var assertion_list = exports.assertionList(a_list, end - start); + options.testDone(name, assertion_list); + callback(null, a_list); + }); + }, + ok: wrapAssert('ok', 'ok', 2), + same: wrapAssert('same', 'deepEqual', 3), + equals: wrapAssert('equals', 'equal', 3), + expect: function (num) { + expecting = num; + }, + _assertion_list: a_list + }; + // add all functions from the assert module + for (var k in assert) { + if (assert.hasOwnProperty(k)) { + test[k] = wrapAssert(k, k, assert[k].length); + } + } + return test; +}; + +/** + * Ensures an options object has all callbacks, adding empty callback functions + * if any are missing. + * + * @param {Object} opt + * @return {Object} + * @api public + */ + +exports.options = function (opt) { + var optionalCallback = function (name) { + opt[name] = opt[name] || function () {}; + }; + + optionalCallback('moduleStart'); + optionalCallback('moduleDone'); + optionalCallback('testStart'); + optionalCallback('testDone'); + //optionalCallback('log'); + + // 'done' callback is not optional. + + return opt; +}; +})(types); +(function(exports){ +/*! + * Nodeunit + * Copyright (c) 2010 Caolan McMahon + * MIT Licensed + * + * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! + * Only code on that line will be removed, it's mostly to avoid requiring code + * that is node specific + */ + +/** + * Module dependencies + */ + + + +/** + * Added for browser compatibility + */ + +var _keys = function (obj) { + if (Object.keys) { + return Object.keys(obj); + } + var keys = []; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + keys.push(k); + } + } + return keys; +}; + + +var _copy = function (obj) { + var nobj = {}; + var keys = _keys(obj); + for (var i = 0; i < keys.length; i += 1) { + nobj[keys[i]] = obj[keys[i]]; + } + return nobj; +}; + + +/** + * Runs a test function (fn) from a loaded module. After the test function + * calls test.done(), the callback is executed with an assertionList as its + * second argument. + * + * @param {String} name + * @param {Function} fn + * @param {Object} opt + * @param {Function} callback + * @api public + */ + +exports.runTest = function (name, fn, opt, callback) { + var options = types.options(opt); + + options.testStart(name); + var start = new Date().getTime(); + var test = types.test(name, start, options, callback); + + try { + fn(test); + } + catch (e) { + test.done(e); + } +}; + +/** + * Takes an object containing test functions or other test suites as properties + * and runs each in series. After all tests have completed, the callback is + * called with a list of all assertions as the second argument. + * + * If a name is passed to this function it is prepended to all test and suite + * names that run within it. + * + * @param {String} name + * @param {Object} suite + * @param {Object} opt + * @param {Function} callback + * @api public + */ + +exports.runSuite = function (name, suite, opt, callback) { + suite = wrapGroup(suite); + var keys = _keys(suite); + + async.concatSeries(keys, function (k, cb) { + var prop = suite[k], _name; + + _name = name ? [].concat(name, k) : [k]; + _name.toString = function () { + // fallback for old one + return this.join(' - '); + }; + + if (typeof prop === 'function') { + var in_name = false, + in_specific_test = (_name.toString() === opt.testFullSpec) ? true : false; + for (var i = 0; i < _name.length; i += 1) { + if (_name[i] === opt.testspec) { + in_name = true; + } + } + + if ((!opt.testFullSpec || in_specific_test) && (!opt.testspec || in_name)) { + if (opt.moduleStart) { + opt.moduleStart(); + } + exports.runTest(_name, suite[k], opt, cb); + } + else { + return cb(); + } + } + else { + exports.runSuite(_name, suite[k], opt, cb); + } + }, callback); +}; + +/** + * Run each exported test function or test suite from a loaded module. + * + * @param {String} name + * @param {Object} mod + * @param {Object} opt + * @param {Function} callback + * @api public + */ + +exports.runModule = function (name, mod, opt, callback) { + var options = _copy(types.options(opt)); + + var _run = false; + var _moduleStart = options.moduleStart; + + mod = wrapGroup(mod); + + function run_once() { + if (!_run) { + _run = true; + _moduleStart(name); + } + } + options.moduleStart = run_once; + + var start = new Date().getTime(); + + exports.runSuite(null, mod, options, function (err, a_list) { + var end = new Date().getTime(); + var assertion_list = types.assertionList(a_list, end - start); + options.moduleDone(name, assertion_list); + if (nodeunit.complete) { + nodeunit.complete(name, assertion_list); + } + callback(null, a_list); + }); +}; + +/** + * Treats an object literal as a list of modules keyed by name. Runs each + * module and finished with calling 'done'. You can think of this as a browser + * safe alternative to runFiles in the nodeunit module. + * + * @param {Object} modules + * @param {Object} opt + * @api public + */ + +// TODO: add proper unit tests for this function +exports.runModules = function (modules, opt) { + var all_assertions = []; + var options = types.options(opt); + var start = new Date().getTime(); + + async.concatSeries(_keys(modules), function (k, cb) { + exports.runModule(k, modules[k], options, cb); + }, + function (err, all_assertions) { + var end = new Date().getTime(); + options.done(types.assertionList(all_assertions, end - start)); + }); +}; + + +/** + * Wraps a test function with setUp and tearDown functions. + * Used by testCase. + * + * @param {Function} setUp + * @param {Function} tearDown + * @param {Function} fn + * @api private + */ + +var wrapTest = function (setUp, tearDown, fn) { + return function (test) { + var context = {}; + if (tearDown) { + var done = test.done; + test.done = function (err) { + try { + tearDown.call(context, function (err2) { + if (err && err2) { + test._assertion_list.push( + types.assertion({error: err}) + ); + return done(err2); + } + done(err || err2); + }); + } + catch (e) { + done(e); + } + }; + } + if (setUp) { + setUp.call(context, function (err) { + if (err) { + return test.done(err); + } + fn.call(context, test); + }); + } + else { + fn.call(context, test); + } + }; +}; + + +/** + * Returns a serial callback from two functions. + * + * @param {Function} funcFirst + * @param {Function} funcSecond + * @api private + */ + +var getSerialCallback = function (fns) { + if (!fns.length) { + return null; + } + return function (callback) { + var that = this; + var bound_fns = []; + for (var i = 0, len = fns.length; i < len; i++) { + (function (j) { + bound_fns.push(function () { + return fns[j].apply(that, arguments); + }); + })(i); + } + return async.series(bound_fns, callback); + }; +}; + + +/** + * Wraps a group of tests with setUp and tearDown functions. + * Used by testCase. + * + * @param {Object} group + * @param {Array} setUps - parent setUp functions + * @param {Array} tearDowns - parent tearDown functions + * @api private + */ + +var wrapGroup = function (group, setUps, tearDowns) { + var tests = {}; + + var setUps = setUps ? setUps.slice(): []; + var tearDowns = tearDowns ? tearDowns.slice(): []; + + if (group.setUp) { + setUps.push(group.setUp); + delete group.setUp; + } + if (group.tearDown) { + tearDowns.unshift(group.tearDown); + delete group.tearDown; + } + + var keys = _keys(group); + + for (var i = 0; i < keys.length; i += 1) { + var k = keys[i]; + if (typeof group[k] === 'function') { + tests[k] = wrapTest( + getSerialCallback(setUps), + getSerialCallback(tearDowns), + group[k] + ); + } + else if (typeof group[k] === 'object') { + tests[k] = wrapGroup(group[k], setUps, tearDowns); + } + } + return tests; +}; + + +/** + * Backwards compatibility for test suites using old testCase API + */ + +exports.testCase = function (suite) { + return suite; +}; +})(core); +(function(exports){ +/*! + * Nodeunit + * Copyright (c) 2010 Caolan McMahon + * MIT Licensed + * + * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! + * Only code on that line will be removed, its mostly to avoid requiring code + * that is node specific + */ + + +/** + * NOTE: this test runner is not listed in index.js because it cannot be + * used with the command-line tool, only inside the browser. + */ + + +/** + * Reporter info string + */ + +exports.info = "Browser-based test reporter"; + + +/** + * Run all tests within each module, reporting the results + * + * @param {Array} files + * @api public + */ + +exports.run = function (modules, options) { + var start = new Date().getTime(), div; + options = options || {}; + div = options.div || document.body; + + function setText(el, txt) { + if ('innerText' in el) { + el.innerText = txt; + } + else if ('textContent' in el){ + el.textContent = txt; + } + } + + function getOrCreate(tag, id) { + var el = document.getElementById(id); + if (!el) { + el = document.createElement(tag); + el.id = id; + div.appendChild(el); + } + return el; + }; + + var header = getOrCreate('h1', 'nodeunit-header'); + var banner = getOrCreate('h2', 'nodeunit-banner'); + var userAgent = getOrCreate('h2', 'nodeunit-userAgent'); + var tests = getOrCreate('ol', 'nodeunit-tests'); + var result = getOrCreate('p', 'nodeunit-testresult'); + + setText(userAgent, navigator.userAgent); + + nodeunit.runModules(modules, { + moduleStart: function (name) { + /*var mheading = document.createElement('h2'); + mheading.innerText = name; + results.appendChild(mheading); + module = document.createElement('ol'); + results.appendChild(module);*/ + }, + testDone: function (name, assertions) { + var test = document.createElement('li'); + var strong = document.createElement('strong'); + strong.innerHTML = name + ' (' + + '' + assertions.failures() + ', ' + + '' + assertions.passes() + ', ' + + assertions.length + + ')'; + test.className = assertions.failures() ? 'fail': 'pass'; + test.appendChild(strong); + + var aList = document.createElement('ol'); + aList.style.display = 'none'; + test.onclick = function () { + var d = aList.style.display; + aList.style.display = (d == 'none') ? 'block': 'none'; + }; + for (var i=0; i' + (a.error.stack || a.error) + ''; + li.className = 'fail'; + } + else { + li.innerHTML = a.message || a.method || 'no message'; + li.className = 'pass'; + } + aList.appendChild(li); + } + test.appendChild(aList); + tests.appendChild(test); + }, + done: function (assertions) { + var end = new Date().getTime(); + var duration = end - start; + + var failures = assertions.failures(); + banner.className = failures ? 'fail': 'pass'; + + result.innerHTML = 'Tests completed in ' + duration + + ' milliseconds.
' + + assertions.passes() + ' assertions of ' + + '' + assertions.length + ' passed, ' + + assertions.failures() + ' failed.'; + } + }); +}; +})(reporter); +nodeunit = core; +nodeunit.assert = assert; +nodeunit.reporter = reporter; +nodeunit.run = reporter.run; +return nodeunit; })(); diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/numberformats.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/numberformats.proto new file mode 100644 index 0000000..79a07f8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/numberformats.proto @@ -0,0 +1,18 @@ +enum Formats { + DEC = 1; + HEX = 0x1F; + OCT = 017; +} + +message Msg { + required int32 dec = 1 [default=-1]; + required int32 hex = 2 [default=-0x1F]; + required int32 oct = 3 [default=-017]; + required double exp = 4 [default=0.1e5]; + required double nod = 5 [default=1.]; + required double exn = 6 [default=1e8]; + required double sp1 = 7 [default=inf]; + required double sp2 = 8 [default=-inf]; + required double sp3 = 9 [default=nan]; + required int32 hexUC = 10 [default=0X209]; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/oneof.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/oneof.proto new file mode 100644 index 0000000..52a618b --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/oneof.proto @@ -0,0 +1,6 @@ +message MyOneOf { + oneof my_oneof { + uint32 id = 1; + string name = 2; + } +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/optional.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/optional.proto new file mode 100644 index 0000000..92fbfc5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/optional.proto @@ -0,0 +1,12 @@ +message Test1 { + optional int32 a = 1; + optional Test2 b = 2; +} + +message Test2 { + optional int32 c = 1; + optional Test3 d = 2; +} + +message Test3 { +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/options.json b/legacy-libs/grpc/node_modules/protobufjs/tests/options.json new file mode 100644 index 0000000..405450e --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/options.json @@ -0,0 +1,32 @@ +{ + "package": "My", + "messages": [ + { + "name": "Test", + "fields": [ + { + "rule": "optional", + "options": { + "default": "Max" + }, + "type": "string", + "name": "name", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": { + "(inmessage)": "My.Test", + "(foo.my_option).bar": false + } + } + ], + "enums": [], + "imports": [], + "options": { + "(toplevel_1)": 10, + "(toplevel_2)": "Hello world!" + }, + "services": [] +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/options.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/options.proto new file mode 100644 index 0000000..f96da6d --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/options.proto @@ -0,0 +1,13 @@ +option (toplevel_1) = 10; +package My; +option (toplevel_2) = "Hello world!"; + +message Test { + optional string name = 1 [default="Max"]; + optional string desc1 = 2 [default="Shouldn't mix quotes"]; + optional string desc2 = 3 [default='Shouldn"t mix quotes']; + optional string desc3 = 4 [(foo_options) = { opt1: 123 opt2: "baz" }]; + optional string desc4 = 5 [(foo_options) = {options { opt1: 1234 opt2: "baz" } options { opt1: 4321 opt2: "foo" }} ]; + option (inmessage) = My.Test; + option (foo.my_option).bar = false; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/packed.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/packed.proto new file mode 100644 index 0000000..b9ee7a0 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/packed.proto @@ -0,0 +1,4 @@ +message Message { + repeated int32 a = 1 [packed = true]; + repeated int32 b = 2; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/proto2js/Bar.json b/legacy-libs/grpc/node_modules/protobufjs/tests/proto2js/Bar.json new file mode 100644 index 0000000..3c4712a --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/proto2js/Bar.json @@ -0,0 +1,46 @@ +{ + "package": null, + "messages": [ + { + "ref": "Foo", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "buzz", + "id": 2, + "options": {} + } + ] + } + ], + "enums": [], + "imports": [ + { + "package": null, + "messages": [ + { + "name": "Foo", + "fields": [ + { + "rule": "required", + "type": "string", + "name": "fizz", + "id": 1, + "options": {} + } + ], + "enums": [], + "messages": [], + "options": {} + } + ], + "enums": [], + "imports": [], + "options": {}, + "services": [] + } + ], + "options": {}, + "services": [] +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/proto2js/Bar.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/proto2js/Bar.proto new file mode 100644 index 0000000..309157b --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/proto2js/Bar.proto @@ -0,0 +1,7 @@ +// Bar.proto +import "Foo.proto"; + +// really extend Bar but that produces an empty constructor. +extend Foo { + required string buzz = 2; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/proto2js/Foo.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/proto2js/Foo.proto new file mode 100644 index 0000000..f56944a --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/proto2js/Foo.proto @@ -0,0 +1,4 @@ +// Foo.proto +message Foo { + required string fizz = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/proto3.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/proto3.proto new file mode 100644 index 0000000..9f99fbb --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/proto3.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package test; + +message Foo { + int32 optional_int32 = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/protobufnet.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/protobufnet.proto new file mode 100644 index 0000000..1d255c2 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/protobufnet.proto @@ -0,0 +1,19 @@ +message IMeshImp { +} +message Mesh { + optional IMeshImp _meshImp = 1; + repeated float3 _vertices = 2; + repeated uint32 _colors = 3; + repeated float3 _normals = 4; + repeated float2 _uvs = 5; + repeated int32 _triangles = 6; +} +message float2 { + optional float x = 1 [default = 0]; + optional float y = 2 [default = 0]; +} +message float3 { + optional float x = 1 [default = 0]; + optional float y = 2 [default = 0]; + optional float z = 3 [default = 0]; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/repeated.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/repeated.proto new file mode 100644 index 0000000..4ed169b --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/repeated.proto @@ -0,0 +1,12 @@ +message Outer { + // As of: https://developers.google.com/protocol-buffers/docs/encoding#optional + + repeated Inner inner = 1; + // "If your message definition has repeated elements (without the [packed=true] option), the encoded message has + // zero or more key-value pairs with the same tag number." + +} + +message Inner { + optional uint32 inner_value = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/services.js b/legacy-libs/grpc/node_modules/protobufjs/tests/services.js new file mode 100644 index 0000000..c59995d --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/services.js @@ -0,0 +1,39 @@ +var root = require("..").newBuilder({ + "convertFieldsToCamelCase": true, + "populateAccessors": false +})['import']({ + "package": "my.namespace", + "messages": [ + { + "name": "something", + "fields": [], + "messages": [ + { + "name": "v1", + "fields": [], + "messages": [ + { + "name": "GetRequest", + "fields": [] + }, + { + "name": "GetResponse", + "fields": [] + } + ], + "enums": [], + "services": [{ + "name": "SomeService", + "rpc": { + "get": { + "request": "GetRequest", + "response": "GetResponse" + } + } + }] + } + ] + } + ] +}).build(); +console.log(require("util").inspect(root, { depth: 10})); \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/setarray.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/setarray.proto new file mode 100644 index 0000000..8bbcc32 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/setarray.proto @@ -0,0 +1,7 @@ +message Outer { + repeated Inner inners = 4; +} + +message Inner { + required string str = 1; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/string_single_quote.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/string_single_quote.proto new file mode 100644 index 0000000..082cff8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/string_single_quote.proto @@ -0,0 +1,3 @@ +message TestSingleQuoteString { + required string a = 1 [ default = 'hello world' ]; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/suite.html b/legacy-libs/grpc/node_modules/protobufjs/tests/suite.html new file mode 100644 index 0000000..ed15eaa --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/suite.html @@ -0,0 +1,16 @@ + + + + ProtoBuf.js Test Suite + + + + + + + + +

ProtoBuf.js Test Suite

+ + + diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/suite.js b/legacy-libs/grpc/node_modules/protobufjs/tests/suite.js new file mode 100644 index 0000000..da0b087 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/suite.js @@ -0,0 +1,2267 @@ +/* + Copyright 2013 Daniel Wirtz + + 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. + */ + +/** + * ProtoBuf.js Test Suite. + * @author Daniel Wirtz + */ +(function(global) { + + var FILE = "protobuf.js"; + var BROWSER = !!global.window; + var StdOutFixture = require('fixture-stdout'); + var fixture = new StdOutFixture(); + + var ProtoBuf = BROWSER ? global.dcodeIO.ProtoBuf : require(__dirname+"/../dist/"+FILE), + ByteBuffer = BROWSER ? global.dcodeIO.ByteBuffer : ByteBuffer || require("bytebuffer"), + util = BROWSER ? null : require("util"), + fs = BROWSER ? null : require("fs"); + + if (typeof __dirname == 'undefined') { + __dirname = document.location.href.replace(/[\/\\][^\/\\]*$/, ""); + } + + /** + * Constructs a new Sandbox for module loaders and shim testing. + * @param {Object.} properties Additional properties to set + * @constructor + */ + var Sandbox = function(properties) { + this.ByteBuffer = function() {}; + for (var i in properties) { + this[i] = properties[i]; + } + this.console = { + log: function(s) { + console.log(s); + } + }; + }; + + function fail(e) { + throw(e); + } + + /** + * Validates the complexDotProto and complexInline tests. + * @param {*} test Nodeunit test + * @param {Object} Game Game namespace + */ + function validateComplex(test, Game) { + var Car = Game.Cars.Car, + Vendor = Car.Vendor, + Speed = Car.Speed; + + var vendor; + // Car from class with argument list properties + var car = new Car( + "Rusty", + // Vendor from class with object properties + vendor = new Vendor({ + "name": "Iron Inc.", + // Address from object + "address": { + "country": "US" + }, + "models": ["m1"] + }), + // Speed from enum object + Speed.SUPERFAST + ); + test.equal(car.model, "Rusty"); + test.equal(car.vendor.name, "Iron Inc."); + test.equal(car.vendor.address.country, "US"); + test.equal(car.vendor.address.country, car.getVendor().get_address().country); + var bb = new ByteBuffer(32); + car.encode(bb); + test.equal(bb.flip().toString("debug"), "<0A 05 52 75 73 74 79 12 15 0A 09 49 72 6F 6E 20 49 6E 63 2E 12 04 0A 02 55 53 1A 02 6D 31 18 02>"); + var carDec = Car.decode(bb); + test.equal(carDec.model, "Rusty"); + test.equal(carDec.vendor.name, "Iron Inc."); + test.equal(carDec.vendor.address.country, "US"); + test.equal(carDec.vendor.address.country, carDec.getVendor().get_address().country); + test.equal(carDec.vendor.models[0], "m1"); + } + + /** + * Test suite. + * @type {Object.} + */ + var suite = { + + "init": function(test) { + test.ok(typeof ProtoBuf == "object"); + test.ok(typeof ProtoBuf.Reflect == 'object'); + test.ok(typeof ProtoBuf.loadProto == "function"); + test.ok(typeof ProtoBuf.loadProtoFile == "function"); + test.strictEqual(ProtoBuf.loadProto, ProtoBuf.protoFromString); + test.strictEqual(ProtoBuf.loadProtoFile, ProtoBuf.protoFromFile); + test.ok(ProtoBuf.ByteBuffer); + test.done(); + }, + + "IS_NODE": function(test) { + test.ok(ProtoBuf.Util.IS_NODE); + test.done(); + }, + + // Example "A Simple Message" from the protobuf docs + // https://developers.google.com/protocol-buffers/docs/encoding#simple + "example1": function(test) { + try{ + var builder = ProtoBuf.loadProtoFile(__dirname+"/example1.proto"); + var Test1 = builder.build("Test1"); + test.ok(typeof Test1 == 'function'); + var inst = new Test1(150); + test.ok(inst instanceof ProtoBuf.Builder.Message); + test.equal(inst.a, 150); + test.equal(inst.getA(), 150); + test.equal(inst.get_a(), 150); + inst.setA(151); + test.equal(inst.a, 151); + test.equal(inst.getA(), 151); + test.equal(inst.get_a(), 151); + inst.set_a(152); + test.equal(inst.a, 152); + test.equal(inst.toString(), ".Test1"); + test.throws(function() { + inst.setA(null); // required + }); + test.throws(function() { + inst.setA([]); + }); + var size = inst.calculate(); + var bb = new ByteBuffer(3); + inst.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<08 98 01>"); + var instDec = Test1.decode(bb); + test.equal(instDec.a, 152); + + } catch (e) { + fail(e); + } + test.done(); + }, + + // Basically the same as example1, but with an unsigned value. + "example1u": function(test) { + try{ + var builder = ProtoBuf.loadProtoFile(__dirname+"/example1u.proto"); + var Test1u = builder.build("Test1u"); + test.ok(typeof Test1u == 'function'); + var inst = new Test1u(-1); + test.strictEqual(inst.a, 4294967295); + var bb = new ByteBuffer(6); + var size = inst.calculate(); + inst.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<08 FF FF FF FF 0F>"); + var instDec = Test1u.decode(bb); + test.strictEqual(instDec.a, 4294967295); + + } catch (e) { + fail(e); + } + test.done(); + }, + + // Example "Strings" from the protobuf docs + // https://developers.google.com/protocol-buffers/docs/encoding#types + "example2": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example2.proto"); + var Test2 = builder.build("Test2"); + var inst = new Test2("testing"); + var bb = new ByteBuffer(9); + var size = inst.calculate(); + inst.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<12 07 74 65 73 74 69 6E 67>"); + var instDec = Test2.decode(bb); + test.equal(instDec.b, "testing"); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Example "Embedded Messages" from the protobuf docs + // https://developers.google.com/protocol-buffers/docs/encoding#embedded + "example3": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example3.proto"); + var root = builder.build(); + var Test1 = root.Test1; + var Test3 = root.Test3; + var inst = new Test3(new Test1(150)); + var bb = new ByteBuffer(5); + test.equal(inst.c.a, 150); + var size = inst.calculate(); + inst.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<1A 03 08 96 01>"); + var instDec = Test3.decode(bb); + test.equal(instDec.c.a, 150); + } catch(e) { + fail(e); + } + test.done(); + }, + + "example4": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example4.proto"); + var Test4 = builder.build("Test4"); + var inst = new Test4([3, 270, 86942]); + var bb = new ByteBuffer(8); + test.equal(inst.d.length, 3); + var size = inst.calculate(); + inst.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<22 06 03 8E 02 9E A7 05>"); + var instDec = Test4.decode(bb); + test.equal(bb.toString("debug"), "22 06 03 8E 02 9E A7 05|"); + test.equal(instDec.d.length, 3); + test.equal(instDec.d[2], 86942); + } catch(e) { + fail(e); + } + test.done(); + }, + + "example5": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example5.proto"); + builder.build(); + } catch(e) { + fail(e); + } + test.done(); + }, + + "constructor": function(test) { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example1.proto"); + var Test1 = builder.build("Test1"); + var t1 = new Test1(123), + t2 = new Test1({a: 123}), + t3 = new Test1(t1); + test.deepEqual(t1, t2); + test.deepEqual(t2, t3); + test.done(); + }, + + "constructorWithOneofs": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/oneof.proto"), + MyOneOf = builder.build("MyOneOf"), + TOneOf = builder.lookup(".MyOneOf"); + test.ok(TOneOf.getChild("my_oneof")); + + var myOneOf = new MyOneOf(); + test.strictEqual(myOneOf.my_oneof, null); + myOneOf.set("id", 1); + test.strictEqual(myOneOf.my_oneof, "id"); + myOneOf.set("name", "me"); + test.strictEqual(myOneOf.my_oneof, "name"); + test.strictEqual(myOneOf.id, null); + + var copy = new MyOneOf(myOneOf); // this line is what was failing + // Error: .MyOneOf#my_oneof is not a field: undefined + + test.deepEqual(myOneOf, copy); + + // Test same things are there + test.strictEqual(copy.my_oneof, "name"); + test.strictEqual(copy.name, "me"); + test.strictEqual(copy.id, null); + } catch (e) { + fail(e); + } + test.done(); + }, + + "numberFormats": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/numberformats.proto"); + var Formats = builder.build("Formats"); + test.strictEqual(Formats.DEC, 1); + test.strictEqual(Formats.HEX, 31); + test.strictEqual(Formats.OCT, 15); + var Msg = builder.build("Msg"); + var msg = new Msg(); + test.strictEqual(msg.dec, -1); + test.strictEqual(msg.hex, -31); + test.strictEqual(msg.hexUC, 521); + test.strictEqual(msg.oct, -15); + test.strictEqual(msg.exp, 0.1e5); + test.strictEqual(msg.nod, 1.); + test.strictEqual(msg.exn, 1e8); + test.strictEqual(msg.sp1, Infinity); + test.strictEqual(msg.sp2, -Infinity); + test.ok(isNaN(msg.sp3)); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Check encode/decode against a table of known correct pairs. + // Note that javascript ArrayBuffer does not support signed Zero or NaN + // bertdouglas (https://github.com/bertdouglas) + "float": function(test) { + try { + var str_proto = "message Float {" + + " required float f = 1;" + + "}"; + var builder = ProtoBuf.loadProto(str_proto); + var root = builder.build(); + var Float = root.Float; + + var in_tolerance = function (reference,actual) { + var tol = 1e-6; + var scale = 1.0; + if (reference != 0.0 ) { + scale = reference; + }; + var err = Math.abs(reference - actual)/scale; + return err < tol; + }; + + var f_vals = [ + // hex values are shown here in big-endian following IEEE754 notation + // protobuf is little-endian + // { f: -0.0 , b: "80 00 00 00" }, + { f: +0.0 , b: "00 00 00 00" }, + { f: -1e-10 , b: "AE DB E6 FF" }, + { f: +1e-10 , b: "2E DB E6 FF" }, + { f: -2e+10 , b: "D0 95 02 F9" }, + { f: +2e+10 , b: "50 95 02 F9" }, + { f: -3e-30 , b: "8E 73 63 90" }, + { f: +3e-30 , b: "0E 73 63 90" }, + { f: -4e+30 , b: "F2 49 F2 CA" }, + { f: +4e+30 , b: "72 49 F2 CA" }, + { f: -123456789.0 , b: "CC EB 79 A3" }, + { f: +123456789.0 , b: "4C EB 79 A3" }, + { f: -0.987654321 , b: "BF 7C D6 EA" }, + { f: +0.987654321 , b: "3F 7C D6 EA" }, + { f: -Infinity , b: "FF 80 00 00" }, + { f: +Infinity , b: "7F 80 00 00" } + // { f: -NaN , b: "FF C0 00 00>" }, + // { f: +NaN , b: "7F C0 00 00" } + ]; + + f_vals.map( function(x) { + // check encode + var m1 = new Float(); + var b1 = new ByteBuffer(); + m1.f = x.f; + m1.encode(b1); + var q1 = b1.slice(1,5).compact().reverse(); + test.strictEqual('<' + x.b + '>', q1.toString("debug")); + + // check decode + var b2 = new ByteBuffer(); + var s1 = x.b + ' 0D'; + var s2 = s1.split(" "); + var s3 = s2.reverse(); + var i1 = s3.map(function(y) { return parseInt(y,16) } ); + i1.map(function(y) { b2.writeUint8(y) }); + b2.limit = b2.offset; + b2.offset = 0; + var m2 = Float.decode(b2); + + var s4 = "" + x.f +" " + m2.f; + if ( isNaN(x.f) ) { + test.ok( isNaN(m2.f), s4 ); + } + else if ( ! isFinite( x.f) ) { + test.ok( x.f === m2.f, s4 ); + } + else { + test.ok( in_tolerance(x.f, m2.f), s4 ); + } + }); + } catch(e) { + fail(e); + } + test.done(); + }, + + "bytes": function(test) { + try { + var str_proto = "message Test { required bytes b = 1; }"; + var builder = ProtoBuf.loadProto(str_proto); + var Test = builder.build("Test"); + var bb = new ByteBuffer(4).writeUint32(0x12345678).flip(); + var myTest = new Test(bb); + test.strictEqual(myTest.b.array, bb.array); + var bb2 = new ByteBuffer(6); + var size = myTest.calculate(); + myTest.encode(bb2); + test.strictEqual(bb2.offset, size); + test.equal(bb2.flip().toString("debug"), "<0A 04 12 34 56 78>"); + myTest = Test.decode(bb2); + test.equal(myTest.b.BE().readUint32(), 0x12345678); + } catch (e) { + fail(e); + } + test.done(); + }, + + "bytesFromFile": function(test) { + try { + var builder = ProtoBuf.loadProto("message Image { required bytes data = 1; }"), + Image = builder.build("Image"), + data = fs.readFileSync(__dirname+"/../protobuf.png"), + image = new Image({ data: data }), + bb = image.encode(), + imageDec = Image.decode(bb), + dataDec = imageDec.data.toBuffer(); + test.strictEqual(data.length, dataDec.length); + test.deepEqual(data, dataDec); + } catch (e) { + fail(e); + } + test.done(); + }, + + "notEnoughBytes": function(test) { + var builder = ProtoBuf.loadProto("message Test { required bytes b = 1; }"); + var Test = builder.build("Test"); + var bb = new ByteBuffer().writeUint32(0x12345678).flip(); + var encoded = new ByteBuffer(6); + new Test(bb).encode(encoded); + test.equal(encoded.flip().toString("debug"), "<0A 04 12 34 56 78>"); + encoded = encoded.slice(0, 5); // chop off the last byte + var err = null; + try { + Test.decode(encoded); + } catch (caught) { + err = caught; + } + test.ok(err && err.message && err.message.indexOf(": 4 required but got only 3") >= 0); + test.done(); + }, + + "bool": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test { optional bool ok = 1 [ default = false ]; }"), + Test = builder.build("Test"), + t = new Test(); + test.strictEqual(t.ok, null); // Not set as it is optional + t.setOk(true); + test.strictEqual(t.ok, true); + test.strictEqual(Test.decode(t.encode()).ok, true); + t.setOk(false); + test.strictEqual(t.ok, false); + t.setOk(null); // Not set + test.strictEqual(Test.decode(t.encode()).ok, false); // = default when missing + } catch (err) { + fail(err); + } + test.done(); + }, + + // As mentioned by Bill Katz + "T139": function(test) { + try{ + var builder = ProtoBuf.loadProtoFile(__dirname+"/T139.proto"); + var T139 = builder.build("T139"); + test.ok(typeof T139 == 'function'); + var inst = new T139(139,139); + test.equal(inst.a, 139); + test.equal(inst.b, 139); + inst.setA(139); + inst.setB(139); + test.equal(inst.a, 139); + test.equal(inst.b, 139); + var bb = new ByteBuffer(3); + inst.encode(bb); + test.equal(bb.flip().toString("debug"), "<08 8B 01 10 8B 01>"); + var instDec = T139.decode(bb); + test.equal(instDec.a, 139); + test.equal(instDec.b, 139); + } catch (e) { + fail(e); + } + test.done(); + }, + + "emptyDefaultString": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test1 { required string test = 1 [default = \"\"]; }"); + var Test1; + test.doesNotThrow(function() { + Test1 = builder.build("Test1"); + }); + var test1 = new Test1(); + test.strictEqual(test1.test, ""); + } catch (e) { + fail(e); + } + test.done(); + }, + + "trailingSemicolon": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test1 { optional string test = 1; };"); + test.doesNotThrow(function() { + var Test1 = builder.build("Test1"); + }); + } catch (e) { + fail(e); + } + test.done(); + }, + + "inner": { + + "longstr": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test { required Inner a = 1; message Inner { required string b = 1; } }"); + var Test = builder.build("Test"); + var t = new Test(); + var data = "0123456789"; // 10: 20, 40, 80, 160, 320 bytes + for (var i=0; i<5; i++) data += data; + test.equal(data.length, 320); + t.a = new Test.Inner(data); + var bb = t.encode(); + var t2 = Test.decode(bb); + test.equal(t2.a.b.length, 320); + test.equal(data, t2.a.b); + } catch (e) { + fail(e); + } + test.done(); + }, + + "multiple": function(test) { + try { + var str = ""; + for (var i=0; i<200; i++) str += 'a'; + var builder = ProtoBuf.loadProtoFile(__dirname+"/inner.proto"); + var fooCls = builder.build("Foo"); + var barCls = builder.build("Bar"); + var bazCls = builder.build("Baz"); + var foo = new fooCls(new barCls(str), new bazCls(str)); + var fooEncoded = foo.encode(); + test.doesNotThrow(function() { + fooCls.decode(fooEncoded); + }); + } catch (e) { + fail(e); + } + test.done(); + }, + + "float": function(test) { + try { + var builder = ProtoBuf.loadProto("message Foo { required Bar bar = 1; } message Bar { required float baz = 1; }"); + var root = builder.build(); + var foo = new root.Foo(new root.Bar(4)); + var bb = foo.encode(); + var foo2 = root.Foo.decode(bb); + test.equal(foo.bar.baz, 4); + test.equal(foo2.bar.baz, foo.bar.baz); + } catch (e) { + fail(e); + } + test.done(); + } + + }, + + "truncated": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test { required int32 a = 1; required int32 b = 2; }"); + var Test = builder.build("Test"); + var t = new Test(), bb = new ByteBuffer(2); + t.setA(1); + try { + bb = t.encode(bb).flip(); + test.ok(false); + } catch (e) { + test.ok(e.encoded); + bb = e.encoded.flip(); + test.equal(bb.toString("debug"), "<08 01>"); + } + var t2; + try /* to decode truncated message */ { + t2 = Test.decode(bb); + test.ok(false); // ^ throws + } catch (e) { + // But still be able to access the rest + var t3 = e.decoded; + test.strictEqual(t3.a, 1); + test.strictEqual(t3.b, null); + } + test.strictEqual(t2, undefined); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Options on all levels + "options": { + + "parse": function(test) { + try { + var parser = new ProtoBuf.DotProto.Parser(ProtoBuf.Util.fetch(__dirname+"/options.proto")); + var root = parser.parse(); + test.equal(root["package"], "My"); + test.strictEqual(root["options"]["(toplevel_1)"], 10); + test.equal(root["options"]["(toplevel_2)"], "Hello world!"); + var opt = root["messages"][0]["fields"][0]["options"]; + test.equal(opt["default"], "Max"); + opt = root["messages"][0]["options"]; + test.strictEqual(opt["(inmessage)"], "My.Test"); + test.strictEqual(opt["(foo.my_option).bar"], false); + opt = root["messages"][0]["fields"][1]["options"]; + test.strictEqual(opt["default"], "Shouldn't mix quotes"); + opt = root["messages"][0]["fields"][2]["options"]; + test.strictEqual(opt["default"], 'Shouldn"t mix quotes'); + opt = root["messages"][0]["fields"][3]["options"]; + test.strictEqual(opt["(foo_options).opt1"], 123); + test.strictEqual(opt["(foo_options).opt2"], "baz"); + } catch (e) { + fail(e); + } + test.done(); + }, + + "export": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/options.proto"); + var My = builder.build("My"); + test.deepEqual(My.$options, { + "(toplevel_1)": 10, + "(toplevel_2)": "Hello world!" + }); + test.strictEqual(My.$options['(toplevel_1)'], 10); + test.deepEqual(My.Test.$options, { + "(inmessage)": "My.Test", + "(foo.my_option).bar": false + }); + } catch (e) { + fail(e); + } + test.done(); + } + }, + + // Comments + "comments": function(test) { + try { + var tn = new ProtoBuf.DotProto.Tokenizer(ProtoBuf.Util.fetch(__dirname+'/comments.proto')); + var token, tokens = []; + do { + token = tn.next(); + tokens.push(token); + } while (token !== null); + test.deepEqual(tokens, ['message', 'TestC', '{', 'required', 'int32', 'a', '=', '1', ';', '}', null]); + } catch (e) { + fail(e); + } + test.done(); + }, + + // A more or less complex proto with type references + "complexProto": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/complex.proto"); + validateComplex(test, builder.build("Game")); + var TCars = builder.lookup("Game.Cars"); + test.strictEqual(TCars.fqn(), ".Game.Cars"); + } catch(e) { + fail(e); + } + test.done(); + }, + + // The same created without calling upon the parser to do so + "complexJSON": function(test) { + try { + var builder = ProtoBuf.loadJsonFile(__dirname+"/complex.json"); + validateComplex(test, builder.build("Game")); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Test error messages + "errorMessage": function(test) { + test.throws(function() { + var builder = ProtoBuf.loadJsonFile(__dirname+"/complex.json"); + var Game = builder.build("Game"); + var car = new Game.Cars.Car(); + car.speed = "hello"; + car.encode(); + }, /Illegal value for speed/); + test.done(); + }, + + // Builder reused to add definitions from multiple sources + "multiBuilder": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/example1.proto"); + ProtoBuf.loadProtoFile(__dirname+"/example2.proto", builder); + var ns = builder.build(); + test.ok(!!ns.Test1); + test.ok(!!ns.Test2); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Inner messages test + "inner": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/repeated.proto"); + var root = builder.build(), + Outer = root.Outer, + Inner = root.Inner; + // Empty + var outer = new Outer(); + var bb = new ByteBuffer(1).fill(0).flip(); + outer.encode(bb); + test.equal(bb.flip().toString("debug"), "|00"); + var douter = Outer.decode(bb); + test.ok(douter.inner instanceof Array); + test.equal(douter.inner.length, 0); + // Multiple + outer = new Outer({ inner: [new Inner(1), new Inner(2)] }); + bb = new ByteBuffer(8); + var size = outer.calculate(); + outer.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<0A 02 08 01 0A 02 08 02>"); + douter = Outer.decode(bb); + test.ok(douter.inner instanceof Array); + test.equal(douter.inner.length, 2); + test.equal(douter.inner[0].inner_value, 1); + test.equal(douter.inner[1].inner_value, 2); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Packed vs. not packed repeated fields test + "packed": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/packed.proto"); + var Message = builder.build("Message"); + // Both empty + var message = new Message(); + var bb = new ByteBuffer(1).fill(0).flip(); + var size = message.calculate(); + message.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "|00"); + message = Message.decode(bb); + test.ok(message.a instanceof Array); + test.equal(message.a.length, 0); + test.ok(message.b instanceof Array); + test.equal(message.b.length, 0); + // Both non-empty + message = new Message([1,2,3], [1,2,3]); + size = message.calculate(); + message.encode(bb.resize(11)); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<0A 03 01 02 03 10 01 10 02 10 03>"); + message = Message.decode(bb); + test.ok(message.a instanceof Array); + test.equal(message.a.length, 3); + test.deepEqual(message.a, [1,2,3]); + test.ok(message.b instanceof Array); + test.equal(message.b.length, 3); + test.deepEqual(message.b, [1,2,3]); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Legacy groups test + "groups": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/groups.proto"); + var root = builder.build(); + var Outer = root.Outer; + var TOuter = builder.ns.getChild("Outer"); + var TInner = TOuter.getChild("MyInner"); + test.ok(TInner instanceof ProtoBuf.Reflect.Message); + test.strictEqual(TInner.isGroup, true); + var Tinner = TOuter.getChild("myinner"); + test.ok(Tinner instanceof ProtoBuf.Reflect.Message.Field); + test.strictEqual(Tinner.id, 2); + test.deepEqual(Tinner.options, { "deprecated": true }); + var Inner = root.Outer.MyInner; + var outer = new Outer("a", [new Inner("hello")], "b", new Inner("world")); + var bb = new ByteBuffer(); + var size = outer.calculate(); + outer.encode(bb); + test.strictEqual(bb.offset, size); + bb.flip().compact(); + var wiredMsg = [ + "0A", // 1|010 = id 1, wire type 2 (ldelim) + "01", // length 1 + "61", // "a" + "13", // 10|011 = id 2, wire type 3 (start group) + "1A", // 11|010 = id 3, wire type 2 (ldelim) + "05", // length 5 + "68 65 6C 6C 6F", // "hello" + "14", // 10|100 = id 2, wire type 4 (end group) + "22", // 100|010 = id 4, wire type 2 (ldelim) + "01", // length 1 + "62", // "b" + "2B", // 101|011 = id 5, wire type = 3 (start group) + "1A", // 11|010 = id 3, wire type = 2 (ldelim) + "05", // length 5 + "77 6F 72 6C 64", // "world" + "2C" // 101|100 = id 5, wire type = 4 (end group) + ]; + test.equal(bb.toString("debug"), "<" +wiredMsg.join(" ") + ">"); + var douter = Outer.decode(bb); + test.strictEqual(douter.before, "a"); + test.strictEqual(douter.myinner.length, 1); + test.strictEqual(douter.myinner[0].a, "hello"); + test.strictEqual(douter.after, "b"); + bb.offset = 0; + douter = root.OuterSparse.decode(bb); + test.strictEqual(bb.offset, bb.limit); + test.strictEqual(douter.before, "a"); + test.strictEqual(douter.after, "b"); + } catch (e) { + fail(e); + } + test.done(); + }, + + "x64Fixed": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/x64.proto"); + var Test = builder.build("Test"); + var myTest = new Test(); + test.ok(myTest.val instanceof ByteBuffer.Long); + test.equal(myTest.val.unsigned, false); + test.equal(myTest.val.toNumber(), -1); + test.ok(myTest.uval instanceof ByteBuffer.Long); + test.equal(myTest.uval.unsigned, true); + test.equal(myTest.uval.toNumber(), 1); + myTest.setVal(-2); + myTest.setUval(2); + var bb = new ByteBuffer(18); // 2x tag + 2x 64bit + var size = myTest.calculate(); + myTest.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<09 FE FF FF FF FF FF FF FF 11 02 00 00 00 00 00 00 00>"); + // ^ wireType=1, id=1 ^ wireType=1, id=2 + myTest = Test.decode(bb); + test.ok(myTest.val instanceof ByteBuffer.Long); + test.equal(myTest.val.unsigned, false); + test.equal(myTest.val.toNumber(), -2); + test.ok(myTest.uval instanceof ByteBuffer.Long); + test.equal(myTest.uval.unsigned, true); + test.equal(myTest.uval.toNumber(), 2); + } catch (e) { + fail(e); + } + test.done(); + }, + + "x64Varint": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/x64.proto"); + var Test = builder.build("Test2"); + var Test = builder.build("Test2"); + var myTest = new Test(); + test.ok(myTest.val instanceof ByteBuffer.Long); + test.equal(myTest.val.unsigned, false); + test.equal(myTest.val.toNumber(), -1); + test.ok(myTest.uval instanceof ByteBuffer.Long); + test.equal(myTest.uval.unsigned, true); + test.equal(myTest.uval.toNumber(), 1); + test.ok(myTest.sval instanceof ByteBuffer.Long); + test.equal(myTest.sval.unsigned, false); + test.equal(myTest.sval.toNumber(), -2); + + myTest.setVal(-2); + myTest.setUval(2); + myTest.setSval(-3); + var bb = new ByteBuffer(3+10+2); // 3x tag + 1x varint 10byte + 2x varint 1byte + var size = myTest.calculate(); + myTest.encode(bb); + test.strictEqual(bb.offset, size); + test.equal(bb.flip().toString("debug"), "<08 FE FF FF FF FF FF FF FF FF 01 10 02 18 05>"); + // 08: wireType=0, id=1, 18: wireType=0, id=2, ?: wireType=0, id=3 + myTest = Test.decode(bb); + test.ok(myTest.val instanceof ByteBuffer.Long); + test.equal(myTest.val.unsigned, false); + test.equal(myTest.val.toNumber(), -2); + test.ok(myTest.uval instanceof ByteBuffer.Long); + test.equal(myTest.uval.unsigned, true); + test.equal(myTest.uval.toNumber(), 2); + test.ok(myTest.sval instanceof ByteBuffer.Long); + test.equal(myTest.sval.unsigned, false); + test.equal(myTest.sval.toNumber(), -3); + } catch (e) { + fail(e); + } + test.done(); + }, + + "keywords": function(test) { + try { + var builder = ProtoBuf.loadProto("message Reserved { optional string get = 1; }"); + var My = builder.build(); + var myTest = new My.Reserved("a"); + test.doesNotThrow(function() { + myTest.encode(); + }); + } catch (e) { + fail(e); + } + test.done(); + }, + + "imports": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/imports.proto"); + var root = builder.build(); + test.ok(!!root.Test1); + test.ok(!!root.Test2); + test.ok(!!root.My.Test3); + test.notEqual(root.Test2, root.My.Test2); + } catch (e) { + fail(e); + } + test.done(); + }, + + "weakImports": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/imports-weak.proto"); + var root = builder.build(); + } catch (e) { + test.ok(e.message.indexOf("unresolvable type reference") >= 0); + test.done(); + return; + } + var e = new Error("Weak import was imported."); + fail(e); + }, + + "importExtensions": function(test) { + var x = "package x; \ + message Test { \ + extensions 1 to 10; \ + } \ + extend Test { \ + optional int32 first_val = 1; \ + }"; + var y = "package y; \ + extend x.Test { \ + optional int32 second_val = 2; \ + }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(x, builder); + ProtoBuf.loadProto(y, builder); + var Test = builder.build('x.Test'); + var inst = new Test(); + test.strictEqual(inst[".x.first_val"], null); + test.strictEqual(inst[".y.second_val"], null); + test.done(); + }, + + "toplevel": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/toplevel.proto"); + var My = builder.build("My"); + test.ok(!!My.MyEnum); + test.equal(My.MyEnum.ONE, 1); + test.equal(My.MyEnum.TWO, 2); + test.ok(!!My.Test); + var myTest = new My.Test(); + test.equal(myTest.num, My.MyEnum.ONE); + } catch (e) { + fail(e); + } + test.done(); + }, + + "importsToplevel": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/imports-toplevel.proto"); + var My = builder.build("My"); + test.ok(!!My.MyEnum); + test.equal(My.MyEnum1.ONE, 1); + test.equal(My.MyEnum1.TWO, 2); + test.ok(!!My.Test1); + var myTest = new My.Test1(); + test.equal(myTest.num, My.MyEnum.ONE); + test.equal(myTest.num1, My.MyEnum1.ONE); + } catch (e) { + fail(e); + } + test.done(); + }, + + "importDuplicate": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/import_a.proto"); + test.doesNotThrow(function() { + ProtoBuf.loadProtoFile(__dirname+"/import_b.proto", builder); + }); + var root = builder.build(); + test.ok(root.A); + test.ok(root.B); + test.ok(root.Common); + } catch (e) { + fail(e); + } + test.done(); + }, + + "importDuplicateDifferentBuilder": function(test) { + try { + var builderA = ProtoBuf.loadProtoFile(__dirname+"/import_a.proto"); + var builderB; + test.doesNotThrow(function() { + builderB = ProtoBuf.loadProtoFile(__dirname+"/import_b.proto"); + }); + var rootA = builderA.build(); + var rootB = builderB.build(); + test.ok(rootA.A); + test.ok(rootB.B); + test.ok(rootA.Common); + test.ok(rootB.Common); + } catch (e) { + fail(e); + } + test.done(); + }, + + "dupimport": function(test) { + try { + // Suppress logging result to stdout + fixture.capture(function() { return false;}); + require(__dirname+"/../cli/pbjs.js").main(["node", "bin/pbjs", __dirname+"/dupimport/main.proto", "--quiet"]); + fixture.release(); + } catch (e) { + fixture.release(); + fail(e); + } + test.done(); + }, + + "field_name_same_as_package": function(test) { + try { + fixture.capture(function() { return false;}); + require(__dirname+"/../cli/pbjs.js").main(["node", "bin/pbjs", __dirname+"/field_name_same_as_package/main.proto", "--quiet"]); + fixture.release(); + } catch (e) { + fixture.release(); + fail(e); + } + test.done(); + }, + + "importRoot": function(test) { + try { + var builder = ProtoBuf.loadProtoFile({ + root: __dirname, + file: "importRoot/file1.proto" + }); + var Test = builder.build("Test"); + test.ok(new Test() instanceof ProtoBuf.Builder.Message); + } catch (e) { + fail(e); + } + test.done(); + }, + + "extend": function(test) { + try { + var ast = new ProtoBuf.DotProto.Parser(fs.readFileSync(__dirname+"/extend.proto")).parse(); + test.deepEqual(ast, { package: null, + messages: + [ { ref: 'google.protobuf.MessageOptions', + fields: + [ { rule: 'optional', + type: 'int32', + name: 'foo', + options: {}, + id: 1001 } ] }, + { name: 'Foo', + fields: [], + enums: [], + messages: [], + options: {}, + services: [], + oneofs: {}, + extensions: [ [ 2, 536870911 ] ] }, + { ref: 'Foo', + fields: + [ { rule: 'optional', + type: 'string', + name: 'bar', + options: {}, + id: 2 } ] }, + { name: 'Bar', + fields: [], + enums: [], + messages: + [ { name: 'Foo', + fields: [], + enums: [], + messages: [], + options: {}, + services: [], + oneofs: {} }, + { ref: '.Foo', + fields: [ { rule: 'optional', type: 'Foo', name: 'foo', options: {}, id: 3 } ] } ], + options: {}, + services: [], + oneofs: {} } ], + enums: [], + imports: [ 'google/protobuf/descriptor.proto' ], + options: {}, + services: [] } + ); + + var builder = ProtoBuf.loadProtoFile(__dirname+"/extend.proto"); + var TFoo = builder.lookup(".Foo"), + TBar = builder.lookup(".Bar"), + TBarFoo = builder.lookup(".Bar.Foo"), + fields = TFoo.getChildren(ProtoBuf.Reflect.Message.Field); + test.strictEqual(fields.length, 2); + test.strictEqual(fields[0].name, ".bar"); + test.strictEqual(fields[0].id, 2); + test.strictEqual(fields[1].name, ".Bar.foo"); + test.strictEqual(fields[1].id, 3); + test.deepEqual(TFoo.extensions, [[2, ProtoBuf.ID_MAX]]); // explicitly defined + test.strictEqual(TBar.extensions, undefined); // none defined + test.deepEqual(TBar.getChild("foo"), { builder: builder, parent: TBar, name: "foo", field: TFoo.getChild('.Bar.foo') }); + test.strictEqual(TBar.getChildren(ProtoBuf.Reflect.Message.Field).length, 0); + var root = builder.build(); + test.strictEqual(TFoo.getChild(".Bar.foo").resolvedType, TBarFoo); // .Bar.Foo, not .Foo + var foo = new root.Foo(), + bar = new root.Bar(); + foo['.bar'] = "123"; + foo['.Bar.foo'] = bar; + test.equal(foo.encode().compact().toString("debug"), "<12 03 31 32 33 1A 00>"); + } catch (e) { + fail(e); + } + test.done(); + }, + + // Custom options on all levels + // victorr (https://github.com/victorr) + "customOptions": function(test) { + try { + var parser = new ProtoBuf.DotProto.Parser(ProtoBuf.Util.fetch(__dirname+"/custom-options.proto")); + var root = parser.parse(); + test.equal(root["options"]["(my_file_option)"], "Hello world!"); + test.equal(root["messages"][7]["options"]["(my_message_option)"], 1234); + test.equal(root["messages"][7]["fields"][0]["options"]["(my_field_option)"], 4.5); + // test.equal(root["services"]["MyService"]["options"]["my_service_option"], "FOO"); + // TODO: add tests for my_enum_option, my_enum_value_option + } catch (e) { + fail(e); + } + test.done(); + }, + + "oneofs": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/oneof.proto"), + MyOneOf = builder.build("MyOneOf"), + TOneOf = builder.lookup(".MyOneOf"); + test.ok(TOneOf.getChild("my_oneof")); + var myOneOf = new MyOneOf(); + test.strictEqual(myOneOf.my_oneof, null); + myOneOf.set("id", 1); + test.strictEqual(myOneOf.my_oneof, "id"); + myOneOf.set("name", "me"); + test.strictEqual(myOneOf.my_oneof, "name"); + test.strictEqual(myOneOf.id, null); + var bb = myOneOf.encode().compact(); + test.strictEqual(bb.toString("debug"), "<12 02 6D 65>"); // id 2, wt 2, len 2 + myOneOf = MyOneOf.decode(bb); + test.strictEqual(myOneOf.my_oneof, "name"); + test.strictEqual(myOneOf.name, "me"); + test.strictEqual(myOneOf.id, null); + } catch (e) { + fail(e); + } + test.done(); + }, + + "services": function(test) { + try { + var parser = new ProtoBuf.DotProto.Parser(ProtoBuf.Util.fetch(__dirname+"/custom-options.proto")); + var root = parser.parse(); + test.deepEqual(root["services"], [{ + "name": "MyService", + "rpc": { + "MyMethod": { + "request": "RequestType", + "response": "ResponseType", + "request_stream": false, + "response_stream": false, + "options": { + "(my_method_option).foo": 567, + "(my_method_option).bar": "Some string" + } + } + }, + "options": { + "(my_service_option)": "FOO" + } + }]); + + var builder = ProtoBuf.loadProtoFile(__dirname+"/custom-options.proto"); + var root = builder.build(), + MyService = root.MyService, + RequestType = root.RequestType, + ResponseType = root.ResponseType, + called = false; + + test.deepEqual(MyService.$options, { + "(my_service_option)": "FOO" + }); + test.deepEqual(MyService.MyMethod.$options, { + "(my_method_option).foo": 567, + "(my_method_option).bar": "Some string" + }); + + // Provide the service with your actual RPC implementation based on whatever framework you like most. + var myService = new MyService(function(method, req, callback) { + test.strictEqual(method, ".MyService.MyMethod"); + test.ok(req instanceof RequestType); + called = true; + + // In this case we just return no error and our pre-built response. This must be properly async! + setTimeout(callback.bind(this, null, (new ResponseType()).encode() /* as raw bytes for debugging */ )); + }); + + test.deepEqual(myService.$options, MyService.$options); + test.deepEqual(myService.MyMethod.$options, MyService.MyMethod.$options); + + // Call the service with your request message and provide a callback. This will call your actual service + // implementation to perform the request and gather a response before calling the callback. If the + // request or response type is invalid i.e. not an instance of RequestType or ResponseType, your + // implementation will not be called as ProtoBuf.js handles this case internally and directly hands the + // error to your callback below. + myService.MyMethod(new RequestType(), function(err, res) { + // We get: err = null, res = our prebuilt response. And that's it. + if (err !== null) { + fail(err); + } + test.strictEqual(called, true); + test.ok(res instanceof ResponseType); + test.done(); + }); + myService.MyMethod(new RequestType().encode(), function(err, res) { + // We get: err = null, res = our prebuilt response. And that's it. + if (err !== null) { + fail(err); + } + test.strictEqual(called, true); + test.ok(res instanceof ResponseType); + test.done(); + }); + } catch (e) { + fail(e); + } + }, + + // Properly ignore "syntax" and "extensions" keywords + // The corresponding .proto file has been removed upon request + /* "gtfs-realtime": function(test) { + try { + test.doesNotThrow(function() { + ProtoBuf.loadProtoFile(__dirname+"/gtfs-realtime.proto"); + }); + } catch (e) { + fail(e); + } + test.done(); + }, */ + + "delimited": function(test) { + try { + var builder = ProtoBuf.loadProto("message Position { required int32 x = 1; required int32 y = 2; }"); + var Position = builder.build("Position"); + var bb = new ByteBuffer(); + for (var i=0; i<2; i++) { + var position = new Position(10,10); + position.encodeDelimited(bb); + } + bb.flip(); + for (i=0; i<2; i++) { + position = Position.decodeDelimited(bb); + test.strictEqual(position.x, 10); + test.strictEqual(position.y, 10); + } + } catch (e) { + fail(e); + } + test.done(); + }, + + "stringify": function(test) { + try { + var builder = ProtoBuf.loadProto("message Position { required int32 x = 1; required int64 y = 2; }"); + var Position = builder.build("Position"); + var position = new Position(1, ProtoBuf.Long.fromNumber(2)); + var json = JSON.stringify(position); + test.strictEqual(json, '{"x":1,"y":{"low":2,"high":0,"unsigned":false}}'); + position = new Position(JSON.parse(json)); + test.strictEqual(position.x, 1); + test.ok(position.y instanceof ProtoBuf.Long); + test.deepEqual(position.y, {"low":2,"high":0,"unsigned":false}); + // Also test if this encodes and decodes properly + position = Position.decode(position.encode()); + test.ok(position.y instanceof ProtoBuf.Long); + test.deepEqual(position.y, {"low": 2, "high": 0, "unsigned": false }); + } catch (e) { + fail(e); + } + test.done(); + }, + + "fields": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/optional.proto"); + var Test1 = builder.build("Test1"); + var test1 = new Test1(); + test.strictEqual(test1.a, null); + test.deepEqual(Object.keys(test1), ['a','b']); + var bb = test1.encode(); + test1 = Test1.decode(bb); + test.strictEqual(test1.a, null); + test.deepEqual(Object.keys(test1), ['a','b']); + } catch (e) { + fail(e); + } + test.done(); + }, + + "fieldsToCamelCase": function(test) { + try { + ProtoBuf.convertFieldsToCamelCase = true; + var builder = ProtoBuf.loadProtoFile(__dirname+"/camelcase.proto"); + var Test = builder.build("Test"), + TTest = builder.lookup("Test"); + var msg = new Test(); + + // Reverted collision on 1st + test.strictEqual(msg.some_field, null); + test.strictEqual(msg.someField, null); + test.equal(TTest.getChild("some_field").id, 1); + test.equal(TTest.getChild("someField").id, 2); + + + // Reverted collision on 2nd + test.strictEqual(msg.aField, null); + test.strictEqual(msg.a_field, null); + test.equal(TTest.getChild("aField").id, 3); + test.equal(TTest.getChild("a_field").id, 4); + + // No collision + test.strictEqual(msg.itsAField, null); + test.equal(TTest.getChild("itsAField").id, 5); + + test.ok(typeof msg.set_its_a_field === "function"); + test.ok(typeof msg.setItsAField === "function"); + + ProtoBuf.convertFieldsToCamelCase = false; + } catch (e) { + ProtoBuf.convertFieldsToCamelCase = false; + fail(e); + } + test.done(); + }, + + "setarray": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/setarray.proto"); + var root = builder.build(), + Outer = root.Outer, + Inner = root.Inner, + inners = []; + + // Array of repeated messages + inners.push(new Inner("a"), new Inner("b"), new Inner("c")); + var outer = new Outer(); + outer.setInners(inners); + test.deepEqual(outer.inners, inners); + + // Array of repeated message objects + inners = []; + inners.push({ str: 'a' }, { str: 'b' }, { str: 'c' }); + outer.setInners(inners); // Converts + test.ok(outer.inners[0] instanceof Inner); + test.deepEqual(outer.inners, inners); + } catch (e) { + fail(e); + } + test.done(); + }, + + + // Make sure that our example at https://github.com/dcodeIO/ProtoBuf.js/wiki is not nonsense + "pingexample": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/PingExample.proto"); + var Message = builder.build("Message"); + var msg = new Message(); + msg.ping = new Message.Ping(123456789); + var bb = msg.encode(); + test.strictEqual(bb.limit, 7); + msg = Message.decode(bb); + test.ok(msg.ping); + test.notOk(msg.pong); + test.strictEqual(msg.ping.time, 123456789); + } catch (e) { + fail(e); + } + test.done(); + }, + + "negInt32": function(test) { + try { + var builder = ProtoBuf.loadProto("message Test { required int32 value = 2; }"); + var Test = builder.build("Test"); + var t = new Test(-1); + var size = t.calculate(); + var bb = t.encode(); // flips + test.strictEqual(bb.remaining(), size); + test.strictEqual(bb.toBase64(), "EP///////////wE="); + t = Test.decode(bb); + test.strictEqual(t.value, -1); + } catch (e) { + fail(e); + } + test.done(); + }, + + "negEnumId": function(test) { + try { + test.doesNotThrow(function() { + var builder = ProtoBuf.loadProtoFile(__dirname+"/negid.proto"); + var Test = builder.build("Test"); + test.strictEqual(Test.LobbyType.INVALID, -1); + var t = new Test(Test.LobbyType.INVALID); + test.strictEqual(t.type, -1); + var size = t.calculate(); + var bb = t.encode(); // flips + test.strictEqual(bb.remaining(), size); + t = Test.decode(bb); + test.strictEqual(t.type, -1); + }); + } catch (e) { + fail(e); + } + test.done(); + }, + + "base64": function(test) { + try { + var Message = ProtoBuf.loadProto("message Message { required string s = 1; }").build("Message"); + var msg = new Message("ProtoBuf.js"); + var b64 = msg.toBase64(); + test.strictEqual(b64, "CgtQcm90b0J1Zi5qcw=="); + var msg2 = Message.decode64(b64); + test.deepEqual(msg, msg2); + msg2 = Message.decode(b64, "base64"); + test.deepEqual(msg, msg2); + } catch (e) { + fail(e); + } + test.done(); + }, + + "hex": function(test) { + try { + var Message = ProtoBuf.loadProto("message Message { required string s = 1; }").build("Message"); + var msg = new Message("ProtoBuf.js"); + var hex = msg.toHex(); + test.strictEqual(hex, "0a0b50726f746f4275662e6a73"); + var msg2 = Message.decodeHex(hex); + test.deepEqual(msg, msg2); + msg2 = Message.decode(hex, "hex"); + test.deepEqual(msg, msg2); + } catch (e) { + fail(e); + } + test.done(); + }, + + "forwardComp": function(test) { + try { + var Message = ProtoBuf.loadProto("message Message { required int32 a = 1; required string b = 2; required float c = 3; }").build("Message"); + var msg = new Message(123, "abc", 0.123); + var bb = msg.encode(); + Message = ProtoBuf.loadProto("message Message {}").build("Message"); + test.doesNotThrow(function() { + Message.decode(bb); + }); + test.strictEqual(bb.offset, bb.limit); + } catch (e) { + fail(e); + } + test.done(); + }, + + "tokenizerLine": function(test) { + try { + var parser = new ProtoBuf.DotProto.Parser("package test;\n\nmessage Message {\n\trequired string invalid = 1;}ERROR\n"), + ast = null, err = null; + try { + ast = parser.parse(); + } catch (caught) { + err = caught; + } + test.ok(err); + test.notOk(ast); + test.ok(err.message.indexOf("line 4:") >= 0); + } catch (e) { + fail(e); + } + test.done(); + }, + + "excludeFields": function(test) { + try { + var builder = ProtoBuf.loadProto("message A { required int32 i = 1; } message B { required A A = 1; }"); + builder.build(); + } catch (e) { + fail(e); + } + test.done(); + }, + + "proto2jsExtend": function(test) { + try { + var builder = ProtoBuf.loadJsonFile(__dirname+"/proto2js/Bar.json"); + builder.build(); + } catch (e) { + fail(e); + } + test.done(); + }, + + "emptyMessage": function(test) { + try { + var builder = ProtoBuf.loadProto("message EmptyMessage {}"), + EmptyMessage = builder.build("EmptyMessage"); + + var msg = new EmptyMessage(), + ab = msg.toArrayBuffer(); + test.strictEqual(ab.byteLength, 0); + } catch (e) { + fail(e); + } + test.done(); + }, + + "toRaw": function(test) { + try { + var builder = ProtoBuf.loadProto("message MyMessage { required int32 a = 1; required int32 b = 2; required bytes c = 3; }"), + MyMessage = builder.build("MyMessage"); + var raw = { a: 1, b: 2, c: "YWJj" }, + myMessage = new MyMessage(raw); + test.deepEqual(myMessage.c.toBase64(), raw.c); + test.deepEqual(myMessage.toRaw(true), raw); + } catch (e) { + fail(e); + } + test.done(); + }, + + "singleQuotedString": function(test) { + try{ + var builder = ProtoBuf.loadProtoFile(__dirname+"/string_single_quote.proto"); + var TestSingleQuoteString = builder.build("TestSingleQuoteString"); + test.ok(typeof TestSingleQuoteString == 'function'); + } catch (e) { + fail(e); + } + test.done(); + }, + + "importDuplicateSingleQuote": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/import_a_single_quote.proto"); + test.doesNotThrow(function() { + ProtoBuf.loadProtoFile(__dirname+"/import_b.proto", builder); + }); + var root = builder.build(); + test.ok(root.A); + test.ok(root.B); + test.ok(root.Common); + } catch (e) { + fail(e); + } + test.done(); + }, + + "importStringSuccessively": function(test) { + try { + var proto1 = "message A { required string a = 1; };"; + var proto2 = "import \"proto1.proto\"; message B { required A a = 1; };"; + var builder = ProtoBuf.loadProto(proto1, "proto1.proto"); + ProtoBuf.loadProto(proto2, builder, "proto2.proto"); + var root = builder.build(); + test.ok(root.A); + test.ok(root.B); + } catch (e) { + fail(e); + } + test.done(); + }, + + "multilineString": function(test) { + try { + var proto = "message TestMessage { required string test = 1 [default = \"1\" \"2\"\n\"3\"];}"; + var builder = ProtoBuf.loadProto(proto, "multilineString.proto"); + var TestMessage = builder.build("TestMessage"), + testMessage = new TestMessage(); + test.strictEqual(testMessage.test, "123"); + test.done(); + } catch (e) { + fail(e); + } + test.done(); + }, + + "packable": function(test) { + try { + var proto = 'message Inner { required int32 id=2; }\nmessage Outer { repeated Inner inner = 1 [packed=true]; }'; + var builder = ProtoBuf.loadProto(proto); + var root = builder.build(); + var inner = new root.Inner(1), + outer = new root.Outer(inner); + var bb = outer.encode().compact(); + test.strictEqual(bb.toDebug(), "<0A 02 10 01>"); + // 0A: wt 2, id 1 + // 02: len 2 + // 10: wt 0, id 2 + // 01: 1 + var outer2 = root.Outer.decode(bb); + test.strictEqual(outer2.inner.id, 1); + } catch (e) { + fail(e); + } + test.done(); + }, + + "$type": function(test) { + var builder = ProtoBuf.loadProto("message Test {}"); + var Test = builder.build("Test"), + TTest = builder.lookup("Test"); + test.strictEqual(new Test().$type, TTest); + test.done(); + }, + + "descriptor": function(test) { + try { + var proto = 'import "./google/protobuf/descriptor.proto";'; + var builder = ProtoBuf.loadProto(proto, "tests/proto.proto"); + var root = builder.build("google.protobuf"); + test.ok(root.FileDescriptorSet); + } catch (e) { + fail(e); + } + test.done(); + }, + + "mismatchedNesting": function(test) { + try { + var proto = "message Child { optional uint32 foo = 1; } message FakeChild { optional uint32 foo = 1; } message Parent { optional Child child = 1; }"; + var builder = ProtoBuf.loadProto(proto, "tests/mismatchedNesting.proto"); + var root = builder.build(); + var foo = new root.Parent({ child: new root.FakeChild({ foo: 1 })}); + } catch (e) { + fail(e); + } + test.done(); + }, + + /* "mismatchedType": function(test) { + try { + var proto = "message Test1 { optional string foo = 1; }"; + proto += "message Test2 { optional int32 foo = 1; }"; + var builder = ProtoBuf.loadProto(proto, "tests/mistmatchedType.proto"); + var root = builder.build(); + var test1 = new root.Test1({ foo: 'bar' }); + var test2 = root.Test2.decode(test1.encode()); + } catch (e) { + fail(e); + } + test.done(); + }, */ + + "builderOptions": function(test) { + try { + var proto = "message Foo { optional uint32 foo_bar = 1; }"; + var builder = ProtoBuf.newBuilder({ + convertFieldsToCamelCase: true + }); + ProtoBuf.loadProto(proto, builder, "tests/builderOptions.proto"); + var Foo = builder.build("Foo"); + test.strictEqual(ProtoBuf.convertFieldsToCamelCase, false); + test.strictEqual(builder.options.convertFieldsToCamelCase, true); + var foo = new Foo(); + test.ok(typeof foo.fooBar !== 'undefined'); + test.ok(typeof foo.foo_bar === 'undefined'); + test.done(); + } catch (e) { + fail(e); + } + test.done(); + }, + + "proto3": function(test) { + try { + var builder = ProtoBuf.loadProtoFile(__dirname+"/proto3.proto"); + test.doesNotThrow(function() { + ProtoBuf.loadProtoFile(__dirname+"/proto3.proto", builder); + }); + var root = builder.build(); + test.ok(root.test.Foo.$type.syntax === 'proto3'); + } catch (e) { + fail(e); + } + test.done(); + }, + + // FIXME: This test relied on some bloated builder functionality that has been removed. + // Is it even mandatory to strictly disallow proto2/3 mixing, even if that would be illegal in the official + // implementation? + /* "proto3DisallowedFeatures": function(test) { + try { + // Required field + var proto = "syntax = \"proto3\"; message Foo { required int32 field = 1; }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "tests/proto3DisallowedFeatures.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Not a valid definition/.test(e.message)); + } + + try { + // Field with default value + var proto = "syntax = \"proto3\"; message Foo { int32 field = 1 [default=42]; }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "tests/proto3DisallowedFeatures.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Not a valid definition/.test(e.message)); + } + + try { + // Message with extension range + var proto = "syntax = \"proto3\"; message Foo { extensions 100 to max; } "; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "tests/proto3DisallowedFeatures.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Not a valid definition/.test(e.message)); + } + + try { + // Message with extension + var proto = "syntax = \"proto3\"; message Foo { extensions 100 to max; } " + + "message Bar { extend Foo { optional Bar bar = 100; } }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "tests/proto3DisallowedFeatures.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Not a valid definition/.test(e.message)); + } + + try { + // Enum with non-zero first entry. + var proto = "syntax = \"proto3\"; enum E { A = 1; B = 2; }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "tests/proto3DisallowedFeatures.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Not a valid definition/.test(e.message)); + } + + try { + // Proto3 message referring to proto2 enum. + var proto2 = "syntax = \"proto2\"; enum E { A = 1; B = 2; }"; + var proto3 = "syntax = \"proto3\"; message Test { E enum_field = 1; }"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto2, builder, "tests/proto3DisallowedFeatures1.proto"); + ProtoBuf.loadProto(proto3, builder, "tests/proto3DisallowedFeatures3.proto"); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(/^Proto3 message refers to proto2 enum/.test(e.message)); + } + + test.done(); + }, */ + + "proto3FieldPresence": function(test) { + var proto = + "syntax = \"proto3\";\n" + + "message Test {\n" + + " int32 field_int32 = 1;\n" + + " int64 field_int64 = 2;\n" + + " string field_str = 3;\n" + + " bytes field_bytes = 4;\n" + + " Test field_msg = 5;\n" + + " Enum field_enum = 6;\n" + + " repeated int32 rpt_int32 = 11;\n" + + " repeated int64 rpt_int64 = 12;\n" + + " repeated string rpt_str = 13;\n" + + " repeated bytes rpt_bytes = 14;\n" + + " repeated Test rpt_msg = 15;\n" + + " repeated Enum rpt_enum = 16;\n" + + " oneof oneof_type { bool oneof_bool = 17; };\n" + + "}\n" + + "enum Enum { Default = 0; A = 1; B = 2; }\n"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "test/proto3FieldPresence.proto"); + var Test = builder.build('Test'), + Enum = builder.build('Enum'); + + var testMsg = new Test(); + test.strictEqual(testMsg.field_int32, 0); + test.strictEqual(testMsg.field_int64.low, 0); + test.strictEqual(testMsg.field_int64.high, 0); + test.strictEqual(testMsg.field_str, ""); + test.strictEqual(testMsg.field_msg, null); + test.ok(testMsg.field_bytes instanceof ByteBuffer); + test.strictEqual(testMsg.field_bytes.remaining(), 0); + test.strictEqual(testMsg.rpt_int32.length, 0); + test.strictEqual(testMsg.oneof_type, null); + test.strictEqual(testMsg.oneof_bool, false); + + // No fields should go on the wire, even though they're set + var encoded = testMsg.encode(); + test.strictEqual(encoded.remaining(), 0); + testMsg.field_int32 = 42; + encoded = testMsg.encode(); + test.strictEqual(encoded.remaining(), 2); + testMsg.field_int32 = 0; + encoded = testMsg.encode(); + test.strictEqual(encoded.remaining(), 0); + + // Enum fields should be able to carry arbitrary values. + testMsg.field_enum = 42; + test.strictEqual(testMsg.field_enum, 42); + encoded = testMsg.encode(); + testMsg = Test.decode(encoded); + test.strictEqual(testMsg.field_enum, 42); + + // Explicitly set fields that are part of an oneof should + // be encoded even if set to their default value + testMsg = new Test(); + testMsg.set("oneof_bool", false); + test.strictEqual(testMsg.oneof_type, "oneof_bool"); + encoded = testMsg.encode().compact(); + test.strictEqual(encoded.toString("debug"), "<88 01 00>"); // 17|varint (0term) + varint 0 + var decoded = Test.decode(encoded); + test.strictEqual(decoded.oneof_type, "oneof_bool"); + test.strictEqual(decoded.oneof_bool, false); + + test.done(); + }, + + "mapContainer": function(test) { + var proto = + "message Test {\n" + + " map map_string_int32 = 1;\n" + + " map map_string_int64 = 2;\n" + + " map map_string_string = 3;\n" + + " map map_string_msg = 4;\n" + + " map map_string_enum = 5;\n" + + " map map_int32_string = 6;\n" + + " map map_int64_string = 7;\n" + + " map map_bool_string = 9;\n" + + "}\n" + + "enum Enum { Default = 0; A = 1; B = 2; }\n"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "test/mapContainer.proto"); + + var map_string_int32 = + new ProtoBuf.Map(builder.lookup("Test.map_string_int32")); + test.strictEqual(map_string_int32.size, 0); + test.strictEqual(map_string_int32.has("asdf"), false); + test.strictEqual(map_string_int32.get("asdf"), undefined); + map_string_int32.set("asdf", 42); + test.strictEqual(map_string_int32.has("asdf"), true); + test.strictEqual(map_string_int32.get("asdf"), 42); + + var it = map_string_int32.keys(); + var itVal = it.next(); + test.strictEqual(itVal.done, false); + test.strictEqual(itVal.value, "asdf"); + itVal = it.next(); + test.strictEqual(itVal.done, true); + + it = map_string_int32.values(); + itVal = it.next(); + test.strictEqual(itVal.done, false); + test.strictEqual(itVal.value, 42); + itVal = it.next(); + test.strictEqual(itVal.done, true); + + it = map_string_int32.entries(); + itVal = it.next(); + test.strictEqual(itVal.done, false); + test.deepEqual(itVal.value, ["asdf", 42]); + itVal = it.next(); + test.strictEqual(itVal.done, true); + + map_string_int32.set("jkl;", 84); + test.strictEqual(map_string_int32.has("jkl;"), true); + test.strictEqual(map_string_int32.has("asdf"), true); + test.strictEqual(map_string_int32.size, 2); + map_string_int32.delete("jkl;"); + test.strictEqual(map_string_int32.has("jkl;"), false); + test.strictEqual(map_string_int32.get("jkl;"), undefined); + test.strictEqual(map_string_int32.size, 1); + + map_string_int32.clear(); + test.strictEqual(map_string_int32.size, 0); + + try { + map_string_int32.set("asdf", 42.1); + test.ok(false); // ^ should throw + } catch(e) { + test.ok(e.message.match(/not an integer/)); + } + + try { + map_string_int32.set(42, 42); + test.ok(false); // ^ should throw + } catch(e) { + test.ok(e.message.match(/not a string/)); + } + + // Test various key types to ensure that value->string->value + // conversion works. + var map_int32_string = + new ProtoBuf.Map(builder.lookup("Test.map_int32_string")); + test.strictEqual(map_int32_string.size, 0); + map_int32_string.set(12345678, "asdf"); + test.strictEqual(map_int32_string.size, 1); + test.strictEqual(map_int32_string.has(12345678), true); + test.strictEqual(map_int32_string.get(12345678), "asdf"); + + var map_int64_string = + new ProtoBuf.Map(builder.lookup("Test.map_int64_string")); + test.strictEqual(map_int64_string.size, 0); + map_int64_string.set("9223372036854775807", "asdf"); + test.strictEqual(map_int64_string.size, 1); + test.strictEqual(map_int64_string.has("9223372036854775807"), true); + test.strictEqual(map_int64_string.get("9223372036854775807"), "asdf"); + + // Ensure that initialization from a raw object works. + var map_int32_string = + new ProtoBuf.Map(builder.lookup("Test.map_int32_string"), + { 42: "asdf" }); + test.strictEqual(map_int32_string.size, 1); + test.strictEqual(map_int32_string.keys().next().value, 42); + + var map_int64_string = + new ProtoBuf.Map(builder.lookup("Test.map_int64_string"), + { "9223372036854775807": "asdf" }); + test.strictEqual(map_int64_string.size, 1); + var i64 = map_int64_string.keys().next().value; + test.ok(i64 instanceof ProtoBuf.Long); + test.strictEqual(i64.toString(), "9223372036854775807"); + + test.done(); + }, + + "mapField": function(test) { + var proto = + "message Test {\n" + + " map map_string_int32 = 1;\n" + + " map map_string_int64 = 2;\n" + + " map map_string_string = 3;\n" + + " map map_string_msg = 4;\n" + + " map map_string_enum = 5;\n" + + " map map_int32_string = 6;\n" + + " map map_int64_string = 7;\n" + + " map map_bool_string = 9;\n" + + "}\n" + + "enum Enum { Default = 0; A = 1; B = 2; }\n"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "test/mapField.proto"); + var Test = builder.build('Test'), + Enum = builder.build('Enum'); + + var testMsg = new Test(); + test.strictEqual(testMsg.map_string_int32.size, 0); + test.strictEqual(testMsg.map_string_int64.size, 0); + test.strictEqual(testMsg.map_string_string.size, 0); + test.strictEqual(testMsg.map_string_msg.size, 0); + test.strictEqual(testMsg.map_string_enum.size, 0); + test.strictEqual(testMsg.map_int32_string.size, 0); + test.strictEqual(testMsg.map_int64_string.size, 0); + test.strictEqual(testMsg.map_bool_string.size, 0); + + testMsg.$set('map_string_int32', { 'asdf': 42 }); + + try { + testMsg.$set('map_string_int32', { 'asdf': 42.1 }); + test.ok(false); // ^ should throw + } catch (e) { + test.ok(e.message.match(/Illegal/)); + } + + test.done(); + }, + + "mapEncodeDecode": function(test) { + var proto = + "message Test {\n" + + " map map_string_int32 = 1;\n" + + " map map_string_int64 = 2;\n" + + " map map_string_string = 3;\n" + + " map map_string_msg = 4;\n" + + " map map_string_enum = 5;\n" + + " map map_int32_string = 6;\n" + + " map map_int64_string = 7;\n" + + " map map_bool_string = 9;\n" + + "}\n" + + "enum Enum { Default = 0; A = 1; B = 2; }\n"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "test/mapField.proto"); + var Test = builder.build('Test'), + Enum = builder.build('Enum'); + + var testMsg = new Test(); + testMsg.map_string_int32.set("a", 1); + testMsg.map_string_int32.set("b", 2); + testMsg.map_string_int64.set("c", "12345678901234"); + testMsg.map_string_int64.set("d", "98765432109876"); + testMsg.map_string_string.set("e", "asdf"); + testMsg.map_string_string.set("f", "jkl;"); + testMsg.map_string_enum.set("g", Enum.A); + testMsg.map_string_enum.set("h", Enum.B); + testMsg.map_int32_string.set(9, "a"); + testMsg.map_int32_string.set(10, "b"); + testMsg.map_int64_string.set("12345678901234", "a"); + testMsg.map_int64_string.set("98765432109876", "b"); + testMsg.map_bool_string.set(false, "a"); + testMsg.map_bool_string.set(true, "b"); + + var encoded = testMsg.encode(); + testMsg = Test.decode(encoded); + + test.strictEqual(testMsg.map_string_int32.get("a"), 1); + test.strictEqual(testMsg.map_string_int32.get("b"), 2); + test.strictEqual(testMsg.map_string_int64.get("c").toString(), "12345678901234"); + test.strictEqual(testMsg.map_string_int64.get("d").toString(), "98765432109876"); + test.strictEqual(testMsg.map_string_string.get("e"), "asdf"); + test.strictEqual(testMsg.map_string_string.get("f"), "jkl;"); + test.strictEqual(testMsg.map_string_enum.get("g"), Enum.A); + test.strictEqual(testMsg.map_string_enum.get("h"), Enum.B); + test.strictEqual(testMsg.map_int32_string.get(9), "a"); + test.strictEqual(testMsg.map_int32_string.get(10), "b"); + test.strictEqual(testMsg.map_int64_string.get("12345678901234"), "a"); + test.strictEqual(testMsg.map_int64_string.get("98765432109876"), "b"); + test.strictEqual(testMsg.map_bool_string.get(false), "a"); + test.strictEqual(testMsg.map_bool_string.get(true), "b"); + + test.done(); + }, + + "proto3Json": function(test) { + var proto = + "syntax = \"proto3\";\n" + + "message Test {\n" + + " int32 optional_int32 = 1;\n" + + " int64 optional_int64 = 2;\n" + + " string optional_string = 3;\n" + + " bytes optional_bytes = 4;\n" + + " bool optional_bool = 5;\n" + + " Enum optional_enum = 6;\n" + + " repeated int32 repeated_int32 = 11;\n" + + " repeated int64 repeated_int64 = 12;\n" + + " repeated string repeated_string = 13;\n" + + " repeated bytes repeated_bytes = 14;\n" + + " repeated bool repeated_bool = 15;\n" + + " repeated Enum repeated_enum = 16;\n" + + " map map_string_int32 = 20;\n" + + " map map_string_int64 = 21;\n" + + " map map_string_string = 22;\n" + + " map map_string_enum = 24;\n" + + " map map_int32_string = 25;\n" + + " map map_int64_string = 26;\n" + + " map map_bool_string = 27;\n" + + "}\n" + + "enum Enum { Default = 0; A = 1; B = 2; }\n"; + var builder = ProtoBuf.newBuilder(); + ProtoBuf.loadProto(proto, builder, "test/mapField.proto"); + var Test = builder.build('Test'), + Enum = builder.build('Enum'); + + var testMsg = new Test(); + testMsg.optional_int32 = 1; + testMsg.optional_int64 = "12345678901234"; + testMsg.optional_string = "hello"; + testMsg.optional_bytes = ProtoBuf.ByteBuffer.fromBinary("\x00\xFF\x80"); + testMsg.optional_bool = true; + testMsg.optional_enum = Enum.A; + testMsg.repeated_int32.push(1); + testMsg.repeated_int64.push("12345678901234"); + testMsg.repeated_string.push("hello"); + testMsg.repeated_bytes.push(ProtoBuf.ByteBuffer.fromBinary("\x00\xFF\x80")); + testMsg.repeated_bool.push(true); + testMsg.repeated_enum.push(Enum.A); + testMsg.map_string_int32.set("a", 1); + testMsg.map_string_int32.set("b", 2); + testMsg.map_string_int64.set("c", "12345678901234"); + testMsg.map_string_int64.set("d", "98765432109876"); + testMsg.map_string_string.set("e", "asdf"); + testMsg.map_string_string.set("f", "jkl;"); + testMsg.map_string_enum.set("g", Enum.A); + testMsg.map_string_enum.set("h", Enum.B); + testMsg.map_int32_string.set(9, "a"); + testMsg.map_int32_string.set(10, "b"); + testMsg.map_int64_string.set("12345678901234", "a"); + testMsg.map_int64_string.set("98765432109876", "b"); + testMsg.map_bool_string.set(false, "a"); + testMsg.map_bool_string.set(true, "b"); + + var jsonObj = JSON.parse(testMsg.encodeJSON()); + test.deepEqual(jsonObj, + { + optional_int32: 1, + optional_int64: "12345678901234", + optional_string: "hello", + optional_bytes: "AP+A", // base64 + optional_bool: true, + optional_enum: "A", + repeated_int32: [1], + repeated_int64: ["12345678901234"], + repeated_string: ["hello"], + repeated_bytes: ["AP+A"], // base64 + repeated_bool: [true], + repeated_enum: ["A"], + map_string_int32: { "a": 1, "b": 2 }, + map_string_int64: { "c": "12345678901234", "d": "98765432109876" }, + map_string_string: { "e": "asdf", "f": "jkl;" }, + map_string_enum: { "g": "A", "h": "B" }, + map_int32_string: { "9": "a", "10": "b" }, + map_int64_string: { "12345678901234": "a", "98765432109876": "b" }, + map_bool_string: { "false": "a", "true": "b" }, + }); + + var testMsg2 = Test.decodeJSON(testMsg.encodeJSON()); + test.strictEqual(testMsg2.encodeJSON(), testMsg.encodeJSON()); + + test.done(); + }, + + // Node.js only + "loaders": BROWSER ? {} : { + + "commonjs": function(test) { + var fs = require("fs") + , vm = require("vm") + , util = require('util'); + + var code = fs.readFileSync(__dirname+"/../dist/"+FILE); + var exports = {}; + var sandbox = new Sandbox({ + module: { + exports: exports, + id: "protobufjs" + }, + exports: exports, + require: (function() { + function require(mod) { + if (mod == 'bytebuffer') require.called = true; + return ByteBuffer; + } + require.called = false; + return require; + })() + }); + vm.runInNewContext(code, sandbox, "ProtoBuf.js in CommonJS-VM"); + // console.log(util.inspect(sandbox)); + test.ok(typeof sandbox.module.exports == 'object'); + test.ok(typeof sandbox.require != 'undefined' && sandbox.require.called); + test.done(); + }, + + "amd": function(test) { + var fs = require("fs") + , vm = require("vm") + , util = require('util'); + + var code = fs.readFileSync(__dirname+"/../dist/"+FILE); + var sandbox = new Sandbox({ + define: (function() { + function define() { + define.called = true; + } + define.amd = true; + define.called = false; + return define; + })() + }); + vm.runInNewContext(code, sandbox, "ProtoBuf.js in AMD-VM"); + // console.log(util.inspect(sandbox)); + test.ok(sandbox.define.called == true); + test.done(); + }, + + "shim": function(test) { + var fs = require("fs") + , vm = require("vm") + , util = require('util'); + + var code = fs.readFileSync(__dirname+"/../dist/"+FILE); + var sandbox = new Sandbox({ + dcodeIO: { + ByteBuffer: ByteBuffer + } + }); + vm.runInNewContext(code, sandbox, "ProtoBuf.js in shim-VM"); + // console.log(util.inspect(sandbox)); + test.ok(typeof sandbox.dcodeIO != 'undefined' && typeof sandbox.dcodeIO.ProtoBuf != 'undefined'); + test.done(); + } + } + }; + + if (typeof module != 'undefined' && module.exports) { + module.exports = suite; + } else { + global["suite"] = suite; + } + +})(this); diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/toplevel.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/toplevel.proto new file mode 100644 index 0000000..eec948e --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/toplevel.proto @@ -0,0 +1,10 @@ +package My; + +enum MyEnum { + ONE = 1; + TWO = 2; +} + +message Test { + required MyEnum num = 1 [default=ONE]; +} diff --git a/legacy-libs/grpc/node_modules/protobufjs/tests/x64.proto b/legacy-libs/grpc/node_modules/protobufjs/tests/x64.proto new file mode 100644 index 0000000..18ea2d3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/protobufjs/tests/x64.proto @@ -0,0 +1,10 @@ +message Test { + required sfixed64 val = 1 [default=-1]; + required fixed64 uval = 2 [default=1]; +} + +message Test2 { + required int64 val = 1 [default=-1]; + required uint64 uval = 2 [default=1]; + required sint64 sval = 3 [default=-2]; +} diff --git a/legacy-libs/grpc/node_modules/rc/LICENSE.APACHE2 b/legacy-libs/grpc/node_modules/rc/LICENSE.APACHE2 new file mode 100644 index 0000000..6366c04 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/LICENSE.APACHE2 @@ -0,0 +1,15 @@ +Apache License, Version 2.0 + +Copyright (c) 2011 Dominic Tarr + +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/legacy-libs/grpc/node_modules/rc/LICENSE.BSD b/legacy-libs/grpc/node_modules/rc/LICENSE.BSD new file mode 100644 index 0000000..96bb796 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/LICENSE.BSD @@ -0,0 +1,26 @@ +Copyright (c) 2013, Dominic Tarr +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. + +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. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. diff --git a/legacy-libs/grpc/node_modules/rc/LICENSE.MIT b/legacy-libs/grpc/node_modules/rc/LICENSE.MIT new file mode 100644 index 0000000..6eafbd7 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/LICENSE.MIT @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2011 Dominic Tarr + +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/legacy-libs/grpc/node_modules/rc/README.md b/legacy-libs/grpc/node_modules/rc/README.md new file mode 100644 index 0000000..e6522e2 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/README.md @@ -0,0 +1,227 @@ +# rc + +The non-configurable configuration loader for lazy people. + +## Usage + +The only option is to pass rc the name of your app, and your default configuration. + +```javascript +var conf = require('rc')(appname, { + //defaults go here. + port: 2468, + + //defaults which are objects will be merged, not replaced + views: { + engine: 'jade' + } +}); +``` + +`rc` will return your configuration options merged with the defaults you specify. +If you pass in a predefined defaults object, it will be mutated: + +```javascript +var conf = {}; +require('rc')(appname, conf); +``` + +If `rc` finds any config files for your app, the returned config object will have +a `configs` array containing their paths: + +```javascript +var appCfg = require('rc')(appname, conf); +appCfg.configs[0] // /etc/appnamerc +appCfg.configs[1] // /home/dominictarr/.config/appname +appCfg.config // same as appCfg.configs[appCfg.configs.length - 1] +``` + +## Standards + +Given your application name (`appname`), rc will look in all the obvious places for configuration. + + * command line arguments, parsed by minimist _(e.g. `--foo baz`, also nested: `--foo.bar=baz`)_ + * environment variables prefixed with `${appname}_` + * or use "\_\_" to indicate nested properties
_(e.g. `appname_foo__bar__baz` => `foo.bar.baz`)_ + * if you passed an option `--config file` then from that file + * a local `.${appname}rc` or the first found looking in `./ ../ ../../ ../../../` etc. + * `$HOME/.${appname}rc` + * `$HOME/.${appname}/config` + * `$HOME/.config/${appname}` + * `$HOME/.config/${appname}/config` + * `/etc/${appname}rc` + * `/etc/${appname}/config` + * the defaults object you passed in. + +All configuration sources that were found will be flattened into one object, +so that sources **earlier** in this list override later ones. + + +## Configuration File Formats + +Configuration files (e.g. `.appnamerc`) may be in either [json](http://json.org/example) or [ini](http://en.wikipedia.org/wiki/INI_file) format. **No** file extension (`.json` or `.ini`) should be used. The example configurations below are equivalent: + + +#### Formatted as `ini` + +``` +; You can include comments in `ini` format if you want. + +dependsOn=0.10.0 + + +; `rc` has built-in support for ini sections, see? + +[commands] + www = ./commands/www + console = ./commands/repl + + +; You can even do nested sections + +[generators.options] + engine = ejs + +[generators.modules] + new = generate-new + engine = generate-backend + +``` + +#### Formatted as `json` + +```javascript +{ + // You can even comment your JSON, if you want + "dependsOn": "0.10.0", + "commands": { + "www": "./commands/www", + "console": "./commands/repl" + }, + "generators": { + "options": { + "engine": "ejs" + }, + "modules": { + "new": "generate-new", + "backend": "generate-backend" + } + } +} +``` + +Comments are stripped from JSON config via [strip-json-comments](https://github.com/sindresorhus/strip-json-comments). + +> Since ini, and env variables do not have a standard for types, your application needs be prepared for strings. + +To ensure that string representations of booleans and numbers are always converted into their proper types (especially useful if you intend to do strict `===` comparisons), consider using a module such as [parse-strings-in-object](https://github.com/anselanza/parse-strings-in-object) to wrap the config object returned from rc. + + +## Simple example demonstrating precedence +Assume you have an application like this (notice the hard-coded defaults passed to rc): +``` +const conf = require('rc')('myapp', { + port: 12345, + mode: 'test' +}); + +console.log(JSON.stringify(conf, null, 2)); +``` +You also have a file `config.json`, with these contents: +``` +{ + "port": 9000, + "foo": "from config json", + "something": "else" +} +``` +And a file `.myapprc` in the same folder, with these contents: +``` +{ + "port": "3001", + "foo": "bar" +} +``` +Here is the expected output from various commands: + +`node .` +``` +{ + "port": "3001", + "mode": "test", + "foo": "bar", + "_": [], + "configs": [ + "/Users/stephen/repos/conftest/.myapprc" + ], + "config": "/Users/stephen/repos/conftest/.myapprc" +} +``` +*Default `mode` from hard-coded object is retained, but port is overridden by `.myapprc` file (automatically found based on appname match), and `foo` is added.* + + +`node . --foo baz` +``` +{ + "port": "3001", + "mode": "test", + "foo": "baz", + "_": [], + "configs": [ + "/Users/stephen/repos/conftest/.myapprc" + ], + "config": "/Users/stephen/repos/conftest/.myapprc" +} +``` +*Same result as above but `foo` is overridden because command-line arguments take precedence over `.myapprc` file.* + +`node . --foo barbar --config config.json` +``` +{ + "port": 9000, + "mode": "test", + "foo": "barbar", + "something": "else", + "_": [], + "config": "config.json", + "configs": [ + "/Users/stephen/repos/conftest/.myapprc", + "config.json" + ] +} +``` +*Now the `port` comes from the `config.json` file specified (overriding the value from `.myapprc`), and `foo` value is overriden by command-line despite also being specified in the `config.json` file.* + + + +## Advanced Usage + +#### Pass in your own `argv` + +You may pass in your own `argv` as the third argument to `rc`. This is in case you want to [use your own command-line opts parser](https://github.com/dominictarr/rc/pull/12). + +```javascript +require('rc')(appname, defaults, customArgvParser); +``` + +## Pass in your own parser + +If you have a special need to use a non-standard parser, +you can do so by passing in the parser as the 4th argument. +(leave the 3rd as null to get the default args parser) + +```javascript +require('rc')(appname, defaults, null, parser); +``` + +This may also be used to force a more strict format, +such as strict, valid JSON only. + +## Note on Performance + +`rc` is running `fs.statSync`-- so make sure you don't use it in a hot code path (e.g. a request handler) + + +## License + +Multi-licensed under the two-clause BSD License, MIT License, or Apache License, version 2.0 diff --git a/legacy-libs/grpc/node_modules/rc/browser.js b/legacy-libs/grpc/node_modules/rc/browser.js new file mode 100644 index 0000000..8c230c5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/browser.js @@ -0,0 +1,7 @@ + +// when this is loaded into the browser, +// just use the defaults... + +module.exports = function (name, defaults) { + return defaults +} diff --git a/legacy-libs/grpc/node_modules/rc/cli.js b/legacy-libs/grpc/node_modules/rc/cli.js new file mode 100644 index 0000000..ab05b60 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/cli.js @@ -0,0 +1,4 @@ +#! /usr/bin/env node +var rc = require('./index') + +console.log(JSON.stringify(rc(process.argv[2]), false, 2)) diff --git a/legacy-libs/grpc/node_modules/rc/index.js b/legacy-libs/grpc/node_modules/rc/index.js new file mode 100644 index 0000000..65eb47a --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/index.js @@ -0,0 +1,53 @@ +var cc = require('./lib/utils') +var join = require('path').join +var deepExtend = require('deep-extend') +var etc = '/etc' +var win = process.platform === "win32" +var home = win + ? process.env.USERPROFILE + : process.env.HOME + +module.exports = function (name, defaults, argv, parse) { + if('string' !== typeof name) + throw new Error('rc(name): name *must* be string') + if(!argv) + argv = require('minimist')(process.argv.slice(2)) + defaults = ( + 'string' === typeof defaults + ? cc.json(defaults) : defaults + ) || {} + + parse = parse || cc.parse + + var env = cc.env(name + '_') + + var configs = [defaults] + var configFiles = [] + function addConfigFile (file) { + if (configFiles.indexOf(file) >= 0) return + var fileConfig = cc.file(file) + if (fileConfig) { + configs.push(parse(fileConfig)) + configFiles.push(file) + } + } + + // which files do we look at? + if (!win) + [join(etc, name, 'config'), + join(etc, name + 'rc')].forEach(addConfigFile) + if (home) + [join(home, '.config', name, 'config'), + join(home, '.config', name), + join(home, '.' + name, 'config'), + join(home, '.' + name + 'rc')].forEach(addConfigFile) + addConfigFile(cc.find('.'+name+'rc')) + if (env.config) addConfigFile(env.config) + if (argv.config) addConfigFile(argv.config) + + return deepExtend.apply(null, configs.concat([ + env, + argv, + configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined, + ])) +} diff --git a/legacy-libs/grpc/node_modules/rc/lib/utils.js b/legacy-libs/grpc/node_modules/rc/lib/utils.js new file mode 100644 index 0000000..8b3beff --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/lib/utils.js @@ -0,0 +1,104 @@ +'use strict'; +var fs = require('fs') +var ini = require('ini') +var path = require('path') +var stripJsonComments = require('strip-json-comments') + +var parse = exports.parse = function (content) { + + //if it ends in .json or starts with { then it must be json. + //must be done this way, because ini accepts everything. + //can't just try and parse it and let it throw if it's not ini. + //everything is ini. even json with a syntax error. + + if(/^\s*{/.test(content)) + return JSON.parse(stripJsonComments(content)) + return ini.parse(content) + +} + +var file = exports.file = function () { + var args = [].slice.call(arguments).filter(function (arg) { return arg != null }) + + //path.join breaks if it's a not a string, so just skip this. + for(var i in args) + if('string' !== typeof args[i]) + return + + var file = path.join.apply(null, args) + var content + try { + return fs.readFileSync(file,'utf-8') + } catch (err) { + return + } +} + +var json = exports.json = function () { + var content = file.apply(null, arguments) + return content ? parse(content) : null +} + +var env = exports.env = function (prefix, env) { + env = env || process.env + var obj = {} + var l = prefix.length + for(var k in env) { + if(k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) { + + var keypath = k.substring(l).split('__') + + // Trim empty strings from keypath array + var _emptyStringIndex + while ((_emptyStringIndex=keypath.indexOf('')) > -1) { + keypath.splice(_emptyStringIndex, 1) + } + + var cursor = obj + keypath.forEach(function _buildSubObj(_subkey,i){ + + // (check for _subkey first so we ignore empty strings) + // (check for cursor to avoid assignment to primitive objects) + if (!_subkey || typeof cursor !== 'object') + return + + // If this is the last key, just stuff the value in there + // Assigns actual value from env variable to final key + // (unless it's just an empty string- in that case use the last valid key) + if (i === keypath.length-1) + cursor[_subkey] = env[k] + + + // Build sub-object if nothing already exists at the keypath + if (cursor[_subkey] === undefined) + cursor[_subkey] = {} + + // Increment cursor used to track the object at the current depth + cursor = cursor[_subkey] + + }) + + } + + } + + return obj +} + +var find = exports.find = function () { + var rel = path.join.apply(null, [].slice.call(arguments)) + + function find(start, rel) { + var file = path.join(start, rel) + try { + fs.statSync(file) + return file + } catch (err) { + if(path.dirname(start) !== start) // root + return find(path.dirname(start), rel) + } + } + return find(process.cwd(), rel) +} + + diff --git a/legacy-libs/grpc/node_modules/rc/package.json b/legacy-libs/grpc/node_modules/rc/package.json new file mode 100644 index 0000000..12ee566 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/package.json @@ -0,0 +1,72 @@ +{ + "_args": [ + [ + "rc@1.2.8", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "rc@1.2.8", + "_id": "rc@1.2.8", + "_inBundle": false, + "_integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "_location": "/grpc/rc", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "rc@1.2.8", + "name": "rc", + "escapedName": "rc", + "rawSpec": "1.2.8", + "saveSpec": null, + "fetchSpec": "1.2.8" + }, + "_requiredBy": [ + "/grpc/node-pre-gyp" + ], + "_resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "_shrinkwrap": null, + "_spec": "1.2.8", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Dominic Tarr", + "email": "dominic.tarr@gmail.com", + "url": "dominictarr.com" + }, + "bin": { + "rc": "./cli.js" + }, + "browser": "browser.js", + "bugs": { + "url": "https://github.com/dominictarr/rc/issues" + }, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "description": "hardwired configuration loader", + "devDependencies": {}, + "homepage": "https://github.com/dominictarr/rc#readme", + "keywords": [ + "config", + "rc", + "unix", + "defaults" + ], + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "main": "index.js", + "name": "rc", + "optionalDependencies": {}, + "readme": "# rc\n\nThe non-configurable configuration loader for lazy people.\n\n## Usage\n\nThe only option is to pass rc the name of your app, and your default configuration.\n\n```javascript\nvar conf = require('rc')(appname, {\n //defaults go here.\n port: 2468,\n\n //defaults which are objects will be merged, not replaced\n views: {\n engine: 'jade'\n }\n});\n```\n\n`rc` will return your configuration options merged with the defaults you specify.\nIf you pass in a predefined defaults object, it will be mutated:\n\n```javascript\nvar conf = {};\nrequire('rc')(appname, conf);\n```\n\nIf `rc` finds any config files for your app, the returned config object will have\na `configs` array containing their paths:\n\n```javascript\nvar appCfg = require('rc')(appname, conf);\nappCfg.configs[0] // /etc/appnamerc\nappCfg.configs[1] // /home/dominictarr/.config/appname\nappCfg.config // same as appCfg.configs[appCfg.configs.length - 1]\n```\n\n## Standards\n\nGiven your application name (`appname`), rc will look in all the obvious places for configuration.\n\n * command line arguments, parsed by minimist _(e.g. `--foo baz`, also nested: `--foo.bar=baz`)_\n * environment variables prefixed with `${appname}_`\n * or use \"\\_\\_\" to indicate nested properties
_(e.g. `appname_foo__bar__baz` => `foo.bar.baz`)_\n * if you passed an option `--config file` then from that file\n * a local `.${appname}rc` or the first found looking in `./ ../ ../../ ../../../` etc.\n * `$HOME/.${appname}rc`\n * `$HOME/.${appname}/config`\n * `$HOME/.config/${appname}`\n * `$HOME/.config/${appname}/config`\n * `/etc/${appname}rc`\n * `/etc/${appname}/config`\n * the defaults object you passed in.\n\nAll configuration sources that were found will be flattened into one object,\nso that sources **earlier** in this list override later ones.\n\n\n## Configuration File Formats\n\nConfiguration files (e.g. `.appnamerc`) may be in either [json](http://json.org/example) or [ini](http://en.wikipedia.org/wiki/INI_file) format. **No** file extension (`.json` or `.ini`) should be used. The example configurations below are equivalent:\n\n\n#### Formatted as `ini`\n\n```\n; You can include comments in `ini` format if you want.\n\ndependsOn=0.10.0\n\n\n; `rc` has built-in support for ini sections, see?\n\n[commands]\n www = ./commands/www\n console = ./commands/repl\n\n\n; You can even do nested sections\n\n[generators.options]\n engine = ejs\n\n[generators.modules]\n new = generate-new\n engine = generate-backend\n\n```\n\n#### Formatted as `json`\n\n```javascript\n{\n // You can even comment your JSON, if you want\n \"dependsOn\": \"0.10.0\",\n \"commands\": {\n \"www\": \"./commands/www\",\n \"console\": \"./commands/repl\"\n },\n \"generators\": {\n \"options\": {\n \"engine\": \"ejs\"\n },\n \"modules\": {\n \"new\": \"generate-new\",\n \"backend\": \"generate-backend\"\n }\n }\n}\n```\n\nComments are stripped from JSON config via [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).\n\n> Since ini, and env variables do not have a standard for types, your application needs be prepared for strings.\n\nTo ensure that string representations of booleans and numbers are always converted into their proper types (especially useful if you intend to do strict `===` comparisons), consider using a module such as [parse-strings-in-object](https://github.com/anselanza/parse-strings-in-object) to wrap the config object returned from rc.\n\n\n## Simple example demonstrating precedence\nAssume you have an application like this (notice the hard-coded defaults passed to rc):\n```\nconst conf = require('rc')('myapp', {\n port: 12345,\n mode: 'test'\n});\n\nconsole.log(JSON.stringify(conf, null, 2));\n```\nYou also have a file `config.json`, with these contents:\n```\n{\n \"port\": 9000,\n \"foo\": \"from config json\",\n \"something\": \"else\"\n}\n```\nAnd a file `.myapprc` in the same folder, with these contents:\n```\n{\n \"port\": \"3001\",\n \"foo\": \"bar\"\n}\n```\nHere is the expected output from various commands:\n\n`node .`\n```\n{\n \"port\": \"3001\",\n \"mode\": \"test\",\n \"foo\": \"bar\",\n \"_\": [],\n \"configs\": [\n \"/Users/stephen/repos/conftest/.myapprc\"\n ],\n \"config\": \"/Users/stephen/repos/conftest/.myapprc\"\n}\n```\n*Default `mode` from hard-coded object is retained, but port is overridden by `.myapprc` file (automatically found based on appname match), and `foo` is added.*\n\n\n`node . --foo baz`\n```\n{\n \"port\": \"3001\",\n \"mode\": \"test\",\n \"foo\": \"baz\",\n \"_\": [],\n \"configs\": [\n \"/Users/stephen/repos/conftest/.myapprc\"\n ],\n \"config\": \"/Users/stephen/repos/conftest/.myapprc\"\n}\n```\n*Same result as above but `foo` is overridden because command-line arguments take precedence over `.myapprc` file.*\n\n`node . --foo barbar --config config.json`\n```\n{\n \"port\": 9000,\n \"mode\": \"test\",\n \"foo\": \"barbar\",\n \"something\": \"else\",\n \"_\": [],\n \"config\": \"config.json\",\n \"configs\": [\n \"/Users/stephen/repos/conftest/.myapprc\",\n \"config.json\"\n ]\n}\n```\n*Now the `port` comes from the `config.json` file specified (overriding the value from `.myapprc`), and `foo` value is overriden by command-line despite also being specified in the `config.json` file.*\n \n\n\n## Advanced Usage\n\n#### Pass in your own `argv`\n\nYou may pass in your own `argv` as the third argument to `rc`. This is in case you want to [use your own command-line opts parser](https://github.com/dominictarr/rc/pull/12).\n\n```javascript\nrequire('rc')(appname, defaults, customArgvParser);\n```\n\n## Pass in your own parser\n\nIf you have a special need to use a non-standard parser,\nyou can do so by passing in the parser as the 4th argument.\n(leave the 3rd as null to get the default args parser)\n\n```javascript\nrequire('rc')(appname, defaults, null, parser);\n```\n\nThis may also be used to force a more strict format,\nsuch as strict, valid JSON only.\n\n## Note on Performance\n\n`rc` is running `fs.statSync`-- so make sure you don't use it in a hot code path (e.g. a request handler) \n\n\n## License\n\nMulti-licensed under the two-clause BSD License, MIT License, or Apache License, version 2.0\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/dominictarr/rc.git" + }, + "scripts": { + "test": "set -e; node test/test.js; node test/ini.js; node test/nested-env-vars.js" + }, + "version": "1.2.8" +} diff --git a/legacy-libs/grpc/node_modules/rc/test/ini.js b/legacy-libs/grpc/node_modules/rc/test/ini.js new file mode 100644 index 0000000..e6857f8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/test/ini.js @@ -0,0 +1,16 @@ +var cc =require('../lib/utils') +var INI = require('ini') +var assert = require('assert') + +function test(obj) { + + var _json, _ini + var json = cc.parse (_json = JSON.stringify(obj)) + var ini = cc.parse (_ini = INI.stringify(obj)) + console.log(_ini, _json) + assert.deepEqual(json, ini) +} + + +test({hello: true}) + diff --git a/legacy-libs/grpc/node_modules/rc/test/nested-env-vars.js b/legacy-libs/grpc/node_modules/rc/test/nested-env-vars.js new file mode 100644 index 0000000..0ecd176 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/test/nested-env-vars.js @@ -0,0 +1,50 @@ + +var seed = Math.random(); +var n = 'rc'+ seed; +var N = 'RC'+ seed; +var assert = require('assert') + + +// Basic usage +process.env[n+'_someOpt__a'] = 42 +process.env[n+'_someOpt__x__'] = 99 +process.env[n+'_someOpt__a__b'] = 186 +process.env[n+'_someOpt__a__b__c'] = 243 +process.env[n+'_someOpt__x__y'] = 1862 +process.env[n+'_someOpt__z'] = 186577 + +// Should ignore empty strings from orphaned '__' +process.env[n+'_someOpt__z__x__'] = 18629 +process.env[n+'_someOpt__w__w__'] = 18629 + +// Leading '__' should ignore everything up to 'z' +process.env[n+'___z__i__'] = 9999 + +// should ignore case for config name section. +process.env[N+'_test_upperCase'] = 187 + +function testPrefix(prefix) { + var config = require('../')(prefix, { + option: true + }) + + console.log('\n\n------ nested-env-vars ------\n',{prefix: prefix}, '\n', config); + + assert.equal(config.option, true) + assert.equal(config.someOpt.a, 42) + assert.equal(config.someOpt.x, 99) + // Should not override `a` once it's been set + assert.equal(config.someOpt.a/*.b*/, 42) + // Should not override `x` once it's been set + assert.equal(config.someOpt.x/*.y*/, 99) + assert.equal(config.someOpt.z, 186577) + // Should not override `z` once it's been set + assert.equal(config.someOpt.z/*.x*/, 186577) + assert.equal(config.someOpt.w.w, 18629) + assert.equal(config.z.i, 9999) + + assert.equal(config.test_upperCase, 187) +} + +testPrefix(n); +testPrefix(N); diff --git a/legacy-libs/grpc/node_modules/rc/test/test.js b/legacy-libs/grpc/node_modules/rc/test/test.js new file mode 100644 index 0000000..4f63351 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rc/test/test.js @@ -0,0 +1,59 @@ + +var n = 'rc'+Math.random() +var assert = require('assert') + +process.env[n+'_envOption'] = 42 + +var config = require('../')(n, { + option: true +}) + +console.log(config) + +assert.equal(config.option, true) +assert.equal(config.envOption, 42) + +var customArgv = require('../')(n, { + option: true +}, { // nopt-like argv + option: false, + envOption: 24, + argv: { + remain: [], + cooked: ['--no-option', '--envOption', '24'], + original: ['--no-option', '--envOption=24'] + } +}) + +console.log(customArgv) + +assert.equal(customArgv.option, false) +assert.equal(customArgv.envOption, 24) + +var fs = require('fs') +var path = require('path') +var jsonrc = path.resolve('.' + n + 'rc'); + +fs.writeFileSync(jsonrc, [ + '{', + '// json overrides default', + '"option": false,', + '/* env overrides json */', + '"envOption": 24', + '}' +].join('\n')); + +var commentedJSON = require('../')(n, { + option: true +}) + +fs.unlinkSync(jsonrc); + +console.log(commentedJSON) + +assert.equal(commentedJSON.option, false) +assert.equal(commentedJSON.envOption, 42) + +assert.equal(commentedJSON.config, jsonrc) +assert.equal(commentedJSON.configs.length, 1) +assert.equal(commentedJSON.configs[0], jsonrc) diff --git a/legacy-libs/grpc/node_modules/readable-stream/CONTRIBUTING.md b/legacy-libs/grpc/node_modules/readable-stream/CONTRIBUTING.md new file mode 100644 index 0000000..f478d58 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# 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/legacy-libs/grpc/node_modules/readable-stream/GOVERNANCE.md b/legacy-libs/grpc/node_modules/readable-stream/GOVERNANCE.md new file mode 100644 index 0000000..16ffb93 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/GOVERNANCE.md @@ -0,0 +1,136 @@ +### 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/legacy-libs/grpc/node_modules/readable-stream/LICENSE b/legacy-libs/grpc/node_modules/readable-stream/LICENSE new file mode 100644 index 0000000..2873b3b --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/LICENSE @@ -0,0 +1,47 @@ +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/legacy-libs/grpc/node_modules/readable-stream/README.md b/legacy-libs/grpc/node_modules/readable-stream/README.md new file mode 100644 index 0000000..23fe3f3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/README.md @@ -0,0 +1,58 @@ +# readable-stream + +***Node-core v8.11.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/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/readable-stream.svg)](https://saucelabs.com/u/readable-stream) + +```bash +npm install --save readable-stream +``` + +***Node-core streams for userland*** + +This package is a mirror of the Streams2 and Streams3 implementations in +Node-core. + +Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.11.1/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. + +# 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 + +* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com> + - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B +* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com> + - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242 +* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org> + - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D +* **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com> +* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com> +* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me> +* **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> diff --git a/legacy-libs/grpc/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/legacy-libs/grpc/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md new file mode 100644 index 0000000..83275f1 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md @@ -0,0 +1,60 @@ +# streams WG Meeting 2015-01-30 + +## Links + +* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg +* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106 +* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/ + +## Agenda + +Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting. + +* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105) +* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101) +* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102) +* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99) + +## Minutes + +### adopt a charter + +* group: +1's all around + +### What versioning scheme should be adopted? +* group: +1’s 3.0.0 +* domenic+group: pulling in patches from other sources where appropriate +* mikeal: version independently, suggesting versions for io.js +* mikeal+domenic: work with TC to notify in advance of changes +simpler stream creation + +### streamline creation of streams +* sam: streamline creation of streams +* domenic: nice simple solution posted + but, we lose the opportunity to change the model + may not be backwards incompatible (double check keys) + + **action item:** domenic will check + +### remove implicit flowing of streams on(‘data’) +* add isFlowing / isPaused +* mikeal: worrying that we’re documenting polyfill methods – confuses users +* domenic: more reflective API is probably good, with warning labels for users +* new section for mad scientists (reflective stream access) +* calvin: name the “third state” +* mikeal: maybe borrow the name from whatwg? +* domenic: we’re missing the “third state” +* consensus: kind of difficult to name the third state +* mikeal: figure out differences in states / compat +* mathias: always flow on data – eliminates third state + * explore what it breaks + +**action items:** +* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream) +* ask rod/build for infrastructure +* **chris**: explore the “flow on data” approach +* add isPaused/isFlowing +* add new docs section +* move isPaused to that section + + diff --git a/legacy-libs/grpc/node_modules/readable-stream/duplex-browser.js b/legacy-libs/grpc/node_modules/readable-stream/duplex-browser.js new file mode 100644 index 0000000..f8b2db8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/duplex-browser.js @@ -0,0 +1 @@ +module.exports = require('./lib/_stream_duplex.js'); diff --git a/legacy-libs/grpc/node_modules/readable-stream/duplex.js b/legacy-libs/grpc/node_modules/readable-stream/duplex.js new file mode 100644 index 0000000..46924cb --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/duplex.js @@ -0,0 +1 @@ +module.exports = require('./readable').Duplex diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_duplex.js b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_duplex.js new file mode 100644 index 0000000..a1ca813 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_duplex.js @@ -0,0 +1,131 @@ +// 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 pna = require('process-nextick-args'); +/**/ + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); + +util.inherits(Duplex, Readable); + +{ + // avoid scope creep, the keys array can then be collected + 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); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && 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 () { + return this._writableState.highWaterMark; + } +}); + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + pna.nextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +Object.defineProperty(Duplex.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function (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; + } +}); + +Duplex.prototype._destroy = function (err, cb) { + this.push(null); + this.end(); + + pna.nextTick(cb, err); +}; \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_passthrough.js b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_passthrough.js new file mode 100644 index 0000000..a9c8358 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_passthrough.js @@ -0,0 +1,47 @@ +// 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'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.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/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_readable.js b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_readable.js new file mode 100644 index 0000000..bf34ac6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_readable.js @@ -0,0 +1,1019 @@ +// 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 pna = require('process-nextick-args'); +/**/ + +module.exports = Readable; + +/**/ +var isArray = require('isarray'); +/**/ + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = require('events').EventEmitter; + +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = require('./internal/streams/stream'); +/**/ + +/**/ + +var Buffer = require('safe-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 util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +/**/ +var debugUtil = require('util'); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + +var BufferList = require('./internal/streams/BufferList'); +var destroyImpl = require('./internal/streams/destroy'); +var StringDecoder; + +util.inherits(Readable, Stream); + +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 (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + +function ReadableState(options, stream) { + 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. + var 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" + var hwm = options.highWaterMark; + var readableHwm = options.readableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // 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; + + // 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); + + this._readableState = new ReadableState(options, this); + + // 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', { + get: function () { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function (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) { + this.push(null); + 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) { + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', 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) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); + } else if (state.ended) { + stream.emit('error', new Error('stream.push() after EOF')); + } 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; + } + } + + return needMoreData(state); +} + +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } 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 TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + +// if it's past the high water mark, we can push in some more. +// 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. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +} + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + 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.length >= state.highWaterMark || 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 = true; + n = 0; + } else { + state.length -= n; + } + + 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) { + 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; + + // emit 'readable' now to make sure it gets picked up. + 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; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + 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; + pna.nextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + 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) { + this.emit('error', new Error('_read() is not implemented')); +}; + +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) pna.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(); + } + + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // 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', src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + 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) dest.emit('error', 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 () { + 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, unpipeInfo); + }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); + + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + pna.nextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +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'); + state.flowing = true; + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + pna.nextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + 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 (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + 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 (method) { + return function () { + 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; +}; + +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 () { + return this._readableState.highWaterMark; + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// 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.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); + } + + return ret; +} + +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret; +} + +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.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) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = Buffer.allocUnsafe(n); + var p = list.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) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + pna.nextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} + +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/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_transform.js b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_transform.js new file mode 100644 index 0000000..5d1f8b8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_transform.js @@ -0,0 +1,214 @@ +// 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 Duplex = require('./_stream_duplex'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) { + return this.emit('error', new Error('write callback called multiple times')); + } + + 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._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) { + throw new Error('_transform() is not implemented'); +}; + +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.writecb && !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) { + var _this2 = this; + + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + _this2.emit('close'); + }); +}; + +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); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); + + if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_writable.js b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_writable.js new file mode 100644 index 0000000..b3f4e85 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,687 @@ +// 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'; + +/**/ + +var pna = require('process-nextick-args'); +/**/ + +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 asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; +/**/ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +/**/ +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + +/**/ +var Stream = require('./internal/streams/stream'); +/**/ + +/**/ + +var Buffer = require('safe-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'); + +util.inherits(Writable, Stream); + +function nop() {} + +function WritableState(options, stream) { + 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. + var 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() + var hwm = options.highWaterMark; + var writableHwm = options.writableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // 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; + + // 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 () { + 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 (object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function (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. + if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { + return new Writable(options); + } + + this._writableState = new WritableState(options, this); + + // 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 () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + pna.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 valid = true; + var er = false; + + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + pna.nextTick(cb, er); + valid = false; + } + return valid; +} + +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.ended) 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 () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.finished && !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 TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +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 () { + 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 (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 + pna.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + pna.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + stream.emit('error', 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; + + 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); + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + /**/ + asyncWrite(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 Error('_write() is not implemented')); +}; + +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 && !state.finished) endWritable(this, state, cb); +}; + +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) { + stream.emit('error', 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.pendingcb++; + state.finalCalled = true; + pna.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'); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) pna.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; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = corkReq; + } else { + state.corkedRequestsFree = corkReq; + } +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + get: function () { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function (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) { + this.end(); + cb(err); +}; \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/BufferList.js b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/BufferList.js new file mode 100644 index 0000000..aefc68b --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/BufferList.js @@ -0,0 +1,79 @@ +'use strict'; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Buffer = require('safe-buffer').Buffer; +var util = require('util'); + +function copyBuffer(src, target, offset) { + src.copy(target, offset); +} + +module.exports = function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; + } + + BufferList.prototype.push = 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; + }; + + BufferList.prototype.unshift = function unshift(v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + }; + + BufferList.prototype.shift = 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; + }; + + BufferList.prototype.clear = function clear() { + this.head = this.tail = null; + this.length = 0; + }; + + BufferList.prototype.join = 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; + }; + + BufferList.prototype.concat = function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + if (this.length === 1) return this.head.data; + 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; + }; + + return BufferList; +}(); + +if (util && util.inspect && util.inspect.custom) { + module.exports.prototype[util.inspect.custom] = function () { + var obj = util.inspect({ length: this.length }); + return this.constructor.name + ' ' + obj; + }; +} \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/destroy.js b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/destroy.js new file mode 100644 index 0000000..5a0a0d8 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/destroy.js @@ -0,0 +1,74 @@ +'use strict'; + +/**/ + +var pna = require('process-nextick-args'); +/**/ + +// 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 && (!this._writableState || !this._writableState.errorEmitted)) { + pna.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) { + pna.nextTick(emitErrorNT, _this, err); + if (_this._writableState) { + _this._writableState.errorEmitted = true; + } + } else if (cb) { + cb(err); + } + }); + + return this; +} + +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.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy +}; \ No newline at end of file diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream-browser.js new file mode 100644 index 0000000..9332a3f --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream-browser.js @@ -0,0 +1 @@ +module.exports = require('events').EventEmitter; diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream.js b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream.js new file mode 100644 index 0000000..ce2ad5b --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream.js @@ -0,0 +1 @@ +module.exports = require('stream'); diff --git a/legacy-libs/grpc/node_modules/readable-stream/package.json b/legacy-libs/grpc/node_modules/readable-stream/package.json new file mode 100644 index 0000000..3c5aac2 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/package.json @@ -0,0 +1,88 @@ +{ + "_args": [ + [ + "readable-stream@2.3.6", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "readable-stream@2.3.6", + "_id": "readable-stream@2.3.6", + "_inBundle": false, + "_integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "_location": "/grpc/readable-stream", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "readable-stream@2.3.6", + "name": "readable-stream", + "escapedName": "readable-stream", + "rawSpec": "2.3.6", + "saveSpec": null, + "fetchSpec": "2.3.6" + }, + "_requiredBy": [ + "/grpc/are-we-there-yet" + ], + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "_shrinkwrap": null, + "_spec": "2.3.6", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "browser": { + "util": false, + "./readable.js": "./readable-browser.js", + "./writable.js": "./writable-browser.js", + "./duplex.js": "./duplex-browser.js", + "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js" + }, + "bugs": { + "url": "https://github.com/nodejs/readable-stream/issues" + }, + "dependencies": { + "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" + }, + "description": "Streams3, a user-land copy of the stream library from Node.js", + "devDependencies": { + "assert": "^1.4.0", + "babel-polyfill": "^6.9.1", + "buffer": "^4.9.0", + "lolex": "^2.3.2", + "nyc": "^6.4.0", + "tap": "^0.7.0", + "tape": "^4.8.0" + }, + "homepage": "https://github.com/nodejs/readable-stream#readme", + "keywords": [ + "readable", + "stream", + "pipe" + ], + "license": "MIT", + "main": "readable.js", + "name": "readable-stream", + "nyc": { + "include": [ + "lib/**.js" + ] + }, + "optionalDependencies": {}, + "readme": "# readable-stream\n\n***Node-core v8.11.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)\n\n\n[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)\n[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)\n\n\n[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream)\n\n```bash\nnpm install --save readable-stream\n```\n\n***Node-core streams for userland***\n\nThis package is a mirror of the Streams2 and Streams3 implementations in\nNode-core.\n\nFull documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.11.1/docs/api/stream.html).\n\nIf you want to guarantee a stable streams base, regardless of what version of\nNode 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).\n\nAs of version 2.0.0 **readable-stream** uses semantic versioning.\n\n# Streams Working Group\n\n`readable-stream` is maintained by the Streams Working Group, which\noversees the development and maintenance of the Streams API within\nNode.js. The responsibilities of the Streams Working Group include:\n\n* Addressing stream issues on the Node.js issue tracker.\n* Authoring and editing stream documentation within the Node.js project.\n* Reviewing changes to stream subclasses within the Node.js project.\n* Redirecting changes to streams from the Node.js project to this\n project.\n* Assisting in the implementation of stream providers within Node.js.\n* Recommending versions of `readable-stream` to be included in Node.js.\n* Messaging about the future of streams to give the community advance\n notice of changes.\n\n\n## Team Members\n\n* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com>\n - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B\n* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com>\n - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242\n* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org>\n - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D\n* **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com>\n* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com>\n* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me>\n* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com>\n - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E\n* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com>\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/readable-stream.git" + }, + "scripts": { + "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js", + "cover": "nyc npm test", + "report": "nyc report --reporter=lcov", + "test": "tap test/parallel/*.js test/ours/*.js && node test/verify-dependencies.js" + }, + "version": "2.3.6" +} diff --git a/legacy-libs/grpc/node_modules/readable-stream/passthrough.js b/legacy-libs/grpc/node_modules/readable-stream/passthrough.js new file mode 100644 index 0000000..ffd791d --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/passthrough.js @@ -0,0 +1 @@ +module.exports = require('./readable').PassThrough diff --git a/legacy-libs/grpc/node_modules/readable-stream/readable-browser.js b/legacy-libs/grpc/node_modules/readable-stream/readable-browser.js new file mode 100644 index 0000000..e503725 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/readable-browser.js @@ -0,0 +1,7 @@ +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'); diff --git a/legacy-libs/grpc/node_modules/readable-stream/readable.js b/legacy-libs/grpc/node_modules/readable-stream/readable.js new file mode 100644 index 0000000..ec89ec5 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/readable.js @@ -0,0 +1,19 @@ +var Stream = require('stream'); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream; + exports = module.exports = Stream.Readable; + exports.Readable = Stream.Readable; + exports.Writable = Stream.Writable; + exports.Duplex = Stream.Duplex; + exports.Transform = Stream.Transform; + exports.PassThrough = Stream.PassThrough; + 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'); +} diff --git a/legacy-libs/grpc/node_modules/readable-stream/transform.js b/legacy-libs/grpc/node_modules/readable-stream/transform.js new file mode 100644 index 0000000..b1baba2 --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/transform.js @@ -0,0 +1 @@ +module.exports = require('./readable').Transform diff --git a/legacy-libs/grpc/node_modules/readable-stream/writable-browser.js b/legacy-libs/grpc/node_modules/readable-stream/writable-browser.js new file mode 100644 index 0000000..ebdde6a --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/writable-browser.js @@ -0,0 +1 @@ +module.exports = require('./lib/_stream_writable.js'); diff --git a/legacy-libs/grpc/node_modules/readable-stream/writable.js b/legacy-libs/grpc/node_modules/readable-stream/writable.js new file mode 100644 index 0000000..3211a6f --- /dev/null +++ b/legacy-libs/grpc/node_modules/readable-stream/writable.js @@ -0,0 +1,8 @@ +var Stream = require("stream") +var Writable = require("./lib/_stream_writable.js") + +if (process.env.READABLE_STREAM === 'disable') { + module.exports = Stream && Stream.Writable || Writable +} else { + module.exports = Writable +} diff --git a/legacy-libs/grpc/node_modules/rimraf/LICENSE b/legacy-libs/grpc/node_modules/rimraf/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/LICENSE @@ -0,0 +1,15 @@ +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/legacy-libs/grpc/node_modules/rimraf/README.md b/legacy-libs/grpc/node_modules/rimraf/README.md new file mode 100644 index 0000000..423b8cf --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/README.md @@ -0,0 +1,101 @@ +[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies) + +The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node. + +Install with `npm install rimraf`, or just drop rimraf.js somewhere. + +## API + +`rimraf(f, [opts], callback)` + +The first parameter will be interpreted as a globbing pattern for files. If you +want to disable globbing you can do so with `opts.disableGlob` (defaults to +`false`). This might be handy, for instance, if you have filenames that contain +globbing wildcard characters. + +The callback will be called with an error if there is one. Certain +errors are handled for you: + +* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of + `opts.maxBusyTries` times before giving up, adding 100ms of wait + between each attempt. The default `maxBusyTries` is 3. +* `ENOENT` - If the file doesn't exist, rimraf will return + successfully, since your desired outcome is already the case. +* `EMFILE` - Since `readdir` requires opening a file descriptor, it's + possible to hit `EMFILE` if too many file descriptors are in use. + In the sync case, there's nothing to be done for this. But in the + async case, rimraf will gradually back off with timeouts up to + `opts.emfileWait` ms, which defaults to 1000. + +## options + +* unlink, chmod, stat, lstat, rmdir, readdir, + unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync + + In order to use a custom file system library, you can override + specific fs functions on the options object. + + If any of these functions are present on the options object, then + the supplied function will be used instead of the default fs + method. + + Sync methods are only relevant for `rimraf.sync()`, of course. + + For example: + + ```javascript + var myCustomFS = require('some-custom-fs') + + rimraf('some-thing', myCustomFS, callback) + ``` + +* maxBusyTries + + If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered + on Windows systems, then rimraf will retry with a linear backoff + wait of 100ms longer on each try. The default maxBusyTries is 3. + + Only relevant for async usage. + +* emfileWait + + If an `EMFILE` error is encountered, then rimraf will retry + repeatedly with a linear backoff of 1ms longer on each try, until + the timeout counter hits this max. The default limit is 1000. + + If you repeatedly encounter `EMFILE` errors, then consider using + [graceful-fs](http://npm.im/graceful-fs) in your program. + + Only relevant for async usage. + +* glob + + Set to `false` to disable [glob](http://npm.im/glob) pattern + matching. + + Set to an object to pass options to the glob module. The default + glob options are `{ nosort: true, silent: true }`. + + Glob version 6 is used in this module. + + Relevant for both sync and async usage. + +* disableGlob + + Set to any non-falsey value to disable globbing entirely. + (Equivalent to setting `glob: false`.) + +## rimraf.sync + +It can remove stuff synchronously, too. But that's not so good. Use +the async API. It's better. + +## CLI + +If installed with `npm install rimraf -g` it can be used as a global +command `rimraf [ ...]` which is useful for cross platform support. + +## mkdirp + +If you need to create a directory recursively, check out +[mkdirp](https://github.com/substack/node-mkdirp). diff --git a/legacy-libs/grpc/node_modules/rimraf/bin.js b/legacy-libs/grpc/node_modules/rimraf/bin.js new file mode 100644 index 0000000..0d1e17b --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/bin.js @@ -0,0 +1,50 @@ +#!/usr/bin/env node + +var rimraf = require('./') + +var help = false +var dashdash = false +var noglob = false +var args = process.argv.slice(2).filter(function(arg) { + if (dashdash) + return !!arg + else if (arg === '--') + dashdash = true + else if (arg === '--no-glob' || arg === '-G') + noglob = true + else if (arg === '--glob' || arg === '-g') + noglob = false + else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/)) + help = true + else + return !!arg +}) + +if (help || args.length === 0) { + // If they didn't ask for help, then this is not a "success" + var log = help ? console.log : console.error + log('Usage: rimraf [ ...]') + log('') + log(' Deletes all files and folders at "path" recursively.') + log('') + log('Options:') + log('') + log(' -h, --help Display this usage info') + log(' -G, --no-glob Do not expand glob patterns in arguments') + log(' -g, --glob Expand glob patterns in arguments (default)') + process.exit(help ? 0 : 1) +} else + go(0) + +function go (n) { + if (n >= args.length) + return + var options = {} + if (noglob) + options = { glob: false } + rimraf(args[n], options, function (er) { + if (er) + throw er + go(n+1) + }) +} diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/LICENSE b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/LICENSE new file mode 100644 index 0000000..42ca266 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/LICENSE @@ -0,0 +1,21 @@ +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. + +## Glob Logo + +Glob's logo created by Tanya Brassie , licensed +under a Creative Commons Attribution-ShareAlike 4.0 International License +https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/README.md b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/README.md new file mode 100644 index 0000000..e71b967 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/README.md @@ -0,0 +1,373 @@ +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master) + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![](logo/glob.png) + +## Usage + +Install with npm + +``` +npm i glob +``` + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* `cb` `{Function}` + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* return: `{Array}` filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` `{String}` pattern to search for +* `options` `{Object}` +* `cb` `{Function}` Called when an error occurs, or matches are found + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'FILE'` - Path exists, and is not a directory + * `'DIR'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the specific + thing that matched. It is not deduplicated or resolved to a realpath. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of glob patterns to exclude matches. + Note: `ignore` patterns are *always* in `dot:true` mode, regardless + of any other settings. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `absolute` Set to true to always receive absolute paths for matched + files. Unlike `realpath`, this also affects the values returned in + the `match` event. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +Previously, this module let you mark a pattern as a "comment" if it +started with a `#` character, or a "negated" pattern if it started +with a `!` character. + +These options were deprecated in version 5, and removed in version 6. + +To specify things that should not match, use the `ignore` option. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Glob Logo +Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo). + +The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/). + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/changelog.md b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/changelog.md new file mode 100644 index 0000000..4163677 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/changelog.md @@ -0,0 +1,67 @@ +## 7.0 + +- Raise error if `options.cwd` is specified, and not a directory + +## 6.0 + +- Remove comment and negation pattern support +- Ignore patterns are always in `dot:true` mode + +## 5.0 + +- Deprecate comment and negation patterns +- Fix regression in `mark` and `nodir` options from making all cache + keys absolute path. +- Abort if `fs.readdir` returns an error that's unexpected +- Don't emit `match` events for ignored items +- Treat ENOTSUP like ENOTDIR in readdir + +## 4.5 + +- Add `options.follow` to always follow directory symlinks in globstar +- Add `options.realpath` to call `fs.realpath` on all results +- Always cache based on absolute path + +## 4.4 + +- Add `options.ignore` +- Fix handling of broken symlinks + +## 4.3 + +- Bump minimatch to 2.x +- Pass all tests on Windows + +## 4.2 + +- Add `glob.hasMagic` function +- Add `options.nodir` flag + +## 4.1 + +- Refactor sync and async implementations for performance +- Throw if callback provided to sync glob function +- Treat symbolic links in globstar results the same as Bash 4.3 + +## 4.0 + +- Use `^` for dependency versions (bumped major because this breaks + older npm versions) +- Ensure callbacks are only ever called once +- switch to ISC license + +## 3.x + +- Rewrite in JavaScript +- Add support for setting root, cwd, and windows support +- Cache many fs calls +- Add globstar support +- emit match events + +## 2.x + +- Use `glob.h` and `fnmatch.h` from NetBSD + +## 1.x + +- `glob.h` static binding. diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/common.js b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/common.js new file mode 100644 index 0000000..66651bb --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/common.js @@ -0,0 +1,240 @@ +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path-is-absolute") +var Minimatch = minimatch.Minimatch + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } + + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + if (process.platform === "win32") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + self.nomount = !!options.nomount + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') + + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/glob.js b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/glob.js new file mode 100644 index 0000000..58dec0f --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/glob.js @@ -0,0 +1,790 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var fs = require('fs') +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var globSync = require('./sync.js') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} + +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + + if (!pattern) + return false + + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + this._processing = 0 + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + sync = false + + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (isIgnored(this, e)) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = isAbsolute(e) ? e : this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) + e = abs + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return cb() + + return cb(null, c, stat) +} diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/package.json b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/package.json new file mode 100644 index 0000000..02962a6 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/package.json @@ -0,0 +1,80 @@ +{ + "_from": "glob@^7.1.3", + "_id": "glob@7.1.4", + "_inBundle": false, + "_integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "_location": "/grpc/rimraf/glob", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "glob@^7.1.3", + "name": "glob", + "escapedName": "glob", + "rawSpec": "^7.1.3", + "saveSpec": null, + "fetchSpec": "^7.1.3" + }, + "_requiredBy": [ + "/grpc/rimraf" + ], + "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "_shasum": "aa608a2f6c577ad357e1ae5a5c26d9a8d1969255", + "_shrinkwrap": null, + "_spec": "glob@^7.1.3", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/rimraf", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/node-glob/issues" + }, + "bundleDependencies": false, + "dependencies": { + "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" + }, + "deprecated": false, + "description": "a little globber", + "devDependencies": { + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^12.0.1", + "tick": "0.0.6" + }, + "engines": { + "node": "*" + }, + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "homepage": "https://github.com/isaacs/node-glob#readme", + "license": "ISC", + "main": "glob.js", + "name": "glob", + "optionalDependencies": {}, + "readme": "# Glob\n\nMatch files using the patterns the shell uses, like stars and stuff.\n\n[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master)\n\nThis is a glob implementation in JavaScript. It uses the `minimatch`\nlibrary to do its matching.\n\n![](logo/glob.png)\n\n## Usage\n\nInstall with npm\n\n```\nnpm i glob\n```\n\n```javascript\nvar glob = require(\"glob\")\n\n// options is optional\nglob(\"**/*.js\", options, function (er, files) {\n // files is an array of filenames.\n // If the `nonull` option is set, and nothing\n // was found, then files is [\"**/*.js\"]\n // er is an error object or null.\n})\n```\n\n## Glob Primer\n\n\"Globs\" are the patterns you type when you do stuff like `ls *.js` on\nthe command line, or put `build/*` in a `.gitignore` file.\n\nBefore parsing the path part patterns, braced sections are expanded\ninto a set. Braced sections start with `{` and end with `}`, with any\nnumber of comma-delimited sections within. Braced sections may contain\nslash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`.\n\nThe following characters have special magic meaning when used in a\npath portion:\n\n* `*` Matches 0 or more characters in a single path portion\n* `?` Matches 1 character\n* `[...]` Matches a range of characters, similar to a RegExp range.\n If the first character of the range is `!` or `^` then it matches\n any character not in the range.\n* `!(pattern|pattern|pattern)` Matches anything that does not match\n any of the patterns provided.\n* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the\n patterns provided.\n* `+(pattern|pattern|pattern)` Matches one or more occurrences of the\n patterns provided.\n* `*(a|b|c)` Matches zero or more occurrences of the patterns provided\n* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns\n provided\n* `**` If a \"globstar\" is alone in a path portion, then it matches\n zero or more directories and subdirectories searching for matches.\n It does not crawl symlinked directories.\n\n### Dots\n\nIf a file or directory path portion has a `.` as the first character,\nthen it will not match any glob pattern unless that pattern's\ncorresponding path part also has a `.` as its first character.\n\nFor example, the pattern `a/.*/c` would match the file at `a/.b/c`.\nHowever the pattern `a/*/c` would not, because `*` does not start with\na dot character.\n\nYou can make glob treat dots as normal characters by setting\n`dot:true` in the options.\n\n### Basename Matching\n\nIf you set `matchBase:true` in the options, and the pattern has no\nslashes in it, then it will seek for any file anywhere in the tree\nwith a matching basename. For example, `*.js` would match\n`test/simple/basic.js`.\n\n### Empty Sets\n\nIf no matching files are found, then an empty array is returned. This\ndiffers from the shell, where the pattern itself is returned. For\nexample:\n\n $ echo a*s*d*f\n a*s*d*f\n\nTo get the bash-style behavior, set the `nonull:true` in the options.\n\n### See Also:\n\n* `man sh`\n* `man bash` (Search for \"Pattern Matching\")\n* `man 3 fnmatch`\n* `man 5 gitignore`\n* [minimatch documentation](https://github.com/isaacs/minimatch)\n\n## glob.hasMagic(pattern, [options])\n\nReturns `true` if there are any special characters in the pattern, and\n`false` otherwise.\n\nNote that the options affect the results. If `noext:true` is set in\nthe options object, then `+(a|b)` will not be considered a magic\npattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`\nthen that is considered magical, unless `nobrace:true` is set in the\noptions.\n\n## glob(pattern, [options], cb)\n\n* `pattern` `{String}` Pattern to be matched\n* `options` `{Object}`\n* `cb` `{Function}`\n * `err` `{Error | null}`\n * `matches` `{Array}` filenames found matching the pattern\n\nPerform an asynchronous glob search.\n\n## glob.sync(pattern, [options])\n\n* `pattern` `{String}` Pattern to be matched\n* `options` `{Object}`\n* return: `{Array}` filenames found matching the pattern\n\nPerform a synchronous glob search.\n\n## Class: glob.Glob\n\nCreate a Glob object by instantiating the `glob.Glob` class.\n\n```javascript\nvar Glob = require(\"glob\").Glob\nvar mg = new Glob(pattern, options, cb)\n```\n\nIt's an EventEmitter, and starts walking the filesystem to find matches\nimmediately.\n\n### new glob.Glob(pattern, [options], [cb])\n\n* `pattern` `{String}` pattern to search for\n* `options` `{Object}`\n* `cb` `{Function}` Called when an error occurs, or matches are found\n * `err` `{Error | null}`\n * `matches` `{Array}` filenames found matching the pattern\n\nNote that if the `sync` flag is set in the options, then matches will\nbe immediately available on the `g.found` member.\n\n### Properties\n\n* `minimatch` The minimatch object that the glob uses.\n* `options` The options object passed in.\n* `aborted` Boolean which is set to true when calling `abort()`. There\n is no way at this time to continue a glob search after aborting, but\n you can re-use the statCache to avoid having to duplicate syscalls.\n* `cache` Convenience object. Each field has the following possible\n values:\n * `false` - Path does not exist\n * `true` - Path exists\n * `'FILE'` - Path exists, and is not a directory\n * `'DIR'` - Path exists, and is a directory\n * `[file, entries, ...]` - Path exists, is a directory, and the\n array value is the results of `fs.readdir`\n* `statCache` Cache of `fs.stat` results, to prevent statting the same\n path multiple times.\n* `symlinks` A record of which paths are symbolic links, which is\n relevant in resolving `**` patterns.\n* `realpathCache` An optional object which is passed to `fs.realpath`\n to minimize unnecessary syscalls. It is stored on the instantiated\n Glob object, and may be re-used.\n\n### Events\n\n* `end` When the matching is finished, this is emitted with all the\n matches found. If the `nonull` option is set, and no match was found,\n then the `matches` list contains the original pattern. The matches\n are sorted, unless the `nosort` flag is set.\n* `match` Every time a match is found, this is emitted with the specific\n thing that matched. It is not deduplicated or resolved to a realpath.\n* `error` Emitted when an unexpected error is encountered, or whenever\n any fs error occurs if `options.strict` is set.\n* `abort` When `abort()` is called, this event is raised.\n\n### Methods\n\n* `pause` Temporarily stop the search\n* `resume` Resume the search\n* `abort` Stop the search forever\n\n### Options\n\nAll the options that can be passed to Minimatch can also be passed to\nGlob to change pattern matching behavior. Also, some have been added,\nor have glob-specific ramifications.\n\nAll options are false by default, unless otherwise noted.\n\nAll options are added to the Glob object, as well.\n\nIf you are running many `glob` operations, you can pass a Glob object\nas the `options` argument to a subsequent operation to shortcut some\n`stat` and `readdir` calls. At the very least, you may pass in shared\n`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that\nparallel glob operations will be sped up by sharing information about\nthe filesystem.\n\n* `cwd` The current working directory in which to search. Defaults\n to `process.cwd()`.\n* `root` The place where patterns starting with `/` will be mounted\n onto. Defaults to `path.resolve(options.cwd, \"/\")` (`/` on Unix\n systems, and `C:\\` or some such on Windows.)\n* `dot` Include `.dot` files in normal matches and `globstar` matches.\n Note that an explicit dot in a portion of the pattern will always\n match dot files.\n* `nomount` By default, a pattern starting with a forward-slash will be\n \"mounted\" onto the root setting, so that a valid filesystem path is\n returned. Set this flag to disable that behavior.\n* `mark` Add a `/` character to directory matches. Note that this\n requires additional stat calls.\n* `nosort` Don't sort the results.\n* `stat` Set to true to stat *all* results. This reduces performance\n somewhat, and is completely unnecessary, unless `readdir` is presumed\n to be an untrustworthy indicator of file existence.\n* `silent` When an unusual error is encountered when attempting to\n read a directory, a warning will be printed to stderr. Set the\n `silent` option to true to suppress these warnings.\n* `strict` When an unusual error is encountered when attempting to\n read a directory, the process will just continue on in search of\n other matches. Set the `strict` option to raise an error in these\n cases.\n* `cache` See `cache` property above. Pass in a previously generated\n cache object to save some fs calls.\n* `statCache` A cache of results of filesystem information, to prevent\n unnecessary stat calls. While it should not normally be necessary\n to set this, you may pass the statCache from one glob() call to the\n options object of another, if you know that the filesystem will not\n change between calls. (See \"Race Conditions\" below.)\n* `symlinks` A cache of known symbolic links. You may pass in a\n previously generated `symlinks` object to save `lstat` calls when\n resolving `**` matches.\n* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead.\n* `nounique` In some cases, brace-expanded patterns can result in the\n same file showing up multiple times in the result set. By default,\n this implementation prevents duplicates in the result set. Set this\n flag to disable that behavior.\n* `nonull` Set to never return an empty set, instead returning a set\n containing the pattern itself. This is the default in glob(3).\n* `debug` Set to enable debug logging in minimatch and glob.\n* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets.\n* `noglobstar` Do not match `**` against multiple filenames. (Ie,\n treat it as a normal `*` instead.)\n* `noext` Do not match `+(a|b)` \"extglob\" patterns.\n* `nocase` Perform a case-insensitive match. Note: on\n case-insensitive filesystems, non-magic patterns will match by\n default, since `stat` and `readdir` will not raise errors.\n* `matchBase` Perform a basename-only match if the pattern does not\n contain any slash characters. That is, `*.js` would be treated as\n equivalent to `**/*.js`, matching all js files in all directories.\n* `nodir` Do not match directories, only files. (Note: to match\n *only* directories, simply put a `/` at the end of the pattern.)\n* `ignore` Add a pattern or an array of glob patterns to exclude matches.\n Note: `ignore` patterns are *always* in `dot:true` mode, regardless\n of any other settings.\n* `follow` Follow symlinked directories when expanding `**` patterns.\n Note that this can result in a lot of duplicate references in the\n presence of cyclic links.\n* `realpath` Set to true to call `fs.realpath` on all of the results.\n In the case of a symlink that cannot be resolved, the full absolute\n path to the matched entry is returned (though it will usually be a\n broken symlink)\n* `absolute` Set to true to always receive absolute paths for matched\n files. Unlike `realpath`, this also affects the values returned in\n the `match` event.\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between node-glob and other\nimplementations, and are intentional.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.3, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not.\n\nNote that symlinked directories are not crawled as part of a `**`,\nthough their contents may match against subsequent portions of the\npattern. This prevents infinite loops and duplicates and the like.\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen glob returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`glob.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n\n### Comments and Negation\n\nPreviously, this module let you mark a pattern as a \"comment\" if it\nstarted with a `#` character, or a \"negated\" pattern if it started\nwith a `!` character.\n\nThese options were deprecated in version 5, and removed in version 6.\n\nTo specify things that should not match, use the `ignore` option.\n\n## Windows\n\n**Please only use forward-slashes in glob expressions.**\n\nThough windows uses either `/` or `\\` as its path separator, only `/`\ncharacters are used by this glob implementation. You must use\nforward-slashes **only** in glob expressions. Back-slashes will always\nbe interpreted as escape characters, not path separators.\n\nResults from absolute patterns such as `/foo/*` are mounted onto the\nroot setting using `path.join`. On windows, this will by default result\nin `/foo/*` matching `C:\\foo\\bar.txt`.\n\n## Race Conditions\n\nGlob searching, by its very nature, is susceptible to race conditions,\nsince it relies on directory walking and such.\n\nAs a result, it is possible that a file that exists when glob looks for\nit may have been deleted or modified by the time it returns the result.\n\nAs part of its internal implementation, this program caches all stat\nand readdir calls that it makes, in order to cut down on system\noverhead. However, this also makes it even more susceptible to races,\nespecially if the cache or statCache objects are reused between glob\ncalls.\n\nUsers are thus advised not to use a glob result as a guarantee of\nfilesystem state in the face of rapid changes. For the vast majority\nof operations, this is never a problem.\n\n## Glob Logo\nGlob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo).\n\nThe logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).\n\n## Contributing\n\nAny change to behavior (including bugfixes) must come with a test.\n\nPatches that fail tests or reduce performance will be rejected.\n\n```\n# to run tests\nnpm test\n\n# to re-generate test fixtures\nnpm run test-regen\n\n# to benchmark against bash/zsh\nnpm run bench\n\n# to profile javascript\nnpm run prof\n```\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "scripts": { + "bench": "bash benchmark.sh", + "benchclean": "node benchclean.js", + "prepublish": "npm run benchclean", + "prof": "bash prof.sh && cat profile.txt", + "profclean": "rm -f v8.log profile.txt", + "test": "tap test/*.js --cov", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js" + }, + "version": "7.1.4" +} diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/sync.js b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/sync.js new file mode 100644 index 0000000..c952134 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/sync.js @@ -0,0 +1,486 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = require('fs') +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = rp.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) + return + + var abs = this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) { + e = abs + } + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null + } + } + + var isSym = lstat && lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + throw error + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } + } + + if (lstat && lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/legacy-libs/grpc/node_modules/rimraf/package.json b/legacy-libs/grpc/node_modules/rimraf/package.json new file mode 100644 index 0000000..1896924 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/package.json @@ -0,0 +1,78 @@ +{ + "_from": "rimraf@^2.6.1", + "_id": "rimraf@2.6.3", + "_inBundle": false, + "_integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "_location": "/grpc/rimraf", + "_phantomChildren": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "rimraf@^2.6.1", + "name": "rimraf", + "escapedName": "rimraf", + "rawSpec": "^2.6.1", + "saveSpec": null, + "fetchSpec": "^2.6.1" + }, + "_requiredBy": [ + "/grpc/node-pre-gyp" + ], + "_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "_shasum": "b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab", + "_shrinkwrap": null, + "_spec": "rimraf@^2.6.1", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/node-pre-gyp", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bin": { + "rimraf": "./bin.js" + }, + "bugs": { + "url": "https://github.com/isaacs/rimraf/issues" + }, + "bundleDependencies": false, + "dependencies": { + "glob": "^7.1.3" + }, + "deprecated": false, + "description": "A deep deletion module for node (like `rm -rf`)", + "devDependencies": { + "mkdirp": "^0.5.1", + "tap": "^12.1.1" + }, + "files": [ + "LICENSE", + "README.md", + "bin.js", + "rimraf.js" + ], + "homepage": "https://github.com/isaacs/rimraf#readme", + "license": "ISC", + "main": "rimraf.js", + "name": "rimraf", + "optionalDependencies": {}, + "readme": "[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies)\n\nThe [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node.\n\nInstall with `npm install rimraf`, or just drop rimraf.js somewhere.\n\n## API\n\n`rimraf(f, [opts], callback)`\n\nThe first parameter will be interpreted as a globbing pattern for files. If you\nwant to disable globbing you can do so with `opts.disableGlob` (defaults to\n`false`). This might be handy, for instance, if you have filenames that contain\nglobbing wildcard characters.\n\nThe callback will be called with an error if there is one. Certain\nerrors are handled for you:\n\n* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of\n `opts.maxBusyTries` times before giving up, adding 100ms of wait\n between each attempt. The default `maxBusyTries` is 3.\n* `ENOENT` - If the file doesn't exist, rimraf will return\n successfully, since your desired outcome is already the case.\n* `EMFILE` - Since `readdir` requires opening a file descriptor, it's\n possible to hit `EMFILE` if too many file descriptors are in use.\n In the sync case, there's nothing to be done for this. But in the\n async case, rimraf will gradually back off with timeouts up to\n `opts.emfileWait` ms, which defaults to 1000.\n\n## options\n\n* unlink, chmod, stat, lstat, rmdir, readdir,\n unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync\n\n In order to use a custom file system library, you can override\n specific fs functions on the options object.\n\n If any of these functions are present on the options object, then\n the supplied function will be used instead of the default fs\n method.\n\n Sync methods are only relevant for `rimraf.sync()`, of course.\n\n For example:\n\n ```javascript\n var myCustomFS = require('some-custom-fs')\n\n rimraf('some-thing', myCustomFS, callback)\n ```\n\n* maxBusyTries\n\n If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered\n on Windows systems, then rimraf will retry with a linear backoff\n wait of 100ms longer on each try. The default maxBusyTries is 3.\n\n Only relevant for async usage.\n\n* emfileWait\n\n If an `EMFILE` error is encountered, then rimraf will retry\n repeatedly with a linear backoff of 1ms longer on each try, until\n the timeout counter hits this max. The default limit is 1000.\n\n If you repeatedly encounter `EMFILE` errors, then consider using\n [graceful-fs](http://npm.im/graceful-fs) in your program.\n\n Only relevant for async usage.\n\n* glob\n\n Set to `false` to disable [glob](http://npm.im/glob) pattern\n matching.\n\n Set to an object to pass options to the glob module. The default\n glob options are `{ nosort: true, silent: true }`.\n\n Glob version 6 is used in this module.\n\n Relevant for both sync and async usage.\n\n* disableGlob\n\n Set to any non-falsey value to disable globbing entirely.\n (Equivalent to setting `glob: false`.)\n\n## rimraf.sync\n\nIt can remove stuff synchronously, too. But that's not so good. Use\nthe async API. It's better.\n\n## CLI\n\nIf installed with `npm install rimraf -g` it can be used as a global\ncommand `rimraf [ ...]` which is useful for cross platform support.\n\n## mkdirp\n\nIf you need to create a directory recursively, check out\n[mkdirp](https://github.com/substack/node-mkdirp).\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/rimraf.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js" + }, + "version": "2.6.3" +} diff --git a/legacy-libs/grpc/node_modules/rimraf/rimraf.js b/legacy-libs/grpc/node_modules/rimraf/rimraf.js new file mode 100644 index 0000000..e80dd10 --- /dev/null +++ b/legacy-libs/grpc/node_modules/rimraf/rimraf.js @@ -0,0 +1,364 @@ +module.exports = rimraf +rimraf.sync = rimrafSync + +var assert = require("assert") +var path = require("path") +var fs = require("fs") +var glob = require("glob") +var _0666 = parseInt('666', 8) + +var defaultGlobOpts = { + nosort: true, + silent: true +} + +// for EMFILE handling +var timeout = 0 + +var isWindows = (process.platform === "win32") + +function defaults (options) { + var methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(function(m) { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) + + options.maxBusyTries = options.maxBusyTries || 3 + options.emfileWait = options.emfileWait || 1000 + if (options.glob === false) { + options.disableGlob = true + } + options.disableGlob = options.disableGlob || false + options.glob = options.glob || defaultGlobOpts +} + +function rimraf (p, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } + + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert.equal(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.equal(typeof options, 'object', 'rimraf: options should be object') + + defaults(options) + + var busyTries = 0 + var errState = null + var n = 0 + + if (options.disableGlob || !glob.hasMagic(p)) + return afterGlob(null, [p]) + + options.lstat(p, function (er, stat) { + if (!er) + return afterGlob(null, [p]) + + glob(p, options.glob, afterGlob) + }) + + function next (er) { + errState = errState || er + if (--n === 0) + cb(errState) + } + + function afterGlob (er, results) { + if (er) + return cb(er) + + n = results.length + if (n === 0) + return cb() + + results.forEach(function (p) { + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && + busyTries < options.maxBusyTries) { + busyTries ++ + var time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(function () { + rimraf_(p, options, CB) + }, time) + } + + // this one won't happen if graceful-fs is used. + if (er.code === "EMFILE" && timeout < options.emfileWait) { + return setTimeout(function () { + rimraf_(p, options, CB) + }, timeout ++) + } + + // already gone + if (er.code === "ENOENT") er = null + } + + timeout = 0 + next(er) + }) + }) + } +} + +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, function (er, st) { + if (er && er.code === "ENOENT") + return cb(null) + + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === "EPERM" && isWindows) + fixWinEPERM(p, options, er, cb) + + if (st && st.isDirectory()) + return rmdir(p, options, er, cb) + + options.unlink(p, function (er) { + if (er) { + if (er.code === "ENOENT") + return cb(null) + if (er.code === "EPERM") + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + if (er.code === "EISDIR") + return rmdir(p, options, er, cb) + } + return cb(er) + }) + }) +} + +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + if (er) + assert(er instanceof Error) + + options.chmod(p, _0666, function (er2) { + if (er2) + cb(er2.code === "ENOENT" ? null : er) + else + options.stat(p, function(er3, stats) { + if (er3) + cb(er3.code === "ENOENT" ? null : er) + else if (stats.isDirectory()) + rmdir(p, options, er, cb) + else + options.unlink(p, cb) + }) + }) +} + +function fixWinEPERMSync (p, options, er) { + assert(p) + assert(options) + if (er) + assert(er instanceof Error) + + try { + options.chmodSync(p, _0666) + } catch (er2) { + if (er2.code === "ENOENT") + return + else + throw er + } + + try { + var stats = options.statSync(p) + } catch (er3) { + if (er3.code === "ENOENT") + return + else + throw er + } + + if (stats.isDirectory()) + rmdirSync(p, options, er) + else + options.unlinkSync(p) +} + +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + if (originalEr) + assert(originalEr instanceof Error) + assert(typeof cb === 'function') + + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, function (er) { + if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) + rmkids(p, options, cb) + else if (er && er.code === "ENOTDIR") + cb(originalEr) + else + cb(er) + }) +} + +function rmkids(p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.readdir(p, function (er, files) { + if (er) + return cb(er) + var n = files.length + if (n === 0) + return options.rmdir(p, cb) + var errState + files.forEach(function (f) { + rimraf(path.join(p, f), options, function (er) { + if (errState) + return + if (er) + return cb(errState = er) + if (--n === 0) + options.rmdir(p, cb) + }) + }) + }) +} + +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + options = options || {} + defaults(options) + + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.equal(typeof options, 'object', 'rimraf: options should be object') + + var results + + if (options.disableGlob || !glob.hasMagic(p)) { + results = [p] + } else { + try { + options.lstatSync(p) + results = [p] + } catch (er) { + results = glob.sync(p, options.glob) + } + } + + if (!results.length) + return + + for (var i = 0; i < results.length; i++) { + var p = results[i] + + try { + var st = options.lstatSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + + // Windows can EPERM on stat. Life is suffering. + if (er.code === "EPERM" && isWindows) + fixWinEPERMSync(p, options, er) + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) + rmdirSync(p, options, null) + else + options.unlinkSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "EPERM") + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + if (er.code !== "EISDIR") + throw er + + rmdirSync(p, options, er) + } + } +} + +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + if (originalEr) + assert(originalEr instanceof Error) + + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "ENOTDIR") + throw originalEr + if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") + rmkidsSync(p, options) + } +} + +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(function (f) { + rimrafSync(path.join(p, f), options) + }) + + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + var retries = isWindows ? 100 : 1 + var i = 0 + do { + var threw = true + try { + var ret = options.rmdirSync(p, options) + threw = false + return ret + } finally { + if (++i < retries && threw) + continue + } + } while (true) +} diff --git a/legacy-libs/grpc/node_modules/safe-buffer/LICENSE b/legacy-libs/grpc/node_modules/safe-buffer/LICENSE new file mode 100644 index 0000000..0c068ce --- /dev/null +++ b/legacy-libs/grpc/node_modules/safe-buffer/LICENSE @@ -0,0 +1,21 @@ +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/legacy-libs/grpc/node_modules/safe-buffer/README.md b/legacy-libs/grpc/node_modules/safe-buffer/README.md new file mode 100644 index 0000000..e9a81af --- /dev/null +++ b/legacy-libs/grpc/node_modules/safe-buffer/README.md @@ -0,0 +1,584 @@ +# 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/legacy-libs/grpc/node_modules/safe-buffer/index.d.ts b/legacy-libs/grpc/node_modules/safe-buffer/index.d.ts new file mode 100644 index 0000000..e9fed80 --- /dev/null +++ b/legacy-libs/grpc/node_modules/safe-buffer/index.d.ts @@ -0,0 +1,187 @@ +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/legacy-libs/grpc/node_modules/safe-buffer/index.js b/legacy-libs/grpc/node_modules/safe-buffer/index.js new file mode 100644 index 0000000..22438da --- /dev/null +++ b/legacy-libs/grpc/node_modules/safe-buffer/index.js @@ -0,0 +1,62 @@ +/* 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) +} + +// 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/legacy-libs/grpc/node_modules/safe-buffer/package.json b/legacy-libs/grpc/node_modules/safe-buffer/package.json new file mode 100644 index 0000000..5ec6350 --- /dev/null +++ b/legacy-libs/grpc/node_modules/safe-buffer/package.json @@ -0,0 +1,73 @@ +{ + "_args": [ + [ + "safe-buffer@5.1.2", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "safe-buffer@5.1.2", + "_id": "safe-buffer@5.1.2", + "_inBundle": false, + "_integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "_location": "/grpc/safe-buffer", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "safe-buffer@5.1.2", + "name": "safe-buffer", + "escapedName": "safe-buffer", + "rawSpec": "5.1.2", + "saveSpec": null, + "fetchSpec": "5.1.2" + }, + "_requiredBy": [ + "/grpc/minipass", + "/grpc/readable-stream", + "/grpc/string_decoder", + "/grpc/tar" + ], + "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "_shrinkwrap": null, + "_spec": "5.1.2", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/safe-buffer/issues" + }, + "dependencies": {}, + "description": "Safer Node.js Buffer API", + "devDependencies": { + "standard": "*", + "tape": "^4.0.0" + }, + "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", + "optionalDependencies": {}, + "readme": "# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]\n\n[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg\n[travis-url]: https://travis-ci.org/feross/safe-buffer\n[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg\n[npm-url]: https://npmjs.org/package/safe-buffer\n[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg\n[downloads-url]: https://npmjs.org/package/safe-buffer\n[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg\n[standard-url]: https://standardjs.com\n\n#### Safer Node.js Buffer API\n\n**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`,\n`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.**\n\n**Uses the built-in implementation when available.**\n\n## install\n\n```\nnpm install safe-buffer\n```\n\n## usage\n\nThe goal of this package is to provide a safe replacement for the node.js `Buffer`.\n\nIt's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to\nthe top of your node.js modules:\n\n```js\nvar Buffer = require('safe-buffer').Buffer\n\n// Existing buffer code will continue to work without issues:\n\nnew Buffer('hey', 'utf8')\nnew Buffer([1, 2, 3], 'utf8')\nnew Buffer(obj)\nnew Buffer(16) // create an uninitialized buffer (potentially unsafe)\n\n// But you can use these new explicit APIs to make clear what you want:\n\nBuffer.from('hey', 'utf8') // convert from many types to a Buffer\nBuffer.alloc(16) // create a zero-filled buffer (safe)\nBuffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe)\n```\n\n## api\n\n### Class Method: Buffer.from(array)\n\n\n* `array` {Array}\n\nAllocates a new `Buffer` using an `array` of octets.\n\n```js\nconst buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]);\n // creates a new Buffer containing ASCII bytes\n // ['b','u','f','f','e','r']\n```\n\nA `TypeError` will be thrown if `array` is not an `Array`.\n\n### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]])\n\n\n* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or\n a `new ArrayBuffer()`\n* `byteOffset` {Number} Default: `0`\n* `length` {Number} Default: `arrayBuffer.length - byteOffset`\n\nWhen passed a reference to the `.buffer` property of a `TypedArray` instance,\nthe newly created `Buffer` will share the same allocated memory as the\nTypedArray.\n\n```js\nconst arr = new Uint16Array(2);\narr[0] = 5000;\narr[1] = 4000;\n\nconst buf = Buffer.from(arr.buffer); // shares the memory with arr;\n\nconsole.log(buf);\n // Prints: \n\n// changing the TypedArray changes the Buffer also\narr[1] = 6000;\n\nconsole.log(buf);\n // Prints: \n```\n\nThe optional `byteOffset` and `length` arguments specify a memory range within\nthe `arrayBuffer` that will be shared by the `Buffer`.\n\n```js\nconst ab = new ArrayBuffer(10);\nconst buf = Buffer.from(ab, 0, 2);\nconsole.log(buf.length);\n // Prints: 2\n```\n\nA `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`.\n\n### Class Method: Buffer.from(buffer)\n\n\n* `buffer` {Buffer}\n\nCopies the passed `buffer` data onto a new `Buffer` instance.\n\n```js\nconst buf1 = Buffer.from('buffer');\nconst buf2 = Buffer.from(buf1);\n\nbuf1[0] = 0x61;\nconsole.log(buf1.toString());\n // 'auffer'\nconsole.log(buf2.toString());\n // 'buffer' (copy is not changed)\n```\n\nA `TypeError` will be thrown if `buffer` is not a `Buffer`.\n\n### Class Method: Buffer.from(str[, encoding])\n\n\n* `str` {String} String to encode.\n* `encoding` {String} Encoding to use, Default: `'utf8'`\n\nCreates a new `Buffer` containing the given JavaScript string `str`. If\nprovided, the `encoding` parameter identifies the character encoding.\nIf not provided, `encoding` defaults to `'utf8'`.\n\n```js\nconst buf1 = Buffer.from('this is a tést');\nconsole.log(buf1.toString());\n // prints: this is a tést\nconsole.log(buf1.toString('ascii'));\n // prints: this is a tC)st\n\nconst buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');\nconsole.log(buf2.toString());\n // prints: this is a tést\n```\n\nA `TypeError` will be thrown if `str` is not a string.\n\n### Class Method: Buffer.alloc(size[, fill[, encoding]])\n\n\n* `size` {Number}\n* `fill` {Value} Default: `undefined`\n* `encoding` {String} Default: `utf8`\n\nAllocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the\n`Buffer` will be *zero-filled*.\n\n```js\nconst buf = Buffer.alloc(5);\nconsole.log(buf);\n // \n```\n\nThe `size` must be less than or equal to the value of\n`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is\n`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will\nbe created if a `size` less than or equal to 0 is specified.\n\nIf `fill` is specified, the allocated `Buffer` will be initialized by calling\n`buf.fill(fill)`. See [`buf.fill()`][] for more information.\n\n```js\nconst buf = Buffer.alloc(5, 'a');\nconsole.log(buf);\n // \n```\n\nIf both `fill` and `encoding` are specified, the allocated `Buffer` will be\ninitialized by calling `buf.fill(fill, encoding)`. For example:\n\n```js\nconst buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');\nconsole.log(buf);\n // \n```\n\nCalling `Buffer.alloc(size)` can be significantly slower than the alternative\n`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance\ncontents will *never contain sensitive data*.\n\nA `TypeError` will be thrown if `size` is not a number.\n\n### Class Method: Buffer.allocUnsafe(size)\n\n\n* `size` {Number}\n\nAllocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must\nbe less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit\narchitectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is\nthrown. A zero-length Buffer will be created if a `size` less than or equal to\n0 is specified.\n\nThe underlying memory for `Buffer` instances created in this way is *not\ninitialized*. The contents of the newly created `Buffer` are unknown and\n*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such\n`Buffer` instances to zeroes.\n\n```js\nconst buf = Buffer.allocUnsafe(5);\nconsole.log(buf);\n // \n // (octets will be different, every time)\nbuf.fill(0);\nconsole.log(buf);\n // \n```\n\nA `TypeError` will be thrown if `size` is not a number.\n\nNote that the `Buffer` module pre-allocates an internal `Buffer` instance of\nsize `Buffer.poolSize` that is used as a pool for the fast allocation of new\n`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated\n`new Buffer(size)` constructor) only when `size` is less than or equal to\n`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default\nvalue of `Buffer.poolSize` is `8192` but can be modified.\n\nUse of this pre-allocated internal memory pool is a key difference between\ncalling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.\nSpecifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer\npool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal\nBuffer pool if `size` is less than or equal to half `Buffer.poolSize`. The\ndifference is subtle but can be important when an application requires the\nadditional performance that `Buffer.allocUnsafe(size)` provides.\n\n### Class Method: Buffer.allocUnsafeSlow(size)\n\n\n* `size` {Number}\n\nAllocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The\n`size` must be less than or equal to the value of\n`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is\n`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will\nbe created if a `size` less than or equal to 0 is specified.\n\nThe underlying memory for `Buffer` instances created in this way is *not\ninitialized*. The contents of the newly created `Buffer` are unknown and\n*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such\n`Buffer` instances to zeroes.\n\nWhen using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,\nallocations under 4KB are, by default, sliced from a single pre-allocated\n`Buffer`. This allows applications to avoid the garbage collection overhead of\ncreating many individually allocated Buffers. This approach improves both\nperformance and memory usage by eliminating the need to track and cleanup as\nmany `Persistent` objects.\n\nHowever, in the case where a developer may need to retain a small chunk of\nmemory from a pool for an indeterminate amount of time, it may be appropriate\nto create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then\ncopy out the relevant bits.\n\n```js\n// need to keep around a few small chunks of memory\nconst store = [];\n\nsocket.on('readable', () => {\n const data = socket.read();\n // allocate for retained data\n const sb = Buffer.allocUnsafeSlow(10);\n // copy the data into the new allocation\n data.copy(sb, 0, 0, 10);\n store.push(sb);\n});\n```\n\nUse of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after*\na developer has observed undue memory retention in their applications.\n\nA `TypeError` will be thrown if `size` is not a number.\n\n### All the Rest\n\nThe rest of the `Buffer` API is exactly the same as in node.js.\n[See the docs](https://nodejs.org/api/buffer.html).\n\n\n## Related links\n\n- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660)\n- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4)\n\n## Why is `Buffer` unsafe?\n\nToday, the node.js `Buffer` constructor is overloaded to handle many different argument\ntypes like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.),\n`ArrayBuffer`, and also `Number`.\n\nThe API is optimized for convenience: you can throw any type at it, and it will try to do\nwhat you want.\n\nBecause the Buffer constructor is so powerful, you often see code like this:\n\n```js\n// Convert UTF-8 strings to hex\nfunction toHex (str) {\n return new Buffer(str).toString('hex')\n}\n```\n\n***But what happens if `toHex` is called with a `Number` argument?***\n\n### Remote Memory Disclosure\n\nIf an attacker can make your program call the `Buffer` constructor with a `Number`\nargument, then they can make it allocate uninitialized memory from the node.js process.\nThis could potentially disclose TLS private keys, user data, or database passwords.\n\nWhen the `Buffer` constructor is passed a `Number` argument, it returns an\n**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like\nthis, you **MUST** overwrite the contents before returning it to the user.\n\nFrom the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size):\n\n> `new Buffer(size)`\n>\n> - `size` Number\n>\n> The underlying memory for `Buffer` instances created in this way is not initialized.\n> **The contents of a newly created `Buffer` are unknown and could contain sensitive\n> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes.\n\n(Emphasis our own.)\n\nWhenever the programmer intended to create an uninitialized `Buffer` you often see code\nlike this:\n\n```js\nvar buf = new Buffer(16)\n\n// Immediately overwrite the uninitialized buffer with data from another buffer\nfor (var i = 0; i < buf.length; i++) {\n buf[i] = otherBuf[i]\n}\n```\n\n\n### Would this ever be a problem in real code?\n\nYes. It's surprisingly common to forget to check the type of your variables in a\ndynamically-typed language like JavaScript.\n\nUsually the consequences of assuming the wrong type is that your program crashes with an\nuncaught exception. But the failure mode for forgetting to check the type of arguments to\nthe `Buffer` constructor is more catastrophic.\n\nHere's an example of a vulnerable service that takes a JSON payload and converts it to\nhex:\n\n```js\n// Take a JSON payload {str: \"some string\"} and convert it to hex\nvar server = http.createServer(function (req, res) {\n var data = ''\n req.setEncoding('utf8')\n req.on('data', function (chunk) {\n data += chunk\n })\n req.on('end', function () {\n var body = JSON.parse(data)\n res.end(new Buffer(body.str).toString('hex'))\n })\n})\n\nserver.listen(8080)\n```\n\nIn this example, an http client just has to send:\n\n```json\n{\n \"str\": 1000\n}\n```\n\nand it will get back 1,000 bytes of uninitialized memory from the server.\n\nThis is a very serious bug. It's similar in severity to the\n[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process\nmemory by remote attackers.\n\n\n### Which real-world packages were vulnerable?\n\n#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht)\n\n[Mathias Buus](https://github.com/mafintosh) and I\n([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages,\n[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow\nanyone on the internet to send a series of messages to a user of `bittorrent-dht` and get\nthem to reveal 20 bytes at a time of uninitialized memory from the node.js process.\n\nHere's\n[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8)\nthat fixed it. We released a new fixed version, created a\n[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all\nvulnerable versions on npm so users will get a warning to upgrade to a newer version.\n\n#### [`ws`](https://www.npmjs.com/package/ws)\n\nThat got us wondering if there were other vulnerable packages. Sure enough, within a short\nperiod of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the\nmost popular WebSocket implementation in node.js.\n\nIf certain APIs were called with `Number` parameters instead of `String` or `Buffer` as\nexpected, then uninitialized server memory would be disclosed to the remote peer.\n\nThese were the vulnerable methods:\n\n```js\nsocket.send(number)\nsocket.ping(number)\nsocket.pong(number)\n```\n\nHere's a vulnerable socket server with some echo functionality:\n\n```js\nserver.on('connection', function (socket) {\n socket.on('message', function (message) {\n message = JSON.parse(message)\n if (message.type === 'echo') {\n socket.send(message.data) // send back the user's message\n }\n })\n})\n```\n\n`socket.send(number)` called on the server, will disclose server memory.\n\nHere's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue\nwas fixed, with a more detailed explanation. Props to\n[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the\n[Node Security Project disclosure](https://nodesecurity.io/advisories/67).\n\n\n### What's the solution?\n\nIt's important that node.js offers a fast way to get memory otherwise performance-critical\napplications would needlessly get a lot slower.\n\nBut we need a better way to *signal our intent* as programmers. **When we want\nuninitialized memory, we should request it explicitly.**\n\nSensitive functionality should not be packed into a developer-friendly API that loosely\naccepts many different types. This type of API encourages the lazy practice of passing\nvariables in without checking the type very carefully.\n\n#### A new API: `Buffer.allocUnsafe(number)`\n\nThe functionality of creating buffers with uninitialized memory should be part of another\nAPI. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that\nfrequently gets user input of all sorts of different types passed into it.\n\n```js\nvar buf = Buffer.allocUnsafe(16) // careful, uninitialized memory!\n\n// Immediately overwrite the uninitialized buffer with data from another buffer\nfor (var i = 0; i < buf.length; i++) {\n buf[i] = otherBuf[i]\n}\n```\n\n\n### How do we fix node.js core?\n\nWe sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as\n`semver-major`) which defends against one case:\n\n```js\nvar str = 16\nnew Buffer(str, 'utf8')\n```\n\nIn this situation, it's implied that the programmer intended the first argument to be a\nstring, since they passed an encoding as a second argument. Today, node.js will allocate\nuninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not\nwhat the programmer intended.\n\nBut this is only a partial solution, since if the programmer does `new Buffer(variable)`\n(without an `encoding` parameter) there's no way to know what they intended. If `variable`\nis sometimes a number, then uninitialized memory will sometimes be returned.\n\n### What's the real long-term fix?\n\nWe could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when\nwe need uninitialized memory. But that would break 1000s of packages.\n\n~~We believe the best solution is to:~~\n\n~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~\n\n~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~\n\n#### Update\n\nWe now support adding three new APIs:\n\n- `Buffer.from(value)` - convert from any type to a buffer\n- `Buffer.alloc(size)` - create a zero-filled buffer\n- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size\n\nThis solves the core problem that affected `ws` and `bittorrent-dht` which is\n`Buffer(variable)` getting tricked into taking a number argument.\n\nThis way, existing code continues working and the impact on the npm ecosystem will be\nminimal. Over time, npm maintainers can migrate performance-critical code to use\n`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`.\n\n\n### Conclusion\n\nWe think there's a serious design issue with the `Buffer` API as it exists today. It\npromotes insecure software by putting high-risk functionality into a convenient API\nwith friendly \"developer ergonomics\".\n\nThis wasn't merely a theoretical exercise because we found the issue in some of the\nmost popular npm packages.\n\nFortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of\n`buffer`.\n\n```js\nvar Buffer = require('safe-buffer').Buffer\n```\n\nEventually, we hope that node.js core can switch to this new, safer behavior. We believe\nthe impact on the ecosystem would be minimal since it's not a breaking change.\nWell-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while\nolder, insecure packages would magically become safe from this attack vector.\n\n\n## links\n\n- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514)\n- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67)\n- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68)\n\n\n## credit\n\nThe original issues in `bittorrent-dht`\n([disclosure](https://nodesecurity.io/advisories/68)) and\n`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by\n[Mathias Buus](https://github.com/mafintosh) and\n[Feross Aboukhadijeh](http://feross.org/).\n\nThanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues\nand for his work running the [Node Security Project](https://nodesecurity.io/).\n\nThanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and\nauditing the code.\n\n\n## license\n\nMIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org)\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/feross/safe-buffer.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + }, + "types": "index.d.ts", + "version": "5.1.2" +} diff --git a/legacy-libs/grpc/node_modules/safer-buffer/LICENSE b/legacy-libs/grpc/node_modules/safer-buffer/LICENSE new file mode 100644 index 0000000..4fe9e6f --- /dev/null +++ b/legacy-libs/grpc/node_modules/safer-buffer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Nikita Skovoroda + +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/legacy-libs/grpc/node_modules/safer-buffer/Porting-Buffer.md b/legacy-libs/grpc/node_modules/safer-buffer/Porting-Buffer.md new file mode 100644 index 0000000..68d86ba --- /dev/null +++ b/legacy-libs/grpc/node_modules/safer-buffer/Porting-Buffer.md @@ -0,0 +1,268 @@ +# Porting to the Buffer.from/Buffer.alloc API + + +## Overview + +- [Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x.](#variant-1) (*recommended*) +- [Variant 2: Use a polyfill](#variant-2) +- [Variant 3: manual detection, with safeguards](#variant-3) + +### Finding problematic bits of code using grep + +Just run `grep -nrE '[^a-zA-Z](Slow)?Buffer\s*\(' --exclude-dir node_modules`. + +It will find all the potentially unsafe places in your own code (with some considerably unlikely +exceptions). + +### Finding problematic bits of code using Node.js 8 + +If you’re using Node.js ≥ 8.0.0 (which is recommended), Node.js exposes multiple options that help with finding the relevant pieces of code: + +- `--trace-warnings` will make Node.js show a stack trace for this warning and other warnings that are printed by Node.js. +- `--trace-deprecation` does the same thing, but only for deprecation warnings. +- `--pending-deprecation` will show more types of deprecation warnings. In particular, it will show the `Buffer()` deprecation warning, even on Node.js 8. + +You can set these flags using an environment variable: + +```console +$ export NODE_OPTIONS='--trace-warnings --pending-deprecation' +$ cat example.js +'use strict'; +const foo = new Buffer('foo'); +$ node example.js +(node:7147) [DEP0005] DeprecationWarning: The Buffer() and new Buffer() constructors are not recommended for use due to security and usability concerns. Please use the new Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() construction methods instead. + at showFlaggedDeprecation (buffer.js:127:13) + at new Buffer (buffer.js:148:3) + at Object. (/path/to/example.js:2:13) + [... more stack trace lines ...] +``` + +### Finding problematic bits of code using linters + +Eslint rules [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) +or +[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) +also find calls to deprecated `Buffer()` API. Those rules are included in some pre-sets. + +There is a drawback, though, that it doesn't always +[work correctly](https://github.com/chalker/safer-buffer#why-not-safe-buffer) when `Buffer` is +overriden e.g. with a polyfill, so recommended is a combination of this and some other method +described above. + + +## Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x. + +This is the recommended solution nowadays that would imply only minimal overhead. + +The Node.js 5.x release line has been unsupported since July 2016, and the Node.js 4.x release line reaches its End of Life in April 2018 (→ [Schedule](https://github.com/nodejs/Release#release-schedule)). This means that these versions of Node.js will *not* receive any updates, even in case of security issues, so using these release lines should be avoided, if at all possible. + +What you would do in this case is to convert all `new Buffer()` or `Buffer()` calls to use `Buffer.alloc()` or `Buffer.from()`, in the following way: + +- For `new Buffer(number)`, replace it with `Buffer.alloc(number)`. +- For `new Buffer(string)` (or `new Buffer(string, encoding)`), replace it with `Buffer.from(string)` (or `Buffer.from(string, encoding)`). +- For all other combinations of arguments (these are much rarer), also replace `new Buffer(...arguments)` with `Buffer.from(...arguments)`. + +Note that `Buffer.alloc()` is also _faster_ on the current Node.js versions than +`new Buffer(size).fill(0)`, which is what you would otherwise need to ensure zero-filling. + +Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) +or +[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) +is recommended to avoid accidential unsafe Buffer API usage. + +There is also a [JSCodeshift codemod](https://github.com/joyeecheung/node-dep-codemod#dep005) +for automatically migrating Buffer constructors to `Buffer.alloc()` or `Buffer.from()`. +Note that it currently only works with cases where the arguments are literals or where the +constructor is invoked with two arguments. + +_If you currently support those older Node.js versions and dropping them would be a semver-major change +for you, or if you support older branches of your packages, consider using [Variant 2](#variant-2) +or [Variant 3](#variant-3) on older branches, so people using those older branches will also receive +the fix. That way, you will eradicate potential issues caused by unguarded Buffer API usage and +your users will not observe a runtime deprecation warning when running your code on Node.js 10._ + + +## Variant 2: Use a polyfill + +Utilize [safer-buffer](https://www.npmjs.com/package/safer-buffer) as a polyfill to support older +Node.js versions. + +You would take exacly the same steps as in [Variant 1](#variant-1), but with a polyfill +`const Buffer = require('safer-buffer').Buffer` in all files where you use the new `Buffer` api. + +Make sure that you do not use old `new Buffer` API — in any files where the line above is added, +using old `new Buffer()` API will _throw_. It will be easy to notice that in CI, though. + +Alternatively, you could use [buffer-from](https://www.npmjs.com/package/buffer-from) and/or +[buffer-alloc](https://www.npmjs.com/package/buffer-alloc) [ponyfills](https://ponyfill.com/) — +those are great, the only downsides being 4 deps in the tree and slightly more code changes to +migrate off them (as you would be using e.g. `Buffer.from` under a different name). If you need only +`Buffer.from` polyfilled — `buffer-from` alone which comes with no extra dependencies. + +_Alternatively, you could use [safe-buffer](https://www.npmjs.com/package/safe-buffer) — it also +provides a polyfill, but takes a different approach which has +[it's drawbacks](https://github.com/chalker/safer-buffer#why-not-safe-buffer). It will allow you +to also use the older `new Buffer()` API in your code, though — but that's arguably a benefit, as +it is problematic, can cause issues in your code, and will start emitting runtime deprecation +warnings starting with Node.js 10._ + +Note that in either case, it is important that you also remove all calls to the old Buffer +API manually — just throwing in `safe-buffer` doesn't fix the problem by itself, it just provides +a polyfill for the new API. I have seen people doing that mistake. + +Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) +or +[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) +is recommended. + +_Don't forget to drop the polyfill usage once you drop support for Node.js < 4.5.0._ + + +## Variant 3 — manual detection, with safeguards + +This is useful if you create Buffer instances in only a few places (e.g. one), or you have your own +wrapper around them. + +### Buffer(0) + +This special case for creating empty buffers can be safely replaced with `Buffer.concat([])`, which +returns the same result all the way down to Node.js 0.8.x. + +### Buffer(notNumber) + +Before: + +```js +var buf = new Buffer(notNumber, encoding); +``` + +After: + +```js +var buf; +if (Buffer.from && Buffer.from !== Uint8Array.from) { + buf = Buffer.from(notNumber, encoding); +} else { + if (typeof notNumber === 'number') + throw new Error('The "size" argument must be of type number.'); + buf = new Buffer(notNumber, encoding); +} +``` + +`encoding` is optional. + +Note that the `typeof notNumber` before `new Buffer` is required (for cases when `notNumber` argument is not +hard-coded) and _is not caused by the deprecation of Buffer constructor_ — it's exactly _why_ the +Buffer constructor is deprecated. Ecosystem packages lacking this type-check caused numereous +security issues — situations when unsanitized user input could end up in the `Buffer(arg)` create +problems ranging from DoS to leaking sensitive information to the attacker from the process memory. + +When `notNumber` argument is hardcoded (e.g. literal `"abc"` or `[0,1,2]`), the `typeof` check can +be omitted. + +Also note that using TypeScript does not fix this problem for you — when libs written in +`TypeScript` are used from JS, or when user input ends up there — it behaves exactly as pure JS, as +all type checks are translation-time only and are not present in the actual JS code which TS +compiles to. + +### Buffer(number) + +For Node.js 0.10.x (and below) support: + +```js +var buf; +if (Buffer.alloc) { + buf = Buffer.alloc(number); +} else { + buf = new Buffer(number); + buf.fill(0); +} +``` + +Otherwise (Node.js ≥ 0.12.x): + +```js +const buf = Buffer.alloc ? Buffer.alloc(number) : new Buffer(number).fill(0); +``` + +## Regarding Buffer.allocUnsafe + +Be extra cautious when using `Buffer.allocUnsafe`: + * Don't use it if you don't have a good reason to + * e.g. you probably won't ever see a performance difference for small buffers, in fact, those + might be even faster with `Buffer.alloc()`, + * if your code is not in the hot code path — you also probably won't notice a difference, + * keep in mind that zero-filling minimizes the potential risks. + * If you use it, make sure that you never return the buffer in a partially-filled state, + * if you are writing to it sequentially — always truncate it to the actuall written length + +Errors in handling buffers allocated with `Buffer.allocUnsafe` could result in various issues, +ranged from undefined behaviour of your code to sensitive data (user input, passwords, certs) +leaking to the remote attacker. + +_Note that the same applies to `new Buffer` usage without zero-filling, depending on the Node.js +version (and lacking type checks also adds DoS to the list of potential problems)._ + + +## FAQ + + +### What is wrong with the `Buffer` constructor? + +The `Buffer` constructor could be used to create a buffer in many different ways: + +- `new Buffer(42)` creates a `Buffer` of 42 bytes. Before Node.js 8, this buffer contained + *arbitrary memory* for performance reasons, which could include anything ranging from + program source code to passwords and encryption keys. +- `new Buffer('abc')` creates a `Buffer` that contains the UTF-8-encoded version of + the string `'abc'`. A second argument could specify another encoding: For example, + `new Buffer(string, 'base64')` could be used to convert a Base64 string into the original + sequence of bytes that it represents. +- There are several other combinations of arguments. + +This meant that, in code like `var buffer = new Buffer(foo);`, *it is not possible to tell +what exactly the contents of the generated buffer are* without knowing the type of `foo`. + +Sometimes, the value of `foo` comes from an external source. For example, this function +could be exposed as a service on a web server, converting a UTF-8 string into its Base64 form: + +``` +function stringToBase64(req, res) { + // The request body should have the format of `{ string: 'foobar' }` + const rawBytes = new Buffer(req.body.string) + const encoded = rawBytes.toString('base64') + res.end({ encoded: encoded }) +} +``` + +Note that this code does *not* validate the type of `req.body.string`: + +- `req.body.string` is expected to be a string. If this is the case, all goes well. +- `req.body.string` is controlled by the client that sends the request. +- If `req.body.string` is the *number* `50`, the `rawBytes` would be 50 bytes: + - Before Node.js 8, the content would be uninitialized + - After Node.js 8, the content would be `50` bytes with the value `0` + +Because of the missing type check, an attacker could intentionally send a number +as part of the request. Using this, they can either: + +- Read uninitialized memory. This **will** leak passwords, encryption keys and other + kinds of sensitive information. (Information leak) +- Force the program to allocate a large amount of memory. For example, when specifying + `500000000` as the input value, each request will allocate 500MB of memory. + This can be used to either exhaust the memory available of a program completely + and make it crash, or slow it down significantly. (Denial of Service) + +Both of these scenarios are considered serious security issues in a real-world +web server context. + +when using `Buffer.from(req.body.string)` instead, passing a number will always +throw an exception instead, giving a controlled behaviour that can always be +handled by the program. + + +### The `Buffer()` constructor has been deprecated for a while. Is this really an issue? + +Surveys of code in the `npm` ecosystem have shown that the `Buffer()` constructor is still +widely used. This includes new code, and overall usage of such code has actually been +*increasing*. diff --git a/legacy-libs/grpc/node_modules/safer-buffer/Readme.md b/legacy-libs/grpc/node_modules/safer-buffer/Readme.md new file mode 100644 index 0000000..14b0822 --- /dev/null +++ b/legacy-libs/grpc/node_modules/safer-buffer/Readme.md @@ -0,0 +1,156 @@ +# safer-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![javascript style guide][standard-image]][standard-url] [![Security Responsible Disclosure][secuirty-image]][secuirty-url] + +[travis-image]: https://travis-ci.org/ChALkeR/safer-buffer.svg?branch=master +[travis-url]: https://travis-ci.org/ChALkeR/safer-buffer +[npm-image]: https://img.shields.io/npm/v/safer-buffer.svg +[npm-url]: https://npmjs.org/package/safer-buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com +[secuirty-image]: https://img.shields.io/badge/Security-Responsible%20Disclosure-green.svg +[secuirty-url]: https://github.com/nodejs/security-wg/blob/master/processes/responsible_disclosure_template.md + +Modern Buffer API polyfill without footguns, working on Node.js from 0.8 to current. + +## How to use? + +First, port all `Buffer()` and `new Buffer()` calls to `Buffer.alloc()` and `Buffer.from()` API. + +Then, to achieve compatibility with outdated Node.js versions (`<4.5.0` and 5.x `<5.9.0`), use +`const Buffer = require('safer-buffer').Buffer` in all files where you make calls to the new +Buffer API. _Use `var` instead of `const` if you need that for your Node.js version range support._ + +Also, see the +[porting Buffer](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) guide. + +## Do I need it? + +Hopefully, not — dropping support for outdated Node.js versions should be fine nowdays, and that +is the recommended path forward. You _do_ need to port to the `Buffer.alloc()` and `Buffer.from()` +though. + +See the [porting guide](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) +for a better description. + +## Why not [safe-buffer](https://npmjs.com/safe-buffer)? + +_In short: while `safe-buffer` serves as a polyfill for the new API, it allows old API usage and +itself contains footguns._ + +`safe-buffer` could be used safely to get the new API while still keeping support for older +Node.js versions (like this module), but while analyzing ecosystem usage of the old Buffer API +I found out that `safe-buffer` is itself causing problems in some cases. + +For example, consider the following snippet: + +```console +$ cat example.unsafe.js +console.log(Buffer(20)) +$ ./node-v6.13.0-linux-x64/bin/node example.unsafe.js + +$ standard example.unsafe.js +standard: Use JavaScript Standard Style (https://standardjs.com) + /home/chalker/repo/safer-buffer/example.unsafe.js:2:13: 'Buffer()' was deprecated since v6. Use 'Buffer.alloc()' or 'Buffer.from()' (use 'https://www.npmjs.com/package/safe-buffer' for '<4.5.0') instead. +``` + +This is allocates and writes to console an uninitialized chunk of memory. +[standard](https://www.npmjs.com/package/standard) linter (among others) catch that and warn people +to avoid using unsafe API. + +Let's now throw in `safe-buffer`! + +```console +$ cat example.safe-buffer.js +const Buffer = require('safe-buffer').Buffer +console.log(Buffer(20)) +$ standard example.safe-buffer.js +$ ./node-v6.13.0-linux-x64/bin/node example.safe-buffer.js + +``` + +See the problem? Adding in `safe-buffer` _magically removes the lint warning_, but the behavior +remains identiсal to what we had before, and when launched on Node.js 6.x LTS — this dumps out +chunks of uninitialized memory. +_And this code will still emit runtime warnings on Node.js 10.x and above._ + +That was done by design. I first considered changing `safe-buffer`, prohibiting old API usage or +emitting warnings on it, but that significantly diverges from `safe-buffer` design. After some +discussion, it was decided to move my approach into a separate package, and _this is that separate +package_. + +This footgun is not imaginary — I observed top-downloaded packages doing that kind of thing, +«fixing» the lint warning by blindly including `safe-buffer` without any actual changes. + +Also in some cases, even if the API _was_ migrated to use of safe Buffer API — a random pull request +can bring unsafe Buffer API usage back to the codebase by adding new calls — and that could go +unnoticed even if you have a linter prohibiting that (becase of the reason stated above), and even +pass CI. _I also observed that being done in popular packages._ + +Some examples: + * [webdriverio](https://github.com/webdriverio/webdriverio/commit/05cbd3167c12e4930f09ef7cf93b127ba4effae4#diff-124380949022817b90b622871837d56cR31) + (a module with 548 759 downloads/month), + * [websocket-stream](https://github.com/maxogden/websocket-stream/commit/c9312bd24d08271687d76da0fe3c83493871cf61) + (218 288 d/m, fix in [maxogden/websocket-stream#142](https://github.com/maxogden/websocket-stream/pull/142)), + * [node-serialport](https://github.com/node-serialport/node-serialport/commit/e8d9d2b16c664224920ce1c895199b1ce2def48c) + (113 138 d/m, fix in [node-serialport/node-serialport#1510](https://github.com/node-serialport/node-serialport/pull/1510)), + * [karma](https://github.com/karma-runner/karma/commit/3d94b8cf18c695104ca195334dc75ff054c74eec) + (3 973 193 d/m, fix in [karma-runner/karma#2947](https://github.com/karma-runner/karma/pull/2947)), + * [spdy-transport](https://github.com/spdy-http2/spdy-transport/commit/5375ac33f4a62a4f65bcfc2827447d42a5dbe8b1) + (5 970 727 d/m, fix in [spdy-http2/spdy-transport#53](https://github.com/spdy-http2/spdy-transport/pull/53)). + * And there are a lot more over the ecosystem. + +I filed a PR at +[mysticatea/eslint-plugin-node#110](https://github.com/mysticatea/eslint-plugin-node/pull/110) to +partially fix that (for cases when that lint rule is used), but it is a semver-major change for +linter rules and presets, so it would take significant time for that to reach actual setups. +_It also hasn't been released yet (2018-03-20)._ + +Also, `safer-buffer` discourages the usage of `.allocUnsafe()`, which is often done by a mistake. +It still supports it with an explicit concern barier, by placing it under +`require('safer-buffer/dangereous')`. + +## But isn't throwing bad? + +Not really. It's an error that could be noticed and fixed early, instead of causing havoc later like +unguarded `new Buffer()` calls that end up receiving user input can do. + +This package affects only the files where `var Buffer = require('safer-buffer').Buffer` was done, so +it is really simple to keep track of things and make sure that you don't mix old API usage with that. +Also, CI should hint anything that you might have missed. + +New commits, if tested, won't land new usage of unsafe Buffer API this way. +_Node.js 10.x also deals with that by printing a runtime depecation warning._ + +### Would it affect third-party modules? + +No, unless you explicitly do an awful thing like monkey-patching or overriding the built-in `Buffer`. +Don't do that. + +### But I don't want throwing… + +That is also fine! + +Also, it could be better in some cases when you don't comprehensive enough test coverage. + +In that case — just don't override `Buffer` and use +`var SaferBuffer = require('safer-buffer').Buffer` instead. + +That way, everything using `Buffer` natively would still work, but there would be two drawbacks: + +* `Buffer.from`/`Buffer.alloc` won't be polyfilled — use `SaferBuffer.from` and + `SaferBuffer.alloc` instead. +* You are still open to accidentally using the insecure deprecated API — use a linter to catch that. + +Note that using a linter to catch accidential `Buffer` constructor usage in this case is strongly +recommended. `Buffer` is not overriden in this usecase, so linters won't get confused. + +## «Without footguns»? + +Well, it is still possible to do _some_ things with `Buffer` API, e.g. accessing `.buffer` property +on older versions and duping things from there. You shouldn't do that in your code, probabably. + +The intention is to remove the most significant footguns that affect lots of packages in the +ecosystem, and to do it in the proper way. + +Also, this package doesn't protect against security issues affecting some Node.js versions, so for +usage in your own production code, it is still recommended to update to a Node.js version +[supported by upstream](https://github.com/nodejs/release#release-schedule). diff --git a/legacy-libs/grpc/node_modules/safer-buffer/dangerous.js b/legacy-libs/grpc/node_modules/safer-buffer/dangerous.js new file mode 100644 index 0000000..ca41fdc --- /dev/null +++ b/legacy-libs/grpc/node_modules/safer-buffer/dangerous.js @@ -0,0 +1,58 @@ +/* eslint-disable node/no-deprecated-api */ + +'use strict' + +var buffer = require('buffer') +var Buffer = buffer.Buffer +var safer = require('./safer.js') +var Safer = safer.Buffer + +var dangerous = {} + +var key + +for (key in safer) { + if (!safer.hasOwnProperty(key)) continue + dangerous[key] = safer[key] +} + +var Dangereous = dangerous.Buffer = {} + +// Copy Safer API +for (key in Safer) { + if (!Safer.hasOwnProperty(key)) continue + Dangereous[key] = Safer[key] +} + +// Copy those missing unsafe methods, if they are present +for (key in Buffer) { + if (!Buffer.hasOwnProperty(key)) continue + if (Dangereous.hasOwnProperty(key)) continue + Dangereous[key] = Buffer[key] +} + +if (!Dangereous.allocUnsafe) { + Dangereous.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + return Buffer(size) + } +} + +if (!Dangereous.allocUnsafeSlow) { + Dangereous.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + return buffer.SlowBuffer(size) + } +} + +module.exports = dangerous diff --git a/legacy-libs/grpc/node_modules/safer-buffer/package.json b/legacy-libs/grpc/node_modules/safer-buffer/package.json new file mode 100644 index 0000000..b517537 --- /dev/null +++ b/legacy-libs/grpc/node_modules/safer-buffer/package.json @@ -0,0 +1,68 @@ +{ + "_args": [ + [ + "safer-buffer@2.1.2", + "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core" + ] + ], + "_from": "safer-buffer@2.1.2", + "_id": "safer-buffer@2.1.2", + "_inBundle": false, + "_integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "_location": "/grpc/safer-buffer", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "safer-buffer@2.1.2", + "name": "safer-buffer", + "escapedName": "safer-buffer", + "rawSpec": "2.1.2", + "saveSpec": null, + "fetchSpec": "2.1.2" + }, + "_requiredBy": [ + "/grpc/iconv-lite" + ], + "_resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "_shrinkwrap": null, + "_spec": "2.1.2", + "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core", + "author": { + "name": "Nikita Skovoroda", + "email": "chalkerx@gmail.com", + "url": "https://github.com/ChALkeR" + }, + "bugs": { + "url": "https://github.com/ChALkeR/safer-buffer/issues" + }, + "dependencies": {}, + "description": "Modern Buffer API polyfill without footguns", + "devDependencies": { + "standard": "^11.0.1", + "tape": "^4.9.0" + }, + "files": [ + "Porting-Buffer.md", + "Readme.md", + "tests.js", + "dangerous.js", + "safer.js" + ], + "homepage": "https://github.com/ChALkeR/safer-buffer#readme", + "license": "MIT", + "main": "safer.js", + "name": "safer-buffer", + "optionalDependencies": {}, + "readme": "# safer-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![javascript style guide][standard-image]][standard-url] [![Security Responsible Disclosure][secuirty-image]][secuirty-url]\n\n[travis-image]: https://travis-ci.org/ChALkeR/safer-buffer.svg?branch=master\n[travis-url]: https://travis-ci.org/ChALkeR/safer-buffer\n[npm-image]: https://img.shields.io/npm/v/safer-buffer.svg\n[npm-url]: https://npmjs.org/package/safer-buffer\n[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg\n[standard-url]: https://standardjs.com\n[secuirty-image]: https://img.shields.io/badge/Security-Responsible%20Disclosure-green.svg\n[secuirty-url]: https://github.com/nodejs/security-wg/blob/master/processes/responsible_disclosure_template.md\n\nModern Buffer API polyfill without footguns, working on Node.js from 0.8 to current.\n\n## How to use?\n\nFirst, port all `Buffer()` and `new Buffer()` calls to `Buffer.alloc()` and `Buffer.from()` API.\n\nThen, to achieve compatibility with outdated Node.js versions (`<4.5.0` and 5.x `<5.9.0`), use\n`const Buffer = require('safer-buffer').Buffer` in all files where you make calls to the new\nBuffer API. _Use `var` instead of `const` if you need that for your Node.js version range support._\n\nAlso, see the\n[porting Buffer](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) guide.\n\n## Do I need it?\n\nHopefully, not — dropping support for outdated Node.js versions should be fine nowdays, and that\nis the recommended path forward. You _do_ need to port to the `Buffer.alloc()` and `Buffer.from()`\nthough.\n\nSee the [porting guide](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md)\nfor a better description.\n\n## Why not [safe-buffer](https://npmjs.com/safe-buffer)?\n\n_In short: while `safe-buffer` serves as a polyfill for the new API, it allows old API usage and\nitself contains footguns._\n\n`safe-buffer` could be used safely to get the new API while still keeping support for older\nNode.js versions (like this module), but while analyzing ecosystem usage of the old Buffer API\nI found out that `safe-buffer` is itself causing problems in some cases.\n\nFor example, consider the following snippet:\n\n```console\n$ cat example.unsafe.js\nconsole.log(Buffer(20))\n$ ./node-v6.13.0-linux-x64/bin/node example.unsafe.js\n\n$ standard example.unsafe.js\nstandard: Use JavaScript Standard Style (https://standardjs.com)\n /home/chalker/repo/safer-buffer/example.unsafe.js:2:13: 'Buffer()' was deprecated since v6. Use 'Buffer.alloc()' or 'Buffer.from()' (use 'https://www.npmjs.com/package/safe-buffer' for '<4.5.0') instead.\n```\n\nThis is allocates and writes to console an uninitialized chunk of memory.\n[standard](https://www.npmjs.com/package/standard) linter (among others) catch that and warn people\nto avoid using unsafe API.\n\nLet's now throw in `safe-buffer`!\n\n```console\n$ cat example.safe-buffer.js\nconst Buffer = require('safe-buffer').Buffer\nconsole.log(Buffer(20))\n$ standard example.safe-buffer.js\n$ ./node-v6.13.0-linux-x64/bin/node example.safe-buffer.js\n\n```\n\nSee the problem? Adding in `safe-buffer` _magically removes the lint warning_, but the behavior\nremains identiсal to what we had before, and when launched on Node.js 6.x LTS — this dumps out\nchunks of uninitialized memory.\n_And this code will still emit runtime warnings on Node.js 10.x and above._\n\nThat was done by design. I first considered changing `safe-buffer`, prohibiting old API usage or\nemitting warnings on it, but that significantly diverges from `safe-buffer` design. After some\ndiscussion, it was decided to move my approach into a separate package, and _this is that separate\npackage_.\n\nThis footgun is not imaginary — I observed top-downloaded packages doing that kind of thing,\n«fixing» the lint warning by blindly including `safe-buffer` without any actual changes.\n\nAlso in some cases, even if the API _was_ migrated to use of safe Buffer API — a random pull request\ncan bring unsafe Buffer API usage back to the codebase by adding new calls — and that could go\nunnoticed even if you have a linter prohibiting that (becase of the reason stated above), and even\npass CI. _I also observed that being done in popular packages._\n\nSome examples:\n * [webdriverio](https://github.com/webdriverio/webdriverio/commit/05cbd3167c12e4930f09ef7cf93b127ba4effae4#diff-124380949022817b90b622871837d56cR31)\n (a module with 548 759 downloads/month),\n * [websocket-stream](https://github.com/maxogden/websocket-stream/commit/c9312bd24d08271687d76da0fe3c83493871cf61)\n (218 288 d/m, fix in [maxogden/websocket-stream#142](https://github.com/maxogden/websocket-stream/pull/142)),\n * [node-serialport](https://github.com/node-serialport/node-serialport/commit/e8d9d2b16c664224920ce1c895199b1ce2def48c)\n (113 138 d/m, fix in [node-serialport/node-serialport#1510](https://github.com/node-serialport/node-serialport/pull/1510)),\n * [karma](https://github.com/karma-runner/karma/commit/3d94b8cf18c695104ca195334dc75ff054c74eec)\n (3 973 193 d/m, fix in [karma-runner/karma#2947](https://github.com/karma-runner/karma/pull/2947)),\n * [spdy-transport](https://github.com/spdy-http2/spdy-transport/commit/5375ac33f4a62a4f65bcfc2827447d42a5dbe8b1)\n (5 970 727 d/m, fix in [spdy-http2/spdy-transport#53](https://github.com/spdy-http2/spdy-transport/pull/53)).\n * And there are a lot more over the ecosystem.\n\nI filed a PR at\n[mysticatea/eslint-plugin-node#110](https://github.com/mysticatea/eslint-plugin-node/pull/110) to\npartially fix that (for cases when that lint rule is used), but it is a semver-major change for\nlinter rules and presets, so it would take significant time for that to reach actual setups.\n_It also hasn't been released yet (2018-03-20)._\n\nAlso, `safer-buffer` discourages the usage of `.allocUnsafe()`, which is often done by a mistake.\nIt still supports it with an explicit concern barier, by placing it under\n`require('safer-buffer/dangereous')`.\n\n## But isn't throwing bad?\n\nNot really. It's an error that could be noticed and fixed early, instead of causing havoc later like\nunguarded `new Buffer()` calls that end up receiving user input can do.\n\nThis package affects only the files where `var Buffer = require('safer-buffer').Buffer` was done, so\nit is really simple to keep track of things and make sure that you don't mix old API usage with that.\nAlso, CI should hint anything that you might have missed.\n\nNew commits, if tested, won't land new usage of unsafe Buffer API this way.\n_Node.js 10.x also deals with that by printing a runtime depecation warning._\n\n### Would it affect third-party modules?\n\nNo, unless you explicitly do an awful thing like monkey-patching or overriding the built-in `Buffer`.\nDon't do that.\n\n### But I don't want throwing…\n\nThat is also fine!\n\nAlso, it could be better in some cases when you don't comprehensive enough test coverage.\n\nIn that case — just don't override `Buffer` and use\n`var SaferBuffer = require('safer-buffer').Buffer` instead.\n\nThat way, everything using `Buffer` natively would still work, but there would be two drawbacks:\n\n* `Buffer.from`/`Buffer.alloc` won't be polyfilled — use `SaferBuffer.from` and\n `SaferBuffer.alloc` instead.\n* You are still open to accidentally using the insecure deprecated API — use a linter to catch that.\n\nNote that using a linter to catch accidential `Buffer` constructor usage in this case is strongly\nrecommended. `Buffer` is not overriden in this usecase, so linters won't get confused.\n\n## «Without footguns»?\n\nWell, it is still possible to do _some_ things with `Buffer` API, e.g. accessing `.buffer` property\non older versions and duping things from there. You shouldn't do that in your code, probabably.\n\nThe intention is to remove the most significant footguns that affect lots of packages in the\necosystem, and to do it in the proper way.\n\nAlso, this package doesn't protect against security issues affecting some Node.js versions, so for\nusage in your own production code, it is still recommended to update to a Node.js version\n[supported by upstream](https://github.com/nodejs/release#release-schedule).\n", + "readmeFilename": "Readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/ChALkeR/safer-buffer.git" + }, + "scripts": { + "browserify-test": "browserify --external tape tests.js > browserify-tests.js && tape browserify-tests.js", + "test": "standard && tape tests.js" + }, + "version": "2.1.2" +} diff --git a/legacy-libs/grpc/node_modules/safer-buffer/safer.js b/legacy-libs/grpc/node_modules/safer-buffer/safer.js new file mode 100644 index 0000000..37c7e1a --- /dev/null +++ b/legacy-libs/grpc/node_modules/safer-buffer/safer.js @@ -0,0 +1,77 @@ +/* eslint-disable node/no-deprecated-api */ + +'use strict' + +var buffer = require('buffer') +var Buffer = buffer.Buffer + +var safer = {} + +var key + +for (key in buffer) { + if (!buffer.hasOwnProperty(key)) continue + if (key === 'SlowBuffer' || key === 'Buffer') continue + safer[key] = buffer[key] +} + +var Safer = safer.Buffer = {} +for (key in Buffer) { + if (!Buffer.hasOwnProperty(key)) continue + if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue + Safer[key] = Buffer[key] +} + +safer.Buffer.prototype = Buffer.prototype + +if (!Safer.from || Safer.from === Uint8Array.from) { + Safer.from = function (value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) + } + if (value && typeof value.length === 'undefined') { + throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) + } + return Buffer(value, encodingOrOffset, length) + } +} + +if (!Safer.alloc) { + Safer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + var buf = Buffer(size) + if (!fill || fill.length === 0) { + buf.fill(0) + } else if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + return buf + } +} + +if (!safer.kStringMaxLength) { + try { + safer.kStringMaxLength = process.binding('buffer').kStringMaxLength + } catch (e) { + // we can't determine kStringMaxLength in environments where process.binding + // is unsupported, so let's not set it + } +} + +if (!safer.constants) { + safer.constants = { + MAX_LENGTH: safer.kMaxLength + } + if (safer.kStringMaxLength) { + safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength + } +} + +module.exports = safer diff --git a/legacy-libs/grpc/node_modules/safer-buffer/tests.js b/legacy-libs/grpc/node_modules/safer-buffer/tests.js new file mode 100644 index 0000000..7ed2777 --- /dev/null +++ b/legacy-libs/grpc/node_modules/safer-buffer/tests.js @@ -0,0 +1,406 @@ +/* eslint-disable node/no-deprecated-api */ + +'use strict' + +var test = require('tape') + +var buffer = require('buffer') + +var index = require('./') +var safer = require('./safer') +var dangerous = require('./dangerous') + +/* Inheritance tests */ + +test('Default is Safer', function (t) { + t.equal(index, safer) + t.notEqual(safer, dangerous) + t.notEqual(index, dangerous) + t.end() +}) + +test('Is not a function', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(typeof impl, 'object') + t.equal(typeof impl.Buffer, 'object') + }); + [buffer].forEach(function (impl) { + t.equal(typeof impl, 'object') + t.equal(typeof impl.Buffer, 'function') + }) + t.end() +}) + +test('Constructor throws', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.throws(function () { impl.Buffer() }) + t.throws(function () { impl.Buffer(0) }) + t.throws(function () { impl.Buffer('a') }) + t.throws(function () { impl.Buffer('a', 'utf-8') }) + t.throws(function () { return new impl.Buffer() }) + t.throws(function () { return new impl.Buffer(0) }) + t.throws(function () { return new impl.Buffer('a') }) + t.throws(function () { return new impl.Buffer('a', 'utf-8') }) + }) + t.end() +}) + +test('Safe methods exist', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(typeof impl.Buffer.alloc, 'function', 'alloc') + t.equal(typeof impl.Buffer.from, 'function', 'from') + }) + t.end() +}) + +test('Unsafe methods exist only in Dangerous', function (t) { + [index, safer].forEach(function (impl) { + t.equal(typeof impl.Buffer.allocUnsafe, 'undefined') + t.equal(typeof impl.Buffer.allocUnsafeSlow, 'undefined') + }); + [dangerous].forEach(function (impl) { + t.equal(typeof impl.Buffer.allocUnsafe, 'function') + t.equal(typeof impl.Buffer.allocUnsafeSlow, 'function') + }) + t.end() +}) + +test('Generic methods/properties are defined and equal', function (t) { + ['poolSize', 'isBuffer', 'concat', 'byteLength'].forEach(function (method) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], buffer.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +test('Built-in buffer static methods/properties are inherited', function (t) { + Object.keys(buffer).forEach(function (method) { + if (method === 'SlowBuffer' || method === 'Buffer') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl[method], buffer[method], method) + t.notEqual(typeof impl[method], 'undefined', method) + }) + }) + t.end() +}) + +test('Built-in Buffer static methods/properties are inherited', function (t) { + Object.keys(buffer.Buffer).forEach(function (method) { + if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], buffer.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +test('.prototype property of Buffer is inherited', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer.prototype, buffer.Buffer.prototype, 'prototype') + t.notEqual(typeof impl.Buffer.prototype, 'undefined', 'prototype') + }) + t.end() +}) + +test('All Safer methods are present in Dangerous', function (t) { + Object.keys(safer).forEach(function (method) { + if (method === 'Buffer') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl[method], safer[method], method) + if (method !== 'kStringMaxLength') { + t.notEqual(typeof impl[method], 'undefined', method) + } + }) + }) + Object.keys(safer.Buffer).forEach(function (method) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], safer.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +test('Safe methods from Dangerous methods are present in Safer', function (t) { + Object.keys(dangerous).forEach(function (method) { + if (method === 'Buffer') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl[method], dangerous[method], method) + if (method !== 'kStringMaxLength') { + t.notEqual(typeof impl[method], 'undefined', method) + } + }) + }) + Object.keys(dangerous.Buffer).forEach(function (method) { + if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], dangerous.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +/* Behaviour tests */ + +test('Methods return Buffers', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 10))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 'a'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10, 'x'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(9, 'ab'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(''))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string', 'utf-8'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([0, 42, 3]))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(new Uint8Array([0, 42, 3])))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([]))) + }); + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](0))) + t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](10))) + }) + t.end() +}) + +test('Constructor is buffer.Buffer', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer.alloc(0).constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(0, 10).constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(0, 'a').constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(10).constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(10, 'x').constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(9, 'ab').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('string').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('string', 'utf-8').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').constructor, buffer.Buffer) + t.equal(impl.Buffer.from([0, 42, 3]).constructor, buffer.Buffer) + t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).constructor, buffer.Buffer) + t.equal(impl.Buffer.from([]).constructor, buffer.Buffer) + }); + [0, 10, 100].forEach(function (arg) { + t.equal(dangerous.Buffer.allocUnsafe(arg).constructor, buffer.Buffer) + t.equal(dangerous.Buffer.allocUnsafeSlow(arg).constructor, buffer.SlowBuffer(0).constructor) + }) + t.end() +}) + +test('Invalid calls throw', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.throws(function () { impl.Buffer.from(0) }) + t.throws(function () { impl.Buffer.from(10) }) + t.throws(function () { impl.Buffer.from(10, 'utf-8') }) + t.throws(function () { impl.Buffer.from('string', 'invalid encoding') }) + t.throws(function () { impl.Buffer.from(-10) }) + t.throws(function () { impl.Buffer.from(1e90) }) + t.throws(function () { impl.Buffer.from(Infinity) }) + t.throws(function () { impl.Buffer.from(-Infinity) }) + t.throws(function () { impl.Buffer.from(NaN) }) + t.throws(function () { impl.Buffer.from(null) }) + t.throws(function () { impl.Buffer.from(undefined) }) + t.throws(function () { impl.Buffer.from() }) + t.throws(function () { impl.Buffer.from({}) }) + t.throws(function () { impl.Buffer.alloc('') }) + t.throws(function () { impl.Buffer.alloc('string') }) + t.throws(function () { impl.Buffer.alloc('string', 'utf-8') }) + t.throws(function () { impl.Buffer.alloc('b25ldHdvdGhyZWU=', 'base64') }) + t.throws(function () { impl.Buffer.alloc(-10) }) + t.throws(function () { impl.Buffer.alloc(1e90) }) + t.throws(function () { impl.Buffer.alloc(2 * (1 << 30)) }) + t.throws(function () { impl.Buffer.alloc(Infinity) }) + t.throws(function () { impl.Buffer.alloc(-Infinity) }) + t.throws(function () { impl.Buffer.alloc(null) }) + t.throws(function () { impl.Buffer.alloc(undefined) }) + t.throws(function () { impl.Buffer.alloc() }) + t.throws(function () { impl.Buffer.alloc([]) }) + t.throws(function () { impl.Buffer.alloc([0, 42, 3]) }) + t.throws(function () { impl.Buffer.alloc({}) }) + }); + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + t.throws(function () { dangerous.Buffer[method]('') }) + t.throws(function () { dangerous.Buffer[method]('string') }) + t.throws(function () { dangerous.Buffer[method]('string', 'utf-8') }) + t.throws(function () { dangerous.Buffer[method](2 * (1 << 30)) }) + t.throws(function () { dangerous.Buffer[method](Infinity) }) + if (dangerous.Buffer[method] === buffer.Buffer.allocUnsafe) { + t.skip('Skipping, older impl of allocUnsafe coerced negative sizes to 0') + } else { + t.throws(function () { dangerous.Buffer[method](-10) }) + t.throws(function () { dangerous.Buffer[method](-1e90) }) + t.throws(function () { dangerous.Buffer[method](-Infinity) }) + } + t.throws(function () { dangerous.Buffer[method](null) }) + t.throws(function () { dangerous.Buffer[method](undefined) }) + t.throws(function () { dangerous.Buffer[method]() }) + t.throws(function () { dangerous.Buffer[method]([]) }) + t.throws(function () { dangerous.Buffer[method]([0, 42, 3]) }) + t.throws(function () { dangerous.Buffer[method]({}) }) + }) + t.end() +}) + +test('Buffers have appropriate lengths', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer.alloc(0).length, 0) + t.equal(impl.Buffer.alloc(10).length, 10) + t.equal(impl.Buffer.from('').length, 0) + t.equal(impl.Buffer.from('string').length, 6) + t.equal(impl.Buffer.from('string', 'utf-8').length, 6) + t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').length, 11) + t.equal(impl.Buffer.from([0, 42, 3]).length, 3) + t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).length, 3) + t.equal(impl.Buffer.from([]).length, 0) + }); + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + t.equal(dangerous.Buffer[method](0).length, 0) + t.equal(dangerous.Buffer[method](10).length, 10) + }) + t.end() +}) + +test('Buffers have appropriate lengths (2)', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true; + [ safer.Buffer.alloc, + dangerous.Buffer.allocUnsafe, + dangerous.Buffer.allocUnsafeSlow + ].forEach(function (method) { + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 1e5) + var buf = method(length) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + } + }) + t.ok(ok) + t.end() +}) + +test('.alloc(size) is zero-filled and has correct length', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var buf = index.Buffer.alloc(length) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + var j + for (j = 0; j < length; j++) { + if (buf[j] !== 0) ok = false + } + buf.fill(1) + for (j = 0; j < length; j++) { + if (buf[j] !== 1) ok = false + } + } + t.ok(ok) + t.end() +}) + +test('.allocUnsafe / .allocUnsafeSlow are fillable and have correct lengths', function (t) { + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var buf = dangerous.Buffer[method](length) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + buf.fill(0, 0, length) + var j + for (j = 0; j < length; j++) { + if (buf[j] !== 0) ok = false + } + buf.fill(1, 0, length) + for (j = 0; j < length; j++) { + if (buf[j] !== 1) ok = false + } + } + t.ok(ok, method) + }) + t.end() +}) + +test('.alloc(size, fill) is `fill`-filled', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var fill = Math.round(Math.random() * 255) + var buf = index.Buffer.alloc(length, fill) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + for (var j = 0; j < length; j++) { + if (buf[j] !== fill) ok = false + } + } + t.ok(ok) + t.end() +}) + +test('.alloc(size, fill) is `fill`-filled', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var fill = Math.round(Math.random() * 255) + var buf = index.Buffer.alloc(length, fill) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + for (var j = 0; j < length; j++) { + if (buf[j] !== fill) ok = false + } + } + t.ok(ok) + t.deepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 97)) + t.notDeepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 98)) + + var tmp = new buffer.Buffer(2) + tmp.fill('ok') + if (tmp[1] === tmp[0]) { + // Outdated Node.js + t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('ooooo')) + } else { + t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('okoko')) + } + t.notDeepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('kokok')) + + t.end() +}) + +test('safer.Buffer.from returns results same as Buffer constructor', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.deepEqual(impl.Buffer.from(''), new buffer.Buffer('')) + t.deepEqual(impl.Buffer.from('string'), new buffer.Buffer('string')) + t.deepEqual(impl.Buffer.from('string', 'utf-8'), new buffer.Buffer('string', 'utf-8')) + t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), new buffer.Buffer('b25ldHdvdGhyZWU=', 'base64')) + t.deepEqual(impl.Buffer.from([0, 42, 3]), new buffer.Buffer([0, 42, 3])) + t.deepEqual(impl.Buffer.from(new Uint8Array([0, 42, 3])), new buffer.Buffer(new Uint8Array([0, 42, 3]))) + t.deepEqual(impl.Buffer.from([]), new buffer.Buffer([])) + }) + t.end() +}) + +test('safer.Buffer.from returns consistent results', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.deepEqual(impl.Buffer.from(''), impl.Buffer.alloc(0)) + t.deepEqual(impl.Buffer.from([]), impl.Buffer.alloc(0)) + t.deepEqual(impl.Buffer.from(new Uint8Array([])), impl.Buffer.alloc(0)) + t.deepEqual(impl.Buffer.from('string', 'utf-8'), impl.Buffer.from('string')) + t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from([115, 116, 114, 105, 110, 103])) + t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from(impl.Buffer.from('string'))) + t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), impl.Buffer.from('onetwothree')) + t.notDeepEqual(impl.Buffer.from('b25ldHdvdGhyZWU='), impl.Buffer.from('onetwothree')) + }) + t.end() +}) diff --git a/legacy-libs/grpc/node_modules/sax/LICENSE b/legacy-libs/grpc/node_modules/sax/LICENSE new file mode 100644 index 0000000..ccffa08 --- /dev/null +++ b/legacy-libs/grpc/node_modules/sax/LICENSE @@ -0,0 +1,41 @@ +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. + +==== + +`String.fromCodePoint` by Mathias Bynens used according to terms of MIT +License, as follows: + + Copyright Mathias Bynens + + 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/legacy-libs/grpc/node_modules/sax/README.md b/legacy-libs/grpc/node_modules/sax/README.md new file mode 100644 index 0000000..afcd3f3 --- /dev/null +++ b/legacy-libs/grpc/node_modules/sax/README.md @@ -0,0 +1,225 @@ +# sax js + +A sax-style parser for XML and HTML. + +Designed with [node](http://nodejs.org/) in mind, but should work fine in +the browser or other CommonJS implementations. + +## What This Is + +* A very simple tool to parse through an XML string. +* A stepping stone to a streaming HTML parser. +* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML + docs. + +## What This Is (probably) Not + +* An HTML Parser - That's a fine goal, but this isn't it. It's just + XML. +* A DOM Builder - You can use it to build an object model out of XML, + but it doesn't do that out of the box. +* XSLT - No DOM = no querying. +* 100% Compliant with (some other SAX implementation) - Most SAX + implementations are in Java and do a lot more than this does. +* An XML Validator - It does a little validation when in strict mode, but + not much. +* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic + masochism. +* A DTD-aware Thing - Fetching DTDs is a much bigger job. + +## Regarding `Hello, world!').close(); + +// stream usage +// takes the same options as the parser +var saxStream = require("sax").createStream(strict, options) +saxStream.on("error", function (e) { + // unhandled errors will throw, since this is a proper node + // event emitter. + console.error("error!", e) + // clear the error + this._parser.error = null + this._parser.resume() +}) +saxStream.on("opentag", function (node) { + // same object as above +}) +// pipe is supported, and it's readable/writable +// same chunks coming in also go out. +fs.createReadStream("file.xml") + .pipe(saxStream) + .pipe(fs.createWriteStream("file-copy.xml")) +``` + + +## Arguments + +Pass the following arguments to the parser function. All are optional. + +`strict` - Boolean. Whether or not to be a jerk. Default: `false`. + +`opt` - Object bag of settings regarding string formatting. All default to `false`. + +Settings supported: + +* `trim` - Boolean. Whether or not to trim text and comment nodes. +* `normalize` - Boolean. If true, then turn any whitespace into a single + space. +* `lowercase` - Boolean. If true, then lowercase tag names and attribute names + in loose mode, rather than uppercasing them. +* `xmlns` - Boolean. If true, then namespaces are supported. +* `position` - Boolean. If false, then don't track line/col/position. +* `strictEntities` - Boolean. If true, only parse [predefined XML + entities](http://www.w3.org/TR/REC-xml/#sec-predefined-ent) + (`&`, `'`, `>`, `<`, and `"`) + +## Methods + +`write` - Write bytes onto the stream. You don't have to do this all at +once. You can keep writing as much as you want. + +`close` - Close the stream. Once closed, no more data may be written until +it is done processing the buffer, which is signaled by the `end` event. + +`resume` - To gracefully handle errors, assign a listener to the `error` +event. Then, when the error is taken care of, you can call `resume` to +continue parsing. Otherwise, the parser will not continue while in an error +state. + +## Members + +At all times, the parser object will have the following members: + +`line`, `column`, `position` - Indications of the position in the XML +document where the parser currently is looking. + +`startTagPosition` - Indicates the position where the current tag starts. + +`closed` - Boolean indicating whether or not the parser can be written to. +If it's `true`, then wait for the `ready` event to write again. + +`strict` - Boolean indicating whether or not the parser is a jerk. + +`opt` - Any options passed into the constructor. + +`tag` - The current tag being dealt with. + +And a bunch of other stuff that you probably shouldn't touch. + +## Events + +All events emit with a single argument. To listen to an event, assign a +function to `on`. Functions get executed in the this-context of +the parser object. The list of supported events are also in the exported +`EVENTS` array. + +When using the stream interface, assign handlers using the EventEmitter +`on` function in the normal fashion. + +`error` - Indication that something bad happened. The error will be hanging +out on `parser.error`, and must be deleted before parsing can continue. By +listening to this event, you can keep an eye on that kind of stuff. Note: +this happens *much* more in strict mode. Argument: instance of `Error`. + +`text` - Text node. Argument: string of text. + +`doctype` - The ``. Argument: +object with `name` and `body` members. Attributes are not parsed, as +processing instructions have implementation dependent semantics. + +`sgmldeclaration` - Random SGML declarations. Stuff like `` +would trigger this kind of event. This is a weird thing to support, so it +might go away at some point. SAX isn't intended to be used to parse SGML, +after all. + +`opentagstart` - Emitted immediately when the tag name is available, +but before any attributes are encountered. Argument: object with a +`name` field and an empty `attributes` set. Note that this is the +same object that will later be emitted in the `opentag` event. + +`opentag` - An opening tag. Argument: object with `name` and `attributes`. +In non-strict mode, tag names are uppercased, unless the `lowercase` +option is set. If the `xmlns` option is set, then it will contain +namespace binding information on the `ns` member, and will have a +`local`, `prefix`, and `uri` member. + +`closetag` - A closing tag. In loose mode, tags are auto-closed if their +parent closes. In strict mode, well-formedness is enforced. Note that +self-closing tags will have `closeTag` emitted immediately after `openTag`. +Argument: tag name. + +`attribute` - An attribute node. Argument: object with `name` and `value`. +In non-strict mode, attribute names are uppercased, unless the `lowercase` +option is set. If the `xmlns` option is set, it will also contains namespace +information. + +`comment` - A comment node. Argument: the string of the comment. + +`opencdata` - The opening tag of a ``) of a `` tags trigger a `"script"` +event, and their contents are not checked for special xml characters. +If you pass `noscript: true`, then this behavior is suppressed. + +## Reporting Problems + +It's best to write a failing test if you find an issue. I will always +accept pull requests with failing tests if they demonstrate intended +behavior, but it is very hard to figure out what issue you're describing +without a test. Writing a test is also the best way for you yourself +to figure out if you really understand the issue you think you have with +sax-js. diff --git a/legacy-libs/grpc/node_modules/sax/lib/sax.js b/legacy-libs/grpc/node_modules/sax/lib/sax.js new file mode 100644 index 0000000..795d607 --- /dev/null +++ b/legacy-libs/grpc/node_modules/sax/lib/sax.js @@ -0,0 +1,1565 @@ +;(function (sax) { // wrapper for non-node envs + sax.parser = function (strict, opt) { return new SAXParser(strict, opt) } + sax.SAXParser = SAXParser + sax.SAXStream = SAXStream + sax.createStream = createStream + + // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns. + // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)), + // since that's the earliest that a buffer overrun could occur. This way, checks are + // as rare as required, but as often as necessary to ensure never crossing this bound. + // Furthermore, buffers are only tested at most once per write(), so passing a very + // large string into write() might have undesirable effects, but this is manageable by + // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme + // edge case, result in creating at most one complete copy of the string passed in. + // Set to Infinity to have unlimited buffers. + sax.MAX_BUFFER_LENGTH = 64 * 1024 + + var buffers = [ + 'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype', + 'procInstName', 'procInstBody', 'entity', 'attribName', + 'attribValue', 'cdata', 'script' + ] + + sax.EVENTS = [ + 'text', + 'processinginstruction', + 'sgmldeclaration', + 'doctype', + 'comment', + 'opentagstart', + 'attribute', + 'opentag', + 'closetag', + 'opencdata', + 'cdata', + 'closecdata', + 'error', + 'end', + 'ready', + 'script', + 'opennamespace', + 'closenamespace' + ] + + function SAXParser (strict, opt) { + if (!(this instanceof SAXParser)) { + return new SAXParser(strict, opt) + } + + var parser = this + clearBuffers(parser) + parser.q = parser.c = '' + parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH + parser.opt = opt || {} + parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags + parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase' + parser.tags = [] + parser.closed = parser.closedRoot = parser.sawRoot = false + parser.tag = parser.error = null + parser.strict = !!strict + parser.noscript = !!(strict || parser.opt.noscript) + parser.state = S.BEGIN + parser.strictEntities = parser.opt.strictEntities + parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES) + parser.attribList = [] + + // namespaces form a prototype chain. + // it always points at the current tag, + // which protos to its parent tag. + if (parser.opt.xmlns) { + parser.ns = Object.create(rootNS) + } + + // mostly just for error reporting + parser.trackPosition = parser.opt.position !== false + if (parser.trackPosition) { + parser.position = parser.line = parser.column = 0 + } + emit(parser, 'onready') + } + + if (!Object.create) { + Object.create = function (o) { + function F () {} + F.prototype = o + var newf = new F() + return newf + } + } + + if (!Object.keys) { + Object.keys = function (o) { + var a = [] + for (var i in o) if (o.hasOwnProperty(i)) a.push(i) + return a + } + } + + function checkBufferLength (parser) { + var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10) + var maxActual = 0 + for (var i = 0, l = buffers.length; i < l; i++) { + var len = parser[buffers[i]].length + if (len > maxAllowed) { + // Text/cdata nodes can get big, and since they're buffered, + // we can get here under normal conditions. + // Avoid issues by emitting the text node now, + // so at least it won't get any bigger. + switch (buffers[i]) { + case 'textNode': + closeText(parser) + break + + case 'cdata': + emitNode(parser, 'oncdata', parser.cdata) + parser.cdata = '' + break + + case 'script': + emitNode(parser, 'onscript', parser.script) + parser.script = '' + break + + default: + error(parser, 'Max buffer length exceeded: ' + buffers[i]) + } + } + maxActual = Math.max(maxActual, len) + } + // schedule the next check for the earliest possible buffer overrun. + var m = sax.MAX_BUFFER_LENGTH - maxActual + parser.bufferCheckPosition = m + parser.position + } + + function clearBuffers (parser) { + for (var i = 0, l = buffers.length; i < l; i++) { + parser[buffers[i]] = '' + } + } + + function flushBuffers (parser) { + closeText(parser) + if (parser.cdata !== '') { + emitNode(parser, 'oncdata', parser.cdata) + parser.cdata = '' + } + if (parser.script !== '') { + emitNode(parser, 'onscript', parser.script) + parser.script = '' + } + } + + SAXParser.prototype = { + end: function () { end(this) }, + write: write, + resume: function () { this.error = null; return this }, + close: function () { return this.write(null) }, + flush: function () { flushBuffers(this) } + } + + var Stream + try { + Stream = require('stream').Stream + } catch (ex) { + Stream = function () {} + } + + var streamWraps = sax.EVENTS.filter(function (ev) { + return ev !== 'error' && ev !== 'end' + }) + + function createStream (strict, opt) { + return new SAXStream(strict, opt) + } + + function SAXStream (strict, opt) { + if (!(this instanceof SAXStream)) { + return new SAXStream(strict, opt) + } + + Stream.apply(this) + + this._parser = new SAXParser(strict, opt) + this.writable = true + this.readable = true + + var me = this + + this._parser.onend = function () { + me.emit('end') + } + + this._parser.onerror = function (er) { + me.emit('error', er) + + // if didn't throw, then means error was handled. + // go ahead and clear error, so we can write again. + me._parser.error = null + } + + this._decoder = null + + streamWraps.forEach(function (ev) { + Object.defineProperty(me, 'on' + ev, { + get: function () { + return me._parser['on' + ev] + }, + set: function (h) { + if (!h) { + me.removeAllListeners(ev) + me._parser['on' + ev] = h + return h + } + me.on(ev, h) + }, + enumerable: true, + configurable: false + }) + }) + } + + SAXStream.prototype = Object.create(Stream.prototype, { + constructor: { + value: SAXStream + } + }) + + SAXStream.prototype.write = function (data) { + if (typeof Buffer === 'function' && + typeof Buffer.isBuffer === 'function' && + Buffer.isBuffer(data)) { + if (!this._decoder) { + var SD = require('string_decoder').StringDecoder + this._decoder = new SD('utf8') + } + data = this._decoder.write(data) + } + + this._parser.write(data.toString()) + this.emit('data', data) + return true + } + + SAXStream.prototype.end = function (chunk) { + if (chunk && chunk.length) { + this.write(chunk) + } + this._parser.end() + return true + } + + SAXStream.prototype.on = function (ev, handler) { + var me = this + if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) { + me._parser['on' + ev] = function () { + var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments) + args.splice(0, 0, ev) + me.emit.apply(me, args) + } + } + + return Stream.prototype.on.call(me, ev, handler) + } + + // this really needs to be replaced with character classes. + // XML allows all manner of ridiculous numbers and digits. + var CDATA = '[CDATA[' + var DOCTYPE = 'DOCTYPE' + var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace' + var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/' + var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE } + + // http://www.w3.org/TR/REC-xml/#NT-NameStartChar + // This implementation works on strings, a single character at a time + // as such, it cannot ever support astral-plane characters (10000-EFFFF) + // without a significant breaking change to either this parser, or the + // JavaScript language. Implementation of an emoji-capable xml parser + // is left as an exercise for the reader. + var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ + + var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/ + + var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ + var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/ + + function isWhitespace (c) { + return c === ' ' || c === '\n' || c === '\r' || c === '\t' + } + + function isQuote (c) { + return c === '"' || c === '\'' + } + + function isAttribEnd (c) { + return c === '>' || isWhitespace(c) + } + + function isMatch (regex, c) { + return regex.test(c) + } + + function notMatch (regex, c) { + return !isMatch(regex, c) + } + + var S = 0 + sax.STATE = { + BEGIN: S++, // leading byte order mark or whitespace + BEGIN_WHITESPACE: S++, // leading whitespace + TEXT: S++, // general stuff + TEXT_ENTITY: S++, // & and such. + OPEN_WAKA: S++, // < + SGML_DECL: S++, // + SCRIPT: S++, //