@azure/digital-twins-core 1.1.0-alpha.20220407.1 → 1.1.0-alpha.20220517.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +96 -366
- package/dist/index.js.map +1 -1
- package/dist-esm/src/constants.js +4 -0
- package/dist-esm/src/constants.js.map +1 -0
- package/dist-esm/src/digitalTwinsClient.js +90 -365
- package/dist-esm/src/digitalTwinsClient.js.map +1 -1
- package/dist-esm/src/tracing.js +6 -4
- package/dist-esm/src/tracing.js.map +1 -1
- package/package.json +4 -4
- package/CHANGELOG.md +0 -50
|
@@ -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 {
|
|
8
|
-
import { SpanStatusCode } from "@azure/core-tracing";
|
|
7
|
+
import { tracingClient } from "./tracing";
|
|
9
8
|
import { logger } from "./logger";
|
|
10
|
-
|
|
9
|
+
import { SDK_VERSION } from "./constants";
|
|
11
10
|
const DEFAULT_DIGITALTWINS_SCOPE = "https://digitaltwins.azure.net/.default";
|
|
12
11
|
/**
|
|
13
12
|
* Client for Azure IoT DigitalTwins API.
|
|
@@ -63,20 +62,9 @@ export class DigitalTwinsClient {
|
|
|
63
62
|
* @returns The application/json digital twin and the http response.
|
|
64
63
|
*/
|
|
65
64
|
getDigitalTwin(digitalTwinId, options = {}) {
|
|
66
|
-
|
|
67
|
-
try {
|
|
65
|
+
return tracingClient.withSpan("DigitalTwinsClient.getDigitalTwin", options, async (updatedOptions) => {
|
|
68
66
|
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
|
-
}
|
|
67
|
+
});
|
|
80
68
|
}
|
|
81
69
|
/**
|
|
82
70
|
* Create or update a digital twin
|
|
@@ -88,21 +76,10 @@ export class DigitalTwinsClient {
|
|
|
88
76
|
* @returns The created application/json digital twin and the http response.
|
|
89
77
|
*/
|
|
90
78
|
upsertDigitalTwin(digitalTwinId, digitalTwinJson, options = {}) {
|
|
91
|
-
|
|
92
|
-
try {
|
|
79
|
+
return tracingClient.withSpan("DigitalTwinsClient.upsertDigitalTwin", options, async (updatedOptions) => {
|
|
93
80
|
const payload = JSON.parse(digitalTwinJson);
|
|
94
81
|
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
|
-
}
|
|
82
|
+
});
|
|
106
83
|
}
|
|
107
84
|
/**
|
|
108
85
|
* Update a digital twin using a json patch.
|
|
@@ -118,20 +95,9 @@ export class DigitalTwinsClient {
|
|
|
118
95
|
updateDigitalTwin(digitalTwinId,
|
|
119
96
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
|
|
120
97
|
jsonPatch, options = {}) {
|
|
121
|
-
|
|
122
|
-
try {
|
|
98
|
+
return tracingClient.withSpan("DigitalTwinsClient.updateDigitalTwin", options, async (updatedOptions) => {
|
|
123
99
|
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
|
-
}
|
|
100
|
+
});
|
|
135
101
|
}
|
|
136
102
|
/**
|
|
137
103
|
* Delete a digital twin
|
|
@@ -142,20 +108,9 @@ export class DigitalTwinsClient {
|
|
|
142
108
|
* @returns The http response.
|
|
143
109
|
*/
|
|
144
110
|
deleteDigitalTwin(digitalTwinId, options = {}) {
|
|
145
|
-
|
|
146
|
-
try {
|
|
111
|
+
return tracingClient.withSpan("DigitalTwinsClient.deleteDigitalTwin", options, async (updatedOptions) => {
|
|
147
112
|
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
|
-
}
|
|
113
|
+
});
|
|
159
114
|
}
|
|
160
115
|
/**
|
|
161
116
|
* Get a component on a digital twin.
|
|
@@ -166,20 +121,9 @@ export class DigitalTwinsClient {
|
|
|
166
121
|
* @returns Json string representation of the component corresponding to the provided componentName and the HTTP response.
|
|
167
122
|
*/
|
|
168
123
|
getComponent(digitalTwinId, componentName, options = {}) {
|
|
169
|
-
|
|
170
|
-
try {
|
|
124
|
+
return tracingClient.withSpan("DigitalTwinsClient.getComponent", options, async (updatedOptions) => {
|
|
171
125
|
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
|
-
}
|
|
126
|
+
});
|
|
183
127
|
}
|
|
184
128
|
/**
|
|
185
129
|
* Update properties of a component on a digital twin using a JSON patch.
|
|
@@ -193,20 +137,9 @@ export class DigitalTwinsClient {
|
|
|
193
137
|
* @returns The http response.
|
|
194
138
|
*/
|
|
195
139
|
updateComponent(digitalTwinId, componentName, jsonPatch, options = {}) {
|
|
196
|
-
|
|
197
|
-
try {
|
|
140
|
+
return tracingClient.withSpan("DigitalTwinsClient.updateComponent", options, async (updatedOptions) => {
|
|
198
141
|
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
|
-
}
|
|
142
|
+
});
|
|
210
143
|
}
|
|
211
144
|
/**
|
|
212
145
|
* Get a relationship on a digital twin.
|
|
@@ -217,20 +150,9 @@ export class DigitalTwinsClient {
|
|
|
217
150
|
* @returns The pageable list of application/json relationships belonging to the specified digital twin and the http response.
|
|
218
151
|
*/
|
|
219
152
|
getRelationship(digitalTwinId, relationshipId, options = {}) {
|
|
220
|
-
|
|
221
|
-
try {
|
|
153
|
+
return tracingClient.withSpan("DigitalTwinsClient.getRelationship", options, async (updatedOptions) => {
|
|
222
154
|
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
|
-
}
|
|
155
|
+
});
|
|
234
156
|
}
|
|
235
157
|
/**
|
|
236
158
|
* Create or update a relationship on a digital twin.
|
|
@@ -244,20 +166,9 @@ export class DigitalTwinsClient {
|
|
|
244
166
|
upsertRelationship(digitalTwinId, relationshipId,
|
|
245
167
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
|
|
246
168
|
relationship, options = {}) {
|
|
247
|
-
|
|
248
|
-
try {
|
|
169
|
+
return tracingClient.withSpan("DigitalTwinsClient.upsertRelationship", options, async (updatedOptions) => {
|
|
249
170
|
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
|
-
}
|
|
171
|
+
});
|
|
261
172
|
}
|
|
262
173
|
/**
|
|
263
174
|
* Updates the properties of a relationship on a digital twin using a JSON patch.
|
|
@@ -269,20 +180,9 @@ export class DigitalTwinsClient {
|
|
|
269
180
|
* ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
|
|
270
181
|
*/
|
|
271
182
|
updateRelationship(digitalTwinId, relationshipId, jsonPatch, options = {}) {
|
|
272
|
-
|
|
273
|
-
try {
|
|
183
|
+
return tracingClient.withSpan("DigitalTwinsClient.updateRelationship", options, async (updatedOptions) => {
|
|
274
184
|
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
|
-
}
|
|
185
|
+
});
|
|
286
186
|
}
|
|
287
187
|
/**
|
|
288
188
|
* Delete a relationship on a digital twin.
|
|
@@ -294,20 +194,9 @@ export class DigitalTwinsClient {
|
|
|
294
194
|
* @returns The http response.
|
|
295
195
|
*/
|
|
296
196
|
deleteRelationship(digitalTwinId, relationshipId, options = {}) {
|
|
297
|
-
|
|
298
|
-
try {
|
|
197
|
+
return tracingClient.withSpan("DigitalTwinsClient.deleteRelationship", options, async (updatedOptions) => {
|
|
299
198
|
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
|
-
}
|
|
199
|
+
});
|
|
311
200
|
}
|
|
312
201
|
/**
|
|
313
202
|
* Deals with the pagination of {@link listRelationships}.
|
|
@@ -363,29 +252,16 @@ export class DigitalTwinsClient {
|
|
|
363
252
|
* @param digitalTwinId - The Id of the digital twin.
|
|
364
253
|
*/
|
|
365
254
|
listRelationships(digitalTwinId, options = {}) {
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
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
|
-
}
|
|
255
|
+
const iter = this.listRelationshipsAll(digitalTwinId, options);
|
|
256
|
+
return {
|
|
257
|
+
next() {
|
|
258
|
+
return iter.next();
|
|
259
|
+
},
|
|
260
|
+
[Symbol.asyncIterator]() {
|
|
261
|
+
return this;
|
|
262
|
+
},
|
|
263
|
+
byPage: (settings = {}) => this.listRelationshipsPage(digitalTwinId, options, settings),
|
|
264
|
+
};
|
|
389
265
|
}
|
|
390
266
|
/**
|
|
391
267
|
* Deals with the pagination of {@link listIncomingRelationships}.
|
|
@@ -440,29 +316,16 @@ export class DigitalTwinsClient {
|
|
|
440
316
|
* @param digitalTwinId - The Id of the digital twin.
|
|
441
317
|
*/
|
|
442
318
|
listIncomingRelationships(digitalTwinId, options = {}) {
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
}
|
|
319
|
+
const iter = this.listIncomingRelationshipsAll(digitalTwinId, options);
|
|
320
|
+
return {
|
|
321
|
+
next() {
|
|
322
|
+
return iter.next();
|
|
323
|
+
},
|
|
324
|
+
[Symbol.asyncIterator]() {
|
|
325
|
+
return this;
|
|
326
|
+
},
|
|
327
|
+
byPage: (settings = {}) => this.listIncomingRelationshipsPage(digitalTwinId, options, settings),
|
|
328
|
+
};
|
|
466
329
|
}
|
|
467
330
|
/**
|
|
468
331
|
* Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.
|
|
@@ -481,20 +344,9 @@ export class DigitalTwinsClient {
|
|
|
481
344
|
if (!messageId) {
|
|
482
345
|
messageId = generateUuid();
|
|
483
346
|
}
|
|
484
|
-
|
|
485
|
-
try {
|
|
347
|
+
return tracingClient.withSpan("DigitalTwinsClient.publishTelemetry", digitalTwinsSendTelemetryOptionalParams, async (updatedOptions) => {
|
|
486
348
|
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
|
-
}
|
|
349
|
+
});
|
|
498
350
|
}
|
|
499
351
|
/**
|
|
500
352
|
* Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.
|
|
@@ -512,20 +364,9 @@ export class DigitalTwinsClient {
|
|
|
512
364
|
if (!messageId) {
|
|
513
365
|
messageId = generateUuid();
|
|
514
366
|
}
|
|
515
|
-
|
|
516
|
-
try {
|
|
367
|
+
return tracingClient.withSpan("DigitalTwinsClient.publishComponentTelemetry", digitalTwinsSendComponentTelemetryOptionalParams, async (updatedOptions) => {
|
|
517
368
|
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
|
-
}
|
|
369
|
+
});
|
|
529
370
|
}
|
|
530
371
|
/**
|
|
531
372
|
* Get a model, including the model metadata and the model definition.
|
|
@@ -538,20 +379,9 @@ export class DigitalTwinsClient {
|
|
|
538
379
|
getModel(modelId, includeModelDefinition = false, options = {}) {
|
|
539
380
|
const digitalTwinModelsGetByIdOptionalParams = options;
|
|
540
381
|
digitalTwinModelsGetByIdOptionalParams.includeModelDefinition = includeModelDefinition;
|
|
541
|
-
|
|
542
|
-
try {
|
|
382
|
+
return tracingClient.withSpan("DigitalTwinsClient.getModel", digitalTwinModelsGetByIdOptionalParams, async (updatedOptions) => {
|
|
543
383
|
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
|
-
}
|
|
384
|
+
});
|
|
555
385
|
}
|
|
556
386
|
/**
|
|
557
387
|
* Deals with the pagination of {@link list}.
|
|
@@ -617,29 +447,16 @@ export class DigitalTwinsClient {
|
|
|
617
447
|
dependenciesFor: dependeciesFor,
|
|
618
448
|
includeModelDefinition: includeModelDefinition,
|
|
619
449
|
};
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
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
|
-
}
|
|
450
|
+
const iter = this.getModelsAll(digitalTwinModelsListOptionalParams);
|
|
451
|
+
return {
|
|
452
|
+
next() {
|
|
453
|
+
return iter.next();
|
|
454
|
+
},
|
|
455
|
+
[Symbol.asyncIterator]() {
|
|
456
|
+
return this;
|
|
457
|
+
},
|
|
458
|
+
byPage: (settings = {}) => this.getModelsPage(digitalTwinModelsListOptionalParams, settings),
|
|
459
|
+
};
|
|
643
460
|
}
|
|
644
461
|
/**
|
|
645
462
|
* Create one or many
|
|
@@ -651,20 +468,9 @@ export class DigitalTwinsClient {
|
|
|
651
468
|
createModels(dtdlModels, options = {}) {
|
|
652
469
|
const digitalTwinModelsAddOptionalParams = options;
|
|
653
470
|
digitalTwinModelsAddOptionalParams.models = dtdlModels;
|
|
654
|
-
|
|
655
|
-
try {
|
|
471
|
+
return tracingClient.withSpan("DigitalTwinsClient.createModels", digitalTwinModelsAddOptionalParams, async (updatedOptions) => {
|
|
656
472
|
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
|
-
}
|
|
473
|
+
});
|
|
668
474
|
}
|
|
669
475
|
/**
|
|
670
476
|
* Decommission a model using a json patch.
|
|
@@ -680,20 +486,9 @@ export class DigitalTwinsClient {
|
|
|
680
486
|
*/
|
|
681
487
|
decommissionModel(modelId, options = {}) {
|
|
682
488
|
const jsonPatch = [{ op: "replace", path: "/decommissioned", value: true }];
|
|
683
|
-
|
|
684
|
-
try {
|
|
489
|
+
return tracingClient.withSpan("DigitalTwinsClient.decommissionModel", options, async (updatedOptions) => {
|
|
685
490
|
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
|
-
}
|
|
491
|
+
});
|
|
697
492
|
}
|
|
698
493
|
/**
|
|
699
494
|
* Delete a model.
|
|
@@ -703,20 +498,9 @@ export class DigitalTwinsClient {
|
|
|
703
498
|
* @returns The http response.
|
|
704
499
|
*/
|
|
705
500
|
deleteModel(modelId, options = {}) {
|
|
706
|
-
|
|
707
|
-
try {
|
|
501
|
+
return tracingClient.withSpan("DigitalTwinsClient.deleteModel", options, async (updatedOptions) => {
|
|
708
502
|
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
|
-
}
|
|
503
|
+
});
|
|
720
504
|
}
|
|
721
505
|
/**
|
|
722
506
|
* Get an event route.
|
|
@@ -726,20 +510,9 @@ export class DigitalTwinsClient {
|
|
|
726
510
|
* @returns The application/json event route and the http response.
|
|
727
511
|
*/
|
|
728
512
|
getEventRoute(eventRouteId, options = {}) {
|
|
729
|
-
|
|
730
|
-
try {
|
|
513
|
+
return tracingClient.withSpan("DigitalTwinsClient.getEventRoute", options, async (updatedOptions) => {
|
|
731
514
|
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
|
-
}
|
|
515
|
+
});
|
|
743
516
|
}
|
|
744
517
|
/**
|
|
745
518
|
* Deals with the pagination of {@link list}.
|
|
@@ -802,29 +575,16 @@ export class DigitalTwinsClient {
|
|
|
802
575
|
eventRoutesListOptionalParams = {
|
|
803
576
|
maxItemsPerPage: resultsPerPage,
|
|
804
577
|
};
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
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
|
-
}
|
|
578
|
+
const iter = this.getEventRoutesAll(eventRoutesListOptionalParams);
|
|
579
|
+
return {
|
|
580
|
+
next() {
|
|
581
|
+
return iter.next();
|
|
582
|
+
},
|
|
583
|
+
[Symbol.asyncIterator]() {
|
|
584
|
+
return this;
|
|
585
|
+
},
|
|
586
|
+
byPage: (settings = {}) => this.getEventRoutesPage(eventRoutesListOptionalParams, settings),
|
|
587
|
+
};
|
|
828
588
|
}
|
|
829
589
|
/**
|
|
830
590
|
* Create or update an event route.
|
|
@@ -842,20 +602,9 @@ export class DigitalTwinsClient {
|
|
|
842
602
|
filter: filter,
|
|
843
603
|
};
|
|
844
604
|
eventRoutesAddOptionalParams.eventRoute = eventRoute;
|
|
845
|
-
|
|
846
|
-
try {
|
|
605
|
+
return tracingClient.withSpan("DigitalTwinsClient.upsertEventRoute", eventRoutesAddOptionalParams, async (updatedOptions) => {
|
|
847
606
|
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
|
-
}
|
|
607
|
+
});
|
|
859
608
|
}
|
|
860
609
|
/**
|
|
861
610
|
* Delete an event route.
|
|
@@ -865,20 +614,9 @@ export class DigitalTwinsClient {
|
|
|
865
614
|
* @returns The http response.
|
|
866
615
|
*/
|
|
867
616
|
deleteEventRoute(eventRouteId, options = {}) {
|
|
868
|
-
|
|
869
|
-
try {
|
|
617
|
+
return tracingClient.withSpan("DigitalTwinsClient.deleteEventRoute", options, async (updatedOptions) => {
|
|
870
618
|
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
|
-
}
|
|
619
|
+
});
|
|
882
620
|
}
|
|
883
621
|
/**
|
|
884
622
|
* Deals with the pagination of {@link query}.
|
|
@@ -950,29 +688,16 @@ export class DigitalTwinsClient {
|
|
|
950
688
|
queryQueryTwinsOptionalParams = {
|
|
951
689
|
maxItemsPerPage: resultsPerPage,
|
|
952
690
|
};
|
|
953
|
-
const
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
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
|
-
}
|
|
691
|
+
const iter = this.queryTwinsAll(query, queryQueryTwinsOptionalParams);
|
|
692
|
+
return {
|
|
693
|
+
next() {
|
|
694
|
+
return iter.next();
|
|
695
|
+
},
|
|
696
|
+
[Symbol.asyncIterator]() {
|
|
697
|
+
return this;
|
|
698
|
+
},
|
|
699
|
+
byPage: (settings = {}) => this.queryTwinsPage(query, queryQueryTwinsOptionalParams, settings),
|
|
700
|
+
};
|
|
976
701
|
}
|
|
977
702
|
}
|
|
978
703
|
//# sourceMappingURL=digitalTwinsClient.js.map
|