@azure/eventgrid 4.5.1-alpha.20211110.2 → 4.5.1-alpha.20220105.3

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/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
  /*
@@ -7591,7 +7585,7 @@ function cloudEventDistributedTracingEnricherPolicy() {
7591
7585
  request.body = JSON.stringify(parsedBody);
7592
7586
  }
7593
7587
  return next(request);
7594
- }
7588
+ },
7595
7589
  };
7596
7590
  }
7597
7591
 
@@ -7602,7 +7596,7 @@ function cloudEventDistributedTracingEnricherPolicy() {
7602
7596
  */
7603
7597
  const createSpan = coreTracing.createSpanFunction({
7604
7598
  packagePrefix: "Azure.Data.EventGrid",
7605
- namespace: "Microsoft.Messaging.EventGrid"
7599
+ namespace: "Microsoft.Messaging.EventGrid",
7606
7600
  });
7607
7601
 
7608
7602
  // Copyright (c) Microsoft Corporation.
@@ -7637,7 +7631,9 @@ class EventGridPublisherClient {
7637
7631
  ? coreRestPipeline.bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_EVENTGRID_SCOPE })
7638
7632
  : eventGridCredentialPolicy(credential);
7639
7633
  this.client.pipeline.addPolicy(authPolicy);
7640
- this.client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy());
7634
+ this.client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {
7635
+ afterPolicies: [coreRestPipeline.tracingPolicyName],
7636
+ });
7641
7637
  this.apiVersion = this.client.apiVersion;
7642
7638
  }
7643
7639
  /**
@@ -7685,7 +7681,7 @@ function convertEventGridEventToModelType(event) {
7685
7681
  subject: event.subject,
7686
7682
  topic: event.topic,
7687
7683
  data: event.data,
7688
- dataVersion: event.dataVersion
7684
+ dataVersion: event.dataVersion,
7689
7685
  };
7690
7686
  }
7691
7687
  /**
@@ -7724,9 +7720,7 @@ function convertCloudEventToModelType(event) {
7724
7720
  */
7725
7721
  async function sha256Hmac(secret, stringToSign) {
7726
7722
  const decodedSecret = Buffer.from(secret, "base64");
7727
- return crypto.createHmac("sha256", decodedSecret)
7728
- .update(stringToSign)
7729
- .digest("base64");
7723
+ return crypto.createHmac("sha256", decodedSecret).update(stringToSign).digest("base64");
7730
7724
  }
7731
7725
 
7732
7726
  // Copyright (c) Microsoft Corporation.
@@ -7781,7 +7775,7 @@ class EventGridDeserializer {
7781
7775
  specversion: deserialized.specversion,
7782
7776
  id: deserialized.id,
7783
7777
  source: deserialized.source,
7784
- type: deserialized.type
7778
+ type: deserialized.type,
7785
7779
  };
7786
7780
  if (deserialized.datacontenttype !== undefined) {
7787
7781
  modelEvent.datacontenttype = deserialized.datacontenttype;