@azure/eventgrid 4.5.1-alpha.20211214.2 → 4.6.1-alpha.20220124.2

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Release History
2
2
 
3
- ## 4.5.1 (Unreleased)
3
+ ## 4.6.1 (Unreleased)
4
4
 
5
5
  ### Features Added
6
6
 
@@ -10,6 +10,36 @@
10
10
 
11
11
  ### Other Changes
12
12
 
13
+ ## 4.6.0 (2022-01-11)
14
+
15
+ ### Features Added
16
+
17
+ - Added a new property to `AcsRecordingChunkInfo` (for the `Microsoft.Communication.RecordingFileStatusUpdated` system event):
18
+
19
+ - `deleteLocation`
20
+
21
+ - Added new properties to `ContainerRegistryArtifactEventData` and `ContainerRegistryEventData` (for the `Microsoft.ContainerRegistry.{ChartDeleted|ChartPushed|ImagePushed|ImageDeleted}` system events):
22
+
23
+ - `connectedRegistry`
24
+ - `location`
25
+
26
+ - Added new properties to `AcsRecordingFileStatusUpdatedEventData` (for the `Microsoft.Communication.RecordingFileStatusUpdated` system event):
27
+
28
+ - `recordingChannelType`
29
+ - `recordingContentType`
30
+ - `recordingFormatType`
31
+
32
+ ### Key Bug Fixes
33
+
34
+ - The TypeScript typings for events from Azure Resource Manager were incorrect. The following properties had their types changed:
35
+
36
+ - `authorization`
37
+ - `claims`
38
+ - `httpRequest`
39
+
40
+ Previously, these properties were typed as `string` but the underlying events from the service actually contained objects. Customers using `isSystemEvent` with TypeScript will
41
+ now see compliation issues if they try to treat these properties as strings (previously, the code would fail at runtime).
42
+
13
43
  ## 4.5.0 (2021-10-05)
14
44
 
15
45
  ### Features Added
package/dist/index.js CHANGED
@@ -29,14 +29,8 @@ function dateToServiceTimeString(d) {
29
29
  const day = d.getUTCDate();
30
30
  const year = d.getUTCFullYear();
31
31
  const hour = d.getUTCHours() === 0 ? 12 : d.getUTCHours() % 12; // getUTCHours returns 0-23, and we want this in 12 hour format.
32
- const minute = d
33
- .getUTCMinutes()
34
- .toString()
35
- .padStart(2, "0");
36
- const second = d
37
- .getUTCSeconds()
38
- .toString()
39
- .padStart(2, "0");
32
+ const minute = d.getUTCMinutes().toString().padStart(2, "0");
33
+ const second = d.getUTCSeconds().toString().padStart(2, "0");
40
34
  const am = d.getUTCHours() >= 13 ? "PM" : "AM";
41
35
  return `${month}/${day}/${year} ${hour}:${minute}:${second} ${am}`;
42
36
  }
@@ -80,7 +74,7 @@ function validateEventGridEvent(o) {
80
74
  "subject",
81
75
  "topic",
82
76
  "dataVersion",
83
- "metadataVersion"
77
+ "metadataVersion",
84
78
  ]);
85
79
  validateRequiredAnyProperties(o, ["data"]);
86
80
  if (castO.metadataVersion !== EVENT_GRID_SCHEMA_METADATA_VERSION) {
@@ -152,7 +146,7 @@ function eventGridCredentialPolicy(credential) {
152
146
  request.headers.set(SAS_TOKEN_HEADER_NAME, credential.signature);
153
147
  }
154
148
  return next(request);
155
- }
149
+ },
156
150
  };
157
151
  }
158
152
 
@@ -175,7 +169,7 @@ const cloudEventReservedPropertyNames = [
175
169
  "dataschema",
176
170
  "subject",
177
171
  "time",
178
- "data"
172
+ "data",
179
173
  ];
180
174
 
