@azure/digital-twins-core 1.1.1-alpha.20221017.1 → 2.0.0-alpha.20230111.2

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.
Files changed (42) hide show
  1. package/README.md +7 -7
  2. package/dist/index.js +575 -610
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/constants.js +1 -1
  5. package/dist-esm/src/constants.js.map +1 -1
  6. package/dist-esm/src/digitalTwinsClient.js +69 -364
  7. package/dist-esm/src/digitalTwinsClient.js.map +1 -1
  8. package/dist-esm/src/generated/azureDigitalTwinsAPI.js +52 -13
  9. package/dist-esm/src/generated/azureDigitalTwinsAPI.js.map +1 -1
  10. package/dist-esm/src/generated/index.js +13 -0
  11. package/dist-esm/src/generated/index.js.map +1 -0
  12. package/dist-esm/src/generated/models/index.js.map +1 -1
  13. package/dist-esm/src/generated/models/mappers.js +35 -7
  14. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  15. package/dist-esm/src/generated/models/parameters.js +45 -30
  16. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  17. package/dist-esm/src/generated/operations/digitalTwinModels.js +87 -47
  18. package/dist-esm/src/generated/operations/digitalTwinModels.js.map +1 -1
  19. package/dist-esm/src/generated/operations/digitalTwins.js +190 -80
  20. package/dist-esm/src/generated/operations/digitalTwins.js.map +1 -1
  21. package/dist-esm/src/generated/operations/eventRoutes.js +79 -35
  22. package/dist-esm/src/generated/operations/eventRoutes.js.map +1 -1
  23. package/dist-esm/src/generated/operations/query.js +10 -12
  24. package/dist-esm/src/generated/operations/query.js.map +1 -1
  25. package/dist-esm/src/generated/operationsInterfaces/digitalTwinModels.js +9 -0
  26. package/dist-esm/src/generated/operationsInterfaces/digitalTwinModels.js.map +1 -0
  27. package/dist-esm/src/generated/operationsInterfaces/digitalTwins.js +9 -0
  28. package/dist-esm/src/generated/operationsInterfaces/digitalTwins.js.map +1 -0
  29. package/dist-esm/src/generated/operationsInterfaces/eventRoutes.js +9 -0
  30. package/dist-esm/src/generated/operationsInterfaces/eventRoutes.js.map +1 -0
  31. package/dist-esm/src/generated/operationsInterfaces/index.js +12 -0
  32. package/dist-esm/src/generated/operationsInterfaces/index.js.map +1 -0
  33. package/dist-esm/src/generated/operationsInterfaces/query.js +9 -0
  34. package/dist-esm/src/generated/operationsInterfaces/query.js.map +1 -0
  35. package/dist-esm/src/generated/pagingHelper.js +32 -0
  36. package/dist-esm/src/generated/pagingHelper.js.map +1 -0
  37. package/dist-esm/src/index.js +1 -1
  38. package/dist-esm/src/index.js.map +1 -1
  39. package/package.json +13 -11
  40. package/types/digital-twins-core.d.ts +196 -693
  41. package/dist-esm/src/generated/azureDigitalTwinsAPIContext.js +0 -35
  42. package/dist-esm/src/generated/azureDigitalTwinsAPIContext.js.map +0 -1
@@ -1,4 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- export const SDK_VERSION = "1.1.1";
3
+ export const SDK_VERSION = "2.0.0";
4
4
  //# sourceMappingURL=constants.js.map
@@ -1 +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.1\";\n"]}
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 = \"2.0.0\";\n"]}
@@ -1,12 +1,10 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __rest } from "tslib";
4
- /// <reference lib="esnext.asynciterable" />
5
- import { bearerTokenAuthenticationPolicy, createPipelineFromOptions, generateUuid, } from "@azure/core-http";
3
+ import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
4
+ import { v4 as generateUuid } from "uuid";
6
5
  import { AzureDigitalTwinsAPI as GeneratedClient } from "./generated/azureDigitalTwinsAPI";
7
6
  import { tracingClient } from "./tracing";
8
7
  import { logger } from "./logger";
9
- export const SDK_VERSION = "1.1.0";
10
8
  const DEFAULT_DIGITALTWINS_SCOPE = "https://digitaltwins.azure.net/.default";
