@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.
@@ -47,7 +47,7 @@ export function cloudEventDistributedTracingEnricherPolicy() {
47
47
  request.body = JSON.stringify(parsedBody);
48
48
  }
49
49
  return next(request);
50
- }
50
+ },
51
51
  };
52
52
  }
53
53
  //# sourceMappingURL=cloudEventDistrubtedTracingEnricherPolicy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudEventDistrubtedTracingEnricherPolicy.js","sourceRoot":"","sources":["../../src/cloudEventDistrubtedTracingEnricherPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,MAAM,CAAC,MAAM,0BAA0B,GAAG,mDAAmD,CAAC;AAC9F,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC;AACnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEpD;;GAEG;AACH,MAAM,CAAC,MAAM,8CAA8C,GACzD,4CAA4C,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,0CAA0C;IACxD,OAAO;QACL,IAAI,EAAE,8CAA8C;QACpD,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YAC/D,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;YAE7D,IACE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,KAAK,0BAA0B;gBACzE,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;gBAChC,WAAW,EACX;gBACA,yFAAyF;gBACzF,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAU,CAAC;gBAErD,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;oBAC7B,yFAAyF;oBACzF,2FAA2F;oBAC3F,uFAAuF;oBACvF,6EAA6E;oBAC7E,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE;wBAChD,SAAS;qBACV;oBAED,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;oBAC/B,IAAI,UAAU,EAAE;wBACd,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;qBAC9B;iBACF;gBAED,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;aAC3C;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PipelineResponse,\n PipelineRequest,\n SendRequest,\n PipelinePolicy\n} from \"@azure/core-rest-pipeline\";\n\nexport const CloudEventBatchContentType = \"application/cloudevents-batch+json; charset=utf-8\";\nexport const TraceParentHeaderName = \"traceparent\";\nexport const TraceStateHeaderName = \"tracestate\";\nexport const ContentTypeHeaderName = \"Content-Type\";\n\n/**\n * The programmatic identifier of the cloudEventDistributedTracingEnricherPolicy.\n */\nexport const cloudEventDistributedTracingEnricherPolicyName =\n \"cloudEventDistributedTracingEnricherPolicy\";\n\n/**\n * cloudEventDistributedTracingEnricherPolicy is a policy which adds distributed tracing information\n * to a batch of cloud events. It does so by copying the `traceparent` and `tracestate` properties\n * from the HTTP request into the individual events as extension properties.\n *\n * This will only happen in the case where an event does not have a `traceparent` defined already. This\n * allows events to explicitly set a traceparent and tracestate which would be respected during \"multi-hop\n * transmition\".\n *\n * See https://github.com/cloudevents/spec/blob/master/extensions/distributed-tracing.md\n * for more information on distributed tracing and cloud events.\n */\nexport function cloudEventDistributedTracingEnricherPolicy(): PipelinePolicy {\n return {\n name: cloudEventDistributedTracingEnricherPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const traceparent = request.headers.get(TraceParentHeaderName);\n const tracestate = request.headers.get(TraceStateHeaderName);\n\n if (\n request.headers.get(ContentTypeHeaderName) === CloudEventBatchContentType &&\n typeof request.body === \"string\" &&\n traceparent\n ) {\n // per the cloud event batched content type we know the body is an array encoded in JSON.\n const parsedBody = JSON.parse(request.body) as any[];\n\n for (const item of parsedBody) {\n // When using the distributed tracing extension, the \"traceparent\" is a required property\n // and \"tracestate\" is optional. This means if an item already has a \"traceparent\" property\n // we should not stomp over it. Well formed events will not have a \"tracestate\" without\n // also having a \"traceparent\" so there's no need to guard against that case.\n if (typeof item !== \"object\" || item.traceparent) {\n continue;\n }\n\n item.traceparent = traceparent;\n if (tracestate) {\n item.tracestate = tracestate;\n }\n }\n\n request.body = JSON.stringify(parsedBody);\n }\n\n return next(request);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"cloudEventDistrubtedTracingEnricherPolicy.js","sourceRoot":"","sources":["../../src/cloudEventDistrubtedTracingEnricherPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,MAAM,CAAC,MAAM,0BAA0B,GAAG,mDAAmD,CAAC;AAC9F,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC;AACnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEpD;;GAEG;AACH,MAAM,CAAC,MAAM,8CAA8C,GACzD,4CAA4C,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,0CAA0C;IACxD,OAAO;QACL,IAAI,EAAE,8CAA8C;QACpD,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YAC/D,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;YAE7D,IACE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,KAAK,0BAA0B;gBACzE,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;gBAChC,WAAW,EACX;gBACA,yFAAyF;gBACzF,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAU,CAAC;gBAErD,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;oBAC7B,yFAAyF;oBACzF,2FAA2F;oBAC3F,uFAAuF;oBACvF,6EAA6E;oBAC7E,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE;wBAChD,SAAS;qBACV;oBAED,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;oBAC/B,IAAI,UAAU,EAAE;wBACd,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;qBAC9B;iBACF;gBAED,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;aAC3C;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PipelineResponse,\n PipelineRequest,\n SendRequest,\n PipelinePolicy,\n} from \"@azure/core-rest-pipeline\";\n\nexport const CloudEventBatchContentType = \"application/cloudevents-batch+json; charset=utf-8\";\nexport const TraceParentHeaderName = \"traceparent\";\nexport const TraceStateHeaderName = \"tracestate\";\nexport const ContentTypeHeaderName = \"Content-Type\";\n\n/**\n * The programmatic identifier of the cloudEventDistributedTracingEnricherPolicy.\n */\nexport const cloudEventDistributedTracingEnricherPolicyName =\n \"cloudEventDistributedTracingEnricherPolicy\";\n\n/**\n * cloudEventDistributedTracingEnricherPolicy is a policy which adds distributed tracing information\n * to a batch of cloud events. It does so by copying the `traceparent` and `tracestate` properties\n * from the HTTP request into the individual events as extension properties.\n *\n * This will only happen in the case where an event does not have a `traceparent` defined already. This\n * allows events to explicitly set a traceparent and tracestate which would be respected during \"multi-hop\n * transmition\".\n *\n * See https://github.com/cloudevents/spec/blob/master/extensions/distributed-tracing.md\n * for more information on distributed tracing and cloud events.\n */\nexport function cloudEventDistributedTracingEnricherPolicy(): PipelinePolicy {\n return {\n name: cloudEventDistributedTracingEnricherPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const traceparent = request.headers.get(TraceParentHeaderName);\n const tracestate = request.headers.get(TraceStateHeaderName);\n\n if (\n request.headers.get(ContentTypeHeaderName) === CloudEventBatchContentType &&\n typeof request.body === \"string\" &&\n traceparent\n ) {\n // per the cloud event batched content type we know the body is an array encoded in JSON.\n const parsedBody = JSON.parse(request.body) as any[];\n\n for (const item of parsedBody) {\n // When using the distributed tracing extension, the \"traceparent\" is a required property\n // and \"tracestate\" is optional. This means if an item already has a \"traceparent\" property\n // we should not stomp over it. Well formed events will not have a \"tracestate\" without\n // also having a \"traceparent\" so there's no need to guard against that case.\n if (typeof item !== \"object\" || item.traceparent) {\n continue;\n }\n\n item.traceparent = traceparent;\n if (tracestate) {\n item.tracestate = tracestate;\n }\n }\n\n request.body = JSON.stringify(parsedBody);\n }\n\n return next(request);\n },\n };\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  // Licensed under the MIT license.
3
3
  import { createSerializer } from "@azure/core-client";
4
4
  import { cloudEventReservedPropertyNames } from "./models";
5
- import { EventGridEvent as EventGridEventMapper, CloudEvent as CloudEventMapper } from "./generated/models/mappers";
5
+ import { EventGridEvent as EventGridEventMapper, CloudEvent as CloudEventMapper, } from "./generated/models/mappers";
6
6
  import { parseAndWrap, validateEventGridEvent, validateCloudEventEvent } from "./util";
7
7
  const serializer = createSerializer();
8
8
  /**
@@ -39,7 +39,7 @@ export class EventGridDeserializer {
39
39
  specversion: deserialized.specversion,
40
40
  id: deserialized.id,
41
41
  source: deserialized.source,
42
- type: deserialized.type
42
+ type: deserialized.type,
43
43
  };
44
44
  if (deserialized.datacontenttype !== undefined) {
45
45
  modelEvent.datacontenttype = deserialized.datacontenttype;
@@ -1 +1 @@
1
- {"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../src/consumer.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSerializer } from \"@azure/core-client\";\nimport { CloudEvent as WireCloudEvent } from \"./generated/models\";\nimport { CloudEvent, EventGridEvent, cloudEventReservedPropertyNames } from \"./models\";\nimport {\n EventGridEvent as EventGridEventMapper,\n CloudEvent as CloudEventMapper\n} from \"./generated/models/mappers\";\nimport { parseAndWrap, validateEventGridEvent, validateCloudEventEvent } from \"./util\";\n\nconst serializer = createSerializer();\n\n/**\n * EventGridDeserializer is used to aid in processing events delivered by EventGrid. It can deserialize a JSON encoded payload\n * of either a single event or batch of events as well as be used to convert the result of `JSON.parse` into an\n * `EventGridEvent` or `CloudEvent` like object.\n *\n * Unlike normal JSON deseralization, EventGridDeserializer does some additional conversions:\n *\n * - The consumer parses the event time property into a `Date` object, for ease of use.\n * - When deserializing an event in the CloudEvent schema, if the event contains binary data, it is base64 decoded\n * and returned as an instance of the `Uint8Array` type.\n */\nexport class EventGridDeserializer {\n /**\n * Deserializes events encoded in the Event Grid schema.\n *\n * @param encodedEvents - the JSON encoded representation of either a single event or an array of\n * events, encoded in the Event Grid Schema.\n */\n public async deserializeEventGridEvents(\n encodedEvents: string\n ): Promise<EventGridEvent<unknown>[]>;\n\n /**\n * Deserializes events encoded in the Event Grid schema.\n *\n * @param encodedEvents - an object representing a single event, encoded in the Event Grid schema.\n */\n public async deserializeEventGridEvents(\n encodedEvents: Record<string, unknown>\n ): Promise<EventGridEvent<unknown>[]>;\n public async deserializeEventGridEvents(\n encodedEvents: string | Record<string, unknown>\n ): Promise<EventGridEvent<unknown>[]> {\n const decodedArray = parseAndWrap(encodedEvents);\n\n const events: EventGridEvent<unknown>[] = [];\n\n for (const o of decodedArray) {\n validateEventGridEvent(o);\n\n const deserialized: EventGridEvent<any> = serializer.deserialize(EventGridEventMapper, o, \"\");\n\n events.push(deserialized as EventGridEvent<unknown>);\n }\n\n return events;\n }\n\n /**\n * Deserializes events encoded in the Cloud Events 1.0 schema.\n *\n * @param encodedEvents - the JSON encoded representation of either a single event or an array of\n * events, encoded in the Cloud Events 1.0 Schema.\n */\n public async deserializeCloudEvents(encodedEvents: string): Promise<CloudEvent<unknown>[]>;\n\n /**\n * Deserializes events encoded in the Cloud Events 1.0 schema.\n *\n * @param encodedEvents - an object representing a single event, encoded in the Cloud Events 1.0 schema.\n */\n public async deserializeCloudEvents(\n encodedEvents: Record<string, unknown>\n ): Promise<CloudEvent<unknown>[]>;\n public async deserializeCloudEvents(\n encodedEvents: string | Record<string, unknown>\n ): Promise<CloudEvent<unknown>[]> {\n const decodedArray = parseAndWrap(encodedEvents);\n\n const events: CloudEvent<unknown>[] = [];\n\n for (const o of decodedArray) {\n validateCloudEventEvent(o);\n\n // Check that the required fields are present and of the correct type and the optional fields are missing\n // or of the correct type.\n\n const deserialized: WireCloudEvent = serializer.deserialize(CloudEventMapper, o, \"\");\n const modelEvent: Record<string, any> = {\n specversion: deserialized.specversion,\n id: deserialized.id,\n source: deserialized.source,\n type: deserialized.type\n };\n\n if (deserialized.datacontenttype !== undefined) {\n modelEvent.datacontenttype = deserialized.datacontenttype;\n }\n\n if (deserialized.dataschema !== undefined) {\n modelEvent.dataschema = deserialized.dataschema;\n }\n\n if (deserialized.subject !== undefined) {\n modelEvent.subject = deserialized.subject;\n }\n\n if (deserialized.time !== undefined) {\n modelEvent.time = deserialized.time;\n }\n\n if (deserialized.data !== undefined) {\n modelEvent.data = deserialized.data;\n }\n\n // If the data the event represents binary, it is encoded as base64 text in a different property on the event and we need to transform it.\n if (deserialized.dataBase64 !== undefined) {\n if (deserialized.data !== undefined) {\n throw new TypeError(\"event contains both a data and data_base64 field\");\n }\n\n if (!(deserialized.dataBase64 instanceof Uint8Array)) {\n throw new TypeError(\"event data_base64 property is not an instance of Uint8Array\");\n }\n\n modelEvent.data = deserialized.dataBase64;\n }\n\n // Build the \"extensionsAttributes\" property bag by removing all known top level properties.\n const extensionAttributes = { ...deserialized };\n for (const propName of cloudEventReservedPropertyNames) {\n delete extensionAttributes[propName];\n }\n delete extensionAttributes.dataBase64;\n\n // If any properties remain, copy them to the model.\n if (Object.keys(extensionAttributes).length > 0) {\n modelEvent.extensionAttributes = extensionAttributes;\n }\n\n events.push(modelEvent as CloudEvent<unknown>);\n }\n\n return events;\n }\n}\n"]}
1
+ {"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../src/consumer.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSerializer } from \"@azure/core-client\";\nimport { CloudEvent as WireCloudEvent } from \"./generated/models\";\nimport { CloudEvent, EventGridEvent, cloudEventReservedPropertyNames } from \"./models\";\nimport {\n EventGridEvent as EventGridEventMapper,\n CloudEvent as CloudEventMapper,\n} from \"./generated/models/mappers\";\nimport { parseAndWrap, validateEventGridEvent, validateCloudEventEvent } from \"./util\";\n\nconst serializer = createSerializer();\n\n/**\n * EventGridDeserializer is used to aid in processing events delivered by EventGrid. It can deserialize a JSON encoded payload\n * of either a single event or batch of events as well as be used to convert the result of `JSON.parse` into an\n * `EventGridEvent` or `CloudEvent` like object.\n *\n * Unlike normal JSON deseralization, EventGridDeserializer does some additional conversions:\n *\n * - The consumer parses the event time property into a `Date` object, for ease of use.\n * - When deserializing an event in the CloudEvent schema, if the event contains binary data, it is base64 decoded\n * and returned as an instance of the `Uint8Array` type.\n */\nexport class EventGridDeserializer {\n /**\n * Deserializes events encoded in the Event Grid schema.\n *\n * @param encodedEvents - the JSON encoded representation of either a single event or an array of\n * events, encoded in the Event Grid Schema.\n */\n public async deserializeEventGridEvents(\n encodedEvents: string\n ): Promise<EventGridEvent<unknown>[]>;\n\n /**\n * Deserializes events encoded in the Event Grid schema.\n *\n * @param encodedEvents - an object representing a single event, encoded in the Event Grid schema.\n */\n public async deserializeEventGridEvents(\n encodedEvents: Record<string, unknown>\n ): Promise<EventGridEvent<unknown>[]>;\n public async deserializeEventGridEvents(\n encodedEvents: string | Record<string, unknown>\n ): Promise<EventGridEvent<unknown>[]> {\n const decodedArray = parseAndWrap(encodedEvents);\n\n const events: EventGridEvent<unknown>[] = [];\n\n for (const o of decodedArray) {\n validateEventGridEvent(o);\n\n const deserialized: EventGridEvent<any> = serializer.deserialize(EventGridEventMapper, o, \"\");\n\n events.push(deserialized as EventGridEvent<unknown>);\n }\n\n return events;\n }\n\n /**\n * Deserializes events encoded in the Cloud Events 1.0 schema.\n *\n * @param encodedEvents - the JSON encoded representation of either a single event or an array of\n * events, encoded in the Cloud Events 1.0 Schema.\n */\n public async deserializeCloudEvents(encodedEvents: string): Promise<CloudEvent<unknown>[]>;\n\n /**\n * Deserializes events encoded in the Cloud Events 1.0 schema.\n *\n * @param encodedEvents - an object representing a single event, encoded in the Cloud Events 1.0 schema.\n */\n public async deserializeCloudEvents(\n encodedEvents: Record<string, unknown>\n ): Promise<CloudEvent<unknown>[]>;\n public async deserializeCloudEvents(\n encodedEvents: string | Record<string, unknown>\n ): Promise<CloudEvent<unknown>[]> {\n const decodedArray = parseAndWrap(encodedEvents);\n\n const events: CloudEvent<unknown>[] = [];\n\n for (const o of decodedArray) {\n validateCloudEventEvent(o);\n\n // Check that the required fields are present and of the correct type and the optional fields are missing\n // or of the correct type.\n\n const deserialized: WireCloudEvent = serializer.deserialize(CloudEventMapper, o, \"\");\n const modelEvent: Record<string, any> = {\n specversion: deserialized.specversion,\n id: deserialized.id,\n source: deserialized.source,\n type: deserialized.type,\n };\n\n if (deserialized.datacontenttype !== undefined) {\n modelEvent.datacontenttype = deserialized.datacontenttype;\n }\n\n if (deserialized.dataschema !== undefined) {\n modelEvent.dataschema = deserialized.dataschema;\n }\n\n if (deserialized.subject !== undefined) {\n modelEvent.subject = deserialized.subject;\n }\n\n if (deserialized.time !== undefined) {\n modelEvent.time = deserialized.time;\n }\n\n if (deserialized.data !== undefined) {\n modelEvent.data = deserialized.data;\n }\n\n // If the data the event represents binary, it is encoded as base64 text in a different property on the event and we need to transform it.\n if (deserialized.dataBase64 !== undefined) {\n if (deserialized.data !== undefined) {\n throw new TypeError(\"event contains both a data and data_base64 field\");\n }\n\n if (!(deserialized.dataBase64 instanceof Uint8Array)) {\n throw new TypeError(\"event data_base64 property is not an instance of Uint8Array\");\n }\n\n modelEvent.data = deserialized.dataBase64;\n }\n\n // Build the \"extensionsAttributes\" property bag by removing all known top level properties.\n const extensionAttributes = { ...deserialized };\n for (const propName of cloudEventReservedPropertyNames) {\n delete extensionAttributes[propName];\n }\n delete extensionAttributes.dataBase64;\n\n // If any properties remain, copy them to the model.\n if (Object.keys(extensionAttributes).length > 0) {\n modelEvent.extensionAttributes = extensionAttributes;\n }\n\n events.push(modelEvent as CloudEvent<unknown>);\n }\n\n return events;\n }\n}\n"]}
@@ -7,7 +7,7 @@
7
7
  export async function sha256Hmac(secret, stringToSign) {
8
8
  const key = await self.crypto.subtle.importKey("raw", Uint8Array.from(atob(secret), (c) => c.charCodeAt(0)), {
9
9
  name: "HMAC",
10
- hash: "SHA-256"
10
+ hash: "SHA-256",
11
11
  }, false, ["sign"]);
12
12
  const sigArray = await self.crypto.subtle.sign("HMAC", key, new TextEncoder().encode(stringToSign));
13
13
  // The conversions here are a bit odd but necessary (see "Unicode strings" in the link below)
@@ -1 +1 @@
1
- {"version":3,"file":"cryptoHelpers.browser.js","sourceRoot":"","sources":["../../src/cryptoHelpers.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc,EAAE,YAAoB;IACnE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAC5C,KAAK,EACL,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EACrD;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,SAAS;KAChB,EACD,KAAK,EACL,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAC5C,MAAM,EACN,GAAG,EACH,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CACvC,CAAC;IAEF,6FAA6F;IAC7F,kFAAkF;IAClF,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// <reference lib=\"dom\"/>\n\n/**\n * @internal\n */\nexport async function sha256Hmac(secret: string, stringToSign: string): Promise<string> {\n const key = await self.crypto.subtle.importKey(\n \"raw\",\n Uint8Array.from(atob(secret), (c) => c.charCodeAt(0)),\n {\n name: \"HMAC\",\n hash: \"SHA-256\"\n },\n false,\n [\"sign\"]\n );\n\n const sigArray = await self.crypto.subtle.sign(\n \"HMAC\",\n key,\n new TextEncoder().encode(stringToSign)\n );\n\n // The conversions here are a bit odd but necessary (see \"Unicode strings\" in the link below)\n // https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa\n return btoa(String.fromCharCode(...new Uint8Array(sigArray)));\n}\n"]}
1
+ {"version":3,"file":"cryptoHelpers.browser.js","sourceRoot":"","sources":["../../src/cryptoHelpers.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc,EAAE,YAAoB;IACnE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAC5C,KAAK,EACL,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EACrD;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,SAAS;KAChB,EACD,KAAK,EACL,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAC5C,MAAM,EACN,GAAG,EACH,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CACvC,CAAC;IAEF,6FAA6F;IAC7F,kFAAkF;IAClF,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// <reference lib=\"dom\"/>\n\n/**\n * @internal\n */\nexport async function sha256Hmac(secret: string, stringToSign: string): Promise<string> {\n const key = await self.crypto.subtle.importKey(\n \"raw\",\n Uint8Array.from(atob(secret), (c) => c.charCodeAt(0)),\n {\n name: \"HMAC\",\n hash: \"SHA-256\",\n },\n false,\n [\"sign\"]\n );\n\n const sigArray = await self.crypto.subtle.sign(\n \"HMAC\",\n key,\n new TextEncoder().encode(stringToSign)\n );\n\n // The conversions here are a bit odd but necessary (see \"Unicode strings\" in the link below)\n // https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa\n return btoa(String.fromCharCode(...new Uint8Array(sigArray)));\n}\n"]}
@@ -6,8 +6,6 @@ import { createHmac } from "crypto";
6
6
  */
7
7
  export async function sha256Hmac(secret, stringToSign) {
8
8
  const decodedSecret = Buffer.from(secret, "base64");
9
- return createHmac("sha256", decodedSecret)
10
- .update(stringToSign)
11
- .digest("base64");
9
+ return createHmac("sha256", decodedSecret).update(stringToSign).digest("base64");
12
10
  }
13
11
  //# sourceMappingURL=cryptoHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cryptoHelpers.js","sourceRoot":"","sources":["../../src/cryptoHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc,EAAE,YAAoB;IACnE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEpD,OAAO,UAAU,CAAC,QAAQ,EAAE,aAAa,CAAC;SACvC,MAAM,CAAC,YAAY,CAAC;SACpB,MAAM,CAAC,QAAQ,CAAC,CAAC;AACtB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createHmac } from \"crypto\";\n\n/**\n * @internal\n */\nexport async function sha256Hmac(secret: string, stringToSign: string): Promise<string> {\n const decodedSecret = Buffer.from(secret, \"base64\");\n\n return createHmac(\"sha256\", decodedSecret)\n .update(stringToSign)\n .digest(\"base64\");\n}\n"]}
1
+ {"version":3,"file":"cryptoHelpers.js","sourceRoot":"","sources":["../../src/cryptoHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc,EAAE,YAAoB;IACnE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEpD,OAAO,UAAU,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACnF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createHmac } from \"crypto\";\n\n/**\n * @internal\n */\nexport async function sha256Hmac(secret: string, stringToSign: string): Promise<string> {\n const decodedSecret = Buffer.from(secret, \"base64\");\n\n return createHmac(\"sha256\", decodedSecret).update(stringToSign).digest(\"base64\");\n}\n"]}
@@ -28,7 +28,7 @@ export function eventGridCredentialPolicy(credential) {
28
28
  request.headers.set(SAS_TOKEN_HEADER_NAME, credential.signature);
29
29
  }
30
30
  return next(request);
31
- }
31
+ },
32
32
  };
