diff --git a/build/yaml/botbuilder-js-ci.yml b/build/yaml/botbuilder-js-ci.yml new file mode 100644 index 0000000000..78195c178e --- /dev/null +++ b/build/yaml/botbuilder-js-ci.yml @@ -0,0 +1,50 @@ +# +# This runs under botbuilder-js-ci.yml. Runs unit tests on Node versions 10 and 12. +# + +# "name" here defines the build number format. Build number is accessed via $(Build.BuildNumber) +name: $(Build.BuildId) + +pool: + vmImage: 'macOS-10.15' + +variables: + PackageVersion: 4.8.0-preview.$(Build.BuildNumber) + PreviewPackageVersion: 4.8.0-preview.$(Build.BuildNumber) + +stages: +- stage: Node10CI + dependsOn: [] # Run this stage in parallel + displayName: 'Node 10.x CI' + variables: + NodeVersion: 10.x + jobs: + - job: Node10UnitTests + displayName: 'Node 10.x Unit Tests' + steps: + - template: js-build-steps.yml + + - powershell: | + pushd .. + Get-ChildItem -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"} + displayName: 'Dir workspace except node-modules (takes 5 seconds)' + continueOnError: true + condition: succeededOrFailed() + +- stage: Node12CI + dependsOn: [] # Run this stage in parallel + displayName: 'Node 12.x CI' + variables: + NodeVersion: 12.x + jobs: + - job: Node12UnitTests + displayName: 'Node 12.x Unit Tests' + steps: + - template: js-build-steps.yml + + - powershell: | + pushd .. + Get-ChildItem -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"} + displayName: 'Dir workspace except node-modules (takes 5 seconds)' + continueOnError: true + condition: succeededOrFailed() \ No newline at end of file diff --git a/build/yaml/botbuilder-js-daily.yml b/build/yaml/botbuilder-js-daily.yml new file mode 100644 index 0000000000..b7138fabb5 --- /dev/null +++ b/build/yaml/botbuilder-js-daily.yml @@ -0,0 +1,111 @@ +# This runs under BotBuilder-JS-daily-yaml. + +# "name" here defines the build number format. Build number is accessed via $(Build.BuildNumber) +name: $(Build.BuildId) + +pool: + vmImage: 'macOS-10.15' + +variables: + NodeVersion: 12.x +# PackageVersion: Define this in Azure to be settable at queue time. Ex: 4.8.0-dev.{DateStamp}.{CommitHash} +# PreviewPackageVersion: Define this in Azure to be settable at queue time. Ex: 4.8.0-dev.{DateStamp}.{CommitHash} + +steps: +- powershell: | + # Replace {DateStamp} and {CommitHash} tokens with the actual values in vars PackageVersion and PreviewPackageVersion + $dateStamp = (Get-Date -format "yyyyMMdd"); + $commitHash = "$(Build.SourceVersion)".SubString(0,7); + + "Raw PackageVersion = $(PackageVersion)"; + $v = "$(PackageVersion)".Replace("{DateStamp}",$dateStamp).Replace("{CommitHash}",$commitHash); + Write-Host "##vso[task.setvariable variable=PackageVersion;]$v"; + "Resolved PackageVersion = $v"; + + "Raw PreviewPackageVersion = $(PreviewPackageVersion)"; + $ppv = "$(PreviewPackageVersion)".Replace("{DateStamp}",$dateStamp).Replace("{CommitHash}",$commitHash); + Write-Host "##vso[task.setvariable variable=PreviewPackageVersion;]$ppv"; + "Resolved PreviewPackageVersion = $ppv"; + displayName: 'Resolve package version variables' + +- template: js-daily-build-steps.yml + +- script: 'lerna exec --no-private npm pack' + displayName: 'lerna exec --no-private npm pack' + +- task: CopyFiles@2 + displayName: 'Copy TGZ files to staging' + inputs: + SourceFolder: libraries + Contents: '*/*.tgz' + TargetFolder: '$(Build.ArtifactStagingDirectory)' + flattenFolders: true + +- task: PublishBuildArtifacts@1 + displayName: 'Publish staging to Build Artifacts' + +- powershell: | + [string[]]$outvar = (Get-ChildItem *.tgz -Path $(Build.ArtifactStagingDirectory) ).Name; + + [int] $packageCount = $outvar.Length; + $PackagesDescription = "$packageCount packages"; + $PackagesDescription; + $outvar; + + "##vso[task.setvariable variable=PackagesDescription;]$PackagesDescription"; + [int] $maxTags = 5; + + if ($packageCount -gt $maxTags) { + # Too many packages for tags. + + # Set a few package name variables for tags + for ($i = 0; $i -lt $maxTags; $i++ ) { + $p = $outvar[$i]; + "##vso[task.setvariable variable=pkg$i;]$p"; + } + + $message = "(See 'Package names' task log for full list)"; + Write-Host "##vso[task.setvariable variable=pkg$i;]$message"; + Write-Host $message; + $packageCount = ++$i; + } else { + # Set package name variables for tags + for ($i = 0; $i -lt $packageCount; $i++ ) { + $p = $outvar[$i]; + "##vso[task.setvariable variable=pkg$i;]$p"; + } + } + + for ($i = $packageCount; $i -le 30; $i++ ) { + # Set remaining variables to an empty string + "##vso[task.setvariable variable=pkg$i;]"; + } + displayName: 'Package names' + continueOnError: true + +- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0 + displayName: 'Tag Build with package names' + inputs: + tags: | + $(PACKAGESDESCRIPTION) + $(PKG0) + $(PKG1) + $(PKG2) + $(PKG3) + $(PKG4) + $(PKG5) + $(PKG6) + $(PKG7) + $(PKG8) + $(PKG9) + $(PKG10) + $(PKG11) + $(PKG12) + continueOnError: true + +- powershell: | + pushd .. + ls -R + displayName: 'Dir workspace' + continueOnError: true + condition: succeededOrFailed() \ No newline at end of file diff --git a/build/yaml/js-build-steps.yml b/build/yaml/js-build-steps.yml new file mode 100644 index 0000000000..8f45e6352f --- /dev/null +++ b/build/yaml/js-build-steps.yml @@ -0,0 +1,85 @@ +#variables: +# PackageVersion: Define this in the calling pipeline. + +steps: +- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0 + displayName: 'Tag Build with version number. (Skip if a fork PR to avoid access denied error.)' + inputs: + tags: | + v: $(PackageVersion) + preview v: $(PreviewPackageVersion) + continueOnError: true + condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'false')) + +- task: NodeTool@0 + displayName: 'Use Node $(NodeVersion)' + inputs: + versionSpec: $(NodeVersion) + +- task: Npm@1 + displayName: 'npm install lerna ...' + inputs: + command: custom + verbose: false + customCommand: 'install --global lerna@3.22.1 nyc mocha eslint-plugin-jsdoc' + +- task: Npm@1 + displayName: '/tools npm install' + inputs: + workingDir: tools + verbose: false + +- bash: | + set -o xtrace + sed -i '' 's/${Version}/$(PackageVersion)/g' package.json + sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/adaptive-expressions/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-ai/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-applicationinsights/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-azure/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-core/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-dialogs/package.json + sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/botbuilder-lg/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-testing/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-config/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-connector/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-schema/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-streaming/package.json + displayName: 'Replace version number in package.json files' + continueOnError: true + +- bash: | + npm run update-versions + displayName: 'npm run update-versions' + env: + Version: $(PackageVersion) + PreviewPackageVersion: $(PreviewPackageVersion) + +- powershell: | + $fileName = 'package-lock.json' + Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName}; + Write-Host "`nDeleting any files listed above"; + Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName} | Remove-Item -Force; + displayName: 'Delete tools/package-lock.json. Maybe avoids intermittent error in \"npm run postinstall\" ENOENT: no such file or directory, lchown ''/Users/runner/.npm/_locks/staging-7c222bec8116519f.lock''' + continueOnError: true + +- task: Npm@1 + displayName: 'npm run postinstall' + inputs: + command: custom + verbose: false + customCommand: 'run postinstall' + +- task: Npm@1 + displayName: 'npm run build' + inputs: + command: custom + verbose: false + customCommand: 'run build' + +- task: Npm@1 + displayName: 'npm run test' + inputs: + command: custom + verbose: false + customCommand: 'run test' \ No newline at end of file diff --git a/build/yaml/js-daily-build-steps.yml b/build/yaml/js-daily-build-steps.yml new file mode 100644 index 0000000000..6f06e3ea83 --- /dev/null +++ b/build/yaml/js-daily-build-steps.yml @@ -0,0 +1,86 @@ +#variables: +# PackageVersion: Define this in the calling pipeline. +# PreviewPackageVersion: Define this in Azure to be settable at queue time. Ex: 4.9.0-dev.{DateStamp}.{CommitHash} + +steps: +- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0 + displayName: 'Tag Build with version number. (Skip if a fork PR to avoid access denied error.)' + inputs: + tags: | + v: $(PackageVersion) + preview v: $(PreviewPackageVersion) + continueOnError: true + condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'false')) + +- task: NodeTool@0 + displayName: 'Use Node $(NodeVersion)' + inputs: + versionSpec: $(NodeVersion) + +- task: Npm@1 + displayName: 'npm install lerna ...' + inputs: + command: custom + verbose: false + customCommand: 'install --global lerna@3.22.1 nyc mocha eslint-plugin-jsdoc' + +- task: Npm@1 + displayName: '/tools npm install' + inputs: + workingDir: tools + verbose: false + +- bash: | + set -o xtrace + sed -i '' 's/${Version}/$(PackageVersion)/g' package.json + sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/adaptive-expressions/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-ai/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-applicationinsights/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-azure/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-core/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-dialogs/package.json + sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/botbuilder-lg/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-testing/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-config/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-connector/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-schema/package.json + sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-streaming/package.json + displayName: 'Replace version number in package.json files' + continueOnError: true + +- bash: | + npm run update-versions + displayName: 'npm run update-versions' + env: + Version: $(PackageVersion) + PreviewPackageVersion: $(PreviewPackageVersion) + +- powershell: | + $fileName = 'package-lock.json' + Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName}; + Write-Host "`nDeleting any files listed above"; + Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName} | Remove-Item -Force; + displayName: 'Delete tools/package-lock.json. Maybe avoids intermittent error in \"npm run postinstall\" ENOENT: no such file or directory, lchown ''/Users/runner/.npm/_locks/staging-7c222bec8116519f.lock''' + continueOnError: true + +- task: Npm@1 + displayName: 'npm run postinstall' + inputs: + command: custom + verbose: false + customCommand: 'run postinstall' + +- task: Npm@1 + displayName: 'npm run build' + inputs: + command: custom + verbose: false + customCommand: 'run build' + +- task: Npm@1 + displayName: 'npm run test' + inputs: + command: custom + verbose: false + customCommand: 'run test' \ No newline at end of file diff --git a/libraries/botframework-connector/src/auth/jwtTokenValidation.ts b/libraries/botframework-connector/src/auth/jwtTokenValidation.ts index 7957929409..fed19cd74e 100644 --- a/libraries/botframework-connector/src/auth/jwtTokenValidation.ts +++ b/libraries/botframework-connector/src/auth/jwtTokenValidation.ts @@ -133,7 +133,7 @@ export namespace JwtTokenValidation { await authConfig.validateClaims(claims); } else if (SkillValidation.isSkillClaim(claims)) { // Skill claims must be validated using AuthenticationConfiguration validateClaims - throw new AuthenticationError('Unauthorized Access. Request is not authorized. Skill Claims require validation.', StatusCodes.UNAUTHORIZED); + throw new Error('Unauthorized Access. Request is not authorized. Skill Claims require validation.'); } } diff --git a/libraries/botframework-streaming/src/interfaces/INodeSocket.ts b/libraries/botframework-streaming/src/interfaces/INodeSocket.ts index 3e5faeb12e..a92853c8f0 100644 --- a/libraries/botframework-streaming/src/interfaces/INodeSocket.ts +++ b/libraries/botframework-streaming/src/interfaces/INodeSocket.ts @@ -28,6 +28,7 @@ export interface INodeSocket { readonly writableLength: number; readonly readableHighWaterMark: number; readonly readableLength: number; + readonly readableFlowing: boolean | null; address(): AddressInfo | string;