@azure/eventgrid 4.10.0-alpha.20220421.1 → 4.10.0-alpha.20220517.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,10 +17,10 @@ export function dateToServiceTimeString(d) {
17
17
  const month = d.getUTCMonth() + 1; // getUTCMonth returns 0-11 not 1-12.
18
18
  const day = d.getUTCDate();
19
19
  const year = d.getUTCFullYear();
20
- const hour = d.getUTCHours() === 0 ? 12 : d.getUTCHours() % 12; // getUTCHours returns 0-23, and we want this in 12 hour format.
20
+ const hour = d.getUTCHours() === 0 || d.getUTCHours() === 12 ? 12 : d.getUTCHours() % 12; // getUTCHours returns 0-23, and we want this in 12 hour format.
21
21
  const minute = d.getUTCMinutes().toString().padStart(2, "0");
22
22
  const second = d.getUTCSeconds().toString().padStart(2, "0");
23
- const am = d.getUTCHours() >= 13 ? "PM" : "AM";
23
+ const am = d.getUTCHours() >= 12 ? "PM" : "AM";
24
24
  return `${month}/${day}/${year} ${hour}:${minute}:${second} ${am}`;
25
25
  }
26
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,uBAAuB,CAAC,CAAO;IAC7C,MAAM,KAAK,GAAG,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,qCAAqC;IACxE,MAAM,GAAG,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,CAAC;IAEhC,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,gEAAgE;IAChI,MAAM,MAAM,GAAG,CAAC,CAAC,aAA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H;KACF;AACH,CAAC;AAED,SAAS,6BAA6B,CAAC,CAAM,EAAE,aAAuB;IACpE,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;QACxC,IAAI,OAAO,CAAC,CAAC,YAAY,CAAC,KAAK,WAAW,EAAE;YAC1C,MAAM,IAAI,KAAK,CAAC,uCAAuC,YAAY,GAAG,CAAC,CAAC;SACzE;KACF;AACH,CAAC;AAED,SAAS,gCAAgC,CAAC,CAAM,EAAE,aAAuB;IACvE,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;QACxC,IAAI,OAAO,CAAC,CAAC,YAAY,CAAC,KAAK,WAAW,IAAI,OAAO,CAAC,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE;YACjF,MAAM,IAAI,SAAS,CACjB,mBAAmB,YAAY,uCAAuC,OAAO,CAAC,CAC5E,YAAY,CACb,GAAG,CACL,CAAC;SACH;KACF;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { KeyCredential } from \"@azure/core-auth\";\n\n/**\n * Stringifies a Date object in the format expected by the Event Grid service, for use in a Shared Access Signiture.\n *\n * The service expects this time string to be in the same format as what is returned by the .NET DateTime.ToString\n * method, using the \"en-US\" culture.\n *\n * This corresponds to the .NET format string: \"M/d/yyyy h:mm:ss tt\". For example, the date \"June 5th, 2020, 12:09:03 PM\"\n * is represented as the string \"6/5/2020 12:09:03 PM\"\n *\n * The service expects a UTC time, so this method returns a string based on the UTC time of the provided Date.\n *\n * @param d - The Date object to convert to a string.\n */\nexport function dateToServiceTimeString(d: Date): string {\n const month = d.getUTCMonth() + 1; // getUTCMonth returns 0-11 not 1-12.\n const day = d.getUTCDate();\n const year = d.getUTCFullYear();\n\n const hour = d.getUTCHours() === 0 ? 12 : d.getUTCHours() % 12; // getUTCHours returns 0-23, and we want this in 12 hour format.\n const minute = d.getUTCMinutes().toString().padStart(2, \"0\");\n const second = d.getUTCSeconds().toString().padStart(2, \"0\");\n const am = d.getUTCHours() >= 13 ? \"PM\" : \"AM\";\n\n return `${month}/${day}/${year} ${hour}:${minute}:${second} ${am}`;\n}\n\n/**\n * Returns `true` if the credential object is like the KeyCredential interface (i.e. it has a\n * key property).\n *\n * @param credential - The object to test\n */\nexport function isKeyCredentialLike(o: unknown): o is KeyCredential {\n const castO = o as {\n key: unknown;\n };\n return castO.key !== undefined;\n}\n\nexport function parseAndWrap(jsonStringOrObject: string | Record<string, unknown>): any[] {\n if (typeof jsonStringOrObject === \"string\") {\n const o = JSON.parse(jsonStringOrObject);\n if (Array.isArray(o)) {\n return o;\n } else {\n return [o];\n }\n }\n\n if (Array.isArray(jsonStringOrObject)) {\n return jsonStringOrObject;\n } else {\n return [jsonStringOrObject];\n }\n}\n\nconst EVENT_GRID_SCHEMA_METADATA_VERSION = \"1\";\n\nexport function validateEventGridEvent(o: unknown): void {\n if (typeof o !== \"object\") {\n throw new TypeError(\"event is not an object\");\n }\n\n const castO = o as {\n metadataVersion: unknown;\n };\n validateRequiredStringProperties(o, [\n \"eventType\",\n \"eventTime\",\n \"id\",\n \"subject\",\n \"topic\",\n \"dataVersion\",\n \"metadataVersion\",\n ]);\n\n validateRequiredAnyProperties(o, [\"data\"]);\n\n if (castO.metadataVersion !== EVENT_GRID_SCHEMA_METADATA_VERSION) {\n throw new TypeError(\"event is not in the Event Grid schema\");\n }\n}\n\nconst CLOUD_EVENT_1_0_SPEC_VERSION = \"1.0\";\n\nexport function validateCloudEventEvent(o: unknown): void {\n validateRequiredStringProperties(o, [\"type\", \"source\", \"id\", \"specversion\"]);\n validateOptionalStringProperties(o, [\"time\", \"dataschema\", \"datacontenttype\", \"subject\"]);\n\n if (typeof o !== \"object\") {\n throw new TypeError(\"event is not an object\");\n }\n\n const castO = o as {\n specversion: unknown;\n };\n\n if (castO.specversion !== CLOUD_EVENT_1_0_SPEC_VERSION) {\n throw new Error(\"event is not in the Cloud Event 1.0 schema\");\n }\n}\n\nfunction validateRequiredStringProperties(o: any, propertyNames: string[]): void {\n for (const propertyName of propertyNames) {\n if (typeof o[propertyName] === \"undefined\") {\n throw new Error(`event is missing required property '${propertyName}'`);\n }\n\n if (typeof o[propertyName] !== \"string\") {\n throw new TypeError(\n `event property '${propertyName} should be a 'string', but is '${typeof o[propertyName]}'`\n );\n }\n }\n}\n\nfunction validateRequiredAnyProperties(o: any, propertyNames: string[]): void {\n for (const propertyName of propertyNames) {\n if (typeof o[propertyName] === \"undefined\") {\n throw new Error(`event is missing required property '${propertyName}'`);\n }\n }\n}\n\nfunction validateOptionalStringProperties(o: any, propertyNames: string[]): void {\n for (const propertyName of propertyNames) {\n if (typeof o[propertyName] !== \"undefined\" && typeof o[propertyName] !== \"string\") {\n throw new TypeError(\n `event property '${propertyName}' should be a 'string' but it is a '${typeof o[\n propertyName\n ]}'`\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,uBAAuB,CAAC,CAAO;IAC7C,MAAM,KAAK,GAAG,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,qCAAqC;IACxE,MAAM,GAAG,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,CAAC;IAEhC,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,gEAAgE;IAC1J,MAAM,MAAM,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,CAAC,CAAC,aAAa,EAAE,CA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CAAC,YAAY,CAAC,KAAK,WAAW,EAAE;YAC1C,MAAM,IAAI,KAAK,CAAC,uCAAuC,YAAY,GAAG,CAAC,CAAC;SACzE;KACF;AACH,CAAC;AAED,SAAS,gCAAgC,CAAC,CAAM,EAAE,aAAuB;IACvE,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;QACxC,IAAI,OAAO,CAAC,CAAC,YAAY,CAAC,KAAK,WAAW,IAAI,OAAO,CAAC,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE;YACjF,MAAM,IAAI,SAAS,CACjB,mBAAmB,YAAY,uCAAuC,OAAO,CAAC,CAC5E,YAAY,CACb,GAAG,CACL,CAAC;SACH;KACF;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { KeyCredential } from \"@azure/core-auth\";\n\n/**\n * Stringifies a Date object in the format expected by the Event Grid service, for use in a Shared Access Signiture.\n *\n * The service expects this time string to be in the same format as what is returned by the .NET DateTime.ToString\n * method, using the \"en-US\" culture.\n *\n * This corresponds to the .NET format string: \"M/d/yyyy h:mm:ss tt\". For example, the date \"June 5th, 2020, 12:09:03 PM\"\n * is represented as the string \"6/5/2020 12:09:03 PM\"\n *\n * The service expects a UTC time, so this method returns a string based on the UTC time of the provided Date.\n *\n * @param d - The Date object to convert to a string.\n */\nexport function dateToServiceTimeString(d: Date): string {\n const month = d.getUTCMonth() + 1; // getUTCMonth returns 0-11 not 1-12.\n const day = d.getUTCDate();\n const year = d.getUTCFullYear();\n\n const hour = d.getUTCHours() === 0 || d.getUTCHours() === 12 ? 12 : d.getUTCHours() % 12; // getUTCHours returns 0-23, and we want this in 12 hour format.\n const minute = d.getUTCMinutes().toString().padStart(2, \"0\");\n const second = d.getUTCSeconds().toString().padStart(2, \"0\");\n const am = d.getUTCHours() >= 12 ? \"PM\" : \"AM\";\n\n return `${month}/${day}/${year} ${hour}:${minute}:${second} ${am}`;\n}\n\n/**\n * Returns `true` if the credential object is like the KeyCredential interface (i.e. it has a\n * key property).\n *\n * @param credential - The object to test\n */\nexport function isKeyCredentialLike(o: unknown): o is KeyCredential {\n const castO = o as {\n key: unknown;\n };\n return castO.key !== undefined;\n}\n\nexport function parseAndWrap(jsonStringOrObject: string | Record<string, unknown>): any[] {\n if (typeof jsonStringOrObject === \"string\") {\n const o = JSON.parse(jsonStringOrObject);\n if (Array.isArray(o)) {\n return o;\n } else {\n return [o];\n }\n }\n\n if (Array.isArray(jsonStringOrObject)) {\n return jsonStringOrObject;\n } else {\n return [jsonStringOrObject];\n }\n}\n\nconst EVENT_GRID_SCHEMA_METADATA_VERSION = \"1\";\n\nexport function validateEventGridEvent(o: unknown): void {\n if (typeof o !== \"object\") {\n throw new TypeError(\"event is not an object\");\n }\n\n const castO = o as {\n metadataVersion: unknown;\n };\n validateRequiredStringProperties(o, [\n \"eventType\",\n \"eventTime\",\n \"id\",\n \"subject\",\n \"topic\",\n \"dataVersion\",\n \"metadataVersion\",\n ]);\n\n validateRequiredAnyProperties(o, [\"data\"]);\n\n if (castO.metadataVersion !== EVENT_GRID_SCHEMA_METADATA_VERSION) {\n throw new TypeError(\"event is not in the Event Grid schema\");\n }\n}\n\nconst CLOUD_EVENT_1_0_SPEC_VERSION = \"1.0\";\n\nexport function validateCloudEventEvent(o: unknown): void {\n validateRequiredStringProperties(o, [\"type\", \"source\", \"id\", \"specversion\"]);\n validateOptionalStringProperties(o, [\"time\", \"dataschema\", \"datacontenttype\", \"subject\"]);\n\n if (typeof o !== \"object\") {\n throw new TypeError(\"event is not an object\");\n }\n\n const castO = o as {\n specversion: unknown;\n };\n\n if (castO.specversion !== CLOUD_EVENT_1_0_SPEC_VERSION) {\n throw new Error(\"event is not in the Cloud Event 1.0 schema\");\n }\n}\n\nfunction validateRequiredStringProperties(o: any, propertyNames: string[]): void {\n for (const propertyName of propertyNames) {\n if (typeof o[propertyName] === \"undefined\") {\n throw new Error(`event is missing required property '${propertyName}'`);\n }\n\n if (typeof o[propertyName] !== \"string\") {\n throw new TypeError(\n `event property '${propertyName} should be a 'string', but is '${typeof o[propertyName]}'`\n );\n }\n }\n}\n\nfunction validateRequiredAnyProperties(o: any, propertyNames: string[]): void {\n for (const propertyName of propertyNames) {\n if (typeof o[propertyName] === \"undefined\") {\n throw new Error(`event is missing required property '${propertyName}'`);\n }\n }\n}\n\nfunction validateOptionalStringProperties(o: any, propertyNames: string[]): void {\n for (const propertyName of propertyNames) {\n if (typeof o[propertyName] !== \"undefined\" && typeof o[propertyName] !== \"string\") {\n throw new TypeError(\n `event property '${propertyName}' should be a 'string' but it is a '${typeof o[\n propertyName\n ]}'`\n );\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "An isomorphic client library for the Azure Event Grid service.",
6
- "version": "4.10.0-alpha.20220421.1",
6
+ "version": "4.10.0-alpha.20220517.1",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",
@@ -136,6 +136,6 @@
136
136
  "sinon": "^9.0.2",
137
137
  "source-map-support": "^0.5.9",
138
138
  "ts-node": "^10.0.0",
139
- "typescript": "~4.2.0"
139
+ "typescript": "~4.6.0"
140
140
  }
141
141
  }
package/CHANGELOG.md DELETED
@@ -1,198 +0,0 @@
1
- # Release History
2
-
3
- ## 4.10.0-beta.2 (Unreleased)
4
-
5
- ### Features Added
6
-
7
- ### Breaking Changes
8
-
9
- ### Bugs Fixed
10
-
11
- ### Other Changes
12
-
13
- ## 4.10.0-beta.1 (2022-04-14)
14
-
15
- ### Features Added
16
-
17
- - Add support for specifiying a channel to send to in a specific Partner Topic via the `channelName` property of `SendOptions`.
18
-
19
- ### Other Changes
20
-
21
- - Updated our `@azure/core-tracing` dependency to the latest version (1.0.0).
22
- - Notable changes include Removal of `@opentelemetry/api` as a transitive dependency and ensuring that the active context is properly propagated.
23
- - Customers who would like to continue using OpenTelemetry driven tracing should visit our [OpenTelemetry Instrumentation](https://www.npmjs.com/package/@azure/opentelemetry-instrumentation-azure-sdk) package for instructions.
24
-
25
- ## 4.9.0 (2022-04-07)
26
-
27
- ### Features Added
28
-
29
- - Added new System Events:
30
-
31
- - `Microsoft.HealthcareApis.FhirResourceCreated`
32
- - `Microsoft.HealthcareApis.FhirUpdatedCreated`
33
- - `Microsoft.HealthcareApis.FhirDeletedCreated`
34
-
35
- ## 4.8.0 (2022-03-08)
36
-
37
- ### Features Added
38
-
39
- - Added new value `IdentityUnsupported` to `MediaJobErrorCode` and `Account` to `MediaJobErrorCategory` for `Microsoft.Media` events.
40
-
41
- ## 4.7.0 (2022-02-08)
42
-
43
- ### Key Bug Fixes
44
-
45
- - The TypeScript typings for two events have had small changes to accurately reflect the data sent by Azure.
46
- - `Microsoft.EventHub.CaptureFileCreated`'s `fileurl` property is now correctly cased as `fileUrl`
47
- - `Microsoft.Storage.DirectoryDeleted`'s `recursive` property has been changed from `boolean` to `string`. The service sets this property to the string `"true"` or `"false"`.
48
-
49
- ## 4.6.0 (2022-01-11)
50
-
51
- ### Features Added
52
-
53
- - Added a new property to `AcsRecordingChunkInfo` (for the `Microsoft.Communication.RecordingFileStatusUpdated` system event):
54
-
55
- - `deleteLocation`
56
-
57
- - Added new properties to `ContainerRegistryArtifactEventData` and `ContainerRegistryEventData` (for the `Microsoft.ContainerRegistry.{ChartDeleted|ChartPushed|ImagePushed|ImageDeleted}` system events):
58
-
59
- - `connectedRegistry`
60
- - `location`
61
-
62
- - Added new properties to `AcsRecordingFileStatusUpdatedEventData` (for the `Microsoft.Communication.RecordingFileStatusUpdated` system event):
63
-
64
- - `recordingChannelType`
65
- - `recordingContentType`
66
- - `recordingFormatType`
67
-
68
- ### Key Bug Fixes
69
-
70
- - The TypeScript typings for events from Azure Resource Manager were incorrect. The following properties had their types changed:
71
-
72
- - `authorization`
73
- - `claims`
74
- - `httpRequest`
75
-
76
- Previously, these properties were typed as `string` but the underlying events from the service actually contained objects. Customers using `isSystemEvent` with TypeScript will
77
- now see compliation issues if they try to treat these properties as strings (previously, the code would fail at runtime).
78
-
79
- ## 4.5.0 (2021-10-05)
80
-
81
- ### Features Added
82
-
83
- - Added new properties for the `Microsoft.Media.LiveEventIngestHeartbeat` System Event:
84
-
85
- - `ingestDriftValue`
86
- - `lastFragmentArrivalTime`
87
- - `transcriptionLanguage`
88
- - `transcriptionState`
89
-
90
- - Added new System Events:
91
- - API Management:
92
- - `Microsoft.ApiManagement.APICreated`
93
- - `Microsoft.ApiManagement.APIDeleted`
94
- - `Microsoft.ApiManagement.APIReleaseCreated`
95
- - `Microsoft.ApiManagement.APIReleaseDeleted`
96
- - `Microsoft.ApiManagement.APIReleaseUpdated`
97
- - `Microsoft.ApiManagement.APIUpdated`
98
- - `Microsoft.ApiManagement.ProductCreated`
99
- - `Microsoft.ApiManagement.ProductDeleted`
100
- - `Microsoft.ApiManagement.ProductUpdated`
101
- - `Microsoft.ApiManagement.SubscriptionCreated`
102
- - `Microsoft.ApiManagement.SubscriptionDeleted`
103
- - `Microsoft.ApiManagement.SubscriptionUpdated`
104
- - `Microsoft.ApiManagement.UserCreated`
105
- - `Microsoft.ApiManagement.UserDeleted`
106
- - `Microsoft.ApiManagement.UserUpdated`
107
- - Container Service:
108
- - `Microsoft.ContainerService.NewKubernetesVersionAvailable`
109
- - Communication:
110
- - `Microsoft.Communication.UserDisconnected`
111
- - Media Streaming:
112
- - `Microsoft.Media.LiveEventChannelArchiveHeartbeat`
113
-
114
- ## 4.4.0 (2021-07-19)
115
-
116
- ### Features Added
117
-
118
- - With the dropping of support for Node.js versions that are no longer in LTS, the dependency on `@types/node` has been updated to version 12. Read our
119
- [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
120
- - Updated our internal core package dependencies to their latest versions in order to add support for Opentelemetry 1.0.0 which is compatible with the latest versions of our other client libraries.
121
- - Changed TS compilation target to ES2017 in order to produce smaller bundles and use more native platform features
122
- - `EventGridPublisherClient` now supports Azure Active Directory (AAD) for authentication. When constructing an `EventGridPublisherClient` you may now pass an instance
123
- of a `TokenCredential` as the credential. See the readme for [`@azure/identity`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity) to learn
124
- more about using Azure Active Directory for authentication.
125
-
126
- - Added a "metadata" property for the following system events:
127
-
128
- - `Microsoft.Communication.AcsChatMessageReceived`
129
- - `Microsoft.Communication.AcsChatMessageEdited`
130
- - `Microsoft.Communication.AcsChatMessageReceivedInThread`
131
- - `Microsoft.Communication.AcsChatMessageEditedInThread`
132
-
133
- ## 4.3.0 (2021-06-08)
134
-
135
- ### New Features
136
-
137
- - Added new System Event: `Microsoft.Storage.BlobInventoryPolicyCompleted`
138
-
139
- ### Key Bug Fixes
140
-
141
- - The `Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners` event was incorrectly listed with the name of `Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener`.
142
- This has been corrected. When using TypeScript, you will need to replace any calls to `isSystemEvent("Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener")` with
143
- `isSystemEvent("Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners")`.
144
-
145
- ## 4.2.0 (2021-05-11)
146
-
147
- ### New Features
148
-
149
- - Added new System Events: "Microsoft.PolicyInsights.PolicyStateCreated", "Microsoft.PolicyInsights.PolicyStateChanged", "Microsoft.PolicyInsights.PolicyStateDeleted",
150
- "Microsoft.Storage.AsyncOperationInitiated", "Microsoft.Storage.BlobTierChanged".
151
-
152
- ## 4.1.0 (2021-03-23)
153
-
154
- - The system event names `Microsoft.Communication.ChatParticipantAddedToThread` and `Microsoft.Communication.ChatParticipantRemovedFromThread` have been removed, and
155
- `Microsoft.Communication.ChatThreadParticipantAdded` and `Microsoft.Communication.ChatThreadParticipantRemoved` have been added. The old names did not match the
156
- the type names that Azure Communication Services was using for these events. TypeScript users will now see compliation errors if they are calling `isSystemEvent` with
157
- either `Microsoft.Communication.ChatParticipantAddedToThread` or `Microsoft.Communication.ChatParticipantRemovedFromThread` as the event name. To fix these issues,
158
- replace all uses of `Microsoft.Communication.ChatParticipantAddedToThread` with `Microsoft.Communication.ChatThreadParticipantAdded` and
159
- `Microsoft.Communication.ChatParticipantRemovedFromThread` with `Microsoft.Communication.ChatThreadParticipantRemoved`.
160
-
161
- - Add `Microsoft.Communications.RecordingFileStatusUpdated` system event.
162
-
163
- ## 4.0.0 (2021-03-17)
164
-
165
- - Update version to 4.0.0 to align with other EventGrid SDKs
166
-
167
- ### Breaking Changes
168
-
169
- - `EventGridConsumer` no longer applies any conversions to the `data` property of system events. The interfaces that describe the data payload of each
170
- 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
171
- `Date` objects, and instead are kepts as strings which contain ISO 8601 timestamps.
172
- - 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
173
- event type when deserializing events.
174
- - 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.
175
-
176
- ## 3.0.0-beta.3 (2020-10-06)
177
-
178
- - Added distributed tracing support. `EventGridProducerClient` will now create spans when sending events to Event Grid.
179
- - Added support for system events sent by Azure Key Vault.
180
-
181
- ### Breaking Changes
182
-
183
- - The type definitions for SMS events sent by Azure Communication Services have been renamed, to use the prefix "AcsSms" instead of "Acssms". If you are
184
- using TypeScript and explicitly referencing these interfaces, you will need to update your code to use the new names. The payload of the events is unchanged.
185
- - `EventGridSharedAccessCredential` has been removed, in favor of `AzureSASCredential`. Code which is using `EventGridSharedAccessCredential` should
186
- now use `AzureSASCredential` instead.
187
- - When constructing the client, you must now include the schema type your topic is configured to expect (one of "EventGrid", "CloudEvent" or "Custom").
188
- - The `sendEvents` methods have been collapsed into a single method on the client called `send` which uses the input schema that was configured on the client.
189
-
190
- ## 3.0.0-beta.2 (2020-09-24)
191
-
192
- - Added support for system events sent by the Azure Communication Services.
193
-
194
- ## 3.0.0-beta.1 (2020-09-08)
195
-
196
- - This release is a preview of our efforts to create a client library that is user friendly and
197
- idiomatic to the JavaScript ecosystem. The reasons for most of the changes in this update can be found in the
198
- [Azure SDK Design Guidelines for TypeScript](https://azuresdkspecs.z5.web.core.windows.net/TypeScriptSpec.html).