33
33
  }
34
34
  //# sourceMappingURL=eventGridAuthenticationPolicy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eventGridAuthenticationPolicy.js","sourceRoot":"","sources":["../../src/eventGridAuthenticationPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C;;GAEG;AACH,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAEzE;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAAyC;IAEzC,OAAO;QACL,IAAI,EAAE,6BAA6B;QACnC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,IAAI,mBAAmB,CAAC,UAAU,CAAC,EAAE;gBACnC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;aAC1D;iBAAM;gBACL,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;aAClE;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { KeyCredential, SASCredential } from \"@azure/core-auth\";\nimport {\n PipelineResponse,\n PipelineRequest,\n SendRequest,\n PipelinePolicy\n} from \"@azure/core-rest-pipeline\";\n\nimport { isKeyCredentialLike } from \"./util\";\n\n/**\n * The name of the header to include when a Shared Key is used for authentication.\n */\nconst API_KEY_HEADER_NAME = \"aeg-sas-key\";\n\n/**\n * The name of the header to include when Shared Access Signature is used for authentication.\n */\nconst SAS_TOKEN_HEADER_NAME = \"aeg-sas-token\";\n\n/**\n * The programmatic identifier of the eventGridCredentialPolicy.\n */\nexport const eventGridCredentialPolicyName = \"eventGridCredentialPolicy\";\n\n/**\n * A concrete implementation of an AzureKeyCredential policy\n * using the appropriate header for Event Grid\n */\nexport function eventGridCredentialPolicy(\n credential: KeyCredential | SASCredential\n): PipelinePolicy {\n return {\n name: eventGridCredentialPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (isKeyCredentialLike(credential)) {\n request.headers.set(API_KEY_HEADER_NAME, credential.key);\n } else {\n request.headers.set(SAS_TOKEN_HEADER_NAME, credential.signature);\n }\n\n return next(request);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"eventGridAuthenticationPolicy.js","sourceRoot":"","sources":["../../src/eventGridAuthenticationPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C;;GAEG;AACH,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAEzE;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAAyC;IAEzC,OAAO;QACL,IAAI,EAAE,6BAA6B;QACnC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,IAAI,mBAAmB,CAAC,UAAU,CAAC,EAAE;gBACnC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;aAC1D;iBAAM;gBACL,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;aAClE;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { KeyCredential, SASCredential } from \"@azure/core-auth\";\nimport {\n PipelineResponse,\n PipelineRequest,\n SendRequest,\n PipelinePolicy,\n} from \"@azure/core-rest-pipeline\";\n\nimport { isKeyCredentialLike } from \"./util\";\n\n/**\n * The name of the header to include when a Shared Key is used for authentication.\n */\nconst API_KEY_HEADER_NAME = \"aeg-sas-key\";\n\n/**\n * The name of the header to include when Shared Access Signature is used for authentication.\n */\nconst SAS_TOKEN_HEADER_NAME = \"aeg-sas-token\";\n\n/**\n * The programmatic identifier of the eventGridCredentialPolicy.\n */\nexport const eventGridCredentialPolicyName = \"eventGridCredentialPolicy\";\n\n/**\n * A concrete implementation of an AzureKeyCredential policy\n * using the appropriate header for Event Grid\n */\nexport function eventGridCredentialPolicy(\n credential: KeyCredential | SASCredential\n): PipelinePolicy {\n return {\n name: eventGridCredentialPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (isKeyCredentialLike(credential)) {\n request.headers.set(API_KEY_HEADER_NAME, credential.key);\n } else {\n request.headers.set(SAS_TOKEN_HEADER_NAME, credential.signature);\n }\n\n return next(request);\n },\n };\n}\n"]}
@@ -3,13 +3,13 @@
3
3
  import { isTokenCredential } from "@azure/core-auth";
4
4
  import { eventGridCredentialPolicy } from "./eventGridAuthenticationPolicy";
5
5
  import { DEFAULT_EVENTGRID_SCOPE } from "./constants";
6
- import { cloudEventReservedPropertyNames } from "./models";
6
+ import { cloudEventReservedPropertyNames, } from "./models";
7
7
  import { GeneratedClient } from "./generated/generatedClient";
8
8
  import { cloudEventDistributedTracingEnricherPolicy } from "./cloudEventDistrubtedTracingEnricherPolicy";
9
9
  import { createSpan } from "./tracing";
10
10
  import { SpanStatusCode } from "@azure/core-tracing";
11
11
  import { v4 as uuidv4 } from "uuid";
12
- import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
12
+ import { bearerTokenAuthenticationPolicy, tracingPolicyName } from "@azure/core-rest-pipeline";
13
13
  /**
14
14
  * Client class for publishing events to the Event Grid Service.
15
15
  */
@@ -41,7 +41,9 @@ export class EventGridPublisherClient {
41
41
  ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_EVENTGRID_SCOPE })
42
42
  : eventGridCredentialPolicy(credential);
43
43
  this.client.pipeline.addPolicy(authPolicy);
44
- this.client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy());
44
+ this.client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {
45
+ afterPolicies: [tracingPolicyName],
46
+ });
45
47
  this.apiVersion = this.client.apiVersion;
46
48
  }
