New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@azure/eventgrid

Package Overview
Dependencies
Maintainers
6
Versions
357
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/eventgrid - npm Package Compare versions

Comparing version 3.0.0-beta.3 to 4.0.0

13

CHANGELOG.md
# Release History
## 4.0.0 (2021-03-17)
- Update version to 4.0.0 to align with other EventGrid SDKs
### Breaking Changes
- `EventGridConsumer` no longer applies any conversions to the `data` property of system events. The interfaces that describe the data payload of each
system event has been updated to reflect this. The most visible impact of this change is that some properties of events are no longer converted into JavaScript
`Date` objects, and instead are kepts as strings which contain ISO 8601 timestamps.
- Related to the above, `EventGridConsumer` no longer accepts a set of custom converters that can be used to further transform the `data` property of a specific
event type when deserializing events.
- The interfaces which describe the shape of the `data` member of system events have been updated so that properties always included in the event are not typed as optional.
## 3.0.0-beta.3 (2020-10-06)

@@ -4,0 +17,0 @@

2

dist-esm/src/constants.js
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
export const SDK_VERSION = "3.0.0-beta.3";
export const SDK_VERSION = "4.0.0";
export const DEFAULT_API_VERSION = "2018-01-01";
//# sourceMappingURL=constants.js.map

@@ -8,3 +8,2 @@ // Copyright (c) Microsoft Corporation.

import { parseAndWrap, validateEventGridEvent, validateCloudEventEvent } from "./util";
import { systemDeserializers } from "./systemEventDecoders";
const serializer = createSerializer();

@@ -21,3 +20,2 @@ /**

* and returned as an instance of the `Uint8Array` type.
* - The `data` payload from system events is converted to match the interfaces this library defines.
*/

@@ -32,5 +30,2 @@ export class EventGridDeserializer {

const deserialized = serializer.deserialize(EventGridEventMapper, o, "");
if (systemDeserializers[deserialized.eventType]) {
deserialized.data = yield systemDeserializers[deserialized.eventType](deserialized.data);
}
events.push(deserialized);

@@ -77,10 +72,6 @@ }

if (!(deserialized.dataBase64 instanceof Uint8Array)) {
throw new TypeError("event data_base64 property is invalid");
throw new TypeError("event data_base64 property is not an instance of Uint8Array");
}
modelEvent.data = deserialized.dataBase64;
}
// If a decoder is registered, apply it to the data.
if (systemDeserializers[modelEvent.type]) {
modelEvent.data = yield systemDeserializers[modelEvent.type](modelEvent.data);
}
// Build the "extensionsAttributes" property bag by removing all known top level properties.

@@ -87,0 +78,0 @@ const extensionAttributes = Object.assign({}, deserialized);

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { __awaiter } from "tslib";
import { createClientPipeline } from "@azure/core-client";
import { eventGridCredentialPolicy } from "./eventGridAuthenticationPolicy";

@@ -50,7 +49,6 @@ import { SDK_VERSION } from "./constants";

}
const pipeline = createClientPipeline(pipelineOptions);
this.client = new GeneratedClient(pipelineOptions);
const authPolicy = eventGridCredentialPolicy(credential);
pipeline.addPolicy(authPolicy);
pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy());
this.client = new GeneratedClient({ pipeline });
this.client.pipeline.addPolicy(authPolicy);
this.client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy());
this.apiVersion = this.client.apiVersion;

@@ -57,0 +55,0 @@ }

@@ -1,9 +0,2 @@

/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
export {};
//# sourceMappingURL=index.js.map

@@ -5,5 +5,5 @@ // Copyright (c) Microsoft Corporation.

