@azure/web-pubsub 1.1.4-alpha.20241118.1 → 1.1.4-alpha.20241120.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/commonjs/generated/generatedClient.d.ts +19 -0
- package/dist/commonjs/generated/generatedClient.d.ts.map +1 -0
- package/dist/commonjs/generated/generatedClient.js +76 -0
- package/dist/commonjs/generated/generatedClient.js.map +1 -0
- package/dist/commonjs/generated/generatedClientContext.d.ts +14 -0
- package/dist/commonjs/generated/generatedClientContext.d.ts.map +1 -0
- package/dist/commonjs/generated/generatedClientContext.js +46 -0
- package/dist/commonjs/generated/generatedClientContext.js.map +1 -0
- package/dist/commonjs/generated/index.d.ts +4 -0
- package/dist/commonjs/generated/index.d.ts.map +1 -0
- package/dist/commonjs/generated/index.js +16 -0
- package/dist/commonjs/generated/index.js.map +1 -0
- package/dist/commonjs/generated/models/index.d.ts +323 -0
- package/dist/commonjs/generated/models/index.d.ts.map +1 -0
- package/dist/commonjs/generated/models/index.js +27 -0
- package/dist/commonjs/generated/models/index.js.map +1 -0
- package/dist/commonjs/generated/models/mappers.d.ts +30 -0
- package/dist/commonjs/generated/models/mappers.d.ts.map +1 -0
- package/dist/commonjs/generated/models/mappers.js +463 -0
- package/dist/commonjs/generated/models/mappers.js.map +1 -0
- package/dist/commonjs/generated/models/parameters.d.ts +31 -0
- package/dist/commonjs/generated/models/parameters.d.ts.map +1 -0
- package/dist/commonjs/generated/models/parameters.js +335 -0
- package/dist/commonjs/generated/models/parameters.js.map +1 -0
- package/dist/commonjs/generated/operations/healthApi.d.ts +18 -0
- package/dist/commonjs/generated/operations/healthApi.d.ts.map +1 -0
- package/dist/commonjs/generated/operations/healthApi.js +43 -0
- package/dist/commonjs/generated/operations/healthApi.js.map +1 -0
- package/dist/commonjs/generated/operations/index.d.ts +3 -0
- package/dist/commonjs/generated/operations/index.d.ts.map +1 -0
- package/dist/commonjs/generated/operations/index.js +13 -0
- package/dist/commonjs/generated/operations/index.js.map +1 -0
- package/dist/commonjs/generated/operations/webPubSub.d.ts +249 -0
- package/dist/commonjs/generated/operations/webPubSub.d.ts.map +1 -0
- package/dist/commonjs/generated/operations/webPubSub.js +874 -0
- package/dist/commonjs/generated/operations/webPubSub.js.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/healthApi.d.ts +10 -0
- package/dist/commonjs/generated/operationsInterfaces/healthApi.d.ts.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/healthApi.js +10 -0
- package/dist/commonjs/generated/operationsInterfaces/healthApi.js.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/index.d.ts +3 -0
- package/dist/commonjs/generated/operationsInterfaces/index.d.ts.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/index.js +13 -0
- package/dist/commonjs/generated/operationsInterfaces/index.js.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/webPubSub.d.ts +224 -0
- package/dist/commonjs/generated/operationsInterfaces/webPubSub.d.ts.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/webPubSub.js +10 -0
- package/dist/commonjs/generated/operationsInterfaces/webPubSub.js.map +1 -0
- package/dist/commonjs/groupClient.d.ts +232 -0
- package/dist/commonjs/groupClient.d.ts.map +1 -0
- package/dist/commonjs/groupClient.js +101 -0
- package/dist/commonjs/groupClient.js.map +1 -0
- package/dist/commonjs/hubClient.d.ts +478 -0
- package/dist/commonjs/hubClient.d.ts.map +1 -0
- package/dist/commonjs/hubClient.js +372 -0
- package/dist/commonjs/hubClient.js.map +1 -0
- package/dist/commonjs/index.d.ts +5 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +12 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/logger.d.ts +5 -0
- package/dist/commonjs/logger.d.ts.map +1 -0
- package/dist/commonjs/logger.js +11 -0
- package/dist/commonjs/logger.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/parseConnectionString.d.ts +8 -0
- package/dist/commonjs/parseConnectionString.d.ts.map +1 -0
- package/dist/commonjs/parseConnectionString.js +34 -0
- package/dist/commonjs/parseConnectionString.js.map +1 -0
- package/dist/commonjs/reverseProxyPolicy.d.ts +9 -0
- package/dist/commonjs/reverseProxyPolicy.d.ts.map +1 -0
- package/dist/commonjs/reverseProxyPolicy.js +25 -0
- package/dist/commonjs/reverseProxyPolicy.js.map +1 -0
- package/dist/commonjs/tracing.d.ts +3 -0
- package/dist/commonjs/tracing.d.ts.map +1 -0
- package/dist/commonjs/tracing.js +12 -0
- package/dist/commonjs/tracing.js.map +1 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/commonjs/utils.d.ts +29 -0
- package/dist/commonjs/utils.d.ts.map +1 -0
- package/dist/commonjs/utils.js +73 -0
- package/dist/commonjs/utils.js.map +1 -0
- package/dist/commonjs/webPubSubCredentialPolicy.d.ts +13 -0
- package/dist/commonjs/webPubSubCredentialPolicy.d.ts.map +1 -0
- package/dist/commonjs/webPubSubCredentialPolicy.js +32 -0
- package/dist/commonjs/webPubSubCredentialPolicy.js.map +1 -0
- package/dist/esm/generated/generatedClient.d.ts +19 -0
- package/dist/esm/generated/generatedClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/generated/generatedClient.js +1 -1
- package/dist/esm/generated/generatedClient.js.map +1 -0
- package/dist/esm/generated/generatedClientContext.d.ts +14 -0
- package/dist/esm/generated/generatedClientContext.d.ts.map +1 -0
- package/dist/esm/generated/generatedClientContext.js.map +1 -0
- package/dist/esm/generated/index.d.ts +4 -0
- package/dist/esm/generated/index.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/generated/index.js +3 -3
- package/dist/esm/generated/index.js.map +1 -0
- package/dist/esm/generated/models/index.d.ts +323 -0
- package/dist/esm/generated/models/index.d.ts.map +1 -0
- package/dist/esm/generated/models/mappers.d.ts +30 -0
- package/dist/esm/generated/models/mappers.d.ts.map +1 -0
- package/dist/esm/generated/models/parameters.d.ts +31 -0
- package/dist/esm/generated/models/parameters.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/generated/models/parameters.js +1 -1
- package/dist/esm/generated/models/parameters.js.map +1 -0
- package/dist/esm/generated/operations/healthApi.d.ts +18 -0
- package/dist/esm/generated/operations/healthApi.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/generated/operations/healthApi.js +2 -2
- package/dist/esm/generated/operations/healthApi.js.map +1 -0
- package/dist/esm/generated/operations/index.d.ts +3 -0
- package/dist/esm/generated/operations/index.d.ts.map +1 -0
- package/{dist-esm/src/generated/operationsInterfaces → dist/esm/generated/operations}/index.js +2 -2
- package/dist/esm/generated/operations/index.js.map +1 -0
- package/dist/esm/generated/operations/webPubSub.d.ts +249 -0
- package/dist/esm/generated/operations/webPubSub.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/generated/operations/webPubSub.js +2 -2
- package/dist/esm/generated/operations/webPubSub.js.map +1 -0
- package/dist/esm/generated/operationsInterfaces/healthApi.d.ts +10 -0
- package/dist/esm/generated/operationsInterfaces/healthApi.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/generated/operationsInterfaces/healthApi.js.map +1 -1
- package/dist/esm/generated/operationsInterfaces/index.d.ts +3 -0
- package/dist/esm/generated/operationsInterfaces/index.d.ts.map +1 -0
- package/{dist-esm/src/generated/operations → dist/esm/generated/operationsInterfaces}/index.js +2 -2
- package/dist/esm/generated/operationsInterfaces/index.js.map +1 -0
- package/dist/esm/generated/operationsInterfaces/webPubSub.d.ts +224 -0
- package/dist/esm/generated/operationsInterfaces/webPubSub.d.ts.map +1 -0
- package/dist/esm/generated/operationsInterfaces/webPubSub.js.map +1 -0
- package/dist/esm/groupClient.d.ts +232 -0
- package/dist/esm/groupClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/groupClient.js +2 -2
- package/dist/esm/groupClient.js.map +1 -0
- package/dist/esm/hubClient.d.ts +478 -0
- package/dist/esm/hubClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/hubClient.js +9 -9
- package/dist/esm/hubClient.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/index.js +2 -2
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.d.ts +5 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/parseConnectionString.d.ts +8 -0
- package/dist/esm/parseConnectionString.d.ts.map +1 -0
- package/dist/esm/reverseProxyPolicy.d.ts +9 -0
- package/dist/esm/reverseProxyPolicy.d.ts.map +1 -0
- package/dist/esm/tracing.d.ts +3 -0
- package/dist/esm/tracing.d.ts.map +1 -0
- package/dist/esm/utils.d.ts +29 -0
- package/dist/esm/utils.d.ts.map +1 -0
- package/dist/esm/webPubSubCredentialPolicy.d.ts +13 -0
- package/dist/esm/webPubSubCredentialPolicy.d.ts.map +1 -0
- package/package.json +56 -52
- package/dist/index.js +0 -2441
- package/dist/index.js.map +0 -1
- package/dist-esm/samples-dev/broadcasting.js +0 -27
- package/dist-esm/samples-dev/broadcasting.js.map +0 -1
- package/dist-esm/samples-dev/directMessage.js +0 -20
- package/dist-esm/samples-dev/directMessage.js.map +0 -1
- package/dist-esm/samples-dev/managingGroups.js +0 -23
- package/dist-esm/samples-dev/managingGroups.js.map +0 -1
- package/dist-esm/src/generated/generatedClient.js.map +0 -1
- package/dist-esm/src/generated/generatedClientContext.js.map +0 -1
- package/dist-esm/src/generated/index.js.map +0 -1
- package/dist-esm/src/generated/models/parameters.js.map +0 -1
- package/dist-esm/src/generated/operations/healthApi.js.map +0 -1
- package/dist-esm/src/generated/operations/index.js.map +0 -1
- package/dist-esm/src/generated/operations/webPubSub.js.map +0 -1
- package/dist-esm/src/generated/operationsInterfaces/index.js.map +0 -1
- package/dist-esm/src/generated/operationsInterfaces/webPubSub.js.map +0 -1
- package/dist-esm/src/groupClient.js.map +0 -1
- package/dist-esm/src/hubClient.js.map +0 -1
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/test/conn.spec.js +0 -23
- package/dist-esm/test/conn.spec.js.map +0 -1
- package/dist-esm/test/groups.spec.js +0 -138
- package/dist-esm/test/groups.spec.js.map +0 -1
- package/dist-esm/test/hubs.spec.js +0 -270
- package/dist-esm/test/hubs.spec.js.map +0 -1
- package/dist-esm/test/integration.spec.js +0 -299
- package/dist-esm/test/integration.spec.js.map +0 -1
- package/dist-esm/test/odata.spec.js +0 -15
- package/dist-esm/test/odata.spec.js.map +0 -1
- package/dist-esm/test/testEnv.js +0 -23
- package/dist-esm/test/testEnv.js.map +0 -1
- /package/{dist-esm/src → dist/esm}/generated/generatedClientContext.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/models/index.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/models/index.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/generated/models/mappers.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/models/mappers.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/generated/operationsInterfaces/healthApi.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/operationsInterfaces/webPubSub.js +0 -0
- /package/{dist-esm/src → dist/esm}/logger.js +0 -0
- /package/{dist-esm/src → dist/esm}/logger.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/parseConnectionString.js +0 -0
- /package/{dist-esm/src → dist/esm}/parseConnectionString.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/reverseProxyPolicy.js +0 -0
- /package/{dist-esm/src → dist/esm}/reverseProxyPolicy.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/tracing.js +0 -0
- /package/{dist-esm/src → dist/esm}/tracing.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/utils.js +0 -0
- /package/{dist-esm/src → dist/esm}/utils.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/webPubSubCredentialPolicy.js +0 -0
- /package/{dist-esm/src → dist/esm}/webPubSubCredentialPolicy.js.map +0 -0
- /package/{types → dist}/web-pubsub.d.ts +0 -0
@@ -1 +0,0 @@
|
|
1
|
-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CAAC,CAAC;QAEH,qCAAqC;QACrC,MAAM,aAAa,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;YAC7C,MAAM,EAAE,2CAA2C;SACpD,CAAC,CAAC;QAEH,kBAAkB;QAClB,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7F,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACjC,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,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 { WebPubSubServiceClient, odata } from \"../src/index\";\nimport { isLiveMode, assertEnvironmentVariable } from \"@azure-tools/test-recorder\";\nimport type { Context } from \"mocha\";\nimport { assert } from \"chai\";\nimport ws from \"ws\";\n\nfunction defer<T>(): {\n promise: Promise<T>;\n resolve: (t: T) => void;\n reject: (err: Error) => void;\n} {\n let actualResolve: (t: T) => void;\n let actualReject: (err: Error) => void;\n\n const promise = new Promise<T>((resolve, reject) => {\n actualResolve = resolve;\n actualReject = reject;\n });\n\n return {\n promise,\n resolve: actualResolve!,\n reject: actualReject!,\n };\n}\n\nclass SimpleWebSocketFrame {\n public dataAsString: string | undefined;\n constructor(\n public data: Buffer | ArrayBuffer | Buffer[],\n public isBinary: boolean,\n ) {\n if (!isBinary) {\n this.dataAsString = data.toString();\n }\n }\n\n isEndSignal(id: number | undefined = undefined): boolean {\n return (\n this.isBinary &&\n this.data instanceof Buffer &&\n this.data[0] === 5 &&\n this.data[1] === 1 &&\n this.data[2] === 1 &&\n (id === undefined || this.data[3] === id)\n );\n }\n\n toString(): string | undefined {\n if (this.isEndSignal()) {\n return \"|EndSignal|\";\n }\n if (!this.isBinary) {\n return this.dataAsString;\n } else {\n return this.data.toString();\n }\n }\n}\n\nclass PubSubWebSocketFrame {\n public message: any;\n public dataAsString: string;\n constructor(data: Buffer | ArrayBuffer | Buffer[], isBinary: boolean) {\n assert.isFalse(isBinary);\n this.dataAsString = data.toString();\n this.message = JSON.parse(this.dataAsString);\n }\n\n isEndSignal(): boolean {\n return this.message.dataType === \"binary\" && this.message.data === \"BQEB\";\n }\n\n toString(): string | undefined {\n if (this.isEndSignal()) {\n return \"|EndSignal|\";\n }\n\n return this.dataAsString;\n }\n}\n\nfunction getEndSignal(id: number | undefined = undefined): Uint8Array {\n // magic number 511\n const payload = new Uint8Array(id === undefined ? 3 : 4);\n payload[0] = 5;\n payload[1] = 1;\n payload[2] = 1;\n if (id !== undefined) {\n payload[3] = id;\n }\n return payload;\n}\n\ndescribe(\"ServiceClient to manage the connected WebSocket connections\", function () {\n it(\"Simple clients can receive expected messages with different content types\", async function (this: Context) {\n if (!isLiveMode()) this.skip();\n const hub = \"SimpleClientCanReceiveMessage\";\n\n const messages: SimpleWebSocketFrame[] = [];\n\n // Get token\n const serviceClient = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"),\n hub,\n );\n const token = await serviceClient.getClientAccessToken();\n const endSignal = defer<void>();\n // Start simple WebSocket connections\n const client = new ws.WebSocket(token.url);\n client.on(\"message\", (data, isBinary) => {\n const frame = new SimpleWebSocketFrame(data, isBinary);\n console.log(frame.toString());\n if (frame.isEndSignal()) {\n endSignal.resolve();\n client.close();\n } else {\n messages.push(frame);\n }\n });\n client.on(\"open\", async () => {\n // send to all\n // Send a JSON message\n await serviceClient.sendToAll({ message: \"Hello world!\" });\n\n // Send a plain text message\n await serviceClient.sendToAll(\"Hi there!\", { contentType: \"text/plain\" });\n\n // Send the binary end signal message\n await serviceClient.sendToAll(getEndSignal());\n });\n\n await endSignal.promise;\n\n assert.equal(messages.length, 2);\n assert.equal(messages[0].dataAsString, '{\"message\":\"Hello world!\"}');\n assert.equal(messages[1].dataAsString, \"Hi there!\");\n });\n\n it(\"Simple clients can can join group and receive group messages\", async function (this: Context) {\n if (!isLiveMode()) this.skip();\n const hub = \"SimpleClientCanReceiveGroupMessage\";\n\n const messages: SimpleWebSocketFrame[] = [];\n\n // Get token\n const serviceClient = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"),\n hub,\n );\n const token = await serviceClient.getClientAccessToken({\n groups: [\"group1\", \"group2\"],\n });\n const end1Signal = defer<void>();\n const end2Signal = defer<void>();\n // Start simple WebSocket connections\n const client = new ws.WebSocket(token.url);\n client.on(\"message\", (data, isBinary) => {\n const frame = new SimpleWebSocketFrame(data, isBinary);\n console.log(frame.toString());\n if (frame.isEndSignal(1)) {\n end1Signal.resolve();\n } else if (frame.isEndSignal(2)) {\n end2Signal.resolve();\n } else {\n messages.push(frame);\n }\n });\n client.on(\"open\", async () => {\n const group1Client = serviceClient.group(\"group1\");\n const group2Client = serviceClient.group(\"group2\");\n // send to all\n // Send a JSON message\n await group1Client.sendToAll({ message: \"Hello world from group1!\" });\n await group2Client.sendToAll(getEndSignal(1));\n // Send a plain text message\n await group2Client.sendToAll(\"Hi there from group2!\", { contentType: \"text/plain\" });\n\n // Send the binary end signal message\n await group2Client.sendToAll(getEndSignal(2));\n });\n\n await end1Signal.promise;\n await end2Signal.promise;\n client.close();\n assert.equal(messages.length, 2);\n\n // order from different groups is not guaranteed\n assert.isTrue(\n messages.findIndex((s) => s.dataAsString === '{\"message\":\"Hello world from group1!\"}') > -1,\n );\n assert.isTrue(messages.findIndex((s) => s.dataAsString === \"Hi there from group2!\") > -1);\n });\n\n it(\"Subprotocol clients can receive expected messages with different content types\", async function (this: Context) {\n if (!isLiveMode()) this.skip();\n const hub = \"PubSubClientCanReceiveMessage\";\n const messages: PubSubWebSocketFrame[] = [];\n\n // Get token\n const serviceClient = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"),\n hub,\n );\n const token = await serviceClient.getClientAccessToken();\n const endSignal = defer<void>();\n const connectedSignal = defer<void>();\n // Start simple WebSocket connections\n const client = new ws.WebSocket(token.url, \"json.webpubsub.azure.v1\");\n client.on(\"message\", (data, isBinary) => {\n const frame = new PubSubWebSocketFrame(data, isBinary);\n console.log(frame.toString());\n if (frame.message.event === \"connected\") {\n connectedSignal.resolve();\n }\n if (frame.isEndSignal()) {\n endSignal.resolve();\n client.close();\n } else {\n messages.push(frame);\n }\n });\n client.on(\"open\", async () => {\n await connectedSignal.promise;\n\n // send to all\n // Send a JSON message\n await serviceClient.sendToAll({ message: \"Hello world!\" });\n\n // Send a plain text message\n await serviceClient.sendToAll(\"Hi there!\", { contentType: \"text/plain\" });\n\n // Send the binary end signal message\n await serviceClient.sendToAll(getEndSignal());\n });\n\n await endSignal.promise;\n\n assert.equal(messages.length, 3);\n assert.equal(messages[0].message.event, \"connected\");\n assert.equal(\n messages[1].dataAsString,\n '{\"type\":\"message\",\"from\":\"server\",\"dataType\":\"json\",\"data\":{\"message\":\"Hello world!\"}}',\n );\n assert.equal(\n messages[2].dataAsString,\n '{\"type\":\"message\",\"from\":\"server\",\"dataType\":\"text\",\"data\":\"Hi there!\"}',\n );\n });\n\n it(\"Clients can receive messages with filters\", async function (this: Context) {\n if (!isLiveMode()) this.skip();\n const hub = \"ClientCanReceiveMessageWithFilters\";\n\n const messages: SimpleWebSocketFrame[] = [];\n\n // Get token\n const serviceClient = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"),\n hub,\n );\n const token = await serviceClient.getClientAccessToken({ groups: [\"groupA\"] });\n const endSignal = defer<void>();\n // Start simple WebSocket connections\n const client = new ws.WebSocket(token.url);\n client.on(\"message\", (data, isBinary) => {\n const frame = new SimpleWebSocketFrame(data, isBinary);\n console.log(frame.toString());\n if (frame.isEndSignal()) {\n endSignal.resolve();\n client.close();\n } else {\n messages.push(frame);\n }\n });\n client.on(\"open\", async () => {\n // Send a JSON message to anonymous connections\n await serviceClient.sendToAll(\n { message: \"Hello world!\" },\n { filter: \"userId eq null\", messageTtlSeconds: 60 },\n );\n // Send a text message to connections in groupA but not in groupB\n const groupA = \"groupA\";\n const groupB = \"groupB\";\n await serviceClient.sendToAll(\"Hello world!\", {\n contentType: \"text/plain\",\n // use plain text \"'groupA' in groups and not('groupB' in groups)\"\n // or use the odata helper method\n filter: odata`${groupA} in groups and not(${groupB} in groups)`,\n messageTtlSeconds: 60,\n });\n // Send the binary end signal message\n await serviceClient.sendToAll(getEndSignal());\n });\n\n await endSignal.promise;\n\n assert.equal(messages.length, 2);\n assert.equal(messages[0].dataAsString, '{\"message\":\"Hello world!\"}');\n assert.equal(messages[1].dataAsString, \"Hello world!\");\n });\n\n it(\"Clients can join or leave multiple groups with filter\", async function (this: Context) {\n if (!isLiveMode()) this.skip();\n const hub = \"ClientsCanJoinOrLeaveMultipleGroupsWithFilter\";\n\n const messages: SimpleWebSocketFrame[] = [];\n\n // Get token\n const serviceClient = new WebPubSubServiceClient(\n assertEnvironmentVariable(\"WPS_CONNECTION_STRING\"),\n hub,\n );\n const token = await serviceClient.getClientAccessToken({ userId: \"user 1\" });\n const startSignal = defer<void>();\n const endSignal = defer<void>();\n // Start simple WebSocket connections\n const client1 = new ws.WebSocket(token.url);\n const client2 = new ws.WebSocket(token.url);\n let opened = 0;\n\n const onOpen = (): void => {\n opened++;\n if (opened === 2) {\n startSignal.resolve();\n }\n };\n const onMessage = (data: Buffer | ArrayBuffer | Buffer[], isBinary: boolean): void => {\n const frame = new SimpleWebSocketFrame(data, isBinary);\n console.log(frame.toString());\n messages.push(frame);\n if (messages.length === 6) {\n endSignal.resolve();\n }\n };\n client1.on(\"open\", onOpen);\n client2.on(\"open\", onOpen);\n client1.on(\"message\", onMessage);\n client2.on(\"message\", onMessage);\n\n // Wait all clients opened\n await startSignal.promise;\n\n // Add filtered connections to group1 and group2\n await serviceClient.addConnectionsToGroups([\"group1\", \"group2\"], \"userId eq 'user 1'\");\n\n // send to connections in both group1 and group2\n await serviceClient.sendToAll(\n { message: \"Hi json!\" },\n { filter: \"'group1' in groups and 'group2' in groups\" },\n );\n\n // Send a plain text message\n await serviceClient.sendToAll(\"Hi text!\", {\n contentType: \"text/plain\",\n filter: \"'group1' in groups and 'group2' in groups\",\n });\n\n // Send the binary end signal message\n await serviceClient.sendToAll(getEndSignal(2), {\n filter: \"'group1' in groups and 'group2' in groups\",\n });\n\n // Timeout 1000 ms\n await Promise.race([new Promise((resolve) => setTimeout(resolve, 1000)), endSignal.promise]);\n assert.equal(messages.length, 6);\n client1.close();\n client2.close();\n });\n});\n"]}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
2
|
-
// Licensed under the MIT License.
|
3
|
-
/* eslint-disable no-invalid-this */
|
4
|
-
import { odata } from "../src/utils";
|
5
|
-
import { assert } from "chai";
|
6
|
-
describe("Can parse odata to string", function () {
|
7
|
-
it("can wrap different types as expected", async () => {
|
8
|
-
const userId = "vic's";
|
9
|
-
const anonymous = null;
|
10
|
-
const length = 3;
|
11
|
-
const filter = odata `userId eq ${anonymous} or userId eq ${userId} or length(userId) gt ${length}`;
|
12
|
-
assert.equal("userId eq null or userId eq 'vic''s' or length(userId) gt 3", filter);
|
13
|
-
});
|
14
|
-
});
|
15
|
-
//# sourceMappingURL=odata.spec.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"odata.spec.js","sourceRoot":"","sources":["../../test/odata.spec.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,oCAAoC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,QAAQ,CAAC,2BAA2B,EAAE;IACpC,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,MAAM,GAAG,OAAO,CAAC;QACvB,MAAM,SAAS,GAAG,IAAI,CAAC;QACvB,MAAM,MAAM,GAAG,CAAC,CAAC;QACjB,MAAM,MAAM,GAAG,KAAK,CAAA,aAAa,SAAS,iBAAiB,MAAM,yBAAyB,MAAM,EAAE,CAAC;QACnG,MAAM,CAAC,KAAK,CAAC,6DAA6D,EAAE,MAAM,CAAC,CAAC;IACtF,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 { odata } from \"../src/utils\";\nimport { assert } from \"chai\";\n\ndescribe(\"Can parse odata to string\", function () {\n it(\"can wrap different types as expected\", async () => {\n const userId = \"vic's\";\n const anonymous = null;\n const length = 3;\n const filter = odata`userId eq ${anonymous} or userId eq ${userId} or length(userId) gt ${length}`;\n assert.equal(\"userId eq null or userId eq 'vic''s' or length(userId) gt 3\", filter);\n });\n});\n"]}
|
package/dist-esm/test/testEnv.js
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
2
|
-
// Licensed under the MIT License.
|
3
|
-
const envSetupForPlayback = {
|
4
|
-
WPS_CONNECTION_STRING: "Endpoint=endpoint;AccessKey=api_key;Version=1.0;",
|
5
|
-
WPS_API_KEY: "api_key",
|
6
|
-
WPS_ENDPOINT: "https://endpoint",
|
7
|
-
WPS_REVERSE_PROXY_ENDPOINT: "https://endpoint",
|
8
|
-
};
|
9
|
-
const recorderOptions = {
|
10
|
-
envSetupForPlayback,
|
11
|
-
sanitizerOptions: {
|
12
|
-
generalSanitizers: [
|
13
|
-
{
|
14
|
-
regex: true,
|
15
|
-
target: "(?<=http://|https://)(?<host>[^/?]+)",
|
16
|
-
value: "Sanitized",
|
17
|
-
groupForReplace: "host",
|
18
|
-
},
|
19
|
-
],
|
20
|
-
},
|
21
|
-
};
|
22
|
-
export default recorderOptions;
|
23
|
-
//# sourceMappingURL=testEnv.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"testEnv.js","sourceRoot":"","sources":["../../test/testEnv.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,MAAM,mBAAmB,GAA2B;IAClD,qBAAqB,EAAE,kDAAkD;IACzE,WAAW,EAAE,SAAS;IACtB,YAAY,EAAE,kBAAkB;IAChC,0BAA0B,EAAE,kBAAkB;CAC/C,CAAC;AAEF,MAAM,eAAe,GAAyB;IAC5C,mBAAmB;IACnB,gBAAgB,EAAE;QAChB,iBAAiB,EAAE;YACjB;gBACE,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,sCAAsC;gBAC9C,KAAK,EAAE,WAAW;gBAClB,eAAe,EAAE,MAAM;aACxB;SACF;KACF;CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RecorderStartOptions } from \"@azure-tools/test-recorder\";\n\nconst envSetupForPlayback: Record<string, string> = {\n WPS_CONNECTION_STRING: \"Endpoint=endpoint;AccessKey=api_key;Version=1.0;\",\n WPS_API_KEY: \"api_key\",\n WPS_ENDPOINT: \"https://endpoint\",\n WPS_REVERSE_PROXY_ENDPOINT: \"https://endpoint\",\n};\n\nconst recorderOptions: RecorderStartOptions = {\n envSetupForPlayback,\n sanitizerOptions: {\n generalSanitizers: [\n {\n regex: true,\n target: \"(?<=http://|https://)(?<host>[^/?]+)\",\n value: \"Sanitized\",\n groupForReplace: \"host\",\n },\n ],\n },\n};\n\nexport default recorderOptions;\n"]}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|