47
49
  /**
@@ -89,7 +91,7 @@ export function convertEventGridEventToModelType(event) {
89
91
  subject: event.subject,
90
92
  topic: event.topic,
91
93
  data: event.data,
92
- dataVersion: event.dataVersion
94
+ dataVersion: event.dataVersion,
93
95
  };
94
96
  }
95
97
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"eventGridClient.js","sourceRoot":"","sources":["../../src/eventGridClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,iBAAiB,EAAgC,MAAM,kBAAkB,CAAC;AAGnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAGL,+BAA+B,EAChC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAK9D,OAAO,EAAE,0CAA0C,EAAE,MAAM,6CAA6C,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAoC5E;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAqBnC;;;;;;;;;;;;;;;;;;OAkBG;IACH,YACE,WAAmB,EACnB,WAAc,EACd,UAA2D,EAC3D,UAA2C,EAAE;QAE7C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAE/B,IAAI,CAAC,MAAM,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QAE3C,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC;YAC9C,CAAC,CAAC,+BAA+B,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;YAClF,CAAC,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;QAE1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,0CAA0C,EAAE,CAAC,CAAC;QAC7E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,MAAsC,EAAE,OAAqB;QACtE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC,+BAA+B,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;QAE5F,IAAI;YACF,QAAQ,IAAI,CAAC,WAAW,EAAE;gBACxB,KAAK,WAAW,CAAC,CAAC;oBAChB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CACpC,IAAI,CAAC,WAAW,EACf,MAAmD,CAAC,GAAG,CACtD,gCAAgC,CACjC,EACD,cAAc,CACf,CAAC;iBACH;gBACD,KAAK,YAAY,CAAC,CAAC;oBACjB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAC9C,IAAI,CAAC,WAAW,EACf,MAAoD,CAAC,GAAG,CAAC,4BAA4B,CAAC,EACvF,cAAc,CACf,CAAC;iBACH;gBACD,KAAK,QAAQ,CAAC,CAAC;oBACb,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAC/C,IAAI,CAAC,WAAW,EAChB,MAA+C,EAC/C,cAAc,CACf,CAAC;iBACH;gBACD,OAAO,CAAC,CAAC;oBACP,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;iBACpE;aACF;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACnE,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAAmC;;IAEnC,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,MAAA,KAAK,CAAC,SAAS,mCAAI,IAAI,IAAI,EAAE;QACxC,EAAE,EAAE,MAAA,KAAK,CAAC,EAAE,mCAAI,MAAM,EAAE;QACxB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,WAAW,EAAE,KAAK,CAAC,WAAW;KAC/B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAA+B;;IAC1E,IAAI,KAAK,CAAC,mBAAmB,EAAE;QAC7B,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,mBAAmB,EAAE;YAChD,+JAA+J;YAC/J,6DAA6D;YAE7D,IACE,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAC7B,+BAA+B,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EACxD;gBACA,MAAM,IAAI,KAAK,CAAC,qCAAqC,QAAQ,EAAE,CAAC,CAAC;aAClE;SACF;KACF;IAED,MAAM,SAAS,mBACb,WAAW,EAAE,KAAK,EAClB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,EAAE,EAAE,MAAA,KAAK,CAAC,EAAE,mCAAI,MAAM,EAAE,EACxB,IAAI,EAAE,MAAA,KAAK,CAAC,IAAI,mCAAI,IAAI,IAAI,EAAE,EAC9B,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,UAAU,EAAE,KAAK,CAAC,UAAU,IACzB,CAAC,MAAA,KAAK,CAAC,mBAAmB,mCAAI,EAAE,CAAC,CACrC,CAAC;IAEF,IAAI,KAAK,CAAC,IAAI,YAAY,UAAU,EAAE;QACpC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE;YAC1B,MAAM,IAAI,KAAK,CACb,6EAA6E,CAC9E,CAAC;SACH;QAED,SAAS,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAClD,SAAS,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC;KACnC;SAAM;QACL,SAAS,CAAC,eAAe,GAAG,MAAA,KAAK,CAAC,eAAe,mCAAI,kBAAkB,CAAC;QACxE,SAAS,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;KAC7B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isTokenCredential, KeyCredential, SASCredential } from \"@azure/core-auth\";\nimport { OperationOptions, CommonClientOptions } from \"@azure/core-client\";\n\nimport { eventGridCredentialPolicy } from \"./eventGridAuthenticationPolicy\";\nimport { DEFAULT_EVENTGRID_SCOPE } from \"./constants\";\nimport {\n SendCloudEventInput,\n SendEventGridEventInput,\n cloudEventReservedPropertyNames\n} from \"./models\";\nimport { GeneratedClient } from \"./generated/generatedClient\";\nimport {\n CloudEvent as CloudEventWireModel,\n EventGridEvent as EventGridEventWireModel\n} from \"./generated/models\";\nimport { cloudEventDistributedTracingEnricherPolicy } from \"./cloudEventDistrubtedTracingEnricherPolicy\";\nimport { createSpan } from \"./tracing\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Options for the Event Grid Client.\n */\nexport type EventGridPublisherClientOptions = CommonClientOptions;\n\n/**\n * Options for the send events operation.\n */\nexport type SendOptions = OperationOptions;\n\n/**\n * A map of input schema names to shapes of the input for the send method on EventGridPublisherClient.\n */\nexport interface InputSchemaToInputTypeMap {\n /**\n * The shape of the input to `send` when the client is configured to send events using the Event Grid schema.\n */\n EventGrid: SendEventGridEventInput<unknown>;\n /**\n * The shape of the input to `send` when the client is configured to send events using the Cloud Event schema.\n */\n CloudEvent: SendCloudEventInput<unknown>;\n /**\n * The shape of the input to `send` when the client is configured to send events using a custom schema.\n */\n\n Custom: Record<string, unknown>;\n}\n\n/**\n * Allowed schema types, to be used when constructing the EventGridPublisherClient.\n */\nexport type InputSchema = keyof InputSchemaToInputTypeMap;\n\n/**\n * Client class for publishing events to the Event Grid Service.\n */\nexport class EventGridPublisherClient<T extends InputSchema> {\n /**\n * The URL to the Event Grid endpoint.\n */\n public readonly endpointUrl: string;\n\n /**\n * The version of the Even Grid service.\n */\n public readonly apiVersion: string;\n\n /**\n * The AutoRest generated client for the EventGrid dataplane.\n */\n private readonly client: GeneratedClient;\n\n /**\n * The schema that will be used when sending events.\n */\n private readonly inputSchema: InputSchema;\n\n /**\n * Creates an instance of EventGridPublisherClient which sends events using the Event Grid Schema.\n *\n * Example usage:\n * ```ts\n * import { EventGridPublisherClient, AzureKeyCredential } from \"@azure/eventgrid\";\n *\n * const client = new EventGridPublisherClient(\n * \"<service endpoint>\",\n * \"EventGrid\",\n * new AzureKeyCredential(\"<api key>\")\n * );\n * ```\n *\n * @param endpointUrl - The URL to the Event Grid endpoint, e.g. https://eg-topic.westus2-1.eventgrid.azure.net/api/events.\n * @param inputSchema - The schema that the Event Grid endpoint is configured to accept. One of \"EventGrid\", \"CloudEvent\", or \"Custom\".\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Event Grid Client.\n */\n constructor(\n endpointUrl: string,\n inputSchema: T,\n credential: KeyCredential | SASCredential | TokenCredential,\n options: EventGridPublisherClientOptions = {}\n ) {\n this.endpointUrl = endpointUrl;\n this.inputSchema = inputSchema;\n\n this.client = new GeneratedClient(options);\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_EVENTGRID_SCOPE })\n : eventGridCredentialPolicy(credential);\n\n this.client.pipeline.addPolicy(authPolicy);\n this.client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy());\n this.apiVersion = this.client.apiVersion;\n }\n\n /**\n * Sends events to a topic.\n *\n * @param events - The events to send. The events should be in the schema used when constructing the client.\n * @param options - Options to control the underlying operation.\n */\n async send(events: InputSchemaToInputTypeMap[T][], options?: SendOptions): Promise<void> {\n const { span, updatedOptions } = createSpan(\"EventGridPublisherClient-send\", options || {});\n\n try {\n switch (this.inputSchema) {\n case \"EventGrid\": {\n return await this.client.publishEvents(\n this.endpointUrl,\n (events as InputSchemaToInputTypeMap[\"EventGrid\"][]).map(\n convertEventGridEventToModelType\n ),\n updatedOptions\n );\n }\n case \"CloudEvent\": {\n return await this.client.publishCloudEventEvents(\n this.endpointUrl,\n (events as InputSchemaToInputTypeMap[\"CloudEvent\"][]).map(convertCloudEventToModelType),\n updatedOptions\n );\n }\n case \"Custom\": {\n return await this.client.publishCustomEventEvents(\n this.endpointUrl,\n events as InputSchemaToInputTypeMap[\"Custom\"][],\n updatedOptions\n );\n }\n default: {\n throw new Error(`Unknown input schema type '${this.inputSchema}'`);\n }\n }\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n}\n\n/**\n * @internal\n */\nexport function convertEventGridEventToModelType(\n event: SendEventGridEventInput<any>\n): EventGridEventWireModel {\n return {\n eventType: event.eventType,\n eventTime: event.eventTime ?? new Date(),\n id: event.id ?? uuidv4(),\n subject: event.subject,\n topic: event.topic,\n data: event.data,\n dataVersion: event.dataVersion\n };\n}\n\n/**\n * @internal\n */\nexport function convertCloudEventToModelType(event: SendCloudEventInput<any>): CloudEventWireModel {\n if (event.extensionAttributes) {\n for (const propName in event.extensionAttributes) {\n // Per the cloud events spec: \"CloudEvents attribute names MUST consist of lower-case letters ('a' to 'z') or digits ('0' to '9') from the ASCII character set\"\n // they also can not match an existing defined property name.\n\n if (\n !/^[a-z0-9]*$/.test(propName) ||\n cloudEventReservedPropertyNames.indexOf(propName) !== -1\n ) {\n throw new Error(`invalid extension attribute name: ${propName}`);\n }\n }\n }\n\n const converted: CloudEventWireModel = {\n specversion: \"1.0\",\n type: event.type,\n source: event.source,\n id: event.id ?? uuidv4(),\n time: event.time ?? new Date(),\n subject: event.subject,\n dataschema: event.dataschema,\n ...(event.extensionAttributes ?? [])\n };\n\n if (event.data instanceof Uint8Array) {\n if (!event.datacontenttype) {\n throw new Error(\n \"a data content type must be provided when sending an event with binary data\"\n );\n }\n\n converted.datacontenttype = event.datacontenttype;\n converted.dataBase64 = event.data;\n } else {\n converted.datacontenttype = event.datacontenttype ?? \"application/json\";\n converted.data = event.data;\n }\n\n return converted;\n}\n"]}
1
+ {"version":3,"file":"eventGridClient.js","sourceRoot":"","sources":["../../src/eventGridClient.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isTokenCredential, KeyCredential, SASCredential } from \"@azure/core-auth\";\nimport { OperationOptions, CommonClientOptions } from \"@azure/core-client\";\n\nimport { eventGridCredentialPolicy } from \"./eventGridAuthenticationPolicy\";\nimport { DEFAULT_EVENTGRID_SCOPE } from \"./constants\";\nimport {\n SendCloudEventInput,\n SendEventGridEventInput,\n cloudEventReservedPropertyNames,\n} from \"./models\";\nimport { GeneratedClient } from \"./generated/generatedClient\";\nimport {\n CloudEvent as CloudEventWireModel,\n EventGridEvent as EventGridEventWireModel,\n} from \"./generated/models\";\nimport { cloudEventDistributedTracingEnricherPolicy } from \"./cloudEventDistrubtedTracingEnricherPolicy\";\nimport { createSpan } from \"./tracing\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { bearerTokenAuthenticationPolicy, tracingPolicyName } from \"@azure/core-rest-pipeline\";\n\n/**\n * Options for the Event Grid Client.\n */\nexport type EventGridPublisherClientOptions = CommonClientOptions;\n\n/**\n * Options for the send events operation.\n */\nexport type SendOptions = OperationOptions;\n\n/**\n * A map of input schema names to shapes of the input for the send method on EventGridPublisherClient.\n */\nexport interface InputSchemaToInputTypeMap {\n /**\n * The shape of the input to `send` when the client is configured to send events using the Event Grid schema.\n */\n EventGrid: SendEventGridEventInput<unknown>;\n /**\n * The shape of the input to `send` when the client is configured to send events using the Cloud Event schema.\n */\n CloudEvent: SendCloudEventInput<unknown>;\n /**\n * The shape of the input to `send` when the client is configured to send events using a custom schema.\n */\n\n Custom: Record<string, unknown>;\n}\n\n/**\n * Allowed schema types, to be used when constructing the EventGridPublisherClient.\n */\nexport type InputSchema = keyof InputSchemaToInputTypeMap;\n\n/**\n * Client class for publishing events to the Event Grid Service.\n */\nexport class EventGridPublisherClient<T extends InputSchema> {\n /**\n * The URL to the Event Grid endpoint.\n */\n public readonly endpointUrl: string;\n\n /**\n * The version of the Even Grid service.\n */\n public readonly apiVersion: string;\n\n /**\n * The AutoRest generated client for the EventGrid dataplane.\n */\n private readonly client: GeneratedClient;\n\n /**\n * The schema that will be used when sending events.\n */\n private readonly inputSchema: InputSchema;\n\n /**\n * Creates an instance of EventGridPublisherClient which sends events using the Event Grid Schema.\n *\n * Example usage:\n * ```ts\n * import { EventGridPublisherClient, AzureKeyCredential } from \"@azure/eventgrid\";\n *\n * const client = new EventGridPublisherClient(\n * \"<service endpoint>\",\n * \"EventGrid\",\n * new AzureKeyCredential(\"<api key>\")\n * );\n * ```\n *\n * @param endpointUrl - The URL to the Event Grid endpoint, e.g. https://eg-topic.westus2-1.eventgrid.azure.net/api/events.\n * @param inputSchema - The schema that the Event Grid endpoint is configured to accept. One of \"EventGrid\", \"CloudEvent\", or \"Custom\".\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Event Grid Client.\n */\n constructor(\n endpointUrl: string,\n inputSchema: T,\n credential: KeyCredential | SASCredential | TokenCredential,\n options: EventGridPublisherClientOptions = {}\n ) {\n this.endpointUrl = endpointUrl;\n this.inputSchema = inputSchema;\n\n this.client = new GeneratedClient(options);\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_EVENTGRID_SCOPE })\n : eventGridCredentialPolicy(credential);\n\n this.client.pipeline.addPolicy(authPolicy);\n this.client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {\n afterPolicies: [tracingPolicyName],\n });\n this.apiVersion = this.client.apiVersion;\n }\n\n /**\n * Sends events to a topic.\n *\n * @param events - The events to send. The events should be in the schema used when constructing the client.\n * @param options - Options to control the underlying operation.\n */\n async send(events: InputSchemaToInputTypeMap[T][], options?: SendOptions): Promise<void> {\n const { span, updatedOptions } = createSpan(\"EventGridPublisherClient-send\", options || {});\n\n try {\n switch (this.inputSchema) {\n case \"EventGrid\": {\n return await this.client.publishEvents(\n this.endpointUrl,\n (events as InputSchemaToInputTypeMap[\"EventGrid\"][]).map(\n convertEventGridEventToModelType\n ),\n updatedOptions\n );\n }\n case \"CloudEvent\": {\n return await this.client.publishCloudEventEvents(\n this.endpointUrl,\n (events as InputSchemaToInputTypeMap[\"CloudEvent\"][]).map(convertCloudEventToModelType),\n updatedOptions\n );\n }\n case \"Custom\": {\n return await this.client.publishCustomEventEvents(\n this.endpointUrl,\n events as InputSchemaToInputTypeMap[\"Custom\"][],\n updatedOptions\n );\n }\n default: {\n throw new Error(`Unknown input schema type '${this.inputSchema}'`);\n }\n }\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n}\n\n/**\n * @internal\n */\nexport function convertEventGridEventToModelType(\n event: SendEventGridEventInput<any>\n): EventGridEventWireModel {\n return {\n eventType: event.eventType,\n eventTime: event.eventTime ?? new Date(),\n id: event.id ?? uuidv4(),\n subject: event.subject,\n topic: event.topic,\n data: event.data,\n dataVersion: event.dataVersion,\n };\n}\n\n/**\n * @internal\n */\nexport function convertCloudEventToModelType(event: SendCloudEventInput<any>): CloudEventWireModel {\n if (event.extensionAttributes) {\n for (const propName in event.extensionAttributes) {\n // Per the cloud events spec: \"CloudEvents attribute names MUST consist of lower-case letters ('a' to 'z') or digits ('0' to '9') from the ASCII character set\"\n // they also can not match an existing defined property name.\n\n if (\n !/^[a-z0-9]*$/.test(propName) ||\n cloudEventReservedPropertyNames.indexOf(propName) !== -1\n ) {\n throw new Error(`invalid extension attribute name: ${propName}`);\n }\n }\n }\n\n const converted: CloudEventWireModel = {\n specversion: \"1.0\",\n type: event.type,\n source: event.source,\n id: event.id ?? uuidv4(),\n time: event.time ?? new Date(),\n subject: event.subject,\n dataschema: event.dataschema,\n ...(event.extensionAttributes ?? []),\n };\n\n if (event.data instanceof Uint8Array) {\n if (!event.datacontenttype) {\n throw new Error(\n \"a data content type must be provided when sending an event with binary data\"\n );\n }\n\n converted.datacontenttype = event.datacontenttype;\n converted.dataBase64 = event.data;\n } else {\n converted.datacontenttype = event.datacontenttype ?? \"application/json\";\n converted.data = event.data;\n }\n\n return converted;\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
3
  export { AzureKeyCredential, AzureSASCredential } from "@azure/core-auth";
4
- export { EventGridPublisherClient } from "./eventGridClient";
5
- export { generateSharedAccessSignature } from "./generateSharedAccessSignature";
4
+ export { EventGridPublisherClient, } from "./eventGridClient";
5
+ export { generateSharedAccessSignature, } from "./generateSharedAccessSignature";
6
6
  export { EventGridDeserializer } from "./consumer";
7
7
  export { isSystemEvent } from "./predicates";
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI1E,OAAO,EACL,wBAAwB,EAKzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,6BAA6B,EAE9B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAqD,MAAM,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { AzureKeyCredential, AzureSASCredential } from \"@azure/core-auth\";\n\nexport { CloudEvent, EventGridEvent, SendCloudEventInput, SendEventGridEventInput } from \"./models\";\n\nexport {\n EventGridPublisherClient,\n EventGridPublisherClientOptions,\n SendOptions,\n InputSchema,\n InputSchemaToInputTypeMap\n} from \"./eventGridClient\";\n\nexport {\n generateSharedAccessSignature,\n GenerateSharedAccessSignatureOptions\n} from \"./generateSharedAccessSignature\";\n\nexport { EventGridDeserializer } from \"./consumer\";\n\nexport { isSystemEvent, KnownSystemEventTypes, SystemEventNameToEventData } from \"./predicates\";\n\nexport {\n AcsChatEventBase,\n AcsChatEventInThreadBase,\n AcsChatMessageEventInThreadBase,\n AcsChatMessageDeletedEventData,\n AcsChatMessageDeletedInThreadEventData,\n AcsChatMessageEditedEventData,\n AcsChatMessageEditedInThreadEventData,\n AcsChatMessageReceivedEventData,\n AcsChatMessageReceivedInThreadEventData,\n AcsChatMessageEventBase,\n AcsChatThreadCreatedWithUserEventData,\n AcsChatThreadPropertiesUpdatedPerUserEventData,\n AcsChatThreadWithUserDeletedEventData,\n AcsChatThreadEventBase,\n AcsChatParticipantAddedToThreadEventData,\n AcsChatParticipantAddedToThreadWithUserEventData,\n AcsChatParticipantRemovedFromThreadEventData,\n AcsChatParticipantRemovedFromThreadWithUserEventData,\n AcsRecordingFileStatusUpdatedEventData,\n AcsRecordingStorageInfo,\n AcsRecordingChunkInfo,\n ApiManagementApiCreatedEventData,\n ApiManagementApiDeletedEventData,\n ApiManagementApiReleaseCreatedEventData,\n ApiManagementApiReleaseDeletedEventData,\n ApiManagementApiReleaseUpdatedEventData,\n ApiManagementApiUpdatedEventData,\n ApiManagementProductCreatedEventData,\n ApiManagementProductDeletedEventData,\n ApiManagementProductUpdatedEventData,\n ApiManagementSubscriptionCreatedEventData,\n ApiManagementSubscriptionDeletedEventData,\n ApiManagementSubscriptionUpdatedEventData,\n ApiManagementUserCreatedEventData,\n ApiManagementUserDeletedEventData,\n ApiManagementUserUpdatedEventData,\n CommunicationIdentifierModel,\n CommunicationUserIdentifierModel,\n CommunicationCloudEnvironmentModel,\n MicrosoftTeamsUserIdentifierModel,\n PhoneNumberIdentifierModel,\n AcsChatThreadParticipant,\n AcsUserDisconnectedEventData,\n AcsSmsDeliveryAttempt,\n AcsSmsDeliveryReportReceivedEventData,\n AcsSmsEventBase,\n AcsSmsReceivedEventData,\n AppConfigurationKeyValueDeletedEventData,\n AppConfigurationKeyValueModifiedEventData,\n AppEventTypeDetail,\n AppServicePlanEventTypeDetail,\n ContainerRegistryArtifactEventTarget,\n ContainerRegistryEventData,\n ContainerRegistryImagePushedEventData,\n ContainerRegistryImageDeletedEventData,\n ContainerRegistryChartDeletedEventData,\n ContainerRegistryChartPushedEventData,\n ContainerServiceNewKubernetesVersionAvailableEventData,\n DeviceConnectionStateEventInfo,\n DeviceTwinInfo,\n DeviceTwinInfoProperties,\n DeviceTwinInfoX509Thumbprint,\n IotHubDeviceCreatedEventData,\n IotHubDeviceDeletedEventData,\n IotHubDeviceConnectedEventData,\n IotHubDeviceDisconnectedEventData,\n IotHubDeviceTelemetryEventData,\n KeyVaultCertificateNewVersionCreatedEventData,\n KeyVaultCertificateNearExpiryEventData,\n KeyVaultCertificateExpiredEventData,\n KeyVaultKeyNewVersionCreatedEventData,\n KeyVaultKeyNearExpiryEventData,\n KeyVaultKeyExpiredEventData,\n KeyVaultSecretNewVersionCreatedEventData,\n KeyVaultSecretNearExpiryEventData,\n KeyVaultSecretExpiredEventData,\n KeyVaultAccessPolicyChangedEventData,\n SubscriptionValidationEventData,\n SubscriptionDeletedEventData,\n EventHubCaptureFileCreatedEventData,\n MachineLearningServicesDatasetDriftDetectedEventData,\n MachineLearningServicesModelDeployedEventData,\n MachineLearningServicesModelRegisteredEventData,\n MachineLearningServicesRunCompletedEventData,\n MachineLearningServicesRunStatusChangedEventData,\n MapsGeofenceEvent,\n MapsGeofenceEnteredEventData,\n MapsGeofenceExitedEventData,\n MapsGeofenceResultEventData,\n MediaJobStateChangeEventData,\n MediaJobOutputStateChangeEventData,\n MediaJobScheduledEventData,\n MediaJobProcessingEventData,\n MediaJobCancelingEventData,\n MediaJobFinishedEventData,\n MediaJobCanceledEventData,\n MediaJobError,\n MediaJobErrorCategory,\n MediaJobErrorDetail,\n MediaJobErrorCode,\n MediaJobRetry,\n MediaJobErroredEventData,\n MediaJobOutputCanceledEventData,\n MediaJobOutputCancelingEventData,\n MediaJobOutputErroredEventData,\n MediaJobOutputFinishedEventData,\n MediaJobOutputProcessingEventData,\n MediaJobOutputScheduledEventData,\n MediaJobOutputProgressEventData,\n MediaJobOutputUnion,\n MediaJobState,\n MediaLiveEventChannelArchiveHeartbeatEventData,\n MediaLiveEventEncoderConnectedEventData,\n MediaLiveEventConnectionRejectedEventData,\n MediaLiveEventEncoderDisconnectedEventData,\n MediaLiveEventIncomingStreamReceivedEventData,\n MediaLiveEventIncomingStreamsOutOfSyncEventData,\n MediaLiveEventIncomingVideoStreamsOutOfSyncEventData,\n MediaLiveEventIncomingDataChunkDroppedEventData,\n MediaLiveEventIngestHeartbeatEventData,\n MediaLiveEventTrackDiscontinuityDetectedEventData,\n ResourceWriteSuccessEventData,\n ResourceWriteFailureEventData,\n ResourceWriteCancelEventData,\n ResourceDeleteSuccessEventData,\n ResourceDeleteFailureEventData,\n ResourceDeleteCancelEventData,\n ResourceActionSuccessEventData,\n ResourceActionFailureEventData,\n ResourceActionCancelEventData,\n ServiceBusActiveMessagesAvailableWithNoListenersEventData,\n ServiceBusDeadletterMessagesAvailableWithNoListenersEventData,\n StorageBlobCreatedEventData,\n StorageBlobDeletedEventData,\n StorageBlobRenamedEventData,\n StorageDirectoryCreatedEventData,\n StorageDirectoryDeletedEventData,\n StorageDirectoryRenamedEventData,\n StorageLifecyclePolicyActionSummaryDetail,\n StorageLifecyclePolicyCompletedEventData,\n WebAppUpdatedEventData,\n WebBackupOperationStartedEventData,\n WebBackupOperationCompletedEventData,\n WebBackupOperationFailedEventData,\n WebRestoreOperationStartedEventData,\n WebRestoreOperationCompletedEventData,\n WebRestoreOperationFailedEventData,\n WebSlotSwapStartedEventData,\n WebSlotSwapCompletedEventData,\n WebSlotSwapFailedEventData,\n WebSlotSwapWithPreviewStartedEventData,\n WebSlotSwapWithPreviewCancelledEventData,\n WebAppServicePlanUpdatedEventData,\n WebAppServicePlanUpdatedEventDataSku,\n AppAction,\n KnownAppAction,\n StampKind,\n KnownStampKind,\n AsyncStatus,\n KnownAsyncStatus,\n ContainerRegistryArtifactEventData,\n ContainerRegistryEventActor,\n ContainerRegistryEventRequest,\n ContainerRegistryEventSource,\n ContainerRegistryEventTarget,\n DeviceConnectionStateEvent,\n DeviceLifeCycleEvent,\n DeviceTelemetryEvent,\n MapsGeofenceGeometry,\n MediaJobOutput,\n MediaJobOutputAsset,\n DeviceTwin,\n DeviceTwinMetadata,\n AppServicePlanAction,\n KnownAppServicePlanAction,\n PolicyInsightsPolicyStateChangedEventData,\n PolicyInsightsPolicyStateCreatedEventData,\n PolicyInsightsPolicyStateDeletedEventData,\n StorageAsyncOperationInitiatedEventData,\n StorageBlobTierChangedEventData,\n StorageBlobInventoryPolicyCompletedEventData\n} from \"./generated/models\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI1E,OAAO,EACL,wBAAwB,GAKzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,6BAA6B,GAE9B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAqD,MAAM,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { AzureKeyCredential, AzureSASCredential } from \"@azure/core-auth\";\n\nexport { CloudEvent, EventGridEvent, SendCloudEventInput, SendEventGridEventInput } from \"./models\";\n\nexport {\n EventGridPublisherClient,\n EventGridPublisherClientOptions,\n SendOptions,\n InputSchema,\n InputSchemaToInputTypeMap,\n} from \"./eventGridClient\";\n\nexport {\n generateSharedAccessSignature,\n GenerateSharedAccessSignatureOptions,\n} from \"./generateSharedAccessSignature\";\n\nexport { EventGridDeserializer } from \"./consumer\";\n\nexport { isSystemEvent, KnownSystemEventTypes, SystemEventNameToEventData } from \"./predicates\";\n\nexport {\n AcsChatEventBase,\n AcsChatEventInThreadBase,\n AcsChatMessageEventInThreadBase,\n AcsChatMessageDeletedEventData,\n AcsChatMessageDeletedInThreadEventData,\n AcsChatMessageEditedEventData,\n AcsChatMessageEditedInThreadEventData,\n AcsChatMessageReceivedEventData,\n AcsChatMessageReceivedInThreadEventData,\n AcsChatMessageEventBase,\n AcsChatThreadCreatedWithUserEventData,\n AcsChatThreadPropertiesUpdatedPerUserEventData,\n AcsChatThreadWithUserDeletedEventData,\n AcsChatThreadEventBase,\n AcsChatParticipantAddedToThreadEventData,\n AcsChatParticipantAddedToThreadWithUserEventData,\n AcsChatParticipantRemovedFromThreadEventData,\n AcsChatParticipantRemovedFromThreadWithUserEventData,\n AcsRecordingFileStatusUpdatedEventData,\n AcsRecordingStorageInfo,\n AcsRecordingChunkInfo,\n ApiManagementApiCreatedEventData,\n ApiManagementApiDeletedEventData,\n ApiManagementApiReleaseCreatedEventData,\n ApiManagementApiReleaseDeletedEventData,\n ApiManagementApiReleaseUpdatedEventData,\n ApiManagementApiUpdatedEventData,\n ApiManagementProductCreatedEventData,\n ApiManagementProductDeletedEventData,\n ApiManagementProductUpdatedEventData,\n ApiManagementSubscriptionCreatedEventData,\n ApiManagementSubscriptionDeletedEventData,\n ApiManagementSubscriptionUpdatedEventData,\n ApiManagementUserCreatedEventData,\n ApiManagementUserDeletedEventData,\n ApiManagementUserUpdatedEventData,\n CommunicationIdentifierModel,\n CommunicationUserIdentifierModel,\n CommunicationCloudEnvironmentModel,\n MicrosoftTeamsUserIdentifierModel,\n PhoneNumberIdentifierModel,\n AcsChatThreadParticipant,\n AcsUserDisconnectedEventData,\n AcsSmsDeliveryAttempt,\n AcsSmsDeliveryReportReceivedEventData,\n AcsSmsEventBase,\n AcsSmsReceivedEventData,\n AppConfigurationKeyValueDeletedEventData,\n AppConfigurationKeyValueModifiedEventData,\n AppEventTypeDetail,\n AppServicePlanEventTypeDetail,\n ContainerRegistryArtifactEventTarget,\n ContainerRegistryEventData,\n ContainerRegistryImagePushedEventData,\n ContainerRegistryImageDeletedEventData,\n ContainerRegistryChartDeletedEventData,\n ContainerRegistryChartPushedEventData,\n ContainerServiceNewKubernetesVersionAvailableEventData,\n DeviceConnectionStateEventInfo,\n DeviceTwinInfo,\n DeviceTwinInfoProperties,\n DeviceTwinInfoX509Thumbprint,\n IotHubDeviceCreatedEventData,\n IotHubDeviceDeletedEventData,\n IotHubDeviceConnectedEventData,\n IotHubDeviceDisconnectedEventData,\n IotHubDeviceTelemetryEventData,\n KeyVaultCertificateNewVersionCreatedEventData,\n KeyVaultCertificateNearExpiryEventData,\n KeyVaultCertificateExpiredEventData,\n KeyVaultKeyNewVersionCreatedEventData,\n KeyVaultKeyNearExpiryEventData,\n KeyVaultKeyExpiredEventData,\n KeyVaultSecretNewVersionCreatedEventData,\n KeyVaultSecretNearExpiryEventData,\n KeyVaultSecretExpiredEventData,\n KeyVaultAccessPolicyChangedEventData,\n SubscriptionValidationEventData,\n SubscriptionDeletedEventData,\n EventHubCaptureFileCreatedEventData,\n MachineLearningServicesDatasetDriftDetectedEventData,\n MachineLearningServicesModelDeployedEventData,\n MachineLearningServicesModelRegisteredEventData,\n MachineLearningServicesRunCompletedEventData,\n MachineLearningServicesRunStatusChangedEventData,\n MapsGeofenceEvent,\n MapsGeofenceEnteredEventData,\n MapsGeofenceExitedEventData,\n MapsGeofenceResultEventData,\n MediaJobStateChangeEventData,\n MediaJobOutputStateChangeEventData,\n MediaJobScheduledEventData,\n MediaJobProcessingEventData,\n MediaJobCancelingEventData,\n MediaJobFinishedEventData,\n MediaJobCanceledEventData,\n MediaJobError,\n MediaJobErrorCategory,\n MediaJobErrorDetail,\n MediaJobErrorCode,\n MediaJobRetry,\n MediaJobErroredEventData,\n MediaJobOutputCanceledEventData,\n MediaJobOutputCancelingEventData,\n MediaJobOutputErroredEventData,\n MediaJobOutputFinishedEventData,\n MediaJobOutputProcessingEventData,\n MediaJobOutputScheduledEventData,\n MediaJobOutputProgressEventData,\n MediaJobOutputUnion,\n MediaJobState,\n MediaLiveEventChannelArchiveHeartbeatEventData,\n MediaLiveEventEncoderConnectedEventData,\n MediaLiveEventConnectionRejectedEventData,\n MediaLiveEventEncoderDisconnectedEventData,\n MediaLiveEventIncomingStreamReceivedEventData,\n MediaLiveEventIncomingStreamsOutOfSyncEventData,\n MediaLiveEventIncomingVideoStreamsOutOfSyncEventData,\n MediaLiveEventIncomingDataChunkDroppedEventData,\n MediaLiveEventIngestHeartbeatEventData,\n MediaLiveEventTrackDiscontinuityDetectedEventData,\n ResourceWriteSuccessEventData,\n ResourceWriteFailureEventData,\n ResourceWriteCancelEventData,\n ResourceDeleteSuccessEventData,\n ResourceDeleteFailureEventData,\n ResourceDeleteCancelEventData,\n ResourceActionSuccessEventData,\n ResourceActionFailureEventData,\n ResourceActionCancelEventData,\n ServiceBusActiveMessagesAvailableWithNoListenersEventData,\n ServiceBusDeadletterMessagesAvailableWithNoListenersEventData,\n StorageBlobCreatedEventData,\n StorageBlobDeletedEventData,\n StorageBlobRenamedEventData,\n StorageDirectoryCreatedEventData,\n StorageDirectoryDeletedEventData,\n StorageDirectoryRenamedEventData,\n StorageLifecyclePolicyActionSummaryDetail,\n StorageLifecyclePolicyCompletedEventData,\n WebAppUpdatedEventData,\n WebBackupOperationStartedEventData,\n WebBackupOperationCompletedEventData,\n WebBackupOperationFailedEventData,\n WebRestoreOperationStartedEventData,\n WebRestoreOperationCompletedEventData,\n WebRestoreOperationFailedEventData,\n WebSlotSwapStartedEventData,\n WebSlotSwapCompletedEventData,\n WebSlotSwapFailedEventData,\n WebSlotSwapWithPreviewStartedEventData,\n WebSlotSwapWithPreviewCancelledEventData,\n WebAppServicePlanUpdatedEventData,\n WebAppServicePlanUpdatedEventDataSku,\n AppAction,\n KnownAppAction,\n StampKind,\n KnownStampKind,\n AsyncStatus,\n KnownAsyncStatus,\n ContainerRegistryArtifactEventData,\n ContainerRegistryEventActor,\n ContainerRegistryEventRequest,\n ContainerRegistryEventSource,\n ContainerRegistryEventTarget,\n DeviceConnectionStateEvent,\n DeviceLifeCycleEvent,\n DeviceTelemetryEvent,\n MapsGeofenceGeometry,\n MediaJobOutput,\n MediaJobOutputAsset,\n DeviceTwin,\n DeviceTwinMetadata,\n AppServicePlanAction,\n KnownAppServicePlanAction,\n PolicyInsightsPolicyStateChangedEventData,\n PolicyInsightsPolicyStateCreatedEventData,\n PolicyInsightsPolicyStateDeletedEventData,\n StorageAsyncOperationInitiatedEventData,\n StorageBlobTierChangedEventData,\n StorageBlobInventoryPolicyCompletedEventData,\n} from \"./generated/models\";\n"]}
@@ -12,6 +12,6 @@ export const cloudEventReservedPropertyNames = [
12
12
  "dataschema",
13
13
  "subject",
14
14
  "time",
15
- "data"
15
+ "data",
16
16
  ];
