push all website files

This commit is contained in:
Jacob Levine
2019-01-06 13:14:45 -06:00
parent d7301e26c3
commit d2d5d4c04e
15662 changed files with 2166516 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
# gRPC Protobuf Loader
A utility package for loading `.proto` files for use with gRPC, using the latest Protobuf.js package.
## 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
}
```

View File

@@ -0,0 +1,70 @@
/// <reference types="node" />
/**
* @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';
export interface Serialize<T> {
(value: T): Buffer;
}
export interface Deserialize<T> {
(bytes: Buffer): T;
}
export interface MethodDefinition<RequestType, ResponseType> {
path: string;
requestStream: boolean;
responseStream: boolean;
requestSerialize: Serialize<RequestType>;
responseSerialize: Serialize<ResponseType>;
requestDeserialize: Deserialize<RequestType>;
responseDeserialize: Deserialize<ResponseType>;
originalName?: string;
}
export interface ServiceDefinition {
[index: string]: MethodDefinition<object, object>;
}
export interface PackageDefinition {
[index: string]: ServiceDefinition;
}
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<PackageDefinition>;
export declare function loadSync(filename: string, options?: Options): PackageDefinition;

View File

@@ -0,0 +1,157 @@
"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 fs = require("fs");
var path = require("path");
var _ = require("lodash");
function joinName(baseName, name) {
if (baseName === '') {
return name;
}
else {
return baseName + '.' + name;
}
}
function getAllServices(obj, parentName) {
var objName = joinName(parentName, obj.name);
if (obj.hasOwnProperty('methods')) {
return [[objName, obj]];
}
else {
return obj.nestedArray.map(function (child) {
if (child.hasOwnProperty('nested')) {
return getAllServices(child, objName);
}
else {
return [];
}
}).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []);
}
}
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) {
return {
path: '/' + serviceName + '/' + method.name,
requestStream: !!method.requestStream,
responseStream: !!method.responseStream,
requestSerialize: createSerializer(method.resolvedRequestType),
requestDeserialize: createDeserializer(method.resolvedRequestType, options),
responseSerialize: createSerializer(method.resolvedResponseType),
responseDeserialize: createDeserializer(method.resolvedResponseType, options),
// TODO(murgatroid99): Find a better way to handle this
originalName: _.camelCase(method.name)
};
}
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;
}
function createPackageDefinition(root, options) {
var def = {};
for (var _i = 0, _a = getAllServices(root, ''); _i < _a.length; _i++) {
var _b = _a[_i], name = _b[0], service = _b[1];
def[name] = createServiceDefinition(service, name, options);
}
return def;
}
function addIncludePathResolver(root, includePaths) {
root.resolvePath = function (origin, 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 null;
};
}
/**
* 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

View File

@@ -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

View File

@@ -0,0 +1,16 @@
# Installation
> `npm install --save @types/node`
# Summary
This package contains type definitions for Node.js (http://nodejs.org/).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v9
Additional Details
* Last updated: Tue, 18 Dec 2018 21:38:45 GMT
* Dependencies: none
* Global values: Buffer, NodeJS, SlowBuffer, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, require, setImmediate, setInterval, setTimeout
# Credits
These definitions were written by Microsoft TypeScript <https://github.com/Microsoft>, DefinitelyTyped <https://github.com/DefinitelyTyped>, Parambir Singh <https://github.com/parambirs>, Christian Vaagland Tellnes <https://github.com/tellnes>, Wilco Bakker <https://github.com/WilcoBakker>, Nicolas Voigt <https://github.com/octo-sniffle>, Chigozirim C. <https://github.com/smac89>, Flarna <https://github.com/Flarna>, Mariusz Wiktorczyk <https://github.com/mwiktorczyk>, wwwy3y3 <https://github.com/wwwy3y3>, Deividas Bakanas <https://github.com/DeividasBakanas>, Kelvin Jin <https://github.com/kjin>, Alvis HT Tang <https://github.com/alvis>, Sebastian Silbermann <https://github.com/eps1lon>, Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>, Alberto Schiabel <https://github.com/jkomyno>, Klaus Meinhardt <https://github.com/ajafff>, Huw <https://github.com/hoo29>, Nicolas Even <https://github.com/n-e>, Bruno Scheufler <https://github.com/brunoscheufler>, Mohsen Azimi <https://github.com/mohsen1>, Hoàng Văn Khải <https://github.com/KSXGitHub>, Alexander T. <https://github.com/a-tarasyuk>, Lishude <https://github.com/islishude>, Andrew Makarov <https://github.com/r3nya>, Eugene Y. Q. Shen <https://github.com/eyqs>.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,152 @@
{
"_from": "@types/node@^9.4.6",
"_id": "@types/node@9.6.41",
"_inBundle": false,
"_integrity": "sha512-sPZWEbFMz6qAy9SLY7jh5cgepmsiwqUUHjvEm8lpU6kug2hmmcyuTnwhoGw/GWpI5Npue4EqvsiQQI0eWjW/ZA==",
"_location": "/@grpc/proto-loader/@types/node",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@types/node@^9.4.6",
"name": "@types/node",
"escapedName": "@types%2fnode",
"scope": "@types",
"rawSpec": "^9.4.6",
"saveSpec": null,
"fetchSpec": "^9.4.6"
},
"_requiredBy": [
"/@grpc/proto-loader"
],
"_resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.41.tgz",
"_shasum": "e57c3152eb2e7ec748c733cebd0c095b437c5d37",
"_spec": "@types/node@^9.4.6",
"_where": "C:\\Users\\jlevi\\Downloads\\tr2022-strategy-master\\tr2022-strategy-master\\data analysis\\functions\\node_modules\\@grpc\\proto-loader",
"bugs": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Microsoft TypeScript",
"url": "https://github.com/Microsoft"
},
{
"name": "DefinitelyTyped",
"url": "https://github.com/DefinitelyTyped"
},
{
"name": "Parambir Singh",
"url": "https://github.com/parambirs"
},
{
"name": "Christian Vaagland Tellnes",
"url": "https://github.com/tellnes"
},
{
"name": "Wilco Bakker",
"url": "https://github.com/WilcoBakker"
},
{
"name": "Nicolas Voigt",
"url": "https://github.com/octo-sniffle"
},
{
"name": "Chigozirim C.",
"url": "https://github.com/smac89"
},
{
"name": "Flarna",
"url": "https://github.com/Flarna"
},
{
"name": "Mariusz Wiktorczyk",
"url": "https://github.com/mwiktorczyk"
},
{
"name": "wwwy3y3",
"url": "https://github.com/wwwy3y3"
},
{
"name": "Deividas Bakanas",
"url": "https://github.com/DeividasBakanas"
},
{
"name": "Kelvin Jin",
"url": "https://github.com/kjin"
},
{
"name": "Alvis HT Tang",
"url": "https://github.com/alvis"
},
{
"name": "Sebastian Silbermann",
"url": "https://github.com/eps1lon"
},
{
"name": "Hannes Magnusson",
"url": "https://github.com/Hannes-Magnusson-CK"
},
{
"name": "Alberto Schiabel",
"url": "https://github.com/jkomyno"
},
{
"name": "Klaus Meinhardt",
"url": "https://github.com/ajafff"
},
{
"name": "Huw",
"url": "https://github.com/hoo29"
},
{
"name": "Nicolas Even",
"url": "https://github.com/n-e"
},
{
"name": "Bruno Scheufler",
"url": "https://github.com/brunoscheufler"
},
{
"name": "Mohsen Azimi",
"url": "https://github.com/mohsen1"
},
{
"name": "Hoàng Văn Khải",
"url": "https://github.com/KSXGitHub"
},
{
"name": "Alexander T.",
"url": "https://github.com/a-tarasyuk"
},
{
"name": "Lishude",
"url": "https://github.com/islishude"
},
{
"name": "Andrew Makarov",
"url": "https://github.com/r3nya"
},
{
"name": "Eugene Y. Q. Shen",
"url": "https://github.com/eyqs"
}
],
"dependencies": {},
"deprecated": false,
"description": "TypeScript definitions for Node.js",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
"license": "MIT",
"main": "",
"name": "@types/node",
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
},
"scripts": {},
"typeScriptVersion": "2.0",
"types": "index",
"typesPublisherContentHash": "159c257e6a57c0dd5acf840c15ba44d9373d0ee24e030485ba68ec05a145a907",
"version": "9.6.41"
}

View File

@@ -0,0 +1,82 @@
{
"_from": "@grpc/proto-loader@^0.3.0",
"_id": "@grpc/proto-loader@0.3.0",
"_inBundle": false,
"_integrity": "sha512-9b8S/V+3W4Gv7G/JKSZ48zApgyYbfIR7mAC9XNnaSWme3zj57MIESu0ELzm9j5oxNIpFG8DgO00iJMIUZ5luqw==",
"_location": "/@grpc/proto-loader",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@grpc/proto-loader@^0.3.0",
"name": "@grpc/proto-loader",
"escapedName": "@grpc%2fproto-loader",
"scope": "@grpc",
"rawSpec": "^0.3.0",
"saveSpec": null,
"fetchSpec": "^0.3.0"
},
"_requiredBy": [
"/google-gax"
],
"_resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.3.0.tgz",
"_shasum": "c127d3859bff895f220453612ba04b923af0c584",
"_spec": "@grpc/proto-loader@^0.3.0",
"_where": "C:\\Users\\jlevi\\Downloads\\tr2022-strategy-master\\tr2022-strategy-master\\data analysis\\functions\\node_modules\\google-gax",
"author": {
"name": "Google Inc."
},
"bugs": {
"url": "https://github.com/grpc/grpc-node/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Michael Lumish",
"email": "mlumish@google.com"
}
],
"dependencies": {
"@types/lodash": "^4.14.104",
"@types/node": "^9.4.6",
"lodash": "^4.17.5",
"protobufjs": "^6.8.6"
},
"deprecated": false,
"description": "gRPC utility library for loading .proto files",
"devDependencies": {
"clang-format": "^1.2.2",
"gts": "^0.5.3",
"typescript": "~2.7.2"
},
"engines": {
"node": ">=6"
},
"files": [
"build/src/*.d.ts",
"build/src/*.js"
],
"homepage": "https://grpc.io/",
"license": "Apache-2.0",
"main": "build/src/index.js",
"name": "@grpc/proto-loader",
"repository": {
"type": "git",
"url": "git+https://github.com/grpc/grpc-node.git"
},
"scripts": {
"build": "npm run compile",
"check": "gts check",
"clean": "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.3.0"
}