export { EventGridPublisherClient } from "./eventGridClient";
export { generateSharedAccessSignature } from "./generateSharedAccessSignature";
export { EventGridDeserializer } from "./consumer";
export { generateSharedAccessSignature } from "./generateSharedAccessSignature";
export { isSystemEvent } from "./predicates";
//# sourceMappingURL=index.js.map
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { getTracer } from "@azure/core-tracing";
import { SpanKind } from "@opentelemetry/api";
import { createSpanFunction } from "@azure/core-tracing";
/**
* Creates a span using the global tracer.
* @internal
* @param name - The name of the operation being performed.
* @param tracingOptions - The options for the underlying http request.
*/
export function createSpan(operationName, operationOptions) {
const tracer = getTracer();
const tracingOptions = operationOptions.tracingOptions || {};
const spanOptions = Object.assign(Object.assign({}, tracingOptions.spanOptions), { kind: SpanKind.INTERNAL });
const span = tracer.startSpan(`Azure.Data.EventGrid.${operationName}`, spanOptions);
span.setAttribute("az.namespace", "Microsoft.Messaging.EventGrid");
let newSpanOptions = tracingOptions.spanOptions || {};
if (span.isRecording()) {
newSpanOptions = Object.assign(Object.assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: Object.assign(Object.assign({}, spanOptions.attributes), { "az.namespace": "Microsoft.Data.EventGrid" }) });
}
const newTracingOptions = Object.assign(Object.assign({}, tracingOptions), { spanOptions: newSpanOptions });
const newOperationOptions = Object.assign(Object.assign({}, operationOptions), { tracingOptions: newTracingOptions });
return {
span,
updatedOptions: newOperationOptions
};
}
export const createSpan = createSpanFunction({
packagePrefix: "Azure.Data.EventGrid",
namespace: "Microsoft.Messaging.EventGrid"
});
//# sourceMappingURL=tracing.js.map

@@ -6,3 +6,3 @@ {

"description": "An isomorphic client library for the Azure Event Grid service.",
"version": "3.0.0-beta.3",
"version": "4.0.0",
"keywords": [

@@ -60,5 +60,3 @@ "node",

"clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"execute:js-samples": "node ../../../common/scripts/run-samples.js samples/javascript/",
"execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/samples/typescript/src/",
"execute:samples": "npm run build:samples && npm run execute:js-samples && npm run execute:ts-samples",
"execute:samples": "npm run build:samples && dev-tool samples run samples/javascript samples/typescript/dist/samples/typescript/src/",
"extract-api": "tsc -p . && api-extractor run --local",

@@ -85,5 +83,5 @@ "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",

"@azure/core-auth": "^1.2.0",
"@azure/core-client": "1.0.0-beta.1",
"@azure/core-https": "1.0.0-beta.1",
"@azure/core-tracing": "1.0.0-preview.9",
"@azure/core-client": "^1.0.0",
"@azure/core-rest-pipeline": "^1.0.0",
"@azure/core-tracing": "1.0.0-preview.10",
"@azure/logger": "^1.0.0",

@@ -116,3 +114,3 @@ "@opentelemetry/api": "^0.10.2",

"eslint": "^7.15.0",
"karma": "^5.1.0",
"karma": "^6.2.0",
"karma-chrome-launcher": "^3.0.0",

@@ -119,0 +117,0 @@ "karma-coverage": "^2.0.0",

@@ -13,3 +13,3 @@ # Azure Event Grid client library for JavaScript

[Package (NPM)](https://www.npmjs.com/package/@azure/eventgrid/v/next) |
[API reference documentation](https://aka.ms/azsdk-js-eventgrid-ref-docs) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/eventgrid/?view=azure-node-preview) |
[Product documentation](https://docs.microsoft.com/azure/event-grid/) |

@@ -227,3 +227,3 @@ [Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/eventgrid/eventgrid/samples)

`EventGridDeserializer` can be used to deserialize events delivered by Event Grid. When deserializing an event, you need to know the schema used to deliver the event. In this example we have events being delivered to an Azure Service Bus Topic in the Cloud Events schema. Using the Service Bus SDK we can recieve these events from the Service Bus Topic and then deserialize them using `EventGridDeserializer` and use `isSystemEvent` to detect what type of events they are.
`EventGridDeserializer` can be used to deserialize events delivered by Event Grid. When deserializing an event, you need to know the schema used to deliver the event. In this example we have events being delivered to an Azure Service Bus Queue in the Cloud Events schema. Using the Service Bus SDK we can receive these events from the Service Bus Queue and then deserialize them using `EventGridDeserializer` and use `isSystemEvent` to detect what type of events they are.

@@ -244,3 +244,3 @@ ```js

// so we just pluck the first one.
const event = (await consumer.decodeCloudEvents(message.body))[0];
const event = (await consumer.deserializeCloudEvents(message.body))[0];

@@ -272,10 +272,10 @@ if (isSystemEvent("Microsoft.ContainerRegistry.ImagePushed", event)) {

### Enable logs
### Logging
You can set the following environment variable to get the debug logging output when using this library.
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
- Getting debug logs from the Azure Event Grid client library
```javascript
import { setLogLevel } from "@azure/logger";
```bash
export AZURE_LOG_LEVEL=verbose
setLogLevel("info");
```

@@ -282,0 +282,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc