@azure/digital-twins-core 2.0.0-alpha.20231207.1 → 2.0.0-alpha.20240112.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 +146 -208
- package/dist/index.js.map +1 -1
- package/dist-esm/src/digitalTwinsClient.js +50 -47
- package/dist-esm/src/digitalTwinsClient.js.map +1 -1
- package/dist-esm/src/generated/azureDigitalTwinsAPI.js +7 -3
- package/dist-esm/src/generated/azureDigitalTwinsAPI.js.map +1 -1
- package/dist-esm/src/generated/operations/digitalTwinModels.js +22 -40
- package/dist-esm/src/generated/operations/digitalTwinModels.js.map +1 -1
- package/dist-esm/src/generated/operations/digitalTwins.js +44 -79
- package/dist-esm/src/generated/operations/digitalTwins.js.map +1 -1
- package/dist-esm/src/generated/operations/eventRoutes.js +22 -40
- package/dist-esm/src/generated/operations/eventRoutes.js.map +1 -1
- package/dist-esm/src/generated/pagingHelper.js +2 -4
- package/dist-esm/src/generated/pagingHelper.js.map +1 -1
- package/package.json +3 -4
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib = require('tslib');
|
|
6
5
|
var uuid = require('uuid');
|
|
7
6
|
var coreClient = require('@azure/core-client');
|
|
8
7
|
var coreTracing = require('@azure/core-tracing');
|
|
@@ -36,11 +35,10 @@ var coreClient__namespace = /*#__PURE__*/_interopNamespaceDefault(coreClient);
|
|
|
36
35
|
*/
|
|
37
36
|
const pageMap = new WeakMap();
|
|
38
37
|
function setContinuationToken(page, continuationToken) {
|
|
39
|
-
var _a;
|
|
40
38
|
if (typeof page !== "object" || page === null || !continuationToken) {
|
|
41
39
|
return;
|
|
42
40
|
}
|
|
43
|
-
const pageInfo =
|
|
41
|
+
const pageInfo = pageMap.get(page) ?? {};
|
|
44
42
|
pageInfo.continuationToken = continuationToken;
|
|
45
43
|
pageMap.set(page, pageInfo);
|
|
46
44
|
}
|
|
@@ -856,52 +854,35 @@ class DigitalTwinModelsImpl {
|
|
|
856
854
|
return this;
|
|
857
855
|
},
|
|
858
856
|
byPage: (settings) => {
|
|
859
|
-
if (settings
|
|
857
|
+
if (settings?.maxPageSize) {
|
|
860
858
|
throw new Error("maxPageSize is not supported by this operation.");
|
|
861
859
|
}
|
|
862
860
|
return this.listPagingPage(options, settings);
|
|
863
861
|
}
|
|
864
862
|
};
|
|
865
863
|
}
|
|
866
|
-
listPagingPage(options, settings) {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
}
|
|
884
|
-
});
|
|
864
|
+
async *listPagingPage(options, settings) {
|
|
865
|
+
let result;
|
|
866
|
+
let continuationToken = settings?.continuationToken;
|
|
867
|
+
if (!continuationToken) {
|
|
868
|
+
result = await this._list(options);
|
|
869
|
+
let page = result.value || [];
|
|
870
|
+
continuationToken = result.nextLink;
|
|
871
|
+
setContinuationToken(page, continuationToken);
|
|
872
|
+
yield page;
|
|
873
|
+
}
|
|
874
|
+
while (continuationToken) {
|
|
875
|
+
result = await this._listNext(continuationToken, options);
|
|
876
|
+
continuationToken = result.nextLink;
|
|
877
|
+
let page = result.value || [];
|
|
878
|
+
setContinuationToken(page, continuationToken);
|
|
879
|
+
yield page;
|
|
880
|
+
}
|
|
885
881
|
}
|
|
886
|
-
listPagingAll(options) {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
for (var _d = true, _e = tslib.__asyncValues(this.listPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
891
|
-
_c = _f.value;
|
|
892
|
-
_d = false;
|
|
893
|
-
const page = _c;
|
|
894
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
898
|
-
finally {
|
|
899
|
-
try {
|
|
900
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
901
|
-
}
|
|
902
|
-
finally { if (e_1) throw e_1.error; }
|
|
903
|
-
}
|
|
904
|
-
});
|
|
882
|
+
async *listPagingAll(options) {
|
|
883
|
+
for await (const page of this.listPagingPage(options)) {
|
|
884
|
+
yield* page;
|
|
885
|
+
}
|
|
905
886
|
}
|
|
906
887
|
/**
|
|
907
888
|
* Uploads one or more models. When any error occurs, no models are uploaded.
|
|
@@ -1201,52 +1182,35 @@ class DigitalTwinsImpl {
|
|
|
1201
1182
|
return this;
|
|
1202
1183
|
},
|
|
1203
1184
|
byPage: (settings) => {
|
|
1204
|
-
if (settings
|
|
1185
|
+
if (settings?.maxPageSize) {
|
|
1205
1186
|
throw new Error("maxPageSize is not supported by this operation.");
|
|
1206
1187
|
}
|
|
1207
1188
|
return this.listRelationshipsPagingPage(id, options, settings);
|
|
1208
1189
|
}
|
|
1209
1190
|
};
|
|
1210
1191
|
}
|
|
1211
|
-
listRelationshipsPagingPage(id, options, settings) {
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
}
|
|
1229
|
-
});
|
|
1192
|
+
async *listRelationshipsPagingPage(id, options, settings) {
|
|
1193
|
+
let result;
|
|
1194
|
+
let continuationToken = settings?.continuationToken;
|
|
1195
|
+
if (!continuationToken) {
|
|
1196
|
+
result = await this._listRelationships(id, options);
|
|
1197
|
+
let page = result.value || [];
|
|
1198
|
+
continuationToken = result.nextLink;
|
|
1199
|
+
setContinuationToken(page, continuationToken);
|
|
1200
|
+
yield page;
|
|
1201
|
+
}
|
|
1202
|
+
while (continuationToken) {
|
|
1203
|
+
result = await this._listRelationshipsNext(id, continuationToken, options);
|
|
1204
|
+
continuationToken = result.nextLink;
|
|
1205
|
+
let page = result.value || [];
|
|
1206
|
+
setContinuationToken(page, continuationToken);
|
|
1207
|
+
yield page;
|
|
1208
|
+
}
|
|
1230
1209
|
}
|
|
1231
|
-
listRelationshipsPagingAll(id, options) {
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
for (var _d = true, _e = tslib.__asyncValues(this.listRelationshipsPagingPage(id, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
1236
|
-
_c = _f.value;
|
|
1237
|
-
_d = false;
|
|
1238
|
-
const page = _c;
|
|
1239
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1243
|
-
finally {
|
|
1244
|
-
try {
|
|
1245
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
1246
|
-
}
|
|
1247
|
-
finally { if (e_1) throw e_1.error; }
|
|
1248
|
-
}
|
|
1249
|
-
});
|
|
1210
|
+
async *listRelationshipsPagingAll(id, options) {
|
|
1211
|
+
for await (const page of this.listRelationshipsPagingPage(id, options)) {
|
|
1212
|
+
yield* page;
|
|
1213
|
+
}
|
|
1250
1214
|
}
|
|
1251
1215
|
/**
|
|
1252
1216
|
* Retrieves all incoming relationship for a digital twin.
|
|
@@ -1269,52 +1233,35 @@ class DigitalTwinsImpl {
|
|
|
1269
1233
|
return this;
|
|
1270
1234
|
},
|
|
1271
1235
|
byPage: (settings) => {
|
|
1272
|
-
if (settings
|
|
1236
|
+
if (settings?.maxPageSize) {
|
|
1273
1237
|
throw new Error("maxPageSize is not supported by this operation.");
|
|
1274
1238
|
}
|
|
1275
1239
|
return this.listIncomingRelationshipsPagingPage(id, options, settings);
|
|
1276
1240
|
}
|
|
1277
1241
|
};
|
|
1278
1242
|
}
|
|
1279
|
-
listIncomingRelationshipsPagingPage(id, options, settings) {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
}
|
|
1297
|
-
});
|
|
1243
|
+
async *listIncomingRelationshipsPagingPage(id, options, settings) {
|
|
1244
|
+
let result;
|
|
1245
|
+
let continuationToken = settings?.continuationToken;
|
|
1246
|
+
if (!continuationToken) {
|
|
1247
|
+
result = await this._listIncomingRelationships(id, options);
|
|
1248
|
+
let page = result.value || [];
|
|
1249
|
+
continuationToken = result.nextLink;
|
|
1250
|
+
setContinuationToken(page, continuationToken);
|
|
1251
|
+
yield page;
|
|
1252
|
+
}
|
|
1253
|
+
while (continuationToken) {
|
|
1254
|
+
result = await this._listIncomingRelationshipsNext(id, continuationToken, options);
|
|
1255
|
+
continuationToken = result.nextLink;
|
|
1256
|
+
let page = result.value || [];
|
|
1257
|
+
setContinuationToken(page, continuationToken);
|
|
1258
|
+
yield page;
|
|
1259
|
+
}
|
|
1298
1260
|
}
|
|
1299
|
-
listIncomingRelationshipsPagingAll(id, options) {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
for (var _d = true, _e = tslib.__asyncValues(this.listIncomingRelationshipsPagingPage(id, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
1304
|
-
_c = _f.value;
|
|
1305
|
-
_d = false;
|
|
1306
|
-
const page = _c;
|
|
1307
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1311
|
-
finally {
|
|
1312
|
-
try {
|
|
1313
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
1314
|
-
}
|
|
1315
|
-
finally { if (e_2) throw e_2.error; }
|
|
1316
|
-
}
|
|
1317
|
-
});
|
|
1261
|
+
async *listIncomingRelationshipsPagingAll(id, options) {
|
|
1262
|
+
for await (const page of this.listIncomingRelationshipsPagingPage(id, options)) {
|
|
1263
|
+
yield* page;
|
|
1264
|
+
}
|
|
1318
1265
|
}
|
|
1319
1266
|
/**
|
|
1320
1267
|
* Retrieves a digital twin.
|
|
@@ -1936,52 +1883,35 @@ class EventRoutesImpl {
|
|
|
1936
1883
|
return this;
|
|
1937
1884
|
},
|
|
1938
1885
|
byPage: (settings) => {
|
|
1939
|
-
if (settings
|
|
1886
|
+
if (settings?.maxPageSize) {
|
|
1940
1887
|
throw new Error("maxPageSize is not supported by this operation.");
|
|
1941
1888
|
}
|
|
1942
1889
|
return this.listPagingPage(options, settings);
|
|
1943
1890
|
}
|
|
1944
1891
|
};
|
|
1945
1892
|
}
|
|
1946
|
-
listPagingPage(options, settings) {
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
}
|
|
1964
|
-
});
|
|
1893
|
+
async *listPagingPage(options, settings) {
|
|
1894
|
+
let result;
|
|
1895
|
+
let continuationToken = settings?.continuationToken;
|
|
1896
|
+
if (!continuationToken) {
|
|
1897
|
+
result = await this._list(options);
|
|
1898
|
+
let page = result.value || [];
|
|
1899
|
+
continuationToken = result.nextLink;
|
|
1900
|
+
setContinuationToken(page, continuationToken);
|
|
1901
|
+
yield page;
|
|
1902
|
+
}
|
|
1903
|
+
while (continuationToken) {
|
|
1904
|
+
result = await this._listNext(continuationToken, options);
|
|
1905
|
+
continuationToken = result.nextLink;
|
|
1906
|
+
let page = result.value || [];
|
|
1907
|
+
setContinuationToken(page, continuationToken);
|
|
1908
|
+
yield page;
|
|
1909
|
+
}
|
|
1965
1910
|
}
|
|
1966
|
-
listPagingAll(options) {
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
for (var _d = true, _e = tslib.__asyncValues(this.listPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
1971
|
-
_c = _f.value;
|
|
1972
|
-
_d = false;
|
|
1973
|
-
const page = _c;
|
|
1974
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1978
|
-
finally {
|
|
1979
|
-
try {
|
|
1980
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
1981
|
-
}
|
|
1982
|
-
finally { if (e_1) throw e_1.error; }
|
|
1983
|
-
}
|
|
1984
|
-
});
|
|
1911
|
+
async *listPagingAll(options) {
|
|
1912
|
+
for await (const page of this.listPagingPage(options)) {
|
|
1913
|
+
yield* page;
|
|
1914
|
+
}
|
|
1985
1915
|
}
|
|
1986
1916
|
/**
|
|
1987
1917
|
* Retrieves all event routes.
|
|
@@ -2133,7 +2063,6 @@ class AzureDigitalTwinsAPI extends coreClient__namespace.ServiceClient {
|
|
|
2133
2063
|
* @param options The parameter options
|
|
2134
2064
|
*/
|
|
2135
2065
|
constructor(options) {
|
|
2136
|
-
var _a, _b;
|
|
2137
2066
|
// Initializing default values for options
|
|
2138
2067
|
if (!options) {
|
|
2139
2068
|
options = {};
|
|
@@ -2145,9 +2074,14 @@ class AzureDigitalTwinsAPI extends coreClient__namespace.ServiceClient {
|
|
|
2145
2074
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
2146
2075
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
2147
2076
|
: `${packageDetails}`;
|
|
2148
|
-
const optionsWithDefaults =
|
|
2077
|
+
const optionsWithDefaults = {
|
|
2078
|
+
...defaults,
|
|
2079
|
+
...options,
|
|
2080
|
+
userAgentOptions: {
|
|
2149
2081
|
userAgentPrefix
|
|
2150
|
-
},
|
|
2082
|
+
},
|
|
2083
|
+
endpoint: options.endpoint ?? options.baseUri ?? "https://digitaltwins-hostname"
|
|
2084
|
+
};
|
|
2151
2085
|
super(optionsWithDefaults);
|
|
2152
2086
|
// Assigning values to Constant parameters
|
|
2153
2087
|
this.$host = options.$host || "https://digitaltwins-hostname";
|
|
@@ -2232,11 +2166,19 @@ class DigitalTwinsClient {
|
|
|
2232
2166
|
* @param options - Used to configure the service client.
|
|
2233
2167
|
*/
|
|
2234
2168
|
constructor(endpointUrl, credential, options = {}) {
|
|
2235
|
-
const internalPipelineOptions =
|
|
2169
|
+
const internalPipelineOptions = {
|
|
2170
|
+
...options,
|
|
2171
|
+
loggingOptions: {
|
|
2236
2172
|
logger: logger.info,
|
|
2237
2173
|
additionalAllowedHeaderNames: ["x-ms-request-id"],
|
|
2238
|
-
}
|
|
2239
|
-
|
|
2174
|
+
},
|
|
2175
|
+
};
|
|
2176
|
+
this.client = new AzureDigitalTwinsAPI({
|
|
2177
|
+
endpoint: endpointUrl,
|
|
2178
|
+
credential,
|
|
2179
|
+
credentialScopes: DEFAULT_DIGITALTWINS_SCOPE,
|
|
2180
|
+
...internalPipelineOptions,
|
|
2181
|
+
});
|
|
2240
2182
|
}
|
|
2241
2183
|
/**
|
|
2242
2184
|
* Get a digital twin
|
|
@@ -2405,7 +2347,10 @@ class DigitalTwinsClient {
|
|
|
2405
2347
|
*/
|
|
2406
2348
|
publishTelemetry(digitalTwinId, payload, messageId, options = {}) {
|
|
2407
2349
|
return tracingClient.withSpan("DigitalTwinsClient.publishTelemetry", options, async (updatedOptions) => {
|
|
2408
|
-
return this.client.digitalTwins.sendTelemetry(digitalTwinId, messageId || uuid.v4(), payload,
|
|
2350
|
+
return this.client.digitalTwins.sendTelemetry(digitalTwinId, messageId || uuid.v4(), payload, {
|
|
2351
|
+
...updatedOptions,
|
|
2352
|
+
telemetrySourceTime: new Date().toISOString(),
|
|
2353
|
+
});
|
|
2409
2354
|
});
|
|
2410
2355
|
}
|
|
2411
2356
|
/**
|
|
@@ -2420,7 +2365,7 @@ class DigitalTwinsClient {
|
|
|
2420
2365
|
*/
|
|
2421
2366
|
publishComponentTelemetry(digitalTwinId, componentName, payload, messageId, options = {}) {
|
|
2422
2367
|
return tracingClient.withSpan("DigitalTwinsClient.publishComponentTelemetry", options, async (updatedOptions) => {
|
|
2423
|
-
return this.client.digitalTwins.sendComponentTelemetry(digitalTwinId, componentName, messageId || uuid.v4(), payload,
|
|
2368
|
+
return this.client.digitalTwins.sendComponentTelemetry(digitalTwinId, componentName, messageId || uuid.v4(), payload, { ...updatedOptions, telemetrySourceTime: new Date().toISOString() });
|
|
2424
2369
|
});
|
|
2425
2370
|
}
|
|
2426
2371
|
/**
|
|
@@ -2431,8 +2376,10 @@ class DigitalTwinsClient {
|
|
|
2431
2376
|
* @returns The application/json model.
|
|
2432
2377
|
*/
|
|
2433
2378
|
getModel(modelId, options = {}) {
|
|
2434
|
-
|
|
2435
|
-
|
|
2379
|
+
return tracingClient.withSpan("DigitalTwinsClient.getModel", {
|
|
2380
|
+
...options,
|
|
2381
|
+
includeModelDefinition: options?.includeModelDefinition ?? false,
|
|
2382
|
+
}, async (updatedOptions) => {
|
|
2436
2383
|
return this.client.digitalTwinModels.getById(modelId, updatedOptions);
|
|
2437
2384
|
});
|
|
2438
2385
|
}
|
|
@@ -2443,8 +2390,10 @@ class DigitalTwinsClient {
|
|
|
2443
2390
|
* @returns A pageable set of application/json models.
|
|
2444
2391
|
*/
|
|
2445
2392
|
listModels(options = {}) {
|
|
2446
|
-
|
|
2447
|
-
|
|
2393
|
+
return this.client.digitalTwinModels.list({
|
|
2394
|
+
...options,
|
|
2395
|
+
includeModelDefinition: options?.includeModelDefinition ?? false,
|
|
2396
|
+
});
|
|
2448
2397
|
}
|
|
2449
2398
|
/**
|
|
2450
2399
|
* Create one or many
|
|
@@ -2454,7 +2403,10 @@ class DigitalTwinsClient {
|
|
|
2454
2403
|
* @returns The created application/json models.
|
|
2455
2404
|
*/
|
|
2456
2405
|
createModels(dtdlModels, options = {}) {
|
|
2457
|
-
return tracingClient.withSpan("DigitalTwinsClient.createModels",
|
|
2406
|
+
return tracingClient.withSpan("DigitalTwinsClient.createModels", {
|
|
2407
|
+
...options,
|
|
2408
|
+
models: dtdlModels,
|
|
2409
|
+
}, async (updatedOptions) => {
|
|
2458
2410
|
return this.client.digitalTwinModels.add(updatedOptions);
|
|
2459
2411
|
});
|
|
2460
2412
|
}
|
|
@@ -2519,10 +2471,13 @@ class DigitalTwinsClient {
|
|
|
2519
2471
|
|
|
2520
2472
|
*/
|
|
2521
2473
|
upsertEventRoute(eventRouteId, endpointId, filter, options = {}) {
|
|
2522
|
-
return tracingClient.withSpan("DigitalTwinsClient.upsertEventRoute",
|
|
2474
|
+
return tracingClient.withSpan("DigitalTwinsClient.upsertEventRoute", {
|
|
2475
|
+
eventRoute: {
|
|
2523
2476
|
endpointName: endpointId,
|
|
2524
2477
|
filter,
|
|
2525
|
-
}
|
|
2478
|
+
},
|
|
2479
|
+
...options,
|
|
2480
|
+
}, async (updatedOptions) => {
|
|
2526
2481
|
return this.client.eventRoutes.add(eventRouteId, updatedOptions);
|
|
2527
2482
|
});
|
|
2528
2483
|
}
|
|
@@ -2546,47 +2501,30 @@ class DigitalTwinsClient {
|
|
|
2546
2501
|
* @param continuationState - An object that indicates the position of the paginated request.
|
|
2547
2502
|
*
|
|
2548
2503
|
*/
|
|
2549
|
-
queryTwinsPage(query, options, continuationState) {
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
}
|
|
2562
|
-
});
|
|
2504
|
+
async *queryTwinsPage(query, options, continuationState) {
|
|
2505
|
+
let { continuationToken } = continuationState ?? {};
|
|
2506
|
+
if (!continuationToken) {
|
|
2507
|
+
const queryResult = await this.client.query.queryTwins({ query }, options);
|
|
2508
|
+
continuationToken = queryResult.continuationToken;
|
|
2509
|
+
yield queryResult;
|
|
2510
|
+
}
|
|
2511
|
+
while (continuationToken) {
|
|
2512
|
+
const queryResult = await this.client.query.queryTwins({ query, continuationToken }, options);
|
|
2513
|
+
continuationToken = queryResult.continuationToken;
|
|
2514
|
+
yield queryResult;
|
|
2515
|
+
}
|
|
2563
2516
|
}
|
|
2564
2517
|
/**
|
|
2565
2518
|
* Deals with the iteration of all the available results of {@link query}.
|
|
2566
2519
|
* @param query - The query string, in SQL-like syntax.
|
|
2567
2520
|
* @param options - Common options for the iterative endpoints.
|
|
2568
2521
|
*/
|
|
2569
|
-
queryTwinsAll(query, options) {
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
for (var _d = true, _e = tslib.__asyncValues(this.queryTwinsPage(query, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
2574
|
-
_c = _f.value;
|
|
2575
|
-
_d = false;
|
|
2576
|
-
const page = _c;
|
|
2577
|
-
if (page.value) {
|
|
2578
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page.value)));
|
|
2579
|
-
}
|
|
2580
|
-
}
|
|
2522
|
+
async *queryTwinsAll(query, options) {
|
|
2523
|
+
for await (const page of this.queryTwinsPage(query, options)) {
|
|
2524
|
+
if (page.value) {
|
|
2525
|
+
yield* page.value;
|
|
2581
2526
|
}
|
|
2582
|
-
|
|
2583
|
-
finally {
|
|
2584
|
-
try {
|
|
2585
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
2586
|
-
}
|
|
2587
|
-
finally { if (e_1) throw e_1.error; }
|
|
2588
|
-
}
|
|
2589
|
-
});
|
|
2527
|
+
}
|
|
2590
2528
|
}
|
|
2591
2529
|
/**
|
|
2592
2530
|
* Query for digital twins.
|