17
17
  //# sourceMappingURL=models.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA4JlC;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,aAAa;IACb,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,iBAAiB;IACjB,YAAY;IACZ,SAAS;IACT,MAAM;IACN,MAAM;CACP,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * The shape of the input for EventGridProducerClient#sendEventGridEvents\n */\nexport interface SendEventGridEventInput<T> {\n /**\n * The type of the event.\n */\n eventType: string;\n /**\n * The time the event was generated. If not provided, the current time will be used.\n */\n eventTime?: Date;\n /**\n * An unique identifier for the event. If an ID is not provided, a random UUID will be generated\n * and used.\n */\n id?: string;\n /**\n * The resource path of the event source.\n */\n topic?: string;\n /**\n * A resource path relative to the topic path.\n */\n subject: string;\n /**\n * The schema version of the data object.\n */\n dataVersion: string;\n /**\n * Event data specific to the event type.\n */\n data: T;\n}\n\n/**\n * An event in the in the Event Grid Schema.\n */\nexport interface EventGridEvent<T> {\n /**\n * The type of the event.\n */\n eventType: string;\n /**\n * The time the event was generated.\n */\n eventTime: Date;\n /**\n * An unique identifier for the event.\n */\n id: string;\n /**\n * The resource path of the event source.\n */\n topic?: string;\n /**\n * A resource path relative to the topic path.\n */\n subject: string;\n /**\n * The schema version of the data object.\n */\n dataVersion: string;\n /**\n * Event data specific to the event type.\n */\n data: T;\n}\n\n/**\n * * The shape of the input for EventGridProducerClient#sendCloudEvents\n */\nexport interface SendCloudEventInput<T> {\n /**\n * Type of event related to the originating occurrence.\n */\n type: string;\n /**\n * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.\n */\n source: string;\n /**\n * An identifier for the event. The combination of id and source must be unique for each distinct event. If an ID is not provided,\n * a random UUID will be generated and used.\n */\n id?: string;\n /**\n * The time the event was generated. If not provided, the current time will be used.\n */\n time?: Date;\n /**\n * Identifies the schema that data adheres to.\n */\n dataschema?: string;\n /**\n * Content type of data value.\n */\n datacontenttype?: string;\n /**\n * Event data specific to the event type.\n */\n data?: T;\n /**\n * This describes the subject of the event in the context of the event producer (identified by source).\n */\n subject?: string;\n /**\n * Additional context attributes for the event. The Cloud Event specification refers to these as \"extension attributes\".\n */\n extensionAttributes?: Record<string, unknown>;\n}\n\n/**\n * An event in the Cloud Event 1.0 schema.\n */\nexport interface CloudEvent<T> {\n /**\n * Type of event related to the originating occurrence.\n */\n type: string;\n /**\n * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.\n */\n source: string;\n /**\n * An identifier for the event. The combination of id and source must be unique for each distinct event.\n */\n id: string;\n /**\n * The time the event was generated.\n */\n time?: Date;\n /**\n * Identifies the schema that data adheres to.\n */\n dataschema?: string;\n /**\n * Content type of data value.\n */\n datacontenttype?: string;\n /**\n * Event data specific to the event type.\n */\n data?: T;\n /**\n * This describes the subject of the event in the context of the event producer (identified by source).\n */\n subject?: string;\n /**\n * Additional context attributes for the event. The Cloud Event specification refers to these as \"extension attributes\".\n */\n extensionAttributes?: Record<string, unknown>;\n}\n\n/**\n * Property names defined by the CloudEvents 1.0 specification, these may not be reused as the names of extension properties.\n */\nexport const cloudEventReservedPropertyNames = [\n \"specversion\",\n \"id\",\n \"source\",\n \"type\",\n \"datacontenttype\",\n \"dataschema\",\n \"subject\",\n \"time\",\n \"data\"\n];\n\n/**\n * A function which provides custom logic to be used when decoding events.\n */\nexport type CustomEventDataDeserializer = (o: any) => Promise<any>;\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA4JlC;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,aAAa;IACb,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,iBAAiB;IACjB,YAAY;IACZ,SAAS;IACT,MAAM;IACN,MAAM;CACP,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * The shape of the input for EventGridProducerClient#sendEventGridEvents\n */\nexport interface SendEventGridEventInput<T> {\n /**\n * The type of the event.\n */\n eventType: string;\n /**\n * The time the event was generated. If not provided, the current time will be used.\n */\n eventTime?: Date;\n /**\n * An unique identifier for the event. If an ID is not provided, a random UUID will be generated\n * and used.\n */\n id?: string;\n /**\n * The resource path of the event source.\n */\n topic?: string;\n /**\n * A resource path relative to the topic path.\n */\n subject: string;\n /**\n * The schema version of the data object.\n */\n dataVersion: string;\n /**\n * Event data specific to the event type.\n */\n data: T;\n}\n\n/**\n * An event in the in the Event Grid Schema.\n */\nexport interface EventGridEvent<T> {\n /**\n * The type of the event.\n */\n eventType: string;\n /**\n * The time the event was generated.\n */\n eventTime: Date;\n /**\n * An unique identifier for the event.\n */\n id: string;\n /**\n * The resource path of the event source.\n */\n topic?: string;\n /**\n * A resource path relative to the topic path.\n */\n subject: string;\n /**\n * The schema version of the data object.\n */\n dataVersion: string;\n /**\n * Event data specific to the event type.\n */\n data: T;\n}\n\n/**\n * * The shape of the input for EventGridProducerClient#sendCloudEvents\n */\nexport interface SendCloudEventInput<T> {\n /**\n * Type of event related to the originating occurrence.\n */\n type: string;\n /**\n * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.\n */\n source: string;\n /**\n * An identifier for the event. The combination of id and source must be unique for each distinct event. If an ID is not provided,\n * a random UUID will be generated and used.\n */\n id?: string;\n /**\n * The time the event was generated. If not provided, the current time will be used.\n */\n time?: Date;\n /**\n * Identifies the schema that data adheres to.\n */\n dataschema?: string;\n /**\n * Content type of data value.\n */\n datacontenttype?: string;\n /**\n * Event data specific to the event type.\n */\n data?: T;\n /**\n * This describes the subject of the event in the context of the event producer (identified by source).\n */\n subject?: string;\n /**\n * Additional context attributes for the event. The Cloud Event specification refers to these as \"extension attributes\".\n */\n extensionAttributes?: Record<string, unknown>;\n}\n\n/**\n * An event in the Cloud Event 1.0 schema.\n */\nexport interface CloudEvent<T> {\n /**\n * Type of event related to the originating occurrence.\n */\n type: string;\n /**\n * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.\n */\n source: string;\n /**\n * An identifier for the event. The combination of id and source must be unique for each distinct event.\n */\n id: string;\n /**\n * The time the event was generated.\n */\n time?: Date;\n /**\n * Identifies the schema that data adheres to.\n */\n dataschema?: string;\n /**\n * Content type of data value.\n */\n datacontenttype?: string;\n /**\n * Event data specific to the event type.\n */\n data?: T;\n /**\n * This describes the subject of the event in the context of the event producer (identified by source).\n */\n subject?: string;\n /**\n * Additional context attributes for the event. The Cloud Event specification refers to these as \"extension attributes\".\n */\n extensionAttributes?: Record<string, unknown>;\n}\n\n/**\n * Property names defined by the CloudEvents 1.0 specification, these may not be reused as the names of extension properties.\n */\nexport const cloudEventReservedPropertyNames = [\n \"specversion\",\n \"id\",\n \"source\",\n \"type\",\n \"datacontenttype\",\n \"dataschema\",\n \"subject\",\n \"time\",\n \"data\",\n];\n\n/**\n * A function which provides custom logic to be used when decoding events.\n */\nexport type CustomEventDataDeserializer = (o: any) => Promise<any>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"predicates.js","sourceRoot":"","sources":["../../src/predicates.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgZlC;;;;GAIG;AACH,SAAS,gBAAgB,CACvB,CAAgD;IAEhD,OAAQ,CAAS,CAAC,MAAM,KAAK,SAAS,CAAC;AACzC,CAAC;AA4BD,MAAM,UAAU,aAAa,CAC3B,SAAY,EACZ,KAAoD;IAIpD,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;QAC3B,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC;KACjC;SAAM;QACL,OAAO,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC;KACtC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AcsChatMessageDeletedEventData,\n AcsChatMessageDeletedInThreadEventData,\n AcsChatMessageEditedEventData,\n AcsChatMessageEditedInThreadEventData,\n AcsChatMessageReceivedEventData,\n AcsChatMessageReceivedInThreadEventData,\n AcsChatParticipantAddedToThreadEventData,\n AcsChatParticipantAddedToThreadWithUserEventData,\n AcsChatParticipantRemovedFromThreadEventData,\n AcsChatParticipantRemovedFromThreadWithUserEventData,\n AcsChatThreadCreatedWithUserEventData,\n AcsChatThreadPropertiesUpdatedPerUserEventData,\n AcsChatThreadWithUserDeletedEventData,\n AcsRecordingFileStatusUpdatedEventData,\n AcsSmsDeliveryReportReceivedEventData,\n AcsSmsReceivedEventData,\n AcsUserDisconnectedEventData,\n ApiManagementApiCreatedEventData,\n ApiManagementApiDeletedEventData,\n ApiManagementApiReleaseCreatedEventData,\n ApiManagementApiReleaseDeletedEventData,\n ApiManagementApiReleaseUpdatedEventData,\n ApiManagementApiUpdatedEventData,\n ApiManagementProductCreatedEventData,\n ApiManagementProductDeletedEventData,\n ApiManagementProductUpdatedEventData,\n ApiManagementSubscriptionCreatedEventData,\n ApiManagementSubscriptionDeletedEventData,\n ApiManagementSubscriptionUpdatedEventData,\n ApiManagementUserCreatedEventData,\n ApiManagementUserDeletedEventData,\n ApiManagementUserUpdatedEventData,\n AppConfigurationKeyValueDeletedEventData,\n AppConfigurationKeyValueModifiedEventData,\n ContainerRegistryChartDeletedEventData,\n ContainerRegistryChartPushedEventData,\n ContainerRegistryImageDeletedEventData,\n ContainerRegistryImagePushedEventData,\n ContainerServiceNewKubernetesVersionAvailableEventData,\n EventHubCaptureFileCreatedEventData,\n IotHubDeviceConnectedEventData,\n IotHubDeviceCreatedEventData,\n IotHubDeviceDeletedEventData,\n IotHubDeviceDisconnectedEventData,\n IotHubDeviceTelemetryEventData,\n KeyVaultAccessPolicyChangedEventData,\n KeyVaultCertificateExpiredEventData,\n KeyVaultCertificateNearExpiryEventData,\n KeyVaultCertificateNewVersionCreatedEventData,\n KeyVaultKeyExpiredEventData,\n KeyVaultKeyNearExpiryEventData,\n KeyVaultKeyNewVersionCreatedEventData,\n KeyVaultSecretExpiredEventData,\n KeyVaultSecretNearExpiryEventData,\n KeyVaultSecretNewVersionCreatedEventData,\n MachineLearningServicesDatasetDriftDetectedEventData,\n MachineLearningServicesModelDeployedEventData,\n MachineLearningServicesModelRegisteredEventData,\n MachineLearningServicesRunCompletedEventData,\n MachineLearningServicesRunStatusChangedEventData,\n MapsGeofenceEnteredEventData,\n MapsGeofenceExitedEventData,\n MapsGeofenceResultEventData,\n MediaJobCanceledEventData,\n MediaJobCancelingEventData,\n MediaJobErroredEventData,\n MediaJobFinishedEventData,\n MediaJobOutputCanceledEventData,\n MediaJobOutputCancelingEventData,\n MediaJobOutputErroredEventData,\n MediaJobOutputFinishedEventData,\n MediaJobOutputProcessingEventData,\n MediaJobOutputProgressEventData,\n MediaJobOutputScheduledEventData,\n MediaJobOutputStateChangeEventData,\n MediaJobProcessingEventData,\n MediaJobScheduledEventData,\n MediaJobStateChangeEventData,\n MediaLiveEventChannelArchiveHeartbeatEventData,\n MediaLiveEventConnectionRejectedEventData,\n MediaLiveEventEncoderConnectedEventData,\n MediaLiveEventEncoderDisconnectedEventData,\n MediaLiveEventIncomingDataChunkDroppedEventData,\n MediaLiveEventIncomingStreamReceivedEventData,\n MediaLiveEventIncomingStreamsOutOfSyncEventData,\n MediaLiveEventIncomingVideoStreamsOutOfSyncEventData,\n MediaLiveEventIngestHeartbeatEventData,\n MediaLiveEventTrackDiscontinuityDetectedEventData,\n PolicyInsightsPolicyStateChangedEventData,\n PolicyInsightsPolicyStateCreatedEventData,\n PolicyInsightsPolicyStateDeletedEventData,\n ResourceActionCancelEventData,\n ResourceActionFailureEventData,\n ResourceActionSuccessEventData,\n ResourceDeleteCancelEventData,\n ResourceDeleteFailureEventData,\n ResourceDeleteSuccessEventData,\n ResourceWriteCancelEventData,\n ResourceWriteFailureEventData,\n ResourceWriteSuccessEventData,\n ServiceBusActiveMessagesAvailableWithNoListenersEventData,\n ServiceBusDeadletterMessagesAvailableWithNoListenersEventData,\n StorageAsyncOperationInitiatedEventData,\n StorageBlobCreatedEventData,\n StorageBlobDeletedEventData,\n StorageBlobInventoryPolicyCompletedEventData,\n StorageBlobRenamedEventData,\n StorageBlobTierChangedEventData,\n StorageDirectoryCreatedEventData,\n StorageDirectoryDeletedEventData,\n StorageDirectoryRenamedEventData,\n StorageLifecyclePolicyCompletedEventData,\n SubscriptionDeletedEventData,\n SubscriptionValidationEventData,\n WebAppServicePlanUpdatedEventData,\n WebAppUpdatedEventData,\n WebBackupOperationCompletedEventData,\n WebBackupOperationFailedEventData,\n WebBackupOperationStartedEventData,\n WebRestoreOperationCompletedEventData,\n WebRestoreOperationFailedEventData,\n WebRestoreOperationStartedEventData,\n WebSlotSwapCompletedEventData,\n WebSlotSwapFailedEventData,\n WebSlotSwapStartedEventData,\n WebSlotSwapWithPreviewCancelledEventData,\n WebSlotSwapWithPreviewStartedEventData\n} from \"./generated/models\";\n\nimport { CloudEvent, EventGridEvent } from \"./models\";\n\n/**\n * The Event Types for all System Events. These may be used with `isSystemEvent` to determine if an\n * event is a system event of a given type.\n */\nexport type KnownSystemEventTypes = keyof SystemEventNameToEventData;\n\n/**\n * A mapping of event type names to event data type interfaces.\n */\nexport interface SystemEventNameToEventData {\n /** An interface for the event data of a \"Microsoft.ApiManagement.UserCreated\" event. */\n \"Microsoft.ApiManagement.UserCreated\": ApiManagementUserCreatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.UserUpdated\" event. */\n \"Microsoft.ApiManagement.UserUpdated\": ApiManagementUserUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.UserDeleted\" event. */\n \"Microsoft.ApiManagement.UserDeleted\": ApiManagementUserDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.SubscriptionCreated\" event. */\n \"Microsoft.ApiManagement.SubscriptionCreated\": ApiManagementSubscriptionCreatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.SubscriptionUpdated\" event. */\n \"Microsoft.ApiManagement.SubscriptionUpdated\": ApiManagementSubscriptionUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.SubscriptionDeleted\" event. */\n \"Microsoft.ApiManagement.SubscriptionDeleted\": ApiManagementSubscriptionDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.ProductCreated\" event. */\n \"Microsoft.ApiManagement.ProductCreated\": ApiManagementProductCreatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.ProductUpdated\" event. */\n \"Microsoft.ApiManagement.ProductUpdated\": ApiManagementProductUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.ProductDeleted\" event. */\n \"Microsoft.ApiManagement.ProductDeleted\": ApiManagementProductDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APICreated\" event. */\n \"Microsoft.ApiManagement.APICreated\": ApiManagementApiCreatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APIUpdated\" event. */\n \"Microsoft.ApiManagement.APIUpdated\": ApiManagementApiUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APIDeleted\" event. */\n \"Microsoft.ApiManagement.APIDeleted\": ApiManagementApiDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APIReleaseCreated\" event. */\n \"Microsoft.ApiManagement.APIReleaseCreated\": ApiManagementApiReleaseCreatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APIReleaseUpdated\" event. */\n \"Microsoft.ApiManagement.APIReleaseUpdated\": ApiManagementApiReleaseUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APIReleaseDeleted\" event. */\n \"Microsoft.ApiManagement.APIReleaseDeleted\": ApiManagementApiReleaseDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageReceived\" event. */\n \"Microsoft.Communication.ChatMessageReceived\": AcsChatMessageReceivedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageReceivedInThread\" event. */\n \"Microsoft.Communication.ChatMessageReceivedInThread\": AcsChatMessageReceivedInThreadEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageEdited\" event. */\n \"Microsoft.Communication.ChatMessageEdited\": AcsChatMessageEditedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageEditedInThread\" event. */\n \"Microsoft.Communication.ChatMessageEditedInThread\": AcsChatMessageEditedInThreadEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageDeleted\" event. */\n \"Microsoft.Communication.ChatMessageDeleted\": AcsChatMessageDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageDeletedInThread\" event. */\n \"Microsoft.Communication.ChatMessageDeletedInThread\": AcsChatMessageDeletedInThreadEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatThreadCreatedWithUser\" event. */\n \"Microsoft.Communication.ChatThreadCreatedWithUser\": AcsChatThreadCreatedWithUserEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatThreadWithUserDeleted\" event. */\n \"Microsoft.Communication.ChatThreadWithUserDeleted\": AcsChatThreadWithUserDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser\" event. */\n \"Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser\": AcsChatThreadPropertiesUpdatedPerUserEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatThreadParticipantAdded\" event. */\n \"Microsoft.Communication.ChatThreadParticipantAdded\": AcsChatParticipantAddedToThreadEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatParticipantAddedToThreadWithUser\" event. */\n \"Microsoft.Communication.ChatParticipantAddedToThreadWithUser\": AcsChatParticipantAddedToThreadWithUserEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatThreadParticipantRemoved\" event. */\n \"Microsoft.Communication.ChatThreadParticipantRemoved\": AcsChatParticipantRemovedFromThreadEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser\" event. */\n \"Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser\": AcsChatParticipantRemovedFromThreadWithUserEventData;\n /** An interface for the event data of a \"Microsoft.Communication.RecordingFileStatusUpdated\" event. */\n \"Microsoft.Communication.RecordingFileStatusUpdated\": AcsRecordingFileStatusUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.SMSDeliveryReportReceived\" event. */\n \"Microsoft.Communication.SMSDeliveryReportReceived\": AcsSmsDeliveryReportReceivedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.SMSReceived\" event. */\n \"Microsoft.Communication.SMSReceived\": AcsSmsReceivedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.UserDisconnected\" event. */\n \"Microsoft.Communication.UserDisconnected\": AcsUserDisconnectedEventData;\n /** An interface for the event data of a \"Microsoft.ContainerService.NewKubernetesVersionAvailable\" event. */\n \"Microsoft.ContainerService.NewKubernetesVersionAvailable\": ContainerServiceNewKubernetesVersionAvailableEventData;\n /** An interface for the event data of a \"Microsoft.AppConfiguration.KeyValueDeleted\" event. */\n \"Microsoft.AppConfiguration.KeyValueDeleted\": AppConfigurationKeyValueDeletedEventData;\n /** An interface for the event data of a \"Microsoft.AppConfiguration.KeyValueModified\" event. */\n \"Microsoft.AppConfiguration.KeyValueModified\": AppConfigurationKeyValueModifiedEventData;\n /** An interface for the event data of a \"Microsoft.ContainerRegistry.ImagePushed\" event. */\n \"Microsoft.ContainerRegistry.ImagePushed\": ContainerRegistryImagePushedEventData;\n /** An interface for the event data of a \"Microsoft.ContainerRegistry.ImageDeleted\" event. */\n \"Microsoft.ContainerRegistry.ImageDeleted\": ContainerRegistryImageDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ContainerRegistry.ChartDeleted\" event. */\n \"Microsoft.ContainerRegistry.ChartDeleted\": ContainerRegistryChartDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ContainerRegistry.ChartPushed\" event. */\n \"Microsoft.ContainerRegistry.ChartPushed\": ContainerRegistryChartPushedEventData;\n /** An interface for the event data of a \"Microsoft.Devices.DeviceCreated\" event. */\n \"Microsoft.Devices.DeviceCreated\": IotHubDeviceCreatedEventData;\n /** An interface for the event data of a \"Microsoft.Devices.DeviceDeleted\" event. */\n \"Microsoft.Devices.DeviceDeleted\": IotHubDeviceDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Devices.DeviceConnected\" event. */\n \"Microsoft.Devices.DeviceConnected\": IotHubDeviceConnectedEventData;\n /** An interface for the event data of a \"Microsoft.Devices.DeviceDisconnected\" event. */\n \"Microsoft.Devices.DeviceDisconnected\": IotHubDeviceDisconnectedEventData;\n /** An interface for the event data of a \"Microsoft.Devices.DeviceTelemetry\" event. */\n \"Microsoft.Devices.DeviceTelemetry\": IotHubDeviceTelemetryEventData;\n /** An interface for the event data of a \"Microsoft.EventGrid.SubscriptionValidationEvent\" event. */\n \"Microsoft.EventGrid.SubscriptionValidationEvent\": SubscriptionValidationEventData;\n /** An interface for the event data of a \"Microsoft.EventGrid.SubscriptionDeletedEvent\" event. */\n \"Microsoft.EventGrid.SubscriptionDeletedEvent\": SubscriptionDeletedEventData;\n /** An interface for the event data of a \"Microsoft.EventHub.CaptureFileCreated\" event. */\n \"Microsoft.EventHub.CaptureFileCreated\": EventHubCaptureFileCreatedEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.CertificateNewVersionCreated\" event. */\n \"Microsoft.KeyVault.CertificateNewVersionCreated\": KeyVaultCertificateNewVersionCreatedEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.CertificateNearExpiry\" event. */\n \"Microsoft.KeyVault.CertificateNearExpiry\": KeyVaultCertificateNearExpiryEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.CertificateExpired\" event. */\n \"Microsoft.KeyVault.CertificateExpired\": KeyVaultCertificateExpiredEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.KeyNewVersionCreated\" event. */\n \"Microsoft.KeyVault.KeyNewVersionCreated\": KeyVaultKeyNewVersionCreatedEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.KeyNearExpiry\" event. */\n \"Microsoft.KeyVault.KeyNearExpiry\": KeyVaultKeyNearExpiryEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.KeyExpired\" event. */\n \"Microsoft.KeyVault.KeyExpired\": KeyVaultKeyExpiredEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.SecretNewVersionCreated\" event. */\n \"Microsoft.KeyVault.SecretNewVersionCreated\": KeyVaultSecretNewVersionCreatedEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.SecretNearExpiry\" event. */\n \"Microsoft.KeyVault.SecretNearExpiry\": KeyVaultSecretNearExpiryEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.SecretExpired\" event. */\n \"Microsoft.KeyVault.SecretExpired\": KeyVaultSecretExpiredEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.VaultAccessPolicyChanged\" event. */\n \"Microsoft.KeyVault.VaultAccessPolicyChanged\": KeyVaultAccessPolicyChangedEventData;\n /** An interface for the event data of a \"Microsoft.MachineLearningServices.DatasetDriftDetected\" event. */\n \"Microsoft.MachineLearningServices.DatasetDriftDetected\": MachineLearningServicesDatasetDriftDetectedEventData;\n /** An interface for the event data of a \"Microsoft.MachineLearningServices.ModelDeployed\" event. */\n \"Microsoft.MachineLearningServices.ModelDeployed\": MachineLearningServicesModelDeployedEventData;\n /** An interface for the event data of a \"Microsoft.MachineLearningServices.ModelRegistered\" event. */\n \"Microsoft.MachineLearningServices.ModelRegistered\": MachineLearningServicesModelRegisteredEventData;\n /** An interface for the event data of a \"Microsoft.MachineLearningServices.RunCompleted\" event. */\n \"Microsoft.MachineLearningServices.RunCompleted\": MachineLearningServicesRunCompletedEventData;\n /** An interface for the event data of a \"Microsoft.MachineLearningServices.RunStatusChanged\" event. */\n \"Microsoft.MachineLearningServices.RunStatusChanged\": MachineLearningServicesRunStatusChangedEventData;\n /** An interface for the event data of a \"Microsoft.Maps.GeofenceEntered\" event. */\n \"Microsoft.Maps.GeofenceEntered\": MapsGeofenceEnteredEventData;\n /** An interface for the event data of a \"Microsoft.Maps.GeofenceExited\" event. */\n \"Microsoft.Maps.GeofenceExited\": MapsGeofenceExitedEventData;\n /** An interface for the event data of a \"Microsoft.Maps.GeofenceResult\" event. */\n \"Microsoft.Maps.GeofenceResult\": MapsGeofenceResultEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobStateChange\" event. */\n \"Microsoft.Media.JobStateChange\": MediaJobStateChangeEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputStateChange\" event. */\n \"Microsoft.Media.JobOutputStateChange\": MediaJobOutputStateChangeEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobScheduled\" event. */\n \"Microsoft.Media.JobScheduled\": MediaJobScheduledEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobProcessing\" event. */\n \"Microsoft.Media.JobProcessing\": MediaJobProcessingEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobCanceling\" event. */\n \"Microsoft.Media.JobCanceling\": MediaJobCancelingEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobFinished\" event. */\n \"Microsoft.Media.JobFinished\": MediaJobFinishedEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobCanceled\" event. */\n \"Microsoft.Media.JobCanceled\": MediaJobCanceledEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobErrored\" event. */\n \"Microsoft.Media.JobErrored\": MediaJobErroredEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputCanceled\" event. */\n \"Microsoft.Media.JobOutputCanceled\": MediaJobOutputCanceledEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputCanceling\" event. */\n \"Microsoft.Media.JobOutputCanceling\": MediaJobOutputCancelingEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputErrored\" event. */\n \"Microsoft.Media.JobOutputErrored\": MediaJobOutputErroredEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputFinished\" event. */\n \"Microsoft.Media.JobOutputFinished\": MediaJobOutputFinishedEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputProcessing\" event. */\n \"Microsoft.Media.JobOutputProcessing\": MediaJobOutputProcessingEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputScheduled\" event. */\n \"Microsoft.Media.JobOutputScheduled\": MediaJobOutputScheduledEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputProgress\" event. */\n \"Microsoft.Media.JobOutputProgress\": MediaJobOutputProgressEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventEncoderConnected\" event. */\n \"Microsoft.Media.LiveEventEncoderConnected\": MediaLiveEventEncoderConnectedEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventChannelArchiveHeartbeat\" event. */\n \"Microsoft.Media.LiveEventChannelArchiveHeartbeat\": MediaLiveEventChannelArchiveHeartbeatEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventConnectionRejected\" event. */\n \"Microsoft.Media.LiveEventConnectionRejected\": MediaLiveEventConnectionRejectedEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventEncoderDisconnected\" event. */\n \"Microsoft.Media.LiveEventEncoderDisconnected\": MediaLiveEventEncoderDisconnectedEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventIncomingStreamReceived\" event. */\n \"Microsoft.Media.LiveEventIncomingStreamReceived\": MediaLiveEventIncomingStreamReceivedEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventIncomingStreamsOutOfSync\" event. */\n \"Microsoft.Media.LiveEventIncomingStreamsOutOfSync\": MediaLiveEventIncomingStreamsOutOfSyncEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync\" event. */\n \"Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync\": MediaLiveEventIncomingVideoStreamsOutOfSyncEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventIncomingDataChunkDropped\" event. */\n \"Microsoft.Media.LiveEventIncomingDataChunkDropped\": MediaLiveEventIncomingDataChunkDroppedEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventIngestHeartbeat\" event. */\n \"Microsoft.Media.LiveEventIngestHeartbeat\": MediaLiveEventIngestHeartbeatEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventTrackDiscontinuityDetected\" event. */\n \"Microsoft.Media.LiveEventTrackDiscontinuityDetected\": MediaLiveEventTrackDiscontinuityDetectedEventData;\n /** An interface for the event data of a \"Microsoft.PolicyInsights.PolicyStateChanged\" event. */\n \"Microsoft.PolicyInsights.PolicyStateChanged \": PolicyInsightsPolicyStateChangedEventData;\n /** An interface for the event data of a \" Microsoft.PolicyInsights.PolicyStateCreated\" event. */\n \"Microsoft.PolicyInsights.PolicyStateCreated\": PolicyInsightsPolicyStateCreatedEventData;\n /** An interface for the event data of a \"Microsoft.PolicyInsights.PolicyStateDeleted\" event. */\n \"Microsoft.PolicyInsights.PolicyStateDeleted\": PolicyInsightsPolicyStateDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceDeleteSuccess\" event. */\n \"Microsoft.Resources.ResourceWriteSuccess\": ResourceWriteSuccessEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceWriteFailure\" event. */\n \"Microsoft.Resources.ResourceWriteFailure\": ResourceWriteFailureEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceWriteCancel\" event. */\n \"Microsoft.Resources.ResourceWriteCancel\": ResourceWriteCancelEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceDeleteSuccess\" event. */\n \"Microsoft.Resources.ResourceDeleteSuccess\": ResourceDeleteSuccessEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceDeleteFailure\" event. */\n \"Microsoft.Resources.ResourceDeleteFailure\": ResourceDeleteFailureEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceDeleteCancel\" event. */\n \"Microsoft.Resources.ResourceDeleteCancel\": ResourceDeleteCancelEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceActionSuccess\" event. */\n \"Microsoft.Resources.ResourceActionSuccess\": ResourceActionSuccessEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceActionFailure\" event. */\n \"Microsoft.Resources.ResourceActionFailure\": ResourceActionFailureEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceActionCancel\" event. */\n \"Microsoft.Resources.ResourceActionCancel\": ResourceActionCancelEventData;\n /** An interface for the event data of a \"Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners\" event. */\n \"Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners\": ServiceBusActiveMessagesAvailableWithNoListenersEventData;\n /** An interface for the event data of a \"Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners\" event. */\n \"Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners\": ServiceBusDeadletterMessagesAvailableWithNoListenersEventData;\n /** An interface for the event data of a \"Microsoft.Storage.AsyncOperationInitiated\" event. */\n \"Microsoft.Storage.AsyncOperationInitiated\": StorageAsyncOperationInitiatedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.BlobCreated\" event. */\n \"Microsoft.Storage.BlobCreated\": StorageBlobCreatedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.BlobDeleted\" event. */\n \"Microsoft.Storage.BlobDeleted\": StorageBlobDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.BlobInventoryPolicyCompleted\" event. */\n \"Microsoft.Storage.BlobInventoryPolicyCompleted\": StorageBlobInventoryPolicyCompletedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.BlobTierChanged\" event. */\n \"Microsoft.Storage.BlobTierChanged\": StorageBlobTierChangedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.BlobRenamed\" event. */\n \"Microsoft.Storage.BlobRenamed\": StorageBlobRenamedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.DirectoryCreated\" event. */\n \"Microsoft.Storage.DirectoryCreated\": StorageDirectoryCreatedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.DirectoryDeleted\" event. */\n \"Microsoft.Storage.DirectoryDeleted\": StorageDirectoryDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.DirectoryRenamed\" event. */\n \"Microsoft.Storage.DirectoryRenamed\": StorageDirectoryRenamedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.LifecyclePolicyCompleted\" event. */\n \"Microsoft.Storage.LifecyclePolicyCompleted\": StorageLifecyclePolicyCompletedEventData;\n /** An interface for the event data of a \"Microsoft.Web.AppUpdated\" event. */\n \"Microsoft.Web.AppUpdated\": WebAppUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.Web.BackupOperationStarted\" event. */\n \"Microsoft.Web.BackupOperationStarted\": WebBackupOperationStartedEventData;\n /** An interface for the event data of a \"Microsoft.Web.BackupOperationCompleted\" event. */\n \"Microsoft.Web.BackupOperationCompleted\": WebBackupOperationCompletedEventData;\n /** An interface for the event data of a \"Microsoft.Web.BackupOperationFailed\" event. */\n \"Microsoft.Web.BackupOperationFailed\": WebBackupOperationFailedEventData;\n /** An interface for the event data of a \"Microsoft.Web.RestoreOperationStarted\" event. */\n \"Microsoft.Web.RestoreOperationStarted\": WebRestoreOperationStartedEventData;\n /** An interface for the event data of a \"Microsoft.Web.RestoreOperationCompleted\" event. */\n \"Microsoft.Web.RestoreOperationCompleted\": WebRestoreOperationCompletedEventData;\n /** An interface for the event data of a \"Microsoft.Web.RestoreOperationFailed\" event. */\n \"Microsoft.Web.RestoreOperationFailed\": WebRestoreOperationFailedEventData;\n /** An interface for the event data of a \"Microsoft.Web.SlotSwapStarted\" event. */\n \"Microsoft.Web.SlotSwapStarted\": WebSlotSwapStartedEventData;\n /** An interface for the event data of a \"Microsoft.Web.SlotSwapCompleted\" event. */\n \"Microsoft.Web.SlotSwapCompleted\": WebSlotSwapCompletedEventData;\n /** An interface for the event data of a \"Microsoft.Web.SlotSwapFailed\" event. */\n \"Microsoft.Web.SlotSwapFailed\": WebSlotSwapFailedEventData;\n /** An interface for the event data of a \"Microsoft.Web.SlotSwapWithPreviewStarted\" event. */\n \"Microsoft.Web.SlotSwapWithPreviewStarted\": WebSlotSwapWithPreviewStartedEventData;\n /** An interface for the event data of a \"Microsoft.Web.SlotSwapWithPreviewCancelled\" event. */\n \"Microsoft.Web.SlotSwapWithPreviewCancelled\": WebSlotSwapWithPreviewCancelledEventData;\n /** An interface for the event data of a \"Microsoft.Web.AppServicePlanUpdated\" event. */\n \"Microsoft.Web.AppServicePlanUpdated\": WebAppServicePlanUpdatedEventData;\n}\n\n/**\n * isCloudEventLike returns \"true\" when the event is a CloudEvent\n *\n * @param o - Either an EventGrid our CloudEvent event.\n */\nfunction isCloudEventLike(\n o: EventGridEvent<unknown> | CloudEvent<unknown>\n): o is CloudEvent<unknown> {\n return (o as any).source !== undefined;\n}\n\n/**\n * iSystemEvent returns \"true\" when a given event is a system event of a given type. When using\n * TypeScript, this function acts as a custom type guard and allows the TypeScript compiler to\n * identify the underlying data\n *\n * @param eventType - The type of system event to check for, e.g., \"Microsoft.AppConfiguration.KeyValueDeleted\"\n * @param event - The event to test.\n */\nexport function isSystemEvent<T extends KnownSystemEventTypes>(\n eventType: T,\n event: EventGridEvent<unknown>\n): event is EventGridEvent<SystemEventNameToEventData[T]>;\n\n/**\n * iSystemEvent returns \"true\" when a given event is a system event of a given type. When using\n * TypeScript, this function acts as a custom type guard and allows the TypeScript compiler to\n * identify the underlying data\n *\n * @param eventType - The type of system event to check for, e.g., \"Microsoft.AppConfiguration.KeyValueDeleted\"\n * @param event - The event to test.\n */\nexport function isSystemEvent<T extends KnownSystemEventTypes>(\n eventType: T,\n event: CloudEvent<unknown>\n): event is CloudEvent<SystemEventNameToEventData[T]>;\n\nexport function isSystemEvent<T extends KnownSystemEventTypes>(\n eventType: T,\n event: EventGridEvent<unknown> | CloudEvent<unknown>\n): event is\n | EventGridEvent<SystemEventNameToEventData[T]>\n | CloudEvent<SystemEventNameToEventData[T]> {\n if (isCloudEventLike(event)) {\n return event.type === eventType;\n } else {\n return event.eventType === eventType;\n }\n}\n"]}
