@azure/digital-twins-core 1.1.0-alpha.20220406.1 → 1.1.0-alpha.20220516.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/CHANGELOG.md +6 -0
- 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
CHANGED
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
### Key Bugs Fixed
|
|
14
14
|
|
|
15
|
+
### Other Changes
|
|
16
|
+
|
|
17
|
+
- Updated our `@azure/core-tracing` dependency to the latest version (1.0.0).
|
|
18
|
+
- Notable changes include Removal of `@opentelemetry/api` as a transitive dependency and ensuring that the active context is properly propagated.
|
|
19
|
+
- Customers who would like to continue using OpenTelemetry driven tracing should visit our [OpenTelemetry Instrumentation](https://www.npmjs.com/package/@azure/opentelemetry-instrumentation-azure-sdk) package for instructions.
|
|
20
|
+
|
|
15
21
|
## 1.0.3 (2021-01-15)
|
|
16
22
|
|
|
17
23
|
- Bug Fix: include the types definition file in the shipped package
|
package/dist/index.js
CHANGED
|
@@ -1919,14 +1919,19 @@ class AzureDigitalTwinsAPI extends AzureDigitalTwinsAPIContext {
|
|
|
1919
1919
|
}
|
|
1920
1920
|
}
|
|
1921
1921
|
|
|
1922
|
+
// Copyright (c) Microsoft Corporation.
|
|
1923
|
+
// Licensed under the MIT license.
|
|
1924
|
+
const SDK_VERSION = "1.1.0";
|
|
1925
|
+
|
|
1922
1926
|
// Copyright (c) Microsoft Corporation.
|
|
1923
1927
|
/**
|
|
1924
|
-
* Creates a
|
|
1928
|
+
* Creates a tracing client to manage tracing spans.
|
|
1925
1929
|
* @internal
|
|
1926
1930
|
*/
|
|
1927
|
-
const
|
|
1928
|
-
packagePrefix: "DigitalTwinsClient",
|
|
1931
|
+
const tracingClient = coreTracing.createTracingClient({
|
|
1929
1932
|
namespace: "Microsoft.DigitalTwins",
|
|
1933
|
+
packageName: "@azure/digital-twins-core",
|
|
1934
|
+
packageVersion: SDK_VERSION,
|
|
1930
1935
|
});
|
|
1931
1936
|
|
|
1932
1937
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -1936,7 +1941,6 @@ const createSpan = coreTracing.createSpanFunction({
|
|
|
1936
1941
|
const logger = logger$1.createClientLogger("azure-digitaltwins-core");
|
|
1937
1942
|
|
|
1938
1943
|
// Copyright (c) Microsoft Corporation.
|
|
1939
|
-
const SDK_VERSION = "1.1.0";
|
|
1940
1944
|
const DEFAULT_DIGITALTWINS_SCOPE = "https://digitaltwins.azure.net/.default";
|
|
1941
1945
|
/**
|
|
1942
1946
|
* Client for Azure IoT DigitalTwins API.
|
|
@@ -1992,20 +1996,9 @@ class DigitalTwinsClient {
|
|
|
1992
1996
|
* @returns The application/json digital twin and the http response.
|
|
1993
1997
|
*/
|
|
1994
1998
|
getDigitalTwin(digitalTwinId, options = {}) {
|
|
1995
|
-
|
|
1996
|
-
try {
|
|
1999
|
+
return tracingClient.withSpan("DigitalTwinsClient.getDigitalTwin", options, async (updatedOptions) => {
|
|
1997
2000
|
return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);
|
|
1998
|
-
}
|
|
1999
|
-
catch (e) {
|
|
2000
|
-
span.setStatus({
|
|
2001
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2002
|
-
message: e.message,
|
|
2003
|
-
});
|
|
2004
|
-
throw e;
|
|
2005
|
-
}
|
|
2006
|
-
finally {
|
|
2007
|
-
span.end();
|
|
2008
|
-
}
|
|
2001
|
+
});
|
|
2009
2002
|
}
|
|
2010
2003
|
/**
|
|
2011
2004
|
* Create or update a digital twin
|
|
@@ -2017,21 +2010,10 @@ class DigitalTwinsClient {
|
|
|
2017
2010
|
* @returns The created application/json digital twin and the http response.
|
|
2018
2011
|
*/
|
|
2019
2012
|
upsertDigitalTwin(digitalTwinId, digitalTwinJson, options = {}) {
|
|
2020
|
-
|
|
2021
|
-
try {
|
|
2013
|
+
return tracingClient.withSpan("DigitalTwinsClient.upsertDigitalTwin", options, async (updatedOptions) => {
|
|
2022
2014
|
const payload = JSON.parse(digitalTwinJson);
|
|
2023
2015
|
return this.client.digitalTwins.add(digitalTwinId, payload, updatedOptions);
|
|
2024
|
-
}
|
|
2025
|
-
catch (e) {
|
|
2026
|
-
span.setStatus({
|
|
2027
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2028
|
-
message: e.message,
|
|
2029
|
-
});
|
|
2030
|
-
throw e;
|
|
2031
|
-
}
|
|
2032
|
-
finally {
|
|
2033
|
-
span.end();
|
|
2034
|
-
}
|
|
2016
|
+
});
|
|
2035
2017
|
}
|
|
2036
2018
|
/**
|
|
2037
2019
|
* Update a digital twin using a json patch.
|
|
@@ -2047,20 +2029,9 @@ class DigitalTwinsClient {
|
|
|
2047
2029
|
updateDigitalTwin(digitalTwinId,
|
|
2048
2030
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
|
|
2049
2031
|
jsonPatch, options = {}) {
|
|
2050
|
-
|
|
2051
|
-
try {
|
|
2032
|
+
return tracingClient.withSpan("DigitalTwinsClient.updateDigitalTwin", options, async (updatedOptions) => {
|
|
2052
2033
|
return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);
|
|
2053
|
-
}
|
|
2054
|
-
catch (e) {
|
|
2055
|
-
span.setStatus({
|
|
2056
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2057
|
-
message: e.message,
|
|
2058
|
-
});
|
|
2059
|
-
throw e;
|
|
2060
|
-
}
|
|
2061
|
-
finally {
|
|
2062
|
-
span.end();
|
|
2063
|
-
}
|
|
2034
|
+
});
|
|
2064
2035
|
}
|
|
2065
2036
|
/**
|
|
2066
2037
|
* Delete a digital twin
|
|
@@ -2071,20 +2042,9 @@ class DigitalTwinsClient {
|
|
|
2071
2042
|
* @returns The http response.
|
|
2072
2043
|
*/
|
|
2073
2044
|
deleteDigitalTwin(digitalTwinId, options = {}) {
|
|
2074
|
-
|
|
2075
|
-
try {
|
|
2045
|
+
return tracingClient.withSpan("DigitalTwinsClient.deleteDigitalTwin", options, async (updatedOptions) => {
|
|
2076
2046
|
return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);
|
|
2077
|
-
}
|
|
2078
|
-
catch (e) {
|
|
2079
|
-
span.setStatus({
|
|
2080
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2081
|
-
message: e.message,
|
|
2082
|
-
});
|
|
2083
|
-
throw e;
|
|
2084
|
-
}
|
|
2085
|
-
finally {
|
|
2086
|
-
span.end();
|
|
2087
|
-
}
|
|
2047
|
+
});
|
|
2088
2048
|
}
|
|
2089
2049
|
/**
|
|
2090
2050
|
* Get a component on a digital twin.
|
|
@@ -2095,20 +2055,9 @@ class DigitalTwinsClient {
|
|
|
2095
2055
|
* @returns Json string representation of the component corresponding to the provided componentName and the HTTP response.
|
|
2096
2056
|
*/
|
|
2097
2057
|
getComponent(digitalTwinId, componentName, options = {}) {
|
|
2098
|
-
|
|
2099
|
-
try {
|
|
2058
|
+
return tracingClient.withSpan("DigitalTwinsClient.getComponent", options, async (updatedOptions) => {
|
|
2100
2059
|
return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);
|
|
2101
|
-
}
|
|
2102
|
-
catch (e) {
|
|
2103
|
-
span.setStatus({
|
|
2104
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2105
|
-
message: e.message,
|
|
2106
|
-
});
|
|
2107
|
-
throw e;
|
|
2108
|
-
}
|
|
2109
|
-
finally {
|
|
2110
|
-
span.end();
|
|
2111
|
-
}
|
|
2060
|
+
});
|
|
2112
2061
|
}
|
|
2113
2062
|
/**
|
|
2114
2063
|
* Update properties of a component on a digital twin using a JSON patch.
|
|
@@ -2122,20 +2071,9 @@ class DigitalTwinsClient {
|
|
|
2122
2071
|
* @returns The http response.
|
|
2123
2072
|
*/
|
|
2124
2073
|
updateComponent(digitalTwinId, componentName, jsonPatch, options = {}) {
|
|
2125
|
-
|
|
2126
|
-
try {
|
|
2074
|
+
return tracingClient.withSpan("DigitalTwinsClient.updateComponent", options, async (updatedOptions) => {
|
|
2127
2075
|
return this.client.digitalTwins.updateComponent(digitalTwinId, componentName, jsonPatch, updatedOptions);
|
|
2128
|
-
}
|
|
2129
|
-
catch (e) {
|
|
2130
|
-
span.setStatus({
|
|
2131
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2132
|
-
message: e.message,
|
|
2133
|
-
});
|
|
2134
|
-
throw e;
|
|
2135
|
-
}
|
|
2136
|
-
finally {
|
|
2137
|
-
span.end();
|
|
2138
|
-
}
|
|
2076
|
+
});
|
|
2139
2077
|
}
|
|
2140
2078
|
/**
|
|
2141
2079
|
* Get a relationship on a digital twin.
|
|
@@ -2146,20 +2084,9 @@ class DigitalTwinsClient {
|
|
|
2146
2084
|
* @returns The pageable list of application/json relationships belonging to the specified digital twin and the http response.
|
|
2147
2085
|
*/
|
|
2148
2086
|
getRelationship(digitalTwinId, relationshipId, options = {}) {
|
|
2149
|
-
|
|
2150
|
-
try {
|
|
2087
|
+
return tracingClient.withSpan("DigitalTwinsClient.getRelationship", options, async (updatedOptions) => {
|
|
2151
2088
|
return this.client.digitalTwins.getRelationshipById(digitalTwinId, relationshipId, updatedOptions);
|
|
2152
|
-
}
|
|
2153
|
-
catch (e) {
|
|
2154
|
-
span.setStatus({
|
|
2155
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2156
|
-
message: e.message,
|
|
2157
|
-
});
|
|
2158
|
-
throw e;
|
|
2159
|
-
}
|
|
2160
|
-
finally {
|
|
2161
|
-
span.end();
|
|
2162
|
-
}
|
|
2089
|
+
});
|
|
2163
2090
|
}
|
|
2164
2091
|
/**
|
|
2165
2092
|
* Create or update a relationship on a digital twin.
|
|
@@ -2173,20 +2100,9 @@ class DigitalTwinsClient {
|
|
|
2173
2100
|
upsertRelationship(digitalTwinId, relationshipId,
|
|
2174
2101
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
|
|
2175
2102
|
relationship, options = {}) {
|
|
2176
|
-
|
|
2177
|
-
try {
|
|
2103
|
+
return tracingClient.withSpan("DigitalTwinsClient.upsertRelationship", options, async (updatedOptions) => {
|
|
2178
2104
|
return this.client.digitalTwins.addRelationship(digitalTwinId, relationshipId, relationship, updatedOptions);
|
|
2179
|
-
}
|
|
2180
|
-
catch (e) {
|
|
2181
|
-
span.setStatus({
|
|
2182
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2183
|
-
message: e.message,
|
|
2184
|
-
});
|
|
2185
|
-
throw e;
|
|
2186
|
-
}
|
|
2187
|
-
finally {
|
|
2188
|
-
span.end();
|
|
2189
|
-
}
|
|
2105
|
+
});
|
|
2190
2106
|
}
|
|
2191
2107
|
/**
|
|
2192
2108
|
* Updates the properties of a relationship on a digital twin using a JSON patch.
|
|
@@ -2198,20 +2114,9 @@ class DigitalTwinsClient {
|
|
|
2198
2114
|
* ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
|
|
2199
2115
|
*/
|
|
2200
2116
|
updateRelationship(digitalTwinId, relationshipId, jsonPatch, options = {}) {
|
|
2201
|
-
|
|
2202
|
-
try {
|
|
2117
|
+
return tracingClient.withSpan("DigitalTwinsClient.updateRelationship", options, async (updatedOptions) => {
|
|
2203
2118
|
return this.client.digitalTwins.updateRelationship(digitalTwinId, relationshipId, jsonPatch, updatedOptions);
|
|
2204
|
-
}
|
|
2205
|
-
catch (e) {
|
|
2206
|
-
span.setStatus({
|
|
2207
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2208
|
-
message: e.message,
|
|
2209
|
-
});
|
|
2210
|
-
throw e;
|
|
2211
|
-
}
|
|
2212
|
-
finally {
|
|
2213
|
-
span.end();
|
|
2214
|
-
}
|
|
2119
|
+
});
|
|
2215
2120
|
}
|
|
2216
2121
|
/**
|
|
2217
2122
|
* Delete a relationship on a digital twin.
|
|
@@ -2223,20 +2128,9 @@ class DigitalTwinsClient {
|
|
|
2223
2128
|
* @returns The http response.
|
|
2224
2129
|
*/
|
|
2225
2130
|
deleteRelationship(digitalTwinId, relationshipId, options = {}) {
|
|
2226
|
-
|
|
2227
|
-
try {
|
|
2131
|
+
return tracingClient.withSpan("DigitalTwinsClient.deleteRelationship", options, async (updatedOptions) => {
|
|
2228
2132
|
return this.client.digitalTwins.deleteRelationship(digitalTwinId, relationshipId, updatedOptions);
|
|
2229
|
-
}
|
|
2230
|
-
catch (e) {
|
|
2231
|
-
span.setStatus({
|
|
2232
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2233
|
-
message: e.message,
|
|
2234
|
-
});
|
|
2235
|
-
throw e;
|
|
2236
|
-
}
|
|
2237
|
-
finally {
|
|
2238
|
-
span.end();
|
|
2239
|
-
}
|
|
2133
|
+
});
|
|
2240
2134
|
}
|
|
2241
2135
|
/**
|
|
2242
2136
|
* Deals with the pagination of {@link listRelationships}.
|
|
@@ -2292,29 +2186,16 @@ class DigitalTwinsClient {
|
|
|
2292
2186
|
* @param digitalTwinId - The Id of the digital twin.
|
|
2293
2187
|
*/
|
|
2294
2188
|
listRelationships(digitalTwinId, options = {}) {
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
byPage: (settings = {}) => this.listRelationshipsPage(digitalTwinId, updatedOptions, settings),
|
|
2306
|
-
};
|
|
2307
|
-
}
|
|
2308
|
-
catch (e) {
|
|
2309
|
-
span.setStatus({
|
|
2310
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2311
|
-
message: e.message,
|
|
2312
|
-
});
|
|
2313
|
-
throw e;
|
|
2314
|
-
}
|
|
2315
|
-
finally {
|
|
2316
|
-
span.end();
|
|
2317
|
-
}
|
|
2189
|
+
const iter = this.listRelationshipsAll(digitalTwinId, options);
|
|
2190
|
+
return {
|
|
2191
|
+
next() {
|
|
2192
|
+
return iter.next();
|
|
2193
|
+
},
|
|
2194
|
+
[Symbol.asyncIterator]() {
|
|
2195
|
+
return this;
|
|
2196
|
+
},
|
|
2197
|
+
byPage: (settings = {}) => this.listRelationshipsPage(digitalTwinId, options, settings),
|
|
2198
|
+
};
|
|
2318
2199
|
}
|
|
2319
2200
|
/**
|
|
2320
2201
|
* Deals with the pagination of {@link listIncomingRelationships}.
|
|
@@ -2369,29 +2250,16 @@ class DigitalTwinsClient {
|
|
|
2369
2250
|
* @param digitalTwinId - The Id of the digital twin.
|
|
2370
2251
|
*/
|
|
2371
2252
|
listIncomingRelationships(digitalTwinId, options = {}) {
|
|
2372
|
-
const
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
byPage: (settings = {}) => this.listIncomingRelationshipsPage(digitalTwinId, updatedOptions, settings),
|
|
2383
|
-
};
|
|
2384
|
-
}
|
|
2385
|
-
catch (e) {
|
|
2386
|
-
span.setStatus({
|
|
2387
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2388
|
-
message: e.message,
|
|
2389
|
-
});
|
|
2390
|
-
throw e;
|
|
2391
|
-
}
|
|
2392
|
-
finally {
|
|
2393
|
-
span.end();
|
|
2394
|
-
}
|
|
2253
|
+
const iter = this.listIncomingRelationshipsAll(digitalTwinId, options);
|
|
2254
|
+
return {
|
|
2255
|
+
next() {
|
|
2256
|
+
return iter.next();
|
|
2257
|
+
},
|
|
2258
|
+
[Symbol.asyncIterator]() {
|
|
2259
|
+
return this;
|
|
2260
|
+
},
|
|
2261
|
+
byPage: (settings = {}) => this.listIncomingRelationshipsPage(digitalTwinId, options, settings),
|
|
2262
|
+
};
|
|
2395
2263
|
}
|
|
2396
2264
|
/**
|
|
2397
2265
|
* Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.
|
|
@@ -2410,20 +2278,9 @@ class DigitalTwinsClient {
|
|
|
2410
2278
|
if (!messageId) {
|
|
2411
2279
|
messageId = coreHttp.generateUuid();
|
|
2412
2280
|
}
|
|
2413
|
-
|
|
2414
|
-
try {
|
|
2281
|
+
return tracingClient.withSpan("DigitalTwinsClient.publishTelemetry", digitalTwinsSendTelemetryOptionalParams, async (updatedOptions) => {
|
|
2415
2282
|
return this.client.digitalTwins.sendTelemetry(digitalTwinId, messageId, payload, updatedOptions);
|
|
2416
|
-
}
|
|
2417
|
-
catch (e) {
|
|
2418
|
-
span.setStatus({
|
|
2419
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2420
|
-
message: e.message,
|
|
2421
|
-
});
|
|
2422
|
-
throw e;
|
|
2423
|
-
}
|
|
2424
|
-
finally {
|
|
2425
|
-
span.end();
|
|
2426
|
-
}
|
|
2283
|
+
});
|
|
2427
2284
|
}
|
|
2428
2285
|
/**
|
|
2429
2286
|
* Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.
|
|
@@ -2441,20 +2298,9 @@ class DigitalTwinsClient {
|
|
|
2441
2298
|
if (!messageId) {
|
|
2442
2299
|
messageId = coreHttp.generateUuid();
|
|
2443
2300
|
}
|
|
2444
|
-
|
|
2445
|
-
try {
|
|
2301
|
+
return tracingClient.withSpan("DigitalTwinsClient.publishComponentTelemetry", digitalTwinsSendComponentTelemetryOptionalParams, async (updatedOptions) => {
|
|
2446
2302
|
return this.client.digitalTwins.sendComponentTelemetry(digitalTwinId, componentName, payload, messageId, updatedOptions);
|
|
2447
|
-
}
|
|
2448
|
-
catch (e) {
|
|
2449
|
-
span.setStatus({
|
|
2450
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2451
|
-
message: e.message,
|
|
2452
|
-
});
|
|
2453
|
-
throw e;
|
|
2454
|
-
}
|
|
2455
|
-
finally {
|
|
2456
|
-
span.end();
|
|
2457
|
-
}
|
|
2303
|
+
});
|
|
2458
2304
|
}
|
|
2459
2305
|
/**
|
|
2460
2306
|
* Get a model, including the model metadata and the model definition.
|
|
@@ -2467,20 +2313,9 @@ class DigitalTwinsClient {
|
|
|
2467
2313
|
getModel(modelId, includeModelDefinition = false, options = {}) {
|
|
2468
2314
|
const digitalTwinModelsGetByIdOptionalParams = options;
|
|
2469
2315
|
digitalTwinModelsGetByIdOptionalParams.includeModelDefinition = includeModelDefinition;
|
|
2470
|
-
|
|
2471
|
-
try {
|
|
2316
|
+
return tracingClient.withSpan("DigitalTwinsClient.getModel", digitalTwinModelsGetByIdOptionalParams, async (updatedOptions) => {
|
|
2472
2317
|
return this.client.digitalTwinModels.getById(modelId, updatedOptions);
|
|
2473
|
-
}
|
|
2474
|
-
catch (e) {
|
|
2475
|
-
span.setStatus({
|
|
2476
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2477
|
-
message: e.message,
|
|
2478
|
-
});
|
|
2479
|
-
throw e;
|
|
2480
|
-
}
|
|
2481
|
-
finally {
|
|
2482
|
-
span.end();
|
|
2483
|
-
}
|
|
2318
|
+
});
|
|
2484
2319
|
}
|
|
2485
2320
|
/**
|
|
2486
2321
|
* Deals with the pagination of {@link list}.
|
|
@@ -2546,29 +2381,16 @@ class DigitalTwinsClient {
|
|
|
2546
2381
|
dependenciesFor: dependeciesFor,
|
|
2547
2382
|
includeModelDefinition: includeModelDefinition,
|
|
2548
2383
|
};
|
|
2549
|
-
const
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
byPage: (settings = {}) => this.getModelsPage(digitalTwinModelsListOptionalParams, settings),
|
|
2560
|
-
};
|
|
2561
|
-
}
|
|
2562
|
-
catch (e) {
|
|
2563
|
-
span.setStatus({
|
|
2564
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2565
|
-
message: e.message,
|
|
2566
|
-
});
|
|
2567
|
-
throw e;
|
|
2568
|
-
}
|
|
2569
|
-
finally {
|
|
2570
|
-
span.end();
|
|
2571
|
-
}
|
|
2384
|
+
const iter = this.getModelsAll(digitalTwinModelsListOptionalParams);
|
|
2385
|
+
return {
|
|
2386
|
+
next() {
|
|
2387
|
+
return iter.next();
|
|
2388
|
+
},
|
|
2389
|
+
[Symbol.asyncIterator]() {
|
|
2390
|
+
return this;
|
|
2391
|
+
},
|
|
2392
|
+
byPage: (settings = {}) => this.getModelsPage(digitalTwinModelsListOptionalParams, settings),
|
|
2393
|
+
};
|
|
2572
2394
|
}
|
|
2573
2395
|
/**
|
|
2574
2396
|
* Create one or many
|
|
@@ -2580,20 +2402,9 @@ class DigitalTwinsClient {
|
|
|
2580
2402
|
createModels(dtdlModels, options = {}) {
|
|
2581
2403
|
const digitalTwinModelsAddOptionalParams = options;
|
|
2582
2404
|
digitalTwinModelsAddOptionalParams.models = dtdlModels;
|
|
2583
|
-
|
|
2584
|
-
try {
|
|
2405
|
+
return tracingClient.withSpan("DigitalTwinsClient.createModels", digitalTwinModelsAddOptionalParams, async (updatedOptions) => {
|
|
2585
2406
|
return this.client.digitalTwinModels.add(updatedOptions);
|
|
2586
|
-
}
|
|
2587
|
-
catch (e) {
|
|
2588
|
-
span.setStatus({
|
|
2589
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2590
|
-
message: e.message,
|
|
2591
|
-
});
|
|
2592
|
-
throw e;
|
|
2593
|
-
}
|
|
2594
|
-
finally {
|
|
2595
|
-
span.end();
|
|
2596
|
-
}
|
|
2407
|
+
});
|
|
2597
2408
|
}
|
|
2598
2409
|
/**
|
|
2599
2410
|
* Decommission a model using a json patch.
|
|
@@ -2609,20 +2420,9 @@ class DigitalTwinsClient {
|
|
|
2609
2420
|
*/
|
|
2610
2421
|
decommissionModel(modelId, options = {}) {
|
|
2611
2422
|
const jsonPatch = [{ op: "replace", path: "/decommissioned", value: true }];
|
|
2612
|
-
|
|
2613
|
-
try {
|
|
2423
|
+
return tracingClient.withSpan("DigitalTwinsClient.decommissionModel", options, async (updatedOptions) => {
|
|
2614
2424
|
return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);
|
|
2615
|
-
}
|
|
2616
|
-
catch (e) {
|
|
2617
|
-
span.setStatus({
|
|
2618
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2619
|
-
message: e.message,
|
|
2620
|
-
});
|
|
2621
|
-
throw e;
|
|
2622
|
-
}
|
|
2623
|
-
finally {
|
|
2624
|
-
span.end();
|
|
2625
|
-
}
|
|
2425
|
+
});
|
|
2626
2426
|
}
|
|
2627
2427
|
/**
|
|
2628
2428
|
* Delete a model.
|
|
@@ -2632,20 +2432,9 @@ class DigitalTwinsClient {
|
|
|
2632
2432
|
* @returns The http response.
|
|
2633
2433
|
*/
|
|
2634
2434
|
deleteModel(modelId, options = {}) {
|
|
2635
|
-
|
|
2636
|
-
try {
|
|
2435
|
+
return tracingClient.withSpan("DigitalTwinsClient.deleteModel", options, async (updatedOptions) => {
|
|
2637
2436
|
return this.client.digitalTwinModels.delete(modelId, updatedOptions);
|
|
2638
|
-
}
|
|
2639
|
-
catch (e) {
|
|
2640
|
-
span.setStatus({
|
|
2641
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2642
|
-
message: e.message,
|
|
2643
|
-
});
|
|
2644
|
-
throw e;
|
|
2645
|
-
}
|
|
2646
|
-
finally {
|
|
2647
|
-
span.end();
|
|
2648
|
-
}
|
|
2437
|
+
});
|
|
2649
2438
|
}
|
|
2650
2439
|
/**
|
|
2651
2440
|
* Get an event route.
|
|
@@ -2655,20 +2444,9 @@ class DigitalTwinsClient {
|
|
|
2655
2444
|
* @returns The application/json event route and the http response.
|
|
2656
2445
|
*/
|
|
2657
2446
|
getEventRoute(eventRouteId, options = {}) {
|
|
2658
|
-
|
|
2659
|
-
try {
|
|
2447
|
+
return tracingClient.withSpan("DigitalTwinsClient.getEventRoute", options, async (updatedOptions) => {
|
|
2660
2448
|
return this.client.eventRoutes.getById(eventRouteId, updatedOptions);
|
|
2661
|
-
}
|
|
2662
|
-
catch (e) {
|
|
2663
|
-
span.setStatus({
|
|
2664
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2665
|
-
message: e.message,
|
|
2666
|
-
});
|
|
2667
|
-
throw e;
|
|
2668
|
-
}
|
|
2669
|
-
finally {
|
|
2670
|
-
span.end();
|
|
2671
|
-
}
|
|
2449
|
+
});
|
|
2672
2450
|
}
|
|
2673
2451
|
/**
|
|
2674
2452
|
* Deals with the pagination of {@link list}.
|
|
@@ -2731,29 +2509,16 @@ class DigitalTwinsClient {
|
|
|
2731
2509
|
eventRoutesListOptionalParams = {
|
|
2732
2510
|
maxItemsPerPage: resultsPerPage,
|
|
2733
2511
|
};
|
|
2734
|
-
const
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
byPage: (settings = {}) => this.getEventRoutesPage(eventRoutesListOptionalParams, settings),
|
|
2745
|
-
};
|
|
2746
|
-
}
|
|
2747
|
-
catch (e) {
|
|
2748
|
-
span.setStatus({
|
|
2749
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2750
|
-
message: e.message,
|
|
2751
|
-
});
|
|
2752
|
-
throw e;
|
|
2753
|
-
}
|
|
2754
|
-
finally {
|
|
2755
|
-
span.end();
|
|
2756
|
-
}
|
|
2512
|
+
const iter = this.getEventRoutesAll(eventRoutesListOptionalParams);
|
|
2513
|
+
return {
|
|
2514
|
+
next() {
|
|
2515
|
+
return iter.next();
|
|
2516
|
+
},
|
|
2517
|
+
[Symbol.asyncIterator]() {
|
|
2518
|
+
return this;
|
|
2519
|
+
},
|
|
2520
|
+
byPage: (settings = {}) => this.getEventRoutesPage(eventRoutesListOptionalParams, settings),
|
|
2521
|
+
};
|
|
2757
2522
|
}
|
|
2758
2523
|
/**
|
|
2759
2524
|
* Create or update an event route.
|
|
@@ -2771,20 +2536,9 @@ class DigitalTwinsClient {
|
|
|
2771
2536
|
filter: filter,
|
|
2772
2537
|
};
|
|
2773
2538
|
eventRoutesAddOptionalParams.eventRoute = eventRoute;
|
|
2774
|
-
|
|
2775
|
-
try {
|
|
2539
|
+
return tracingClient.withSpan("DigitalTwinsClient.upsertEventRoute", eventRoutesAddOptionalParams, async (updatedOptions) => {
|
|
2776
2540
|
return this.client.eventRoutes.add(eventRouteId, updatedOptions);
|
|
2777
|
-
}
|
|
2778
|
-
catch (e) {
|
|
2779
|
-
span.setStatus({
|
|
2780
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2781
|
-
message: e.message,
|
|
2782
|
-
});
|
|
2783
|
-
throw e;
|
|
2784
|
-
}
|
|
2785
|
-
finally {
|
|
2786
|
-
span.end();
|
|
2787
|
-
}
|
|
2541
|
+
});
|
|
2788
2542
|
}
|
|
2789
2543
|
/**
|
|
2790
2544
|
* Delete an event route.
|
|
@@ -2794,20 +2548,9 @@ class DigitalTwinsClient {
|
|
|
2794
2548
|
* @returns The http response.
|
|
2795
2549
|
*/
|
|
2796
2550
|
deleteEventRoute(eventRouteId, options = {}) {
|
|
2797
|
-
|
|
2798
|
-
try {
|
|
2551
|
+
return tracingClient.withSpan("DigitalTwinsClient.deleteEventRoute", options, async (updatedOptions) => {
|
|
2799
2552
|
return this.client.eventRoutes.delete(eventRouteId, updatedOptions);
|
|
2800
|
-
}
|
|
2801
|
-
catch (e) {
|
|
2802
|
-
span.setStatus({
|
|
2803
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2804
|
-
message: e.message,
|
|
2805
|
-
});
|
|
2806
|
-
throw e;
|
|
2807
|
-
}
|
|
2808
|
-
finally {
|
|
2809
|
-
span.end();
|
|
2810
|
-
}
|
|
2553
|
+
});
|
|
2811
2554
|
}
|
|
2812
2555
|
/**
|
|
2813
2556
|
* Deals with the pagination of {@link query}.
|
|
@@ -2879,29 +2622,16 @@ class DigitalTwinsClient {
|
|
|
2879
2622
|
queryQueryTwinsOptionalParams = {
|
|
2880
2623
|
maxItemsPerPage: resultsPerPage,
|
|
2881
2624
|
};
|
|
2882
|
-
const
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
byPage: (settings = {}) => this.queryTwinsPage(query, queryQueryTwinsOptionalParams, settings),
|
|
2893
|
-
};
|
|
2894
|
-
}
|
|
2895
|
-
catch (e) {
|
|
2896
|
-
span.setStatus({
|
|
2897
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
2898
|
-
message: e.message,
|
|
2899
|
-
});
|
|
2900
|
-
throw e;
|
|
2901
|
-
}
|
|
2902
|
-
finally {
|
|
2903
|
-
span.end();
|
|
2904
|
-
}
|
|
2625
|
+
const iter = this.queryTwinsAll(query, queryQueryTwinsOptionalParams);
|
|
2626
|
+
return {
|
|
2627
|
+
next() {
|
|
2628
|
+
return iter.next();
|
|
2629
|
+
},
|
|
2630
|
+
[Symbol.asyncIterator]() {
|
|
2631
|
+
return this;
|
|
2632
|
+
},
|
|
2633
|
+
byPage: (settings = {}) => this.queryTwinsPage(query, queryQueryTwinsOptionalParams, settings),
|
|
2634
|
+
};
|
|
2905
2635
|
}
|
|
2906
2636
|
}
|
|
2907
2637
|
|