diff --git a/lib/services/contentModerator/LICENSE.txt b/lib/services/contentModerator/LICENSE.txt index a70e8cf660..5431ba98b9 100644 --- a/lib/services/contentModerator/LICENSE.txt +++ b/lib/services/contentModerator/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 Microsoft - -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. +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +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/lib/services/contentModerator/lib/models/index.d.ts b/lib/services/contentModerator/lib/models/index.d.ts index cd14c7261c..9de671bced 100644 --- a/lib/services/contentModerator/lib/models/index.d.ts +++ b/lib/services/contentModerator/lib/models/index.d.ts @@ -176,6 +176,21 @@ export interface Email { index?: number; } +/** + * @class + * Initializes a new instance of the SSN class. + * @constructor + * Detected SSN details. + * + * @member {string} [text] Detected SSN in the input text content. + * @member {number} [index] Index(Location) of the SSN in the input text + * content. + */ +export interface SSN { + text?: string; + index?: number; +} + /** * @class * Initializes a new instance of the IPA class. @@ -232,12 +247,14 @@ export interface Address { * Personal Identifier Information details. * * @member {array} [email] + * @member {array} [sSN] * @member {array} [iPA] * @member {array} [phone] * @member {array} [address] */ export interface PII { email?: Email[]; + sSN?: SSN[]; iPA?: IPA[]; phone?: Phone[]; address?: Address[]; @@ -294,6 +311,7 @@ export interface DetectedTerms { * @member {string} [status.exception] Exception status. * @member {object} [pII] Personal Identifier Information details. * @member {array} [pII.email] + * @member {array} [pII.sSN] * @member {array} [pII.iPA] * @member {array} [pII.phone] * @member {array} [pII.address] diff --git a/lib/services/contentModerator/lib/models/index.js b/lib/services/contentModerator/lib/models/index.js index d8591e915b..58ea462c62 100644 --- a/lib/services/contentModerator/lib/models/index.js +++ b/lib/services/contentModerator/lib/models/index.js @@ -24,6 +24,7 @@ exports.ClassificationCategory3 = require('./classificationCategory3'); exports.Classification = require('./classification'); exports.Status = require('./status'); exports.Email = require('./email'); +exports.SSN = require('./sSN'); exports.IPA = require('./iPA'); exports.Phone = require('./phone'); exports.Address = require('./address'); diff --git a/lib/services/contentModerator/lib/models/pII.js b/lib/services/contentModerator/lib/models/pII.js index 9a7e0d936e..1636e48ab9 100644 --- a/lib/services/contentModerator/lib/models/pII.js +++ b/lib/services/contentModerator/lib/models/pII.js @@ -20,6 +20,7 @@ class PII { /** * Create a PII. * @member {array} [email] + * @member {array} [sSN] * @member {array} [iPA] * @member {array} [phone] * @member {array} [address] @@ -56,6 +57,21 @@ class PII { } } }, + sSN: { + required: false, + serializedName: 'SSN', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SSNElementType', + type: { + name: 'Composite', + className: 'SSN' + } + } + } + }, iPA: { required: false, serializedName: 'IPA', diff --git a/lib/services/contentModerator/lib/models/sSN.js b/lib/services/contentModerator/lib/models/sSN.js new file mode 100644 index 0000000000..f3bd39350b --- /dev/null +++ b/lib/services/contentModerator/lib/models/sSN.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Detected SSN details. + * + */ +class SSN { + /** + * Create a SSN. + * @member {string} [text] Detected SSN in the input text content. + * @member {number} [index] Index(Location) of the SSN in the input text + * content. + */ + constructor() { + } + + /** + * Defines the metadata of SSN + * + * @returns {object} metadata of SSN + * + */ + mapper() { + return { + required: false, + serializedName: 'SSN', + type: { + name: 'Composite', + className: 'SSN', + modelProperties: { + text: { + required: false, + serializedName: 'Text', + type: { + name: 'String' + } + }, + index: { + required: false, + serializedName: 'Index', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = SSN; diff --git a/lib/services/contentModerator/lib/models/screen.js b/lib/services/contentModerator/lib/models/screen.js index fd99e2d8ec..9515f90a3d 100644 --- a/lib/services/contentModerator/lib/models/screen.js +++ b/lib/services/contentModerator/lib/models/screen.js @@ -44,6 +44,7 @@ class Screen { * @member {string} [status.exception] Exception status. * @member {object} [pII] Personal Identifier Information details. * @member {array} [pII.email] + * @member {array} [pII.sSN] * @member {array} [pII.iPA] * @member {array} [pII.phone] * @member {array} [pII.address] diff --git a/lib/services/contentModerator/lib/operations/index.d.ts b/lib/services/contentModerator/lib/operations/index.d.ts index ffeb6dc06a..2fbb11143f 100644 --- a/lib/services/contentModerator/lib/operations/index.d.ts +++ b/lib/services/contentModerator/lib/operations/index.d.ts @@ -921,15 +921,15 @@ export interface TextModeration { * Detects profanity in more than 100 languages and match against custom and * shared blacklists. * - * @param {string} language Language of the terms. - * * @param {string} textContentType The content type. Possible values include: * 'text/plain', 'text/html', 'text/xml', 'text/markdown' * - * @param {string} textContent Content to screen. + * @param {object} textContent Content to screen. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.language] Language of the text. + * * @param {boolean} [options.autocorrect] Autocorrect text. * * @param {boolean} [options.pII] Detect personal identifiable information. @@ -947,7 +947,7 @@ export interface TextModeration { * * @reject {Error|ServiceError} - The error object. */ - screenTextWithHttpOperationResponse(language: string, textContentType: string, textContent: string, options?: { autocorrect? : boolean, pII? : boolean, listId? : string, classify? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>; + screenTextWithHttpOperationResponse(textContentType: string, textContent: stream.Readable, options?: { language? : string, autocorrect? : boolean, pII? : boolean, listId? : string, classify? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * @summary Detect profanity and match against custom and shared blacklists @@ -955,15 +955,15 @@ export interface TextModeration { * Detects profanity in more than 100 languages and match against custom and * shared blacklists. * - * @param {string} language Language of the terms. - * * @param {string} textContentType The content type. Possible values include: * 'text/plain', 'text/html', 'text/xml', 'text/markdown' * - * @param {string} textContent Content to screen. + * @param {object} textContent Content to screen. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.language] Language of the text. + * * @param {boolean} [options.autocorrect] Autocorrect text. * * @param {boolean} [options.pII] Detect personal identifiable information. @@ -997,9 +997,9 @@ export interface TextModeration { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - screenText(language: string, textContentType: string, textContent: string, options?: { autocorrect? : boolean, pII? : boolean, listId? : string, classify? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise; - screenText(language: string, textContentType: string, textContent: string, callback: ServiceCallback): void; - screenText(language: string, textContentType: string, textContent: string, options: { autocorrect? : boolean, pII? : boolean, listId? : string, classify? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + screenText(textContentType: string, textContent: stream.Readable, options?: { language? : string, autocorrect? : boolean, pII? : boolean, listId? : string, classify? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise; + screenText(textContentType: string, textContent: stream.Readable, callback: ServiceCallback): void; + screenText(textContentType: string, textContent: stream.Readable, options: { language? : string, autocorrect? : boolean, pII? : boolean, listId? : string, classify? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1011,7 +1011,7 @@ export interface TextModeration { * @param {string} textContentType The content type. Possible values include: * 'text/plain', 'text/html', 'text/xml', 'text/markdown' * - * @param {string} textContent Content to screen. + * @param {object} textContent Content to screen. * * @param {object} [options] Optional Parameters. * @@ -1024,7 +1024,7 @@ export interface TextModeration { * * @reject {Error|ServiceError} - The error object. */ - detectLanguageWithHttpOperationResponse(textContentType: string, textContent: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + detectLanguageWithHttpOperationResponse(textContentType: string, textContent: stream.Readable, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * This operation will detect the language of given input content. Returns the @@ -1035,7 +1035,7 @@ export interface TextModeration { * @param {string} textContentType The content type. Possible values include: * 'text/plain', 'text/html', 'text/xml', 'text/markdown' * - * @param {string} textContent Content to screen. + * @param {object} textContent Content to screen. * * @param {object} [options] Optional Parameters. * @@ -1064,9 +1064,9 @@ export interface TextModeration { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - detectLanguage(textContentType: string, textContent: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - detectLanguage(textContentType: string, textContent: string, callback: ServiceCallback): void; - detectLanguage(textContentType: string, textContent: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + detectLanguage(textContentType: string, textContent: stream.Readable, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + detectLanguage(textContentType: string, textContent: stream.Readable, callback: ServiceCallback): void; + detectLanguage(textContentType: string, textContent: stream.Readable, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** diff --git a/lib/services/contentModerator/lib/operations/textModeration.js b/lib/services/contentModerator/lib/operations/textModeration.js index ffa5afab78..7c1f831658 100644 --- a/lib/services/contentModerator/lib/operations/textModeration.js +++ b/lib/services/contentModerator/lib/operations/textModeration.js @@ -19,15 +19,15 @@ const WebResource = msRest.WebResource; * Detects profanity in more than 100 languages and match against custom and * shared blacklists. * - * @param {string} language Language of the terms. - * * @param {string} textContentType The content type. Possible values include: * 'text/plain', 'text/html', 'text/xml', 'text/markdown' * - * @param {string} textContent Content to screen. + * @param {object} textContent Content to screen. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.language] Language of the text. + * * @param {boolean} [options.autocorrect] Autocorrect text. * * @param {boolean} [options.pII] Detect personal identifiable information. @@ -52,7 +52,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _screenText(language, textContentType, textContent, options, callback) { +function _screenText(textContentType, textContent, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -62,6 +62,7 @@ function _screenText(language, textContentType, textContent, options, callback) if (!callback) { throw new Error('callback cannot be null.'); } + let language = (options && options.language !== undefined) ? options.language : undefined; let autocorrect = (options && options.autocorrect !== undefined) ? options.autocorrect : false; let pII = (options && options.pII !== undefined) ? options.pII : false; let listId = (options && options.listId !== undefined) ? options.listId : undefined; @@ -71,8 +72,8 @@ function _screenText(language, textContentType, textContent, options, callback) if (this.client.baseUrl === null || this.client.baseUrl === undefined || typeof this.client.baseUrl.valueOf() !== 'string') { throw new Error('this.client.baseUrl cannot be null or undefined and it must be of type string.'); } - if (language === null || language === undefined || typeof language.valueOf() !== 'string') { - throw new Error('language cannot be null or undefined and it must be of type string.'); + if (language !== null && language !== undefined && typeof language.valueOf() !== 'string') { + throw new Error('language must be of type string.'); } if (autocorrect !== null && autocorrect !== undefined && typeof autocorrect !== 'boolean') { throw new Error('autocorrect must be of type boolean.'); @@ -89,8 +90,8 @@ function _screenText(language, textContentType, textContent, options, callback) if (textContentType === null || textContentType === undefined || typeof textContentType.valueOf() !== 'string') { throw new Error('textContentType cannot be null or undefined and it must be of type string.'); } - if (textContent === null || textContent === undefined || typeof textContent.valueOf() !== 'string') { - throw new Error('textContent cannot be null or undefined and it must be of type string.'); + if (textContent === null || textContent === undefined) { + throw new Error('textContent cannot be null or undefined and it must be of type object.'); } } catch (error) { return callback(error); @@ -101,7 +102,9 @@ function _screenText(language, textContentType, textContent, options, callback) let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'contentmoderator/moderate/v1.0/ProcessText/Screen/'; requestUrl = requestUrl.replace('{baseUrl}', this.client.baseUrl); let queryParameters = []; - queryParameters.push('language=' + encodeURIComponent(language)); + if (language !== null && language !== undefined) { + queryParameters.push('language=' + encodeURIComponent(language)); + } if (autocorrect !== null && autocorrect !== undefined) { queryParameters.push('autocorrect=' + encodeURIComponent(autocorrect.toString())); } @@ -136,25 +139,7 @@ function _screenText(language, textContentType, textContent, options, callback) } } // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (textContent !== null && textContent !== undefined) { - let requestModelMapper = { - required: true, - serializedName: 'Text Content', - type: { - name: 'String' - } - }; - requestModel = client.serialize(requestModelMapper, textContent, 'textContent'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(textContent, null, 2)}.`); - return callback(serializationError); - } + let requestContent = textContent; httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { @@ -222,7 +207,7 @@ function _screenText(language, textContentType, textContent, options, callback) * @param {string} textContentType The content type. Possible values include: * 'text/plain', 'text/html', 'text/xml', 'text/markdown' * - * @param {string} textContent Content to screen. + * @param {object} textContent Content to screen. * * @param {object} [options] Optional Parameters. * @@ -260,8 +245,8 @@ function _detectLanguage(textContentType, textContent, options, callback) { if (textContentType === null || textContentType === undefined || typeof textContentType.valueOf() !== 'string') { throw new Error('textContentType cannot be null or undefined and it must be of type string.'); } - if (textContent === null || textContent === undefined || typeof textContent.valueOf() !== 'string') { - throw new Error('textContent cannot be null or undefined and it must be of type string.'); + if (textContent === null || textContent === undefined) { + throw new Error('textContent cannot be null or undefined and it must be of type object.'); } } catch (error) { return callback(error); @@ -290,25 +275,7 @@ function _detectLanguage(textContentType, textContent, options, callback) { } } // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (textContent !== null && textContent !== undefined) { - let requestModelMapper = { - required: true, - serializedName: 'Text Content', - type: { - name: 'String' - } - }; - requestModel = client.serialize(requestModelMapper, textContent, 'textContent'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(textContent, null, 2)}.`); - return callback(serializationError); - } + let requestContent = textContent; httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { @@ -385,15 +352,15 @@ class TextModeration { * Detects profanity in more than 100 languages and match against custom and * shared blacklists. * - * @param {string} language Language of the terms. - * * @param {string} textContentType The content type. Possible values include: * 'text/plain', 'text/html', 'text/xml', 'text/markdown' * - * @param {string} textContent Content to screen. + * @param {object} textContent Content to screen. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.language] Language of the text. + * * @param {boolean} [options.autocorrect] Autocorrect text. * * @param {boolean} [options.pII] Detect personal identifiable information. @@ -411,11 +378,11 @@ class TextModeration { * * @reject {Error} - The error object. */ - screenTextWithHttpOperationResponse(language, textContentType, textContent, options) { + screenTextWithHttpOperationResponse(textContentType, textContent, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._screenText(language, textContentType, textContent, options, (err, result, request, response) => { + self._screenText(textContentType, textContent, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -431,15 +398,15 @@ class TextModeration { * Detects profanity in more than 100 languages and match against custom and * shared blacklists. * - * @param {string} language Language of the terms. - * * @param {string} textContentType The content type. Possible values include: * 'text/plain', 'text/html', 'text/xml', 'text/markdown' * - * @param {string} textContent Content to screen. + * @param {object} textContent Content to screen. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.language] Language of the text. + * * @param {boolean} [options.autocorrect] Autocorrect text. * * @param {boolean} [options.pII] Detect personal identifiable information. @@ -473,7 +440,7 @@ class TextModeration { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - screenText(language, textContentType, textContent, options, optionalCallback) { + screenText(textContentType, textContent, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -482,14 +449,14 @@ class TextModeration { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._screenText(language, textContentType, textContent, options, (err, result, request, response) => { + self._screenText(textContentType, textContent, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._screenText(language, textContentType, textContent, options, optionalCallback); + return self._screenText(textContentType, textContent, options, optionalCallback); } } @@ -502,7 +469,7 @@ class TextModeration { * @param {string} textContentType The content type. Possible values include: * 'text/plain', 'text/html', 'text/xml', 'text/markdown' * - * @param {string} textContent Content to screen. + * @param {object} textContent Content to screen. * * @param {object} [options] Optional Parameters. * @@ -538,7 +505,7 @@ class TextModeration { * @param {string} textContentType The content type. Possible values include: * 'text/plain', 'text/html', 'text/xml', 'text/markdown' * - * @param {string} textContent Content to screen. + * @param {object} textContent Content to screen. * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/contentModerator/package-lock.json b/lib/services/contentModerator/package-lock.json new file mode 100644 index 0000000000..1da8d0291e --- /dev/null +++ b/lib/services/contentModerator/package-lock.json @@ -0,0 +1,376 @@ +{ + "name": "azure-cognitiveservices-contentmoderator", + "version": "3.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "optional": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "^5.1.0", + "har-schema": "^2.0.0" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "mime-db": { + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" + }, + "mime-types": { + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "requires": { + "mime-db": "~1.35.0" + } + }, + "moment": { + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" + }, + "ms-rest": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/ms-rest/-/ms-rest-2.3.6.tgz", + "integrity": "sha512-M+Lx9P7Wy4TeAk7jqPLwGS1QS1gvxF6Xo+OHv5j1g3Kcb44T/GTUuSjxTKarF6aKyeacZH1ZD++Nt7pcql7dDA==", + "requires": { + "duplexer": "^0.1.1", + "is-buffer": "^1.1.6", + "is-stream": "^1.1.0", + "moment": "^2.21.0", + "request": "^2.87.0", + "through": "^2.3.8", + "tunnel": "0.0.5", + "uuid": "^3.2.1" + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "request": { + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", + "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "requires": { + "punycode": "^1.4.1" + } + }, + "tunnel": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz", + "integrity": "sha512-gj5sdqherx4VZKMcBA4vewER7zdK25Td+z1npBqpbDys4eJrLx+SlYjJvq1bDXs2irkuJM5pf8ktaEQVipkrbA==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + } + } +} diff --git a/lib/services/contentModerator/package.json b/lib/services/contentModerator/package.json index 324b07b742..9e4704451f 100644 --- a/lib/services/contentModerator/package.json +++ b/lib/services/contentModerator/package.json @@ -2,20 +2,23 @@ "name": "azure-cognitiveservices-contentmoderator", "author": "Microsoft Corporation", "description": "ContentModeratorAPIClient Library with typescript type definitions for node", - "version": "2.0.0", + "version": "3.0.0", "dependencies": { - "ms-rest": "^2.3.2" + "ms-rest": "^2.3.3" }, - "keywords": [ "node", "azure" ], + "keywords": [ + "node", + "azure" + ], "license": "MIT", "main": "./lib/contentModeratorAPIClient.js", "types": "./lib/contentModeratorAPIClient.d.ts", - "homepage": "http://github.com/azure/azure-sdk-for-node", + "homepage": "https://github.com/azure/azure-sdk-for-node/lib/services/contentModerator", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" + "url": "https://github.com/azure/azure-sdk-for-node/issues" } } diff --git a/test/recordings/contentmoderator-tests/Content_Moderator_Screen_Text_should_detect_profanity.nock.js b/test/recordings/contentmoderator-tests/Content_Moderator_Screen_Text_should_detect_profanity.nock.js index 4ec9634dce..982a4afcda 100644 --- a/test/recordings/contentmoderator-tests/Content_Moderator_Screen_Text_should_detect_profanity.nock.js +++ b/test/recordings/contentmoderator-tests/Content_Moderator_Screen_Text_should_detect_profanity.nock.js @@ -9,7 +9,7 @@ exports.scopes = [[function (nock) { var result = nock('https://westus.api.cognitive.microsoft.com:443') .filteringRequestBody(function (path) { return '*';}) -.post('/contentmoderator/moderate/v1.0/ProcessText/Screen/?language=eng&autocorrect=false&PII=false&classify=false', '*') +.post('/contentmoderator/moderate/v1.0/ProcessText/Screen/?autocorrect=false&PII=false&classify=false', '*') .reply(200, "{\"OriginalText\":\"\\\"Is this a crap email abcdef@abcd.com, phone:\\\\n 6657789887, IP: 255.255.255.255, 1 Microsoft Way, Redmond, WA 98052\\\"\",\"NormalizedText\":\"\\\" Is this a crap email abcdef@ abcd. com, phone: \\\\ n 6657789887, IP: 255. 255. 255. 255, 1 Microsoft Way, Redmond, WA 98052\\\"\",\"Misrepresentation\":null,\"Language\":\"eng\",\"Terms\":[{\"Index\":11,\"OriginalIndex\":11,\"ListId\":0,\"Term\":\"crap\"}],\"Status\":{\"Code\":3000,\"Description\":\"OK\",\"Exception\":null},\"TrackingId\":\"f090117e-5a83-43fb-97a8-dbe58b9d4703\"}", { 'cache-control': 'no-cache', pragma: 'no-cache', 'content-length': '512',