1
+ {"version":3,"file":"predicates.js","sourceRoot":"","sources":["../../src/predicates.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgZlC;;;;GAIG;AACH,SAAS,gBAAgB,CACvB,CAAgD;IAEhD,OAAQ,CAAS,CAAC,MAAM,KAAK,SAAS,CAAC;AACzC,CAAC;AA4BD,MAAM,UAAU,aAAa,CAC3B,SAAY,EACZ,KAAoD;IAIpD,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;QAC3B,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC;KACjC;SAAM;QACL,OAAO,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC;KACtC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AcsChatMessageDeletedEventData,\n AcsChatMessageDeletedInThreadEventData,\n AcsChatMessageEditedEventData,\n AcsChatMessageEditedInThreadEventData,\n AcsChatMessageReceivedEventData,\n AcsChatMessageReceivedInThreadEventData,\n AcsChatParticipantAddedToThreadEventData,\n AcsChatParticipantAddedToThreadWithUserEventData,\n AcsChatParticipantRemovedFromThreadEventData,\n AcsChatParticipantRemovedFromThreadWithUserEventData,\n AcsChatThreadCreatedWithUserEventData,\n AcsChatThreadPropertiesUpdatedPerUserEventData,\n AcsChatThreadWithUserDeletedEventData,\n AcsRecordingFileStatusUpdatedEventData,\n AcsSmsDeliveryReportReceivedEventData,\n AcsSmsReceivedEventData,\n AcsUserDisconnectedEventData,\n ApiManagementApiCreatedEventData,\n ApiManagementApiDeletedEventData,\n ApiManagementApiReleaseCreatedEventData,\n ApiManagementApiReleaseDeletedEventData,\n ApiManagementApiReleaseUpdatedEventData,\n ApiManagementApiUpdatedEventData,\n ApiManagementProductCreatedEventData,\n ApiManagementProductDeletedEventData,\n ApiManagementProductUpdatedEventData,\n ApiManagementSubscriptionCreatedEventData,\n ApiManagementSubscriptionDeletedEventData,\n ApiManagementSubscriptionUpdatedEventData,\n ApiManagementUserCreatedEventData,\n ApiManagementUserDeletedEventData,\n ApiManagementUserUpdatedEventData,\n AppConfigurationKeyValueDeletedEventData,\n AppConfigurationKeyValueModifiedEventData,\n ContainerRegistryChartDeletedEventData,\n ContainerRegistryChartPushedEventData,\n ContainerRegistryImageDeletedEventData,\n ContainerRegistryImagePushedEventData,\n ContainerServiceNewKubernetesVersionAvailableEventData,\n EventHubCaptureFileCreatedEventData,\n IotHubDeviceConnectedEventData,\n IotHubDeviceCreatedEventData,\n IotHubDeviceDeletedEventData,\n IotHubDeviceDisconnectedEventData,\n IotHubDeviceTelemetryEventData,\n KeyVaultAccessPolicyChangedEventData,\n KeyVaultCertificateExpiredEventData,\n KeyVaultCertificateNearExpiryEventData,\n KeyVaultCertificateNewVersionCreatedEventData,\n KeyVaultKeyExpiredEventData,\n KeyVaultKeyNearExpiryEventData,\n KeyVaultKeyNewVersionCreatedEventData,\n KeyVaultSecretExpiredEventData,\n KeyVaultSecretNearExpiryEventData,\n KeyVaultSecretNewVersionCreatedEventData,\n MachineLearningServicesDatasetDriftDetectedEventData,\n MachineLearningServicesModelDeployedEventData,\n MachineLearningServicesModelRegisteredEventData,\n MachineLearningServicesRunCompletedEventData,\n MachineLearningServicesRunStatusChangedEventData,\n MapsGeofenceEnteredEventData,\n MapsGeofenceExitedEventData,\n MapsGeofenceResultEventData,\n MediaJobCanceledEventData,\n MediaJobCancelingEventData,\n MediaJobErroredEventData,\n MediaJobFinishedEventData,\n MediaJobOutputCanceledEventData,\n MediaJobOutputCancelingEventData,\n MediaJobOutputErroredEventData,\n MediaJobOutputFinishedEventData,\n MediaJobOutputProcessingEventData,\n MediaJobOutputProgressEventData,\n MediaJobOutputScheduledEventData,\n MediaJobOutputStateChangeEventData,\n MediaJobProcessingEventData,\n MediaJobScheduledEventData,\n MediaJobStateChangeEventData,\n MediaLiveEventChannelArchiveHeartbeatEventData,\n MediaLiveEventConnectionRejectedEventData,\n MediaLiveEventEncoderConnectedEventData,\n MediaLiveEventEncoderDisconnectedEventData,\n MediaLiveEventIncomingDataChunkDroppedEventData,\n MediaLiveEventIncomingStreamReceivedEventData,\n MediaLiveEventIncomingStreamsOutOfSyncEventData,\n MediaLiveEventIncomingVideoStreamsOutOfSyncEventData,\n MediaLiveEventIngestHeartbeatEventData,\n MediaLiveEventTrackDiscontinuityDetectedEventData,\n PolicyInsightsPolicyStateChangedEventData,\n PolicyInsightsPolicyStateCreatedEventData,\n PolicyInsightsPolicyStateDeletedEventData,\n ResourceActionCancelEventData,\n ResourceActionFailureEventData,\n ResourceActionSuccessEventData,\n ResourceDeleteCancelEventData,\n ResourceDeleteFailureEventData,\n ResourceDeleteSuccessEventData,\n ResourceWriteCancelEventData,\n ResourceWriteFailureEventData,\n ResourceWriteSuccessEventData,\n ServiceBusActiveMessagesAvailableWithNoListenersEventData,\n ServiceBusDeadletterMessagesAvailableWithNoListenersEventData,\n StorageAsyncOperationInitiatedEventData,\n StorageBlobCreatedEventData,\n StorageBlobDeletedEventData,\n StorageBlobInventoryPolicyCompletedEventData,\n StorageBlobRenamedEventData,\n StorageBlobTierChangedEventData,\n StorageDirectoryCreatedEventData,\n StorageDirectoryDeletedEventData,\n StorageDirectoryRenamedEventData,\n StorageLifecyclePolicyCompletedEventData,\n SubscriptionDeletedEventData,\n SubscriptionValidationEventData,\n WebAppServicePlanUpdatedEventData,\n WebAppUpdatedEventData,\n WebBackupOperationCompletedEventData,\n WebBackupOperationFailedEventData,\n WebBackupOperationStartedEventData,\n WebRestoreOperationCompletedEventData,\n WebRestoreOperationFailedEventData,\n WebRestoreOperationStartedEventData,\n WebSlotSwapCompletedEventData,\n WebSlotSwapFailedEventData,\n WebSlotSwapStartedEventData,\n WebSlotSwapWithPreviewCancelledEventData,\n WebSlotSwapWithPreviewStartedEventData,\n} from \"./generated/models\";\n\nimport { CloudEvent, EventGridEvent } from \"./models\";\n\n/**\n * The Event Types for all System Events. These may be used with `isSystemEvent` to determine if an\n * event is a system event of a given type.\n */\nexport type KnownSystemEventTypes = keyof SystemEventNameToEventData;\n\n/**\n * A mapping of event type names to event data type interfaces.\n */\nexport interface SystemEventNameToEventData {\n /** An interface for the event data of a \"Microsoft.ApiManagement.UserCreated\" event. */\n \"Microsoft.ApiManagement.UserCreated\": ApiManagementUserCreatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.UserUpdated\" event. */\n \"Microsoft.ApiManagement.UserUpdated\": ApiManagementUserUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.UserDeleted\" event. */\n \"Microsoft.ApiManagement.UserDeleted\": ApiManagementUserDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.SubscriptionCreated\" event. */\n \"Microsoft.ApiManagement.SubscriptionCreated\": ApiManagementSubscriptionCreatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.SubscriptionUpdated\" event. */\n \"Microsoft.ApiManagement.SubscriptionUpdated\": ApiManagementSubscriptionUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.SubscriptionDeleted\" event. */\n \"Microsoft.ApiManagement.SubscriptionDeleted\": ApiManagementSubscriptionDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.ProductCreated\" event. */\n \"Microsoft.ApiManagement.ProductCreated\": ApiManagementProductCreatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.ProductUpdated\" event. */\n \"Microsoft.ApiManagement.ProductUpdated\": ApiManagementProductUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.ProductDeleted\" event. */\n \"Microsoft.ApiManagement.ProductDeleted\": ApiManagementProductDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APICreated\" event. */\n \"Microsoft.ApiManagement.APICreated\": ApiManagementApiCreatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APIUpdated\" event. */\n \"Microsoft.ApiManagement.APIUpdated\": ApiManagementApiUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APIDeleted\" event. */\n \"Microsoft.ApiManagement.APIDeleted\": ApiManagementApiDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APIReleaseCreated\" event. */\n \"Microsoft.ApiManagement.APIReleaseCreated\": ApiManagementApiReleaseCreatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APIReleaseUpdated\" event. */\n \"Microsoft.ApiManagement.APIReleaseUpdated\": ApiManagementApiReleaseUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.ApiManagement.APIReleaseDeleted\" event. */\n \"Microsoft.ApiManagement.APIReleaseDeleted\": ApiManagementApiReleaseDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageReceived\" event. */\n \"Microsoft.Communication.ChatMessageReceived\": AcsChatMessageReceivedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageReceivedInThread\" event. */\n \"Microsoft.Communication.ChatMessageReceivedInThread\": AcsChatMessageReceivedInThreadEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageEdited\" event. */\n \"Microsoft.Communication.ChatMessageEdited\": AcsChatMessageEditedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageEditedInThread\" event. */\n \"Microsoft.Communication.ChatMessageEditedInThread\": AcsChatMessageEditedInThreadEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageDeleted\" event. */\n \"Microsoft.Communication.ChatMessageDeleted\": AcsChatMessageDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatMessageDeletedInThread\" event. */\n \"Microsoft.Communication.ChatMessageDeletedInThread\": AcsChatMessageDeletedInThreadEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatThreadCreatedWithUser\" event. */\n \"Microsoft.Communication.ChatThreadCreatedWithUser\": AcsChatThreadCreatedWithUserEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatThreadWithUserDeleted\" event. */\n \"Microsoft.Communication.ChatThreadWithUserDeleted\": AcsChatThreadWithUserDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser\" event. */\n \"Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser\": AcsChatThreadPropertiesUpdatedPerUserEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatThreadParticipantAdded\" event. */\n \"Microsoft.Communication.ChatThreadParticipantAdded\": AcsChatParticipantAddedToThreadEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatParticipantAddedToThreadWithUser\" event. */\n \"Microsoft.Communication.ChatParticipantAddedToThreadWithUser\": AcsChatParticipantAddedToThreadWithUserEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatThreadParticipantRemoved\" event. */\n \"Microsoft.Communication.ChatThreadParticipantRemoved\": AcsChatParticipantRemovedFromThreadEventData;\n /** An interface for the event data of a \"Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser\" event. */\n \"Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser\": AcsChatParticipantRemovedFromThreadWithUserEventData;\n /** An interface for the event data of a \"Microsoft.Communication.RecordingFileStatusUpdated\" event. */\n \"Microsoft.Communication.RecordingFileStatusUpdated\": AcsRecordingFileStatusUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.SMSDeliveryReportReceived\" event. */\n \"Microsoft.Communication.SMSDeliveryReportReceived\": AcsSmsDeliveryReportReceivedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.SMSReceived\" event. */\n \"Microsoft.Communication.SMSReceived\": AcsSmsReceivedEventData;\n /** An interface for the event data of a \"Microsoft.Communication.UserDisconnected\" event. */\n \"Microsoft.Communication.UserDisconnected\": AcsUserDisconnectedEventData;\n /** An interface for the event data of a \"Microsoft.ContainerService.NewKubernetesVersionAvailable\" event. */\n \"Microsoft.ContainerService.NewKubernetesVersionAvailable\": ContainerServiceNewKubernetesVersionAvailableEventData;\n /** An interface for the event data of a \"Microsoft.AppConfiguration.KeyValueDeleted\" event. */\n \"Microsoft.AppConfiguration.KeyValueDeleted\": AppConfigurationKeyValueDeletedEventData;\n /** An interface for the event data of a \"Microsoft.AppConfiguration.KeyValueModified\" event. */\n \"Microsoft.AppConfiguration.KeyValueModified\": AppConfigurationKeyValueModifiedEventData;\n /** An interface for the event data of a \"Microsoft.ContainerRegistry.ImagePushed\" event. */\n \"Microsoft.ContainerRegistry.ImagePushed\": ContainerRegistryImagePushedEventData;\n /** An interface for the event data of a \"Microsoft.ContainerRegistry.ImageDeleted\" event. */\n \"Microsoft.ContainerRegistry.ImageDeleted\": ContainerRegistryImageDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ContainerRegistry.ChartDeleted\" event. */\n \"Microsoft.ContainerRegistry.ChartDeleted\": ContainerRegistryChartDeletedEventData;\n /** An interface for the event data of a \"Microsoft.ContainerRegistry.ChartPushed\" event. */\n \"Microsoft.ContainerRegistry.ChartPushed\": ContainerRegistryChartPushedEventData;\n /** An interface for the event data of a \"Microsoft.Devices.DeviceCreated\" event. */\n \"Microsoft.Devices.DeviceCreated\": IotHubDeviceCreatedEventData;\n /** An interface for the event data of a \"Microsoft.Devices.DeviceDeleted\" event. */\n \"Microsoft.Devices.DeviceDeleted\": IotHubDeviceDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Devices.DeviceConnected\" event. */\n \"Microsoft.Devices.DeviceConnected\": IotHubDeviceConnectedEventData;\n /** An interface for the event data of a \"Microsoft.Devices.DeviceDisconnected\" event. */\n \"Microsoft.Devices.DeviceDisconnected\": IotHubDeviceDisconnectedEventData;\n /** An interface for the event data of a \"Microsoft.Devices.DeviceTelemetry\" event. */\n \"Microsoft.Devices.DeviceTelemetry\": IotHubDeviceTelemetryEventData;\n /** An interface for the event data of a \"Microsoft.EventGrid.SubscriptionValidationEvent\" event. */\n \"Microsoft.EventGrid.SubscriptionValidationEvent\": SubscriptionValidationEventData;\n /** An interface for the event data of a \"Microsoft.EventGrid.SubscriptionDeletedEvent\" event. */\n \"Microsoft.EventGrid.SubscriptionDeletedEvent\": SubscriptionDeletedEventData;\n /** An interface for the event data of a \"Microsoft.EventHub.CaptureFileCreated\" event. */\n \"Microsoft.EventHub.CaptureFileCreated\": EventHubCaptureFileCreatedEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.CertificateNewVersionCreated\" event. */\n \"Microsoft.KeyVault.CertificateNewVersionCreated\": KeyVaultCertificateNewVersionCreatedEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.CertificateNearExpiry\" event. */\n \"Microsoft.KeyVault.CertificateNearExpiry\": KeyVaultCertificateNearExpiryEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.CertificateExpired\" event. */\n \"Microsoft.KeyVault.CertificateExpired\": KeyVaultCertificateExpiredEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.KeyNewVersionCreated\" event. */\n \"Microsoft.KeyVault.KeyNewVersionCreated\": KeyVaultKeyNewVersionCreatedEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.KeyNearExpiry\" event. */\n \"Microsoft.KeyVault.KeyNearExpiry\": KeyVaultKeyNearExpiryEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.KeyExpired\" event. */\n \"Microsoft.KeyVault.KeyExpired\": KeyVaultKeyExpiredEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.SecretNewVersionCreated\" event. */\n \"Microsoft.KeyVault.SecretNewVersionCreated\": KeyVaultSecretNewVersionCreatedEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.SecretNearExpiry\" event. */\n \"Microsoft.KeyVault.SecretNearExpiry\": KeyVaultSecretNearExpiryEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.SecretExpired\" event. */\n \"Microsoft.KeyVault.SecretExpired\": KeyVaultSecretExpiredEventData;\n /** An interface for the event data of a \"Microsoft.KeyVault.VaultAccessPolicyChanged\" event. */\n \"Microsoft.KeyVault.VaultAccessPolicyChanged\": KeyVaultAccessPolicyChangedEventData;\n /** An interface for the event data of a \"Microsoft.MachineLearningServices.DatasetDriftDetected\" event. */\n \"Microsoft.MachineLearningServices.DatasetDriftDetected\": MachineLearningServicesDatasetDriftDetectedEventData;\n /** An interface for the event data of a \"Microsoft.MachineLearningServices.ModelDeployed\" event. */\n \"Microsoft.MachineLearningServices.ModelDeployed\": MachineLearningServicesModelDeployedEventData;\n /** An interface for the event data of a \"Microsoft.MachineLearningServices.ModelRegistered\" event. */\n \"Microsoft.MachineLearningServices.ModelRegistered\": MachineLearningServicesModelRegisteredEventData;\n /** An interface for the event data of a \"Microsoft.MachineLearningServices.RunCompleted\" event. */\n \"Microsoft.MachineLearningServices.RunCompleted\": MachineLearningServicesRunCompletedEventData;\n /** An interface for the event data of a \"Microsoft.MachineLearningServices.RunStatusChanged\" event. */\n \"Microsoft.MachineLearningServices.RunStatusChanged\": MachineLearningServicesRunStatusChangedEventData;\n /** An interface for the event data of a \"Microsoft.Maps.GeofenceEntered\" event. */\n \"Microsoft.Maps.GeofenceEntered\": MapsGeofenceEnteredEventData;\n /** An interface for the event data of a \"Microsoft.Maps.GeofenceExited\" event. */\n \"Microsoft.Maps.GeofenceExited\": MapsGeofenceExitedEventData;\n /** An interface for the event data of a \"Microsoft.Maps.GeofenceResult\" event. */\n \"Microsoft.Maps.GeofenceResult\": MapsGeofenceResultEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobStateChange\" event. */\n \"Microsoft.Media.JobStateChange\": MediaJobStateChangeEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputStateChange\" event. */\n \"Microsoft.Media.JobOutputStateChange\": MediaJobOutputStateChangeEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobScheduled\" event. */\n \"Microsoft.Media.JobScheduled\": MediaJobScheduledEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobProcessing\" event. */\n \"Microsoft.Media.JobProcessing\": MediaJobProcessingEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobCanceling\" event. */\n \"Microsoft.Media.JobCanceling\": MediaJobCancelingEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobFinished\" event. */\n \"Microsoft.Media.JobFinished\": MediaJobFinishedEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobCanceled\" event. */\n \"Microsoft.Media.JobCanceled\": MediaJobCanceledEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobErrored\" event. */\n \"Microsoft.Media.JobErrored\": MediaJobErroredEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputCanceled\" event. */\n \"Microsoft.Media.JobOutputCanceled\": MediaJobOutputCanceledEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputCanceling\" event. */\n \"Microsoft.Media.JobOutputCanceling\": MediaJobOutputCancelingEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputErrored\" event. */\n \"Microsoft.Media.JobOutputErrored\": MediaJobOutputErroredEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputFinished\" event. */\n \"Microsoft.Media.JobOutputFinished\": MediaJobOutputFinishedEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputProcessing\" event. */\n \"Microsoft.Media.JobOutputProcessing\": MediaJobOutputProcessingEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputScheduled\" event. */\n \"Microsoft.Media.JobOutputScheduled\": MediaJobOutputScheduledEventData;\n /** An interface for the event data of a \"Microsoft.Media.JobOutputProgress\" event. */\n \"Microsoft.Media.JobOutputProgress\": MediaJobOutputProgressEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventEncoderConnected\" event. */\n \"Microsoft.Media.LiveEventEncoderConnected\": MediaLiveEventEncoderConnectedEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventChannelArchiveHeartbeat\" event. */\n \"Microsoft.Media.LiveEventChannelArchiveHeartbeat\": MediaLiveEventChannelArchiveHeartbeatEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventConnectionRejected\" event. */\n \"Microsoft.Media.LiveEventConnectionRejected\": MediaLiveEventConnectionRejectedEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventEncoderDisconnected\" event. */\n \"Microsoft.Media.LiveEventEncoderDisconnected\": MediaLiveEventEncoderDisconnectedEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventIncomingStreamReceived\" event. */\n \"Microsoft.Media.LiveEventIncomingStreamReceived\": MediaLiveEventIncomingStreamReceivedEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventIncomingStreamsOutOfSync\" event. */\n \"Microsoft.Media.LiveEventIncomingStreamsOutOfSync\": MediaLiveEventIncomingStreamsOutOfSyncEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync\" event. */\n \"Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync\": MediaLiveEventIncomingVideoStreamsOutOfSyncEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventIncomingDataChunkDropped\" event. */\n \"Microsoft.Media.LiveEventIncomingDataChunkDropped\": MediaLiveEventIncomingDataChunkDroppedEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventIngestHeartbeat\" event. */\n \"Microsoft.Media.LiveEventIngestHeartbeat\": MediaLiveEventIngestHeartbeatEventData;\n /** An interface for the event data of a \"Microsoft.Media.LiveEventTrackDiscontinuityDetected\" event. */\n \"Microsoft.Media.LiveEventTrackDiscontinuityDetected\": MediaLiveEventTrackDiscontinuityDetectedEventData;\n /** An interface for the event data of a \"Microsoft.PolicyInsights.PolicyStateChanged\" event. */\n \"Microsoft.PolicyInsights.PolicyStateChanged \": PolicyInsightsPolicyStateChangedEventData;\n /** An interface for the event data of a \" Microsoft.PolicyInsights.PolicyStateCreated\" event. */\n \"Microsoft.PolicyInsights.PolicyStateCreated\": PolicyInsightsPolicyStateCreatedEventData;\n /** An interface for the event data of a \"Microsoft.PolicyInsights.PolicyStateDeleted\" event. */\n \"Microsoft.PolicyInsights.PolicyStateDeleted\": PolicyInsightsPolicyStateDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceDeleteSuccess\" event. */\n \"Microsoft.Resources.ResourceWriteSuccess\": ResourceWriteSuccessEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceWriteFailure\" event. */\n \"Microsoft.Resources.ResourceWriteFailure\": ResourceWriteFailureEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceWriteCancel\" event. */\n \"Microsoft.Resources.ResourceWriteCancel\": ResourceWriteCancelEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceDeleteSuccess\" event. */\n \"Microsoft.Resources.ResourceDeleteSuccess\": ResourceDeleteSuccessEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceDeleteFailure\" event. */\n \"Microsoft.Resources.ResourceDeleteFailure\": ResourceDeleteFailureEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceDeleteCancel\" event. */\n \"Microsoft.Resources.ResourceDeleteCancel\": ResourceDeleteCancelEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceActionSuccess\" event. */\n \"Microsoft.Resources.ResourceActionSuccess\": ResourceActionSuccessEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceActionFailure\" event. */\n \"Microsoft.Resources.ResourceActionFailure\": ResourceActionFailureEventData;\n /** An interface for the event data of a \"Microsoft.Resources.ResourceActionCancel\" event. */\n \"Microsoft.Resources.ResourceActionCancel\": ResourceActionCancelEventData;\n /** An interface for the event data of a \"Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners\" event. */\n \"Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners\": ServiceBusActiveMessagesAvailableWithNoListenersEventData;\n /** An interface for the event data of a \"Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners\" event. */\n \"Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners\": ServiceBusDeadletterMessagesAvailableWithNoListenersEventData;\n /** An interface for the event data of a \"Microsoft.Storage.AsyncOperationInitiated\" event. */\n \"Microsoft.Storage.AsyncOperationInitiated\": StorageAsyncOperationInitiatedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.BlobCreated\" event. */\n \"Microsoft.Storage.BlobCreated\": StorageBlobCreatedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.BlobDeleted\" event. */\n \"Microsoft.Storage.BlobDeleted\": StorageBlobDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.BlobInventoryPolicyCompleted\" event. */\n \"Microsoft.Storage.BlobInventoryPolicyCompleted\": StorageBlobInventoryPolicyCompletedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.BlobTierChanged\" event. */\n \"Microsoft.Storage.BlobTierChanged\": StorageBlobTierChangedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.BlobRenamed\" event. */\n \"Microsoft.Storage.BlobRenamed\": StorageBlobRenamedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.DirectoryCreated\" event. */\n \"Microsoft.Storage.DirectoryCreated\": StorageDirectoryCreatedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.DirectoryDeleted\" event. */\n \"Microsoft.Storage.DirectoryDeleted\": StorageDirectoryDeletedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.DirectoryRenamed\" event. */\n \"Microsoft.Storage.DirectoryRenamed\": StorageDirectoryRenamedEventData;\n /** An interface for the event data of a \"Microsoft.Storage.LifecyclePolicyCompleted\" event. */\n \"Microsoft.Storage.LifecyclePolicyCompleted\": StorageLifecyclePolicyCompletedEventData;\n /** An interface for the event data of a \"Microsoft.Web.AppUpdated\" event. */\n \"Microsoft.Web.AppUpdated\": WebAppUpdatedEventData;\n /** An interface for the event data of a \"Microsoft.Web.BackupOperationStarted\" event. */\n \"Microsoft.Web.BackupOperationStarted\": WebBackupOperationStartedEventData;\n /** An interface for the event data of a \"Microsoft.Web.BackupOperationCompleted\" event. */\n \"Microsoft.Web.BackupOperationCompleted\": WebBackupOperationCompletedEventData;\n /** An interface for the event data of a \"Microsoft.Web.BackupOperationFailed\" event. */\n \"Microsoft.Web.BackupOperationFailed\": WebBackupOperationFailedEventData;\n /** An interface for the event data of a \"Microsoft.Web.RestoreOperationStarted\" event. */\n \"Microsoft.Web.RestoreOperationStarted\": WebRestoreOperationStartedEventData;\n /** An interface for the event data of a \"Microsoft.Web.RestoreOperationCompleted\" event. */\n \"Microsoft.Web.RestoreOperationCompleted\": WebRestoreOperationCompletedEventData;\n /** An interface for the event data of a \"Microsoft.Web.RestoreOperationFailed\" event. */\n \"Microsoft.Web.RestoreOperationFailed\": WebRestoreOperationFailedEventData;\n /** An interface for the event data of a \"Microsoft.Web.SlotSwapStarted\" event. */\n \"Microsoft.Web.SlotSwapStarted\": WebSlotSwapStartedEventData;\n /** An interface for the event data of a \"Microsoft.Web.SlotSwapCompleted\" event. */\n \"Microsoft.Web.SlotSwapCompleted\": WebSlotSwapCompletedEventData;\n /** An interface for the event data of a \"Microsoft.Web.SlotSwapFailed\" event. */\n \"Microsoft.Web.SlotSwapFailed\": WebSlotSwapFailedEventData;\n /** An interface for the event data of a \"Microsoft.Web.SlotSwapWithPreviewStarted\" event. */\n \"Microsoft.Web.SlotSwapWithPreviewStarted\": WebSlotSwapWithPreviewStartedEventData;\n /** An interface for the event data of a \"Microsoft.Web.SlotSwapWithPreviewCancelled\" event. */\n \"Microsoft.Web.SlotSwapWithPreviewCancelled\": WebSlotSwapWithPreviewCancelledEventData;\n /** An interface for the event data of a \"Microsoft.Web.AppServicePlanUpdated\" event. */\n \"Microsoft.Web.AppServicePlanUpdated\": WebAppServicePlanUpdatedEventData;\n}\n\n/**\n * isCloudEventLike returns \"true\" when the event is a CloudEvent\n *\n * @param o - Either an EventGrid our CloudEvent event.\n */\nfunction isCloudEventLike(\n o: EventGridEvent<unknown> | CloudEvent<unknown>\n): o is CloudEvent<unknown> {\n return (o as any).source !== undefined;\n}\n\n/**\n * iSystemEvent returns \"true\" when a given event is a system event of a given type. When using\n * TypeScript, this function acts as a custom type guard and allows the TypeScript compiler to\n * identify the underlying data\n *\n * @param eventType - The type of system event to check for, e.g., \"Microsoft.AppConfiguration.KeyValueDeleted\"\n * @param event - The event to test.\n */\nexport function isSystemEvent<T extends KnownSystemEventTypes>(\n eventType: T,\n event: EventGridEvent<unknown>\n): event is EventGridEvent<SystemEventNameToEventData[T]>;\n\n/**\n * iSystemEvent returns \"true\" when a given event is a system event of a given type. When using\n * TypeScript, this function acts as a custom type guard and allows the TypeScript compiler to\n * identify the underlying data\n *\n * @param eventType - The type of system event to check for, e.g., \"Microsoft.AppConfiguration.KeyValueDeleted\"\n * @param event - The event to test.\n */\nexport function isSystemEvent<T extends KnownSystemEventTypes>(\n eventType: T,\n event: CloudEvent<unknown>\n): event is CloudEvent<SystemEventNameToEventData[T]>;\n\nexport function isSystemEvent<T extends KnownSystemEventTypes>(\n eventType: T,\n event: EventGridEvent<unknown> | CloudEvent<unknown>\n): event is\n | EventGridEvent<SystemEventNameToEventData[T]>\n | CloudEvent<SystemEventNameToEventData[T]> {\n if (isCloudEventLike(event)) {\n return event.type === eventType;\n } else {\n return event.eventType === eventType;\n }\n}\n"]}
@@ -7,6 +7,6 @@ import { createSpanFunction } from "@azure/core-tracing";
7
7
  */
