Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
46 changes: 46 additions & 0 deletions .azure-pipelines/client.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
parameters:
name: ''
vmImage: ''

jobs:
- job: ${{ format('Test_{0}', parameters.name) }}
dependsOn:
- 'Publish'

pool:
vmImage: ${{ parameters.vmImage }}

strategy:
matrix:
Node6:
node.version: '6.x'
Node8:
node.version: '8.x'
Node10:
node.version: '10.x'
Node11:
node.version: '11.x'

steps:
- task: NodeTool@0
inputs:
versionSpec: '$(node.version)'
displayName: 'Install Node.js $(node.version)'

- task: Npm@1
inputs:
command: 'install'
displayName: 'npm install'

- task: Npm@1
inputs:
command: 'custom'
customCommand: 'run mocha -- $(test.path) --reporter mocha-junit-reporter'
displayName: 'npm run mocha'

- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-results.xml'
testRunTitle: ${{ format('{0} Node $(node.version)', parameters.name) }}
condition: succeededOrFailed()
displayName: 'Publish test results'
78 changes: 78 additions & 0 deletions .azure-pipelines/client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
trigger:
- master

variables:
node.version: '10.x'

jobs:
- job: 'Publish'

pool:
vmImage: 'ubuntu-16.04'

steps:
- task: NodeTool@0
inputs:
versionSpec: '$(node.version)'
displayName: 'Install Node.js $(node.version)'

- task: Npm@1
inputs:
command: 'install'
workingDir: '$(source.path)'
displayName: 'npm install'

- task: Npm@1
inputs:
command: 'custom'
customCommand: 'pack'
workingDir: '$(source.path)'
displayName: 'npm pack'

- task: CopyFiles@2
inputs:
sourceFolder: '$(source.path)'
contents: '*.tgz'
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: 'Copy Package'

- task: PublishBuildArtifacts@1
displayName: 'Publish Package'

- job: 'Audit'

pool:
vmImage: 'ubuntu-16.04'

steps:
- task: NodeTool@0
inputs:
versionSpec: '$(node.version)'
displayName: 'Install Node.js $(node.version)'

- task: Npm@1
inputs:
command: 'custom'
customCommand: 'i --package-lock-only'
workingDir: '$(source.path)'
displayName: 'npm i --package-lock-only'

- powershell: "npm audit --json | ConvertFrom-Json | Select-Object -expandProperty 'metadata' | select-object -expandproperty 'vulnerabilities' | %{ if ($_.low + $_.moderate + $_.high + $_.critical -ne 0) { write-error 'FAILED! Your package has vulnerabilities. Check npm audit' }}"
workingDirectory: '$(source.path)'
displayName: 'npm audit'

- template: client.test.yml
parameters:
name: Linux
vmImage: 'ubuntu-16.04'

- template: client.test.yml
parameters:
name: macOS
vmImage: 'macOS-10.13'

- template: client.test.yml
parameters:
name: Windows
vmImage: 'vs2017-win2016'

8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,10 @@ packages

# Coverage report
coverage
.nyc_output
.nyc_output

# Output of 'npm pack'
*.tgz

# Test Results
test-results.xml
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Azure SDK for Node.js

[![NPM version](https://badge.fury.io/js/azure.png)](https://badge.fury.io/js/azure) [![Build Status](https://travis-ci.org/Azure/azure-sdk-for-node.png?branch=master)](https://travis-ci.org/Azure/azure-sdk-for-node)
| Component | Build Status |
| --------- | ------ |
| Management Libraries | [![Build Status](https://travis-ci.org/Azure/azure-sdk-for-node.png?branch=master)](https://travis-ci.org/Azure/azure-sdk-for-node) |
| Client Libraries | [![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/azure-sdk-for-node.client)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=33) |

This project provides Node.js packages that makes it easy to consume and manage Microsoft Azure Services.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Microsoft
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
Expand All @@ -18,4 +18,4 @@ 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.
SOFTWARE.
44 changes: 44 additions & 0 deletions lib/services/cognitiveServicesQnAMaker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
uid: azure-cognitiveservices-qnamaker
summary: *content

---
**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.**
## Microsoft Azure SDK for Node.js - QnAMakerClient

This project provides a Node.js package for accessing Azure. Right now it supports:
- **Node.js version 6.x.x or higher**

### Features


### How to Install

```bash
npm install azure-cognitiveservices-qnamaker
```

### How to use

#### Authentication, client creation, and getKeys endpointKeys as an example.

```javascript
const msRest = require("ms-rest");
const QnAMakerClient = require("azure-cognitiveservices-qnamaker");
const token = "<access_token>";
const creds = new msRest.TokenCredentials(token);
const subscriptionId = "<Subscription_Id>";
const client = new QnAMakerClient(creds, subscriptionId);

client.endpointKeys.getKeys().then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error occurred:');
console.dir(err, {depth: null, colors: true});
});
```

### Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* 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';

/**
* Collection of words that are synonyms.
*
*/
class AlterationsDTO {
/**
* Create a AlterationsDTO.
* @property {array} alterations Words that are synonymous with each other.
*/
constructor() {
}

/**
* Defines the metadata of AlterationsDTO
*
* @returns {object} metadata of AlterationsDTO
*
*/
mapper() {
return {
required: false,
serializedName: 'AlterationsDTO',
type: {
name: 'Composite',
className: 'AlterationsDTO',
modelProperties: {
alterations: {
required: true,
serializedName: 'alterations',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}

module.exports = AlterationsDTO;
104 changes: 104 additions & 0 deletions lib/services/cognitiveServicesQnAMaker/lib/models/createKbDTO.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* 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';

/**
* Post body schema for CreateKb operation.
*
*/
class CreateKbDTO {
/**
* Create a CreateKbDTO.
* @property {string} name Friendly name for the knowledgebase.
* @property {array} [qnaList] List of Q-A (QnADTO) to be added to the
* knowledgebase. Q-A Ids are assigned by the service and should be omitted.
* @property {array} [urls] List of URLs to be used for extracting Q-A.
* @property {array} [files] List of files from which to Extract Q-A.
*/
constructor() {
}

/**
* Defines the metadata of CreateKbDTO
*
* @returns {object} metadata of CreateKbDTO
*
*/
mapper() {
return {
required: false,
serializedName: 'CreateKbDTO',
type: {
name: 'Composite',
className: 'CreateKbDTO',
modelProperties: {
name: {
required: true,
serializedName: 'name',
constraints: {
MaxLength: 100,
MinLength: 1
},
type: {
name: 'String'
}
},
qnaList: {
required: false,
serializedName: 'qnaList',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'QnADTOElementType',
type: {
name: 'Composite',
className: 'QnADTO'
}
}
}
},
urls: {
required: false,
serializedName: 'urls',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
},
files: {
required: false,
serializedName: 'files',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'FileDTOElementType',
type: {
name: 'Composite',
className: 'FileDTO'
}
}
}
}
}
}
};
}
}

module.exports = CreateKbDTO;
Loading