From 4c4a859da1135f3a27e476c8d5534a74487e4970 Mon Sep 17 00:00:00 2001 From: ramya0820 <45977823+ramya0820@users.noreply.github.com> Date: Tue, 24 Sep 2019 12:28:26 -0700 Subject: [PATCH] [Service Bus] Add browser support (#5128) --- common/config/rush/pnpm-lock.yaml | 83 +++++++++++++------ sdk/servicebus/service-bus/License | 34 ++++---- .../service-bus/browser/ThirdPartyNotice.txt | 48 +++++++++++ sdk/servicebus/service-bus/changelog.md | 24 ++++-- sdk/servicebus/service-bus/package.json | 5 +- .../service-bus/rollup.base.config.js | 6 +- sdk/servicebus/service-bus/rollup.config.js | 4 - .../service-bus/src/serviceBusClient.ts | 6 ++ .../service-bus/src/util/constants.ts | 3 +- .../service-bus/test/serviceBusClient.spec.ts | 18 +++- 10 files changed, 167 insertions(+), 64 deletions(-) create mode 100644 sdk/servicebus/service-bus/browser/ThirdPartyNotice.txt diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 61848f84d2e1..f8487a6fbb35 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1,5 +1,5 @@ dependencies: - '@azure/amqp-common': 1.0.0-preview.6_rhea-promise@0.1.15 + '@azure/amqp-common': 1.0.0-preview.7_rhea-promise@0.1.15 '@azure/arm-servicebus': 3.2.0 '@azure/core-asynciterator-polyfill': 1.0.0-preview.1 '@azure/cosmos-sign': 1.0.2 @@ -231,6 +231,28 @@ packages: rhea-promise: ^0.1.15 resolution: integrity: sha512-5XJZaJGtGoPmLhFx5y0vfCXiAHksoA4fdSnHAfkgEm4krhCW1jt1LH/6aJdUwUTJe+bz6m3Pv0sG/ILG0Vd65g== + /@azure/amqp-common/1.0.0-preview.7_rhea-promise@0.1.15: + dependencies: + '@azure/ms-rest-nodeauth': 0.9.3 + '@types/async-lock': 1.1.1 + '@types/is-buffer': 2.0.0 + async-lock: 1.2.2 + buffer: 5.4.3 + debug: 3.2.6 + events: 3.0.0 + is-buffer: 2.0.3 + jssha: 2.3.1 + process: 0.11.10 + rhea-promise: 0.1.15 + stream-browserify: 2.0.2 + tslib: 1.10.0 + url: 0.11.0 + util: 0.11.1 + dev: false + peerDependencies: + rhea-promise: ^0.1.15 + resolution: + integrity: sha512-Lz8fsedD2YtUPXU0MwXew81XHJsU3OxL9YnHbf23EIhbqb1b5kA92QFjZNOoGiFLwGNfDOEj937M7XUsKoco3Q== /@azure/arm-servicebus/3.2.0: dependencies: '@azure/ms-rest-azure-js': 1.3.8 @@ -2503,6 +2525,13 @@ packages: dev: false resolution: integrity: sha512-Xpgy0IwHK2N01ncykXTy6FpCWuM+CJSHoPVBLyNqyrWxsedpLvwsYUhf0ME3WRFNUhos0dMamz9cOS/xRDtU5g== + /buffer/5.4.3: + dependencies: + base64-js: 1.3.1 + ieee754: 1.1.13 + dev: false + resolution: + integrity: sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A== /builtin-modules/1.1.1: dev: false engines: @@ -10795,7 +10824,7 @@ packages: dev: false name: '@rush-temp/abort-controller' resolution: - integrity: sha512-YwhAi/dV8QU4uVvddHEEchoJUG07D7QbKuQVf5jyvD5oklm8BnoIR5ONWo24G1jQnlIEaFrsFjYbboAt1Xl3bQ== + integrity: sha512-vDcC9ZxFHAZ1GK8i63eC7rnBVBbGN6JKPNgMETz4CGHji31lXhMdMMx0sjZNiDN1HMv9lojK3KtW+mhsZmEfZQ== tarball: 'file:projects/abort-controller.tgz' version: 0.0.0 'file:projects/app-configuration.tgz': @@ -10826,7 +10855,7 @@ packages: dev: false name: '@rush-temp/app-configuration' resolution: - integrity: sha512-yL3UwTRBJ5d8zUsqH8wVabgwENM4R1knOIDeWV0OdEkeSYsJ3QJMC0sE8QVSsUwVmUu8/PXIcSMeixdjMUETtw== + integrity: sha512-E7iNSp6sfIjCXmpK7lNDqAY00UoMz+ZZ4zgIO5v32Y78tx0D9dq+UrreQEytDR14GUwPyh3uLesptZMwADKlNg== tarball: 'file:projects/app-configuration.tgz' version: 0.0.0 'file:projects/core-amqp.tgz': @@ -10895,7 +10924,7 @@ packages: dev: false name: '@rush-temp/core-amqp' resolution: - integrity: sha512-O8f70NJBk7/6mhI083dWNWnXFzNOvCGoQWSs+6d/FYbSDNiCRSwgTnZ6ZeEUAL7FbPWOCcEfeqlZsDz9CSE4zA== + integrity: sha512-DasjGL3VvHyphyi0JX91olVAdiOce2XvrjiDAfj9ubz1GkolMFvaNr4zh2MAW/KRzpk4RjJxbHSJcr3NnJxUvg== tarball: 'file:projects/core-amqp.tgz' version: 0.0.0 'file:projects/core-arm.tgz': @@ -10930,7 +10959,7 @@ packages: dev: false name: '@rush-temp/core-arm' resolution: - integrity: sha512-YLO+Lu8+QdbGXNectrQzC9OCK5HlWogISjARKZSp+sU5/qxtkPpogIJUOctgReTgx3yK4bh/wNBegLsYeXVxvg== + integrity: sha512-CUyFXyNU8RXwK7x40YPYiqbXLI++JBNuUBKUvLtGOaoe53QhyCr8ehLXWdgPmoz689vNApf0JLcyxFVlthNzbA== tarball: 'file:projects/core-arm.tgz' version: 0.0.0 'file:projects/core-asynciterator-polyfill.tgz': @@ -10948,7 +10977,7 @@ packages: dev: false name: '@rush-temp/core-asynciterator-polyfill' resolution: - integrity: sha512-X2qR67x/Wgwcs8VjH/m3EA7HFB22mL2sf9YJCvpdIUXvz5ENGH54U4TC8IAc2AxcqlKjOi1pwFUAf9yBf4nAJQ== + integrity: sha512-hp2FjyoaLo9iJIGV0Aq7UI8oGzIr29OewVSFfuckKI+2aDUrh6Kamlg/hw/HrZ/a3ybccP3oqGjwA2uze4DoAg== tarball: 'file:projects/core-asynciterator-polyfill.tgz' version: 0.0.0 'file:projects/core-auth.tgz': @@ -10987,7 +11016,7 @@ packages: dev: false name: '@rush-temp/core-auth' resolution: - integrity: sha512-fGVgepFqWjAN5Jxlf/YAE7xElRuGy+mDk84yEv/crX+dj98rAbn9QF/tNdY7/06xHwTI1E5cLvPjNISYrLbb4g== + integrity: sha512-OP2+mfrkgls9JxdoKEagMyvsoOujHFoTpzMYpMEsezWb5UgOIkl4et7bu+pR+/rffT8kwI+0KKBy2t+tyWqk/A== tarball: 'file:projects/core-auth.tgz' version: 0.0.0 'file:projects/core-http.tgz': @@ -11071,7 +11100,7 @@ packages: dev: false name: '@rush-temp/core-http' resolution: - integrity: sha512-tbYfxauAdOzrE3yT5z1WUJd3Kndv6E940DbjOJ5q6EEaj3U3CSp7/kxrOAnJpieqUH5eOoZ/+rJMtGspMXelBA== + integrity: sha512-q5149bZS7h72W5USm3WrFB+QgNYWsFkMScREv3O+KKyWlmVFO6Ok5jssD/aCSfxsn42YPO8S0KlDS7EcTtK1iQ== tarball: 'file:projects/core-http.tgz' version: 0.0.0 'file:projects/core-paging.tgz': @@ -11090,7 +11119,7 @@ packages: dev: false name: '@rush-temp/core-paging' resolution: - integrity: sha512-/l5SA2u/jUrYjvQBf24YFdaoYW4GAdU3iDoGDekLbjH2fSP8wOt/3oDlBM8pxGD54TB7s06Oi4OjBsQN6F5tgw== + integrity: sha512-rorSx6Oeq/VsKWv3L8qwnHYihYjPZS/PiCZZrIlGt7WfSH8iS60XFPxRrAiP+zIhosvd1hDlSmQ8k30iIB10QA== tarball: 'file:projects/core-paging.tgz' version: 0.0.0 'file:projects/core-tracing.tgz': @@ -11129,7 +11158,7 @@ packages: dev: false name: '@rush-temp/core-tracing' resolution: - integrity: sha512-kQulnB/+QgGoq4dix6zSTb7odWaxkMsOHYkc9lpXJy98X1zckjDSLlwbbeqviqkDMjMmbqqRimOtOypivt8Dmg== + integrity: sha512-tJ58I97IAcVA5vJsvMt2Oqze5/2n5B1dXGuPEhiySXgry2kGNeOF64ZVUlGHPPT2Zsvpst+f9K/Y0SXusToWPg== tarball: 'file:projects/core-tracing.tgz' version: 0.0.0 'file:projects/cosmos.tgz_webpack@4.39.2': @@ -11205,7 +11234,7 @@ packages: peerDependencies: webpack: '*' resolution: - integrity: sha512-ZwEE+b0Q+iECvIe11mgtneZ3N4YBla/dWW9WYTtHP2AIwUfc7CIVtRLhwHi/KW5tzJHGK54qvDUnz4pXXJOPHQ== + integrity: sha512-hJJjJj86BUBSS228e9VU4XteZDdYMSqrPOGC+woAZvpX6dfwyZbZSfKAscourcyo9RaWeFZjP9aPCeibqmuzqA== tarball: 'file:projects/cosmos.tgz' version: 0.0.0 'file:projects/event-hubs.tgz': @@ -11282,7 +11311,7 @@ packages: dev: false name: '@rush-temp/event-hubs' resolution: - integrity: sha512-q+ihScahg5y1w7biapQHL6AYHh90dSPR85HcgxJBykkNQtHCPdJ2p7h0nnQmq5pKrovtJ/ufFpYF7H63+Sl13A== + integrity: sha512-j/OY8KHU0zD+bWlRhK5yp711OcS7oQYsRNmELlYAeishEnoPeWE+2mm104Ck2osCQa1w2HcYIqs9NJD9TSQzqA== tarball: 'file:projects/event-hubs.tgz' version: 0.0.0 'file:projects/event-processor-host.tgz': @@ -11340,7 +11369,7 @@ packages: dev: false name: '@rush-temp/event-processor-host' resolution: - integrity: sha512-W3yvQ/XpiLD0NxwDCHy8iuOnHcMAQDH0f9g336udX3pgtjhcxwjRVcUzuOK+u5e1At95pTE/LMFJoDFeJGvIrQ== + integrity: sha512-7Qk5AOasHTZrxBj7bDBlChwSFImEDSYG2yQJ4m6kdAKG6Byxg1OtL0ojBzf74UK1R4A+Bqz66pjBnhbI0MT6kA== tarball: 'file:projects/event-processor-host.tgz' version: 0.0.0 'file:projects/eventhubs-checkpointstore-blob.tgz': @@ -11403,7 +11432,7 @@ packages: dev: false name: '@rush-temp/eventhubs-checkpointstore-blob' resolution: - integrity: sha512-fA1airUTMv4LAmlMLTyvSHSkMnWeuQ5u9d4AHuE2RSNEILob7WG5sF09RjNikbJkYMKNLNXO9cZHxEKlrCkm4w== + integrity: sha512-hoS0oalZm7WOQ3YNGBakiuzU+zGVjAJHAaUSR5RiazFPaBMYmnbwr4epZXQRFi0FOEz5oDw+fhaoCZVi9rJYLQ== tarball: 'file:projects/eventhubs-checkpointstore-blob.tgz' version: 0.0.0 'file:projects/identity.tgz': @@ -11455,7 +11484,7 @@ packages: dev: false name: '@rush-temp/identity' resolution: - integrity: sha512-yITMvnD9EnzaWxVx7KrQhQ7BftiFe8/i3ykh/ZUi5V8TBOcIhMEYwd3vFoahVqO1TJdo7TCv5KW9+WpKRAByYA== + integrity: sha512-bVFvN9S6o3c3YHXwiTDfwRhXIIYxh3i5qvYhPOJlLVTsmHgsmmQjx0hiF3cE4JayFN91MHtMDJw3pu5BmkovNw== tarball: 'file:projects/identity.tgz' version: 0.0.0 'file:projects/keyvault-certificates.tgz': @@ -11524,7 +11553,7 @@ packages: dev: false name: '@rush-temp/keyvault-certificates' resolution: - integrity: sha512-EFiXgxOsM7nzGDpo24dwAFj3NB9iVcnlYLg2zRasrIHdgnMyvvg2X0RD2yOMQyL/q26nqnS+9CWjbREXFsOvGQ== + integrity: sha512-0VO+0a4YgpvmpSb4BjjcBTCmjwg7j22kHrasZWWnbeKbQp9CzguDgknIYwd5l4gh9fRMjFWtPS9b7UuB4Wx4lw== tarball: 'file:projects/keyvault-certificates.tgz' version: 0.0.0 'file:projects/keyvault-keys.tgz': @@ -11593,7 +11622,7 @@ packages: dev: false name: '@rush-temp/keyvault-keys' resolution: - integrity: sha512-+TRnDu0gtivqdc1ccO+PD/1IaljLNQe7v7WsnE5c1Mvl2Bvd1kiCswQpdBPrjTtJBLCfMCfDzelUh4e9FdyNnA== + integrity: sha512-UJmV8ySBuvZ9KrQDtZrIxojC5d7P41qemrY9ichk08lXfmBc5bRJFlcMLE+Sld32FX4AKaSjPXZt4wCgzT1dww== tarball: 'file:projects/keyvault-keys.tgz' version: 0.0.0 'file:projects/keyvault-secrets.tgz': @@ -11661,12 +11690,12 @@ packages: dev: false name: '@rush-temp/keyvault-secrets' resolution: - integrity: sha512-BqXds/rjlQUgSVasBkrSTvio8GOQlFlhqQH8wM42OThTLBZvIkdnjoO3wg2+A1geTLQIhhir5dnysg2Xy1oDzQ== + integrity: sha512-VfTsDKuJ1iaGdchDP4rF/1HXNW/g4QtjWNhoVvA6rlJetUn6Teyh5Eb5E52Vauqte57kS6m7qLYP/k92UfwGGA== tarball: 'file:projects/keyvault-secrets.tgz' version: 0.0.0 'file:projects/service-bus.tgz': dependencies: - '@azure/amqp-common': 1.0.0-preview.6_rhea-promise@0.1.15 + '@azure/amqp-common': 1.0.0-preview.7_rhea-promise@0.1.15 '@azure/arm-servicebus': 3.2.0 '@azure/eslint-plugin-azure-sdk': 2.0.1_9e8391ca70fb0408a9da4393803aa477 '@azure/ms-rest-nodeauth': 0.9.3 @@ -11739,7 +11768,7 @@ packages: dev: false name: '@rush-temp/service-bus' resolution: - integrity: sha512-MFTbKJFGZfLMYWcCjdZqdR+qJZ/8MpoNF8/KDB3hkkjkz4cOEZ4oPnCIBhlXR+/Wy2xg609i78c3JGYpml4haw== + integrity: sha512-WK1TJTyv7aW0B14SCUbdDtgvrRYbV6zAyT63ZjEPJlezoFP6iYdKxRveDwpHkfHldBbZbgqf883PoVhLhsOJ5Q== tarball: 'file:projects/service-bus.tgz' version: 0.0.0 'file:projects/storage-blob.tgz': @@ -11809,7 +11838,7 @@ packages: dev: false name: '@rush-temp/storage-blob' resolution: - integrity: sha512-6JJFDGUj5AY8R/wStkv05OdRkLSE05ZPbX03uIJefY4QTxdtaqyCi5s+2lrxbuxE9UGduVSnlB3qh0tgdH2Jhw== + integrity: sha512-76kxW4mT5QbNSGd1oOkcZxqa2ZoZYn5E8LSoui/rWtH3tX1i0lCT/FJhSgcnOQXYMM56Gdno8AqEI5CT9dFRmg== tarball: 'file:projects/storage-blob.tgz' version: 0.0.0 'file:projects/storage-file.tgz': @@ -11879,7 +11908,7 @@ packages: dev: false name: '@rush-temp/storage-file' resolution: - integrity: sha512-Ss14Pm4zCFh4fqOHc2QzsbpTFHkuqkZo+qVXASJvsE7sqzuqFg+W09M2D+uT23k45l44d+x5G5D1dyg1OWmjwA== + integrity: sha512-1vuu96rlT8OLbWybGYkV7wXK2iRYEAg9JBdTFS2VbcYWztw2/L5gXM/HrRrnDN891SpDW1KsHNng0oj880UL/Q== tarball: 'file:projects/storage-file.tgz' version: 0.0.0 'file:projects/storage-queue.tgz': @@ -11948,7 +11977,7 @@ packages: dev: false name: '@rush-temp/storage-queue' resolution: - integrity: sha512-xOXI5NLw/G1ylX0iLrbEsmmANf7/8l1yoKhZ9rcpcFVHj5Jnz0bXEU9RNHK12mAGYRanQ/AJK1HBOJoeNQk9CA== + integrity: sha512-Sva5UkbRrEXShOKLaZ4ALhk/2RdGETd4oKVAmgRmeo1CACidcSPDvHQC/MJhEgdmM/47YJLMOyKkP/mVSgZqjw== tarball: 'file:projects/storage-queue.tgz' version: 0.0.0 'file:projects/template.tgz': @@ -11998,7 +12027,7 @@ packages: dev: false name: '@rush-temp/template' resolution: - integrity: sha512-Mr5kH/fT37U2+FhWBOOteBh5HPN07yLkRD2MlYGQ1Y3z6sVRO9H9ruwnSeZXg5xxWvUNsQW77YVOqbgFRzavLQ== + integrity: sha512-kVQvLrvxsA1WMbSQpOpcTQTIN0HwJKD9PvpY7ZONaZIKwgWTuUM2u0euzQMU4qYBkfvqrAiPSviNf99s2pFjQQ== tarball: 'file:projects/template.tgz' version: 0.0.0 'file:projects/test-utils-recorder.tgz': @@ -12026,7 +12055,7 @@ packages: dev: false name: '@rush-temp/test-utils-recorder' resolution: - integrity: sha512-5X0CLSRbJrplwH5JFkcDlSfzxzFeT/veoYhb9NB+q2hTDd9rXRjwePn76IWcVBtUzq2siSgvgrSsioDYiXMUsw== + integrity: sha512-SJjlxlVlW3QPkHFCP+M3QSAgrlVC50hl/ePd/Xmfixx8pl4uiLwm/ZOMmzQ59IfM1zryQw55BNPv2qu5/1hJXA== tarball: 'file:projects/test-utils-recorder.tgz' version: 0.0.0 'file:projects/testhub.tgz': @@ -12047,12 +12076,12 @@ packages: dev: false name: '@rush-temp/testhub' resolution: - integrity: sha512-RkYcAmpRKuAXwbssMJGmc8uzm3LoQikdGvIqdwioQqURgLagimtd01yH+757XDMvMyOfVwejTTSCZHpqa2Bf6Q== + integrity: sha512-XZB/wnNqz04DCZBqyhzkkYG8c/XduwpKK8uJbRcnJrvTthx844ix8Cn3nDHaoLlxODmoxP4xosiCiKTIn7EuBw== tarball: 'file:projects/testhub.tgz' version: 0.0.0 registry: '' specifiers: - '@azure/amqp-common': 1.0.0-preview.6 + '@azure/amqp-common': 1.0.0-preview.7 '@azure/arm-servicebus': ^3.2.0 '@azure/core-asynciterator-polyfill': 1.0.0-preview.1 '@azure/cosmos-sign': ^1.0.2 diff --git a/sdk/servicebus/service-bus/License b/sdk/servicebus/service-bus/License index d1ca00f20a89..8cb179cdb694 100644 --- a/sdk/servicebus/service-bus/License +++ b/sdk/servicebus/service-bus/License @@ -1,21 +1,21 @@ - MIT License +Copyright (c) Microsoft Corporation. All rights reserved. - Copyright (c) Microsoft Corporation. All rights reserved. +MIT License - 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: +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 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 \ No newline at end of file +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/sdk/servicebus/service-bus/browser/ThirdPartyNotice.txt b/sdk/servicebus/service-bus/browser/ThirdPartyNotice.txt new file mode 100644 index 000000000000..504810d8c793 --- /dev/null +++ b/sdk/servicebus/service-bus/browser/ThirdPartyNotice.txt @@ -0,0 +1,48 @@ +------------------------------------------- START OF THIRD PARTY NOTICE ----------------------------------------- +This file is based on or incorporates material from the projects listed below (Third Party Programs). The original copyright notice and the license under which Microsoft received such Third Party Programs, are set forth below. Such licenses and notices are provided for informational purposes only. +********** + +uuid 3.2.2, Copyright (c) 2010-2016 Robert Kieffer and other contributors +events 3.0.0, Copyright Joyent, Inc. and other Node contributors. +buffer 5.2.1, is-buffer 2.0.3 - Copyright (c) Feross Aboukhadijeh, and other contributors. +process 1.11.10, Copyright (c) 2013 Roman Shtylman +debug 4.1.1, Copyright (c) 2014 TJ Holowaychuk + +The MIT License (MIT) +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. +********** + +********** +rhea 1.0.4, Copyright 2015 Red Hat Inc. +long 4.0.0, Copyright Daniel Wirtz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +********** + +----------------------------------------------- END OF THIRD PARTY NOTICE ------------------------------------------ diff --git a/sdk/servicebus/service-bus/changelog.md b/sdk/servicebus/service-bus/changelog.md index 603cf628c31a..f96b1e35a930 100644 --- a/sdk/servicebus/service-bus/changelog.md +++ b/sdk/servicebus/service-bus/changelog.md @@ -1,11 +1,16 @@ +# 2019-09-24 1.1.0 + +- Add browser support. Authentication using Azure Active Directory credentials is not supported yet - use a connection string instead. + [PR 5128](https://github.com/Azure/azure-sdk-for-js/pull/5128) related to [issue 3373](https://github.com/Azure/azure-sdk-for-js/issues/3373) + # 2019-09-12 1.0.4 - Increase timeout value from 20 seconds to 60 seconds when settling messages. -[PR 4907](https://github.com/Azure/azure-sdk-for-js/pull/4907) related to [bug 3764](https://github.com/Azure/azure-sdk-for-js/issues/3764) + [PR 4907](https://github.com/Azure/azure-sdk-for-js/pull/4907) related to [bug 3764](https://github.com/Azure/azure-sdk-for-js/issues/3764) - Allow time to receive a flow frame from service when sender is not in a sendable state. -[PR 4908](https://github.com/Azure/azure-sdk-for-js/pull/4908) related to [bug 4764](https://github.com/Azure/azure-sdk-for-js/issues/4764) + [PR 4908](https://github.com/Azure/azure-sdk-for-js/pull/4908) related to [bug 4764](https://github.com/Azure/azure-sdk-for-js/issues/4764) - Use user provided timeout value for the entirety of the `receiveMessages()` method. -[PR 4933](https://github.com/Azure/azure-sdk-for-js/pull/4933) related to [bug 4748](https://github.com/Azure/azure-sdk-for-js/issues/4748) + [PR 4933](https://github.com/Azure/azure-sdk-for-js/pull/4933) related to [bug 4748](https://github.com/Azure/azure-sdk-for-js/issues/4748) - Improve logging when not able to settle a message due to not having access to the right receiver. [PR 4943](https://github.com/Azure/azure-sdk-for-js/pull/4943) - Fix bug where the library consistently fails to settle a message due to having lost reference to the right receiver. [PR 4947](https://github.com/Azure/azure-sdk-for-js/pull/4947) @@ -17,12 +22,12 @@ # 2019-05-21 1.0.2 - Added missing package.json file to the npm package to fix issues bundling with webpack and other bundlers. -This fixes the [bug 2857](https://github.com/Azure/azure-sdk-for-js/issues/2857). + This fixes the [bug 2857](https://github.com/Azure/azure-sdk-for-js/issues/2857). # 2019-05-16 1.0.1 - Readme updated to remove the status about this library being in preview. This library is now out -of preview. + of preview. # 2019-05-16 1.0.0 @@ -31,13 +36,14 @@ of preview. - Errors thrown explicitly by the library for the user facing apis are documented in jsdocs. ### Breaking changes + - When Service Bus does not acknowledge a message settlement/disposition request in time, the error -`ServiceUnavailbleError` is thrown. This is consistent with send requests and requests over the $management link. + `ServiceUnavailbleError` is thrown. This is consistent with send requests and requests over the \$management link. - The error `MessageLockLostError` or `SessionLockLostError` (based on whether the entity has sessions enabled -or not) is thrown for a message settlement/disposition request when the AMQP receiver link that was used to receive -the message has died. + or not) is thrown for a message settlement/disposition request when the AMQP receiver link that was used to receive + the message has died. - User agent string which is passed as a AMQP connection property is updated to follow the new standard. -For example: `azsdk-js-azureservicebus/1.0.0/(NODE-VERSION v10.15.0) Windows_NT 10.0.17763` + For example: `azsdk-js-azureservicebus/1.0.0/(NODE-VERSION v10.15.0) Windows_NT 10.0.17763` # 2019-04-24 1.0.0-preview.3 diff --git a/sdk/servicebus/service-bus/package.json b/sdk/servicebus/service-bus/package.json index 324bb430779e..b601bc0e2a07 100644 --- a/sdk/servicebus/service-bus/package.json +++ b/sdk/servicebus/service-bus/package.json @@ -2,7 +2,7 @@ "name": "@azure/service-bus", "sdk-type": "client", "author": "Microsoft Corporation", - "version": "1.0.4", + "version": "1.1.0", "license": "MIT", "description": "Azure Service Bus SDK for Node.js", "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/servicebus/service-bus", @@ -32,6 +32,7 @@ "dist/", "dist-esm/src/", "src/", + "browser/", "typings/service-bus.d.ts", "tsconfig.json" ], @@ -65,7 +66,7 @@ }, "sideEffects": false, "dependencies": { - "@azure/amqp-common": "1.0.0-preview.6", + "@azure/amqp-common": "1.0.0-preview.7", "@azure/ms-rest-nodeauth": "^0.9.2", "@types/is-buffer": "^2.0.0", "@types/long": "^4.0.0", diff --git a/sdk/servicebus/service-bus/rollup.base.config.js b/sdk/servicebus/service-bus/rollup.base.config.js index 8e868ed17ad0..b193e94ef4cf 100644 --- a/sdk/servicebus/service-bus/rollup.base.config.js +++ b/sdk/servicebus/service-bus/rollup.base.config.js @@ -57,7 +57,8 @@ export function nodeConfig({ test = false, production = false } = {}) { values: { // replace dynamic checks with if (true) since this is for node only. // Allows rollup's dead code elimination to be more aggressive. - "if (isNode)": "if (true)" + "if (isNode)": "if (true)", + "if (!isNode)": "if (false)" } }), nodeResolve({ preferBuiltins: true }), @@ -117,7 +118,8 @@ export function browserConfig({ test = false, production = false } = {}) { // replace dynamic checks with if (false) since this is for // browser only. Rollup's dead code elimination will remove // any code guarded by if (isNode) { ... } - "if (isNode)": "if (false)" + "if (isNode)": "if (false)", + "if (!isNode)": "if (true)" } } ), diff --git a/sdk/servicebus/service-bus/rollup.config.js b/sdk/servicebus/service-bus/rollup.config.js index 0561cc0a3c26..aa60e18807db 100644 --- a/sdk/servicebus/service-bus/rollup.config.js +++ b/sdk/servicebus/service-bus/rollup.config.js @@ -14,8 +14,4 @@ if (!process.env.ONLY_NODE) { inputs.push(base.browserConfig({ production: true })); } -if (process.env.BROWSER_TEST) { - inputs.push(base.browserConfig({ test: true })); -} - export default inputs; diff --git a/sdk/servicebus/service-bus/src/serviceBusClient.ts b/sdk/servicebus/service-bus/src/serviceBusClient.ts index 126a317a33fd..b87bcfba1a92 100644 --- a/sdk/servicebus/service-bus/src/serviceBusClient.ts +++ b/sdk/servicebus/service-bus/src/serviceBusClient.ts @@ -22,6 +22,7 @@ import { SasTokenProvider } from "@azure/amqp-common"; import { SubscriptionClient } from "./subscriptionClient"; +import { isNode } from "./util/utils"; /** * Describes the options that can be provided while creating the ServiceBusClient. @@ -244,6 +245,11 @@ export class ServiceBusClient { | MSITokenCredentials, options?: ServiceBusClientOptions ): ServiceBusClient { + if (!isNode) { + throw new Error( + "`createFromAadTokenCredentials` cannot be used to create ServiceBusClient as AAD support is not present in browser." + ); + } host = String(host); const tokenProvider = new AadTokenProvider(credentials); return ServiceBusClient.createFromTokenProvider(host, tokenProvider, options); diff --git a/sdk/servicebus/service-bus/src/util/constants.ts b/sdk/servicebus/service-bus/src/util/constants.ts index 874c0af1377f..f4918a3104d0 100644 --- a/sdk/servicebus/service-bus/src/util/constants.ts +++ b/sdk/servicebus/service-bus/src/util/constants.ts @@ -3,8 +3,7 @@ export const packageJsonInfo = { name: "@azure/service-bus", - version: "1.0.4" + version: "1.1.0" }; - export const max32BitNumber = Math.pow(2, 31) - 1; diff --git a/sdk/servicebus/service-bus/test/serviceBusClient.spec.ts b/sdk/servicebus/service-bus/test/serviceBusClient.spec.ts index 32c0114783c9..249c0ae5f60b 100644 --- a/sdk/servicebus/service-bus/test/serviceBusClient.spec.ts +++ b/sdk/servicebus/service-bus/test/serviceBusClient.spec.ts @@ -32,7 +32,7 @@ import { } from "./utils/testUtils"; import { ClientType } from "../src/client"; import { DispositionType } from "../src/serviceBusMessage"; -import { getEnvVars } from "./utils/envVarUtils"; +import { getEnvVars, isNode } from "./utils/envVarUtils"; import { loginWithServicePrincipalSecret } from "./utils/aadUtils"; const should = chai.should(); @@ -341,6 +341,22 @@ describe("Test createFromAadTokenCredentials", function(): void { should.equal(msgs.length, 1, "Unexpected number of messages"); } + it("throws error when using `CreateFromAadTokenCredentials` in browser #RunInBrowser", async function(): Promise< + void + > { + if (!isNode) { + const credentials: any = {}; + await testCreateFromAadTokenCredentials(serviceBusEndpoint, credentials).catch((err) => { + errorWasThrown = true; + should.equal( + err.message, + "`createFromAadTokenCredentials` cannot be used to create ServiceBusClient as AAD support is not present in browser." + ); + }); + should.equal(errorWasThrown, true, "Error thrown flag must be true"); + } + }); + it("throws error for invalid tokenCredentials", async function(): Promise { await testCreateFromAadTokenCredentials(serviceBusEndpoint, "").catch((err) => { errorWasThrown = true;