@azure/digital-twins-core 1.1.0-beta.1 → 1.1.0

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.
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export const SDK_VERSION = "1.1.0";
4
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,OAAO,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.1.0\";\n"]}
@@ -4,10 +4,9 @@ import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __rest } fr
4
4
  /// <reference lib="esnext.asynciterable" />
5
5
  import { bearerTokenAuthenticationPolicy, createPipelineFromOptions, generateUuid, } from "@azure/core-http";
6
6
  import { AzureDigitalTwinsAPI as GeneratedClient } from "./generated/azureDigitalTwinsAPI";
7
- import { createSpan } from "./tracing";
8
- import { SpanStatusCode } from "@azure/core-tracing";
7
+ import { tracingClient } from "./tracing";
9
8
  import { logger } from "./logger";
10
- export const SDK_VERSION = "1.1.0-beta.1";
9
+ export const SDK_VERSION = "1.1.0";
11
10
  const DEFAULT_DIGITALTWINS_SCOPE = "https://digitaltwins.azure.net/.default";
12
11
  /**
13
12
  * Client for Azure IoT DigitalTwins API.
@@ -30,10 +29,6 @@ export class DigitalTwinsClient {
30
29
  * @param options - Used to configure the service client.
31
30
  */
32
31
  constructor(endpointUrl, credential, options = {}) {
33
- /**
34
- * @deprecated Please use {@link DigitalTwinsClient.decommissionModel} instead.
35
- */
36
- this.decomissionModel = this.decommissionModel;
37
32
  const authPolicy = bearerTokenAuthenticationPolicy(credential, DEFAULT_DIGITALTWINS_SCOPE);
38
33
  const libInfo = `azsdk-js-digital-twins-core/${SDK_VERSION}`;
39
34
  const { apiVersion } = options, pipelineOptions = __rest(options, ["apiVersion"]);
@@ -63,20 +58,9 @@ export class DigitalTwinsClient {
63
58
  * @returns The application/json digital twin and the http response.
64
59
  */
65
60
  getDigitalTwin(digitalTwinId, options = {}) {
66
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-getDigitalTwin", options);
67
- try {
61
+ return tracingClient.withSpan("DigitalTwinsClient.getDigitalTwin", options, async (updatedOptions) => {
68
62
  return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);
69
- }
70
- catch (e) {
71
- span.setStatus({
72
- code: SpanStatusCode.ERROR,
73
- message: e.message,
74
- });
75
- throw e;
76
- }
77
- finally {
78
- span.end();
79
- }
63
+ });
80
64
  }
81
65
  /**
82
66
  * Create or update a digital twin
@@ -88,21 +72,10 @@ export class DigitalTwinsClient {
88
72
  * @returns The created application/json digital twin and the http response.
89
73
  */
90
74
  upsertDigitalTwin(digitalTwinId, digitalTwinJson, options = {}) {
91
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-upsertDigitalTwin", options);
92
- try {
75
+ return tracingClient.withSpan("DigitalTwinsClient.upsertDigitalTwin", options, async (updatedOptions) => {
93
76
  const payload = JSON.parse(digitalTwinJson);
94
77
  return this.client.digitalTwins.add(digitalTwinId, payload, updatedOptions);
95
- }
96
- catch (e) {
97
- span.setStatus({
98
- code: SpanStatusCode.ERROR,
99
- message: e.message,
100
- });
101
- throw e;
102
- }
103
- finally {
104
- span.end();
105
- }
78
+ });
106
79
  }
107
80
  /**
108
81
  * Update a digital twin using a json patch.
@@ -118,20 +91,9 @@ export class DigitalTwinsClient {
118
91
  updateDigitalTwin(digitalTwinId,
119
92
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
120
93
  jsonPatch, options = {}) {
121
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-updateDigitalTwin", options);
122
- try {
94
+ return tracingClient.withSpan("DigitalTwinsClient.updateDigitalTwin", options, async (updatedOptions) => {
123
95
  return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);
124
- }
125
- catch (e) {
126
- span.setStatus({
127
- code: SpanStatusCode.ERROR,
128
- message: e.message,
129
- });
130
- throw e;
131
- }
132
- finally {
133
- span.end();
134
- }
96
+ });
135
97
  }
136
98
  /**
137
99
  * Delete a digital twin
@@ -142,20 +104,9 @@ export class DigitalTwinsClient {
142
104
  * @returns The http response.
143
105
  */
144
106
  deleteDigitalTwin(digitalTwinId, options = {}) {
145
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-deleteDigitalTwin", options);
146
- try {
107
+ return tracingClient.withSpan("DigitalTwinsClient.deleteDigitalTwin", options, async (updatedOptions) => {
147
108
  return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);
148
- }
149
- catch (e) {
150
- span.setStatus({
151
- code: SpanStatusCode.ERROR,
152
- message: e.message,
153
- });
154
- throw e;
155
- }
156
- finally {
157
- span.end();
158
- }
109
+ });
159
110
  }
160
111
  /**
161
112
  * Get a component on a digital twin.
@@ -166,20 +117,9 @@ export class DigitalTwinsClient {
166
117
  * @returns Json string representation of the component corresponding to the provided componentName and the HTTP response.
167
118
  */
168
119
  getComponent(digitalTwinId, componentName, options = {}) {
169
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-getComponent", options);
170
- try {
120
+ return tracingClient.withSpan("DigitalTwinsClient.getComponent", options, async (updatedOptions) => {
171
121
  return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);
172
- }
173
- catch (e) {
174
- span.setStatus({
175
- code: SpanStatusCode.ERROR,
176
- message: e.message,
177
- });
178
- throw e;
179
- }
180
- finally {
181
- span.end();
182
- }
122
+ });
183
123
  }
184
124
  /**
185
125
  * Update properties of a component on a digital twin using a JSON patch.
@@ -193,20 +133,9 @@ export class DigitalTwinsClient {
193
133
  * @returns The http response.
194
134
  */
195
135
  updateComponent(digitalTwinId, componentName, jsonPatch, options = {}) {
196
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-updateComponent", options);
197
- try {
136
+ return tracingClient.withSpan("DigitalTwinsClient.updateComponent", options, async (updatedOptions) => {
198
137
  return this.client.digitalTwins.updateComponent(digitalTwinId, componentName, jsonPatch, updatedOptions);
199
- }
200
- catch (e) {
201
- span.setStatus({
202
- code: SpanStatusCode.ERROR,
203
- message: e.message,
204
- });
205
- throw e;
206
- }
207
- finally {
208
- span.end();
209
- }
138
+ });
210
139
  }
211
140
  /**
212
141
  * Get a relationship on a digital twin.
@@ -217,20 +146,9 @@ export class DigitalTwinsClient {
217
146
  * @returns The pageable list of application/json relationships belonging to the specified digital twin and the http response.
218
147
  */
219
148
  getRelationship(digitalTwinId, relationshipId, options = {}) {
220
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-getRelationship", options);
221
- try {
149
+ return tracingClient.withSpan("DigitalTwinsClient.getRelationship", options, async (updatedOptions) => {
222
150
  return this.client.digitalTwins.getRelationshipById(digitalTwinId, relationshipId, updatedOptions);
223
- }
224
- catch (e) {
225
- span.setStatus({
226
- code: SpanStatusCode.ERROR,
227
- message: e.message,
228
- });
229
- throw e;
230
- }
231
- finally {
232
- span.end();
233
- }
151
+ });
234
152
  }
235
153
  /**
236
154
  * Create or update a relationship on a digital twin.
@@ -244,20 +162,9 @@ export class DigitalTwinsClient {
244
162
  upsertRelationship(digitalTwinId, relationshipId,
245
163
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
246
164
  relationship, options = {}) {
247
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-upsertRelationship", options);
248
- try {
165
+ return tracingClient.withSpan("DigitalTwinsClient.upsertRelationship", options, async (updatedOptions) => {
249
166
  return this.client.digitalTwins.addRelationship(digitalTwinId, relationshipId, relationship, updatedOptions);
250
- }
251
- catch (e) {
252
- span.setStatus({
253
- code: SpanStatusCode.ERROR,
254
- message: e.message,
255
- });
256
- throw e;
257
- }
258
- finally {
259
- span.end();
260
- }
167
+ });
261
168
  }
262
169
  /**
263
170
  * Updates the properties of a relationship on a digital twin using a JSON patch.
@@ -269,20 +176,9 @@ export class DigitalTwinsClient {
269
176
  * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
270
177
  */
271
178
  updateRelationship(digitalTwinId, relationshipId, jsonPatch, options = {}) {
272
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-updateRelationship", options);
273
- try {
179
+ return tracingClient.withSpan("DigitalTwinsClient.updateRelationship", options, async (updatedOptions) => {
274
180
  return this.client.digitalTwins.updateRelationship(digitalTwinId, relationshipId, jsonPatch, updatedOptions);
275
- }
276
- catch (e) {
277
- span.setStatus({
278
- code: SpanStatusCode.ERROR,
279
- message: e.message,
280
- });
281
- throw e;
282
- }
283
- finally {
284
- span.end();
285
- }
181
+ });
286
182
  }
287
183
  /**
288
184
  * Delete a relationship on a digital twin.
@@ -294,20 +190,9 @@ export class DigitalTwinsClient {
294
190
  * @returns The http response.
295
191
  */
296
192
  deleteRelationship(digitalTwinId, relationshipId, options = {}) {
297
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-deleteRelationship", options);
298
- try {
193
+ return tracingClient.withSpan("DigitalTwinsClient.deleteRelationship", options, async (updatedOptions) => {
299
194
  return this.client.digitalTwins.deleteRelationship(digitalTwinId, relationshipId, updatedOptions);
300
- }
301
- catch (e) {
302
- span.setStatus({
303
- code: SpanStatusCode.ERROR,
304
- message: e.message,
305
- });
306
- throw e;
307
- }
308
- finally {
309
- span.end();
310
- }
195
+ });
311
196
  }
312
197
  /**
313
198
  * Deals with the pagination of {@link listRelationships}.
@@ -363,29 +248,16 @@ export class DigitalTwinsClient {
363
248
  * @param digitalTwinId - The Id of the digital twin.
364
249
  */
365
250
  listRelationships(digitalTwinId, options = {}) {
366
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-listRelationships", options);
367
- try {
368
- const iter = this.listRelationshipsAll(digitalTwinId, updatedOptions);
369
- return {
370
- next() {
371
- return iter.next();
372
- },
373
- [Symbol.asyncIterator]() {
374
- return this;
375
- },
376
- byPage: (settings = {}) => this.listRelationshipsPage(digitalTwinId, updatedOptions, settings),
377
- };
378
- }
379
- catch (e) {
380
- span.setStatus({
381
- code: SpanStatusCode.ERROR,
382
- message: e.message,
383
- });
384
- throw e;
385
- }
386
- finally {
387
- span.end();
388
- }
251
+ const iter = this.listRelationshipsAll(digitalTwinId, options);
252
+ return {
253
+ next() {
254
+ return iter.next();
255
+ },
256
+ [Symbol.asyncIterator]() {
257
+ return this;
258
+ },
259
+ byPage: (settings = {}) => this.listRelationshipsPage(digitalTwinId, options, settings),
260
+ };
389
261
  }
390
262
  /**
391
263
  * Deals with the pagination of {@link listIncomingRelationships}.
@@ -440,29 +312,16 @@ export class DigitalTwinsClient {
440
312
  * @param digitalTwinId - The Id of the digital twin.
441
313
  */
442
314
  listIncomingRelationships(digitalTwinId, options = {}) {
443
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-listIncomingRelationships", options);
444
- try {
445
- const iter = this.listIncomingRelationshipsAll(digitalTwinId, updatedOptions);
446
- return {
447
- next() {
448
- return iter.next();
449
- },
450
- [Symbol.asyncIterator]() {
451
- return this;
452
- },
453
- byPage: (settings = {}) => this.listIncomingRelationshipsPage(digitalTwinId, updatedOptions, settings),
454
- };
455
- }
456
- catch (e) {
457
- span.setStatus({
458
- code: SpanStatusCode.ERROR,
459
- message: e.message,
460
- });
461
- throw e;
462
- }
463
- finally {
464
- span.end();
465
- }
315
+ const iter = this.listIncomingRelationshipsAll(digitalTwinId, options);
316
+ return {
317
+ next() {
318
+ return iter.next();
319
+ },
320
+ [Symbol.asyncIterator]() {
321
+ return this;
322
+ },
323
+ byPage: (settings = {}) => this.listIncomingRelationshipsPage(digitalTwinId, options, settings),
324
+ };
466
325
  }
467
326
  /**
468
327
  * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.
@@ -481,20 +340,9 @@ export class DigitalTwinsClient {
481
340
  if (!messageId) {
482
341
  messageId = generateUuid();
483
342
  }
484
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-publishTelemetry", digitalTwinsSendTelemetryOptionalParams);
485
- try {
343
+ return tracingClient.withSpan("DigitalTwinsClient.publishTelemetry", digitalTwinsSendTelemetryOptionalParams, async (updatedOptions) => {
486
344
  return this.client.digitalTwins.sendTelemetry(digitalTwinId, messageId, payload, updatedOptions);
487
- }
488
- catch (e) {
489
- span.setStatus({
490
- code: SpanStatusCode.ERROR,
491
- message: e.message,
492
- });
493
- throw e;
494
- }
495
- finally {
496
- span.end();
497
- }
345
+ });
498
346
  }
499
347
  /**
500
348
  * Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.
@@ -512,20 +360,9 @@ export class DigitalTwinsClient {
512
360
  if (!messageId) {
513
361
  messageId = generateUuid();
514
362
  }
515
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-publishComponentTelemetry", digitalTwinsSendComponentTelemetryOptionalParams);
516
- try {
363
+ return tracingClient.withSpan("DigitalTwinsClient.publishComponentTelemetry", digitalTwinsSendComponentTelemetryOptionalParams, async (updatedOptions) => {
517
364
  return this.client.digitalTwins.sendComponentTelemetry(digitalTwinId, componentName, payload, messageId, updatedOptions);
518
- }
519
- catch (e) {
520
- span.setStatus({
521
- code: SpanStatusCode.ERROR,
522
- message: e.message,
523
- });
524
- throw e;
525
- }
526
- finally {
527
- span.end();
528
- }
365
+ });
529
366
  }
530
367
  /**
531
368
  * Get a model, including the model metadata and the model definition.
@@ -538,20 +375,9 @@ export class DigitalTwinsClient {
538
375
  getModel(modelId, includeModelDefinition = false, options = {}) {
539
376
  const digitalTwinModelsGetByIdOptionalParams = options;
540
377
  digitalTwinModelsGetByIdOptionalParams.includeModelDefinition = includeModelDefinition;
541
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-getModel", digitalTwinModelsGetByIdOptionalParams);
542
- try {
378
+ return tracingClient.withSpan("DigitalTwinsClient.getModel", digitalTwinModelsGetByIdOptionalParams, async (updatedOptions) => {
543
379
  return this.client.digitalTwinModels.getById(modelId, updatedOptions);
544
- }
545
- catch (e) {
546
- span.setStatus({
547
- code: SpanStatusCode.ERROR,
548
- message: e.message,
549
- });
550
- throw e;
551
- }
552
- finally {
553
- span.end();
554
- }
380
+ });
555
381
  }
556
382
  /**
557
383
  * Deals with the pagination of {@link list}.
@@ -617,29 +443,16 @@ export class DigitalTwinsClient {
617
443
  dependenciesFor: dependeciesFor,
618
444
  includeModelDefinition: includeModelDefinition,
619
445
  };
620
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-listModels", digitalTwinModelsListOptionalParams);
621
- try {
622
- const iter = this.getModelsAll(updatedOptions);
623
- return {
624
- next() {
625
- return iter.next();
626
- },
627
- [Symbol.asyncIterator]() {
628
- return this;
629
- },
630
- byPage: (settings = {}) => this.getModelsPage(digitalTwinModelsListOptionalParams, settings),
631
- };
632
- }
633
- catch (e) {
634
- span.setStatus({
635
- code: SpanStatusCode.ERROR,
636
- message: e.message,
637
- });
638
- throw e;
639
- }
640
- finally {
641
- span.end();
642
- }
446
+ const iter = this.getModelsAll(digitalTwinModelsListOptionalParams);
447
+ return {
448
+ next() {
449
+ return iter.next();
450
+ },
451
+ [Symbol.asyncIterator]() {
452
+ return this;
453
+ },
454
+ byPage: (settings = {}) => this.getModelsPage(digitalTwinModelsListOptionalParams, settings),
455
+ };
643
456
  }
644
457
  /**
645
458
  * Create one or many
@@ -651,20 +464,9 @@ export class DigitalTwinsClient {
651
464
  createModels(dtdlModels, options = {}) {
652
465
  const digitalTwinModelsAddOptionalParams = options;
653
466
  digitalTwinModelsAddOptionalParams.models = dtdlModels;
654
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-createModels", digitalTwinModelsAddOptionalParams);
655
- try {
467
+ return tracingClient.withSpan("DigitalTwinsClient.createModels", digitalTwinModelsAddOptionalParams, async (updatedOptions) => {
656
468
  return this.client.digitalTwinModels.add(updatedOptions);
657
- }
658
- catch (e) {
659
- span.setStatus({
660
- code: SpanStatusCode.ERROR,
661
- message: e.message,
662
- });
663
- throw e;
664
- }
665
- finally {
666
- span.end();
667
- }
469
+ });
668
470
  }
669
471
  /**
670
472
  * Decommission a model using a json patch.
@@ -678,22 +480,11 @@ export class DigitalTwinsClient {
678
480
  * @returns The http response.
679
481
  *
680
482
  */
