@azure/web-pubsub 1.1.3-alpha.20240423.1 → 1.1.3-alpha.20240425.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
|
|
3
3
|
/* eslint-disable no-invalid-this */
|
4
4
|
import { Recorder, isLiveMode, assertEnvironmentVariable } from "@azure-tools/test-recorder";
|
5
5
|
import { WebPubSubServiceClient, AzureKeyCredential } from "../src";
|
6
|
-
import { assert } from "@azure/test-utils";
|
6
|
+
import { assert } from "@azure-tools/test-utils";
|
7
7
|
import recorderOptions from "./testEnv";
|
8
8
|
import { createTestCredential } from "@azure-tools/test-credential";
|
9
9
|
/* eslint-disable @typescript-eslint/no-invalid-this */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hubs.spec.js","sourceRoot":"","sources":["../../test/hubs.spec.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,oCAAoC;AACpC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,eAAe,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,uDAAuD;AAEvD,QAAQ,CAAC,WAAW,EAAE;IACpB,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACxC,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;QAC1C,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC1D,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE;gBACvB,IAAI,sBAAsB,CAAC,yBAAyB,CAAC,uBAAuB,CAAC,EAAE,UAAU,EAAE;oBACzF,YAAY,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;iBAChC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;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CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/* eslint-disable no-invalid-this */\nimport { Recorder, isLiveMode, assertEnvironmentVariable } from \"@azure-tools/test-recorder\";\nimport { WebPubSubServiceClient, AzureKeyCredential } from \"../src\";\nimport { assert } from \"@azure/test-utils\";\nimport recorderOptions from \"./testEnv\";\nimport { FullOperationResponse } from \"@azure/core-client\";\nimport { createTestCredential } from \"@azure-tools/test-credential\";\n/* eslint-disable @typescript-eslint/no-invalid-this */\n\ndescribe(\"HubClient\", function () {\n describe(\"Constructing a HubClient\", () => {\n const credential = createTestCredential();\n it(\"takes a connection string, hub name, and options\", () => {\n assert.doesNotThrow(() => {\n new WebPubSubServiceClient(assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"), \"test-hub\", {\n retryOptions: { maxRetries: 2 },\n });\n });\n });\n\n it(\"takes an endpoint, an API key, a hub name, and options\", () => {\n assert.doesNotThrow(() => {\n new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_ENDPOINT\"),\n new AzureKeyCredential(assertEnvironmentVariable(\"WPS_API_KEY\")),\n \"test-hub\",\n {\n retryOptions: { maxRetries: 2 },\n },\n );\n });\n });\n\n it(\"takes an endpoint, DefaultAzureCredential, a hub name, and options\", () => {\n assert.doesNotThrow(() => {\n new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_ENDPOINT\"),\n credential,\n \"test-hub\",\n {\n retryOptions: { maxRetries: 2 },\n },\n );\n });\n });\n });\n\n describe(\"Working with a hub\", function () {\n let recorder: Recorder;\n let client: WebPubSubServiceClient;\n let lastResponse: FullOperationResponse | undefined;\n const credential = createTestCredential();\n function onResponse(response: FullOperationResponse): void {\n lastResponse = response;\n }\n beforeEach(async function () {\n recorder = new Recorder(this.currentTest);\n await recorder.start(recorderOptions);\n\n client = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"),\n \"simplechat\",\n recorder.configureClientOptions({}),\n );\n });\n\n afterEach(async function () {\n await recorder.stop();\n });\n\n it(\"can broadcast\", async () => {\n await client.sendToAll(\"hello\", { contentType: \"text/plain\", onResponse });\n assert.equal(lastResponse?.status, 202);\n\n await client.sendToAll({ x: 1, y: 2 }, { onResponse });\n assert.equal(lastResponse?.status, 202);\n\n const binaryMessage = new Uint8Array(10);\n await client.sendToAll(binaryMessage.buffer, { onResponse });\n assert.equal(lastResponse?.status, 202);\n });\n\n it(\"can broadcast with filter\", async () => {\n await client.sendToAll(\"hello\", {\n contentType: \"text/plain\",\n filter: \"userId ne 'user1'\",\n messageTtlSeconds: 60,\n onResponse,\n });\n assert.equal(lastResponse?.status, 202);\n\n let error;\n try {\n await client.sendToAll(\"hello\", {\n contentType: \"text/plain\",\n filter: \"invalid filter\",\n });\n } catch (e: any) {\n if (e.name !== \"RestError\") {\n throw e;\n }\n\n error = e;\n }\n assert.equal(error.statusCode, 400);\n assert.equal(\n JSON.parse(error.message).message,\n \"Invalid syntax for 'invalid filter': Syntax error at position 14 in 'invalid filter'. (Parameter 'filter')\",\n );\n });\n\n it(\"can broadcast using the DAC\", async () => {\n const dacClient = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_ENDPOINT\"),\n credential,\n \"simplechat\",\n recorder.configureClientOptions({}),\n );\n\n await dacClient.sendToAll(\"hello\", { contentType: \"text/plain\", onResponse });\n assert.equal(lastResponse?.status, 202);\n\n await dacClient.sendToAll({ x: 1, y: 2 }, { onResponse });\n assert.equal(lastResponse?.status, 202);\n\n const binaryMessage = new Uint8Array(10);\n await dacClient.sendToAll(binaryMessage.buffer, { onResponse });\n assert.equal(lastResponse?.status, 202);\n });\n\n it(\"can broadcast using APIM\", async () => {\n const apimClient = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"),\n \"simplechat\",\n recorder.configureClientOptions({\n reverseProxyEndpoint: assertEnvironmentVariable(\"WPS_REVERSE_PROXY_ENDPOINT\"),\n }),\n );\n\n await apimClient.sendToAll(\"hello\", { contentType: \"text/plain\", onResponse });\n assert.equal(lastResponse?.status, 202);\n\n await apimClient.sendToAll({ x: 1, y: 2 }, { onResponse });\n assert.equal(lastResponse?.status, 202);\n\n const binaryMessage = new Uint8Array(10);\n await apimClient.sendToAll(binaryMessage.buffer, { onResponse });\n assert.equal(lastResponse?.status, 202);\n });\n\n it(\"can send messages to a user\", async () => {\n await client.sendToUser(\"brian\", \"hello\", {\n contentType: \"text/plain\",\n onResponse,\n });\n assert.equal(lastResponse?.status, 202);\n\n await client.sendToUser(\"brian\", { x: 1, y: 2 }, { onResponse });\n assert.equal(lastResponse?.status, 202);\n\n const binaryMessage = new Uint8Array(10);\n await client.sendToUser(\"brian\", binaryMessage.buffer, { onResponse });\n assert.equal(lastResponse?.status, 202);\n });\n\n it(\"can send to a user with filter\", async () => {\n await client.sendToUser(\"vic\", \"hello\", {\n contentType: \"text/plain\",\n filter: \"userId ne 'user1'\",\n onResponse,\n });\n assert.equal(lastResponse?.status, 202);\n\n let error;\n try {\n await client.sendToUser(\"brian\", \"hello\", {\n contentType: \"text/plain\",\n filter: \"invalid filter\",\n });\n } catch (e: any) {\n if (e.name !== \"RestError\") {\n throw e;\n }\n\n error = e;\n }\n assert.equal(error.statusCode, 400);\n assert.equal(\n JSON.parse(error.message).message,\n \"Invalid syntax for 'invalid filter': Syntax error at position 14 in 'invalid filter'. (Parameter 'filter')\",\n );\n });\n\n it(\"can send messages to a connection\", async () => {\n await client.sendToConnection(\"xxxx\", \"hello\", { contentType: \"text/plain\", onResponse });\n assert.equal(lastResponse?.status, 202);\n\n await client.sendToConnection(\"xxxx\", { x: 1, y: 2 }, { onResponse });\n assert.equal(lastResponse?.status, 202);\n const binaryMessage = new Uint8Array(10);\n\n await client.sendToConnection(\"xxxx\", binaryMessage.buffer, { onResponse });\n assert.equal(lastResponse?.status, 202);\n });\n\n it(\"can manage users\", async () => {\n const res = await client.userExists(\"foo\");\n assert.ok(!res);\n await client.removeUserFromAllGroups(\"brian\", { onResponse });\n assert.equal(lastResponse?.status, 204);\n });\n\n it(\"can manage connections\", async () => {\n await client.removeConnectionFromAllGroups(\"xxx\", { onResponse });\n assert.equal(lastResponse?.status, 204);\n });\n\n it(\"can check if a connection exists\", async function () {\n // likely bug in recorder for this test - recording not generating properly\n if (!isLiveMode()) this.skip();\n const res = await client.connectionExists(\"xxx\");\n assert.ok(!res);\n });\n\n it(\"can grant permissions to connections\", async () => {\n let error;\n try {\n await client.grantPermission(\"xxx\", \"joinLeaveGroup\", { targetName: \"x\" });\n } catch (e: any) {\n if (e.name !== \"RestError\") {\n throw e;\n }\n\n error = e;\n }\n // grantPermission validates connection ids, so we expect an error here.\n assert.equal(error.statusCode, 404);\n });\n\n it(\"can revoke permissions from connections\", async function () {\n // likely bug in recorder for this test - recording not generating properly\n if (!isLiveMode()) this.skip();\n await client.revokePermission(\"invalid-id\", \"joinLeaveGroup\", { targetName: \"x\" });\n // Service doesn't throw error for invalid connection-ids\n });\n\n it(\"can trace through the various options\", async function () {\n await assert.supportsTracing(\n async (options) => {\n const promises: Promise<any>[] = [\n client.sendToAll(\"hello\", { contentType: \"text/plain\", onResponse, ...options }),\n client.sendToUser(\"brian\", \"hello\", {\n contentType: \"text/plain\",\n onResponse,\n ...options,\n }),\n client.sendToConnection(\"xxxx\", \"hello\", {\n contentType: \"text/plain\",\n onResponse,\n ...options,\n }),\n client.connectionExists(\"xxxx\", options),\n client.closeConnection(\"xxxx\", options),\n client.closeAllConnections(options),\n client.closeUserConnections(\"xxxx\", options),\n client.removeUserFromAllGroups(\"foo\", options),\n client.groupExists(\"foo\", options),\n client.userExists(\"foo\", options),\n client.grantPermission(\"xxxx\", \"joinLeaveGroup\", { targetName: \"x\", ...options }),\n client.hasPermission(\"xxxx\", \"joinLeaveGroup\", { targetName: \"x\", ...options }),\n client.revokePermission(\"xxxx\", \"joinLeaveGroup\", options),\n client.getClientAccessToken(options),\n ];\n // We don't care about errors, only that we created (and closed) the appropriate spans.\n await Promise.all(promises.map((p) => p.catch(() => undefined)));\n },\n [\n \"WebPubSubServiceClient.sendToAll\",\n \"WebPubSubServiceClient.sendToUser\",\n \"WebPubSubServiceClient.sendToConnection\",\n \"WebPubSubServiceClient.connectionExists\",\n \"WebPubSubServiceClient.closeConnection\",\n \"WebPubSubServiceClient.closeAllConnections\",\n \"WebPubSubServiceClient.closeUserConnections\",\n \"WebPubSubServiceClient.removeUserFromAllGroups\",\n \"WebPubSubServiceClient.groupExists\",\n \"WebPubSubServiceClient.userExists\",\n \"WebPubSubServiceClient.grantPermission\",\n \"WebPubSubServiceClient.hasPermission\",\n \"WebPubSubServiceClient.revokePermission\",\n \"WebPubSubServiceClient.getClientAccessToken\",\n ],\n );\n });\n\n it(\"can generate client tokens\", async () => {\n const res = await client.getClientAccessToken({\n userId: \"brian\",\n groups: [\"group1\"],\n });\n const url = new URL(res.url);\n assert.ok(url.searchParams.has(\"access_token\"));\n assert.equal(url.host, new URL(client.endpoint).host);\n assert.equal(url.pathname, `/client/hubs/${client.hubName}`);\n });\n });\n});\n"]}
|
1
|
+
{"version":3,"file":"hubs.spec.js","sourceRoot":"","sources":["../../test/hubs.spec.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,oCAAoC;AACpC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,eAAe,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,uDAAuD;AAEvD,QAAQ,CAAC,WAAW,EAAE;IACpB,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACxC,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;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C,CAAC,CAAC;YAChD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;YACtD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,gBAAgB,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/* eslint-disable no-invalid-this */\nimport { Recorder, isLiveMode, assertEnvironmentVariable } from \"@azure-tools/test-recorder\";\nimport { WebPubSubServiceClient, AzureKeyCredential } from \"../src\";\nimport { assert } from \"@azure-tools/test-utils\";\nimport recorderOptions from \"./testEnv\";\nimport { FullOperationResponse } from \"@azure/core-client\";\nimport { createTestCredential } from \"@azure-tools/test-credential\";\n/* eslint-disable @typescript-eslint/no-invalid-this */\n\ndescribe(\"HubClient\", function () {\n describe(\"Constructing a HubClient\", () => {\n const credential = createTestCredential();\n it(\"takes a connection string, hub name, and options\", () => {\n assert.doesNotThrow(() => {\n new WebPubSubServiceClient(assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"), \"test-hub\", {\n retryOptions: { maxRetries: 2 },\n });\n });\n });\n\n it(\"takes an endpoint, an API key, a hub name, and options\", () => {\n assert.doesNotThrow(() => {\n new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_ENDPOINT\"),\n new AzureKeyCredential(assertEnvironmentVariable(\"WPS_API_KEY\")),\n \"test-hub\",\n {\n retryOptions: { maxRetries: 2 },\n },\n );\n });\n });\n\n it(\"takes an endpoint, DefaultAzureCredential, a hub name, and options\", () => {\n assert.doesNotThrow(() => {\n new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_ENDPOINT\"),\n credential,\n \"test-hub\",\n {\n retryOptions: { maxRetries: 2 },\n },\n );\n });\n });\n });\n\n describe(\"Working with a hub\", function () {\n let recorder: Recorder;\n let client: WebPubSubServiceClient;\n let lastResponse: FullOperationResponse | undefined;\n const credential = createTestCredential();\n function onResponse(response: FullOperationResponse): void {\n lastResponse = response;\n }\n beforeEach(async function () {\n recorder = new Recorder(this.currentTest);\n await recorder.start(recorderOptions);\n\n client = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"),\n \"simplechat\",\n recorder.configureClientOptions({}),\n );\n });\n\n afterEach(async function () {\n await recorder.stop();\n });\n\n it(\"can broadcast\", async () => {\n await client.sendToAll(\"hello\", { contentType: \"text/plain\", onResponse });\n assert.equal(lastResponse?.status, 202);\n\n await client.sendToAll({ x: 1, y: 2 }, { onResponse });\n assert.equal(lastResponse?.status, 202);\n\n const binaryMessage = new Uint8Array(10);\n await client.sendToAll(binaryMessage.buffer, { onResponse });\n assert.equal(lastResponse?.status, 202);\n });\n\n it(\"can broadcast with filter\", async () => {\n await client.sendToAll(\"hello\", {\n contentType: \"text/plain\",\n filter: \"userId ne 'user1'\",\n messageTtlSeconds: 60,\n onResponse,\n });\n assert.equal(lastResponse?.status, 202);\n\n let error;\n try {\n await client.sendToAll(\"hello\", {\n contentType: \"text/plain\",\n filter: \"invalid filter\",\n });\n } catch (e: any) {\n if (e.name !== \"RestError\") {\n throw e;\n }\n\n error = e;\n }\n assert.equal(error.statusCode, 400);\n assert.equal(\n JSON.parse(error.message).message,\n \"Invalid syntax for 'invalid filter': Syntax error at position 14 in 'invalid filter'. (Parameter 'filter')\",\n );\n });\n\n it(\"can broadcast using the DAC\", async () => {\n const dacClient = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_ENDPOINT\"),\n credential,\n \"simplechat\",\n recorder.configureClientOptions({}),\n );\n\n await dacClient.sendToAll(\"hello\", { contentType: \"text/plain\", onResponse });\n assert.equal(lastResponse?.status, 202);\n\n await dacClient.sendToAll({ x: 1, y: 2 }, { onResponse });\n assert.equal(lastResponse?.status, 202);\n\n const binaryMessage = new Uint8Array(10);\n await dacClient.sendToAll(binaryMessage.buffer, { onResponse });\n assert.equal(lastResponse?.status, 202);\n });\n\n it(\"can broadcast using APIM\", async () => {\n const apimClient = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"),\n \"simplechat\",\n recorder.configureClientOptions({\n reverseProxyEndpoint: assertEnvironmentVariable(\"WPS_REVERSE_PROXY_ENDPOINT\"),\n }),\n );\n\n await apimClient.sendToAll(\"hello\", { contentType: \"text/plain\", onResponse });\n assert.equal(lastResponse?.status, 202);\n\n await apimClient.sendToAll({ x: 1, y: 2 }, { onResponse });\n assert.equal(lastResponse?.status, 202);\n\n const binaryMessage = new Uint8Array(10);\n await apimClient.sendToAll(binaryMessage.buffer, { onResponse });\n assert.equal(lastResponse?.status, 202);\n });\n\n it(\"can send messages to a user\", async () => {\n await client.sendToUser(\"brian\", \"hello\", {\n contentType: \"text/plain\",\n onResponse,\n });\n assert.equal(lastResponse?.status, 202);\n\n await client.sendToUser(\"brian\", { x: 1, y: 2 }, { onResponse });\n assert.equal(lastResponse?.status, 202);\n\n const binaryMessage = new Uint8Array(10);\n await client.sendToUser(\"brian\", binaryMessage.buffer, { onResponse });\n assert.equal(lastResponse?.status, 202);\n });\n\n it(\"can send to a user with filter\", async () => {\n await client.sendToUser(\"vic\", \"hello\", {\n contentType: \"text/plain\",\n filter: \"userId ne 'user1'\",\n onResponse,\n });\n assert.equal(lastResponse?.status, 202);\n\n let error;\n try {\n await client.sendToUser(\"brian\", \"hello\", {\n contentType: \"text/plain\",\n filter: \"invalid filter\",\n });\n } catch (e: any) {\n if (e.name !== \"RestError\") {\n throw e;\n }\n\n error = e;\n }\n assert.equal(error.statusCode, 400);\n assert.equal(\n JSON.parse(error.message).message,\n \"Invalid syntax for 'invalid filter': Syntax error at position 14 in 'invalid filter'. (Parameter 'filter')\",\n );\n });\n\n it(\"can send messages to a connection\", async () => {\n await client.sendToConnection(\"xxxx\", \"hello\", { contentType: \"text/plain\", onResponse });\n assert.equal(lastResponse?.status, 202);\n\n await client.sendToConnection(\"xxxx\", { x: 1, y: 2 }, { onResponse });\n assert.equal(lastResponse?.status, 202);\n const binaryMessage = new Uint8Array(10);\n\n await client.sendToConnection(\"xxxx\", binaryMessage.buffer, { onResponse });\n assert.equal(lastResponse?.status, 202);\n });\n\n it(\"can manage users\", async () => {\n const res = await client.userExists(\"foo\");\n assert.ok(!res);\n await client.removeUserFromAllGroups(\"brian\", { onResponse });\n assert.equal(lastResponse?.status, 204);\n });\n\n it(\"can manage connections\", async () => {\n await client.removeConnectionFromAllGroups(\"xxx\", { onResponse });\n assert.equal(lastResponse?.status, 204);\n });\n\n it(\"can check if a connection exists\", async function () {\n // likely bug in recorder for this test - recording not generating properly\n if (!isLiveMode()) this.skip();\n const res = await client.connectionExists(\"xxx\");\n assert.ok(!res);\n });\n\n it(\"can grant permissions to connections\", async () => {\n let error;\n try {\n await client.grantPermission(\"xxx\", \"joinLeaveGroup\", { targetName: \"x\" });\n } catch (e: any) {\n if (e.name !== \"RestError\") {\n throw e;\n }\n\n error = e;\n }\n // grantPermission validates connection ids, so we expect an error here.\n assert.equal(error.statusCode, 404);\n });\n\n it(\"can revoke permissions from connections\", async function () {\n // likely bug in recorder for this test - recording not generating properly\n if (!isLiveMode()) this.skip();\n await client.revokePermission(\"invalid-id\", \"joinLeaveGroup\", { targetName: \"x\" });\n // Service doesn't throw error for invalid connection-ids\n });\n\n it(\"can trace through the various options\", async function () {\n await assert.supportsTracing(\n async (options) => {\n const promises: Promise<any>[] = [\n client.sendToAll(\"hello\", { contentType: \"text/plain\", onResponse, ...options }),\n client.sendToUser(\"brian\", \"hello\", {\n contentType: \"text/plain\",\n onResponse,\n ...options,\n }),\n client.sendToConnection(\"xxxx\", \"hello\", {\n contentType: \"text/plain\",\n onResponse,\n ...options,\n }),\n client.connectionExists(\"xxxx\", options),\n client.closeConnection(\"xxxx\", options),\n client.closeAllConnections(options),\n client.closeUserConnections(\"xxxx\", options),\n client.removeUserFromAllGroups(\"foo\", options),\n client.groupExists(\"foo\", options),\n client.userExists(\"foo\", options),\n client.grantPermission(\"xxxx\", \"joinLeaveGroup\", { targetName: \"x\", ...options }),\n client.hasPermission(\"xxxx\", \"joinLeaveGroup\", { targetName: \"x\", ...options }),\n client.revokePermission(\"xxxx\", \"joinLeaveGroup\", options),\n client.getClientAccessToken(options),\n ];\n // We don't care about errors, only that we created (and closed) the appropriate spans.\n await Promise.all(promises.map((p) => p.catch(() => undefined)));\n },\n [\n \"WebPubSubServiceClient.sendToAll\",\n \"WebPubSubServiceClient.sendToUser\",\n \"WebPubSubServiceClient.sendToConnection\",\n \"WebPubSubServiceClient.connectionExists\",\n \"WebPubSubServiceClient.closeConnection\",\n \"WebPubSubServiceClient.closeAllConnections\",\n \"WebPubSubServiceClient.closeUserConnections\",\n \"WebPubSubServiceClient.removeUserFromAllGroups\",\n \"WebPubSubServiceClient.groupExists\",\n \"WebPubSubServiceClient.userExists\",\n \"WebPubSubServiceClient.grantPermission\",\n \"WebPubSubServiceClient.hasPermission\",\n \"WebPubSubServiceClient.revokePermission\",\n \"WebPubSubServiceClient.getClientAccessToken\",\n ],\n );\n });\n\n it(\"can generate client tokens\", async () => {\n const res = await client.getClientAccessToken({\n userId: \"brian\",\n groups: [\"group1\"],\n });\n const url = new URL(res.url);\n assert.ok(url.searchParams.has(\"access_token\"));\n assert.equal(url.host, new URL(client.endpoint).host);\n assert.equal(url.pathname, `/client/hubs/${client.hubName}`);\n });\n });\n});\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@azure/web-pubsub",
|
3
|
-
"version": "1.1.3-alpha.
|
3
|
+
"version": "1.1.3-alpha.20240425.1",
|
4
4
|
"description": "Azure client library for Azure Web PubSub",
|
5
5
|
"sdk-type": "client",
|
6
6
|
"main": "dist/index.js",
|
@@ -80,7 +80,7 @@
|
|
80
80
|
"devDependencies": {
|
81
81
|
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
82
82
|
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
83
|
-
"@azure/test-utils": ">=1.0.0-alpha <1.0.0-alphb",
|
83
|
+
"@azure-tools/test-utils": ">=1.0.0-alpha <1.0.0-alphb",
|
84
84
|
"@azure-tools/test-credential": "^1.0.0",
|
85
85
|
"@azure-tools/test-recorder": "^3.0.0",
|
86
86
|
"@microsoft/api-extractor": "^7.31.1",
|