Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions sdk/eventhub/event-hubs/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
process.env.CHROME_BIN = require("puppeteer").executablePath();
require("dotenv").config();

module.exports = function(config) {
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "./",
Expand All @@ -21,13 +21,13 @@ module.exports = function(config) {
"karma-env-preprocessor",
"karma-coverage",
"karma-sourcemap-loader",
"karma-junit-reporter"
"karma-junit-reporter",
],

// list of files / patterns to load in the browser
files: [
"dist-test/index.browser.js",
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true }
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true },
],

// list of files / patterns to exclude
Expand All @@ -36,7 +36,7 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["env"]
"**/*.js": ["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"]
Expand All @@ -49,7 +49,7 @@ module.exports = function(config) {
"EVENTHUB_CONNECTION_STRING",
"EVENTHUB_NAME",
"IOTHUB_EH_COMPATIBLE_CONNECTION_STRING",
"TEST_TARGET"
"TEST_TARGET",
],

// test results reporter to use
Expand All @@ -64,8 +64,8 @@ module.exports = function(config) {
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
{ type: "html", subdir: "html" },
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }
]
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" },
],
},

junitReporter: {
Expand All @@ -75,7 +75,7 @@ module.exports = function(config) {
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
properties: {}, // key value pair of properties to add to the <properties> section of the report
},

// web server port
Expand Down Expand Up @@ -112,8 +112,8 @@ module.exports = function(config) {
mocha: {
// change Karma's debug.html to the mocha web reporter
reporter: "html",
timeout: "600000"
}
}
timeout: "600000",
},
},
});
};
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
"mocha-junit-reporter": "^2.0.0",
"moment": "^2.24.0",
"nyc": "^15.0.0",
"prettier": "^1.16.4",
"prettier": "^2.5.1",
"puppeteer": "^10.2.0",
"rimraf": "^3.0.0",
"rollup": "^1.16.3",
Expand Down
16 changes: 8 additions & 8 deletions sdk/eventhub/event-hubs/rollup.test.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,32 @@ function makeBrowserTestConfigPatch() {
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)",
"if (!isNode)": "if (true)"
"if (!isNode)": "if (true)",
}),
// fs, net, and tls are used by rhea and need to be shimmed
// dotenv doesn't work in the browser, so replace it with a no-op function
shim({
dotenv: `export function config() { }`
dotenv: `export function config() { }`,
}),
nodeResolve({
mainFields: ["module", "browser"],
preferBuiltins: false
preferBuiltins: false,
}),
cjs({
namedExports: {
chai: ["should", "assert"]
}
chai: ["should", "assert"],
},
}),
// rhea and rhea-promise use the Buffer global which requires
// injection to shim properly
inject({
modules: {
Buffer: ["buffer", "Buffer"],
process: "process"
process: "process",
},
exclude: ["./**/package.json"]
exclude: ["./**/package.json"],
}),
json()
json(),
];

return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ async function convertIotHubToEventHubsConnectionString(connectionString: string
username: `${SharedAccessKeyName}@sas.root.${iotHubName}`,
port: 5671,
reconnect: false,
password: token
password: token,
});
await connection.open();

// Create the receiver that will trigger a redirect error.
const receiver = await connection.createReceiver({
source: { address: `amqps://${HostName}/messages/events/$management` }
source: { address: `amqps://${HostName}/messages/events/$management` },
});

return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -147,7 +147,7 @@ export async function main() {
},
processError: async (err, context) => {
console.log(`Error on partition "${context.partitionId}" : ${err}`);
}
},
},
{ startPosition: earliestEventPosition }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ async function convertIotHubToEventHubsConnectionString(connectionString: string
webSocketOptions: {
webSocket: WebSocket,
protocol: ["AMQPWSB10"],
url: `wss://${HostName}:${443}/$servicebus/websocket`
}
url: `wss://${HostName}:${443}/$servicebus/websocket`,
},
});
await connection.open();

// Create the receiver that will trigger a redirect error.
const receiver = await connection.createReceiver({
source: { address: `amqps://${HostName}/messages/events/$management` }
source: { address: `amqps://${HostName}/messages/events/$management` },
});

return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -153,7 +153,7 @@ export async function main() {
},
processError: async (err, context) => {
console.log(`Error on partition "${context.partitionId}" : ${err}`);
}
},
},
{ startPosition: earliestEventPosition }
);
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/samples-dev/receiveEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function main() {
},
processError: async (err, context) => {
console.log(`Error on partition "${context.partitionId}": ${err}`);
}
},
},
{ startPosition: earliestEventPosition }
);
Expand Down
4 changes: 2 additions & 2 deletions sdk/eventhub/event-hubs/samples-dev/websockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export async function main(): Promise<void> {
const client = new EventHubConsumerClient(consumerGroup, connectionString, eventHubName, {
webSocketOptions: {
webSocket: WebSocket,
webSocketConstructorOptions: { agent: proxyAgent }
}
webSocketConstructorOptions: { agent: proxyAgent },
},
});
/*
Refer to other samples, and place your code here to send/receive events
Expand Down
12 changes: 6 additions & 6 deletions sdk/eventhub/event-hubs/src/batchingPartitionChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
EventDataBatch,
EventHubBufferedProducerClientOptions,
EventHubProducerClient,
OperationOptions
OperationOptions,
} from "./index";
import { isDefined, isObjectWithProperties } from "./util/typeGuards";
import { AbortSignalLike } from "@azure/abort-controller";
Expand Down Expand Up @@ -47,7 +47,7 @@ export class BatchingPartitionChannel {
private _flushState:
| { isFlushing: false }
| { isFlushing: true; currentPromise: Promise<void>; resolve: () => void } = {
isFlushing: false
isFlushing: false,
};
private _isRunning: boolean = false;
private _lastBatchCreationTime: number = 0;
Expand All @@ -67,7 +67,7 @@ export class BatchingPartitionChannel {
onSendEventsErrorHandler,
onSendEventsSuccessHandler,
partitionId,
producer
producer,
}: BatchingPartitionChannelProps) {
this._loopAbortSignal = loopAbortSignal;
this._maxBufferSize = maxBufferSize;
Expand Down Expand Up @@ -242,7 +242,7 @@ export class BatchingPartitionChannel {
this._lastBatchCreationTime = Date.now();
this._batchedEvents = [];
const batch = await this._producer.createBatch({
partitionId: this._partitionId
partitionId: this._partitionId,
});
this._incrementReadiness();
return batch;
Expand Down Expand Up @@ -276,7 +276,7 @@ export class BatchingPartitionChannel {
this._updateFlushState();
this._onSendEventsSuccessHandler?.({
events: this._batchedEvents,
partitionId: this._partitionId
partitionId: this._partitionId,
}).catch((e) => {
logger.error(
`The following error occured in the onSendEventsSuccessHandler: ${JSON.stringify(
Expand All @@ -298,7 +298,7 @@ export class BatchingPartitionChannel {
this._onSendEventsErrorHandler({
error: err,
events: event ? [event] : this._batchedEvents,
partitionId: this._partitionId
partitionId: this._partitionId,
}).catch((e) => {
logger.error(
`The following error occured in the onSendEventsErrorHandler: ${JSON.stringify(
Expand Down
Loading