From 002b4d1e18e4fe98c501af9b140d399020a94cfb Mon Sep 17 00:00:00 2001 From: Chris McConnell Date: Wed, 14 Apr 2021 19:05:26 -0700 Subject: [PATCH 1/3] Switch to axios to support proxy server when merging. (#1190) * Switch to axios to support proxy server when merging. Normalize sorting to reduce variation. * modify https proxy setting * refactor * fix lint * fix lint Co-authored-by: Chris McConnell Co-authored-by: cosmicshuai --- .vscode/launch.json | 20 ++ common/config/rush/pnpm-lock.yaml | 29 ++- packages/dialog/package.json | 5 +- packages/dialog/src/library/getJSON.ts | 51 ++++ packages/dialog/src/library/schemaMerger.ts | 27 +- packages/dialog/src/library/schemaTracker.ts | 10 +- .../dialog/test/commands/dialog/merge.test.ts | 4 +- .../test/commands/dialog/npm/packageBase.json | 87 +++++++ .../test/commands/dialog/oracles/app.schema | 158 +++++------ .../commands/dialog/oracles/project3.schema | 246 +++++++++--------- .../commands/dialog/oracles/project5.schema | 246 +++++++++--------- packages/lu/package.json | 2 +- .../lu/src/parser/lubuild/http-request.ts | 5 +- .../lu/src/parser/qnabuild/serviceBase.js | 6 +- packages/lu/src/parser/utils/httpsProxy.js | 36 +++ 15 files changed, 567 insertions(+), 365 deletions(-) create mode 100644 packages/dialog/src/library/getJSON.ts create mode 100644 packages/dialog/test/commands/dialog/npm/packageBase.json create mode 100644 packages/lu/src/parser/utils/httpsProxy.js diff --git a/.vscode/launch.json b/.vscode/launch.json index cec015a76..30dcc9240 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -157,6 +157,26 @@ "./packages/lu/lib/**" ] }, + { + "type": "node", + "request": "launch", + "name": "Dialog merge root-package schema", + "preLaunchTask": "${defaultBuildTask}", + "program": "${workspaceFolder}/packages/dialog/bin/run", + "outputCapture": "std", + "outFiles": [ + "./packages/dialog/lib/**" + ], + "args": [ + "dialog:merge", + "npm/node_modules/root-package/package.json", + "-o", + "oracles/root-package", + "--verbose" + ], + "internalConsoleOptions": "openOnSessionStart", + "cwd": "${workspaceFolder}/packages/dialog/test/commands/dialog/" + }, { "type": "node", "request": "launch", diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 7617b4676..2835b7c6f 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -48,9 +48,7 @@ dependencies: fast-text-encoding: 1.0.3 fetch-mock: 7.7.3 get-stdin: 6.0.0 - get-uri: 3.0.2 glob: 7.1.6 - https-proxy-agent: 2.2.4 intercept-stdout: 0.1.2 is-ci: 2.0.0 json-ptr: 1.3.1 @@ -1009,6 +1007,14 @@ packages: node: '>= 4.0.0' resolution: integrity: sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== + /agent-base/6.0.2: + dependencies: + debug: 4.1.1 + dev: false + engines: + node: '>= 6.0.0' + resolution: + integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== /ajv/6.12.0: dependencies: fast-deep-equal: 3.1.1 @@ -3391,6 +3397,15 @@ packages: node: '>= 4.5.0' resolution: integrity: sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== + /https-proxy-agent/5.0.0: + dependencies: + agent-base: 6.0.2 + debug: 4.1.1 + dev: false + engines: + node: '>= 6' + resolution: + integrity: sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== /hyperlinker/1.0.0: dev: false engines: @@ -7292,6 +7307,7 @@ packages: '@types/xml2js': 0.4.5 adaptive-expressions: 4.8.0-preview ajv: 6.12.6 + axios: 0.21.1 botbuilder-lg: 4.8.0-preview chai: 4.2.0 chalk: 2.4.2 @@ -7301,6 +7317,7 @@ packages: get-json: 1.0.1 get-uri: 3.0.2 globby: 11.0.0 + https-proxy-agent: 5.0.0 json-ptr: 1.3.1 json-schema-merge-allof: 0.7.0 json-schema-ref-parser: 8.0.0 @@ -7323,7 +7340,7 @@ packages: dev: false name: '@rush-temp/bf-dialog' resolution: - integrity: sha512-f835rOeaw5mMWjEF+Ch/yTnPHAw/8Q16iVrMlPHb27reOi0t1qtOSOuOKpXWUCIr65oCvvzE32JwnPCy8XFG7w== + integrity: sha512-Pe+h+iEst6RqFvAkWH/RzlUSuJlXoXI957ACIv2jtNe73ps02BYaynLquChghKVuXnZ2Ul+oceCyXx+D9dFQog== tarball: 'file:projects/bf-dialog.tgz' version: 0.0.0 'file:projects/bf-dispatcher.tgz': @@ -7480,7 +7497,7 @@ packages: dev: false name: '@rush-temp/bf-luis-cli' resolution: - integrity: sha512-hi+iOx5Yq08FxsCiGuAIZzdB1/4wcaP/qnDaXfBNMsoT1AB/hjHydm0OyRR/QtBwjFAxMzUCafPmHKqD3JdhPw== + integrity: sha512-fg5B1E3kaqUNQDT45ZWxBSAHE/gNVmIAbz2VCKEcK1/xK7DYLvcGlX5bFMC4AaYw7vSnJZ4Q5S3JYugPG6TinQ== tarball: 'file:projects/bf-luis-cli.tgz' version: 0.0.0 'file:projects/bf-orchestrator-cli.tgz': @@ -7594,7 +7611,7 @@ packages: dev: false name: '@rush-temp/bf-qnamaker' resolution: - integrity: sha512-4493Sz8sTpkTWkPegzzpmpFadoboXwalx1Yj9hLwJLuw/csHob4JzWS0Ota83j6lWkfy0NtObDUb7GJrZtN5xg== + integrity: sha512-XZ3HKrN0Wmk+5WLyi9NfLxhOMPTkQN5R0H+Js+0vM2jaq00NmpGinUalQTDvYrJrgaTIsentVSedsEUHyUU/JQ== tarball: 'file:projects/bf-qnamaker.tgz' version: 0.0.0 'file:projects/botframework-cli.tgz': @@ -7684,9 +7701,7 @@ specifiers: fast-text-encoding: ^1.0.3 fetch-mock: ^7.3.9 get-stdin: ^6.0.0 - get-uri: ~3.0.2 glob: ^7.1.3 - https-proxy-agent: ^2.2.1 intercept-stdout: ^0.1.2 is-ci: 2.0.0 json-ptr: ~1.3.0 diff --git a/packages/dialog/package.json b/packages/dialog/package.json index d78f73bfe..1f9cfbb57 100644 --- a/packages/dialog/package.json +++ b/packages/dialog/package.json @@ -45,10 +45,11 @@ "@types/lru-cache": "^5.1.0", "@types/xml2js": "^0.4.4", "ajv": "^6.12.2", + "axios": "~0.21.1", + "https-proxy-agent": "^5.0.0", "chalk": "^2.4.2", "clone": "^2.1.2", "fs-extra": "^8.1.0", - "get-uri": "~3.0.2", "globby": "^11.0.0", "@apidevtools/json-schema-ref-parser": "^9.0.1", "os": "~0.1.1", @@ -80,4 +81,4 @@ "tslint": "^5.18.0", "typescript": "^4.0.3" } -} +} \ No newline at end of file diff --git a/packages/dialog/src/library/getJSON.ts b/packages/dialog/src/library/getJSON.ts new file mode 100644 index 000000000..7363a99a6 --- /dev/null +++ b/packages/dialog/src/library/getJSON.ts @@ -0,0 +1,51 @@ +/*! + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +import * as fs from 'fs-extra' +const axios = require('axios') +const url = require('url') +const httpsProxyAgent = require('https-proxy-agent') + +const httpsProxy = function (config) { + const parsed = url.parse(config.url) + const protocol = parsed.protocol + if (protocol !== 'https:') { + return config + } + + /* tslint:disable:no-string-literal */ + const envProxy = process.env['HTTPS_PROXY'] || process.env['https_proxy'] + /* tslint:enable:no-string-literal */ + if (envProxy) { + const parsed = url.parse(envProxy) + const proxyOpt = { + hostname: parsed.hostname, + port: parsed.port + } + + if (parsed.auth) { + (proxyOpt as any).auth = parsed.auth + } + + config.httpsAgent = httpsProxyAgent(proxyOpt) + //Disable direct proxy + config.proxy = false + } + + return config +} +axios.interceptors.request.use(httpsProxy) + +const filePrefix = 'file:///' + +// Get JSON from a URL. +export default async function getJSON(url: string): Promise { + if (url.startsWith(filePrefix)) { + return fs.readJSON(url.substring(filePrefix.length)) + } + + const resp = await axios.get(url); + return resp.data +} diff --git a/packages/dialog/src/library/schemaMerger.ts b/packages/dialog/src/library/schemaMerger.ts index 0934ea1c2..4c016fa9c 100644 --- a/packages/dialog/src/library/schemaMerger.ts +++ b/packages/dialog/src/library/schemaMerger.ts @@ -12,10 +12,10 @@ import * as xp from 'xml2js' import Ajv = require('ajv') import parser from '@apidevtools/json-schema-ref-parser' import {JsonPointer as ptr} from 'json-ptr' +import getJSON from './getJSON' const allof = require('json-schema-merge-allof') const clone = require('clone') -const getUri = require('get-uri') const glob = require('globby') const semverRsort = require('semver/functions/rsort') const util = require('util') @@ -40,16 +40,6 @@ function pathName(path: string | undefined, extension: string): string { return path ? `${path}/${extension}` : extension } -// Get JSON from a URI. -async function getJSON(uri: string): Promise { - const stream = await getUri(uri) - let data = '' - for await (const chunk of stream) { - data += chunk.toString() - } - return JSON.parse(data) -} - // Convert to the right kind of slash. // ppath.normalize did not do this properly on the mac. function normalize(path: string): string { @@ -67,6 +57,11 @@ function forwardSlashes(input: string): string { return input.replace(/\\/g, '/') } +// Consistent sort comparison +function sortFunction(a: any, b: any): number { + return a.localeCompare(b, 'en') +} + // Deep merge of JSON objects function mergeObjects(obj1: any, obj2: any): any { const target = {} @@ -83,7 +78,7 @@ function mergeObjects(obj1: any, obj2: any): any { merger(obj1) merger(obj2) const finalTarget = {} - for (const key of Object.keys(target).sort()) { + for (const key of Object.keys(target).sort(sortFunction)) { finalTarget[key] = target[key] } return finalTarget @@ -649,7 +644,7 @@ export class SchemaMerger { this.validateAndExpandPolicies() const oneOf = Object.keys(this.definitions) .filter(kind => !this.isInterface(kind) && this.definitions[kind].$role) - .sort() + .sort(sortFunction) .map(kind => { return {$ref: `#/definitions/${kind}`} }) @@ -661,7 +656,7 @@ export class SchemaMerger { this.currentFile = this.output + '.schema' this.currentKind = '' const finalDefinitions: any = {} - for (const key of Object.keys(this.definitions).sort()) { + for (const key of Object.keys(this.definitions).sort(sortFunction)) { finalDefinitions[key] = this.definitions[key] } let finalSchema: any = { @@ -778,7 +773,7 @@ export class SchemaMerger { if (!this.failed) { for (const locale of Object.keys(result)) { const uischema = {$schema: this.metaUISchemaId} - for (const key of Object.keys(result[locale]).sort()) { + for (const key of Object.keys(result[locale]).sort(sortFunction)) { uischema[key] = result[locale][key] } this.currentFile = ppath.join(ppath.dirname(this.output), outputName + (locale ? '.' + locale : '') + '.uischema') @@ -1788,7 +1783,7 @@ export class SchemaMerger { for (this.currentKind in this.definitions) { const definition = this.definitions[this.currentKind] if (this.isInterface(this.currentKind) && definition.oneOf) { - definition.oneOf = definition.oneOf.sort((a: any, b: any) => (a.$ref || a.type).localeCompare(b.$ref || b.type)) + definition.oneOf = definition.oneOf.sort((a: any, b: any) => sortFunction(a.$ref ?? a.type, b.$ref ?? b.type)) } } } diff --git a/packages/dialog/src/library/schemaTracker.ts b/packages/dialog/src/library/schemaTracker.ts index 466ba52b2..abca8f5c4 100644 --- a/packages/dialog/src/library/schemaTracker.ts +++ b/packages/dialog/src/library/schemaTracker.ts @@ -5,20 +5,14 @@ import Ajv = require('ajv') import parser from '@apidevtools/json-schema-ref-parser' - -let getUri: any = require('get-uri') +import http from './getJSON' // Get JSON from a URI. async function getJSON(uri: string): Promise { if (uri.indexOf(':') < 2) { uri = `file:///${uri}` } - let stream = await getUri(uri) - let data = '' - for await (let chunk of stream) { - data += chunk.toString() - } - return JSON.parse(data) + return http(uri) } export class SchemaTracker { diff --git a/packages/dialog/test/commands/dialog/merge.test.ts b/packages/dialog/test/commands/dialog/merge.test.ts index a7c98af5b..5020dcbf3 100644 --- a/packages/dialog/test/commands/dialog/merge.test.ts +++ b/packages/dialog/test/commands/dialog/merge.test.ts @@ -148,7 +148,7 @@ describe('dialog:merge', async () => { console.log('Start missing component schema') const [merged, lines] = await merge(['schemas/badSchemas/missingComponent.schema'], 'app.schema') assert(!merged, 'Merge should have failed') - assert(countMatches(/file does not exist/i, lines) === 1, 'No missing component schema') + assert(countMatches(/status code 404/i, lines) === 1, 'No missing component schema') }) it('mismatched component schema', async () => { @@ -495,7 +495,7 @@ describe('dialog:merge', async () => { .persist() const [merged, lines] = await merge(['schemas/*.schema'], 'app.schema') assert(!merged, 'Merging should fail') - assert(countMatches(/internal server error/i, lines) === 1, 'Did not detect server error') + assert(countMatches(/status code 500/i, lines) === 1, 'Did not detect server error') scope.done() nock.cleanAll() }) diff --git a/packages/dialog/test/commands/dialog/npm/packageBase.json b/packages/dialog/test/commands/dialog/npm/packageBase.json new file mode 100644 index 000000000..f8e55f561 --- /dev/null +++ b/packages/dialog/test/commands/dialog/npm/packageBase.json @@ -0,0 +1,87 @@ +{ + "$schema": "https://schemas.botframework.com/schemas/component/v1.0/component.schema", + "$role": [], + "title": "Example schema for packages", + "description": "Example schema for packages.", + "properties": { + "Object": { + "type": "object", + "title": " object", + "description": "This is an object.", + "properties": { + "subObject": { + "type": "string", + "title": "SubObject", + "description": "SubObject property of Object." + } + } + }, + "SimpleArray": { + "type": "array", + "title": " Empty Array", + "description": "This is simple items array.", + "items": true + }, + "Array": { + "type": "array", + "title": " Array", + "description": "This is a complex item array.", + "items": { + "type": "object", + "title": "Array item", + "description": "This is an array item.", + "properties": { + "subArray": { + "type": "integer", + "title": "Integer item", + "description": "Integer item" + } + } + } + }, + "AnyOf": { + "title": " AnyOf", + "description": "This is an anyOf.", + "anyOf": [ + { + "type": "object", + "title": "AnyOf1", + "description": "This is anyOf1 object.", + "properties": { + "anyOf1": { + "type": "object", + "title": "AnyOf1 object", + "description": "This is anyOf1.", + "properties": { + "subAnyOf1": { + "type": "string", + "title": "SubAnyOf1", + "description": "SubAnyOf1 string" + } + } + } + } + }, + { + "type": "object", + "title": "AnyOf2", + "description": "This is anyOf2 object.", + "properties": { + "anyOf2": { + "type": "object", + "title": "AnyOf2 object", + "description": "This is anyOf2.", + "properties": { + "subAnyOf2": { + "type": "string", + "title": "SubAnyOf2", + "description": "SubAnyOf2 string" + } + } + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/packages/dialog/test/commands/dialog/oracles/app.schema b/packages/dialog/test/commands/dialog/oracles/app.schema index 96d665b03..62ae7ab80 100644 --- a/packages/dialog/test/commands/dialog/oracles/app.schema +++ b/packages/dialog/test/commands/dialog/oracles/app.schema @@ -4,96 +4,20 @@ "title": "Component kinds", "description": "These are all of the kinds that can be created by the loader.", "oneOf": [ - { - "$ref": "#/definitions/Recognizer" - }, { "$ref": "#/definitions/policyLevel2" }, { "$ref": "#/definitions/prompt" }, + { + "$ref": "#/definitions/Recognizer" + }, { "$ref": "#/definitions/root" } ], "definitions": { - "INothing": { - "title": "Microsoft Nothing", - "description": "Definition of a union type with no implementations.", - "$role": "interface" - }, - "IRecognizer": { - "$role": "interface", - "$comment": "Has multiple implementations", - "title": "Recognizer", - "description": "Recognizer interface.", - "oneOf": [ - { - "$ref": "#/definitions/Recognizer" - }, - { - "type": "string", - "title": "Reference to IRecognizer", - "description": "Reference to IRecognizer .dialog file." - } - ] - }, - "Recognizer": { - "$role": "implements(IRecognizer)", - "required": [ - "req", - "$kind" - ], - "definitions": { - "insideDef": { - "$role": "expression", - "title": "Inside", - "description": "Something inside." - } - }, - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^\\$": { - "title": "Tooling property", - "description": "Open ended property for tooling." - } - }, - "properties": { - "req": { - "$role": "expression", - "title": "Required", - "description": "Something required." - }, - "opt": { - "type": "string", - "title": "Optional", - "description": "Something optional." - }, - "complex": { - "title": "Complex", - "description": "Complex object.", - "properties": { - "inside": { - "$ref": "#/definitions/Recognizer/definitions/insideDef" - } - } - }, - "$kind": { - "title": "Kind of dialog object", - "description": "Defines the valid properties for the component you are configuring (from a dialog .schema file)", - "type": "string", - "pattern": "^[a-zA-Z][a-zA-Z0-9.]*$", - "const": "Recognizer" - }, - "$designer": { - "title": "Designer information", - "type": "object", - "description": "Extra information for the Bot Framework Composer." - } - } - }, "arrayExpression": { "$role": "expression", "title": "Array or expression", @@ -232,6 +156,11 @@ "user.age > 13" ] }, + "INothing": { + "title": "Microsoft Nothing", + "description": "Definition of a union type with no implementations.", + "$role": "interface" + }, "integerExpression": { "$role": "expression", "title": "Integer or expression", @@ -254,6 +183,22 @@ } ] }, + "IRecognizer": { + "$role": "interface", + "$comment": "Has multiple implementations", + "title": "Recognizer", + "description": "Recognizer interface.", + "oneOf": [ + { + "$ref": "#/definitions/Recognizer" + }, + { + "type": "string", + "title": "Reference to IRecognizer", + "description": "Reference to IRecognizer .dialog file." + } + ] + }, "numberExpression": { "$role": "expression", "title": "Number or expression", @@ -432,6 +377,61 @@ } } }, + "Recognizer": { + "$role": "implements(IRecognizer)", + "required": [ + "req", + "$kind" + ], + "definitions": { + "insideDef": { + "$role": "expression", + "title": "Inside", + "description": "Something inside." + } + }, + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^\\$": { + "title": "Tooling property", + "description": "Open ended property for tooling." + } + }, + "properties": { + "req": { + "$role": "expression", + "title": "Required", + "description": "Something required." + }, + "opt": { + "type": "string", + "title": "Optional", + "description": "Something optional." + }, + "complex": { + "title": "Complex", + "description": "Complex object.", + "properties": { + "inside": { + "$ref": "#/definitions/Recognizer/definitions/insideDef" + } + } + }, + "$kind": { + "title": "Kind of dialog object", + "description": "Defines the valid properties for the component you are configuring (from a dialog .schema file)", + "type": "string", + "pattern": "^[a-zA-Z][a-zA-Z0-9.]*$", + "const": "Recognizer" + }, + "$designer": { + "title": "Designer information", + "type": "object", + "description": "Extra information for the Bot Framework Composer." + } + } + }, "role": { "title": "$role", "description": "Defines the role played in the dialog schema from [expression|interface|implements($kind)|extends($kind)].", diff --git a/packages/dialog/test/commands/dialog/oracles/project3.schema b/packages/dialog/test/commands/dialog/oracles/project3.schema index 4b0a90e51..c544b54f1 100644 --- a/packages/dialog/test/commands/dialog/oracles/project3.schema +++ b/packages/dialog/test/commands/dialog/oracles/project3.schema @@ -33,6 +33,129 @@ } ], "definitions": { + "arrayExpression": { + "$role": "expression", + "title": "Array or expression", + "description": "Array or expression to evaluate.", + "oneOf": [ + { + "type": "array", + "title": "Array", + "description": "Array constant." + }, + { + "$ref": "#/definitions/equalsExpression" + } + ] + }, + "booleanExpression": { + "$role": "expression", + "title": "Boolean or expression", + "description": "Boolean constant or expression to evaluate.", + "oneOf": [ + { + "type": "boolean", + "title": "Boolean", + "description": "Boolean constant.", + "default": false, + "examples": [ + false + ] + }, + { + "$ref": "#/definitions/equalsExpression", + "examples": [ + "=user.isVip" + ] + } + ] + }, + "component": { + "required": [ + "$kind" + ], + "additionalProperties": false, + "patternProperties": { + "^\\$": { + "title": "Tooling property", + "description": "Open ended property for tooling." + } + }, + "properties": { + "$kind": { + "title": "Kind of dialog object", + "description": "Defines the valid properties for the component you are configuring (from a dialog .schema file)", + "type": "string", + "pattern": "^[a-zA-Z][a-zA-Z0-9.]*$" + }, + "$designer": { + "title": "Designer information", + "type": "object", + "description": "Extra information for the Bot Framework Composer." + } + } + }, + "condition": { + "$role": "expression", + "title": "Boolean condition", + "description": "Boolean constant or expression to evaluate.", + "oneOf": [ + { + "$ref": "#/definitions/expression" + }, + { + "type": "boolean", + "title": "Boolean", + "description": "Boolean value.", + "default": true, + "examples": [ + false + ] + } + ] + }, + "equalsExpression": { + "$role": "expression", + "type": "string", + "title": "Expression", + "description": "Expression starting with =.", + "pattern": "^=.*\\S.*", + "examples": [ + "=user.name" + ] + }, + "expression": { + "$role": "expression", + "type": "string", + "title": "Expression", + "description": "Expression to evaluate.", + "pattern": "^.*\\S.*", + "examples": [ + "user.age > 13" + ] + }, + "integerExpression": { + "$role": "expression", + "title": "Integer or expression", + "description": "Integer constant or expression to evaluate.", + "oneOf": [ + { + "type": "integer", + "title": "Integer", + "description": "Integer constant.", + "default": 0, + "examples": [ + 15 + ] + }, + { + "$ref": "#/definitions/equalsExpression", + "examples": [ + "=user.age" + ] + } + ] + }, "Microsoft.AdaptiveDialog": { "$role": "implements(Microsoft.IDialog)", "title": "Adaptive Dialog", @@ -750,129 +873,6 @@ } } }, - "arrayExpression": { - "$role": "expression", - "title": "Array or expression", - "description": "Array or expression to evaluate.", - "oneOf": [ - { - "type": "array", - "title": "Array", - "description": "Array constant." - }, - { - "$ref": "#/definitions/equalsExpression" - } - ] - }, - "booleanExpression": { - "$role": "expression", - "title": "Boolean or expression", - "description": "Boolean constant or expression to evaluate.", - "oneOf": [ - { - "type": "boolean", - "title": "Boolean", - "description": "Boolean constant.", - "default": false, - "examples": [ - false - ] - }, - { - "$ref": "#/definitions/equalsExpression", - "examples": [ - "=user.isVip" - ] - } - ] - }, - "component": { - "required": [ - "$kind" - ], - "additionalProperties": false, - "patternProperties": { - "^\\$": { - "title": "Tooling property", - "description": "Open ended property for tooling." - } - }, - "properties": { - "$kind": { - "title": "Kind of dialog object", - "description": "Defines the valid properties for the component you are configuring (from a dialog .schema file)", - "type": "string", - "pattern": "^[a-zA-Z][a-zA-Z0-9.]*$" - }, - "$designer": { - "title": "Designer information", - "type": "object", - "description": "Extra information for the Bot Framework Composer." - } - } - }, - "condition": { - "$role": "expression", - "title": "Boolean condition", - "description": "Boolean constant or expression to evaluate.", - "oneOf": [ - { - "$ref": "#/definitions/expression" - }, - { - "type": "boolean", - "title": "Boolean", - "description": "Boolean value.", - "default": true, - "examples": [ - false - ] - } - ] - }, - "equalsExpression": { - "$role": "expression", - "type": "string", - "title": "Expression", - "description": "Expression starting with =.", - "pattern": "^=.*\\S.*", - "examples": [ - "=user.name" - ] - }, - "expression": { - "$role": "expression", - "type": "string", - "title": "Expression", - "description": "Expression to evaluate.", - "pattern": "^.*\\S.*", - "examples": [ - "user.age > 13" - ] - }, - "integerExpression": { - "$role": "expression", - "title": "Integer or expression", - "description": "Integer constant or expression to evaluate.", - "oneOf": [ - { - "type": "integer", - "title": "Integer", - "description": "Integer constant.", - "default": 0, - "examples": [ - 15 - ] - }, - { - "$ref": "#/definitions/equalsExpression", - "examples": [ - "=user.age" - ] - } - ] - }, "nuget3.component1": { "$role": [], "title": "Nuget3 schema", diff --git a/packages/dialog/test/commands/dialog/oracles/project5.schema b/packages/dialog/test/commands/dialog/oracles/project5.schema index 4b0a90e51..c544b54f1 100644 --- a/packages/dialog/test/commands/dialog/oracles/project5.schema +++ b/packages/dialog/test/commands/dialog/oracles/project5.schema @@ -33,6 +33,129 @@ } ], "definitions": { + "arrayExpression": { + "$role": "expression", + "title": "Array or expression", + "description": "Array or expression to evaluate.", + "oneOf": [ + { + "type": "array", + "title": "Array", + "description": "Array constant." + }, + { + "$ref": "#/definitions/equalsExpression" + } + ] + }, + "booleanExpression": { + "$role": "expression", + "title": "Boolean or expression", + "description": "Boolean constant or expression to evaluate.", + "oneOf": [ + { + "type": "boolean", + "title": "Boolean", + "description": "Boolean constant.", + "default": false, + "examples": [ + false + ] + }, + { + "$ref": "#/definitions/equalsExpression", + "examples": [ + "=user.isVip" + ] + } + ] + }, + "component": { + "required": [ + "$kind" + ], + "additionalProperties": false, + "patternProperties": { + "^\\$": { + "title": "Tooling property", + "description": "Open ended property for tooling." + } + }, + "properties": { + "$kind": { + "title": "Kind of dialog object", + "description": "Defines the valid properties for the component you are configuring (from a dialog .schema file)", + "type": "string", + "pattern": "^[a-zA-Z][a-zA-Z0-9.]*$" + }, + "$designer": { + "title": "Designer information", + "type": "object", + "description": "Extra information for the Bot Framework Composer." + } + } + }, + "condition": { + "$role": "expression", + "title": "Boolean condition", + "description": "Boolean constant or expression to evaluate.", + "oneOf": [ + { + "$ref": "#/definitions/expression" + }, + { + "type": "boolean", + "title": "Boolean", + "description": "Boolean value.", + "default": true, + "examples": [ + false + ] + } + ] + }, + "equalsExpression": { + "$role": "expression", + "type": "string", + "title": "Expression", + "description": "Expression starting with =.", + "pattern": "^=.*\\S.*", + "examples": [ + "=user.name" + ] + }, + "expression": { + "$role": "expression", + "type": "string", + "title": "Expression", + "description": "Expression to evaluate.", + "pattern": "^.*\\S.*", + "examples": [ + "user.age > 13" + ] + }, + "integerExpression": { + "$role": "expression", + "title": "Integer or expression", + "description": "Integer constant or expression to evaluate.", + "oneOf": [ + { + "type": "integer", + "title": "Integer", + "description": "Integer constant.", + "default": 0, + "examples": [ + 15 + ] + }, + { + "$ref": "#/definitions/equalsExpression", + "examples": [ + "=user.age" + ] + } + ] + }, "Microsoft.AdaptiveDialog": { "$role": "implements(Microsoft.IDialog)", "title": "Adaptive Dialog", @@ -750,129 +873,6 @@ } } }, - "arrayExpression": { - "$role": "expression", - "title": "Array or expression", - "description": "Array or expression to evaluate.", - "oneOf": [ - { - "type": "array", - "title": "Array", - "description": "Array constant." - }, - { - "$ref": "#/definitions/equalsExpression" - } - ] - }, - "booleanExpression": { - "$role": "expression", - "title": "Boolean or expression", - "description": "Boolean constant or expression to evaluate.", - "oneOf": [ - { - "type": "boolean", - "title": "Boolean", - "description": "Boolean constant.", - "default": false, - "examples": [ - false - ] - }, - { - "$ref": "#/definitions/equalsExpression", - "examples": [ - "=user.isVip" - ] - } - ] - }, - "component": { - "required": [ - "$kind" - ], - "additionalProperties": false, - "patternProperties": { - "^\\$": { - "title": "Tooling property", - "description": "Open ended property for tooling." - } - }, - "properties": { - "$kind": { - "title": "Kind of dialog object", - "description": "Defines the valid properties for the component you are configuring (from a dialog .schema file)", - "type": "string", - "pattern": "^[a-zA-Z][a-zA-Z0-9.]*$" - }, - "$designer": { - "title": "Designer information", - "type": "object", - "description": "Extra information for the Bot Framework Composer." - } - } - }, - "condition": { - "$role": "expression", - "title": "Boolean condition", - "description": "Boolean constant or expression to evaluate.", - "oneOf": [ - { - "$ref": "#/definitions/expression" - }, - { - "type": "boolean", - "title": "Boolean", - "description": "Boolean value.", - "default": true, - "examples": [ - false - ] - } - ] - }, - "equalsExpression": { - "$role": "expression", - "type": "string", - "title": "Expression", - "description": "Expression starting with =.", - "pattern": "^=.*\\S.*", - "examples": [ - "=user.name" - ] - }, - "expression": { - "$role": "expression", - "type": "string", - "title": "Expression", - "description": "Expression to evaluate.", - "pattern": "^.*\\S.*", - "examples": [ - "user.age > 13" - ] - }, - "integerExpression": { - "$role": "expression", - "title": "Integer or expression", - "description": "Integer constant or expression to evaluate.", - "oneOf": [ - { - "type": "integer", - "title": "Integer", - "description": "Integer constant.", - "default": 0, - "examples": [ - 15 - ] - }, - { - "$ref": "#/definitions/equalsExpression", - "examples": [ - "=user.age" - ] - } - ] - }, "nuget3.component1": { "$role": [], "title": "Nuget3 schema", diff --git a/packages/lu/package.json b/packages/lu/package.json index a6259fc09..40d25e0c9 100644 --- a/packages/lu/package.json +++ b/packages/lu/package.json @@ -36,7 +36,7 @@ "@types/node-fetch": "~2.5.5", "antlr4": "~4.8.0", "axios": "~0.21.1", - "axios-https-proxy": "^0.1.1", + "https-proxy-agent": "^5.0.0", "chalk": "2.4.1", "console-stream": "^0.1.1", "deep-equal": "^1.0.1", diff --git a/packages/lu/src/parser/lubuild/http-request.ts b/packages/lu/src/parser/lubuild/http-request.ts index f87ef9f05..5f5410960 100644 --- a/packages/lu/src/parser/lubuild/http-request.ts +++ b/packages/lu/src/parser/lubuild/http-request.ts @@ -4,8 +4,9 @@ */ const axios = require('axios') -const axiosHttpsProxy = require('axios-https-proxy') -axios.interceptors.request.use(axiosHttpsProxy) +const httpsProxy = require('../utils/httpsProxy') + +axios.interceptors.request.use(httpsProxy) export default { async get( diff --git a/packages/lu/src/parser/qnabuild/serviceBase.js b/packages/lu/src/parser/qnabuild/serviceBase.js index cd0f3abb2..cc6bed18c 100644 --- a/packages/lu/src/parser/qnabuild/serviceBase.js +++ b/packages/lu/src/parser/qnabuild/serviceBase.js @@ -4,10 +4,12 @@ */ const axios = require('axios') -const axiosHttpsProxy = require('axios-https-proxy') +const httpsProxy = require('../utils/httpsProxy') const os = require('os') const packageJSON = require('./../../../package') -axios.interceptors.request.use(axiosHttpsProxy) + +axios.interceptors.request.use(httpsProxy) + /** * Base class for all services diff --git a/packages/lu/src/parser/utils/httpsProxy.js b/packages/lu/src/parser/utils/httpsProxy.js new file mode 100644 index 000000000..13009a7c8 --- /dev/null +++ b/packages/lu/src/parser/utils/httpsProxy.js @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +const url = require('url') +const httpsProxyAgent = require('https-proxy-agent') + +const httpsProxy = function(config) { + const parsed = url.parse(config.url) + const protocol = parsed.protocol + if (protocol !== 'https:') { + return config + } + + const envProxy = process.env['HTTPS_PROXY'] || process.env['https_proxy'] + if (envProxy) { + const parsed = url.parse(envProxy) + const proxyOpt = { + hostname: parsed.hostname, + port: parsed.port + } + + if (parsed.auth) { + proxyOpt.auth = parsed.auth + } + + config.httpsAgent = httpsProxyAgent(proxyOpt) + //Disable direct proxy + config.proxy = false + } + + return config +} + +module.exports = httpsProxy; \ No newline at end of file From 0892ca6c3f823d8e615ce20c719c936e5e29b8b3 Mon Sep 17 00:00:00 2001 From: Tien Suwandy Date: Thu, 15 Apr 2021 10:40:23 -0700 Subject: [PATCH 2/3] Update orchestrator-core reference to 4.13.0 + fix for orchestrator:add (#1197) * Update package.json * Update datasourcehelper.ts * Update add.ts * Update pnpm-lock.yaml --- common/config/rush/pnpm-lock.yaml | 414 +++++++++++++----- .../src/commands/orchestrator/add.ts | 5 +- packages/orchestratorlib/package.json | 4 +- .../orchestratorlib/src/datasourcehelper.ts | 9 +- 4 files changed, 305 insertions(+), 127 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 2835b7c6f..5cb7987fd 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -31,7 +31,6 @@ dependencies: applicationinsights: 1.7.3 argparse: 1.0.10 axios: 0.21.1 - axios-https-proxy: 0.1.1_axios@0.21.1 botbuilder-lg: 4.12.0 botframework-schema: 4.7.2 camelcase: 4.1.0 @@ -58,7 +57,7 @@ dependencies: mime-types: 2.1.26 minimist: 1.2.0 nyc: 14.1.1 - orchestrator-core: 4.13.0-rc0 + orchestrator-core: 4.13.0 os: 0.1.1 pascal-case: 2.0.1 path: 0.12.7 @@ -304,6 +303,21 @@ packages: dev: false resolution: integrity: sha512-qS/a24RA5FEoiJS9wiv6Pwg2c/kiUo3IVUQcfeM9JvsR6pM8Yx+yl/6xWYLckZCT5jpLNhslgjiA8p/XcGyMRQ== + /@mapbox/node-pre-gyp/1.0.3: + dependencies: + detect-libc: 1.0.3 + https-proxy-agent: 5.0.0 + make-dir: 3.1.0 + node-fetch: 2.6.1 + nopt: 5.0.0 + npmlog: 4.1.2 + rimraf: 3.0.2 + semver: 7.3.5 + tar: 6.1.0 + dev: false + hasBin: true + resolution: + integrity: sha512-9dTIfQW8HVCxLku5QrJ/ysS/b2MdYngs9+/oPrOTLvp3TrggdANYVW2h8FGJGDf0J7MYfp44W+c90cVJx+ASuA== /@microsoft/recognizers-text-data-types-timex-expression/1.1.4: dev: false engines: @@ -355,6 +369,15 @@ packages: node: '>= 8' resolution: integrity: sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ== + /@npmcli/move-file/1.1.2: + dependencies: + mkdirp: 1.0.4 + rimraf: 3.0.2 + dev: false + engines: + node: '>=10' + resolution: + integrity: sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg== /@oclif/color/0.0.0: dependencies: ansi-styles: 3.2.1 @@ -1015,6 +1038,25 @@ packages: node: '>= 6.0.0' resolution: integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + /agentkeepalive/4.1.4: + dependencies: + debug: 4.1.1 + depd: 1.1.2 + humanize-ms: 1.2.1 + dev: false + engines: + node: '>= 8.0.0' + resolution: + integrity: sha512-+V/rGa3EuU74H6wR04plBb7Ks10FbtUQgRj/FQOG7uUIEuaINI+AiqJR1k6t3SVNs7o7ZjIdus6706qqzVq8jQ== + /aggregate-error/3.1.0: + dependencies: + clean-stack: 2.2.0 + indent-string: 4.0.0 + dev: false + engines: + node: '>=8' + resolution: + integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA== /ajv/6.12.0: dependencies: fast-deep-equal: 3.1.1 @@ -1435,6 +1477,30 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= + /cacache/15.0.6: + dependencies: + '@npmcli/move-file': 1.1.2 + chownr: 2.0.0 + fs-minipass: 2.1.0 + glob: 7.1.6 + infer-owner: 1.0.4 + lru-cache: 6.0.0 + minipass: 3.1.3 + minipass-collect: 1.0.2 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + mkdirp: 1.0.4 + p-map: 4.0.0 + promise-inflight: 1.0.1 + rimraf: 3.0.2 + ssri: 8.0.1 + tar: 6.1.0 + unique-filename: 1.1.1 + dev: false + engines: + node: '>= 10' + resolution: + integrity: sha512-g1WYDMct/jzW+JdWEyjaX2zoBkZ6ZT9VpOyp2I/VMtDsNLffNat3kqPFfi1eDRSK9/SuKGyORDHcQMcPF8sQ/w== /cache-base/1.0.1: dependencies: collection-visit: 1.0.0 @@ -2103,6 +2169,12 @@ packages: dev: false resolution: integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + /depd/1.1.2: + dev: false + engines: + node: '>= 0.6' + resolution: + integrity: sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= /detect-indent/6.0.0: dev: false engines: @@ -2201,6 +2273,13 @@ packages: dev: false resolution: integrity: sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + /encoding/0.1.13: + dependencies: + iconv-lite: 0.6.2 + dev: false + optional: true + resolution: + integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== /end-of-stream/1.4.4: dependencies: once: 1.4.0 @@ -2213,6 +2292,10 @@ packages: node: '>=6' resolution: integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== + /err-code/2.0.3: + dev: false + resolution: + integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA== /error-ex/1.3.2: dependencies: is-arrayish: 0.2.1 @@ -2953,12 +3036,6 @@ packages: node: '>=10' resolution: integrity: sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ== - /fs-minipass/1.2.7: - dependencies: - minipass: 2.9.0 - dev: false - resolution: - integrity: sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== /fs-minipass/2.1.0: dependencies: minipass: 3.1.3 @@ -3228,6 +3305,10 @@ packages: dev: false resolution: integrity: sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== + /graceful-fs/4.2.6: + dev: false + resolution: + integrity: sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== /growl/1.10.5: dev: false engines: @@ -3377,6 +3458,16 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-ahwimsC23ICE4kPl9xTBjKB4inbRaeLyZeRunC/1Jy/Z6X8tv22MEAjK+KBOMSVLaqXPTTmd8638waVIKLGx2w== + /http-proxy-agent/4.0.1: + dependencies: + '@tootallnate/once': 1.0.0 + agent-base: 6.0.2 + debug: 4.1.1 + dev: false + engines: + node: '>= 6' + resolution: + integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg== /http-signature/1.2.0: dependencies: assert-plus: 1.0.0 @@ -3406,6 +3497,12 @@ packages: node: '>= 6' resolution: integrity: sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== + /humanize-ms/1.2.1: + dependencies: + ms: 2.1.2 + dev: false + resolution: + integrity: sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0= /hyperlinker/1.0.0: dev: false engines: @@ -3420,12 +3517,15 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - /ignore-walk/3.0.3: + /iconv-lite/0.6.2: dependencies: - minimatch: 3.0.4 + safer-buffer: 2.1.2 dev: false + engines: + node: '>=0.10.0' + optional: true resolution: - integrity: sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== + integrity: sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ== /ignore/3.3.10: dev: false resolution: @@ -3475,6 +3575,10 @@ packages: node: '>=8' resolution: integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== + /infer-owner/1.0.4: + dev: false + resolution: + integrity: sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== /inflight/1.0.6: dependencies: once: 1.4.0 @@ -3543,6 +3647,10 @@ packages: node: '>=4' resolution: integrity: sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= + /ip/1.1.5: + dev: false + resolution: + integrity: sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= /is-accessor-descriptor/0.1.6: dependencies: kind-of: 3.2.2 @@ -3684,6 +3792,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + /is-lambda/1.0.1: + dev: false + resolution: + integrity: sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU= /is-node/0.0.0: dev: false resolution: @@ -4288,10 +4400,40 @@ packages: node: '>=8' resolution: integrity: sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w== + /make-dir/3.1.0: + dependencies: + semver: 6.3.0 + dev: false + engines: + node: '>=8' + resolution: + integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== /make-error/1.3.6: dev: false resolution: integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + /make-fetch-happen/8.0.14: + dependencies: + agentkeepalive: 4.1.4 + cacache: 15.0.6 + http-cache-semantics: 4.1.0 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.0 + is-lambda: 1.0.1 + lru-cache: 6.0.0 + minipass: 3.1.3 + minipass-collect: 1.0.2 + minipass-fetch: 1.3.3 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + promise-retry: 2.0.1 + socks-proxy-agent: 5.0.0 + ssri: 8.0.1 + dev: false + engines: + node: '>= 10' + resolution: + integrity: sha512-EsS89h6l4vbfJEtBZnENTOFk8mCRpY5ru36Xe5bcX1KYIli2mkSHqoFsp5O1wMDvTJJzxe/4THpCTtygjeeGWQ== /map-age-cleaner/0.1.3: dependencies: p-defer: 1.0.0 @@ -4423,31 +4565,58 @@ packages: dev: false resolution: integrity: sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= - /minimist/1.2.5: + /minipass-collect/1.0.2: + dependencies: + minipass: 3.1.3 dev: false + engines: + node: '>= 8' resolution: - integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - /minipass/2.9.0: + integrity: sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA== + /minipass-fetch/1.3.3: dependencies: - safe-buffer: 5.2.0 - yallist: 3.1.1 + minipass: 3.1.3 + minipass-sized: 1.0.3 + minizlib: 2.1.2 dev: false + engines: + node: '>=8' + optionalDependencies: + encoding: 0.1.13 resolution: - integrity: sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - /minipass/3.1.3: + integrity: sha512-akCrLDWfbdAWkMLBxJEeWTdNsjML+dt5YgOI4gJ53vuO0vrmYQkUPxa6j6V65s9CcePIr2SSWqjT2EcrNseryQ== + /minipass-flush/1.0.5: dependencies: - yallist: 4.0.0 + minipass: 3.1.3 + dev: false + engines: + node: '>= 8' + resolution: + integrity: sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw== + /minipass-pipeline/1.2.4: + dependencies: + minipass: 3.1.3 dev: false engines: node: '>=8' resolution: - integrity: sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg== - /minizlib/1.3.3: + integrity: sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A== + /minipass-sized/1.0.3: dependencies: - minipass: 2.9.0 + minipass: 3.1.3 dev: false + engines: + node: '>=8' resolution: - integrity: sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== + integrity: sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g== + /minipass/3.1.3: + dependencies: + yallist: 4.0.0 + dev: false + engines: + node: '>=8' + resolution: + integrity: sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg== /minizlib/2.1.2: dependencies: minipass: 3.1.3 @@ -4474,13 +4643,6 @@ packages: hasBin: true resolution: integrity: sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= - /mkdirp/0.5.5: - dependencies: - minimist: 1.2.5 - dev: false - hasBin: true - resolution: - integrity: sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== /mkdirp/1.0.4: dev: false engines: @@ -4598,17 +4760,6 @@ packages: dev: false resolution: integrity: sha512-p7KTHxU0CUrcOXe62Zfrb5Z13nLvPhSWR/so3kFulUQU0sgUll2Z0LwpsLN351eOOD+hRGu/F1g+6xDfPeD++Q== - /needle/2.6.0: - dependencies: - debug: 3.2.6 - iconv-lite: 0.4.24 - sax: 1.2.4 - dev: false - engines: - node: '>= 4.4.x' - hasBin: true - resolution: - integrity: sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg== /nested-error-stacks/2.1.0: dev: false resolution: @@ -4683,16 +4834,22 @@ packages: node: 4.x || >=6.0.0 resolution: integrity: sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== - /node-gyp/7.1.2: + /node-fetch/2.6.1: + dev: false + engines: + node: 4.x || >=6.0.0 + resolution: + integrity: sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + /node-gyp/8.0.0: dependencies: env-paths: 2.2.1 glob: 7.1.6 - graceful-fs: 4.2.3 + graceful-fs: 4.2.6 + make-fetch-happen: 8.0.14 nopt: 5.0.0 npmlog: 4.1.2 - request: 2.88.2 rimraf: 3.0.2 - semver: 7.3.4 + semver: 7.3.5 tar: 6.1.0 which: 2.0.2 dev: false @@ -4700,32 +4857,7 @@ packages: node: '>= 10.12.0' hasBin: true resolution: - integrity: sha512-CbpcIo7C3eMu3dL1c3d0xw449fHIGALIJsRP4DDPHpyiW8vcriNY7ubh9TE4zEKfSxscY7PjeFnshE7h75ynjQ== - /node-pre-gyp/0.15.0: - dependencies: - detect-libc: 1.0.3 - mkdirp: 0.5.5 - needle: 2.6.0 - nopt: 4.0.3 - npm-packlist: 1.4.8 - npmlog: 4.1.2 - rc: 1.2.8 - rimraf: 2.7.1 - semver: 5.7.1 - tar: 4.4.13 - deprecated: 'Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future' - dev: false - hasBin: true - resolution: - integrity: sha512-7QcZa8/fpaU/BKenjcaeFF9hLz2+7S9AqyXFhlH/rilsQ/hPZKK32RtR5EQHJElgu+q5RfbJ34KriI79UWaorA== - /nopt/4.0.3: - dependencies: - abbrev: 1.1.1 - osenv: 0.1.5 - dev: false - hasBin: true - resolution: - integrity: sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg== + integrity: sha512-Jod6NxyWtcwrpAQe0O/aXOpC5QfncotgtG73dg65z6VW/C6g/G4jiajXQUBIJ8pk/VfM6mBYE9BN/HvudTunUQ== /nopt/5.0.0: dependencies: abbrev: 1.1.1 @@ -4760,30 +4892,12 @@ packages: node: '>=8' resolution: integrity: sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ== - /npm-bundled/1.1.1: - dependencies: - npm-normalize-package-bin: 1.0.1 - dev: false - resolution: - integrity: sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== - /npm-normalize-package-bin/1.0.1: - dev: false - resolution: - integrity: sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== /npm-package-walker/4.0.5: dev: false engines: node: '>=12.9.0' resolution: integrity: sha512-/sBZcS/uyGlXu0Cq+fpO5ueQRdV/aKWONtXN2YDVhCqDG/A2o3KCIAI9Qa2uzoLZWIZGnYOCxivfmVt0Ou8P4Q== - /npm-packlist/1.4.8: - dependencies: - ignore-walk: 3.0.3 - npm-bundled: 1.1.1 - npm-normalize-package-bin: 1.0.1 - dev: false - resolution: - integrity: sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A== /npm-run-path/2.0.2: dependencies: path-key: 2.0.1 @@ -4947,15 +5061,15 @@ packages: node: '>= 0.8.0' resolution: integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== - /orchestrator-core/4.13.0-rc0: + /orchestrator-core/4.13.0: cpu: - x64 - ia32 dependencies: + '@mapbox/node-pre-gyp': 1.0.3 bindings: 1.2.1 node-addon-api: 3.1.0 - node-gyp: 7.1.2 - node-pre-gyp: 0.15.0 + node-gyp: 8.0.0 dev: false engines: node: ^10.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 @@ -4965,7 +5079,7 @@ packages: - win32 requiresBuild: true resolution: - integrity: sha512-0YbzNF8OQ8r0CSRDvcezRK8V6dFOh8jdVkfC+3JM+k7rotLrSMf0EI+UTGJUnSv9tI4roIfo5IM4AHT+KJ8l2A== + integrity: sha512-MJj/Fa0dExB3VldmiASnRoFvbM9OV4SwkI5qTNzv6HukhnaYPyrWidxAkufOJeavka66cpM4M8Cft+Fscc3auQ== /os-homedir/1.0.2: dev: false engines: @@ -4982,13 +5096,6 @@ packages: dev: false resolution: integrity: sha1-IIhF6J4ZOtTZcUdLk5R3NqVtE/M= - /osenv/0.1.5: - dependencies: - os-homedir: 1.0.2 - os-tmpdir: 1.0.2 - dev: false - resolution: - integrity: sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== /p-cancelable/0.4.1: dev: false engines: @@ -5049,6 +5156,14 @@ packages: node: '>=8' resolution: integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + /p-map/4.0.0: + dependencies: + aggregate-error: 3.1.0 + dev: false + engines: + node: '>=10' + resolution: + integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ== /p-timeout/2.0.1: dependencies: p-finally: 1.0.0 @@ -5303,6 +5418,19 @@ packages: node: '>=0.4.0' resolution: integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + /promise-inflight/1.0.1: + dev: false + resolution: + integrity: sha1-mEcocL8igTL8vdhoEputEsPAKeM= + /promise-retry/2.0.1: + dependencies: + err-code: 2.0.3 + retry: 0.12.0 + dev: false + engines: + node: '>=10' + resolution: + integrity: sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g== /propagate/2.0.1: dev: false engines: @@ -5663,6 +5791,12 @@ packages: node: '>=0.12' resolution: integrity: sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== + /retry/0.12.0: + dev: false + engines: + node: '>= 4' + resolution: + integrity: sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= /reusify/1.0.4: dev: false engines: @@ -5760,6 +5894,15 @@ packages: hasBin: true resolution: integrity: sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + /semver/7.3.5: + dependencies: + lru-cache: 6.0.0 + dev: false + engines: + node: '>=10' + hasBin: true + resolution: + integrity: sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== /set-blocking/2.0.0: dev: false resolution: @@ -5842,6 +5985,13 @@ packages: node: '>=6' resolution: integrity: sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + /smart-buffer/4.1.0: + dev: false + engines: + node: '>= 6.0.0' + npm: '>= 3.0.0' + resolution: + integrity: sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw== /snapdragon-node/2.1.1: dependencies: define-property: 1.0.0 @@ -5875,6 +6025,26 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== + /socks-proxy-agent/5.0.0: + dependencies: + agent-base: 6.0.2 + debug: 4.1.1 + socks: 2.6.0 + dev: false + engines: + node: '>= 6' + resolution: + integrity: sha512-lEpa1zsWCChxiynk+lCycKuC502RxDWLKJZoIhnxrWNjLSDGYRFflHA1/228VkRcnv9TIb8w98derGbpKxJRgA== + /socks/2.6.0: + dependencies: + ip: 1.1.5 + smart-buffer: 4.1.0 + dev: false + engines: + node: '>= 10.13.0' + npm: '>= 3.0.0' + resolution: + integrity: sha512-mNmr9owlinMplev0Wd7UHFlqI4ofnBnNzFuzrm63PPaHgbkqCFe4T5LzwKmtQ/f2tX0NTpcdVLyD/FHxFBstYw== /sort-keys/2.0.0: dependencies: is-plain-obj: 1.1.0 @@ -5993,6 +6163,14 @@ packages: hasBin: true resolution: integrity: sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + /ssri/8.0.1: + dependencies: + minipass: 3.1.3 + dev: false + engines: + node: '>= 8' + resolution: + integrity: sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ== /stack-chain/1.3.7: dev: false resolution: @@ -6234,20 +6412,6 @@ packages: dev: false resolution: integrity: sha512-GZjLk64XcE/58qwIc1ZfXGqTSE4OutPMEkfBE/oh9eJ4x1eMRjYkgrLrav7PzddpvIpSJSGi8FgNNYXdB9Vumg== - /tar/4.4.13: - dependencies: - chownr: 1.1.4 - fs-minipass: 1.2.7 - minipass: 2.9.0 - minizlib: 1.3.3 - mkdirp: 0.5.5 - safe-buffer: 5.2.0 - yallist: 3.1.1 - dev: false - engines: - node: '>=4.5' - resolution: - integrity: sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== /tar/6.1.0: dependencies: chownr: 2.0.0 @@ -6760,6 +6924,18 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== + /unique-filename/1.1.1: + dependencies: + unique-slug: 2.0.2 + dev: false + resolution: + integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ== + /unique-slug/2.0.2: + dependencies: + imurmurhash: 0.1.4 + dev: false + resolution: + integrity: sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w== /universalify/0.1.2: dev: false engines: @@ -7437,6 +7613,7 @@ packages: fs-extra: 8.1.0 get-stdin: 6.0.0 globby: 10.0.2 + https-proxy-agent: 5.0.0 intercept-stdout: 0.1.2 lodash: 4.17.19 mocha: 6.2.2 @@ -7453,7 +7630,7 @@ packages: dev: false name: '@rush-temp/bf-lu' resolution: - integrity: sha512-YEzrI4a1MkTCI9DAKeOSjWkcY7ZZGwxramK3Ui5r93OZKknL+Bo7V3Y1NZoVl4B5IxdWobd3eurR2707dFD83w== + integrity: sha512-XVYKIQ+EI+NqqYS/E+7Mirp90rcefvp2IcB0DuSaVn3j8TUf3Mn0NT7O+tMkc6PnCDaxi99FfDGKAxcbzg7Nnw== tarball: 'file:projects/bf-lu.tgz' version: 0.0.0 'file:projects/bf-luis-cli.tgz': @@ -7549,7 +7726,7 @@ packages: nock: 11.9.1 node-fetch: 2.6.0 nyc: 14.1.1 - orchestrator-core: 4.13.0-rc0 + orchestrator-core: 4.13.0 read-text-file: 1.1.0 rimraf: 2.7.1 sinon: 9.2.4 @@ -7560,7 +7737,7 @@ packages: dev: false name: '@rush-temp/bf-orchestrator' resolution: - integrity: sha512-RuEMKNVk/o3ADR0rMPhJ3PHMYQAG+51GLBBfVlbCyy6OuW0x6ha9IoGPwMtaWVvtvs7mZrZUP4ZkSHvdzU5DfA== + integrity: sha512-smS6zhClWO/kUDa0NhMK9Wcag3RhCkFSCuWfIjurLa50/+2T4w7DOxnzxty6tTNzt4ylQkNPsSCaFQuA0m8B+A== tarball: 'file:projects/bf-orchestrator.tgz' version: 0.0.0 'file:projects/bf-qnamaker.tgz': @@ -7684,7 +7861,6 @@ specifiers: applicationinsights: ^1.0.8 argparse: ~1.0.10 axios: ~0.21.1 - axios-https-proxy: ^0.1.1 botbuilder-lg: 4.12.0 botframework-schema: ^4.5.1 camelcase: ^4.1.0 @@ -7711,7 +7887,7 @@ specifiers: mime-types: ^2.1.18 minimist: ^1.2.0 nyc: ^14.1.1 - orchestrator-core: rc + orchestrator-core: 4.13.0 os: ~0.1.1 pascal-case: ^2.0.1 path: ^0.12.7 diff --git a/packages/orchestrator/src/commands/orchestrator/add.ts b/packages/orchestrator/src/commands/orchestrator/add.ts index 841b66ffe..8af98e437 100644 --- a/packages/orchestrator/src/commands/orchestrator/add.ts +++ b/packages/orchestrator/src/commands/orchestrator/add.ts @@ -5,7 +5,7 @@ import * as path from 'path'; import {Command, CLIError, flags} from '@microsoft/bf-cli-command'; -import {DataSourceHelper, Orchestrator, OrchestratorDataSource, OrchestratorHelper, OrchestratorSettings} from '@microsoft/bf-orchestrator'; +import {DataSourceHelper, Orchestrator, OrchestratorDataSource, OrchestratorHelper, OrchestratorSettings, Utility} from '@microsoft/bf-orchestrator'; export default class OrchestratorAdd extends Command { static description: string = 'Add examples from .lu/.qna/.json/.blu files, LUIS app(s) and QnaMaker kb(s) to Orchestrator snapshot file.'; @@ -58,6 +58,9 @@ export default class OrchestratorAdd extends Command { } if (type.length > 0) { + if (type === 'luis' && Utility.isEmptyString(endpoint)) { + throw new CLIError('LUIS endpoint required, ie --endpoint https://westus.api.cognitive.microsoft.com'); + } OrchestratorSettings.init(cwd, baseModelPath, entityBaseModelPath, output, true); const dataSource: OrchestratorDataSource = new OrchestratorDataSource(id, key, version, endpoint, type, routingName, OrchestratorSettings.DataSources.path); await DataSourceHelper.ensureDataSourceAsync(dataSource, OrchestratorSettings.DataSources.path); diff --git a/packages/orchestratorlib/package.json b/packages/orchestratorlib/package.json index cdea0cf88..c22bc92c8 100644 --- a/packages/orchestratorlib/package.json +++ b/packages/orchestratorlib/package.json @@ -40,7 +40,7 @@ "@types/node-fetch": "~2.5.5", "node-fetch": "~2.6.0", "tslib": "^2.0.3", - "orchestrator-core": "rc", + "orchestrator-core": "4.13.0", "@types/fs-extra": "~8.1.0", "fs-extra": "~9.0.0", "read-text-file": "~1.1.0", @@ -62,4 +62,4 @@ "typescript": "^4.0.3", "sinon": "^9.0.2" } -} \ No newline at end of file +} diff --git a/packages/orchestratorlib/src/datasourcehelper.ts b/packages/orchestratorlib/src/datasourcehelper.ts index f693a5df4..4194c5bed 100644 --- a/packages/orchestratorlib/src/datasourcehelper.ts +++ b/packages/orchestratorlib/src/datasourcehelper.ts @@ -117,8 +117,9 @@ export class DataSourceHelper { filePath = path.dirname(filePath); } - if (!filePath.endsWith('datasources')) { - filePath = path.join(filePath, 'datasources'); + if (!filePath.toLowerCase().endsWith('datasources')) { + filePath = path.join(filePath, 'dataSources'); + fs.mkdirSync(filePath, {recursive: true}); } if (input.Type === 'luis') { @@ -127,9 +128,7 @@ export class DataSourceHelper { } input.FilePath = path.join(filePath, input.RoutingName + '.lu'); } else if (input.Type === 'qna') { - if (Utility.isEmptyString(input.RoutingName)) { - input.RoutingName = `q_${input.Id}`; - } + input.RoutingName = Utility.isEmptyString(input.RoutingName) ? `q_${input.Id}` : `q_${input.RoutingName}`; input.FilePath = path.join(filePath, input.RoutingName + '.qna'); } else { throw new Error(`Invalid content for type ${input.Type}`); From 0b055d9d184a2cad7ca7893e9475f4a4e73bf66d Mon Sep 17 00:00:00 2001 From: Emilio Munoz Date: Thu, 15 Apr 2021 13:00:54 -0700 Subject: [PATCH 3/3] Update botbuilder-lg to 4.13.0 (#1198) --- packages/lg/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lg/package.json b/packages/lg/package.json index 6a2174e29..7f6af8781 100644 --- a/packages/lg/package.json +++ b/packages/lg/package.json @@ -10,7 +10,7 @@ "@microsoft/bf-cli-command": "1.0.0", "@oclif/command": "^1.5.19", "@oclif/config": "^1.14.0", - "botbuilder-lg":"4.12.0", + "botbuilder-lg":"4.13.0", "delay": "^4.3.0", "fs-extra": "^8.1.0", "lodash": "^4.17.15",