681
- decommissionModel(modelId, options = {}) {
483
+ decomissionModel(modelId, options = {}) {
682
484
  const jsonPatch = [{ op: "replace", path: "/decommissioned", value: true }];
683
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-decommissionModel", options);
684
- try {
485
+ return tracingClient.withSpan("DigitalTwinsClient.decomissionModel", options, async (updatedOptions) => {
685
486
  return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);
686
- }
687
- catch (e) {
688
- span.setStatus({
689
- code: SpanStatusCode.ERROR,
690
- message: e.message,
691
- });
692
- throw e;
693
- }
694
- finally {
695
- span.end();
696
- }
487
+ });
697
488
  }
698
489
  /**
699
490
  * Delete a model.
@@ -703,20 +494,9 @@ export class DigitalTwinsClient {
703
494
  * @returns The http response.
704
495
  */
705
496
  deleteModel(modelId, options = {}) {
706
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-deleteModel", options);
707
- try {
497
+ return tracingClient.withSpan("DigitalTwinsClient.deleteModel", options, async (updatedOptions) => {
708
498
  return this.client.digitalTwinModels.delete(modelId, updatedOptions);
709
- }
710
- catch (e) {
711
- span.setStatus({
712
- code: SpanStatusCode.ERROR,
713
- message: e.message,
714
- });
715
- throw e;
716
- }
717
- finally {
718
- span.end();
719
- }
499
+ });
720
500
  }
721
501
  /**
722
502
  * Get an event route.
@@ -726,20 +506,9 @@ export class DigitalTwinsClient {
726
506
  * @returns The application/json event route and the http response.
727
507
  */
728
508
  getEventRoute(eventRouteId, options = {}) {
729
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-getEventRoute", options);
730
- try {
509
+ return tracingClient.withSpan("DigitalTwinsClient.getEventRoute", options, async (updatedOptions) => {
731
510
  return this.client.eventRoutes.getById(eventRouteId, updatedOptions);
732
- }
733
- catch (e) {
734
- span.setStatus({
735
- code: SpanStatusCode.ERROR,
736
- message: e.message,
737
- });
738
- throw e;
739
- }
740
- finally {
741
- span.end();
742
- }
511
+ });
743
512
  }
