@azure/digital-twins-core 2.0.0-alpha.20250107.1 → 2.0.0-alpha.20250110.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/README.md +8 -8
- package/dist/browser/digitalTwinsClient.d.ts.map +1 -1
- package/dist/browser/digitalTwinsClient.js.map +1 -1
- package/dist/commonjs/digitalTwinsClient.d.ts.map +1 -1
- package/dist/commonjs/digitalTwinsClient.js.map +1 -1
- package/dist/esm/digitalTwinsClient.d.ts.map +1 -1
- package/dist/esm/digitalTwinsClient.js.map +1 -1
- package/dist/react-native/digitalTwinsClient.d.ts.map +1 -1
- package/dist/react-native/digitalTwinsClient.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP
|
|
|
13
13
|
|
|
14
14
|
### Prerequisites
|
|
15
15
|
|
|
16
|
-
- An [Azure Digital Twins instance](https://
|
|
16
|
+
- An [Azure Digital Twins instance](https://learn.microsoft.com/azure/digital-twins/how-to-set-up-instance-portal).
|
|
17
17
|
|
|
18
18
|
### Install the `@azure/digital-twins-core` package
|
|
19
19
|
|
|
@@ -42,7 +42,7 @@ Please refer to [this document](https://github.com/Azure/azure-sdk-for-js/blob/m
|
|
|
42
42
|
|
|
43
43
|
Azure Digital Twins is an Azure IoT service that creates comprehensive models of the physical environment.
|
|
44
44
|
It can create spatial intelligence graphs to model the relationships and interactions between people, spaces, and devices.
|
|
45
|
-
You can learn more about Azure Digital Twins by visiting [Azure Digital Twins Documentation](https://
|
|
45
|
+
You can learn more about Azure Digital Twins by visiting [Azure Digital Twins Documentation](https://learn.microsoft.com/azure/digital-twins/).
|
|
46
46
|
|
|
47
47
|
### `DigitalTwinsClient`
|
|
48
48
|
|
|
@@ -151,7 +151,7 @@ console.log(`DigitalTwin: ${twin}`);
|
|
|
151
151
|
|
|
152
152
|
#### Query digital twins
|
|
153
153
|
|
|
154
|
-
Query the Azure Digital Twins instance for digital twins using the [Azure Digital Twins query language](https://
|
|
154
|
+
Query the Azure Digital Twins instance for digital twins using the [Azure Digital Twins query language](https://learn.microsoft.com/azure/digital-twins/how-to-query-graph).
|
|
155
155
|
Here's an example of how to query for digital twins and how to iterate over the results.
|
|
156
156
|
|
|
157
157
|
```javascript
|
|
@@ -222,7 +222,7 @@ const relationship = {
|
|
|
222
222
|
await serviceClient.upsertRelationship(
|
|
223
223
|
relationship["$sourceId"],
|
|
224
224
|
relationship["$relationshipId"],
|
|
225
|
-
relationship
|
|
225
|
+
relationship,
|
|
226
226
|
);
|
|
227
227
|
```
|
|
228
228
|
|
|
@@ -251,7 +251,7 @@ for await (const incomingRelationship of incomingRelationships) {
|
|
|
251
251
|
#### Create event route
|
|
252
252
|
|
|
253
253
|
To create an event route, provide an ID of an event route (in this case, "myEventRouteId") and event route data containing the endpoint and optional filter like the example shown below.
|
|
254
|
-
For more information on filtering events, see [this documentation](https://
|
|
254
|
+
For more information on filtering events, see [this documentation](https://learn.microsoft.com/azure/digital-twins/how-to-manage-routes-apis-cli#filter-events).
|
|
255
255
|
|
|
256
256
|
```javascript
|
|
257
257
|
const eventHubEndpointName = "myEventHubEndpointName";
|
|
@@ -301,7 +301,7 @@ const telemetryPayload = '{"Telemetry1": 5}';
|
|
|
301
301
|
const response = await serviceClient.publishTelemetry(
|
|
302
302
|
digitalTwinId,
|
|
303
303
|
telemetryPayload,
|
|
304
|
-
"<unique message ID>"
|
|
304
|
+
"<unique message ID>",
|
|
305
305
|
);
|
|
306
306
|
```
|
|
307
307
|
|
|
@@ -316,7 +316,7 @@ const response = await serviceClient.publishComponentTelemetry(
|
|
|
316
316
|
digitalTwinId,
|
|
317
317
|
componentPath,
|
|
318
318
|
telemetryPayload,
|
|
319
|
-
"<unique message ID>"
|
|
319
|
+
"<unique message ID>",
|
|
320
320
|
);
|
|
321
321
|
```
|
|
322
322
|
|
|
@@ -342,7 +342,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur
|
|
|
342
342
|
## Next steps
|
|
343
343
|
|
|
344
344
|
- Take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/digitaltwins/digital-twins-core/samples) directory for detailed examples that demonstrate how to use the client libraries.
|
|
345
|
-
- Explore the Azure Digital Twins [documentation](https://
|
|
345
|
+
- Explore the Azure Digital Twins [documentation](https://learn.microsoft.com/azure/digital-twins/)
|
|
346
346
|
|
|
347
347
|
## Contributing
|
|
348
348
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digitalTwinsClient.d.ts","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"digitalTwinsClient.d.ts","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAEhB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAgB,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGnF,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,EACvB,gCAAgC,EAChC,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,EAChC,mCAAmC,EACnC,yCAAyC,EACzC,mCAAmC,EACnC,yCAAyC,EACzC,4CAA4C,EAC5C,sCAAsC,EACtC,4CAA4C,EAC5C,oBAAoB,EACpB,uCAAuC,EACvC,qBAAqB,EACrB,gCAAgC,EAChC,4BAA4B,EAC5B,0BAA0B,EAC1B,UAAU,EACV,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,sCAAsC,IAAI,eAAe,EACzD,mCAAmC,IAAI,iBAAiB,EACxD,6BAA6B,IAAI,iBAAiB,EAClD,6BAA6B,IAAI,sBAAsB,EACvD,2CAA2C,IAAI,wBAAwB,EACv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,WAAW,GAAG,cAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAA,CAAC;gBAC9F,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC;gBAClD,oBAAM,WAAW,CAAA,CAAC;YACpB,CAAC;QACH,CAAC;KAAA;IAED;;;;OAIG;IACY,aAAa,CAC1B,KAAa,EACb,OAA0B;;;;gBAE1B,KAAyB,eAAA,KAAA,cAAA,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA,IAAA,+DAAE,CAAC;oBAAtC,cAAmC;oBAAnC,WAAmC;oBAAjD,MAAM,IAAI,KAAA,CAAA;oBACnB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;wBACf,cAAA,KAAK,CAAC,CAAC,iBAAA,cAAA,IAAI,CAAC,KAAK,CAAA,CAAA,CAAA,CAAC;oBACpB,CAAC;gBACH,CAAC;;;;;;;;;QACH,CAAC;KAAA;IAED;;;;;;OAMG;IACI,UAAU,CACf,KAAa,EACb,UAA6B,EAAE;QAE/B,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAEhD,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,CAAC,WAAyB,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;SACvF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport type {\n OperationOptions,\n InternalClientPipelineOptions,\n CommonClientOptions,\n} from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { AzureDigitalTwinsAPI as GeneratedClient } from \"./generated/azureDigitalTwinsAPI.js\";\nimport type {\n DigitalTwinsGetByIdResponse,\n DigitalTwinsAddOptionalParams,\n DigitalTwinsAddResponse,\n DigitalTwinsUpdateOptionalParams,\n DigitalTwinsUpdateResponse,\n DigitalTwinsDeleteOptionalParams,\n DigitalTwinsGetComponentResponse,\n DigitalTwinsUpdateComponentResponse,\n DigitalTwinsUpdateComponentOptionalParams,\n DigitalTwinsAddRelationshipResponse,\n DigitalTwinsAddRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipResponse,\n DigitalTwinsDeleteRelationshipOptionalParams,\n IncomingRelationship,\n DigitalTwinsGetRelationshipByIdResponse,\n DigitalTwinsModelData,\n DigitalTwinModelsGetByIdResponse,\n DigitalTwinModelsAddResponse,\n EventRoutesGetByIdResponse,\n EventRoute,\n QueryQueryTwinsResponse,\n} from \"./generated/models/index.js\";\nimport {\n DigitalTwinModelsGetByIdOptionalParams as GetModelOptions,\n DigitalTwinModelsListOptionalParams as ListModelsOptions,\n QueryQueryTwinsOptionalParams as QueryTwinsOptions,\n EventRoutesListOptionalParams as ListEventRoutesOptions,\n DigitalTwinsListRelationshipsOptionalParams as ListRelationshipsOptions,\n DigitalTwinsListIncomingRelationshipsOptionalParams as ListIncomingRelationshipsOptions,\n} from \"./generated/models/index.js\";\nimport { tracingClient } from \"./tracing.js\";\nimport { logger } from \"./logger.js\";\nexport {\n GetModelOptions,\n ListModelsOptions,\n QueryTwinsOptions,\n ListEventRoutesOptions,\n ListIncomingRelationshipsOptions,\n ListRelationshipsOptions,\n};\n\n/**\n * Options for the DigitalTwinsClient class\n */\nexport interface DigitalTwinsClientOptions extends CommonClientOptions {}\n\nconst DEFAULT_DIGITALTWINS_SCOPE = \"https://digitaltwins.azure.net/.default\";\n\n/**\n * Client for Azure IoT DigitalTwins API.\n */\nexport class DigitalTwinsClient {\n /**\n * A reference to the auto-generated AzureDigitalTwinsAPI\n */\n private readonly client: GeneratedClient;\n\n /**\n * Creates an instance of AzureDigitalTwinsAPI.\n *\n * Example usage:\n * ```ts\n * const { DigitalTwinsClient, ServiceClientCredentials } = require(\"@azure/digital-twins-core\");\n *\n * const client = new DigitalTwinsClient(\n * \"<endpoint>\",\n * new DefaultAzureCredential();\n * );\n * ```\n * @param endpointUrl - The endpoint URL of the service.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the service client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential,\n options: DigitalTwinsClientOptions = {},\n ) {\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-request-id\"],\n },\n };\n\n this.client = new GeneratedClient({\n endpoint: endpointUrl,\n credential,\n credentialScopes: DEFAULT_DIGITALTWINS_SCOPE,\n ...internalPipelineOptions,\n });\n }\n\n /**\n * Get a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param options - The operation options\n * @returns The application/json digital twin.\n */\n public getDigitalTwin(\n digitalTwinId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Create or update a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to create or update.\n * @param digitalTwinJson - The application/json digital twin to create.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n * @returns The created application/json digital twin.\n */\n public upsertDigitalTwin(\n digitalTwinId: string,\n digitalTwinJson: string,\n options: DigitalTwinsAddOptionalParams = {},\n ): Promise<DigitalTwinsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertDigitalTwin\",\n options,\n async (updatedOptions) => {\n const payload = JSON.parse(digitalTwinJson);\n return this.client.digitalTwins.add(digitalTwinId, payload, updatedOptions);\n },\n );\n }\n\n /**\n * Update a digital twin using a json patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param jsonPatch - An update specification described by JSON Patch. Updates to property values\n * and $model elements may happen in the same request. Operations are limited to add, replace and\n * remove.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateDigitalTwin(\n digitalTwinId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateOptionalParams = {},\n ): Promise<DigitalTwinsUpdateResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public deleteDigitalTwin(\n digitalTwinId: string,\n options: DigitalTwinsDeleteOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Get a component on a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being retrieved.\n * @param options - The operation options\n * @returns Json string representation of the component corresponding to the provided componentName.\n */\n public getComponent(\n digitalTwinId: string,\n componentName: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);\n },\n );\n }\n\n /**\n * Update properties of a component on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's component.\n * @param enableUpdate - If true then update of an existing digital twin is enabled.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateComponent(\n digitalTwinId: string,\n componentName: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateComponentOptionalParams = {},\n ): Promise<DigitalTwinsUpdateComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateComponent(\n digitalTwinId,\n componentName,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Get a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to retrieve.\n * @param options - The operation options\n * @returns The pageable list of application/json relationships belonging to the specified digital twin.\n */\n public getRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetRelationshipByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getRelationshipById(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Create or update a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to create.\n * @param relationship - The application/json relationship to be created.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n */\n public upsertRelationship(\n digitalTwinId: string,\n relationshipId: string,\n relationship: Record<string, unknown>,\n options: DigitalTwinsAddRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsAddRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.addRelationship(\n digitalTwinId,\n relationshipId,\n relationship,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Updates the properties of a relationship on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param relationshipId - The Id of the relationship to be updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's relationship.\n * @param options - Extended operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n */\n public updateRelationship(\n digitalTwinId: string,\n relationshipId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsUpdateRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateRelationship(\n digitalTwinId,\n relationshipId,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Delete a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to delete.\n * @param options - The operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is\n\n */\n public deleteRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: DigitalTwinsDeleteRelationshipOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.deleteRelationship(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Retrieve relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listRelationships(\n digitalTwinId: string,\n options?: ListRelationshipsOptions,\n ): PagedAsyncIterableIterator<Record<string, unknown>> {\n return this.client.digitalTwins.listRelationships(digitalTwinId, options);\n }\n\n /**\n * Retrieve all incoming relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listIncomingRelationships(\n digitalTwinId: string,\n options?: ListIncomingRelationshipsOptions,\n ): PagedAsyncIterableIterator<IncomingRelationship> {\n return this.client.digitalTwins.listIncomingRelationships(digitalTwinId, options);\n }\n\n /**\n * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishTelemetry(\n digitalTwinId: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendTelemetry(\n digitalTwinId,\n messageId || randomUUID(),\n payload,\n {\n ...updatedOptions,\n telemetrySourceTime: new Date().toISOString(),\n },\n );\n },\n );\n }\n\n /**\n * Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param componentName - The name of the DTDL component.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishComponentTelemetry(\n digitalTwinId: string,\n componentName: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishComponentTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendComponentTelemetry(\n digitalTwinId,\n componentName,\n messageId || randomUUID(),\n payload,\n { ...updatedOptions, telemetrySourceTime: new Date().toISOString() },\n );\n },\n );\n }\n\n /**\n * Get a model, including the model metadata and the model definition.\n *\n * @param modelId - The Id of the model.\n * @param options - Options for this operation\n * @returns The application/json model.\n */\n public getModel(\n modelId: string,\n options: GetModelOptions = {},\n ): Promise<DigitalTwinModelsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getModel\",\n {\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.getById(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get the list of models\n *\n * @param options - Options for listing models.\n * @returns A pageable set of application/json models.\n */\n public listModels(\n options: ListModelsOptions = {},\n ): PagedAsyncIterableIterator<DigitalTwinsModelData> {\n return this.client.digitalTwinModels.list({\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n });\n }\n\n /**\n * Create one or many\n *\n * @param dtdlModels - The set of models to create. Each string corresponds to exactly one model.\n * @param options - The operation options\n * @returns The created application/json models.\n */\n public createModels(\n dtdlModels: Array<Record<string, unknown>>,\n options: OperationOptions = {},\n ): Promise<DigitalTwinModelsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.createModels\",\n {\n ...options,\n models: dtdlModels,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.add(updatedOptions);\n },\n );\n }\n\n /**\n * Decommission a model using a json patch.\n * When a model is decommissioned, new digital twins will no longer be able to be\n * defined by this model. However, existing digital twins may continue to use this model.\n * Once a model is decommissioned, it may not be recommissioned.\n *\n * @param modelId - The Id of the model to decommission.\n * property can be replaced.\n * @param options - The operation options\n\n *\n */\n public decomissionModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n const jsonPatch = [{ op: \"replace\", path: \"/decommissioned\", value: true }];\n\n return tracingClient.withSpan(\n \"DigitalTwinsClient.decomissionModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a model.\n *\n * @param modelId - The Id of the model to delete.\n * @param options - The operation options\n\n */\n public deleteModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.delete(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get an event route.\n *\n * @param modelId - The Id of the event route.\n * @param options - The operation options\n * @returns The application/json event route.\n */\n public getEventRoute(\n eventRouteId: string,\n options: OperationOptions = {},\n ): Promise<EventRoutesGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.getById(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * List the event routes in a digital twins instance.\n *\n * @param options - Options for listEventRoutes.\n * @returns The application/json event route.\n */\n public listEventRoutes(options?: ListEventRoutesOptions): PagedAsyncIterableIterator<EventRoute> {\n return this.client.eventRoutes.list(options);\n }\n\n /**\n * Create or update an event route.\n *\n * @param eventRouteId - The Id of the event route to create or update.\n * @param endpointId - The id of the endpoint this event route is bound to.\n * @param filter - An expression which describes the events which are routed to the endpoint.\n * @param options - The operation options\n\n */\n public upsertEventRoute(\n eventRouteId: string,\n endpointId: string,\n filter: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertEventRoute\",\n {\n eventRoute: {\n endpointName: endpointId,\n filter,\n },\n ...options,\n },\n async (updatedOptions) => {\n return this.client.eventRoutes.add(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Delete an event route.\n *\n * @param eventRouteId - The Id of the eventRoute to delete.\n * @param options - The operation options\n\n */\n public deleteEventRoute(eventRouteId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.delete(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Deals with the pagination of {@link query}.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n * @param continuationState - An object that indicates the position of the paginated request.\n *\n */\n private async *queryTwinsPage(\n query: string,\n options: QueryTwinsOptions,\n continuationState?: PageSettings,\n ): AsyncIterableIterator<QueryQueryTwinsResponse> {\n let { continuationToken } = continuationState ?? {};\n if (!continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n while (continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query, continuationToken }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n }\n\n /**\n * Deals with the iteration of all the available results of {@link query}.\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n */\n private async *queryTwinsAll(\n query: string,\n options: QueryTwinsOptions,\n ): AsyncIterableIterator<Record<string, unknown>> {\n for await (const page of this.queryTwinsPage(query, options)) {\n if (page.value) {\n yield* page.value;\n }\n }\n }\n\n /**\n * Query for digital twins.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Options for the query operation.\n * @returns The pageable list of query results.\n */\n public queryTwins(\n query: string,\n options: QueryTwinsOptions = {},\n ): PagedAsyncIterableIterator<Record<string, unknown>, QueryQueryTwinsResponse> {\n const iter = this.queryTwinsAll(query, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => this.queryTwinsPage(query, options, settings),\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"digitalTwinsClient.js","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AASlC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,IAAI,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAiC9F,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAerC,MAAM,0BAA0B,GAAG,yCAAyC,CAAC;AAE7E;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAM7B;;;;;;;;;;;;;;;OAeG;IACH,YACE,WAAmB,EACnB,UAA2B,EAC3B,UAAqC,EAAE;QAEvC,MAAM,uBAAuB,mCACxB,O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AM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,CAAC,WAAyB,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;SACvF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n OperationOptions,\n InternalClientPipelineOptions,\n CommonClientOptions,\n} from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { AzureDigitalTwinsAPI as GeneratedClient } from \"./generated/azureDigitalTwinsAPI.js\";\nimport type {\n DigitalTwinsGetByIdResponse,\n DigitalTwinsAddOptionalParams,\n DigitalTwinsAddResponse,\n DigitalTwinsUpdateOptionalParams,\n DigitalTwinsUpdateResponse,\n DigitalTwinsDeleteOptionalParams,\n DigitalTwinsGetComponentResponse,\n DigitalTwinsUpdateComponentResponse,\n DigitalTwinsUpdateComponentOptionalParams,\n DigitalTwinsAddRelationshipResponse,\n DigitalTwinsAddRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipResponse,\n DigitalTwinsDeleteRelationshipOptionalParams,\n IncomingRelationship,\n DigitalTwinsGetRelationshipByIdResponse,\n DigitalTwinsModelData,\n DigitalTwinModelsGetByIdResponse,\n DigitalTwinModelsAddResponse,\n EventRoutesGetByIdResponse,\n EventRoute,\n QueryQueryTwinsResponse,\n} from \"./generated/models/index.js\";\nimport {\n DigitalTwinModelsGetByIdOptionalParams as GetModelOptions,\n DigitalTwinModelsListOptionalParams as ListModelsOptions,\n QueryQueryTwinsOptionalParams as QueryTwinsOptions,\n EventRoutesListOptionalParams as ListEventRoutesOptions,\n DigitalTwinsListRelationshipsOptionalParams as ListRelationshipsOptions,\n DigitalTwinsListIncomingRelationshipsOptionalParams as ListIncomingRelationshipsOptions,\n} from \"./generated/models/index.js\";\nimport { tracingClient } from \"./tracing.js\";\nimport { logger } from \"./logger.js\";\nexport {\n GetModelOptions,\n ListModelsOptions,\n QueryTwinsOptions,\n ListEventRoutesOptions,\n ListIncomingRelationshipsOptions,\n ListRelationshipsOptions,\n};\n\n/**\n * Options for the DigitalTwinsClient class\n */\nexport interface DigitalTwinsClientOptions extends CommonClientOptions {}\n\nconst DEFAULT_DIGITALTWINS_SCOPE = \"https://digitaltwins.azure.net/.default\";\n\n/**\n * Client for Azure IoT DigitalTwins API.\n */\nexport class DigitalTwinsClient {\n /**\n * A reference to the auto-generated AzureDigitalTwinsAPI\n */\n private readonly client: GeneratedClient;\n\n /**\n * Creates an instance of AzureDigitalTwinsAPI.\n *\n * Example usage:\n * ```ts\n * const { DigitalTwinsClient, ServiceClientCredentials } = require(\"@azure/digital-twins-core\");\n *\n * const client = new DigitalTwinsClient(\n * \"<endpoint>\",\n * new DefaultAzureCredential();\n * );\n * ```\n * @param endpointUrl - The endpoint URL of the service.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the service client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential,\n options: DigitalTwinsClientOptions = {},\n ) {\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-request-id\"],\n },\n };\n\n this.client = new GeneratedClient({\n endpoint: endpointUrl,\n credential,\n credentialScopes: DEFAULT_DIGITALTWINS_SCOPE,\n ...internalPipelineOptions,\n });\n }\n\n /**\n * Get a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param options - The operation options\n * @returns The application/json digital twin.\n */\n public getDigitalTwin(\n digitalTwinId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Create or update a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to create or update.\n * @param digitalTwinJson - The application/json digital twin to create.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n * @returns The created application/json digital twin.\n */\n public upsertDigitalTwin(\n digitalTwinId: string,\n digitalTwinJson: string,\n options: DigitalTwinsAddOptionalParams = {},\n ): Promise<DigitalTwinsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertDigitalTwin\",\n options,\n async (updatedOptions) => {\n const payload = JSON.parse(digitalTwinJson);\n return this.client.digitalTwins.add(digitalTwinId, payload, updatedOptions);\n },\n );\n }\n\n /**\n * Update a digital twin using a json patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param jsonPatch - An update specification described by JSON Patch. Updates to property values\n * and $model elements may happen in the same request. Operations are limited to add, replace and\n * remove.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateDigitalTwin(\n digitalTwinId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateOptionalParams = {},\n ): Promise<DigitalTwinsUpdateResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public deleteDigitalTwin(\n digitalTwinId: string,\n options: DigitalTwinsDeleteOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Get a component on a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being retrieved.\n * @param options - The operation options\n * @returns Json string representation of the component corresponding to the provided componentName.\n */\n public getComponent(\n digitalTwinId: string,\n componentName: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);\n },\n );\n }\n\n /**\n * Update properties of a component on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's component.\n * @param enableUpdate - If true then update of an existing digital twin is enabled.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateComponent(\n digitalTwinId: string,\n componentName: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateComponentOptionalParams = {},\n ): Promise<DigitalTwinsUpdateComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateComponent(\n digitalTwinId,\n componentName,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Get a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to retrieve.\n * @param options - The operation options\n * @returns The pageable list of application/json relationships belonging to the specified digital twin.\n */\n public getRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetRelationshipByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getRelationshipById(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Create or update a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to create.\n * @param relationship - The application/json relationship to be created.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n */\n public upsertRelationship(\n digitalTwinId: string,\n relationshipId: string,\n relationship: Record<string, unknown>,\n options: DigitalTwinsAddRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsAddRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.addRelationship(\n digitalTwinId,\n relationshipId,\n relationship,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Updates the properties of a relationship on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param relationshipId - The Id of the relationship to be updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's relationship.\n * @param options - Extended operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n */\n public updateRelationship(\n digitalTwinId: string,\n relationshipId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsUpdateRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateRelationship(\n digitalTwinId,\n relationshipId,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Delete a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to delete.\n * @param options - The operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is\n\n */\n public deleteRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: DigitalTwinsDeleteRelationshipOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.deleteRelationship(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Retrieve relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listRelationships(\n digitalTwinId: string,\n options?: ListRelationshipsOptions,\n ): PagedAsyncIterableIterator<Record<string, unknown>> {\n return this.client.digitalTwins.listRelationships(digitalTwinId, options);\n }\n\n /**\n * Retrieve all incoming relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listIncomingRelationships(\n digitalTwinId: string,\n options?: ListIncomingRelationshipsOptions,\n ): PagedAsyncIterableIterator<IncomingRelationship> {\n return this.client.digitalTwins.listIncomingRelationships(digitalTwinId, options);\n }\n\n /**\n * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishTelemetry(\n digitalTwinId: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendTelemetry(\n digitalTwinId,\n messageId || randomUUID(),\n payload,\n {\n ...updatedOptions,\n telemetrySourceTime: new Date().toISOString(),\n },\n );\n },\n );\n }\n\n /**\n * Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param componentName - The name of the DTDL component.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishComponentTelemetry(\n digitalTwinId: string,\n componentName: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishComponentTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendComponentTelemetry(\n digitalTwinId,\n componentName,\n messageId || randomUUID(),\n payload,\n { ...updatedOptions, telemetrySourceTime: new Date().toISOString() },\n );\n },\n );\n }\n\n /**\n * Get a model, including the model metadata and the model definition.\n *\n * @param modelId - The Id of the model.\n * @param options - Options for this operation\n * @returns The application/json model.\n */\n public getModel(\n modelId: string,\n options: GetModelOptions = {},\n ): Promise<DigitalTwinModelsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getModel\",\n {\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.getById(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get the list of models\n *\n * @param options - Options for listing models.\n * @returns A pageable set of application/json models.\n */\n public listModels(\n options: ListModelsOptions = {},\n ): PagedAsyncIterableIterator<DigitalTwinsModelData> {\n return this.client.digitalTwinModels.list({\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n });\n }\n\n /**\n * Create one or many\n *\n * @param dtdlModels - The set of models to create. Each string corresponds to exactly one model.\n * @param options - The operation options\n * @returns The created application/json models.\n */\n public createModels(\n dtdlModels: Array<Record<string, unknown>>,\n options: OperationOptions = {},\n ): Promise<DigitalTwinModelsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.createModels\",\n {\n ...options,\n models: dtdlModels,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.add(updatedOptions);\n },\n );\n }\n\n /**\n * Decommission a model using a json patch.\n * When a model is decommissioned, new digital twins will no longer be able to be\n * defined by this model. However, existing digital twins may continue to use this model.\n * Once a model is decommissioned, it may not be recommissioned.\n *\n * @param modelId - The Id of the model to decommission.\n * property can be replaced.\n * @param options - The operation options\n\n *\n */\n public decomissionModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n const jsonPatch = [{ op: \"replace\", path: \"/decommissioned\", value: true }];\n\n return tracingClient.withSpan(\n \"DigitalTwinsClient.decomissionModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a model.\n *\n * @param modelId - The Id of the model to delete.\n * @param options - The operation options\n\n */\n public deleteModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.delete(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get an event route.\n *\n * @param modelId - The Id of the event route.\n * @param options - The operation options\n * @returns The application/json event route.\n */\n public getEventRoute(\n eventRouteId: string,\n options: OperationOptions = {},\n ): Promise<EventRoutesGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.getById(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * List the event routes in a digital twins instance.\n *\n * @param options - Options for listEventRoutes.\n * @returns The application/json event route.\n */\n public listEventRoutes(options?: ListEventRoutesOptions): PagedAsyncIterableIterator<EventRoute> {\n return this.client.eventRoutes.list(options);\n }\n\n /**\n * Create or update an event route.\n *\n * @param eventRouteId - The Id of the event route to create or update.\n * @param endpointId - The id of the endpoint this event route is bound to.\n * @param filter - An expression which describes the events which are routed to the endpoint.\n * @param options - The operation options\n\n */\n public upsertEventRoute(\n eventRouteId: string,\n endpointId: string,\n filter: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertEventRoute\",\n {\n eventRoute: {\n endpointName: endpointId,\n filter,\n },\n ...options,\n },\n async (updatedOptions) => {\n return this.client.eventRoutes.add(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Delete an event route.\n *\n * @param eventRouteId - The Id of the eventRoute to delete.\n * @param options - The operation options\n\n */\n public deleteEventRoute(eventRouteId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.delete(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Deals with the pagination of {@link query}.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n * @param continuationState - An object that indicates the position of the paginated request.\n *\n */\n private async *queryTwinsPage(\n query: string,\n options: QueryTwinsOptions,\n continuationState?: PageSettings,\n ): AsyncIterableIterator<QueryQueryTwinsResponse> {\n let { continuationToken } = continuationState ?? {};\n if (!continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n while (continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query, continuationToken }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n }\n\n /**\n * Deals with the iteration of all the available results of {@link query}.\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n */\n private async *queryTwinsAll(\n query: string,\n options: QueryTwinsOptions,\n ): AsyncIterableIterator<Record<string, unknown>> {\n for await (const page of this.queryTwinsPage(query, options)) {\n if (page.value) {\n yield* page.value;\n }\n }\n }\n\n /**\n * Query for digital twins.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Options for the query operation.\n * @returns The pageable list of query results.\n */\n public queryTwins(\n query: string,\n options: QueryTwinsOptions = {},\n ): PagedAsyncIterableIterator<Record<string, unknown>, QueryQueryTwinsResponse> {\n const iter = this.queryTwinsAll(query, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => this.queryTwinsPage(query, options, settings),\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digitalTwinsClient.d.ts","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"digitalTwinsClient.d.ts","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"m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;;;;QACH,CAAC;KAAA;IAED;;;;;;OAMG;IACI,UAAU,CACf,KAAa,EACb,UAA6B,EAAE;QAE/B,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAEhD,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,CAAC,WAAyB,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;SACvF,CAAC;IACJ,CAAC;CACF;AArnBD,gDAqnBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport type {\n OperationOptions,\n InternalClientPipelineOptions,\n CommonClientOptions,\n} from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { AzureDigitalTwinsAPI as GeneratedClient } from \"./generated/azureDigitalTwinsAPI.js\";\nimport type {\n DigitalTwinsGetByIdResponse,\n DigitalTwinsAddOptionalParams,\n DigitalTwinsAddResponse,\n DigitalTwinsUpdateOptionalParams,\n DigitalTwinsUpdateResponse,\n DigitalTwinsDeleteOptionalParams,\n DigitalTwinsGetComponentResponse,\n DigitalTwinsUpdateComponentResponse,\n DigitalTwinsUpdateComponentOptionalParams,\n DigitalTwinsAddRelationshipResponse,\n DigitalTwinsAddRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipResponse,\n DigitalTwinsDeleteRelationshipOptionalParams,\n IncomingRelationship,\n DigitalTwinsGetRelationshipByIdResponse,\n DigitalTwinsModelData,\n DigitalTwinModelsGetByIdResponse,\n DigitalTwinModelsAddResponse,\n EventRoutesGetByIdResponse,\n EventRoute,\n QueryQueryTwinsResponse,\n} from \"./generated/models/index.js\";\nimport {\n DigitalTwinModelsGetByIdOptionalParams as GetModelOptions,\n DigitalTwinModelsListOptionalParams as ListModelsOptions,\n QueryQueryTwinsOptionalParams as QueryTwinsOptions,\n EventRoutesListOptionalParams as ListEventRoutesOptions,\n DigitalTwinsListRelationshipsOptionalParams as ListRelationshipsOptions,\n DigitalTwinsListIncomingRelationshipsOptionalParams as ListIncomingRelationshipsOptions,\n} from \"./generated/models/index.js\";\nimport { tracingClient } from \"./tracing.js\";\nimport { logger } from \"./logger.js\";\nexport {\n GetModelOptions,\n ListModelsOptions,\n QueryTwinsOptions,\n ListEventRoutesOptions,\n ListIncomingRelationshipsOptions,\n ListRelationshipsOptions,\n};\n\n/**\n * Options for the DigitalTwinsClient class\n */\nexport interface DigitalTwinsClientOptions extends CommonClientOptions {}\n\nconst DEFAULT_DIGITALTWINS_SCOPE = \"https://digitaltwins.azure.net/.default\";\n\n/**\n * Client for Azure IoT DigitalTwins API.\n */\nexport class DigitalTwinsClient {\n /**\n * A reference to the auto-generated AzureDigitalTwinsAPI\n */\n private readonly client: GeneratedClient;\n\n /**\n * Creates an instance of AzureDigitalTwinsAPI.\n *\n * Example usage:\n * ```ts\n * const { DigitalTwinsClient, ServiceClientCredentials } = require(\"@azure/digital-twins-core\");\n *\n * const client = new DigitalTwinsClient(\n * \"<endpoint>\",\n * new DefaultAzureCredential();\n * );\n * ```\n * @param endpointUrl - The endpoint URL of the service.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the service client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential,\n options: DigitalTwinsClientOptions = {},\n ) {\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-request-id\"],\n },\n };\n\n this.client = new GeneratedClient({\n endpoint: endpointUrl,\n credential,\n credentialScopes: DEFAULT_DIGITALTWINS_SCOPE,\n ...internalPipelineOptions,\n });\n }\n\n /**\n * Get a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param options - The operation options\n * @returns The application/json digital twin.\n */\n public getDigitalTwin(\n digitalTwinId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Create or update a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to create or update.\n * @param digitalTwinJson - The application/json digital twin to create.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n * @returns The created application/json digital twin.\n */\n public upsertDigitalTwin(\n digitalTwinId: string,\n digitalTwinJson: string,\n options: DigitalTwinsAddOptionalParams = {},\n ): Promise<DigitalTwinsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertDigitalTwin\",\n options,\n async (updatedOptions) => {\n const payload = JSON.parse(digitalTwinJson);\n return this.client.digitalTwins.add(digitalTwinId, payload, updatedOptions);\n },\n );\n }\n\n /**\n * Update a digital twin using a json patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param jsonPatch - An update specification described by JSON Patch. Updates to property values\n * and $model elements may happen in the same request. Operations are limited to add, replace and\n * remove.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateDigitalTwin(\n digitalTwinId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateOptionalParams = {},\n ): Promise<DigitalTwinsUpdateResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public deleteDigitalTwin(\n digitalTwinId: string,\n options: DigitalTwinsDeleteOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Get a component on a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being retrieved.\n * @param options - The operation options\n * @returns Json string representation of the component corresponding to the provided componentName.\n */\n public getComponent(\n digitalTwinId: string,\n componentName: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);\n },\n );\n }\n\n /**\n * Update properties of a component on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's component.\n * @param enableUpdate - If true then update of an existing digital twin is enabled.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateComponent(\n digitalTwinId: string,\n componentName: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateComponentOptionalParams = {},\n ): Promise<DigitalTwinsUpdateComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateComponent(\n digitalTwinId,\n componentName,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Get a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to retrieve.\n * @param options - The operation options\n * @returns The pageable list of application/json relationships belonging to the specified digital twin.\n */\n public getRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetRelationshipByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getRelationshipById(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Create or update a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to create.\n * @param relationship - The application/json relationship to be created.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n */\n public upsertRelationship(\n digitalTwinId: string,\n relationshipId: string,\n relationship: Record<string, unknown>,\n options: DigitalTwinsAddRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsAddRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.addRelationship(\n digitalTwinId,\n relationshipId,\n relationship,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Updates the properties of a relationship on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param relationshipId - The Id of the relationship to be updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's relationship.\n * @param options - Extended operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n */\n public updateRelationship(\n digitalTwinId: string,\n relationshipId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsUpdateRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateRelationship(\n digitalTwinId,\n relationshipId,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Delete a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to delete.\n * @param options - The operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is\n\n */\n public deleteRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: DigitalTwinsDeleteRelationshipOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.deleteRelationship(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Retrieve relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listRelationships(\n digitalTwinId: string,\n options?: ListRelationshipsOptions,\n ): PagedAsyncIterableIterator<Record<string, unknown>> {\n return this.client.digitalTwins.listRelationships(digitalTwinId, options);\n }\n\n /**\n * Retrieve all incoming relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listIncomingRelationships(\n digitalTwinId: string,\n options?: ListIncomingRelationshipsOptions,\n ): PagedAsyncIterableIterator<IncomingRelationship> {\n return this.client.digitalTwins.listIncomingRelationships(digitalTwinId, options);\n }\n\n /**\n * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishTelemetry(\n digitalTwinId: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendTelemetry(\n digitalTwinId,\n messageId || randomUUID(),\n payload,\n {\n ...updatedOptions,\n telemetrySourceTime: new Date().toISOString(),\n },\n );\n },\n );\n }\n\n /**\n * Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param componentName - The name of the DTDL component.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishComponentTelemetry(\n digitalTwinId: string,\n componentName: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishComponentTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendComponentTelemetry(\n digitalTwinId,\n componentName,\n messageId || randomUUID(),\n payload,\n { ...updatedOptions, telemetrySourceTime: new Date().toISOString() },\n );\n },\n );\n }\n\n /**\n * Get a model, including the model metadata and the model definition.\n *\n * @param modelId - The Id of the model.\n * @param options - Options for this operation\n * @returns The application/json model.\n */\n public getModel(\n modelId: string,\n options: GetModelOptions = {},\n ): Promise<DigitalTwinModelsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getModel\",\n {\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.getById(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get the list of models\n *\n * @param options - Options for listing models.\n * @returns A pageable set of application/json models.\n */\n public listModels(\n options: ListModelsOptions = {},\n ): PagedAsyncIterableIterator<DigitalTwinsModelData> {\n return this.client.digitalTwinModels.list({\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n });\n }\n\n /**\n * Create one or many\n *\n * @param dtdlModels - The set of models to create. Each string corresponds to exactly one model.\n * @param options - The operation options\n * @returns The created application/json models.\n */\n public createModels(\n dtdlModels: Array<Record<string, unknown>>,\n options: OperationOptions = {},\n ): Promise<DigitalTwinModelsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.createModels\",\n {\n ...options,\n models: dtdlModels,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.add(updatedOptions);\n },\n );\n }\n\n /**\n * Decommission a model using a json patch.\n * When a model is decommissioned, new digital twins will no longer be able to be\n * defined by this model. However, existing digital twins may continue to use this model.\n * Once a model is decommissioned, it may not be recommissioned.\n *\n * @param modelId - The Id of the model to decommission.\n * property can be replaced.\n * @param options - The operation options\n\n *\n */\n public decomissionModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n const jsonPatch = [{ op: \"replace\", path: \"/decommissioned\", value: true }];\n\n return tracingClient.withSpan(\n \"DigitalTwinsClient.decomissionModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a model.\n *\n * @param modelId - The Id of the model to delete.\n * @param options - The operation options\n\n */\n public deleteModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.delete(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get an event route.\n *\n * @param modelId - The Id of the event route.\n * @param options - The operation options\n * @returns The application/json event route.\n */\n public getEventRoute(\n eventRouteId: string,\n options: OperationOptions = {},\n ): Promise<EventRoutesGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.getById(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * List the event routes in a digital twins instance.\n *\n * @param options - Options for listEventRoutes.\n * @returns The application/json event route.\n */\n public listEventRoutes(options?: ListEventRoutesOptions): PagedAsyncIterableIterator<EventRoute> {\n return this.client.eventRoutes.list(options);\n }\n\n /**\n * Create or update an event route.\n *\n * @param eventRouteId - The Id of the event route to create or update.\n * @param endpointId - The id of the endpoint this event route is bound to.\n * @param filter - An expression which describes the events which are routed to the endpoint.\n * @param options - The operation options\n\n */\n public upsertEventRoute(\n eventRouteId: string,\n endpointId: string,\n filter: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertEventRoute\",\n {\n eventRoute: {\n endpointName: endpointId,\n filter,\n },\n ...options,\n },\n async (updatedOptions) => {\n return this.client.eventRoutes.add(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Delete an event route.\n *\n * @param eventRouteId - The Id of the eventRoute to delete.\n * @param options - The operation options\n\n */\n public deleteEventRoute(eventRouteId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.delete(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Deals with the pagination of {@link query}.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n * @param continuationState - An object that indicates the position of the paginated request.\n *\n */\n private async *queryTwinsPage(\n query: string,\n options: QueryTwinsOptions,\n continuationState?: PageSettings,\n ): AsyncIterableIterator<QueryQueryTwinsResponse> {\n let { continuationToken } = continuationState ?? {};\n if (!continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n while (continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query, continuationToken }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n }\n\n /**\n * Deals with the iteration of all the available results of {@link query}.\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n */\n private async *queryTwinsAll(\n query: string,\n options: QueryTwinsOptions,\n ): AsyncIterableIterator<Record<string, unknown>> {\n for await (const page of this.queryTwinsPage(query, options)) {\n if (page.value) {\n yield* page.value;\n }\n }\n }\n\n /**\n * Query for digital twins.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Options for the query operation.\n * @returns The pageable list of query results.\n */\n public queryTwins(\n query: string,\n options: QueryTwinsOptions = {},\n ): PagedAsyncIterableIterator<Record<string, unknown>, QueryQueryTwinsResponse> {\n const iter = this.queryTwinsAll(query, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => this.queryTwinsPage(query, options, settings),\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"digitalTwinsClient.js","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AASlC,gDAA8C;AAC9C,iFAA8F;AAiC9F,6CAA6C;AAC7C,2CAAqC;AAerC,MAAM,0BAA0B,GAAG,yCAAyC,CAAC;AAE7E;;GAEG;AACH,MAAa,kBAAkB;IAM7B;;;;;;;;;;;;;;;OAeG;IACH,YACE,WAAmB,EACnB,UAA2B,EAC3B,UAAqC,EAAE;QAEvC,MAAM,uBAAuB,mCACxB,OAAO,KACV,cAAc,EAAE;gBACd,MAAM,EAAE,kBAAM,CAAC,IAAI;gBACnB,4BAA4B,EAAE,CAAC,iBAAiB,CAAC;aAClD,GACF,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,IAAI,8CAAe,iBAC/B,QAAQ,EAAE,WAAW,EACrB,UAAU,EACV,gBAAgB,EAAE,0BAA0B,IACzC,uBAAuB,EAC1B,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CACnB,aAAqB,EACrB,UAA4B,EAAE;QAE9B,OAAO,0BAAa,CAAC,QAAQ,CAC3B,mCAAmC,EACnC,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;YACvB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;QACzE,CAAC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACI,iBAAiB,CACtB,aAAqB,EACrB,eAAuB,EACvB,UAAyC,EAAE;QAE3C,OAAO,0BAAa,CAAC,QAAQ,CAC3B,sCAAsC,EACtC,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;YACvB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,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,OAAO,CAAC,CAAA,IAAA,uEAAE,CAAC;oBAAtC,cAAmC;oBAAnC,WAAmC;oBAAjD,MAAM,IAAI,KAAA,CAAA;oBACnB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;wBACf,sBAAA,KAAK,CAAC,CAAC,yBAAA,sBAAA,IAAI,CAAC,KAAK,CAAA,CAAA,CAAA,CAAC;oBACpB,CAAC;gBACH,CAAC;;;;;;;;;QACH,CAAC;KAAA;IAED;;;;;;OAMG;IACI,UAAU,CACf,KAAa,EACb,UAA6B,EAAE;QAE/B,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAEhD,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,CAAC,WAAyB,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;SACvF,CAAC;IACJ,CAAC;CACF;AArnBD,gDAqnBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n OperationOptions,\n InternalClientPipelineOptions,\n CommonClientOptions,\n} from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { AzureDigitalTwinsAPI as GeneratedClient } from \"./generated/azureDigitalTwinsAPI.js\";\nimport type {\n DigitalTwinsGetByIdResponse,\n DigitalTwinsAddOptionalParams,\n DigitalTwinsAddResponse,\n DigitalTwinsUpdateOptionalParams,\n DigitalTwinsUpdateResponse,\n DigitalTwinsDeleteOptionalParams,\n DigitalTwinsGetComponentResponse,\n DigitalTwinsUpdateComponentResponse,\n DigitalTwinsUpdateComponentOptionalParams,\n DigitalTwinsAddRelationshipResponse,\n DigitalTwinsAddRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipResponse,\n DigitalTwinsDeleteRelationshipOptionalParams,\n IncomingRelationship,\n DigitalTwinsGetRelationshipByIdResponse,\n DigitalTwinsModelData,\n DigitalTwinModelsGetByIdResponse,\n DigitalTwinModelsAddResponse,\n EventRoutesGetByIdResponse,\n EventRoute,\n QueryQueryTwinsResponse,\n} from \"./generated/models/index.js\";\nimport {\n DigitalTwinModelsGetByIdOptionalParams as GetModelOptions,\n DigitalTwinModelsListOptionalParams as ListModelsOptions,\n QueryQueryTwinsOptionalParams as QueryTwinsOptions,\n EventRoutesListOptionalParams as ListEventRoutesOptions,\n DigitalTwinsListRelationshipsOptionalParams as ListRelationshipsOptions,\n DigitalTwinsListIncomingRelationshipsOptionalParams as ListIncomingRelationshipsOptions,\n} from \"./generated/models/index.js\";\nimport { tracingClient } from \"./tracing.js\";\nimport { logger } from \"./logger.js\";\nexport {\n GetModelOptions,\n ListModelsOptions,\n QueryTwinsOptions,\n ListEventRoutesOptions,\n ListIncomingRelationshipsOptions,\n ListRelationshipsOptions,\n};\n\n/**\n * Options for the DigitalTwinsClient class\n */\nexport interface DigitalTwinsClientOptions extends CommonClientOptions {}\n\nconst DEFAULT_DIGITALTWINS_SCOPE = \"https://digitaltwins.azure.net/.default\";\n\n/**\n * Client for Azure IoT DigitalTwins API.\n */\nexport class DigitalTwinsClient {\n /**\n * A reference to the auto-generated AzureDigitalTwinsAPI\n */\n private readonly client: GeneratedClient;\n\n /**\n * Creates an instance of AzureDigitalTwinsAPI.\n *\n * Example usage:\n * ```ts\n * const { DigitalTwinsClient, ServiceClientCredentials } = require(\"@azure/digital-twins-core\");\n *\n * const client = new DigitalTwinsClient(\n * \"<endpoint>\",\n * new DefaultAzureCredential();\n * );\n * ```\n * @param endpointUrl - The endpoint URL of the service.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the service client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential,\n options: DigitalTwinsClientOptions = {},\n ) {\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-request-id\"],\n },\n };\n\n this.client = new GeneratedClient({\n endpoint: endpointUrl,\n credential,\n credentialScopes: DEFAULT_DIGITALTWINS_SCOPE,\n ...internalPipelineOptions,\n });\n }\n\n /**\n * Get a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param options - The operation options\n * @returns The application/json digital twin.\n */\n public getDigitalTwin(\n digitalTwinId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Create or update a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to create or update.\n * @param digitalTwinJson - The application/json digital twin to create.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n * @returns The created application/json digital twin.\n */\n public upsertDigitalTwin(\n digitalTwinId: string,\n digitalTwinJson: string,\n options: DigitalTwinsAddOptionalParams = {},\n ): Promise<DigitalTwinsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertDigitalTwin\",\n options,\n async (updatedOptions) => {\n const payload = JSON.parse(digitalTwinJson);\n return this.client.digitalTwins.add(digitalTwinId, payload, updatedOptions);\n },\n );\n }\n\n /**\n * Update a digital twin using a json patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param jsonPatch - An update specification described by JSON Patch. Updates to property values\n * and $model elements may happen in the same request. Operations are limited to add, replace and\n * remove.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateDigitalTwin(\n digitalTwinId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateOptionalParams = {},\n ): Promise<DigitalTwinsUpdateResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public deleteDigitalTwin(\n digitalTwinId: string,\n options: DigitalTwinsDeleteOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Get a component on a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being retrieved.\n * @param options - The operation options\n * @returns Json string representation of the component corresponding to the provided componentName.\n */\n public getComponent(\n digitalTwinId: string,\n componentName: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);\n },\n );\n }\n\n /**\n * Update properties of a component on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's component.\n * @param enableUpdate - If true then update of an existing digital twin is enabled.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateComponent(\n digitalTwinId: string,\n componentName: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateComponentOptionalParams = {},\n ): Promise<DigitalTwinsUpdateComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateComponent(\n digitalTwinId,\n componentName,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Get a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to retrieve.\n * @param options - The operation options\n * @returns The pageable list of application/json relationships belonging to the specified digital twin.\n */\n public getRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetRelationshipByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getRelationshipById(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Create or update a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to create.\n * @param relationship - The application/json relationship to be created.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n */\n public upsertRelationship(\n digitalTwinId: string,\n relationshipId: string,\n relationship: Record<string, unknown>,\n options: DigitalTwinsAddRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsAddRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.addRelationship(\n digitalTwinId,\n relationshipId,\n relationship,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Updates the properties of a relationship on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param relationshipId - The Id of the relationship to be updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's relationship.\n * @param options - Extended operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n */\n public updateRelationship(\n digitalTwinId: string,\n relationshipId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsUpdateRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateRelationship(\n digitalTwinId,\n relationshipId,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Delete a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to delete.\n * @param options - The operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is\n\n */\n public deleteRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: DigitalTwinsDeleteRelationshipOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.deleteRelationship(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Retrieve relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listRelationships(\n digitalTwinId: string,\n options?: ListRelationshipsOptions,\n ): PagedAsyncIterableIterator<Record<string, unknown>> {\n return this.client.digitalTwins.listRelationships(digitalTwinId, options);\n }\n\n /**\n * Retrieve all incoming relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listIncomingRelationships(\n digitalTwinId: string,\n options?: ListIncomingRelationshipsOptions,\n ): PagedAsyncIterableIterator<IncomingRelationship> {\n return this.client.digitalTwins.listIncomingRelationships(digitalTwinId, options);\n }\n\n /**\n * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishTelemetry(\n digitalTwinId: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendTelemetry(\n digitalTwinId,\n messageId || randomUUID(),\n payload,\n {\n ...updatedOptions,\n telemetrySourceTime: new Date().toISOString(),\n },\n );\n },\n );\n }\n\n /**\n * Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param componentName - The name of the DTDL component.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishComponentTelemetry(\n digitalTwinId: string,\n componentName: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishComponentTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendComponentTelemetry(\n digitalTwinId,\n componentName,\n messageId || randomUUID(),\n payload,\n { ...updatedOptions, telemetrySourceTime: new Date().toISOString() },\n );\n },\n );\n }\n\n /**\n * Get a model, including the model metadata and the model definition.\n *\n * @param modelId - The Id of the model.\n * @param options - Options for this operation\n * @returns The application/json model.\n */\n public getModel(\n modelId: string,\n options: GetModelOptions = {},\n ): Promise<DigitalTwinModelsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getModel\",\n {\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.getById(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get the list of models\n *\n * @param options - Options for listing models.\n * @returns A pageable set of application/json models.\n */\n public listModels(\n options: ListModelsOptions = {},\n ): PagedAsyncIterableIterator<DigitalTwinsModelData> {\n return this.client.digitalTwinModels.list({\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n });\n }\n\n /**\n * Create one or many\n *\n * @param dtdlModels - The set of models to create. Each string corresponds to exactly one model.\n * @param options - The operation options\n * @returns The created application/json models.\n */\n public createModels(\n dtdlModels: Array<Record<string, unknown>>,\n options: OperationOptions = {},\n ): Promise<DigitalTwinModelsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.createModels\",\n {\n ...options,\n models: dtdlModels,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.add(updatedOptions);\n },\n );\n }\n\n /**\n * Decommission a model using a json patch.\n * When a model is decommissioned, new digital twins will no longer be able to be\n * defined by this model. However, existing digital twins may continue to use this model.\n * Once a model is decommissioned, it may not be recommissioned.\n *\n * @param modelId - The Id of the model to decommission.\n * property can be replaced.\n * @param options - The operation options\n\n *\n */\n public decomissionModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n const jsonPatch = [{ op: \"replace\", path: \"/decommissioned\", value: true }];\n\n return tracingClient.withSpan(\n \"DigitalTwinsClient.decomissionModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a model.\n *\n * @param modelId - The Id of the model to delete.\n * @param options - The operation options\n\n */\n public deleteModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.delete(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get an event route.\n *\n * @param modelId - The Id of the event route.\n * @param options - The operation options\n * @returns The application/json event route.\n */\n public getEventRoute(\n eventRouteId: string,\n options: OperationOptions = {},\n ): Promise<EventRoutesGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.getById(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * List the event routes in a digital twins instance.\n *\n * @param options - Options for listEventRoutes.\n * @returns The application/json event route.\n */\n public listEventRoutes(options?: ListEventRoutesOptions): PagedAsyncIterableIterator<EventRoute> {\n return this.client.eventRoutes.list(options);\n }\n\n /**\n * Create or update an event route.\n *\n * @param eventRouteId - The Id of the event route to create or update.\n * @param endpointId - The id of the endpoint this event route is bound to.\n * @param filter - An expression which describes the events which are routed to the endpoint.\n * @param options - The operation options\n\n */\n public upsertEventRoute(\n eventRouteId: string,\n endpointId: string,\n filter: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertEventRoute\",\n {\n eventRoute: {\n endpointName: endpointId,\n filter,\n },\n ...options,\n },\n async (updatedOptions) => {\n return this.client.eventRoutes.add(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Delete an event route.\n *\n * @param eventRouteId - The Id of the eventRoute to delete.\n * @param options - The operation options\n\n */\n public deleteEventRoute(eventRouteId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.delete(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Deals with the pagination of {@link query}.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n * @param continuationState - An object that indicates the position of the paginated request.\n *\n */\n private async *queryTwinsPage(\n query: string,\n options: QueryTwinsOptions,\n continuationState?: PageSettings,\n ): AsyncIterableIterator<QueryQueryTwinsResponse> {\n let { continuationToken } = continuationState ?? {};\n if (!continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n while (continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query, continuationToken }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n }\n\n /**\n * Deals with the iteration of all the available results of {@link query}.\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n */\n private async *queryTwinsAll(\n query: string,\n options: QueryTwinsOptions,\n ): AsyncIterableIterator<Record<string, unknown>> {\n for await (const page of this.queryTwinsPage(query, options)) {\n if (page.value) {\n yield* page.value;\n }\n }\n }\n\n /**\n * Query for digital twins.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Options for the query operation.\n * @returns The pageable list of query results.\n */\n public queryTwins(\n query: string,\n options: QueryTwinsOptions = {},\n ): PagedAsyncIterableIterator<Record<string, unknown>, QueryQueryTwinsResponse> {\n const iter = this.queryTwinsAll(query, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => this.queryTwinsPage(query, options, settings),\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digitalTwinsClient.d.ts","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"digitalTwinsClient.d.ts","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAEhB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAgB,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGnF,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,EACvB,gCAAgC,EAChC,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,EAChC,mCAAmC,EACnC,yCAAyC,EACzC,mCAAmC,EACnC,yCAAyC,EACzC,4CAA4C,EAC5C,sCAAsC,EACtC,4CAA4C,EAC5C,oBAAoB,EACpB,uCAAuC,EACvC,qBAAqB,EACrB,gCAAgC,EAChC,4BAA4B,EAC5B,0BAA0B,EAC1B,UAAU,EACV,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,sCAAsC,IAAI,eAAe,EACzD,mCAAmC,IAAI,iBAAiB,EACxD,6BAA6B,IAAI,iBAAiB,EAClD,6BAA6B,IAAI,sBAAsB,EACvD,2CAA2C,I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AAC;gBACzB,MAAM,WAAW,GAAG,cAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAA,CAAC;gBAC9F,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC;gBAClD,oBAAM,WAAW,CAAA,CAAC;YACpB,CAAC;QACH,CAAC;KAAA;IAED;;;;OAIG;IACY,aAAa,CAC1B,KAAa,EACb,OAA0B;;;;gBAE1B,KAAyB,eAAA,KAAA,cAAA,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA,IAAA,+DAAE,CAAC;oBAAtC,cAAmC;oBAAnC,WAAmC;oBAAjD,MAAM,IAAI,KAAA,CAAA;oBACnB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;wBACf,cAAA,KAAK,CAAC,CAAC,iBAAA,cAAA,IAAI,CAAC,KAAK,CAAA,CAAA,CAAA,CAAC;oBACpB,CAAC;gBACH,CAAC;;;;;;;;;QACH,CAAC;KAAA;IAED;;;;;;OAMG;IACI,UAAU,CACf,KAAa,EACb,UAA6B,EAAE;QAE/B,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAEhD,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,CAAC,WAAyB,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;SACvF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport type {\n OperationOptions,\n InternalClientPipelineOptions,\n CommonClientOptions,\n} from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { AzureDigitalTwinsAPI as GeneratedClient } from \"./generated/azureDigitalTwinsAPI.js\";\nimport type {\n DigitalTwinsGetByIdResponse,\n DigitalTwinsAddOptionalParams,\n DigitalTwinsAddResponse,\n DigitalTwinsUpdateOptionalParams,\n DigitalTwinsUpdateResponse,\n DigitalTwinsDeleteOptionalParams,\n DigitalTwinsGetComponentResponse,\n DigitalTwinsUpdateComponentResponse,\n DigitalTwinsUpdateComponentOptionalParams,\n DigitalTwinsAddRelationshipResponse,\n DigitalTwinsAddRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipResponse,\n DigitalTwinsDeleteRelationshipOptionalParams,\n IncomingRelationship,\n DigitalTwinsGetRelationshipByIdResponse,\n DigitalTwinsModelData,\n DigitalTwinModelsGetByIdResponse,\n DigitalTwinModelsAddResponse,\n EventRoutesGetByIdResponse,\n EventRoute,\n QueryQueryTwinsResponse,\n} from \"./generated/models/index.js\";\nimport {\n DigitalTwinModelsGetByIdOptionalParams as GetModelOptions,\n DigitalTwinModelsListOptionalParams as ListModelsOptions,\n QueryQueryTwinsOptionalParams as QueryTwinsOptions,\n EventRoutesListOptionalParams as ListEventRoutesOptions,\n DigitalTwinsListRelationshipsOptionalParams as ListRelationshipsOptions,\n DigitalTwinsListIncomingRelationshipsOptionalParams as ListIncomingRelationshipsOptions,\n} from \"./generated/models/index.js\";\nimport { tracingClient } from \"./tracing.js\";\nimport { logger } from \"./logger.js\";\nexport {\n GetModelOptions,\n ListModelsOptions,\n QueryTwinsOptions,\n ListEventRoutesOptions,\n ListIncomingRelationshipsOptions,\n ListRelationshipsOptions,\n};\n\n/**\n * Options for the DigitalTwinsClient class\n */\nexport interface DigitalTwinsClientOptions extends CommonClientOptions {}\n\nconst DEFAULT_DIGITALTWINS_SCOPE = \"https://digitaltwins.azure.net/.default\";\n\n/**\n * Client for Azure IoT DigitalTwins API.\n */\nexport class DigitalTwinsClient {\n /**\n * A reference to the auto-generated AzureDigitalTwinsAPI\n */\n private readonly client: GeneratedClient;\n\n /**\n * Creates an instance of AzureDigitalTwinsAPI.\n *\n * Example usage:\n * ```ts\n * const { DigitalTwinsClient, ServiceClientCredentials } = require(\"@azure/digital-twins-core\");\n *\n * const client = new DigitalTwinsClient(\n * \"<endpoint>\",\n * new DefaultAzureCredential();\n * );\n * ```\n * @param endpointUrl - The endpoint URL of the service.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the service client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential,\n options: DigitalTwinsClientOptions = {},\n ) {\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-request-id\"],\n },\n };\n\n this.client = new GeneratedClient({\n endpoint: endpointUrl,\n credential,\n credentialScopes: DEFAULT_DIGITALTWINS_SCOPE,\n ...internalPipelineOptions,\n });\n }\n\n /**\n * Get a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param options - The operation options\n * @returns The application/json digital twin.\n */\n public getDigitalTwin(\n digitalTwinId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Create or update a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to create or update.\n * @param digitalTwinJson - The application/json digital twin to create.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n * @returns The created application/json digital twin.\n */\n public upsertDigitalTwin(\n digitalTwinId: string,\n digitalTwinJson: string,\n options: DigitalTwinsAddOptionalParams = {},\n ): Promise<DigitalTwinsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertDigitalTwin\",\n options,\n async (updatedOptions) => {\n const payload = JSON.parse(digitalTwinJson);\n return this.client.digitalTwins.add(digitalTwinId, payload, updatedOptions);\n },\n );\n }\n\n /**\n * Update a digital twin using a json patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param jsonPatch - An update specification described by JSON Patch. Updates to property values\n * and $model elements may happen in the same request. Operations are limited to add, replace and\n * remove.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateDigitalTwin(\n digitalTwinId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateOptionalParams = {},\n ): Promise<DigitalTwinsUpdateResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public deleteDigitalTwin(\n digitalTwinId: string,\n options: DigitalTwinsDeleteOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Get a component on a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being retrieved.\n * @param options - The operation options\n * @returns Json string representation of the component corresponding to the provided componentName.\n */\n public getComponent(\n digitalTwinId: string,\n componentName: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);\n },\n );\n }\n\n /**\n * Update properties of a component on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's component.\n * @param enableUpdate - If true then update of an existing digital twin is enabled.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateComponent(\n digitalTwinId: string,\n componentName: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateComponentOptionalParams = {},\n ): Promise<DigitalTwinsUpdateComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateComponent(\n digitalTwinId,\n componentName,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Get a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to retrieve.\n * @param options - The operation options\n * @returns The pageable list of application/json relationships belonging to the specified digital twin.\n */\n public getRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetRelationshipByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getRelationshipById(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Create or update a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to create.\n * @param relationship - The application/json relationship to be created.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n */\n public upsertRelationship(\n digitalTwinId: string,\n relationshipId: string,\n relationship: Record<string, unknown>,\n options: DigitalTwinsAddRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsAddRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.addRelationship(\n digitalTwinId,\n relationshipId,\n relationship,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Updates the properties of a relationship on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param relationshipId - The Id of the relationship to be updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's relationship.\n * @param options - Extended operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n */\n public updateRelationship(\n digitalTwinId: string,\n relationshipId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsUpdateRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateRelationship(\n digitalTwinId,\n relationshipId,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Delete a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to delete.\n * @param options - The operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is\n\n */\n public deleteRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: DigitalTwinsDeleteRelationshipOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.deleteRelationship(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Retrieve relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listRelationships(\n digitalTwinId: string,\n options?: ListRelationshipsOptions,\n ): PagedAsyncIterableIterator<Record<string, unknown>> {\n return this.client.digitalTwins.listRelationships(digitalTwinId, options);\n }\n\n /**\n * Retrieve all incoming relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listIncomingRelationships(\n digitalTwinId: string,\n options?: ListIncomingRelationshipsOptions,\n ): PagedAsyncIterableIterator<IncomingRelationship> {\n return this.client.digitalTwins.listIncomingRelationships(digitalTwinId, options);\n }\n\n /**\n * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishTelemetry(\n digitalTwinId: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendTelemetry(\n digitalTwinId,\n messageId || randomUUID(),\n payload,\n {\n ...updatedOptions,\n telemetrySourceTime: new Date().toISOString(),\n },\n );\n },\n );\n }\n\n /**\n * Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param componentName - The name of the DTDL component.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishComponentTelemetry(\n digitalTwinId: string,\n componentName: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishComponentTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendComponentTelemetry(\n digitalTwinId,\n componentName,\n messageId || randomUUID(),\n payload,\n { ...updatedOptions, telemetrySourceTime: new Date().toISOString() },\n );\n },\n );\n }\n\n /**\n * Get a model, including the model metadata and the model definition.\n *\n * @param modelId - The Id of the model.\n * @param options - Options for this operation\n * @returns The application/json model.\n */\n public getModel(\n modelId: string,\n options: GetModelOptions = {},\n ): Promise<DigitalTwinModelsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getModel\",\n {\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.getById(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get the list of models\n *\n * @param options - Options for listing models.\n * @returns A pageable set of application/json models.\n */\n public listModels(\n options: ListModelsOptions = {},\n ): PagedAsyncIterableIterator<DigitalTwinsModelData> {\n return this.client.digitalTwinModels.list({\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n });\n }\n\n /**\n * Create one or many\n *\n * @param dtdlModels - The set of models to create. Each string corresponds to exactly one model.\n * @param options - The operation options\n * @returns The created application/json models.\n */\n public createModels(\n dtdlModels: Array<Record<string, unknown>>,\n options: OperationOptions = {},\n ): Promise<DigitalTwinModelsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.createModels\",\n {\n ...options,\n models: dtdlModels,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.add(updatedOptions);\n },\n );\n }\n\n /**\n * Decommission a model using a json patch.\n * When a model is decommissioned, new digital twins will no longer be able to be\n * defined by this model. However, existing digital twins may continue to use this model.\n * Once a model is decommissioned, it may not be recommissioned.\n *\n * @param modelId - The Id of the model to decommission.\n * property can be replaced.\n * @param options - The operation options\n\n *\n */\n public decomissionModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n const jsonPatch = [{ op: \"replace\", path: \"/decommissioned\", value: true }];\n\n return tracingClient.withSpan(\n \"DigitalTwinsClient.decomissionModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a model.\n *\n * @param modelId - The Id of the model to delete.\n * @param options - The operation options\n\n */\n public deleteModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.delete(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get an event route.\n *\n * @param modelId - The Id of the event route.\n * @param options - The operation options\n * @returns The application/json event route.\n */\n public getEventRoute(\n eventRouteId: string,\n options: OperationOptions = {},\n ): Promise<EventRoutesGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.getById(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * List the event routes in a digital twins instance.\n *\n * @param options - Options for listEventRoutes.\n * @returns The application/json event route.\n */\n public listEventRoutes(options?: ListEventRoutesOptions): PagedAsyncIterableIterator<EventRoute> {\n return this.client.eventRoutes.list(options);\n }\n\n /**\n * Create or update an event route.\n *\n * @param eventRouteId - The Id of the event route to create or update.\n * @param endpointId - The id of the endpoint this event route is bound to.\n * @param filter - An expression which describes the events which are routed to the endpoint.\n * @param options - The operation options\n\n */\n public upsertEventRoute(\n eventRouteId: string,\n endpointId: string,\n filter: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertEventRoute\",\n {\n eventRoute: {\n endpointName: endpointId,\n filter,\n },\n ...options,\n },\n async (updatedOptions) => {\n return this.client.eventRoutes.add(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Delete an event route.\n *\n * @param eventRouteId - The Id of the eventRoute to delete.\n * @param options - The operation options\n\n */\n public deleteEventRoute(eventRouteId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.delete(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Deals with the pagination of {@link query}.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n * @param continuationState - An object that indicates the position of the paginated request.\n *\n */\n private async *queryTwinsPage(\n query: string,\n options: QueryTwinsOptions,\n continuationState?: PageSettings,\n ): AsyncIterableIterator<QueryQueryTwinsResponse> {\n let { continuationToken } = continuationState ?? {};\n if (!continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n while (continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query, continuationToken }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n }\n\n /**\n * Deals with the iteration of all the available results of {@link query}.\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n */\n private async *queryTwinsAll(\n query: string,\n options: QueryTwinsOptions,\n ): AsyncIterableIterator<Record<string, unknown>> {\n for await (const page of this.queryTwinsPage(query, options)) {\n if (page.value) {\n yield* page.value;\n }\n }\n }\n\n /**\n * Query for digital twins.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Options for the query operation.\n * @returns The pageable list of query results.\n */\n public queryTwins(\n query: string,\n options: QueryTwinsOptions = {},\n ): PagedAsyncIterableIterator<Record<string, unknown>, QueryQueryTwinsResponse> {\n const iter = this.queryTwinsAll(query, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => this.queryTwinsPage(query, options, settings),\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"digitalTwinsClient.js","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AASlC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,IAAI,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAiC9F,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAerC,MAAM,0BAA0B,GAAG,yCAAyC,CAAC;AAE7E;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAM7B;;;;;;;;;;;;;;;OAeG;IACH,YACE,WAAmB,EACnB,UAA2B,EAC3B,UAAqC,EAAE;QAEvC,MAAM,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AC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,CAAC,WAAyB,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;SACvF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n OperationOptions,\n InternalClientPipelineOptions,\n CommonClientOptions,\n} from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { AzureDigitalTwinsAPI as GeneratedClient } from \"./generated/azureDigitalTwinsAPI.js\";\nimport type {\n DigitalTwinsGetByIdResponse,\n DigitalTwinsAddOptionalParams,\n DigitalTwinsAddResponse,\n DigitalTwinsUpdateOptionalParams,\n DigitalTwinsUpdateResponse,\n DigitalTwinsDeleteOptionalParams,\n DigitalTwinsGetComponentResponse,\n DigitalTwinsUpdateComponentResponse,\n DigitalTwinsUpdateComponentOptionalParams,\n DigitalTwinsAddRelationshipResponse,\n DigitalTwinsAddRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipResponse,\n DigitalTwinsDeleteRelationshipOptionalParams,\n IncomingRelationship,\n DigitalTwinsGetRelationshipByIdResponse,\n DigitalTwinsModelData,\n DigitalTwinModelsGetByIdResponse,\n DigitalTwinModelsAddResponse,\n EventRoutesGetByIdResponse,\n EventRoute,\n QueryQueryTwinsResponse,\n} from \"./generated/models/index.js\";\nimport {\n DigitalTwinModelsGetByIdOptionalParams as GetModelOptions,\n DigitalTwinModelsListOptionalParams as ListModelsOptions,\n QueryQueryTwinsOptionalParams as QueryTwinsOptions,\n EventRoutesListOptionalParams as ListEventRoutesOptions,\n DigitalTwinsListRelationshipsOptionalParams as ListRelationshipsOptions,\n DigitalTwinsListIncomingRelationshipsOptionalParams as ListIncomingRelationshipsOptions,\n} from \"./generated/models/index.js\";\nimport { tracingClient } from \"./tracing.js\";\nimport { logger } from \"./logger.js\";\nexport {\n GetModelOptions,\n ListModelsOptions,\n QueryTwinsOptions,\n ListEventRoutesOptions,\n ListIncomingRelationshipsOptions,\n ListRelationshipsOptions,\n};\n\n/**\n * Options for the DigitalTwinsClient class\n */\nexport interface DigitalTwinsClientOptions extends CommonClientOptions {}\n\nconst DEFAULT_DIGITALTWINS_SCOPE = \"https://digitaltwins.azure.net/.default\";\n\n/**\n * Client for Azure IoT DigitalTwins API.\n */\nexport class DigitalTwinsClient {\n /**\n * A reference to the auto-generated AzureDigitalTwinsAPI\n */\n private readonly client: GeneratedClient;\n\n /**\n * Creates an instance of AzureDigitalTwinsAPI.\n *\n * Example usage:\n * ```ts\n * const { DigitalTwinsClient, ServiceClientCredentials } = require(\"@azure/digital-twins-core\");\n *\n * const client = new DigitalTwinsClient(\n * \"<endpoint>\",\n * new DefaultAzureCredential();\n * );\n * ```\n * @param endpointUrl - The endpoint URL of the service.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the service client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential,\n options: DigitalTwinsClientOptions = {},\n ) {\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-request-id\"],\n },\n };\n\n this.client = new GeneratedClient({\n endpoint: endpointUrl,\n credential,\n credentialScopes: DEFAULT_DIGITALTWINS_SCOPE,\n ...internalPipelineOptions,\n });\n }\n\n /**\n * Get a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param options - The operation options\n * @returns The application/json digital twin.\n */\n public getDigitalTwin(\n digitalTwinId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Create or update a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to create or update.\n * @param digitalTwinJson - The application/json digital twin to create.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n * @returns The created application/json digital twin.\n */\n public upsertDigitalTwin(\n digitalTwinId: string,\n digitalTwinJson: string,\n options: DigitalTwinsAddOptionalParams = {},\n ): Promise<DigitalTwinsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertDigitalTwin\",\n options,\n async (updatedOptions) => {\n const payload = JSON.parse(digitalTwinJson);\n return this.client.digitalTwins.add(digitalTwinId, payload, updatedOptions);\n },\n );\n }\n\n /**\n * Update a digital twin using a json patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param jsonPatch - An update specification described by JSON Patch. Updates to property values\n * and $model elements may happen in the same request. Operations are limited to add, replace and\n * remove.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateDigitalTwin(\n digitalTwinId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateOptionalParams = {},\n ): Promise<DigitalTwinsUpdateResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public deleteDigitalTwin(\n digitalTwinId: string,\n options: DigitalTwinsDeleteOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Get a component on a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being retrieved.\n * @param options - The operation options\n * @returns Json string representation of the component corresponding to the provided componentName.\n */\n public getComponent(\n digitalTwinId: string,\n componentName: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);\n },\n );\n }\n\n /**\n * Update properties of a component on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's component.\n * @param enableUpdate - If true then update of an existing digital twin is enabled.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateComponent(\n digitalTwinId: string,\n componentName: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateComponentOptionalParams = {},\n ): Promise<DigitalTwinsUpdateComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateComponent(\n digitalTwinId,\n componentName,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Get a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to retrieve.\n * @param options - The operation options\n * @returns The pageable list of application/json relationships belonging to the specified digital twin.\n */\n public getRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetRelationshipByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getRelationshipById(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Create or update a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to create.\n * @param relationship - The application/json relationship to be created.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n */\n public upsertRelationship(\n digitalTwinId: string,\n relationshipId: string,\n relationship: Record<string, unknown>,\n options: DigitalTwinsAddRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsAddRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.addRelationship(\n digitalTwinId,\n relationshipId,\n relationship,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Updates the properties of a relationship on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param relationshipId - The Id of the relationship to be updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's relationship.\n * @param options - Extended operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n */\n public updateRelationship(\n digitalTwinId: string,\n relationshipId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsUpdateRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateRelationship(\n digitalTwinId,\n relationshipId,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Delete a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to delete.\n * @param options - The operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is\n\n */\n public deleteRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: DigitalTwinsDeleteRelationshipOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.deleteRelationship(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Retrieve relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listRelationships(\n digitalTwinId: string,\n options?: ListRelationshipsOptions,\n ): PagedAsyncIterableIterator<Record<string, unknown>> {\n return this.client.digitalTwins.listRelationships(digitalTwinId, options);\n }\n\n /**\n * Retrieve all incoming relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listIncomingRelationships(\n digitalTwinId: string,\n options?: ListIncomingRelationshipsOptions,\n ): PagedAsyncIterableIterator<IncomingRelationship> {\n return this.client.digitalTwins.listIncomingRelationships(digitalTwinId, options);\n }\n\n /**\n * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishTelemetry(\n digitalTwinId: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendTelemetry(\n digitalTwinId,\n messageId || randomUUID(),\n payload,\n {\n ...updatedOptions,\n telemetrySourceTime: new Date().toISOString(),\n },\n );\n },\n );\n }\n\n /**\n * Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param componentName - The name of the DTDL component.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishComponentTelemetry(\n digitalTwinId: string,\n componentName: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishComponentTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendComponentTelemetry(\n digitalTwinId,\n componentName,\n messageId || randomUUID(),\n payload,\n { ...updatedOptions, telemetrySourceTime: new Date().toISOString() },\n );\n },\n );\n }\n\n /**\n * Get a model, including the model metadata and the model definition.\n *\n * @param modelId - The Id of the model.\n * @param options - Options for this operation\n * @returns The application/json model.\n */\n public getModel(\n modelId: string,\n options: GetModelOptions = {},\n ): Promise<DigitalTwinModelsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getModel\",\n {\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.getById(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get the list of models\n *\n * @param options - Options for listing models.\n * @returns A pageable set of application/json models.\n */\n public listModels(\n options: ListModelsOptions = {},\n ): PagedAsyncIterableIterator<DigitalTwinsModelData> {\n return this.client.digitalTwinModels.list({\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n });\n }\n\n /**\n * Create one or many\n *\n * @param dtdlModels - The set of models to create. Each string corresponds to exactly one model.\n * @param options - The operation options\n * @returns The created application/json models.\n */\n public createModels(\n dtdlModels: Array<Record<string, unknown>>,\n options: OperationOptions = {},\n ): Promise<DigitalTwinModelsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.createModels\",\n {\n ...options,\n models: dtdlModels,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.add(updatedOptions);\n },\n );\n }\n\n /**\n * Decommission a model using a json patch.\n * When a model is decommissioned, new digital twins will no longer be able to be\n * defined by this model. However, existing digital twins may continue to use this model.\n * Once a model is decommissioned, it may not be recommissioned.\n *\n * @param modelId - The Id of the model to decommission.\n * property can be replaced.\n * @param options - The operation options\n\n *\n */\n public decomissionModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n const jsonPatch = [{ op: \"replace\", path: \"/decommissioned\", value: true }];\n\n return tracingClient.withSpan(\n \"DigitalTwinsClient.decomissionModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a model.\n *\n * @param modelId - The Id of the model to delete.\n * @param options - The operation options\n\n */\n public deleteModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.delete(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get an event route.\n *\n * @param modelId - The Id of the event route.\n * @param options - The operation options\n * @returns The application/json event route.\n */\n public getEventRoute(\n eventRouteId: string,\n options: OperationOptions = {},\n ): Promise<EventRoutesGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.getById(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * List the event routes in a digital twins instance.\n *\n * @param options - Options for listEventRoutes.\n * @returns The application/json event route.\n */\n public listEventRoutes(options?: ListEventRoutesOptions): PagedAsyncIterableIterator<EventRoute> {\n return this.client.eventRoutes.list(options);\n }\n\n /**\n * Create or update an event route.\n *\n * @param eventRouteId - The Id of the event route to create or update.\n * @param endpointId - The id of the endpoint this event route is bound to.\n * @param filter - An expression which describes the events which are routed to the endpoint.\n * @param options - The operation options\n\n */\n public upsertEventRoute(\n eventRouteId: string,\n endpointId: string,\n filter: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertEventRoute\",\n {\n eventRoute: {\n endpointName: endpointId,\n filter,\n },\n ...options,\n },\n async (updatedOptions) => {\n return this.client.eventRoutes.add(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Delete an event route.\n *\n * @param eventRouteId - The Id of the eventRoute to delete.\n * @param options - The operation options\n\n */\n public deleteEventRoute(eventRouteId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.delete(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Deals with the pagination of {@link query}.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n * @param continuationState - An object that indicates the position of the paginated request.\n *\n */\n private async *queryTwinsPage(\n query: string,\n options: QueryTwinsOptions,\n continuationState?: PageSettings,\n ): AsyncIterableIterator<QueryQueryTwinsResponse> {\n let { continuationToken } = continuationState ?? {};\n if (!continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n while (continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query, continuationToken }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n }\n\n /**\n * Deals with the iteration of all the available results of {@link query}.\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n */\n private async *queryTwinsAll(\n query: string,\n options: QueryTwinsOptions,\n ): AsyncIterableIterator<Record<string, unknown>> {\n for await (const page of this.queryTwinsPage(query, options)) {\n if (page.value) {\n yield* page.value;\n }\n }\n }\n\n /**\n * Query for digital twins.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Options for the query operation.\n * @returns The pageable list of query results.\n */\n public queryTwins(\n query: string,\n options: QueryTwinsOptions = {},\n ): PagedAsyncIterableIterator<Record<string, unknown>, QueryQueryTwinsResponse> {\n const iter = this.queryTwinsAll(query, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => this.queryTwinsPage(query, options, settings),\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digitalTwinsClient.d.ts","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"digitalTwinsClient.d.ts","sourceRoot":"","sources":["../../src/digitalTwins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,EAAE,CAAC;wBACf,cAAA,KAAK,CAAC,CAAC,iBAAA,cAAA,IAAI,CAAC,KAAK,CAAA,CAAA,CAAA,CAAC;oBACpB,CAAC;gBACH,CAAC;;;;;;;;;QACH,CAAC;KAAA;IAED;;;;;;OAMG;IACI,UAAU,CACf,KAAa,EACb,UAA6B,EAAE;QAE/B,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAEhD,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,CAAC,WAAyB,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;SACvF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport type {\n OperationOptions,\n InternalClientPipelineOptions,\n CommonClientOptions,\n} from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { AzureDigitalTwinsAPI as GeneratedClient } from \"./generated/azureDigitalTwinsAPI.js\";\nimport type {\n DigitalTwinsGetByIdResponse,\n DigitalTwinsAddOptionalParams,\n DigitalTwinsAddResponse,\n DigitalTwinsUpdateOptionalParams,\n DigitalTwinsUpdateResponse,\n DigitalTwinsDeleteOptionalParams,\n DigitalTwinsGetComponentResponse,\n DigitalTwinsUpdateComponentResponse,\n DigitalTwinsUpdateComponentOptionalParams,\n DigitalTwinsAddRelationshipResponse,\n DigitalTwinsAddRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipResponse,\n DigitalTwinsDeleteRelationshipOptionalParams,\n IncomingRelationship,\n DigitalTwinsGetRelationshipByIdResponse,\n DigitalTwinsModelData,\n DigitalTwinModelsGetByIdResponse,\n DigitalTwinModelsAddResponse,\n EventRoutesGetByIdResponse,\n EventRoute,\n QueryQueryTwinsResponse,\n} from \"./generated/models/index.js\";\nimport {\n DigitalTwinModelsGetByIdOptionalParams as GetModelOptions,\n DigitalTwinModelsListOptionalParams as ListModelsOptions,\n QueryQueryTwinsOptionalParams as QueryTwinsOptions,\n EventRoutesListOptionalParams as ListEventRoutesOptions,\n DigitalTwinsListRelationshipsOptionalParams as ListRelationshipsOptions,\n DigitalTwinsListIncomingRelationshipsOptionalParams as ListIncomingRelationshipsOptions,\n} from \"./generated/models/index.js\";\nimport { tracingClient } from \"./tracing.js\";\nimport { logger } from \"./logger.js\";\nexport {\n GetModelOptions,\n ListModelsOptions,\n QueryTwinsOptions,\n ListEventRoutesOptions,\n ListIncomingRelationshipsOptions,\n ListRelationshipsOptions,\n};\n\n/**\n * Options for the DigitalTwinsClient class\n */\nexport interface DigitalTwinsClientOptions extends CommonClientOptions {}\n\nconst DEFAULT_DIGITALTWINS_SCOPE = \"https://digitaltwins.azure.net/.default\";\n\n/**\n * Client for Azure IoT DigitalTwins API.\n */\nexport class DigitalTwinsClient {\n /**\n * A reference to the auto-generated AzureDigitalTwinsAPI\n */\n private readonly client: GeneratedClient;\n\n /**\n * Creates an instance of AzureDigitalTwinsAPI.\n *\n * Example usage:\n * ```ts\n * const { DigitalTwinsClient, ServiceClientCredentials } = require(\"@azure/digital-twins-core\");\n *\n * const client = new DigitalTwinsClient(\n * \"<endpoint>\",\n * new DefaultAzureCredential();\n * );\n * ```\n * @param endpointUrl - The endpoint URL of the service.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the service client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential,\n options: DigitalTwinsClientOptions = {},\n ) {\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-request-id\"],\n },\n };\n\n this.client = new GeneratedClient({\n endpoint: endpointUrl,\n credential,\n credentialScopes: DEFAULT_DIGITALTWINS_SCOPE,\n ...internalPipelineOptions,\n });\n }\n\n /**\n * Get a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param options - The operation options\n * @returns The application/json digital twin.\n */\n public getDigitalTwin(\n digitalTwinId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Create or update a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to create or update.\n * @param digitalTwinJson - The application/json digital twin to create.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n * @returns The created application/json digital twin.\n */\n public upsertDigitalTwin(\n digitalTwinId: string,\n digitalTwinJson: string,\n options: DigitalTwinsAddOptionalParams = {},\n ): Promise<DigitalTwinsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertDigitalTwin\",\n options,\n async (updatedOptions) => {\n const payload = JSON.parse(digitalTwinJson);\n return this.client.digitalTwins.add(digitalTwinId, payload, updatedOptions);\n },\n );\n }\n\n /**\n * Update a digital twin using a json patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param jsonPatch - An update specification described by JSON Patch. Updates to property values\n * and $model elements may happen in the same request. Operations are limited to add, replace and\n * remove.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateDigitalTwin(\n digitalTwinId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateOptionalParams = {},\n ): Promise<DigitalTwinsUpdateResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public deleteDigitalTwin(\n digitalTwinId: string,\n options: DigitalTwinsDeleteOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Get a component on a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being retrieved.\n * @param options - The operation options\n * @returns Json string representation of the component corresponding to the provided componentName.\n */\n public getComponent(\n digitalTwinId: string,\n componentName: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);\n },\n );\n }\n\n /**\n * Update properties of a component on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's component.\n * @param enableUpdate - If true then update of an existing digital twin is enabled.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateComponent(\n digitalTwinId: string,\n componentName: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateComponentOptionalParams = {},\n ): Promise<DigitalTwinsUpdateComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateComponent(\n digitalTwinId,\n componentName,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Get a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to retrieve.\n * @param options - The operation options\n * @returns The pageable list of application/json relationships belonging to the specified digital twin.\n */\n public getRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetRelationshipByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getRelationshipById(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Create or update a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to create.\n * @param relationship - The application/json relationship to be created.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n */\n public upsertRelationship(\n digitalTwinId: string,\n relationshipId: string,\n relationship: Record<string, unknown>,\n options: DigitalTwinsAddRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsAddRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.addRelationship(\n digitalTwinId,\n relationshipId,\n relationship,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Updates the properties of a relationship on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param relationshipId - The Id of the relationship to be updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's relationship.\n * @param options - Extended operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n */\n public updateRelationship(\n digitalTwinId: string,\n relationshipId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsUpdateRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateRelationship(\n digitalTwinId,\n relationshipId,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Delete a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to delete.\n * @param options - The operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is\n\n */\n public deleteRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: DigitalTwinsDeleteRelationshipOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.deleteRelationship(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Retrieve relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listRelationships(\n digitalTwinId: string,\n options?: ListRelationshipsOptions,\n ): PagedAsyncIterableIterator<Record<string, unknown>> {\n return this.client.digitalTwins.listRelationships(digitalTwinId, options);\n }\n\n /**\n * Retrieve all incoming relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listIncomingRelationships(\n digitalTwinId: string,\n options?: ListIncomingRelationshipsOptions,\n ): PagedAsyncIterableIterator<IncomingRelationship> {\n return this.client.digitalTwins.listIncomingRelationships(digitalTwinId, options);\n }\n\n /**\n * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishTelemetry(\n digitalTwinId: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendTelemetry(\n digitalTwinId,\n messageId || randomUUID(),\n payload,\n {\n ...updatedOptions,\n telemetrySourceTime: new Date().toISOString(),\n },\n );\n },\n );\n }\n\n /**\n * Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param componentName - The name of the DTDL component.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishComponentTelemetry(\n digitalTwinId: string,\n componentName: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishComponentTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendComponentTelemetry(\n digitalTwinId,\n componentName,\n messageId || randomUUID(),\n payload,\n { ...updatedOptions, telemetrySourceTime: new Date().toISOString() },\n );\n },\n );\n }\n\n /**\n * Get a model, including the model metadata and the model definition.\n *\n * @param modelId - The Id of the model.\n * @param options - Options for this operation\n * @returns The application/json model.\n */\n public getModel(\n modelId: string,\n options: GetModelOptions = {},\n ): Promise<DigitalTwinModelsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getModel\",\n {\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.getById(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get the list of models\n *\n * @param options - Options for listing models.\n * @returns A pageable set of application/json models.\n */\n public listModels(\n options: ListModelsOptions = {},\n ): PagedAsyncIterableIterator<DigitalTwinsModelData> {\n return this.client.digitalTwinModels.list({\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n });\n }\n\n /**\n * Create one or many\n *\n * @param dtdlModels - The set of models to create. Each string corresponds to exactly one model.\n * @param options - The operation options\n * @returns The created application/json models.\n */\n public createModels(\n dtdlModels: Array<Record<string, unknown>>,\n options: OperationOptions = {},\n ): Promise<DigitalTwinModelsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.createModels\",\n {\n ...options,\n models: dtdlModels,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.add(updatedOptions);\n },\n );\n }\n\n /**\n * Decommission a model using a json patch.\n * When a model is decommissioned, new digital twins will no longer be able to be\n * defined by this model. However, existing digital twins may continue to use this model.\n * Once a model is decommissioned, it may not be recommissioned.\n *\n * @param modelId - The Id of the model to decommission.\n * property can be replaced.\n * @param options - The operation options\n\n *\n */\n public decomissionModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n const jsonPatch = [{ op: \"replace\", path: \"/decommissioned\", value: true }];\n\n return tracingClient.withSpan(\n \"DigitalTwinsClient.decomissionModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a model.\n *\n * @param modelId - The Id of the model to delete.\n * @param options - The operation options\n\n */\n public deleteModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.delete(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get an event route.\n *\n * @param modelId - The Id of the event route.\n * @param options - The operation options\n * @returns The application/json event route.\n */\n public getEventRoute(\n eventRouteId: string,\n options: OperationOptions = {},\n ): Promise<EventRoutesGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.getById(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * List the event routes in a digital twins instance.\n *\n * @param options - Options for listEventRoutes.\n * @returns The application/json event route.\n */\n public listEventRoutes(options?: ListEventRoutesOptions): PagedAsyncIterableIterator<EventRoute> {\n return this.client.eventRoutes.list(options);\n }\n\n /**\n * Create or update an event route.\n *\n * @param eventRouteId - The Id of the event route to create or update.\n * @param endpointId - The id of the endpoint this event route is bound to.\n * @param filter - An expression which describes the events which are routed to the endpoint.\n * @param options - The operation options\n\n */\n public upsertEventRoute(\n eventRouteId: string,\n endpointId: string,\n filter: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertEventRoute\",\n {\n eventRoute: {\n endpointName: endpointId,\n filter,\n },\n ...options,\n },\n async (updatedOptions) => {\n return this.client.eventRoutes.add(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Delete an event route.\n *\n * @param eventRouteId - The Id of the eventRoute to delete.\n * @param options - The operation options\n\n */\n public deleteEventRoute(eventRouteId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.delete(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Deals with the pagination of {@link query}.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n * @param continuationState - An object that indicates the position of the paginated request.\n *\n */\n private async *queryTwinsPage(\n query: string,\n options: QueryTwinsOptions,\n continuationState?: PageSettings,\n ): AsyncIterableIterator<QueryQueryTwinsResponse> {\n let { continuationToken } = continuationState ?? {};\n if (!continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n while (continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query, continuationToken }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n }\n\n /**\n * Deals with the iteration of all the available results of {@link query}.\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n */\n private async *queryTwinsAll(\n query: string,\n options: QueryTwinsOptions,\n ): AsyncIterableIterator<Record<string, unknown>> {\n for await (const page of this.queryTwinsPage(query, options)) {\n if (page.value) {\n yield* page.value;\n }\n }\n }\n\n /**\n * Query for digital twins.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Options for the query operation.\n * @returns The pageable list of query results.\n */\n public queryTwins(\n query: string,\n options: QueryTwinsOptions = {},\n ): PagedAsyncIterableIterator<Record<string, unknown>, QueryQueryTwinsResponse> {\n const iter = this.queryTwinsAll(query, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => this.queryTwinsPage(query, options, settings),\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"digitalTwinsClient.js","sourceRoot":"","sources":["../../src/digitalTwinsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AASlC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,IAAI,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAiC9F,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAerC,MAAM,0BAA0B,GAAG,yCAAyC,CAAC;AAE7E;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAM7B;;;;;;;;;;;;;;;OAeG;IACH,YACE,WAAmB,EACnB,UAA2B,EAC3B,UAAqC,EAAE;QAEvC,MAAM,uBAAuB,mCACxB,OAAO,KACV,cAAc,EAAE;gBACd,MAAM,EAAE,MAAM,CAAC,IAAI;gBACnB,4BAA4B,EAAE,CAAC,iBAAiB,CAAC;aAClD,GACF,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,IAAI,eAAe,iBAC/B,QAAQ,EAAE,WAAW,EACrB,UAAU,EACV,gBAAgB,EAAE,0BAA0B,IACzC,uBAAuB,EAC1B,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CACnB,aAAqB,EACrB,UAA4B,EAAE;QAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,mCAAmC,EACnC,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;YACvB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,cAA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,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC;gBAClD,oBAAM,WAAW,CAAA,CAAC;YACpB,CAAC;QACH,CAAC;KAAA;IAED;;;;OAIG;IACY,aAAa,CAC1B,KAAa,EACb,OAA0B;;;;gBAE1B,KAAyB,eAAA,KAAA,cAAA,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA,IAAA,+DAAE,CAAC;oBAAtC,cAAmC;oBAAnC,WAAmC;oBAAjD,MAAM,IAAI,KAAA,CAAA;oBACnB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;wBACf,cAAA,KAAK,CAAC,CAAC,iBAAA,cAAA,IAAI,CAAC,KAAK,CAAA,CAAA,CAAA,CAAC;oBACpB,CAAC;gBACH,CAAC;;;;;;;;;QACH,CAAC;KAAA;IAED;;;;;;OAMG;IACI,UAAU,CACf,KAAa,EACb,UAA6B,EAAE;QAE/B,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAEhD,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,CAAC,WAAyB,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;SACvF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n OperationOptions,\n InternalClientPipelineOptions,\n CommonClientOptions,\n} from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { AzureDigitalTwinsAPI as GeneratedClient } from \"./generated/azureDigitalTwinsAPI.js\";\nimport type {\n DigitalTwinsGetByIdResponse,\n DigitalTwinsAddOptionalParams,\n DigitalTwinsAddResponse,\n DigitalTwinsUpdateOptionalParams,\n DigitalTwinsUpdateResponse,\n DigitalTwinsDeleteOptionalParams,\n DigitalTwinsGetComponentResponse,\n DigitalTwinsUpdateComponentResponse,\n DigitalTwinsUpdateComponentOptionalParams,\n DigitalTwinsAddRelationshipResponse,\n DigitalTwinsAddRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipOptionalParams,\n DigitalTwinsUpdateRelationshipResponse,\n DigitalTwinsDeleteRelationshipOptionalParams,\n IncomingRelationship,\n DigitalTwinsGetRelationshipByIdResponse,\n DigitalTwinsModelData,\n DigitalTwinModelsGetByIdResponse,\n DigitalTwinModelsAddResponse,\n EventRoutesGetByIdResponse,\n EventRoute,\n QueryQueryTwinsResponse,\n} from \"./generated/models/index.js\";\nimport {\n DigitalTwinModelsGetByIdOptionalParams as GetModelOptions,\n DigitalTwinModelsListOptionalParams as ListModelsOptions,\n QueryQueryTwinsOptionalParams as QueryTwinsOptions,\n EventRoutesListOptionalParams as ListEventRoutesOptions,\n DigitalTwinsListRelationshipsOptionalParams as ListRelationshipsOptions,\n DigitalTwinsListIncomingRelationshipsOptionalParams as ListIncomingRelationshipsOptions,\n} from \"./generated/models/index.js\";\nimport { tracingClient } from \"./tracing.js\";\nimport { logger } from \"./logger.js\";\nexport {\n GetModelOptions,\n ListModelsOptions,\n QueryTwinsOptions,\n ListEventRoutesOptions,\n ListIncomingRelationshipsOptions,\n ListRelationshipsOptions,\n};\n\n/**\n * Options for the DigitalTwinsClient class\n */\nexport interface DigitalTwinsClientOptions extends CommonClientOptions {}\n\nconst DEFAULT_DIGITALTWINS_SCOPE = \"https://digitaltwins.azure.net/.default\";\n\n/**\n * Client for Azure IoT DigitalTwins API.\n */\nexport class DigitalTwinsClient {\n /**\n * A reference to the auto-generated AzureDigitalTwinsAPI\n */\n private readonly client: GeneratedClient;\n\n /**\n * Creates an instance of AzureDigitalTwinsAPI.\n *\n * Example usage:\n * ```ts\n * const { DigitalTwinsClient, ServiceClientCredentials } = require(\"@azure/digital-twins-core\");\n *\n * const client = new DigitalTwinsClient(\n * \"<endpoint>\",\n * new DefaultAzureCredential();\n * );\n * ```\n * @param endpointUrl - The endpoint URL of the service.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the service client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential,\n options: DigitalTwinsClientOptions = {},\n ) {\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-request-id\"],\n },\n };\n\n this.client = new GeneratedClient({\n endpoint: endpointUrl,\n credential,\n credentialScopes: DEFAULT_DIGITALTWINS_SCOPE,\n ...internalPipelineOptions,\n });\n }\n\n /**\n * Get a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param options - The operation options\n * @returns The application/json digital twin.\n */\n public getDigitalTwin(\n digitalTwinId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Create or update a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to create or update.\n * @param digitalTwinJson - The application/json digital twin to create.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n * @returns The created application/json digital twin.\n */\n public upsertDigitalTwin(\n digitalTwinId: string,\n digitalTwinJson: string,\n options: DigitalTwinsAddOptionalParams = {},\n ): Promise<DigitalTwinsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertDigitalTwin\",\n options,\n async (updatedOptions) => {\n const payload = JSON.parse(digitalTwinJson);\n return this.client.digitalTwins.add(digitalTwinId, payload, updatedOptions);\n },\n );\n }\n\n /**\n * Update a digital twin using a json patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param jsonPatch - An update specification described by JSON Patch. Updates to property values\n * and $model elements may happen in the same request. Operations are limited to add, replace and\n * remove.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateDigitalTwin(\n digitalTwinId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateOptionalParams = {},\n ): Promise<DigitalTwinsUpdateResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a digital twin\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public deleteDigitalTwin(\n digitalTwinId: string,\n options: DigitalTwinsDeleteOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteDigitalTwin\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);\n },\n );\n }\n\n /**\n * Get a component on a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being retrieved.\n * @param options - The operation options\n * @returns Json string representation of the component corresponding to the provided componentName.\n */\n public getComponent(\n digitalTwinId: string,\n componentName: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);\n },\n );\n }\n\n /**\n * Update properties of a component on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin.\n * @param componentName - The component being updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's component.\n * @param enableUpdate - If true then update of an existing digital twin is enabled.\n * @param options - Extended operation options including\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n\n */\n public updateComponent(\n digitalTwinId: string,\n componentName: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateComponentOptionalParams = {},\n ): Promise<DigitalTwinsUpdateComponentResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateComponent\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateComponent(\n digitalTwinId,\n componentName,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Get a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to retrieve.\n * @param options - The operation options\n * @returns The pageable list of application/json relationships belonging to the specified digital twin.\n */\n public getRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: OperationOptions = {},\n ): Promise<DigitalTwinsGetRelationshipByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.getRelationshipById(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Create or update a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to create.\n * @param relationship - The application/json relationship to be created.\n * @param options - Extended operation options including\n * ifNoneMatch: Only perform the operation if the entity does not already exist.\n */\n public upsertRelationship(\n digitalTwinId: string,\n relationshipId: string,\n relationship: Record<string, unknown>,\n options: DigitalTwinsAddRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsAddRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.addRelationship(\n digitalTwinId,\n relationshipId,\n relationship,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Updates the properties of a relationship on a digital twin using a JSON patch.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param relationshipId - The Id of the relationship to be updated.\n * @param jsonPatch - The application/json-patch+json operations to be performed on the specified digital twin's relationship.\n * @param options - Extended operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.\n */\n public updateRelationship(\n digitalTwinId: string,\n relationshipId: string,\n jsonPatch: Array<Record<string, unknown>>,\n options: DigitalTwinsUpdateRelationshipOptionalParams = {},\n ): Promise<DigitalTwinsUpdateRelationshipResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.updateRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.updateRelationship(\n digitalTwinId,\n relationshipId,\n jsonPatch,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Delete a relationship on a digital twin.\n *\n * @param digitalTwinId - The Id of the source digital twin.\n * @param relationshipId - The Id of the relationship to delete.\n * @param options - The operation options\n * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is\n\n */\n public deleteRelationship(\n digitalTwinId: string,\n relationshipId: string,\n options: DigitalTwinsDeleteRelationshipOptionalParams = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteRelationship\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.deleteRelationship(\n digitalTwinId,\n relationshipId,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Retrieve relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listRelationships(\n digitalTwinId: string,\n options?: ListRelationshipsOptions,\n ): PagedAsyncIterableIterator<Record<string, unknown>> {\n return this.client.digitalTwins.listRelationships(digitalTwinId, options);\n }\n\n /**\n * Retrieve all incoming relationships for a digital twin.\n *\n * @param digitalTwinId - The Id of the digital twin.\n */\n public listIncomingRelationships(\n digitalTwinId: string,\n options?: ListIncomingRelationshipsOptions,\n ): PagedAsyncIterableIterator<IncomingRelationship> {\n return this.client.digitalTwins.listIncomingRelationships(digitalTwinId, options);\n }\n\n /**\n * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishTelemetry(\n digitalTwinId: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendTelemetry(\n digitalTwinId,\n messageId || randomUUID(),\n payload,\n {\n ...updatedOptions,\n telemetrySourceTime: new Date().toISOString(),\n },\n );\n },\n );\n }\n\n /**\n * Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.\n *\n * @param digitalTwinId - The Id of the digital twin to delete.\n * @param componentName - The name of the DTDL component.\n * @param payload - The application/json telemetry payload to be sent.\n * @param messageId - The message Id.\n * @param options - The operation options\n\n */\n public publishComponentTelemetry(\n digitalTwinId: string,\n componentName: string,\n payload: Record<string, unknown>,\n messageId: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.publishComponentTelemetry\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwins.sendComponentTelemetry(\n digitalTwinId,\n componentName,\n messageId || randomUUID(),\n payload,\n { ...updatedOptions, telemetrySourceTime: new Date().toISOString() },\n );\n },\n );\n }\n\n /**\n * Get a model, including the model metadata and the model definition.\n *\n * @param modelId - The Id of the model.\n * @param options - Options for this operation\n * @returns The application/json model.\n */\n public getModel(\n modelId: string,\n options: GetModelOptions = {},\n ): Promise<DigitalTwinModelsGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getModel\",\n {\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.getById(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get the list of models\n *\n * @param options - Options for listing models.\n * @returns A pageable set of application/json models.\n */\n public listModels(\n options: ListModelsOptions = {},\n ): PagedAsyncIterableIterator<DigitalTwinsModelData> {\n return this.client.digitalTwinModels.list({\n ...options,\n includeModelDefinition: options?.includeModelDefinition ?? false,\n });\n }\n\n /**\n * Create one or many\n *\n * @param dtdlModels - The set of models to create. Each string corresponds to exactly one model.\n * @param options - The operation options\n * @returns The created application/json models.\n */\n public createModels(\n dtdlModels: Array<Record<string, unknown>>,\n options: OperationOptions = {},\n ): Promise<DigitalTwinModelsAddResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.createModels\",\n {\n ...options,\n models: dtdlModels,\n },\n async (updatedOptions) => {\n return this.client.digitalTwinModels.add(updatedOptions);\n },\n );\n }\n\n /**\n * Decommission a model using a json patch.\n * When a model is decommissioned, new digital twins will no longer be able to be\n * defined by this model. However, existing digital twins may continue to use this model.\n * Once a model is decommissioned, it may not be recommissioned.\n *\n * @param modelId - The Id of the model to decommission.\n * property can be replaced.\n * @param options - The operation options\n\n *\n */\n public decomissionModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n const jsonPatch = [{ op: \"replace\", path: \"/decommissioned\", value: true }];\n\n return tracingClient.withSpan(\n \"DigitalTwinsClient.decomissionModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);\n },\n );\n }\n\n /**\n * Delete a model.\n *\n * @param modelId - The Id of the model to delete.\n * @param options - The operation options\n\n */\n public deleteModel(modelId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteModel\",\n options,\n async (updatedOptions) => {\n return this.client.digitalTwinModels.delete(modelId, updatedOptions);\n },\n );\n }\n\n /**\n * Get an event route.\n *\n * @param modelId - The Id of the event route.\n * @param options - The operation options\n * @returns The application/json event route.\n */\n public getEventRoute(\n eventRouteId: string,\n options: OperationOptions = {},\n ): Promise<EventRoutesGetByIdResponse> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.getEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.getById(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * List the event routes in a digital twins instance.\n *\n * @param options - Options for listEventRoutes.\n * @returns The application/json event route.\n */\n public listEventRoutes(options?: ListEventRoutesOptions): PagedAsyncIterableIterator<EventRoute> {\n return this.client.eventRoutes.list(options);\n }\n\n /**\n * Create or update an event route.\n *\n * @param eventRouteId - The Id of the event route to create or update.\n * @param endpointId - The id of the endpoint this event route is bound to.\n * @param filter - An expression which describes the events which are routed to the endpoint.\n * @param options - The operation options\n\n */\n public upsertEventRoute(\n eventRouteId: string,\n endpointId: string,\n filter: string,\n options: OperationOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.upsertEventRoute\",\n {\n eventRoute: {\n endpointName: endpointId,\n filter,\n },\n ...options,\n },\n async (updatedOptions) => {\n return this.client.eventRoutes.add(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Delete an event route.\n *\n * @param eventRouteId - The Id of the eventRoute to delete.\n * @param options - The operation options\n\n */\n public deleteEventRoute(eventRouteId: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"DigitalTwinsClient.deleteEventRoute\",\n options,\n async (updatedOptions) => {\n return this.client.eventRoutes.delete(eventRouteId, updatedOptions);\n },\n );\n }\n\n /**\n * Deals with the pagination of {@link query}.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n * @param continuationState - An object that indicates the position of the paginated request.\n *\n */\n private async *queryTwinsPage(\n query: string,\n options: QueryTwinsOptions,\n continuationState?: PageSettings,\n ): AsyncIterableIterator<QueryQueryTwinsResponse> {\n let { continuationToken } = continuationState ?? {};\n if (!continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n while (continuationToken) {\n const queryResult = await this.client.query.queryTwins({ query, continuationToken }, options);\n continuationToken = queryResult.continuationToken;\n yield queryResult;\n }\n }\n\n /**\n * Deals with the iteration of all the available results of {@link query}.\n * @param query - The query string, in SQL-like syntax.\n * @param options - Common options for the iterative endpoints.\n */\n private async *queryTwinsAll(\n query: string,\n options: QueryTwinsOptions,\n ): AsyncIterableIterator<Record<string, unknown>> {\n for await (const page of this.queryTwinsPage(query, options)) {\n if (page.value) {\n yield* page.value;\n }\n }\n }\n\n /**\n * Query for digital twins.\n *\n * @param query - The query string, in SQL-like syntax.\n * @param options - Options for the query operation.\n * @returns The pageable list of query results.\n */\n public queryTwins(\n query: string,\n options: QueryTwinsOptions = {},\n ): PagedAsyncIterableIterator<Record<string, unknown>, QueryQueryTwinsResponse> {\n const iter = this.queryTwinsAll(query, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => this.queryTwinsPage(query, options, settings),\n };\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/digital-twins-core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.20250110.1",
|
|
4
4
|
"description": "An isomorphic client library for Azure Digital Twins",
|
|
5
5
|
"sdk-type": "client",
|
|
6
6
|
"author": "Microsoft Corporation",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
]
|
|
113
113
|
},
|
|
114
114
|
"requiredResources": {
|
|
115
|
-
"Azure Digital Twins instance": "https://
|
|
115
|
+
"Azure Digital Twins instance": "https://learn.microsoft.com/azure/digital-twins/how-to-set-up-instance-portal"
|
|
116
116
|
},
|
|
117
117
|
"skipFolder": true
|
|
118
118
|
},
|