181
175
  /*
@@ -1244,16 +1238,17 @@ const ResourceWriteSuccessEventData = {
1244
1238
  },
1245
1239
  authorization: {
1246
1240
  serializedName: "authorization",
1247
- required: true,
1248
1241
  type: {
1249
- name: "String"
1242
+ name: "Composite",
1243
+ className: "ResourceAuthorization"
1250
1244
  }
1251
1245
  },
1252
1246
  claims: {
1253
1247
  serializedName: "claims",
1254
1248
  required: true,
1255
1249
  type: {
1256
- name: "String"
1250
+ name: "Dictionary",
1251
+ value: { type: { name: "String" } }
1257
1252
  }
1258
1253
  },
1259
1254
  correlationId: {
@@ -1265,6 +1260,72 @@ const ResourceWriteSuccessEventData = {
1265
1260
  },
1266
1261
  httpRequest: {
1267
1262
  serializedName: "httpRequest",
1263
+ type: {
1264
+ name: "Composite",
1265
+ className: "ResourceHttpRequest"
1266
+ }
1267
+ }
1268
+ }
1269
+ }
1270
+ };
1271
+ const ResourceAuthorization = {
1272
+ type: {
1273
+ name: "Composite",
1274
+ className: "ResourceAuthorization",
1275
+ modelProperties: {
1276
+ scope: {
1277
+ serializedName: "scope",
1278
+ required: true,
1279
+ type: {
1280
+ name: "String"
1281
+ }
1282
+ },
1283
+ action: {
1284
+ serializedName: "action",
1285
+ required: true,
1286
+ type: {
1287
+ name: "String"
1288
+ }
1289
+ },
1290
+ evidence: {
1291
+ serializedName: "evidence",
1292
+ required: true,
1293
+ type: {
1294
+ name: "Dictionary",
1295
+ value: { type: { name: "String" } }
1296
+ }
1297
+ }
1298
+ }
1299
+ }
1300
+ };
1301
+ const ResourceHttpRequest = {
1302
+ type: {
1303
+ name: "Composite",
1304
+ className: "ResourceHttpRequest",
1305
+ modelProperties: {
1306
+ clientRequestId: {
1307
+ serializedName: "clientRequestId",
1308
+ required: true,
1309
+ type: {
1310
+ name: "String"
1311
+ }
1312
+ },
1313
+ clientIpAddress: {
1314
+ serializedName: "clientIpAddress",
1315
+ required: true,
1316
+ type: {
1317
+ name: "String"
1318
+ }
1319
+ },
1320
+ method: {
1321
+ serializedName: "method",
1322
+ required: true,
1323
+ type: {
1324
+ name: "String"
1325
+ }
1326
+ },
1327
+ url: {
1328
+ serializedName: "url",
1268
1329
  required: true,
1269
1330
  type: {
1270
1331
  name: "String"
@@ -1329,16 +1390,17 @@ const ResourceWriteFailureEventData = {
1329
1390
  },
1330
1391
  authorization: {
1331
1392
  serializedName: "authorization",
1332
- required: true,
1333
1393
  type: {
1334
- name: "String"
1394
+ name: "Composite",
1395
+ className: "ResourceAuthorization"
1335
1396
  }
1336
1397
  },
1337
1398
  claims: {
1338
1399
  serializedName: "claims",
1339
1400
  required: true,
1340
1401
  type: {
1341
- name: "String"
1402
+ name: "Dictionary",
1403
+ value: { type: { name: "String" } }
1342
1404
  }
1343
1405
  },
1344
1406
  correlationId: {
@@ -1350,9 +1412,9 @@ const ResourceWriteFailureEventData = {
1350
1412
  },
1351
1413
  httpRequest: {
1352
1414
  serializedName: "httpRequest",
1353
- required: true,
1354
1415
  type: {
1355
- name: "String"
1416
+ name: "Composite",
1417
+ className: "ResourceHttpRequest"
1356
1418
  }
1357
1419
  }
1358
1420
  }
@@ -1414,16 +1476,17 @@ const ResourceWriteCancelEventData = {
1414
1476
  },
1415
1477
  authorization: {
1416
1478
  serializedName: "authorization",
1417
- required: true,
1418
1479
  type: {
1419
- name: "String"
1480
+ name: "Composite",
1481
+ className: "ResourceAuthorization"
1420
1482
  }
1421
1483
  },
1422
1484
  claims: {
1423
1485
  serializedName: "claims",
1424
1486
  required: true,
1425
1487
  type: {
1426
- name: "String"
1488
+ name: "Dictionary",
1489
+ value: { type: { name: "String" } }
1427
1490
  }
1428
1491
  },
1429
1492
  correlationId: {
@@ -1435,9 +1498,9 @@ const ResourceWriteCancelEventData = {
1435
1498
  },
1436
1499
  httpRequest: {
1437
1500
  serializedName: "httpRequest",
1438
- required: true,
1439
1501
  type: {
1440
- name: "String"
1502
+ name: "Composite",
1503
+ className: "ResourceHttpRequest"
1441
1504
  }
1442
1505
  }
1443
1506
  }
@@ -1499,16 +1562,17 @@ const ResourceDeleteSuccessEventData = {
1499
1562
  },
1500
1563
  authorization: {
1501
1564
  serializedName: "authorization",
1502
- required: true,
1503
1565
  type: {
1504
- name: "String"
1566
+ name: "Composite",
1567
+ className: "ResourceAuthorization"
1505
1568
  }
1506
1569
  },
1507
1570
  claims: {
1508
1571
  serializedName: "claims",
1509
1572
  required: true,
1510
1573
  type: {
1511
- name: "String"
1574
+ name: "Dictionary",
1575
+ value: { type: { name: "String" } }
1512
1576
  }
1513
1577
  },
1514
1578
  correlationId: {
@@ -1520,9 +1584,9 @@ const ResourceDeleteSuccessEventData = {
1520
1584
  },
1521
1585
  httpRequest: {
1522
1586
  serializedName: "httpRequest",
1523
- required: true,
1524
1587
  type: {
1525
- name: "String"
1588
+ name: "Composite",
1589
+ className: "ResourceHttpRequest"
1526
1590
  }
1527
1591
  }
1528
1592
  }
@@ -1584,16 +1648,17 @@ const ResourceDeleteFailureEventData = {
1584
1648
  },
1585
1649
  authorization: {
1586
1650
  serializedName: "authorization",
1587
- required: true,
1588
1651
  type: {
1589
- name: "String"
1652
+ name: "Composite",
1653
+ className: "ResourceAuthorization"
1590
1654
  }
1591
1655
  },
1592
1656
  claims: {
1593
1657
  serializedName: "claims",
1594
1658
  required: true,
1595
1659
  type: {
1596
- name: "String"
1660
+ name: "Dictionary",
1661
+ value: { type: { name: "String" } }
1597
1662
  }
1598
1663
  },
1599
1664
  correlationId: {
@@ -1605,9 +1670,9 @@ const ResourceDeleteFailureEventData = {
1605
1670
  },
1606
1671
  httpRequest: {
1607
1672
  serializedName: "httpRequest",
1608
- required: true,
1609
1673
  type: {
1610
- name: "String"
1674
+ name: "Composite",
1675
+ className: "ResourceHttpRequest"
1611
1676
  }
1612
1677
  }
1613
1678
  }
@@ -1669,16 +1734,17 @@ const ResourceDeleteCancelEventData = {
1669
1734
  },
1670
1735
  authorization: {
1671
1736
  serializedName: "authorization",
1672
- required: true,
1673
1737
  type: {
1674
- name: "String"
1738
+ name: "Composite",
1739
+ className: "ResourceAuthorization"
1675
1740
  }
1676
1741
  },
1677
1742
  claims: {
1678
1743
  serializedName: "claims",
1679
1744
  required: true,
1680
1745
  type: {
1681
- name: "String"
1746
+ name: "Dictionary",
1747
+ value: { type: { name: "String" } }
1682
1748
  }
1683
1749
  },
1684
1750
  correlationId: {
@@ -1690,9 +1756,9 @@ const ResourceDeleteCancelEventData = {
1690
1756
  },
1691
1757
  httpRequest: {
1692
1758
  serializedName: "httpRequest",
1693
- required: true,
1694
1759
  type: {
1695
- name: "String"
1760
+ name: "Composite",
1761
+ className: "ResourceHttpRequest"
1696
1762
  }
1697
1763
  }
1698
1764
  }
@@ -1754,16 +1820,17 @@ const ResourceActionSuccessEventData = {
1754
1820
  },
1755
1821
  authorization: {
1756
1822
  serializedName: "authorization",
1757
- required: true,
1758
1823
  type: {
1759
- name: "String"
1824
+ name: "Composite",
1825
+ className: "ResourceAuthorization"
1760
1826
  }
1761
1827
  },
1762
1828
  claims: {
1763
1829
  serializedName: "claims",
1764
1830
  required: true,
1765
1831
  type: {
1766
- name: "String"
1832
+ name: "Dictionary",
1833
+ value: { type: { name: "String" } }
1767
1834
  }
1768
1835
  },
1769
1836
  correlationId: {
@@ -1775,9 +1842,9 @@ const ResourceActionSuccessEventData = {
1775
1842
  },
1776
1843
  httpRequest: {
1777
1844
  serializedName: "httpRequest",
1778
- required: true,
1779
1845
  type: {
1780
- name: "String"
1846
+ name: "Composite",
1847
+ className: "ResourceHttpRequest"
1781
1848
  }
1782
1849
  }
1783
1850
  }
@@ -1839,16 +1906,17 @@ const ResourceActionFailureEventData = {
1839
1906
  },
1840
1907
  authorization: {
1841
1908
  serializedName: "authorization",
1842
- required: true,
1843
1909
  type: {
1844
- name: "String"
1910
+ name: "Composite",
1911
+ className: "ResourceAuthorization"
1845
1912
  }
1846
1913
  },
1847
1914
  claims: {
1848
1915
  serializedName: "claims",
1849
1916
  required: true,
1850
1917
  type: {
1851
- name: "String"
1918
+ name: "Dictionary",
1919
+ value: { type: { name: "String" } }
1852
1920
  }
1853
1921
  },
1854
1922
  correlationId: {
@@ -1860,9 +1928,9 @@ const ResourceActionFailureEventData = {
1860
1928
  },
1861
1929
  httpRequest: {
1862
1930
  serializedName: "httpRequest",
1863
- required: true,
1864
1931
  type: {
1865
- name: "String"
1932
+ name: "Composite",
1933
+ className: "ResourceHttpRequest"
1866
1934
  }
1867
1935
  }
1868
1936
  }
@@ -1924,16 +1992,17 @@ const ResourceActionCancelEventData = {
1924
1992
  },
1925
1993
  authorization: {
1926
1994
  serializedName: "authorization",
1927
- required: true,
1928
1995
  type: {
1929
- name: "String"
1996
+ name: "Composite",
1997
+ className: "ResourceAuthorization"
1930
1998
  }
1931
1999
  },
1932
2000
  claims: {
1933
2001
  serializedName: "claims",
1934
2002
  required: true,
1935
2003
  type: {
1936
- name: "String"
2004
+ name: "Dictionary",
2005
+ value: { type: { name: "String" } }
1937
2006
  }
1938
2007
  },
1939
2008
  correlationId: {
@@ -1945,9 +2014,9 @@ const ResourceActionCancelEventData = {
1945
2014
  },
1946
2015
  httpRequest: {
1947
2016
  serializedName: "httpRequest",
1948
- required: true,
1949
2017
  type: {
1950
- name: "String"
2018
+ name: "Composite",
2019
+ className: "ResourceHttpRequest"
1951
2020
  }
1952
2021
  }
1953
2022
  }
@@ -2309,6 +2378,13 @@ const ContainerRegistryEventData = {
2309
2378
  name: "String"
2310
2379
  }
2311
2380
  },
2381
+ location: {
2382
+ serializedName: "location",
2383
+ required: true,
2384
+ type: {
2385
+ name: "String"
2386
+ }
2387
+ },
2312
2388
  target: {
2313
2389
  serializedName: "target",
2314
2390
  type: {
@@ -2336,6 +2412,13 @@ const ContainerRegistryEventData = {
2336
2412
  name: "Composite",
2337
2413
  className: "ContainerRegistryEventSource"
2338
2414
  }
2415
+ },
2416
+ connectedRegistry: {
2417
+ serializedName: "connectedRegistry",
2418
+ type: {
2419
+ name: "Composite",
2420
+ className: "ContainerRegistryEventConnectedRegistry"
2421
+ }
2339
2422
  }
2340
2423
  }
2341
2424
  }
@@ -2477,6 +2560,21 @@ const ContainerRegistryEventSource = {
2477
2560
  }
2478
2561
  }
2479
2562
  };
2563
+ const ContainerRegistryEventConnectedRegistry = {
2564
+ type: {
2565
+ name: "Composite",
2566
+ className: "ContainerRegistryEventConnectedRegistry",
2567
+ modelProperties: {
2568
+ name: {
2569
+ serializedName: "name",
2570
+ required: true,
2571
+ type: {
2572
+ name: "String"
2573
+ }
2574
+ }
2575
+ }
2576
+ }
2577
+ };
2480
2578
  const ContainerRegistryArtifactEventData = {
2481
2579
  type: {
2482
2580
  name: "Composite",
@@ -2503,12 +2601,26 @@ const ContainerRegistryArtifactEventData = {
2503
2601
  name: "String"
2504
2602
  }
2505
2603
  },
2604
+ location: {
2605
+ serializedName: "location",
2606
+ required: true,
2607
+ type: {
2608
+ name: "String"
2609
+ }
2610
+ },
2506
2611
  target: {
2507
2612
  serializedName: "target",
2508
2613
  type: {
2509
2614
  name: "Composite",
2510
2615
  className: "ContainerRegistryArtifactEventTarget"
2511
2616
  }
2617
+ },
2618
+ connectedRegistry: {
2619
+ serializedName: "connectedRegistry",
2620
+ type: {
2621
+ name: "Composite",
2622
+ className: "ContainerRegistryEventConnectedRegistry"
2623
+ }
2512
2624
  }
2513
2625
  }
2514
2626
  }
@@ -5928,6 +6040,27 @@ const AcsRecordingFileStatusUpdatedEventData = {
5928
6040
  name: "Number"
5929
6041
  }
5930
6042
  },
6043
+ recordingContentType: {
6044
+ serializedName: "recordingContentType",
6045
+ required: true,
6046
+ type: {
6047
+ name: "String"
6048
+ }
6049
+ },
6050
+ recordingChannelType: {
6051
+ serializedName: "recordingChannelType",
6052
+ required: true,
6053
+ type: {
6054
+ name: "String"
6055
+ }
6056
+ },
6057
+ recordingFormatType: {
6058
+ serializedName: "recordingFormatType",
6059
+ required: true,
6060
+ type: {
6061
+ name: "String"
6062
+ }
6063
+ },
5931
6064
  sessionEndReason: {
5932
6065
  serializedName: "sessionEndReason",
5933
6066
  required: true,
@@ -5998,6 +6131,13 @@ const AcsRecordingChunkInfo = {
5998
6131
  type: {
5999
6132
  name: "String"
6000
6133
  }
6134
+ },
6135
+ deleteLocation: {
6136
+ serializedName: "deleteLocation",
6137
+ required: true,
6138
+ type: {
6139
+ name: "String"
6140
+ }
6001
6141
  }
6002
6142
  }
6003
6143
  }
@@ -7258,6 +7398,8 @@ var Mappers = /*#__PURE__*/Object.freeze({
7258
7398
  StorageBlobInventoryPolicyCompletedEventData: StorageBlobInventoryPolicyCompletedEventData,
7259
7399
  EventHubCaptureFileCreatedEventData: EventHubCaptureFileCreatedEventData,
7260
7400
  ResourceWriteSuccessEventData: ResourceWriteSuccessEventData,
7401
+ ResourceAuthorization: ResourceAuthorization,
7402
+ ResourceHttpRequest: ResourceHttpRequest,
7261
7403
  ResourceWriteFailureEventData: ResourceWriteFailureEventData,
7262
7404
  ResourceWriteCancelEventData: ResourceWriteCancelEventData,
7263
7405
  ResourceDeleteSuccessEventData: ResourceDeleteSuccessEventData,
@@ -7283,6 +7425,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
7283
7425
  ContainerRegistryEventRequest: ContainerRegistryEventRequest,
7284
7426
  ContainerRegistryEventActor: ContainerRegistryEventActor,
7285
7427
  ContainerRegistryEventSource: ContainerRegistryEventSource,
7428
+ ContainerRegistryEventConnectedRegistry: ContainerRegistryEventConnectedRegistry,
7286
7429
  ContainerRegistryArtifactEventData: ContainerRegistryArtifactEventData,
7287
7430
  ContainerRegistryArtifactEventTarget: ContainerRegistryArtifactEventTarget,
7288
7431
  ServiceBusActiveMessagesAvailableWithNoListenersEventData: ServiceBusActiveMessagesAvailableWithNoListenersEventData,
@@ -7449,7 +7592,7 @@ class GeneratedClientContext extends coreClient.ServiceClient {
7449
7592
  const defaults = {
7450
7593
  requestContentType: "application/json; charset=utf-8"
7451
7594
  };
7452
- const packageDetails = `azsdk-js-eventgrid/4.5.1`;
7595
+ const packageDetails = `azsdk-js-eventgrid/4.6.1`;
7453
7596
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
7454
7597
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
7455
7598
  : `${packageDetails}`;
@@ -7591,7 +7734,7 @@ function cloudEventDistributedTracingEnricherPolicy() {
7591
7734
  request.body = JSON.stringify(parsedBody);
7592
7735
  }
7593
7736
  return next(request);
7594
- }
7737
+ },
7595
7738
  };