8
8
  export const createSpan = createSpanFunction({
9
9
  packagePrefix: "Azure.Data.EventGrid",
10
- namespace: "Microsoft.Messaging.EventGrid"
10
+ namespace: "Microsoft.Messaging.EventGrid",
11
11
  });
12
12
  //# sourceMappingURL=tracing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/tracing.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;IAC3C,aAAa,EAAE,sBAAsB;IACrC,SAAS,EAAE,+BAA+B;CAC3C,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSpanFunction } from \"@azure/core-tracing\";\n\n/**\n * Creates a span using the global tracer.\n * @internal\n */\nexport const createSpan = createSpanFunction({\n packagePrefix: \"Azure.Data.EventGrid\",\n namespace: \"Microsoft.Messaging.EventGrid\"\n});\n"]}
1
+ {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/tracing.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;IAC3C,aAAa,EAAE,sBAAsB;IACrC,SAAS,EAAE,+BAA+B;CAC3C,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSpanFunction } from \"@azure/core-tracing\";\n\n/**\n * Creates a span using the global tracer.\n * @internal\n */\nexport const createSpan = createSpanFunction({\n packagePrefix: \"Azure.Data.EventGrid\",\n namespace: \"Microsoft.Messaging.EventGrid\",\n});\n"]}
@@ -18,14 +18,8 @@ export function dateToServiceTimeString(d) {
18
18
  const day = d.getUTCDate();
19
19
  const year = d.getUTCFullYear();
20
20
  const hour = d.getUTCHours() === 0 ? 12 : d.getUTCHours() % 12; // getUTCHours returns 0-23, and we want this in 12 hour format.
21
- const minute = d
22
- .getUTCMinutes()
23
- .toString()
24
- .padStart(2, "0");
25
- const second = d
26
- .getUTCSeconds()
27
- .toString()
28
- .padStart(2, "0");
21
+ const minute = d.getUTCMinutes().toString().padStart(2, "0");
22
+ const second = d.getUTCSeconds().toString().padStart(2, "0");
29
23
  const am = d.getUTCHours() >= 13 ? "PM" : "AM";
30
24
  return `${month}/${day}/${year} ${hour}:${minute}:${second} ${am}`;
31
25
  }
@@ -69,7 +63,7 @@ export function validateEventGridEvent(o) {
69
63
  "subject",
70
64
  "topic",
71
65
  "dataVersion",
72
- "metadataVersion"
66
+ "metadataVersion",
73
67
  ]);
74
68
  validateRequiredAnyProperties(o, ["data"]);
75
69
  if (castO.metadataVersion !== EVENT_GRID_SCHEMA_METADATA_VERSION) {