[communication] Migrate @azure/communication-identity to ESM/vitest (#31769)
### Packages impacted by this PR - @azure/communication-identity ### Issues associated with this PR - https://github.com/Azure/azure-sdk-for-js/issues/31338 ### Describe the problem that is addressed by this PR Migrates the @azure/communication-identity package to ESM/vitest ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
This commit is contained in:
Родитель
77e8d0b9d3
Коммит
6b0ec887ea
|
@ -1655,6 +1655,11 @@ packages:
|
|||
engines: {node: '>=0.8.0'}
|
||||
dev: false
|
||||
|
||||
/@azure/msal-common@14.16.0:
|
||||
resolution: {integrity: sha512-1KOZj9IpcDSwpNiQNjt0jDYZpQvNZay7QAEi/5DLubay40iGYtLzya/jbjRPLyOTZhEKyL1MzPuw2HqBCjceYA==}
|
||||
engines: {node: '>=0.8.0'}
|
||||
dev: false
|
||||
|
||||
/@azure/msal-node-extensions@1.3.0:
|
||||
resolution: {integrity: sha512-7rXN+9hDm3NncIfNnMyoFtsnz2AlUtmK5rsY3P+fhhbH+GOk0W5Y1BASvAB6RCcKdO+qSIK3ZA6VHQYy4iS/1w==}
|
||||
engines: {node: '>=16'}
|
||||
|
@ -1679,6 +1684,15 @@ packages:
|
|||
uuid: 8.3.2
|
||||
dev: false
|
||||
|
||||
/@azure/msal-node@2.16.1:
|
||||
resolution: {integrity: sha512-1NEFpTmMMT2A7RnZuvRl/hUmJU+GLPjh+ShyIqPktG2PvSd2yvPnzGd/BxIBAAvJG5nr9lH4oYcQXepDbaE7fg==}
|
||||
engines: {node: '>=16'}
|
||||
dependencies:
|
||||
'@azure/msal-common': 14.16.0
|
||||
jsonwebtoken: 9.0.2
|
||||
uuid: 8.3.2
|
||||
dev: false
|
||||
|
||||
/@azure/openai@1.0.0-beta.12:
|
||||
resolution: {integrity: sha512-qKblxr6oVa8GsyNzY+/Ub9VmEsPYKhBrUrPaNEQiM+qrxnBPVm9kaeqGFFb/U78Q2zOabmhF9ctYt3xBW0nWnQ==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
|
@ -1962,6 +1976,12 @@ packages:
|
|||
cookie: 0.5.0
|
||||
dev: false
|
||||
|
||||
/@bundled-es-modules/cookie@2.0.1:
|
||||
resolution: {integrity: sha512-8o+5fRPLNbjbdGRRmJj3h6Hh1AQJf2dk3qQ/5ZFb+PXkRNiSoMGGUKlsgLfrxneb72axVJyIYji64E2+nNfYyw==}
|
||||
dependencies:
|
||||
cookie: 0.7.2
|
||||
dev: false
|
||||
|
||||
/@bundled-es-modules/statuses@1.0.1:
|
||||
resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==}
|
||||
dependencies:
|
||||
|
@ -4514,6 +4534,40 @@ packages:
|
|||
- vite
|
||||
dev: false
|
||||
|
||||
/@vitest/browser@2.1.5(@types/node@18.19.64)(playwright@1.48.2)(typescript@5.6.3)(vitest@2.1.5):
|
||||
resolution: {integrity: sha512-JrpnxvkrjlBrF7oXbK/YytWVYfJIzWYeDKppANlUaisBKwDso+yXlWocAJrANx8gUxyirF355Yx80S+SKQqayg==}
|
||||
peerDependencies:
|
||||
playwright: '*'
|
||||
safaridriver: '*'
|
||||
vitest: 2.1.5
|
||||
webdriverio: '*'
|
||||
peerDependenciesMeta:
|
||||
playwright:
|
||||
optional: true
|
||||
safaridriver:
|
||||
optional: true
|
||||
webdriverio:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@testing-library/dom': 10.4.0
|
||||
'@testing-library/user-event': 14.5.2(@testing-library/dom@10.4.0)
|
||||
'@vitest/mocker': 2.1.5(msw@2.6.4)
|
||||
'@vitest/utils': 2.1.5
|
||||
magic-string: 0.30.12
|
||||
msw: 2.6.4(@types/node@18.19.64)(typescript@5.6.3)
|
||||
playwright: 1.48.2
|
||||
sirv: 3.0.0
|
||||
tinyrainbow: 1.2.0
|
||||
vitest: 2.1.5(@types/node@18.19.64)(@vitest/browser@2.1.5)
|
||||
ws: 8.18.0
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- bufferutil
|
||||
- typescript
|
||||
- utf-8-validate
|
||||
- vite
|
||||
dev: false
|
||||
|
||||
/@vitest/coverage-istanbul@1.6.0(vitest@1.6.0):
|
||||
resolution: {integrity: sha512-h/BwpXehkkS0qsNCS00QxiupAqVkNi0WT19BR0dQvlge5oHghoSVLx63fABYFoKxVb7Ue7+k6V2KokmQ1zdMpg==}
|
||||
peerDependencies:
|
||||
|
@ -4553,6 +4607,26 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
/@vitest/coverage-istanbul@2.1.5(vitest@2.1.5):
|
||||
resolution: {integrity: sha512-jJsS5jeHncmSvzMNE03F1pk8F9etmjzGmGyQnGMkdHdVek/bxK/3vo8Qr3e9XmVuDM3UZKOy1ObeQHgC2OxvHg==}
|
||||
peerDependencies:
|
||||
vitest: 2.1.5
|
||||
dependencies:
|
||||
'@istanbuljs/schema': 0.1.3
|
||||
debug: 4.3.7(supports-color@8.1.1)
|
||||
istanbul-lib-coverage: 3.2.2
|
||||
istanbul-lib-instrument: 6.0.3
|
||||
istanbul-lib-report: 3.0.1
|
||||
istanbul-lib-source-maps: 5.0.6
|
||||
istanbul-reports: 3.1.7
|
||||
magicast: 0.3.5
|
||||
test-exclude: 7.0.1
|
||||
tinyrainbow: 1.2.0
|
||||
vitest: 2.1.5(@types/node@18.19.64)(@vitest/browser@2.1.5)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/@vitest/expect@1.6.0:
|
||||
resolution: {integrity: sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==}
|
||||
dependencies:
|
||||
|
@ -4570,6 +4644,15 @@ packages:
|
|||
tinyrainbow: 1.2.0
|
||||
dev: false
|
||||
|
||||
/@vitest/expect@2.1.5:
|
||||
resolution: {integrity: sha512-nZSBTW1XIdpZvEJyoP/Sy8fUg0b8od7ZpGDkTUcfJ7wz/VoZAFzFfLyxVxGFhUjJzhYqSbIpfMtl/+k/dpWa3Q==}
|
||||
dependencies:
|
||||
'@vitest/spy': 2.1.5
|
||||
'@vitest/utils': 2.1.5
|
||||
chai: 5.1.2
|
||||
tinyrainbow: 1.2.0
|
||||
dev: false
|
||||
|
||||
/@vitest/mocker@2.1.4(msw@2.6.0):
|
||||
resolution: {integrity: sha512-Ky/O1Lc0QBbutJdW0rqLeFNbuLEyS+mIPiNdlVlp2/yhJ0SbyYqObS5IHdhferJud8MbbwMnexg4jordE5cCoQ==}
|
||||
peerDependencies:
|
||||
|
@ -4604,12 +4687,52 @@ packages:
|
|||
vite: 5.4.10(@types/node@18.19.64)
|
||||
dev: false
|
||||
|
||||
/@vitest/mocker@2.1.5(msw@2.6.4):
|
||||
resolution: {integrity: sha512-XYW6l3UuBmitWqSUXTNXcVBUCRytDogBsWuNXQijc00dtnU/9OqpXWp4OJroVrad/gLIomAq9aW8yWDBtMthhQ==}
|
||||
peerDependencies:
|
||||
msw: ^2.4.9
|
||||
vite: ^5.0.0
|
||||
peerDependenciesMeta:
|
||||
msw:
|
||||
optional: true
|
||||
vite:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@vitest/spy': 2.1.5
|
||||
estree-walker: 3.0.3
|
||||
magic-string: 0.30.12
|
||||
msw: 2.6.4(@types/node@18.19.64)(typescript@5.6.3)
|
||||
dev: false
|
||||
|
||||
/@vitest/mocker@2.1.5(vite@5.4.10):
|
||||
resolution: {integrity: sha512-XYW6l3UuBmitWqSUXTNXcVBUCRytDogBsWuNXQijc00dtnU/9OqpXWp4OJroVrad/gLIomAq9aW8yWDBtMthhQ==}
|
||||
peerDependencies:
|
||||
msw: ^2.4.9
|
||||
vite: ^5.0.0
|
||||
peerDependenciesMeta:
|
||||
msw:
|
||||
optional: true
|
||||
vite:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@vitest/spy': 2.1.5
|
||||
estree-walker: 3.0.3
|
||||
magic-string: 0.30.12
|
||||
vite: 5.4.10(@types/node@18.19.64)
|
||||
dev: false
|
||||
|
||||
/@vitest/pretty-format@2.1.4:
|
||||
resolution: {integrity: sha512-L95zIAkEuTDbUX1IsjRl+vyBSLh3PwLLgKpghl37aCK9Jvw0iP+wKwIFhfjdUtA2myLgjrG6VU6JCFLv8q/3Ww==}
|
||||
dependencies:
|
||||
tinyrainbow: 1.2.0
|
||||
dev: false
|
||||
|
||||
/@vitest/pretty-format@2.1.5:
|
||||
resolution: {integrity: sha512-4ZOwtk2bqG5Y6xRGHcveZVr+6txkH7M2e+nPFd6guSoN638v/1XQ0K06eOpi0ptVU/2tW/pIU4IoPotY/GZ9fw==}
|
||||
dependencies:
|
||||
tinyrainbow: 1.2.0
|
||||
dev: false
|
||||
|
||||
/@vitest/runner@1.6.0:
|
||||
resolution: {integrity: sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==}
|
||||
dependencies:
|
||||
|
@ -4625,6 +4748,13 @@ packages:
|
|||
pathe: 1.1.2
|
||||
dev: false
|
||||
|
||||
/@vitest/runner@2.1.5:
|
||||
resolution: {integrity: sha512-pKHKy3uaUdh7X6p1pxOkgkVAFW7r2I818vHDthYLvUyjRfkKOU6P45PztOch4DZarWQne+VOaIMwA/erSSpB9g==}
|
||||
dependencies:
|
||||
'@vitest/utils': 2.1.5
|
||||
pathe: 1.1.2
|
||||
dev: false
|
||||
|
||||
/@vitest/snapshot@1.6.0:
|
||||
resolution: {integrity: sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==}
|
||||
dependencies:
|
||||
|
@ -4641,6 +4771,14 @@ packages:
|
|||
pathe: 1.1.2
|
||||
dev: false
|
||||
|
||||
/@vitest/snapshot@2.1.5:
|
||||
resolution: {integrity: sha512-zmYw47mhfdfnYbuhkQvkkzYroXUumrwWDGlMjpdUr4jBd3HZiV2w7CQHj+z7AAS4VOtWxI4Zt4bWt4/sKcoIjg==}
|
||||
dependencies:
|
||||
'@vitest/pretty-format': 2.1.5
|
||||
magic-string: 0.30.12
|
||||
pathe: 1.1.2
|
||||
dev: false
|
||||
|
||||
/@vitest/spy@1.6.0:
|
||||
resolution: {integrity: sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==}
|
||||
dependencies:
|
||||
|
@ -4653,6 +4791,12 @@ packages:
|
|||
tinyspy: 3.0.2
|
||||
dev: false
|
||||
|
||||
/@vitest/spy@2.1.5:
|
||||
resolution: {integrity: sha512-aWZF3P0r3w6DiYTVskOYuhBc7EMc3jvn1TkBg8ttylFFRqNN2XGD7V5a4aQdk6QiUzZQ4klNBSpCLJgWNdIiNw==}
|
||||
dependencies:
|
||||
tinyspy: 3.0.2
|
||||
dev: false
|
||||
|
||||
/@vitest/utils@1.6.0:
|
||||
resolution: {integrity: sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==}
|
||||
dependencies:
|
||||
|
@ -4670,6 +4814,14 @@ packages:
|
|||
tinyrainbow: 1.2.0
|
||||
dev: false
|
||||
|
||||
/@vitest/utils@2.1.5:
|
||||
resolution: {integrity: sha512-yfj6Yrp0Vesw2cwJbP+cl04OC+IHFsuQsrsJBL9pyGeQXE56v1UAOQco+SR55Vf1nQzfV0QJg1Qum7AaWUwwYg==}
|
||||
dependencies:
|
||||
'@vitest/pretty-format': 2.1.5
|
||||
loupe: 3.1.2
|
||||
tinyrainbow: 1.2.0
|
||||
dev: false
|
||||
|
||||
/abort-controller@3.0.0:
|
||||
resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}
|
||||
engines: {node: '>=6.5'}
|
||||
|
@ -6037,6 +6189,10 @@ packages:
|
|||
engines: {node: '>= 0.4'}
|
||||
dev: false
|
||||
|
||||
/es-module-lexer@1.5.4:
|
||||
resolution: {integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==}
|
||||
dev: false
|
||||
|
||||
/es6-error@4.1.1:
|
||||
resolution: {integrity: sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==}
|
||||
dev: false
|
||||
|
@ -8569,6 +8725,40 @@ packages:
|
|||
- '@types/node'
|
||||
dev: false
|
||||
|
||||
/msw@2.6.4(@types/node@18.19.64)(typescript@5.6.3):
|
||||
resolution: {integrity: sha512-Pm4LmWQeytDsNCR+A7gt39XAdtH6zQb6jnIKRig0FlvYOn8eksn3s1nXxUfz5KYUjbckof7Z4p2ewzgffPoCbg==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
peerDependencies:
|
||||
typescript: '>= 4.8.x'
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@bundled-es-modules/cookie': 2.0.1
|
||||
'@bundled-es-modules/statuses': 1.0.1
|
||||
'@bundled-es-modules/tough-cookie': 0.1.6
|
||||
'@inquirer/confirm': 5.0.1(@types/node@18.19.64)
|
||||
'@mswjs/interceptors': 0.36.9
|
||||
'@open-draft/deferred-promise': 2.2.0
|
||||
'@open-draft/until': 2.1.0
|
||||
'@types/cookie': 0.6.0
|
||||
'@types/statuses': 2.0.5
|
||||
chalk: 4.1.2
|
||||
graphql: 16.9.0
|
||||
headers-polyfill: 4.0.3
|
||||
is-node-process: 1.2.0
|
||||
outvariant: 1.4.3
|
||||
path-to-regexp: 6.3.0
|
||||
strict-event-emitter: 0.5.1
|
||||
type-fest: 4.26.1
|
||||
typescript: 5.6.3
|
||||
yargs: 17.7.2
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
dev: false
|
||||
|
||||
/mustache@4.2.0:
|
||||
resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==}
|
||||
hasBin: true
|
||||
|
@ -10185,6 +10375,10 @@ packages:
|
|||
resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==}
|
||||
dev: false
|
||||
|
||||
/std-env@3.8.0:
|
||||
resolution: {integrity: sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==}
|
||||
dev: false
|
||||
|
||||
/stoppable@1.1.0:
|
||||
resolution: {integrity: sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==}
|
||||
engines: {node: '>=4', npm: '>=6'}
|
||||
|
@ -11134,6 +11328,28 @@ packages:
|
|||
- terser
|
||||
dev: false
|
||||
|
||||
/vite-node@2.1.5(@types/node@18.19.64):
|
||||
resolution: {integrity: sha512-rd0QIgx74q4S1Rd56XIiL2cYEdyWn13cunYBIuqh9mpmQr7gGS0IxXoP8R6OaZtNQQLyXSWbd4rXKYUbhFpK5w==}
|
||||
engines: {node: ^18.0.0 || >=20.0.0}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
cac: 6.7.14
|
||||
debug: 4.3.7(supports-color@8.1.1)
|
||||
es-module-lexer: 1.5.4
|
||||
pathe: 1.1.2
|
||||
vite: 5.4.10(@types/node@18.19.64)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- less
|
||||
- lightningcss
|
||||
- sass
|
||||
- sass-embedded
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
dev: false
|
||||
|
||||
/vite@5.4.10(@types/node@18.19.64):
|
||||
resolution: {integrity: sha512-1hvaPshuPUtxeQ0hsVH3Mud0ZanOLwVTneA1EgbAM5LhaZEqyPWGRQ7BtaMvUrTDeEaC8pxtj6a6jku3x4z6SQ==}
|
||||
engines: {node: ^18.0.0 || >=20.0.0}
|
||||
|
@ -11387,6 +11603,65 @@ packages:
|
|||
- terser
|
||||
dev: false
|
||||
|
||||
/vitest@2.1.5(@types/node@18.19.64)(@vitest/browser@2.1.5):
|
||||
resolution: {integrity: sha512-P4ljsdpuzRTPI/kbND2sDZ4VmieerR2c9szEZpjc+98Z9ebvnXmM5+0tHEKqYZumXqlvnmfWsjeFOjXVriDG7A==}
|
||||
engines: {node: ^18.0.0 || >=20.0.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@edge-runtime/vm': '*'
|
||||
'@types/node': ^18.0.0 || >=20.0.0
|
||||
'@vitest/browser': 2.1.5
|
||||
'@vitest/ui': 2.1.5
|
||||
happy-dom: '*'
|
||||
jsdom: '*'
|
||||
peerDependenciesMeta:
|
||||
'@edge-runtime/vm':
|
||||
optional: true
|
||||
'@types/node':
|
||||
optional: true
|
||||
'@vitest/browser':
|
||||
optional: true
|
||||
'@vitest/ui':
|
||||
optional: true
|
||||
happy-dom:
|
||||
optional: true
|
||||
jsdom:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@types/node': 18.19.64
|
||||
'@vitest/browser': 2.1.5(@types/node@18.19.64)(playwright@1.48.2)(typescript@5.6.3)(vitest@2.1.5)
|
||||
'@vitest/expect': 2.1.5
|
||||
'@vitest/mocker': 2.1.5(vite@5.4.10)
|
||||
'@vitest/pretty-format': 2.1.5
|
||||
'@vitest/runner': 2.1.5
|
||||
'@vitest/snapshot': 2.1.5
|
||||
'@vitest/spy': 2.1.5
|
||||
'@vitest/utils': 2.1.5
|
||||
chai: 5.1.2
|
||||
debug: 4.3.7(supports-color@8.1.1)
|
||||
expect-type: 1.1.0
|
||||
magic-string: 0.30.12
|
||||
pathe: 1.1.2
|
||||
std-env: 3.8.0
|
||||
tinybench: 2.9.0
|
||||
tinyexec: 0.3.1
|
||||
tinypool: 1.0.1
|
||||
tinyrainbow: 1.2.0
|
||||
vite: 5.4.10(@types/node@18.19.64)
|
||||
vite-node: 2.1.5(@types/node@18.19.64)
|
||||
why-is-node-running: 2.3.0
|
||||
transitivePeerDependencies:
|
||||
- less
|
||||
- lightningcss
|
||||
- msw
|
||||
- sass
|
||||
- sass-embedded
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
dev: false
|
||||
|
||||
/void-elements@2.0.1:
|
||||
resolution: {integrity: sha512-qZKX4RnBzH2ugr8Lxa7x+0V6XD9Sb/ouARtiasEQCHB1EVU4NXtmHsDDrx1dO4ne5fc3J6EW05BP1Dl0z0iung==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
@ -18825,18 +19100,20 @@ packages:
|
|||
dev: false
|
||||
|
||||
file:projects/communication-identity.tgz:
|
||||
resolution: {integrity: sha512-qhM0Ig2VTC6fRQ0sjCP+8aYlz1m4yr+uC5vlhm/pXop87s6MyIIpZzHZH6MTijaIKKlTzZt+3dxYs/4XwqKVhA==, tarball: file:projects/communication-identity.tgz}
|
||||
resolution: {integrity: sha512-cHCdd2LiWjg4jftWNnziaCV9uNSMfkhoUDFlKBymYkvmj4dbrgoobwpuPOkqJ4zoB9r86aiRDNP/E0YmMF2RFw==, tarball: file:projects/communication-identity.tgz}
|
||||
name: '@rush-temp/communication-identity'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure-tools/test-credential': 1.3.1
|
||||
'@azure-tools/test-recorder': 3.5.2
|
||||
'@azure/core-lro': 2.7.2
|
||||
'@azure/msal-node': 2.15.0
|
||||
'@azure/msal-node': 2.16.1
|
||||
'@types/chai': 4.3.20
|
||||
'@types/mocha': 10.0.9
|
||||
'@types/node': 18.19.64
|
||||
'@types/sinon': 17.0.3
|
||||
'@vitest/browser': 2.1.5(@types/node@18.19.64)(playwright@1.48.2)(typescript@5.6.3)(vitest@2.1.5)
|
||||
'@vitest/coverage-istanbul': 2.1.5(vitest@2.1.5)
|
||||
chai: 4.3.10
|
||||
dotenv: 16.4.5
|
||||
eslint: 9.14.0
|
||||
|
@ -18853,19 +19130,33 @@ packages:
|
|||
karma-sourcemap-loader: 0.3.8
|
||||
mocha: 10.8.2
|
||||
nyc: 17.1.0
|
||||
playwright: 1.48.2
|
||||
process: 0.11.10
|
||||
sinon: 17.0.1
|
||||
ts-node: 10.9.2(@types/node@18.19.64)(typescript@5.6.3)
|
||||
tslib: 2.8.1
|
||||
typescript: 5.6.3
|
||||
vitest: 2.1.5(@types/node@18.19.64)(@vitest/browser@2.1.5)
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
- '@swc/wasm'
|
||||
- '@edge-runtime/vm'
|
||||
- '@vitest/ui'
|
||||
- bufferutil
|
||||
- debug
|
||||
- happy-dom
|
||||
- jiti
|
||||
- jsdom
|
||||
- less
|
||||
- lightningcss
|
||||
- msw
|
||||
- safaridriver
|
||||
- sass
|
||||
- sass-embedded
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
- utf-8-validate
|
||||
- vite
|
||||
- webdriverio
|
||||
dev: false
|
||||
|
||||
file:projects/communication-job-router-1.tgz:
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"include": ["dist-esm/src/**/*.js"],
|
||||
"exclude": ["**/*.d.ts", "dist-esm/src/generated/*"],
|
||||
"reporter": ["text-summary", "html", "cobertura"],
|
||||
"exclude-after-remap": false,
|
||||
"sourceMap": true,
|
||||
"produce-source-map": true,
|
||||
"instrument": true,
|
||||
"all": true
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||
"mainEntryPointFilePath": "types/src/index.d.ts",
|
||||
"mainEntryPointFilePath": "dist/esm/index.d.ts",
|
||||
"docModel": {
|
||||
"enabled": true
|
||||
},
|
||||
|
@ -11,7 +11,7 @@
|
|||
"dtsRollup": {
|
||||
"enabled": true,
|
||||
"untrimmedFilePath": "",
|
||||
"publicTrimmedFilePath": "./types/communication-identity.d.ts"
|
||||
"publicTrimmedFilePath": "dist/communication-identity.d.ts"
|
||||
},
|
||||
"messages": {
|
||||
"tsdocMessageReporting": {
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
// https://github.com/karma-runner/karma-chrome-launcher
|
||||
process.env.CHROME_BIN = require("puppeteer").executablePath();
|
||||
require("dotenv").config();
|
||||
const { relativeRecordingsPath } = require("@azure-tools/test-recorder");
|
||||
|
||||
process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: "./",
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ["mocha"],
|
||||
|
||||
plugins: [
|
||||
"karma-mocha",
|
||||
"karma-mocha-reporter",
|
||||
"karma-chrome-launcher",
|
||||
"karma-firefox-launcher",
|
||||
"karma-env-preprocessor",
|
||||
"karma-coverage",
|
||||
"karma-sourcemap-loader",
|
||||
"karma-junit-reporter",
|
||||
],
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: ["dist-test/index.browser.js"],
|
||||
|
||||
// list of files / patterns to exclude
|
||||
exclude: [],
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
"**/*.js": ["sourcemap", "env"],
|
||||
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
|
||||
// Preprocess source file to calculate code coverage, however this will make source file unreadable
|
||||
//"dist-test/index.browser.js": ["coverage"]
|
||||
},
|
||||
|
||||
// inject following environment values into browser testing with window.__env__
|
||||
// environment values MUST be exported or set with same console running "karma start"
|
||||
// https://www.npmjs.com/package/karma-env-preprocessor
|
||||
envPreprocessor: [
|
||||
"TEST_MODE",
|
||||
"COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING",
|
||||
"INCLUDE_PHONENUMBER_TESTS",
|
||||
"COMMUNICATION_ENDPOINT",
|
||||
"AZURE_CLIENT_ID",
|
||||
"AZURE_CLIENT_SECRET",
|
||||
"AZURE_TENANT_ID",
|
||||
"RECORDINGS_RELATIVE_PATH",
|
||||
],
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ["mocha", "coverage", "junit"],
|
||||
|
||||
coverageReporter: {
|
||||
// specify a common output directory
|
||||
dir: "coverage-browser/",
|
||||
reporters: [
|
||||
{ type: "json", subdir: ".", file: "coverage.json" },
|
||||
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
|
||||
{ type: "html", subdir: "html" },
|
||||
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" },
|
||||
],
|
||||
},
|
||||
|
||||
junitReporter: {
|
||||
outputDir: "", // results will be saved as $outputDir/$browserName.xml
|
||||
outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile
|
||||
suite: "", // suite will become the package name attribute in xml testsuite element
|
||||
useBrowserName: false, // add browser name to report and classes names
|
||||
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
|
||||
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
|
||||
properties: {}, // key value pair of properties to add to the <properties> section of the report
|
||||
},
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: false,
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
// 'ChromeHeadless', 'Chrome', 'Firefox', 'Edge', 'IE'
|
||||
browsers: ["HeadlessChrome"],
|
||||
|
||||
customLaunchers: {
|
||||
HeadlessChrome: {
|
||||
base: "ChromeHeadless",
|
||||
flags: ["--no-sandbox", "--disable-web-security"],
|
||||
},
|
||||
},
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
singleRun: true,
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: 1,
|
||||
|
||||
browserNoActivityTimeout: 600000,
|
||||
browserDisconnectTimeout: 10000,
|
||||
browserDisconnectTolerance: 3,
|
||||
|
||||
client: {
|
||||
mocha: {
|
||||
// change Karma's debug.html to the mocha web reporter
|
||||
reporter: "html",
|
||||
timeout: "600000",
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
|
@ -3,27 +3,26 @@
|
|||
"version": "1.3.2",
|
||||
"description": "SDK for Azure Communication service which facilitates user token administration.",
|
||||
"sdk-type": "client",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist-esm/src/index.js",
|
||||
"types": "types/communication-identity.d.ts",
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"module": "./dist/esm/index.js",
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "npm run clean && tsc -p . && dev-tool run bundle && dev-tool run extract-api",
|
||||
"build:browser": "tsc -p . && dev-tool run bundle",
|
||||
"build:clean": "rush update --recheck && rush rebuild && npm run build",
|
||||
"build:node": "tsc -p . && dev-tool run bundle",
|
||||
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
||||
"build:browser": "dev-tool run build-package && dev-tool run bundle",
|
||||
"build:node": "dev-tool run build-package && dev-tool run bundle",
|
||||
"build:samples": "echo Obsolete.",
|
||||
"build:test": "tsc -p . && dev-tool run bundle",
|
||||
"build:test": "dev-tool run build-package && dev-tool run bundle",
|
||||
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
||||
"clean": "dev-tool run vendored rimraf --glob dist dist-* temp types *.tgz *.log",
|
||||
"execute:js-samples": "dev-tool samples run dist-samples/javascript",
|
||||
"execute:samples": "dev-tool samples run samples-dev",
|
||||
"execute:ts-samples": "dev-tool samples run dist-samples/typescript/dist/dist-samples/typescript/src/",
|
||||
"extract-api": "tsc -p . && dev-tool run extract-api",
|
||||
"extract-api": "dev-tool run build-package && dev-tool run extract-api",
|
||||
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
||||
"generate:client": "autorest --typescript ./swagger/README.md && rushx format",
|
||||
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|
||||
"integration-test:browser": "dev-tool run test:browser",
|
||||
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 --exclude 'dist-esm/test/**/browser/*.spec.js' 'dist-esm/test/**/*.spec.js'",
|
||||
"integration-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
||||
"integration-test:node": "dev-tool run test:vitest",
|
||||
"lint": "eslint package.json api-extractor.json README.md src test",
|
||||
"lint:fix": "eslint package.json api-extractor.json README.md src test --fix --fix-type [problem,suggestion]",
|
||||
"pack": "npm pack 2>&1",
|
||||
|
@ -32,8 +31,8 @@
|
|||
"test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
|
||||
"test:watch": "npm run test -- --watch --reporter min",
|
||||
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
||||
"unit-test:browser": "dev-tool run test:browser",
|
||||
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'",
|
||||
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
||||
"unit-test:node": "dev-tool run test:vitest",
|
||||
"update-snippets": "echo skipped"
|
||||
},
|
||||
"//metadata": {
|
||||
|
@ -71,8 +70,6 @@
|
|||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
"dist-esm/src/",
|
||||
"types/communication-identity.d.ts",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
|
@ -94,49 +91,72 @@
|
|||
"sideEffects": false,
|
||||
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/abort-controller": "^2.1.2",
|
||||
"@azure/communication-common": "^2.3.1",
|
||||
"@azure/core-auth": "^1.3.2",
|
||||
"@azure/core-client": "^1.6.0",
|
||||
"@azure/core-auth": "^1.9.0",
|
||||
"@azure/core-client": "^1.9.2",
|
||||
"@azure/core-lro": "^2.2.0",
|
||||
"@azure/core-paging": "^1.1.1",
|
||||
"@azure/core-rest-pipeline": "^1.3.0",
|
||||
"@azure/core-tracing": "^1.0.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"@azure/core-paging": "^1.6.2",
|
||||
"@azure/core-rest-pipeline": "^1.18.0",
|
||||
"@azure/core-tracing": "^1.2.0",
|
||||
"@azure/logger": "^1.1.4",
|
||||
"events": "^3.0.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@azure-tools/test-credential": "^1.0.0",
|
||||
"@azure-tools/test-recorder": "^3.0.0",
|
||||
"@azure-tools/test-utils": "^1.0.1",
|
||||
"@azure-tools/test-credential": "^2.0.0",
|
||||
"@azure-tools/test-recorder": "^4.1.0",
|
||||
"@azure-tools/test-utils-vitest": "^1.0.0",
|
||||
"@azure/core-util": "^1.6.1",
|
||||
"@azure/dev-tool": "^1.0.0",
|
||||
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
||||
"@azure/identity": "^4.0.1",
|
||||
"@azure/msal-node": "^2.9.2",
|
||||
"@types/chai": "^4.1.6",
|
||||
"@types/mocha": "^10.0.0",
|
||||
"@azure/identity": "^4.5.0",
|
||||
"@azure/msal-node": "^2.16.1",
|
||||
"@types/node": "^18.0.0",
|
||||
"@types/sinon": "^17.0.0",
|
||||
"chai": "^4.2.0",
|
||||
"@vitest/browser": "^2.1.5",
|
||||
"@vitest/coverage-istanbul": "^2.1.5",
|
||||
"dotenv": "^16.0.0",
|
||||
"eslint": "^9.9.0",
|
||||
"inherits": "^2.0.3",
|
||||
"karma": "^6.2.0",
|
||||
"karma-chrome-launcher": "^3.0.0",
|
||||
"karma-coverage": "^2.0.0",
|
||||
"karma-env-preprocessor": "^0.1.1",
|
||||
"karma-firefox-launcher": "^1.1.0",
|
||||
"karma-junit-reporter": "^2.0.1",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"karma-mocha-reporter": "^2.2.5",
|
||||
"karma-sourcemap-loader": "^0.3.8",
|
||||
"mocha": "^10.0.0",
|
||||
"nyc": "^17.0.0",
|
||||
"process": "^0.11.10",
|
||||
"sinon": "^17.0.0",
|
||||
"ts-node": "^10.0.0",
|
||||
"typescript": "~5.6.2"
|
||||
"playwright": "^1.48.2",
|
||||
"typescript": "~5.6.2",
|
||||
"vitest": "^2.1.5"
|
||||
},
|
||||
"type": "module",
|
||||
"tshy": {
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./src/index.ts"
|
||||
},
|
||||
"dialects": [
|
||||
"esm",
|
||||
"commonjs"
|
||||
],
|
||||
"esmDialects": [
|
||||
"browser",
|
||||
"react-native"
|
||||
],
|
||||
"selfLink": false
|
||||
},
|
||||
"browser": "./dist/browser/index.js",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"browser": {
|
||||
"types": "./dist/browser/index.d.ts",
|
||||
"default": "./dist/browser/index.js"
|
||||
},
|
||||
"react-native": {
|
||||
"types": "./dist/react-native/index.d.ts",
|
||||
"default": "./dist/react-native/index.js"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { CommunicationIdentityClient, TokenScope } from "@azure/communication-identity";
|
||||
import { CreateUserAndTokenOptions } from "../src";
|
||||
import { CreateUserAndTokenOptions } from "../src/index.js";
|
||||
|
||||
// Load the .env file if it exists
|
||||
import * as dotenv from "dotenv";
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
TokenScope,
|
||||
} from "@azure/communication-identity";
|
||||
|
||||
import { GetTokenOptions } from "../src";
|
||||
import { GetTokenOptions } from "../src/index.js";
|
||||
|
||||
// Load the .env file if it exists
|
||||
import * as dotenv from "dotenv";
|
||||
|
|
|
@ -9,7 +9,7 @@ import type {
|
|||
CreateUserAndTokenOptions,
|
||||
GetTokenOptions,
|
||||
TokenScope,
|
||||
} from "./models";
|
||||
} from "./models.js";
|
||||
import type { CommunicationUserIdentifier } from "@azure/communication-common";
|
||||
import {
|
||||
createCommunicationAuthPolicy,
|
||||
|
@ -19,9 +19,9 @@ import {
|
|||
import type { InternalClientPipelineOptions, OperationOptions } from "@azure/core-client";
|
||||
import type { KeyCredential, TokenCredential } from "@azure/core-auth";
|
||||
import { isTokenCredential } from "@azure/core-auth";
|
||||
import { IdentityRestClient } from "./generated/src/identityRestClient";
|
||||
import { logger } from "./common/logger";
|
||||
import { tracingClient } from "./generated/src/tracing";
|
||||
import { IdentityRestClient } from "./generated/src/identityRestClient.js";
|
||||
import { logger } from "./common/logger.js";
|
||||
import { tracingClient } from "./generated/src/tracing.js";
|
||||
|
||||
const isCommunicationIdentityClientOptions = (
|
||||
options: any,
|
||||
|
|
|
@ -12,9 +12,9 @@ import {
|
|||
PipelineResponse,
|
||||
SendRequest
|
||||
} from "@azure/core-rest-pipeline";
|
||||
import { CommunicationIdentityOperationsImpl } from "./operations";
|
||||
import { CommunicationIdentityOperations } from "./operationsInterfaces";
|
||||
import { IdentityRestClientOptionalParams } from "./models";
|
||||
import { CommunicationIdentityOperationsImpl } from "./operations/index.js";
|
||||
import { CommunicationIdentityOperations } from "./operationsInterfaces/index.js";
|
||||
import { IdentityRestClientOptionalParams } from "./models/index.js";
|
||||
|
||||
export class IdentityRestClient extends coreClient.ServiceClient {
|
||||
endpoint: string;
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
export * from "./models";
|
||||
export { IdentityRestClient } from "./identityRestClient";
|
||||
export * from "./operationsInterfaces";
|
||||
export * from "./models/index.js";
|
||||
export { IdentityRestClient } from "./identityRestClient.js";
|
||||
export * from "./operationsInterfaces/index.js";
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
CommunicationIdentityCreateRequest as CommunicationIdentityCreateRequestMapper,
|
||||
TeamsUserExchangeTokenRequest as TeamsUserExchangeTokenRequestMapper,
|
||||
CommunicationIdentityAccessTokenRequest as CommunicationIdentityAccessTokenRequestMapper
|
||||
} from "../models/mappers";
|
||||
} from "../models/mappers.js";
|
||||
|
||||
export const contentType: OperationParameter = {
|
||||
parameterPath: ["options", "contentType"],
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
import { tracingClient } from "../tracing";
|
||||
import { CommunicationIdentityOperations } from "../operationsInterfaces";
|
||||
import { tracingClient } from "../tracing.js";
|
||||
import { CommunicationIdentityOperations } from "../operationsInterfaces/index.js";
|
||||
import * as coreClient from "@azure/core-client";
|
||||
import * as Mappers from "../models/mappers";
|
||||
import * as Parameters from "../models/parameters";
|
||||
import { IdentityRestClient } from "../identityRestClient";
|
||||
import * as Mappers from "../models/mappers.js";
|
||||
import * as Parameters from "../models/parameters.js";
|
||||
import { IdentityRestClient } from "../identityRestClient.js";
|
||||
import {
|
||||
CommunicationIdentityCreateOptionalParams,
|
||||
CommunicationIdentityCreateResponse,
|
||||
|
@ -22,7 +22,7 @@ import {
|
|||
CommunicationIdentityTokenScope,
|
||||
CommunicationIdentityIssueAccessTokenOptionalParams,
|
||||
CommunicationIdentityIssueAccessTokenResponse
|
||||
} from "../models";
|
||||
} from "../models/index.js";
|
||||
|
||||
/** Class containing CommunicationIdentityOperations operations. */
|
||||
export class CommunicationIdentityOperationsImpl
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
export * from "./communicationIdentityOperations";
|
||||
export * from "./communicationIdentityOperations.js";
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
CommunicationIdentityTokenScope,
|
||||
CommunicationIdentityIssueAccessTokenOptionalParams,
|
||||
CommunicationIdentityIssueAccessTokenResponse
|
||||
} from "../models";
|
||||
} from "../models/index.js";
|
||||
|
||||
/** Interface representing a CommunicationIdentityOperations. */
|
||||
export interface CommunicationIdentityOperations {
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
export * from "./communicationIdentityOperations";
|
||||
export * from "./communicationIdentityOperations.js";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
export * from "./communicationIdentityClient";
|
||||
export * from "./models";
|
||||
export * from "./communicationIdentityClient.js";
|
||||
export * from "./models.js";
|
||||
|
|
|
@ -3,38 +3,33 @@
|
|||
|
||||
import type { CommunicationUserIdentifier } from "@azure/communication-common";
|
||||
import { isCommunicationUserIdentifier } from "@azure/communication-common";
|
||||
import { getTokenForTeamsUserHttpClient, getTokenHttpClient } from "./utils/mockHttpClients";
|
||||
import { CommunicationIdentityClient } from "../../src";
|
||||
import { TestCommunicationIdentityClient } from "./utils/testCommunicationIdentityClient";
|
||||
import { assert } from "chai";
|
||||
import { isNode } from "@azure/core-util";
|
||||
import sinon from "sinon";
|
||||
import { getTokenForTeamsUserHttpClient, getTokenHttpClient } from "./utils/mockHttpClients.js";
|
||||
import { CommunicationIdentityClient } from "../../src/index.js";
|
||||
import { TestCommunicationIdentityClient } from "./utils/testCommunicationIdentityClient.js";
|
||||
import { isNodeLike } from "@azure/core-util";
|
||||
import { describe, it, assert, expect, vi } from "vitest";
|
||||
|
||||
describe("CommunicationIdentityClient [Mocked]", function () {
|
||||
describe("CommunicationIdentityClient [Mocked]", () => {
|
||||
const dateHeader = "x-ms-date";
|
||||
const user: CommunicationUserIdentifier = { communicationUserId: "ACS_ID" };
|
||||
|
||||
afterEach(function () {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
it("creates instance of CommunicationIdentityClient", function () {
|
||||
it("creates instance of CommunicationIdentityClient", () => {
|
||||
const client = new CommunicationIdentityClient(
|
||||
"endpoint=https://contoso.spool.azure.local;accesskey=banana",
|
||||
);
|
||||
assert.instanceOf(client, CommunicationIdentityClient);
|
||||
});
|
||||
|
||||
it("sets correct headers", async function () {
|
||||
it("sets correct headers", async () => {
|
||||
const client = new TestCommunicationIdentityClient();
|
||||
const spy = sinon.spy(getTokenHttpClient, "sendRequest");
|
||||
const spy = vi.spyOn(getTokenHttpClient, "sendRequest");
|
||||
|
||||
await client.getTokenTest(user, ["chat"]);
|
||||
sinon.assert.calledOnce(spy);
|
||||
expect(spy).toHaveBeenCalledOnce();
|
||||
|
||||
const request = spy.getCall(0).args[0];
|
||||
const request = spy.mock.calls[0][0];
|
||||
|
||||
if (isNode) {
|
||||
if (isNodeLike) {
|
||||
assert.equal(request.headers.get("host"), "contoso.spool.azure.local");
|
||||
}
|
||||
|
||||
|
@ -46,27 +41,27 @@ describe("CommunicationIdentityClient [Mocked]", function () {
|
|||
);
|
||||
});
|
||||
|
||||
it("sends scopes in issue token request", async function () {
|
||||
it("sends scopes in issue token request", async () => {
|
||||
const client = new TestCommunicationIdentityClient();
|
||||
const spy = sinon.spy(getTokenHttpClient, "sendRequest");
|
||||
const spy = vi.spyOn(getTokenHttpClient, "sendRequest");
|
||||
const response = await client.getTokenTest(user, ["chat"]);
|
||||
|
||||
assert.equal(response.token, "token");
|
||||
assert.equal(response.expiresOn.toDateString(), new Date("2011/11/30").toDateString());
|
||||
sinon.assert.calledOnce(spy);
|
||||
expect(spy).toHaveBeenCalledOnce();
|
||||
|
||||
const request = spy.getCall(0).args[0];
|
||||
const request = spy.mock.calls[0][0];
|
||||
assert.deepEqual(JSON.parse(request.body as string), { scopes: ["chat"] });
|
||||
});
|
||||
|
||||
it("[getToken] excludes _response from results", async function () {
|
||||
it("[getToken] excludes _response from results", async () => {
|
||||
const client = new TestCommunicationIdentityClient();
|
||||
const response = await client.getTokenTest(user, ["chat"]);
|
||||
|
||||
assert.isFalse("_response" in response);
|
||||
});
|
||||
|
||||
it("[createUser] excludes _response from results", async function () {
|
||||
it("[createUser] excludes _response from results", async () => {
|
||||
const client = new TestCommunicationIdentityClient();
|
||||
const newUser = await client.createUserTest();
|
||||
|
||||
|
@ -75,17 +70,17 @@ describe("CommunicationIdentityClient [Mocked]", function () {
|
|||
assert.isFalse("_response" in newUser);
|
||||
});
|
||||
|
||||
it("exchanges Teams token for ACS token", async function () {
|
||||
it("exchanges Teams token for ACS token", async () => {
|
||||
const client = new TestCommunicationIdentityClient();
|
||||
const spy = sinon.spy(getTokenForTeamsUserHttpClient, "sendRequest");
|
||||
const spy = vi.spyOn(getTokenForTeamsUserHttpClient, "sendRequest");
|
||||
const response = await client.getTokenForTeamsUserTest("TeamsToken", "appId", "userId");
|
||||
|
||||
assert.equal(response.token, "token");
|
||||
assert.equal(response.expiresOn.toDateString(), new Date("2011/11/30").toDateString());
|
||||
sinon.assert.calledOnce(spy);
|
||||
expect(spy).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("[getTokenForTeamsUser] excludes _response from results", async function () {
|
||||
it("[getTokenForTeamsUser] excludes _response from results", async () => {
|
||||
const client = new TestCommunicationIdentityClient();
|
||||
const response = await client.getTokenForTeamsUserTest("TeamsToken", "appId", "userId");
|
||||
|
||||
|
|
|
@ -8,14 +8,13 @@ import { isPlaybackMode } from "@azure-tools/test-recorder";
|
|||
import {
|
||||
createRecordedCommunicationIdentityClient,
|
||||
createRecordedCommunicationIdentityClientWithToken,
|
||||
} from "./utils/recordedClient";
|
||||
import type { CommunicationIdentityClient, TokenScope } from "../../src";
|
||||
import type { Context } from "mocha";
|
||||
import { assert } from "chai";
|
||||
import { matrix } from "@azure-tools/test-utils";
|
||||
} from "./utils/recordedClient.js";
|
||||
import type { CommunicationIdentityClient, TokenScope } from "../../src/index.js";
|
||||
import { matrix } from "@azure-tools/test-utils-vitest";
|
||||
import { describe, it, assert, beforeEach, afterEach } from "vitest";
|
||||
|
||||
matrix([[true, false]], async function (useAad: boolean) {
|
||||
describe(`CommunicationIdentityClient [Playback/Live]${useAad ? " [AAD]" : ""}`, function () {
|
||||
matrix([[true, false]], async (useAad: boolean) => {
|
||||
describe(`CommunicationIdentityClient [Playback/Live]${useAad ? " [AAD]" : ""}`, () => {
|
||||
let recorder: Recorder;
|
||||
let client: CommunicationIdentityClient;
|
||||
|
||||
|
@ -33,27 +32,27 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
{ scopes: ["chat.join", "voip.join"], description: "ChatJoinVoipJoinScopes" },
|
||||
];
|
||||
|
||||
beforeEach(async function (this: Context) {
|
||||
beforeEach(async (ctx) => {
|
||||
if (useAad) {
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClientWithToken(this));
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClientWithToken(ctx));
|
||||
} else {
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClient(this));
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClient(ctx));
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(async function (this: Context) {
|
||||
if (!this.currentTest?.isPending()) {
|
||||
afterEach(async (ctx) => {
|
||||
if (!ctx.task.pending) {
|
||||
await recorder.stop();
|
||||
}
|
||||
});
|
||||
|
||||
it("successfully creates a user", async function () {
|
||||
it("successfully creates a user", async () => {
|
||||
const user: CommunicationUserIdentifier = await client.createUser();
|
||||
assert.isString(user.communicationUserId);
|
||||
});
|
||||
|
||||
tokenScopeScenarios.forEach((scenario) =>
|
||||
it(`successfully creates a user and token <${scenario.description}>`, async function () {
|
||||
it(`successfully creates a user and token <${scenario.description}>`, async () => {
|
||||
const {
|
||||
user: newUser,
|
||||
token,
|
||||
|
@ -67,7 +66,7 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
);
|
||||
|
||||
tokenScopeScenarios.forEach((scenario) =>
|
||||
it(`successfully gets a token for a user <${scenario.description}>`, async function () {
|
||||
it(`successfully gets a token for a user <${scenario.description}>`, async () => {
|
||||
const user: CommunicationUserIdentifier = await client.createUser();
|
||||
const { token, expiresOn } = await client.getToken(user, scenario.scopes as TokenScope[]);
|
||||
assert.isString(token);
|
||||
|
@ -75,24 +74,24 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
}),
|
||||
);
|
||||
|
||||
it("successfully revokes tokens issued for a user", async function () {
|
||||
it("successfully revokes tokens issued for a user", async () => {
|
||||
const { user } = await client.createUserAndToken(scopes);
|
||||
await client.revokeTokens(user);
|
||||
});
|
||||
|
||||
it("successfully deletes a user", async function () {
|
||||
it("successfully deletes a user", async () => {
|
||||
const user: CommunicationUserIdentifier = await client.createUser();
|
||||
await client.deleteUser(user);
|
||||
});
|
||||
|
||||
describe("Error Cases: ", async function () {
|
||||
describe("Error Cases: ", async () => {
|
||||
const fakeUser: CommunicationUserIdentifier = {
|
||||
communicationUserId: isPlaybackMode()
|
||||
? "sanitized"
|
||||
: "8:acs:00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000",
|
||||
};
|
||||
|
||||
it("throws an error when attempting to issue a token without any scopes", async function () {
|
||||
it("throws an error when attempting to issue a token without any scopes", async () => {
|
||||
try {
|
||||
const user: CommunicationUserIdentifier = await client.createUser();
|
||||
await client.getToken(user, []);
|
||||
|
@ -103,7 +102,7 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
}
|
||||
});
|
||||
|
||||
it("throws an error when attempting to issue a token for an invalid user", async function () {
|
||||
it("throws an error when attempting to issue a token for an invalid user", async () => {
|
||||
try {
|
||||
await client.getToken(fakeUser, scopes);
|
||||
assert.fail("Should have thrown an error");
|
||||
|
@ -112,7 +111,7 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
}
|
||||
});
|
||||
|
||||
it("throws an error when attempting to revoke a token from an invalid user", async function () {
|
||||
it("throws an error when attempting to revoke a token from an invalid user", async () => {
|
||||
try {
|
||||
await client.revokeTokens(fakeUser);
|
||||
assert.fail("Should have thrown an error");
|
||||
|
@ -121,7 +120,7 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
}
|
||||
});
|
||||
|
||||
it("throws an error when attempting to delete an invalid user", async function () {
|
||||
it("throws an error when attempting to delete an invalid user", async () => {
|
||||
try {
|
||||
await client.deleteUser(fakeUser);
|
||||
assert.fail("Should have thrown an error");
|
||||
|
|
|
@ -5,158 +5,162 @@ import type {
|
|||
CommunicationAccessToken,
|
||||
CommunicationIdentityClient,
|
||||
GetTokenForTeamsUserOptions,
|
||||
} from "../../../src";
|
||||
} from "../../../src/index.js";
|
||||
import type { Recorder } from "@azure-tools/test-recorder";
|
||||
import { env, isPlaybackMode } from "@azure-tools/test-recorder";
|
||||
import {
|
||||
createRecordedCommunicationIdentityClient,
|
||||
createRecordedCommunicationIdentityClientWithToken,
|
||||
} from "../utils/recordedClient";
|
||||
} from "../utils/recordedClient.js";
|
||||
import { PublicClientApplication } from "@azure/msal-node";
|
||||
import { matrix } from "@azure-tools/test-utils";
|
||||
import type { Context } from "mocha";
|
||||
import { assert } from "chai";
|
||||
import { matrix } from "@azure-tools/test-utils-vitest";
|
||||
import { describe, it, assert, beforeEach, afterEach, beforeAll } from "vitest";
|
||||
|
||||
matrix([[true, false]], async function (useAad) {
|
||||
describe(`Get Token For Teams User [Playback/Live]${useAad ? " [AAD]" : ""}`, function () {
|
||||
let recorder: Recorder;
|
||||
let client: CommunicationIdentityClient;
|
||||
const sanitizedValue = "sanitized";
|
||||
let options: GetTokenForTeamsUserOptions = {
|
||||
teamsUserAadToken: sanitizedValue,
|
||||
clientId: sanitizedValue,
|
||||
userObjectId: sanitizedValue,
|
||||
};
|
||||
matrix([[true, false]], async (useAad) => {
|
||||
describe(
|
||||
`Get Token For Teams User [Playback/Live]${useAad ? " [AAD]" : ""}`,
|
||||
{ skip: env.SKIP_INT_IDENTITY_EXCHANGE_TOKEN_TEST === "true" },
|
||||
() => {
|
||||
let recorder: Recorder;
|
||||
let client: CommunicationIdentityClient;
|
||||
const sanitizedValue = "sanitized";
|
||||
let options: GetTokenForTeamsUserOptions = {
|
||||
teamsUserAadToken: sanitizedValue,
|
||||
clientId: sanitizedValue,
|
||||
userObjectId: sanitizedValue,
|
||||
};
|
||||
|
||||
before(async function (this: Context) {
|
||||
const skipTests = env.SKIP_INT_IDENTITY_EXCHANGE_TOKEN_TEST === "true";
|
||||
if (skipTests) {
|
||||
this.skip();
|
||||
}
|
||||
if (!isPlaybackMode()) {
|
||||
options = await fetchParamsForGetTokenForTeamsUser();
|
||||
}
|
||||
});
|
||||
beforeAll(async () => {
|
||||
if (!isPlaybackMode()) {
|
||||
options = await fetchParamsForGetTokenForTeamsUser();
|
||||
}
|
||||
});
|
||||
|
||||
beforeEach(async function (this: Context) {
|
||||
if (useAad) {
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClientWithToken(this));
|
||||
} else {
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClient(this));
|
||||
}
|
||||
});
|
||||
beforeEach(async (ctx) => {
|
||||
if (useAad) {
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClientWithToken(ctx));
|
||||
} else {
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClient(ctx));
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(async function (this: Context) {
|
||||
if (!this.currentTest?.isPending()) {
|
||||
await recorder.stop();
|
||||
}
|
||||
});
|
||||
afterEach(async (ctx) => {
|
||||
if (!ctx.task.pending) {
|
||||
await recorder.stop();
|
||||
}
|
||||
});
|
||||
|
||||
async function fetchParamsForGetTokenForTeamsUser(): Promise<GetTokenForTeamsUserOptions> {
|
||||
const msalConfig = {
|
||||
auth: {
|
||||
async function fetchParamsForGetTokenForTeamsUser(): Promise<GetTokenForTeamsUserOptions> {
|
||||
const msalConfig = {
|
||||
auth: {
|
||||
clientId: env.COMMUNICATION_M365_APP_ID ?? "",
|
||||
authority:
|
||||
env.COMMUNICATION_M365_AAD_AUTHORITY + "/" + env.COMMUNICATION_M365_AAD_TENANT,
|
||||
},
|
||||
};
|
||||
const msalInstance = new PublicClientApplication(msalConfig);
|
||||
const usernamePasswordRequest = {
|
||||
scopes: [
|
||||
"https://auth.msft.communication.azure.com/Teams.ManageCalls",
|
||||
"https://auth.msft.communication.azure.com/Teams.ManageChats",
|
||||
],
|
||||
username: env.COMMUNICATION_MSAL_USERNAME ?? "",
|
||||
password: env.COMMUNICATION_MSAL_PASSWORD ?? "",
|
||||
};
|
||||
const response = await msalInstance.acquireTokenByUsernamePassword(usernamePasswordRequest);
|
||||
const getTokenForTeamsUserOptions: GetTokenForTeamsUserOptions = {
|
||||
teamsUserAadToken: response!.accessToken,
|
||||
clientId: env.COMMUNICATION_M365_APP_ID ?? "",
|
||||
authority: env.COMMUNICATION_M365_AAD_AUTHORITY + "/" + env.COMMUNICATION_M365_AAD_TENANT,
|
||||
userObjectId: response!.uniqueId,
|
||||
};
|
||||
return getTokenForTeamsUserOptions;
|
||||
}
|
||||
|
||||
it(
|
||||
"successfully exchanges a Teams User AAD token for a Communication access token",
|
||||
{ timeout: 5000 },
|
||||
async () => {
|
||||
const { token, expiresOn }: CommunicationAccessToken =
|
||||
await client.getTokenForTeamsUser(options);
|
||||
assert.isString(token);
|
||||
assert.instanceOf(expiresOn, Date);
|
||||
},
|
||||
};
|
||||
const msalInstance = new PublicClientApplication(msalConfig);
|
||||
const usernamePasswordRequest = {
|
||||
scopes: [
|
||||
"https://auth.msft.communication.azure.com/Teams.ManageCalls",
|
||||
"https://auth.msft.communication.azure.com/Teams.ManageChats",
|
||||
],
|
||||
username: env.COMMUNICATION_MSAL_USERNAME ?? "",
|
||||
password: env.COMMUNICATION_MSAL_PASSWORD ?? "",
|
||||
};
|
||||
const response = await msalInstance.acquireTokenByUsernamePassword(usernamePasswordRequest);
|
||||
const getTokenForTeamsUserOptions: GetTokenForTeamsUserOptions = {
|
||||
teamsUserAadToken: response!.accessToken,
|
||||
clientId: env.COMMUNICATION_M365_APP_ID ?? "",
|
||||
userObjectId: response!.uniqueId,
|
||||
};
|
||||
return getTokenForTeamsUserOptions;
|
||||
}
|
||||
);
|
||||
|
||||
it("successfully exchanges a Teams User AAD token for a Communication access token", async function () {
|
||||
const { token, expiresOn }: CommunicationAccessToken =
|
||||
await client.getTokenForTeamsUser(options);
|
||||
assert.isString(token);
|
||||
assert.instanceOf(expiresOn, Date);
|
||||
}).timeout(5000);
|
||||
|
||||
[
|
||||
{ teamsUserAadToken: "", description: "an empty teamsUserAadToken" },
|
||||
{ teamsUserAadToken: "invalid", description: "an invalid teamsUserAadToken" },
|
||||
{
|
||||
teamsUserAadToken: env.COMMUNICATION_EXPIRED_TEAMS_TOKEN ?? "",
|
||||
description: "an expired teamsUserAadToken",
|
||||
},
|
||||
].forEach((input) =>
|
||||
it(`throws an error when attempting to exchange <${input.description}>`, async function () {
|
||||
try {
|
||||
if (isPlaybackMode()) {
|
||||
input.teamsUserAadToken = sanitizedValue;
|
||||
[
|
||||
{ teamsUserAadToken: "", description: "an empty teamsUserAadToken" },
|
||||
{ teamsUserAadToken: "invalid", description: "an invalid teamsUserAadToken" },
|
||||
{
|
||||
teamsUserAadToken: env.COMMUNICATION_EXPIRED_TEAMS_TOKEN ?? "",
|
||||
description: "an expired teamsUserAadToken",
|
||||
},
|
||||
].forEach((input) =>
|
||||
it(`throws an error when attempting to exchange <${input.description}>`, async () => {
|
||||
try {
|
||||
if (isPlaybackMode()) {
|
||||
input.teamsUserAadToken = sanitizedValue;
|
||||
}
|
||||
await client.getTokenForTeamsUser({
|
||||
teamsUserAadToken: input.teamsUserAadToken,
|
||||
clientId: options.clientId,
|
||||
userObjectId: options.clientId,
|
||||
});
|
||||
} catch (e: any) {
|
||||
assert.equal(e.statusCode, 401);
|
||||
return;
|
||||
}
|
||||
await client.getTokenForTeamsUser({
|
||||
teamsUserAadToken: input.teamsUserAadToken,
|
||||
clientId: options.clientId,
|
||||
userObjectId: options.clientId,
|
||||
});
|
||||
} catch (e: any) {
|
||||
assert.equal(e.statusCode, 401);
|
||||
return;
|
||||
}
|
||||
|
||||
assert.fail("Should have thrown an error");
|
||||
}),
|
||||
);
|
||||
assert.fail("Should have thrown an error");
|
||||
}),
|
||||
);
|
||||
|
||||
[
|
||||
{ clientId: "", description: "an empty clientId" },
|
||||
{ clientId: "invalid", description: "an invalid clientId" },
|
||||
{ clientId: options.userObjectId, description: "a wrong clientId" },
|
||||
].forEach((input) =>
|
||||
it(`throws an error when attempting to exchange <${input.description}>`, async function () {
|
||||
try {
|
||||
if (isPlaybackMode()) {
|
||||
input.clientId = sanitizedValue;
|
||||
[
|
||||
{ clientId: "", description: "an empty clientId" },
|
||||
{ clientId: "invalid", description: "an invalid clientId" },
|
||||
{ clientId: options.userObjectId, description: "a wrong clientId" },
|
||||
].forEach((input) =>
|
||||
it(`throws an error when attempting to exchange <${input.description}>`, async () => {
|
||||
try {
|
||||
if (isPlaybackMode()) {
|
||||
input.clientId = sanitizedValue;
|
||||
}
|
||||
await client.getTokenForTeamsUser({
|
||||
teamsUserAadToken: options.teamsUserAadToken,
|
||||
clientId: input.clientId,
|
||||
userObjectId: options.userObjectId,
|
||||
});
|
||||
} catch (e: any) {
|
||||
assert.equal(e.statusCode, 400);
|
||||
return;
|
||||
}
|
||||
await client.getTokenForTeamsUser({
|
||||
teamsUserAadToken: options.teamsUserAadToken,
|
||||
clientId: input.clientId,
|
||||
userObjectId: options.userObjectId,
|
||||
});
|
||||
} catch (e: any) {
|
||||
assert.equal(e.statusCode, 400);
|
||||
return;
|
||||
}
|
||||
|
||||
assert.fail("Should have thrown an error");
|
||||
}),
|
||||
);
|
||||
assert.fail("Should have thrown an error");
|
||||
}),
|
||||
);
|
||||
|
||||
[
|
||||
{ userObjectId: "", description: "an empty userObjectId" },
|
||||
{ userObjectId: "invalid", description: "an invalid userObjectId" },
|
||||
{ userObjectId: options.clientId, description: "a wrong userObjectId" },
|
||||
].forEach((input) =>
|
||||
it(`throws an error when attempting to exchange <${input.description}>`, async function () {
|
||||
try {
|
||||
if (isPlaybackMode()) {
|
||||
input.userObjectId = sanitizedValue;
|
||||
[
|
||||
{ userObjectId: "", description: "an empty userObjectId" },
|
||||
{ userObjectId: "invalid", description: "an invalid userObjectId" },
|
||||
{ userObjectId: options.clientId, description: "a wrong userObjectId" },
|
||||
].forEach((input) =>
|
||||
it(`throws an error when attempting to exchange <${input.description}>`, async () => {
|
||||
try {
|
||||
if (isPlaybackMode()) {
|
||||
input.userObjectId = sanitizedValue;
|
||||
}
|
||||
await client.getTokenForTeamsUser({
|
||||
teamsUserAadToken: options.teamsUserAadToken,
|
||||
clientId: options.clientId,
|
||||
userObjectId: input.userObjectId,
|
||||
});
|
||||
} catch (e: any) {
|
||||
assert.equal(e.statusCode, 400);
|
||||
return;
|
||||
}
|
||||
await client.getTokenForTeamsUser({
|
||||
teamsUserAadToken: options.teamsUserAadToken,
|
||||
clientId: options.clientId,
|
||||
userObjectId: input.userObjectId,
|
||||
});
|
||||
} catch (e: any) {
|
||||
assert.equal(e.statusCode, 400);
|
||||
return;
|
||||
}
|
||||
|
||||
assert.fail("Should have thrown an error");
|
||||
}),
|
||||
);
|
||||
});
|
||||
assert.fail("Should have thrown an error");
|
||||
}),
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
|
@ -4,34 +4,31 @@
|
|||
import type { CommunicationUserIdentifier } from "@azure/communication-common";
|
||||
import type { Recorder } from "@azure-tools/test-recorder";
|
||||
import { isLiveMode } from "@azure-tools/test-recorder";
|
||||
import type { Context } from "mocha";
|
||||
import { assert } from "chai";
|
||||
import { matrix } from "@azure-tools/test-utils";
|
||||
import type { CommunicationIdentityClient } from "../../../src/communicationIdentityClient";
|
||||
import { matrix } from "@azure-tools/test-utils-vitest";
|
||||
import type { CommunicationIdentityClient } from "../../../src/communicationIdentityClient.js";
|
||||
import {
|
||||
createRecordedCommunicationIdentityClient,
|
||||
createRecordedCommunicationIdentityClientWithToken,
|
||||
} from "../utils/recordedClient";
|
||||
import type { CreateUserAndTokenOptions, GetTokenOptions } from "../../../src/models";
|
||||
} from "../utils/recordedClient.js";
|
||||
import type { CreateUserAndTokenOptions, GetTokenOptions } from "../../../src/models.js";
|
||||
import { describe, it, assert, beforeEach, afterEach } from "vitest";
|
||||
|
||||
matrix([[true, false]], async function (useAad: boolean) {
|
||||
describe(`Get Token With Custom Expiration [Playback/Live]${
|
||||
useAad ? " [AAD]" : ""
|
||||
}`, function () {
|
||||
matrix([[true, false]], async (useAad: boolean) => {
|
||||
describe(`Get Token With Custom Expiration [Playback/Live]${useAad ? " [AAD]" : ""}`, () => {
|
||||
const TOKEN_EXPIRATION_ALLOWED_DEVIATION: number = 0.05;
|
||||
let recorder: Recorder;
|
||||
let client: CommunicationIdentityClient;
|
||||
|
||||
beforeEach(async function (this: Context) {
|
||||
beforeEach(async (ctx) => {
|
||||
if (useAad) {
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClientWithToken(this));
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClientWithToken(ctx));
|
||||
} else {
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClient(this));
|
||||
({ client, recorder } = await createRecordedCommunicationIdentityClient(ctx));
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(async function (this: Context) {
|
||||
if (!this.currentTest?.isPending()) {
|
||||
afterEach(async (ctx) => {
|
||||
if (!ctx.task.pending) {
|
||||
await recorder.stop();
|
||||
}
|
||||
});
|
||||
|
@ -40,7 +37,10 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
expectedTokenExpiration: number,
|
||||
tokenExpiresIn: Date,
|
||||
allowedDeviation: number,
|
||||
) {
|
||||
): {
|
||||
withinAllowedDeviation: boolean;
|
||||
tokenExpirationInMinutes: number;
|
||||
} {
|
||||
const timeNow = Date.now();
|
||||
const expiration = tokenExpiresIn.getTime();
|
||||
const tokenSeconds = (expiration - timeNow) / 1000;
|
||||
|
@ -57,7 +57,7 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
{ tokenExpiresInMinutes: 60, description: "min valid" },
|
||||
{ tokenExpiresInMinutes: 1440, description: "max valid" },
|
||||
].forEach((input) =>
|
||||
it(`successfully gets a valid custom expiration token <${input.description}>`, async function () {
|
||||
it(`successfully gets a valid custom expiration token <${input.description}>`, async () => {
|
||||
const user: CommunicationUserIdentifier = await client.createUser();
|
||||
const tokenOptions: GetTokenOptions = {
|
||||
tokenExpiresInMinutes: input.tokenExpiresInMinutes,
|
||||
|
@ -90,7 +90,7 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
{ tokenExpiresInMinutes: 60, description: "min valid" },
|
||||
{ tokenExpiresInMinutes: 1440, description: "max valid" },
|
||||
].forEach((input) =>
|
||||
it(`successfully gets user and valid custom expiration token <${input.description}>`, async function () {
|
||||
it(`successfully gets user and valid custom expiration token <${input.description}>`, async () => {
|
||||
const tokenOptions: CreateUserAndTokenOptions = {
|
||||
tokenExpiresInMinutes: input.tokenExpiresInMinutes,
|
||||
};
|
||||
|
@ -122,7 +122,7 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
{ tokenExpiresInMinutes: 59, description: "lo inval" },
|
||||
{ tokenExpiresInMinutes: 1441, description: "hi inval" },
|
||||
].forEach((input) =>
|
||||
it(`throws error when attempting to issue an invalid expiration token <${input.description}>`, async function () {
|
||||
it(`throws error when attempting to issue an invalid expiration token <${input.description}>`, async () => {
|
||||
const user: CommunicationUserIdentifier = await client.createUser();
|
||||
const tokenOptions: GetTokenOptions = {
|
||||
tokenExpiresInMinutes: input.tokenExpiresInMinutes,
|
||||
|
@ -140,7 +140,7 @@ matrix([[true, false]], async function (useAad: boolean) {
|
|||
{ tokenExpiresInMinutes: 59, description: "lo inval" },
|
||||
{ tokenExpiresInMinutes: 1441, description: "hi inval" },
|
||||
].forEach((input) =>
|
||||
it(`throws error when attempting to issue user and invalid expiration token <${input.description}>`, async function () {
|
||||
it(`throws error when attempting to issue user and invalid expiration token <${input.description}>`, async () => {
|
||||
const tokenOptions: CreateUserAndTokenOptions = {
|
||||
tokenExpiresInMinutes: input.tokenExpiresInMinutes,
|
||||
};
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* Takes a jagged 2D array and a function and runs the function with every
|
||||
* possible combination of elements of each of the arrays
|
||||
*
|
||||
* For strong type-checking, it is important that the `matrix` have a strong
|
||||
* type, such as a `const` literal.
|
||||
*
|
||||
* @param values - jagged 2D array specifying the arguments and their possible
|
||||
* values
|
||||
* @param handler - the function to run with the different argument combinations
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* matrix([
|
||||
* [true, false],
|
||||
* [1, 2, 3]
|
||||
* ] as const,
|
||||
* (useLabels: boolean, attempts: number) => {
|
||||
* // This body will run six times with the following parameters:
|
||||
* // - true, 1
|
||||
* // - true, 2
|
||||
* // - true, 3
|
||||
* // - false, 1
|
||||
* // - false, 2
|
||||
* // - false, 3
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function matrix<T extends ReadonlyArray<readonly unknown[]>>(
|
||||
values: T,
|
||||
handler: (
|
||||
...args: { [idx in keyof T]: T[idx] extends ReadonlyArray<infer U> ? U : never }
|
||||
) => Promise<void>,
|
||||
): void {
|
||||
// Classic recursive approach
|
||||
if (values.length === 0) {
|
||||
(handler as () => Promise<void>)();
|
||||
} else {
|
||||
for (const v of values[0]) {
|
||||
matrix(values.slice(1), (...args) => (handler as any)(v, ...args));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import type { HttpClient, PipelineRequest, PipelineResponse } from "@azure/core-rest-pipeline";
|
||||
import { createHttpHeaders } from "@azure/core-rest-pipeline";
|
||||
import type { CommunicationAccessToken } from "../../../src";
|
||||
import type { CommunicationAccessToken } from "../../../src/index.js";
|
||||
|
||||
export const createMockHttpClient = <T = Record<string, unknown>>(
|
||||
status: number = 200,
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import type { Context, Test } from "mocha";
|
||||
import type { RecorderStartOptions, SanitizerOptions } from "@azure-tools/test-recorder";
|
||||
import type { RecorderStartOptions, SanitizerOptions, TestInfo } from "@azure-tools/test-recorder";
|
||||
import { Recorder, env, isPlaybackMode } from "@azure-tools/test-recorder";
|
||||
import { CommunicationIdentityClient } from "../../../src";
|
||||
import { CommunicationIdentityClient } from "../../../src/index.js";
|
||||
import type { TokenCredential } from "@azure/core-auth";
|
||||
import { createTestCredential } from "@azure-tools/test-credential";
|
||||
import { parseConnectionString } from "@azure/communication-common";
|
||||
|
@ -63,7 +61,7 @@ const recorderOptions: RecorderStartOptions = {
|
|||
sanitizerOptions: sanitizerOptions,
|
||||
};
|
||||
|
||||
export async function createRecorder(context: Test | undefined): Promise<Recorder> {
|
||||
export async function createRecorder(context: TestInfo | undefined): Promise<Recorder> {
|
||||
const recorder = new Recorder(context);
|
||||
await recorder.start(recorderOptions);
|
||||
await recorder.setMatcher("CustomDefaultMatcher", {
|
||||
|
@ -76,9 +74,9 @@ export async function createRecorder(context: Test | undefined): Promise<Recorde
|
|||
}
|
||||
|
||||
export async function createRecordedCommunicationIdentityClient(
|
||||
context: Context,
|
||||
context: TestInfo,
|
||||
): Promise<RecordedClient<CommunicationIdentityClient>> {
|
||||
const recorder = await createRecorder(context.currentTest);
|
||||
const recorder = await createRecorder(context);
|
||||
|
||||
const client = new CommunicationIdentityClient(
|
||||
env.COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING ?? "",
|
||||
|
@ -92,9 +90,9 @@ export async function createRecordedCommunicationIdentityClient(
|
|||
}
|
||||
|
||||
export async function createRecordedCommunicationIdentityClientWithToken(
|
||||
context: Context,
|
||||
context: TestInfo,
|
||||
): Promise<RecordedClient<CommunicationIdentityClient>> {
|
||||
const recorder = await createRecorder(context.currentTest);
|
||||
const recorder = await createRecorder(context);
|
||||
|
||||
let credential: TokenCredential;
|
||||
const endpoint = parseConnectionString(
|
||||
|
|
|
@ -6,15 +6,15 @@ import type {
|
|||
CommunicationIdentityClientOptions,
|
||||
CommunicationUserToken,
|
||||
TokenScope,
|
||||
} from "../../../src";
|
||||
import { CommunicationIdentityClient } from "../../../src";
|
||||
} from "../../../src/index.js";
|
||||
import { CommunicationIdentityClient } from "../../../src/index.js";
|
||||
import {
|
||||
createUserAndTokenHttpClient,
|
||||
createUserHttpClient,
|
||||
getTokenForTeamsUserHttpClient,
|
||||
getTokenHttpClient,
|
||||
revokeTokensHttpClient,
|
||||
} from "./mockHttpClients";
|
||||
} from "./mockHttpClients.js";
|
||||
import type { CommunicationUserIdentifier } from "@azure/communication-common";
|
||||
import type { OperationOptions } from "@azure/core-client";
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"extends": "./.tshy/build.json",
|
||||
"include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts", "./test/**/*.mts"],
|
||||
"exclude": ["./test/**/node/**/*.ts"],
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist-test/browser",
|
||||
"rootDir": ".",
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
|
@ -1,11 +1,12 @@
|
|||
{
|
||||
"extends": "../../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist-esm",
|
||||
"declarationDir": "./types",
|
||||
"paths": {
|
||||
"@azure/communication-identity": ["./src/index"]
|
||||
}
|
||||
},
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["src/**/*.ts", "test/**/*.ts", "samples-dev/**/*.ts"]
|
||||
"include": ["src/**/*.ts", "src/**/*.mts", "src/**/*.cts", "samples-dev/**/*.ts", "test/**/*.ts"]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import { defineConfig, mergeConfig } from "vitest/config";
|
||||
import viteConfig from "../../../vitest.browser.shared.config.ts";
|
||||
|
||||
export default mergeConfig(
|
||||
viteConfig,
|
||||
defineConfig({
|
||||
test: {
|
||||
include: ["dist-test/browser/test/**/*.spec.js"],
|
||||
hookTimeout: 5000000,
|
||||
testTimeout: 5000000,
|
||||
},
|
||||
}),
|
||||
);
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import { defineConfig, mergeConfig } from "vitest/config";
|
||||
import viteConfig from "../../../vitest.shared.config.ts";
|
||||
|
||||
export default mergeConfig(
|
||||
viteConfig,
|
||||
defineConfig({
|
||||
test: {
|
||||
include: ["test/**/*.spec.ts"],
|
||||
hookTimeout: 5000000,
|
||||
testTimeout: 5000000,
|
||||
},
|
||||
}),
|
||||
);
|
Загрузка…
Ссылка в новой задаче