7596
7739
  }
7597
7740
 
@@ -7602,7 +7745,7 @@ function cloudEventDistributedTracingEnricherPolicy() {
7602
7745
  */
7603
7746
  const createSpan = coreTracing.createSpanFunction({
7604
7747
  packagePrefix: "Azure.Data.EventGrid",
7605
- namespace: "Microsoft.Messaging.EventGrid"
7748
+ namespace: "Microsoft.Messaging.EventGrid",
7606
7749
  });
7607
7750
 
7608
7751
  // Copyright (c) Microsoft Corporation.
@@ -7637,7 +7780,9 @@ class EventGridPublisherClient {
7637
7780
  ? coreRestPipeline.bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_EVENTGRID_SCOPE })
7638
7781
  : eventGridCredentialPolicy(credential);
7639
7782
  this.client.pipeline.addPolicy(authPolicy);
7640
- this.client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy());
7783
+ this.client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {
7784
+ afterPolicies: [coreRestPipeline.tracingPolicyName],
7785
+ });
7641
7786
  this.apiVersion = this.client.apiVersion;
7642
7787
  }
7643
7788
  /**
@@ -7685,7 +7830,7 @@ function convertEventGridEventToModelType(event) {
7685
7830
  subject: event.subject,
7686
7831
  topic: event.topic,
7687
7832
  data: event.data,
7688
- dataVersion: event.dataVersion
7833
+ dataVersion: event.dataVersion,
7689
7834
  };
7690
7835
  }
7691
7836
  /**
@@ -7724,9 +7869,7 @@ function convertCloudEventToModelType(event) {
7724
7869
  */
7725
7870
  async function sha256Hmac(secret, stringToSign) {
7726
7871
  const decodedSecret = Buffer.from(secret, "base64");
7727
- return crypto.createHmac("sha256", decodedSecret)
7728
- .update(stringToSign)
7729
- .digest("base64");
7872
+ return crypto.createHmac("sha256", decodedSecret).update(stringToSign).digest("base64");
7730
7873
  }
7731
7874
 
7732
7875
  // Copyright (c) Microsoft Corporation.
@@ -7781,7 +7924,7 @@ class EventGridDeserializer {
7781
7924
  specversion: deserialized.specversion,
7782
7925
  id: deserialized.id,
7783
7926
  source: deserialized.source,
7784
- type: deserialized.type
7927
+ type: deserialized.type,
7785
7928
  };
7786
7929
  if (deserialized.datacontenttype !== undefined) {
7787
7930
  modelEvent.datacontenttype = deserialized.datacontenttype;