744
513
  /**
745
514
  * Deals with the pagination of {@link list}.
@@ -802,29 +571,16 @@ export class DigitalTwinsClient {
802
571
  eventRoutesListOptionalParams = {
803
572
  maxItemsPerPage: resultsPerPage,
804
573
  };
805
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-listEventRoutes", eventRoutesListOptionalParams);
806
- try {
807
- const iter = this.getEventRoutesAll(updatedOptions);
808
- return {
809
- next() {
810
- return iter.next();
811
- },
812
- [Symbol.asyncIterator]() {
813
- return this;
814
- },
815
- byPage: (settings = {}) => this.getEventRoutesPage(eventRoutesListOptionalParams, settings),
816
- };
817
- }
818
- catch (e) {
819
- span.setStatus({
820
- code: SpanStatusCode.ERROR,
821
- message: e.message,
822
- });
823
- throw e;
824
- }
825
- finally {
826
- span.end();
827
- }
574
+ const iter = this.getEventRoutesAll(eventRoutesListOptionalParams);
575
+ return {
576
+ next() {
577
+ return iter.next();
578
+ },
579
+ [Symbol.asyncIterator]() {
580
+ return this;
581
+ },
582
+ byPage: (settings = {}) => this.getEventRoutesPage(eventRoutesListOptionalParams, settings),
583
+ };
828
584
  }
829
585
  /**
830
586
  * Create or update an event route.
@@ -842,20 +598,9 @@ export class DigitalTwinsClient {
842
598
  filter: filter,
843
599
  };
844
600
  eventRoutesAddOptionalParams.eventRoute = eventRoute;
845
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-upsertEventRoute", eventRoutesAddOptionalParams);
846
- try {
601
+ return tracingClient.withSpan("DigitalTwinsClient.upsertEventRoute", eventRoutesAddOptionalParams, async (updatedOptions) => {
847
602
  return this.client.eventRoutes.add(eventRouteId, updatedOptions);
848
- }
849
- catch (e) {
850
- span.setStatus({
851
- code: SpanStatusCode.ERROR,
852
- message: e.message,
853
- });
854
- throw e;
855
- }
856
- finally {
857
- span.end();
858
- }
603
+ });
859
604
  }
860
605
  /**
861
606
  * Delete an event route.
@@ -865,20 +610,9 @@ export class DigitalTwinsClient {
865
610
  * @returns The http response.
866
611
  */
867
612
  deleteEventRoute(eventRouteId, options = {}) {
868
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-deleteEventRoute", options);
869
- try {
613
+ return tracingClient.withSpan("DigitalTwinsClient.deleteEventRoute", options, async (updatedOptions) => {
870
614
  return this.client.eventRoutes.delete(eventRouteId, updatedOptions);
871
- }
872
- catch (e) {
873
- span.setStatus({
874
- code: SpanStatusCode.ERROR,
875
- message: e.message,
876
- });
877
- throw e;
878
- }
879
- finally {
880
- span.end();
881
- }
615
+ });
882
616
  }
883
617
  /**
884
618
  * Deals with the pagination of {@link query}.
@@ -950,29 +684,16 @@ export class DigitalTwinsClient {
950
684
  queryQueryTwinsOptionalParams = {
951
685
  maxItemsPerPage: resultsPerPage,
952
686
  };
953
- const { span, updatedOptions } = createSpan("DigitalTwinsClient-queryTwins", queryQueryTwinsOptionalParams);
954
- try {
955
- const iter = this.queryTwinsAll(query, updatedOptions);
956
- return {
957
- next() {
958
- return iter.next();
959
- },
960
- [Symbol.asyncIterator]() {
961
- return this;
962
- },
963
- byPage: (settings = {}) => this.queryTwinsPage(query, queryQueryTwinsOptionalParams, settings),
964
- };
965
- }
966
- catch (e) {
967
- span.setStatus({
968
- code: SpanStatusCode.ERROR,
969
- message: e.message,
970
- });
971
- throw e;
972
- }
973
- finally {
974
- span.end();
975
- }
687
+ const iter = this.queryTwinsAll(query, queryQueryTwinsOptionalParams);
688
+ return {
689
+ next() {
690
+ return iter.next();
691
+ },
692
+ [Symbol.asyncIterator]() {
693
+ return this;
694
+ },
695
+ byPage: (settings = {}) => this.queryTwinsPage(query, queryQueryTwinsOptionalParams, settings),
696
+ };
976
697
  }
977
698
  }
978
699
  //# sourceMappingURL=digitalTwinsClient.js.map