11
9
  /**
12
10
  * Client for Azure IoT DigitalTwins API.
@@ -29,33 +27,18 @@ export class DigitalTwinsClient {
29
27
  * @param options - Used to configure the service client.
30
28
  */
31
29
  constructor(endpointUrl, credential, options = {}) {
32
- const authPolicy = bearerTokenAuthenticationPolicy(credential, DEFAULT_DIGITALTWINS_SCOPE);
33
- const libInfo = `azsdk-js-digital-twins-core/${SDK_VERSION}`;
34
- const { apiVersion } = options, pipelineOptions = __rest(options, ["apiVersion"]);
35
- if (!pipelineOptions.userAgentOptions) {
36
- pipelineOptions.userAgentOptions = {};
37
- }
38
- if (pipelineOptions.userAgentOptions.userAgentPrefix) {
39
- pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`;
40
- }
41
- else {
42
- pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;
43
- }
44
- const internalPipelineOptions = Object.assign(Object.assign({}, pipelineOptions), {
45
- loggingOptions: {
30
+ const internalPipelineOptions = Object.assign(Object.assign({}, options), { loggingOptions: {
46
31
  logger: logger.info,
47
- allowedHeaderNames: ["x-ms-request-id"],
48
- },
49
- });
50
- const pipeline = createPipelineFromOptions(internalPipelineOptions, authPolicy);
51
- this.client = new GeneratedClient(Object.assign({ endpoint: endpointUrl, apiVersion }, pipeline));
32
+ additionalAllowedHeaderNames: ["x-ms-request-id"],
33
+ } });
34
+ this.client = new GeneratedClient(Object.assign({ endpoint: endpointUrl, credential, credentialScopes: DEFAULT_DIGITALTWINS_SCOPE }, internalPipelineOptions));
52
35
  }
53
36
  /**
54
37
  * Get a digital twin
55
38
  *
56
39
  * @param digitalTwinId - The Id of the digital twin.
57
40
  * @param options - The operation options
58
- * @returns The application/json digital twin and the http response.
41
+ * @returns The application/json digital twin.
59
42
  */
60
43
  getDigitalTwin(digitalTwinId, options = {}) {
61
44
  return tracingClient.withSpan("DigitalTwinsClient.getDigitalTwin", options, async (updatedOptions) => {
@@ -69,7 +52,7 @@ export class DigitalTwinsClient {
69
52
  * @param digitalTwinJson - The application/json digital twin to create.
70
53
  * @param options - Extended operation options including
71
54
  * ifNoneMatch: Only perform the operation if the entity does not already exist.
72
- * @returns The created application/json digital twin and the http response.
55
+ * @returns The created application/json digital twin.
73
56
  */
74
57
  upsertDigitalTwin(digitalTwinId, digitalTwinJson, options = {}) {
75
58
  return tracingClient.withSpan("DigitalTwinsClient.upsertDigitalTwin", options, async (updatedOptions) => {
@@ -86,11 +69,9 @@ export class DigitalTwinsClient {
86
69
  * remove.
87
70
  * @param options - Extended operation options including
88
71
  * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
89
- * @returns The http response.
72
+
90
73
  */
91
- updateDigitalTwin(digitalTwinId,
92
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
93
- jsonPatch, options = {}) {
74
+ updateDigitalTwin(digitalTwinId, jsonPatch, options = {}) {
94
75
  return tracingClient.withSpan("DigitalTwinsClient.updateDigitalTwin", options, async (updatedOptions) => {
95
76
  return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);
96
77
  });
@@ -101,7 +82,7 @@ export class DigitalTwinsClient {
101
82
  * @param digitalTwinId - The Id of the digital twin to delete.
102
83
  * @param options - Extended operation options including
103
84
  * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
104
- * @returns The http response.
85
+
105
86
  */
106
87
  deleteDigitalTwin(digitalTwinId, options = {}) {
107
88
  return tracingClient.withSpan("DigitalTwinsClient.deleteDigitalTwin", options, async (updatedOptions) => {
@@ -114,7 +95,7 @@ export class DigitalTwinsClient {
114
95
  * @param digitalTwinId - The Id of the digital twin.
115
96
  * @param componentName - The component being retrieved.
116
97
  * @param options - The operation options
117
- * @returns Json string representation of the component corresponding to the provided componentName and the HTTP response.
98
+ * @returns Json string representation of the component corresponding to the provided componentName.
118
99
  */
119
100
  getComponent(digitalTwinId, componentName, options = {}) {
120
101
  return tracingClient.withSpan("DigitalTwinsClient.getComponent", options, async (updatedOptions) => {
@@ -130,7 +111,7 @@ export class DigitalTwinsClient {
130
111
  * @param enableUpdate - If true then update of an existing digital twin is enabled.
131
112
  * @param options - Extended operation options including
132
113
  * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
133
- * @returns The http response.
114
+
134
115
  */
135
116
  updateComponent(digitalTwinId, componentName, jsonPatch, options = {}) {
136
117
  return tracingClient.withSpan("DigitalTwinsClient.updateComponent", options, async (updatedOptions) => {
@@ -143,7 +124,7 @@ export class DigitalTwinsClient {
143
124
  * @param digitalTwinId - The Id of the source digital twin.
144
125
  * @param relationshipId - The Id of the relationship to retrieve.
145
126
  * @param options - The operation options
146
- * @returns The pageable list of application/json relationships belonging to the specified digital twin and the http response.
127
+ * @returns The pageable list of application/json relationships belonging to the specified digital twin.
147
128
  */
148
129
  getRelationship(digitalTwinId, relationshipId, options = {}) {
149
130
  return tracingClient.withSpan("DigitalTwinsClient.getRelationship", options, async (updatedOptions) => {
@@ -159,9 +140,7 @@ export class DigitalTwinsClient {
159
140
  * @param options - Extended operation options including
160
141
  * ifNoneMatch: Only perform the operation if the entity does not already exist.
161
142
  */
162
- upsertRelationship(digitalTwinId, relationshipId,
163
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
164
- relationship, options = {}) {
143
+ upsertRelationship(digitalTwinId, relationshipId, relationship, options = {}) {
165
144
  return tracingClient.withSpan("DigitalTwinsClient.upsertRelationship", options, async (updatedOptions) => {
166
145
  return this.client.digitalTwins.addRelationship(digitalTwinId, relationshipId, relationship, updatedOptions);
167
146
  });
@@ -187,141 +166,28 @@ export class DigitalTwinsClient {
187
166
  * @param relationshipId - The Id of the relationship to delete.
188
167
  * @param options - The operation options
189
168
  * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is
190
- * @returns The http response.
169
+
191
170
  */
192
171
  deleteRelationship(digitalTwinId, relationshipId, options = {}) {
193
172
  return tracingClient.withSpan("DigitalTwinsClient.deleteRelationship", options, async (updatedOptions) => {
194
173
  return this.client.digitalTwins.deleteRelationship(digitalTwinId, relationshipId, updatedOptions);
195
174
  });
196
175
  }
197
- /**
198
- * Deals with the pagination of {@link listRelationships}.
199
- *
200
- * @param digitalTwinId - The Id of the digital twin.
201
- * @param options - Common options for the iterative endpoints.
202
- * @param continuationState - An object that indicates the position of the paginated request.
203
- *
204
- */
205
- listRelationshipsPage(digitalTwinId, options, continuationState) {
206
- return __asyncGenerator(this, arguments, function* listRelationshipsPage_1() {
207
- if (continuationState.continuationToken == null) {
208
- const optionsComplete = Object.assign({}, options);
209
- const listRelationshipResponse = yield __await(this.client.digitalTwins.listRelationships(digitalTwinId, optionsComplete));
210
- continuationState.continuationToken = listRelationshipResponse.nextLink;
211
- yield yield __await(listRelationshipResponse);
212
- }
213
- while (continuationState.continuationToken) {
214
- const listRelationshipResponse = yield __await(this.client.digitalTwins.listRelationshipsNext("", continuationState.continuationToken, options));
215
- continuationState.continuationToken = listRelationshipResponse.nextLink;
216
- yield yield __await(listRelationshipResponse);
217
- }
218
- });
219
- }
220
- /**
221
- * Deals with the iteration of all the available results of {@link listRelationships}.
222
- * @param options - Common options for the iterative endpoints.
223
- */
224
- listRelationshipsAll(digitalTwinId, options) {
225
- return __asyncGenerator(this, arguments, function* listRelationshipsAll_1() {
226
- var e_1, _a;
227
- try {
228
- for (var _b = __asyncValues(this.listRelationshipsPage(digitalTwinId, options, {})), _c; _c = yield __await(_b.next()), !_c.done;) {
229
- const page = _c.value;
230
- const value = page.value || [];
231
- for (const item of value) {
232
- yield yield __await(item);
233
- }
234
- }
235
- }
236
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
237
- finally {
238
- try {
239
- if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
240
- }
241
- finally { if (e_1) throw e_1.error; }
242
- }
243
- });
244
- }
245
176
  /**
246
177
  * Retrieve relationships for a digital twin.
247
178
  *
248
179
  * @param digitalTwinId - The Id of the digital twin.
249
180
  */
250
- listRelationships(digitalTwinId, options = {}) {
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
- };
261
- }
262
- /**
263
- * Deals with the pagination of {@link listIncomingRelationships}.
264
- *
265
- * @param digitalTwinId - The Id of the digital twin.
266
- * @param options - Common options for the iterative endpoints.
267
- * @param continuationState - An object that indicates the position of the paginated request.
268
- *
269
- */
270
- listIncomingRelationshipsPage(digitalTwinId, options, continuationState) {
271
- return __asyncGenerator(this, arguments, function* listIncomingRelationshipsPage_1() {
272
- if (continuationState.continuationToken == null) {
273
- const optionsComplete = Object.assign({}, options);
274
- const listIncomingRelationshipsResponse = yield __await(this.client.digitalTwins.listIncomingRelationships(digitalTwinId, optionsComplete));
275
- continuationState.continuationToken = listIncomingRelationshipsResponse.nextLink;
276
- yield yield __await(listIncomingRelationshipsResponse);
277
- }
278
- while (continuationState.continuationToken) {
279
- const listIncomingRelationshipsResponse = yield __await(this.client.digitalTwins.listIncomingRelationshipsNext("", continuationState.continuationToken, options));
280
- continuationState.continuationToken = listIncomingRelationshipsResponse.nextLink;
281
- yield yield __await(listIncomingRelationshipsResponse);
282
- }
283
- });
284
- }
285
- /**
286
- * Deals with the iteration of all the available results of {@link listIncomingRelationships}.
287
- * @param digitalTwinId - The Id of the digital twin.
288
- * @param options - Common options for the iterative endpoints.
289
- */
290
- listIncomingRelationshipsAll(digitalTwinId, options) {
291
- return __asyncGenerator(this, arguments, function* listIncomingRelationshipsAll_1() {
292
- var e_2, _a;
293
- try {
294
- for (var _b = __asyncValues(this.listIncomingRelationshipsPage(digitalTwinId, options, {})), _c; _c = yield __await(_b.next()), !_c.done;) {
295
- const page = _c.value;
296
- const value = page.value || [];
297
- yield __await(yield* __asyncDelegator(__asyncValues(value)));
298
- }
299
- }
300
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
301
- finally {
302
- try {
303
- if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
304
- }
305
- finally { if (e_2) throw e_2.error; }
306
- }
307
- });
181
+ listRelationships(digitalTwinId, options) {
182
+ return this.client.digitalTwins.listRelationships(digitalTwinId, options);
308
183
  }
309
184
  /**
310
185
  * Retrieve all incoming relationships for a digital twin.
311
186
  *
312
187
  * @param digitalTwinId - The Id of the digital twin.
313
188
  */
314
- listIncomingRelationships(digitalTwinId, options = {}) {
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
- };
189
+ listIncomingRelationships(digitalTwinId, options) {
190
+ return this.client.digitalTwins.listIncomingRelationships(digitalTwinId, options);
325
191
  }
326
192
  /**
327
193
  * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.
@@ -330,18 +196,11 @@ export class DigitalTwinsClient {
330
196
  * @param payload - The application/json telemetry payload to be sent.
331
197
  * @param messageId - The message Id.
332
198
  * @param options - The operation options
333
- * @returns The http response.
199
+
334
200
  */
335
- publishTelemetry(digitalTwinId,
336
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
337
- payload, messageId, options = {}) {
338
- const digitalTwinsSendTelemetryOptionalParams = options;
339
- digitalTwinsSendTelemetryOptionalParams.telemetrySourceTime = new Date().toISOString();
340
- if (!messageId) {
341
- messageId = generateUuid();
342
- }
343
- return tracingClient.withSpan("DigitalTwinsClient.publishTelemetry", digitalTwinsSendTelemetryOptionalParams, async (updatedOptions) => {
344
- return this.client.digitalTwins.sendTelemetry(digitalTwinId, messageId, payload, updatedOptions);
201
+ publishTelemetry(digitalTwinId, payload, messageId, options = {}) {
202
+ return tracingClient.withSpan("DigitalTwinsClient.publishTelemetry", options, async (updatedOptions) => {
203
+ return this.client.digitalTwins.sendTelemetry(digitalTwinId, messageId || generateUuid(), payload, Object.assign(Object.assign({}, updatedOptions), { telemetrySourceTime: new Date().toISOString() }));
345
204
  });
346
205
  }
347
206
  /**
@@ -352,119 +211,45 @@ export class DigitalTwinsClient {
352
211
  * @param payload - The application/json telemetry payload to be sent.
353
212
  * @param messageId - The message Id.
354
213
  * @param options - The operation options
355
- * @returns The http response.
214
+
356
215
  */
357
216
  publishComponentTelemetry(digitalTwinId, componentName, payload, messageId, options = {}) {
358
- const digitalTwinsSendComponentTelemetryOptionalParams = options;
359
- digitalTwinsSendComponentTelemetryOptionalParams.telemetrySourceTime = new Date().toISOString();
360
- if (!messageId) {
361
- messageId = generateUuid();
362
- }
363
- return tracingClient.withSpan("DigitalTwinsClient.publishComponentTelemetry", digitalTwinsSendComponentTelemetryOptionalParams, async (updatedOptions) => {
364
- return this.client.digitalTwins.sendComponentTelemetry(digitalTwinId, componentName, payload, messageId, updatedOptions);
217
+ return tracingClient.withSpan("DigitalTwinsClient.publishComponentTelemetry", options, async (updatedOptions) => {
218
+ return this.client.digitalTwins.sendComponentTelemetry(digitalTwinId, componentName, messageId || generateUuid(), payload, Object.assign(Object.assign({}, updatedOptions), { telemetrySourceTime: new Date().toISOString() }));
365
219
  });
366
220
  }
367
221
  /**
368
222
  * Get a model, including the model metadata and the model definition.
369
223
  *
370
224
  * @param modelId - The Id of the model.
371
- * @param options - Extended operation options including
372
- * includeModelDefinition: When true the model definition will be returned as part of the result. Default value: false.
373
- * @returns The application/json model and the http response.
225
+ * @param options - Options for this operation
226
+ * @returns The application/json model.
374
227
  */
375
- getModel(modelId, includeModelDefinition = false, options = {}) {
376
- const digitalTwinModelsGetByIdOptionalParams = options;
377
- digitalTwinModelsGetByIdOptionalParams.includeModelDefinition = includeModelDefinition;
378
- return tracingClient.withSpan("DigitalTwinsClient.getModel", digitalTwinModelsGetByIdOptionalParams, async (updatedOptions) => {
228
+ getModel(modelId, options = {}) {
229
+ var _a;
230
+ return tracingClient.withSpan("DigitalTwinsClient.getModel", Object.assign(Object.assign({}, options), { includeModelDefinition: (_a = options === null || options === void 0 ? void 0 : options.includeModelDefinition) !== null && _a !== void 0 ? _a : false }), async (updatedOptions) => {
379
231
  return this.client.digitalTwinModels.getById(modelId, updatedOptions);
380
232
  });
381
233
  }
382
- /**
383
- * Deals with the pagination of {@link list}.
384
- *
385
- * @param options - Common options for the iterative endpoints.
386
- * @param continuationState - An object that indicates the position of the paginated request.
387
- *
388
- */
389
- getModelsPage(options, continuationState) {
390
- return __asyncGenerator(this, arguments, function* getModelsPage_1() {
391
- if (continuationState.continuationToken == null) {
392
- const optionsComplete = options;
393
- optionsComplete.maxItemsPerPage = continuationState.maxPageSize;
394
- const listResponse = yield __await(this.client.digitalTwinModels.list(optionsComplete));
395
- continuationState.continuationToken = listResponse.nextLink;
396
- yield yield __await(listResponse);
397
- }
398
- while (continuationState.continuationToken) {
399
- const listResponse = yield __await(this.client.digitalTwinModels.listNext(continuationState.continuationToken, options));
400
- continuationState.continuationToken = listResponse.nextLink;
401
- yield yield __await(listResponse);
402
- }
403
- });
404
- }
405
- /**
406
- * Deals with the iteration of all the available results of {@link list}.
407
- * @param options - Common options for the iterative endpoints.
408
- */
409
- getModelsAll(options) {
410
- return __asyncGenerator(this, arguments, function* getModelsAll_1() {
411
- var e_3, _a;
412
- const f = {};
413
- try {
414
- for (var _b = __asyncValues(this.getModelsPage(options, f)), _c; _c = yield __await(_b.next()), !_c.done;) {
415
- const page = _c.value;
416
- const value = page.value || [];
417
- for (const item of value) {
418
- yield yield __await(item);
419
- }
420
- }
421
- }
422
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
423
- finally {
424
- try {
425
- if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
426
- }
427
- finally { if (e_3) throw e_3.error; }
428
- }
429
- });
430
- }
431
234
  /**
432
235
  * Get the list of models
433
236
  *
434
- * @param dependeciesFor - The model Ids to have dependencies retrieved. If omitted, all models are retrieved.
435
- * @param includeModelDefinition - Whether to include the model definition in the result. If false, only the model metadata will be returned.
436
- * @param resultsPerPage - The maximum number of items to retrieve per request. The server may choose to return less than the requested max.
437
- * @returns A pageable set of application/json models and the http response.
237
+ * @param options - Options for listing models.
238
+ * @returns A pageable set of application/json models.
438
239
  */
439
- listModels(dependeciesFor, includeModelDefinition = false, resultsPerPage, options = {}) {
440
- let digitalTwinModelsListOptionalParams = options;
441
- digitalTwinModelsListOptionalParams = {
442
- maxItemsPerPage: resultsPerPage,
443
- dependenciesFor: dependeciesFor,
444
- includeModelDefinition: includeModelDefinition,
445
- };
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
- };
240
+ listModels(options = {}) {
241
+ var _a;
242
+ return this.client.digitalTwinModels.list(Object.assign(Object.assign({}, options), { includeModelDefinition: (_a = options === null || options === void 0 ? void 0 : options.includeModelDefinition) !== null && _a !== void 0 ? _a : false }));
456
243
  }
457
244
  /**
458
245
  * Create one or many
459
246
  *
460
- * @param models - The set of models to create. Each string corresponds to exactly one model.
247
+ * @param dtdlModels - The set of models to create. Each string corresponds to exactly one model.
461
248
  * @param options - The operation options
462
- * @returns The created application/json models and the http response.
249
+ * @returns The created application/json models.
463
250
  */
464
251
  createModels(dtdlModels, options = {}) {
465
- const digitalTwinModelsAddOptionalParams = options;
466
- digitalTwinModelsAddOptionalParams.models = dtdlModels;
467
- return tracingClient.withSpan("DigitalTwinsClient.createModels", digitalTwinModelsAddOptionalParams, async (updatedOptions) => {
252
+ return tracingClient.withSpan("DigitalTwinsClient.createModels", Object.assign(Object.assign({}, options), { models: dtdlModels }), async (updatedOptions) => {
468
253
  return this.client.digitalTwinModels.add(updatedOptions);
469
254
  });
470
255
  }
@@ -477,7 +262,7 @@ export class DigitalTwinsClient {
477
262
  * @param modelId - The Id of the model to decommission.
478
263
  * property can be replaced.
479
264
  * @param options - The operation options
480
- * @returns The http response.
265
+
481
266
  *
482
267
  */
483
268
  decomissionModel(modelId, options = {}) {
@@ -491,7 +276,7 @@ export class DigitalTwinsClient {
491
276
  *
492
277
  * @param modelId - The Id of the model to delete.
493
278
  * @param options - The operation options
494
- * @returns The http response.
279
+
495
280
  */
496
281
  deleteModel(modelId, options = {}) {
497
282
  return tracingClient.withSpan("DigitalTwinsClient.deleteModel", options, async (updatedOptions) => {
@@ -503,84 +288,21 @@ export class DigitalTwinsClient {
503
288
  *
504
289
  * @param modelId - The Id of the event route.
505
290
  * @param options - The operation options
506
- * @returns The application/json event route and the http response.
291
+ * @returns The application/json event route.
507
292
  */
508
293
  getEventRoute(eventRouteId, options = {}) {
509
294
  return tracingClient.withSpan("DigitalTwinsClient.getEventRoute", options, async (updatedOptions) => {
510
295
  return this.client.eventRoutes.getById(eventRouteId, updatedOptions);
511
296
  });
512
297
  }
513
- /**
514
- * Deals with the pagination of {@link list}.
515
- *
516
- * @param options - Common options for the iterative endpoints.
517
- * @param continuationState - An object that indicates the position of the paginated request.
518
- *
519
- */
520
- getEventRoutesPage(options, continuationState) {
521
- return __asyncGenerator(this, arguments, function* getEventRoutesPage_1() {
522
- if (continuationState.continuationToken == null) {
523
- const optionsComplete = options;
524
- optionsComplete.maxItemsPerPage = continuationState.maxPageSize;
525
- const listResponse = yield __await(this.client.eventRoutes.list(optionsComplete));
526
- continuationState.continuationToken = listResponse.nextLink;
527
- yield yield __await(listResponse);
528
- }
529
- while (continuationState.continuationToken) {
530
- const listResponse = yield __await(this.client.eventRoutes.listNext(continuationState.continuationToken, options));
531
- continuationState.continuationToken = listResponse.nextLink;
532
- yield yield __await(listResponse);
533
- }
534
- });
535
- }
536
- /**
537
- * Deals with the iteration of all the available results of {@link list}.
538
- * @param options - Common options for the iterative endpoints.
539
- */
540
- getEventRoutesAll(options) {
541
- return __asyncGenerator(this, arguments, function* getEventRoutesAll_1() {
542
- var e_4, _a;
543
- const f = {};
544
- try {
545
- for (var _b = __asyncValues(this.getEventRoutesPage(options, f)), _c; _c = yield __await(_b.next()), !_c.done;) {
546
- const page = _c.value;
547
- const value = page.value || [];
548
- for (const item of value) {
549
- yield yield __await(item);
550
- }
551
- }
552
- }
553
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
554
- finally {
555
- try {
556
- if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
557
- }
558
- finally { if (e_4) throw e_4.error; }
559
- }
560
- });
561
- }
562
298
  /**
563
299
  * List the event routes in a digital twins instance.
564
300
  *
565
- * @param resultsPerPage - The maximum number of items to retrieve per request. The server may choose to return less than
566
- * the requested max.
567
- * @returns The application/json event route and the http response.
301
+ * @param options - Options for listEventRoutes.
302
+ * @returns The application/json event route.
568
303
  */
569
- listEventRoutes(resultsPerPage, options = {}) {
570
- let eventRoutesListOptionalParams = options;
571
- eventRoutesListOptionalParams = {
572
- maxItemsPerPage: resultsPerPage,
573
- };
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
- };
304
+ listEventRoutes(options) {
305
+ return this.client.eventRoutes.list(options);
584
306
  }
585
307
  /**
586
308
  * Create or update an event route.
@@ -589,16 +311,13 @@ export class DigitalTwinsClient {
589
311
  * @param endpointId - The id of the endpoint this event route is bound to.
590
312
  * @param filter - An expression which describes the events which are routed to the endpoint.
591
313
  * @param options - The operation options
592
- * @returns The http response.
314
+
593
315
  */
594
316
  upsertEventRoute(eventRouteId, endpointId, filter, options = {}) {
595
- const eventRoutesAddOptionalParams = options;
596
- const eventRoute = {
597
- endpointName: endpointId,
598
- filter: filter,
599
- };
600
- eventRoutesAddOptionalParams.eventRoute = eventRoute;
601
- return tracingClient.withSpan("DigitalTwinsClient.upsertEventRoute", eventRoutesAddOptionalParams, async (updatedOptions) => {
317
+ return tracingClient.withSpan("DigitalTwinsClient.upsertEventRoute", Object.assign({ eventRoute: {
318
+ endpointName: endpointId,
319
+ filter,
320
+ } }, options), async (updatedOptions) => {
602
321
  return this.client.eventRoutes.add(eventRouteId, updatedOptions);
603
322
  });
604
323
  }
@@ -607,7 +326,7 @@ export class DigitalTwinsClient {
607
326
  *
608
327
  * @param eventRouteId - The Id of the eventRoute to delete.
609
328
  * @param options - The operation options
610
- * @returns The http response.
329
+
611
330
  */
612
331
  deleteEventRoute(eventRouteId, options = {}) {
613
332
  return tracingClient.withSpan("DigitalTwinsClient.deleteEventRoute", options, async (updatedOptions) => {
@@ -624,22 +343,15 @@ export class DigitalTwinsClient {
624
343
  */
625
344
  queryTwinsPage(query, options, continuationState) {
626
345
  return __asyncGenerator(this, arguments, function* queryTwinsPage_1() {
627
- if (continuationState.continuationToken == null) {
628
- const querySpecification = {
629
- query: query,
630
- continuationToken: continuationState.continuationToken,
631
- };
632
- const queryResult = yield __await(this.client.query.queryTwins(querySpecification, options));
633
- continuationState.continuationToken = queryResult.continuationToken;
346
+ let { continuationToken } = continuationState !== null && continuationState !== void 0 ? continuationState : {};
347
+ if (!continuationToken) {
348
+ const queryResult = yield __await(this.client.query.queryTwins({ query }, options));
349
+ continuationToken = queryResult.continuationToken;
634
350
  yield yield __await(queryResult);
635
351
  }
636
- while (continuationState.continuationToken) {
637
- const querySpecification = {
638
- query: query,
639
- continuationToken: continuationState.continuationToken,
640
- };
641
- const queryResult = yield __await(this.client.query.queryTwins(querySpecification, options));
642
- continuationState.continuationToken = queryResult.continuationToken;
352
+ while (continuationToken) {
353
+ const queryResult = yield __await(this.client.query.queryTwins({ query, continuationToken }, options));
354
+ continuationToken = queryResult.continuationToken;
643
355
  yield yield __await(queryResult);
644
356
  }
645
357
  });
@@ -651,24 +363,21 @@ export class DigitalTwinsClient {
651
363
  */
652
364
  queryTwinsAll(query, options) {
653
365
  return __asyncGenerator(this, arguments, function* queryTwinsAll_1() {
654
- var e_5, _a;
655
- const f = {};
366
+ var e_1, _a;
656
367
  try {
657
- for (var _b = __asyncValues(this.queryTwinsPage(query, options, f)), _c; _c = yield __await(_b.next()), !_c.done;) {
368
+ for (var _b = __asyncValues(this.queryTwinsPage(query, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
658
369
  const page = _c.value;
659
370
  if (page.value) {
660
- for (const item of page.value) {
661
- yield yield __await(item);
662
- }
371
+ yield __await(yield* __asyncDelegator(__asyncValues(page.value)));
663
372
  }
664
373
  }
665
374
  }
666
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
375
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
667
376
  finally {
668
377
  try {
669
378
  if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
670
379
  }
671
- finally { if (e_5) throw e_5.error; }
380
+ finally { if (e_1) throw e_1.error; }
672
381
  }
673
382
  });
674
383
  }
@@ -676,15 +385,11 @@ export class DigitalTwinsClient {
676
385
  * Query for digital twins.
677
386
  *
678
387
  * @param query - The query string, in SQL-like syntax.
679
- * @param resultsPerPage - The maximum number of items to retrieve per request. The server may choose to return less than the requested max.
388
+ * @param options - Options for the query operation.
680
389
  * @returns The pageable list of query results.
681
390
  */
682
- queryTwins(query, resultsPerPage, options = {}) {
683
- let queryQueryTwinsOptionalParams = options;
684
- queryQueryTwinsOptionalParams = {
685
- maxItemsPerPage: resultsPerPage,
686
- };
687
- const iter = this.queryTwinsAll(query, queryQueryTwinsOptionalParams);
391
+ queryTwins(query, options = {}) {
392
+ const iter = this.queryTwinsAll(query, options);
688
393
  return {
689
394
  next() {
690
395
  return iter.next();
@@ -692,7 +397,7 @@ export class DigitalTwinsClient {
692
397
  [Symbol.asyncIterator]() {
693
398
  return this;
694
399
  },
695
- byPage: (settings = {}) => this.queryTwinsPage(query, queryQueryTwinsOptionalParams, settings),
400
+ byPage: (settings = {}) => this.queryTwinsPage(query, options, settings),
696
401
  };
697
402
  }
698
403
  }