@google-cloud/phishing-protection
Advanced tools
Comparing version 1.7.0 to 2.0.0
@@ -17,3 +17,4 @@ { | ||
"objc_class_prefix": "GCPP", | ||
"php_namespace": "Google\\Cloud\\PhishingProtection\\V1beta1" | ||
"php_namespace": "Google\\Cloud\\PhishingProtection\\V1beta1", | ||
"ruby_package": "Google::Cloud::PhishingProtection::V1beta1" | ||
}, | ||
@@ -20,0 +21,0 @@ "nested": { |
"use strict"; | ||
// Copyright 2019 Google LLC | ||
// Copyright 2020 Google LLC | ||
// | ||
@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License"); |
import * as gax from 'google-gax'; | ||
import { Callback, ClientOptions } from 'google-gax'; | ||
import * as protosTypes from '../../protos/protos'; | ||
import { Callback, Descriptors, ClientOptions } from 'google-gax'; | ||
import * as protos from '../../protos/protos'; | ||
/** | ||
@@ -10,5 +10,2 @@ * Service to report phishing URIs. | ||
export declare class PhishingProtectionServiceV1Beta1Client { | ||
private _descriptors; | ||
private _innerApiCalls; | ||
private _pathTemplates; | ||
private _terminated; | ||
@@ -21,2 +18,9 @@ private _opts; | ||
auth: gax.GoogleAuth; | ||
descriptors: Descriptors; | ||
innerApiCalls: { | ||
[name: string]: Function; | ||
}; | ||
pathTemplates: { | ||
[name: string]: gax.PathTemplate; | ||
}; | ||
phishingProtectionServiceV1Beta1Stub?: Promise<{ | ||
@@ -85,4 +89,5 @@ [name: string]: Function; | ||
getProjectId(callback: Callback<string, undefined, undefined>): void; | ||
reportPhishing(request: protosTypes.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest, options?: gax.CallOptions): Promise<[protosTypes.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse, (protosTypes.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | undefined), {} | undefined]>; | ||
reportPhishing(request: protosTypes.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest, options: gax.CallOptions, callback: Callback<protosTypes.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse, protosTypes.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | undefined, {} | undefined>): void; | ||
reportPhishing(request: protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest, options?: gax.CallOptions): Promise<[protos.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse, (protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | undefined), {} | undefined]>; | ||
reportPhishing(request: protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest, options: gax.CallOptions, callback: Callback<protos.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse, protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | null | undefined, {} | null | undefined>): void; | ||
reportPhishing(request: protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest, callback: Callback<protos.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse, protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | null | undefined, {} | null | undefined>): void; | ||
/** | ||
@@ -102,3 +107,3 @@ * Return a fully-qualified project resource name string. | ||
*/ | ||
matchProjectFromProjectName(projectName: string): string; | ||
matchProjectFromProjectName(projectName: string): string | number; | ||
/** | ||
@@ -105,0 +110,0 @@ * Terminate the GRPC channel and close the client. |
"use strict"; | ||
// Copyright 2019 Google LLC | ||
// Copyright 2020 Google LLC | ||
// | ||
@@ -56,4 +56,9 @@ // Licensed under the Apache License, Version 2.0 (the "License"); | ||
constructor(opts) { | ||
this._descriptors = { page: {}, stream: {}, longrunning: {} }; | ||
this._terminated = false; | ||
this.descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
// Ensure that options include the service address and port. | ||
@@ -109,7 +114,10 @@ const staticMembers = this | ||
const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json'); | ||
this._protos = this._gaxGrpc.loadProto(opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath); | ||
this._protos = this._gaxGrpc.loadProto(opts.fallback | ||
? // eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require('../../protos/protos.json') | ||
: nodejsProtoPath); | ||
// This API contains "path templates"; forward-slash-separated | ||
// identifiers to uniquely identify resources within the API. | ||
// Create useful helper objects for these. | ||
this._pathTemplates = { | ||
this.pathTemplates = { | ||
projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'), | ||
@@ -122,3 +130,3 @@ }; | ||
// merely providing the destination and request information. | ||
this._innerApiCalls = {}; | ||
this.innerApiCalls = {}; | ||
} | ||
@@ -145,3 +153,3 @@ /** | ||
? this._protos.lookupService('google.cloud.phishingprotection.v1beta1.PhishingProtectionServiceV1Beta1') | ||
: // tslint:disable-next-line no-any | ||
: // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
this._protos.google.cloud.phishingprotection.v1beta1 | ||
@@ -153,16 +161,15 @@ .PhishingProtectionServiceV1Beta1, this._opts); | ||
for (const methodName of phishingProtectionServiceV1Beta1StubMethods) { | ||
const innerCallPromise = this.phishingProtectionServiceV1Beta1Stub.then(stub => (...args) => { | ||
const callPromise = this.phishingProtectionServiceV1Beta1Stub.then(stub => (...args) => { | ||
if (this._terminated) { | ||
return Promise.reject('The client has already been closed.'); | ||
} | ||
return stub[methodName].apply(stub, args); | ||
const func = stub[methodName]; | ||
return func.apply(stub, args); | ||
}, (err) => () => { | ||
throw err; | ||
}); | ||
const apiCall = this._gaxModule.createApiCall(innerCallPromise, this._defaults[methodName], this._descriptors.page[methodName] || | ||
this._descriptors.stream[methodName] || | ||
this._descriptors.longrunning[methodName]); | ||
this._innerApiCalls[methodName] = (argument, callOptions, callback) => { | ||
return apiCall(argument, callOptions, callback); | ||
}; | ||
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], this.descriptors.page[methodName] || | ||
this.descriptors.stream[methodName] || | ||
this.descriptors.longrunning[methodName]); | ||
this.innerApiCalls[methodName] = apiCall; | ||
} | ||
@@ -248,3 +255,3 @@ return this.phishingProtectionServiceV1Beta1Stub; | ||
this.initialize(); | ||
return this._innerApiCalls.reportPhishing(request, options, callback); | ||
return this.innerApiCalls.reportPhishing(request, options, callback); | ||
} | ||
@@ -261,4 +268,4 @@ // -------------------- | ||
projectPath(project) { | ||
return this._pathTemplates.projectPathTemplate.render({ | ||
project, | ||
return this.pathTemplates.projectPathTemplate.render({ | ||
project: project, | ||
}); | ||
@@ -274,3 +281,3 @@ } | ||
matchProjectFromProjectName(projectName) { | ||
return this._pathTemplates.projectPathTemplate.match(projectName).project; | ||
return this.pathTemplates.projectPathTemplate.match(projectName).project; | ||
} | ||
@@ -277,0 +284,0 @@ /** |
@@ -7,2 +7,20 @@ # Changelog | ||
## [2.0.0](https://www.github.com/googleapis/nodejs-phishing-protection/compare/v1.7.0...v2.0.0) (2020-04-14) | ||
### ⚠ BREAKING CHANGES | ||
* The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. | ||
### Features | ||
* drop node8 support ([#123](https://www.github.com/googleapis/nodejs-phishing-protection/issues/123)) ([fe53a97](https://www.github.com/googleapis/nodejs-phishing-protection/commit/fe53a97b06dcc5123482f3459312ad2c9ff3534d)) | ||
### Bug Fixes | ||
* drop unused files from package ([#137](https://www.github.com/googleapis/nodejs-phishing-protection/issues/137)) ([9738564](https://www.github.com/googleapis/nodejs-phishing-protection/commit/9738564b5fe1e74e20a9e1fd6cb8ab4af954a817)) | ||
* export explicit version from protos.js ([#128](https://www.github.com/googleapis/nodejs-phishing-protection/issues/128)) ([e71e492](https://www.github.com/googleapis/nodejs-phishing-protection/commit/e71e49252a8e67a03c55af2919a12a34ee121726)) | ||
* remove eslint, update gax, fix generated protos, run the generator ([#133](https://www.github.com/googleapis/nodejs-phishing-protection/issues/133)) ([f530cee](https://www.github.com/googleapis/nodejs-phishing-protection/commit/f530cee08819d7e5faea57f1df2a514e23552067)) | ||
## [1.7.0](https://www.github.com/googleapis/nodejs-phishing-protection/compare/v1.6.0...v1.7.0) (2020-03-06) | ||
@@ -9,0 +27,0 @@ |
{ | ||
"repository": "googleapis/nodejs-phishing-protection", | ||
"name": "@google-cloud/phishing-protection", | ||
"version": "1.7.0", | ||
"version": "2.0.0", | ||
"author": "Google LLC", | ||
@@ -10,5 +10,3 @@ "description": "Phishing Protection API client for Node.js", | ||
"build/protos", | ||
"build/src", | ||
"AUTHORS", | ||
"COPYING" | ||
"build/src" | ||
], | ||
@@ -29,3 +27,3 @@ "keywords": [ | ||
"dependencies": { | ||
"google-gax": "^1.9.0" | ||
"google-gax": "^2.1.0" | ||
}, | ||
@@ -35,9 +33,6 @@ "devDependencies": { | ||
"@types/node": "^12.0.0", | ||
"@types/sinon": "^9.0.0", | ||
"c8": "^7.0.0", | ||
"chai": "^4.2.0", | ||
"eslint": "^6.0.0", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint-plugin-node": "^11.0.0", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
"gts": "^1.0.0", | ||
"gts": "^2.0.0", | ||
"jsdoc": "^3.6.2", | ||
@@ -50,5 +45,5 @@ "jsdoc-fresh": "^1.0.1", | ||
"pack-n-play": "^1.0.0-2", | ||
"prettier": "^1.17.0", | ||
"sinon": "^9.0.1", | ||
"ts-loader": "^6.2.1", | ||
"typescript": "^3.7.0", | ||
"typescript": "^3.8.3", | ||
"webpack": "^4.41.2", | ||
@@ -60,3 +55,3 @@ "webpack-cli": "^3.3.10" | ||
"docs": "jsdoc -c .jsdoc.js", | ||
"lint": "gts fix && eslint --fix samples/*.js", | ||
"lint": "gts fix", | ||
"fix": "gts fix", | ||
@@ -71,8 +66,8 @@ "samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../", | ||
"prepare": "npm run compile", | ||
"prelint": "cd samples; npm link ../; npm i" | ||
"prelint": "cd samples; npm link ../; npm install" | ||
}, | ||
"license": "Apache-2.0", | ||
"engines": { | ||
"node": ">=8.10.0" | ||
"node": ">=10" | ||
} | ||
} |
@@ -58,17 +58,17 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
```javascript | ||
const { | ||
PhishingProtectionServiceV1Beta1Client, | ||
} = require('@google-cloud/phishing-protection'); | ||
const client = new PhishingProtectionServiceV1Beta1Client(); | ||
const { | ||
PhishingProtectionServiceV1Beta1Client, | ||
} = require('@google-cloud/phishing-protection'); | ||
const client = new PhishingProtectionServiceV1Beta1Client(); | ||
// the numeric project ID. | ||
const formattedParent = client.projectPath(projectId); | ||
const request = { | ||
parent: formattedParent, | ||
uri: uri, // the URI to report to Phishing API. | ||
}; | ||
// the numeric project ID. | ||
const formattedParent = client.projectPath(projectId); | ||
const request = { | ||
parent: formattedParent, | ||
uri: uri, // the URI to report to Phishing API. | ||
}; | ||
await client.reportPhishing(request); | ||
await client.reportPhishing(request); | ||
console.info(`reported ${uri} to Phishing Protection API`); | ||
console.info(`reported ${uri} to Phishing Protection API`); | ||
@@ -93,2 +93,23 @@ ``` | ||
## Supported Node.js Versions | ||
Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/). | ||
Libraries are compatible with all current _active_ and _maintenance_ versions of | ||
Node.js. | ||
Client libraries targetting some end-of-life versions of Node.js are available, and | ||
can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). | ||
The dist-tags follow the naming convention `legacy-(version)`. | ||
_Legacy Node.js versions are supported as a best effort:_ | ||
* Legacy versions will not be tested in continuous integration. | ||
* Some security patches may not be able to be backported. | ||
* Dependencies will not be kept up-to-date, and features will not be backported. | ||
#### Legacy tags available | ||
* `legacy-8`: install client libraries from this dist-tag for versions | ||
compatible with Node.js 8. | ||
## Versioning | ||
@@ -116,2 +137,8 @@ | ||
Please note that this `README.md`, the `samples/README.md`, | ||
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) | ||
are generated from a central template. To edit one of these files, make an edit | ||
to its template in this | ||
[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library). | ||
## License | ||
@@ -118,0 +145,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
865251
18
14912
154
+ Added@grpc/grpc-js@1.6.12(transitive)
+ Added@grpc/proto-loader@0.6.130.7.13(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedcliui@7.0.48.0.1(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedduplexify@4.1.3(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedgaxios@4.3.3(transitive)
+ Addedgcp-metadata@4.3.1(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedgoogle-auth-library@7.14.1(transitive)
+ Addedgoogle-gax@2.30.5(transitive)
+ Addedgoogle-p12-pem@3.1.4(transitive)
+ Addedgtoken@5.3.2(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedjson-bigint@1.0.0(transitive)
+ Addedlong@5.2.3(transitive)
+ Addedlru-cache@6.0.0(transitive)
+ Addednode-forge@1.3.1(transitive)
+ Addedobject-hash@3.0.0(transitive)
+ Addedproto3-json-serializer@0.1.9(transitive)
+ Addedprotobufjs@6.11.37.4.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
+ Addedy18n@5.0.8(transitive)
+ Addedyallist@4.0.0(transitive)
+ Addedyargs@16.2.017.7.2(transitive)
+ Addedyargs-parser@20.2.921.1.1(transitive)
- Removed@grpc/grpc-js@1.3.8(transitive)
- Removed@grpc/proto-loader@0.5.6(transitive)
- Removed@types/fs-extra@8.1.5(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedduplexify@3.7.1(transitive)
- Removedgaxios@2.3.4(transitive)
- Removedgcp-metadata@3.5.0(transitive)
- Removedgoogle-auth-library@5.10.1(transitive)
- Removedgoogle-gax@1.15.4(transitive)
- Removedgoogle-p12-pem@2.0.5(transitive)
- Removedgtoken@4.1.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedjson-bigint@0.3.1(transitive)
- Removedlodash.at@4.6.0(transitive)
- Removedlodash.has@4.5.2(transitive)
- Removedlru-cache@5.1.1(transitive)
- Removedmime@2.6.0(transitive)
- Removednode-forge@0.10.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedprotobufjs@6.11.4(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsemver@6.3.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedwalkdir@0.4.1(transitive)
- Removedyallist@3.1.1(transitive)
Updatedgoogle-gax@^2.1.0