@azure/iot-modelsrepository 1.0.0-alpha.20250206.1 → 1.0.0-alpha.20250210.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 +43 -18
- package/dist/browser/index.d.ts +12 -17
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +12 -17
- package/dist/browser/index.js.map +1 -1
- package/dist/commonjs/index.d.ts +12 -17
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +12 -17
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +12 -17
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +12 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/react-native/index.d.ts +12 -17
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +12 -17
- package/dist/react-native/index.js.map +1 -1
- package/package.json +8 -12
package/README.md
CHANGED
|
@@ -33,18 +33,17 @@ npm install @azure/iot-modelsrepository
|
|
|
33
33
|
|
|
34
34
|
### Initializing the Models Repository Client
|
|
35
35
|
|
|
36
|
-
```ts
|
|
37
|
-
// When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint
|
|
38
|
-
// https://devicemodels.azure.com/ is used and the model dependency resolution
|
|
39
|
-
// configuration is set to TryFromExpanded.
|
|
36
|
+
```ts snippet:ReadmeSampleCreate_Global
|
|
40
37
|
import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
41
38
|
|
|
42
39
|
const client = new ModelsRepositoryClient();
|
|
43
40
|
console.log(`Initialized client point to global endpoint: ${client.repositoryLocation}`);
|
|
44
41
|
```
|
|
45
42
|
|
|
46
|
-
```ts
|
|
47
|
-
|
|
43
|
+
```ts snippet:ReadmeSampleCreate_Local
|
|
44
|
+
import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
45
|
+
|
|
46
|
+
// The client will also work with a local filesystem URI. This example shows initialization
|
|
48
47
|
// with a local URI and disabling model dependency resolution.
|
|
49
48
|
const client = new ModelsRepositoryClient({
|
|
50
49
|
repositoryLocation: "file:///path/to/repository/",
|
|
@@ -61,7 +60,9 @@ Publishing models to the models repository requires [exercising](https://learn.m
|
|
|
61
60
|
|
|
62
61
|
After publishing, your model(s) will be available for consumption from the global repository endpoint. The following snippet shows how to retrieve the corresponding JSON-LD content.
|
|
63
62
|
|
|
64
|
-
```ts
|
|
63
|
+
```ts snippet:ReadmeSampleGetModels
|
|
64
|
+
import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
65
|
+
|
|
65
66
|
// Global endpoint client
|
|
66
67
|
const client = new ModelsRepositoryClient();
|
|
67
68
|
|
|
@@ -80,9 +81,14 @@ GitHub pull-request workflows are a core aspect of the IoT Models Repository ser
|
|
|
80
81
|
|
|
81
82
|
To support this workflow and similar use cases, the client supports initialization with a local file-system URI. You can use this for example, to test and ensure newly added models to the locally cloned models repository are in their proper locations.
|
|
82
83
|
|
|
83
|
-
```ts
|
|
84
|
+
```ts snippet:ReadmeSampleGetModels_Local
|
|
85
|
+
import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
86
|
+
|
|
84
87
|
// Local sample repository client
|
|
85
|
-
const client = new ModelsRepositoryClient(
|
|
88
|
+
const client = new ModelsRepositoryClient({
|
|
89
|
+
repositoryLocation: "file:///path/to/repository/",
|
|
90
|
+
dependencyResolution: "disabled",
|
|
91
|
+
});
|
|
86
92
|
|
|
87
93
|
// The output of getModels() will include at least the definition for the target dtmi.
|
|
88
94
|
// If the model dependency resolution configuration is not disabled, then models in which the
|
|
@@ -92,12 +98,14 @@ const models = await client.getModels(dtmi);
|
|
|
92
98
|
|
|
93
99
|
// In this case the above dtmi has 2 model dependencies.
|
|
94
100
|
// dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1
|
|
95
|
-
console.log(`${dtmi} resolved in
|
|
101
|
+
console.log(`${dtmi} resolved in {Object.keys(models).length} interfaces.`);
|
|
96
102
|
```
|
|
97
103
|
|
|
98
104
|
You are also able to get definitions for multiple root models at a time by leveraging the `GetModels` overload.
|
|
99
105
|
|
|
100
|
-
```ts
|
|
106
|
+
```ts snippet:ReadmeSampleGetModels_Multiple
|
|
107
|
+
import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
108
|
+
|
|
101
109
|
// Global endpoint client
|
|
102
110
|
const client = new ModelsRepositoryClient();
|
|
103
111
|
|
|
@@ -110,7 +118,7 @@ const models = await client.getModels(dtmis);
|
|
|
110
118
|
// In this case the dtmi "dtmi:com:example:TemperatureController;1" has 2 model dependencies
|
|
111
119
|
// and the dtmi "dtmi:com:example:azuresphere:sampledevice;1" has no additional dependencies.
|
|
112
120
|
// The returned IDictionary will include 4 models.
|
|
113
|
-
console.log(`${dtmis.toString()} resolved in ${models.keys
|
|
121
|
+
console.log(`${dtmis.toString()} resolved in ${Object.keys(models.keys).length} interfaces.`);
|
|
114
122
|
```
|
|
115
123
|
|
|
116
124
|
### Digital Twins Model Parser Integration
|
|
@@ -121,7 +129,9 @@ _When the Digital Twins Model Parser is completed, we will update you with infor
|
|
|
121
129
|
|
|
122
130
|
The IoT Models Repository applies a set of conventions for organizing digital twin models. This package exposes two auxiliary functions related to `DtmiConventions`, `getModelUri` and `isValidDtmi`. These same functions are used throughout the client.
|
|
123
131
|
|
|
124
|
-
```ts
|
|
132
|
+
```ts snippet:ReadmeSampleDtmiConventions
|
|
133
|
+
import { isValidDtmi } from "@azure/iot-modelsrepository";
|
|
134
|
+
|
|
125
135
|
// This snippet shows how to validate a given DTMI string is well-formed.
|
|
126
136
|
|
|
127
137
|
// Returns true
|
|
@@ -131,26 +141,31 @@ isValidDtmi("dtmi:com:example:Thermostat;1");
|
|
|
131
141
|
isValidDtmi("dtmi:com:example:Thermostat");
|
|
132
142
|
```
|
|
133
143
|
|
|
134
|
-
|
|
135
|
-
|
|
144
|
+
The `getModelUri` function is used to obtain a fully qualified path to a model file. This can be used to retrieve a model file from a local or remote repository. This snippet shows obtaining a fully qualified path to a model file.
|
|
145
|
+
|
|
146
|
+
```ts snippet:ReadmeSampleGetModelUri_Local
|
|
147
|
+
import { getModelUri } from "@azure/iot-modelsrepository";
|
|
136
148
|
|
|
149
|
+
// This snippet shows obtaining a fully qualified path to a model file.
|
|
137
150
|
// Local repository example
|
|
138
151
|
const localRepositoryUri: string = "file:///path/to/repository/";
|
|
139
152
|
const fullyQualifiedModelPath: string = getModelUri(
|
|
140
153
|
"dtmi:com:example:Thermostat;1",
|
|
141
154
|
localRepositoryUri,
|
|
142
155
|
);
|
|
143
|
-
|
|
144
156
|
// Prints '/path/to/repository/dtmi/com/example/thermostat-1.json'
|
|
145
157
|
console.log(fullyQualifiedModelPath);
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```ts snippet:ReadmeSampleGetModelUri_Remote
|
|
161
|
+
import { getModelUri } from "@azure/iot-modelsrepository";
|
|
146
162
|
|
|
147
163
|
// Remote repository example
|
|
148
164
|
const remoteRepositoryUri: string = "https://contoso.com/models/";
|
|
149
|
-
const fullyQualifiedModelPath: string =
|
|
165
|
+
const fullyQualifiedModelPath: string = getModelUri(
|
|
150
166
|
"dtmi:com:example:Thermostat;1",
|
|
151
167
|
remoteRepositoryUri,
|
|
152
168
|
);
|
|
153
|
-
|
|
154
169
|
// Prints 'https://contoso.com/models/dtmi/com/example/thermostat-1.json'
|
|
155
170
|
console.log(fullyQualifiedModelPath);
|
|
156
171
|
```
|
|
@@ -161,6 +176,16 @@ console.log(fullyQualifiedModelPath);
|
|
|
161
176
|
|
|
162
177
|
- If you run into an error, first make sure the model you are access exists at the location you are attempting to get it from.
|
|
163
178
|
|
|
179
|
+
### Logging
|
|
180
|
+
|
|
181
|
+
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
|
182
|
+
|
|
183
|
+
```ts snippet:SetLogLevel
|
|
184
|
+
import { setLogLevel } from "@azure/logger";
|
|
185
|
+
|
|
186
|
+
setLogLevel("info");
|
|
187
|
+
```
|
|
188
|
+
|
|
164
189
|
## Next steps
|
|
165
190
|
|
|
166
191
|
- Review the [DTDL Spec](https://learn.microsoft.com/azure/iot-pnp/concepts-model-parser).
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -8,26 +8,21 @@
|
|
|
8
8
|
* will be mapped to specific models contained in the repository location that the user wishes to get.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* import lib
|
|
14
|
-
* import {ModelsRepositoryClient} from "../../../src";
|
|
11
|
+
* ```ts snippet:ReadmeSampleGetModels
|
|
12
|
+
* import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
* const
|
|
14
|
+
* // Global endpoint client
|
|
15
|
+
* const client = new ModelsRepositoryClient();
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* console.log(result);
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* main().catch((err) => {
|
|
28
|
-
* console.error("The sample encountered an error:", err);
|
|
29
|
-
* });
|
|
17
|
+
* // The output of getModels() will include at least the definition for the target dtmi.
|
|
18
|
+
* // If the model dependency resolution configuration is not disabled, then models in which the
|
|
19
|
+
* // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).
|
|
20
|
+
* const dtmi = "dtmi:com:example:TemperatureController;1";
|
|
21
|
+
* const models = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" });
|
|
30
22
|
*
|
|
23
|
+
* // In this case the above dtmi has 2 model dependencies.
|
|
24
|
+
* // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1
|
|
25
|
+
* console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);
|
|
31
26
|
* ```
|
|
32
27
|
*
|
|
33
28
|
* @packageDocumentation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/browser/index.js
CHANGED
|
@@ -10,26 +10,21 @@
|
|
|
10
10
|
* will be mapped to specific models contained in the repository location that the user wishes to get.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* import lib
|
|
16
|
-
* import {ModelsRepositoryClient} from "../../../src";
|
|
13
|
+
* ```ts snippet:ReadmeSampleGetModels
|
|
14
|
+
* import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
17
15
|
*
|
|
18
|
-
*
|
|
19
|
-
* const
|
|
16
|
+
* // Global endpoint client
|
|
17
|
+
* const client = new ModelsRepositoryClient();
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* console.log(result);
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* main().catch((err) => {
|
|
30
|
-
* console.error("The sample encountered an error:", err);
|
|
31
|
-
* });
|
|
19
|
+
* // The output of getModels() will include at least the definition for the target dtmi.
|
|
20
|
+
* // If the model dependency resolution configuration is not disabled, then models in which the
|
|
21
|
+
* // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).
|
|
22
|
+
* const dtmi = "dtmi:com:example:TemperatureController;1";
|
|
23
|
+
* const models = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" });
|
|
32
24
|
*
|
|
25
|
+
* // In this case the above dtmi has 2 model dependencies.
|
|
26
|
+
* // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1
|
|
27
|
+
* console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);
|
|
33
28
|
* ```
|
|
34
29
|
*
|
|
35
30
|
* @packageDocumentation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAIrE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * This is the ModelsRepositoryClient Library for JavaScript.\n *\n * @remarks\n * This ModelsRepositoryClient is built around getting DTDL Models from a user-specified\n * location. The two main variables are the repositoryLocation, which is a path or URI to either a remote\n * or local repository where the models are located, and the dtmis, which can be one or more dtmis that\n * will be mapped to specific models contained in the repository location that the user wishes to get.\n *\n * @example\n * ```ts snippet:ReadmeSampleGetModels\n * import { ModelsRepositoryClient } from \"@azure/iot-modelsrepository\";\n *\n * // Global endpoint client\n * const client = new ModelsRepositoryClient();\n *\n * // The output of getModels() will include at least the definition for the target dtmi.\n * // If the model dependency resolution configuration is not disabled, then models in which the\n * // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).\n * const dtmi = \"dtmi:com:example:TemperatureController;1\";\n * const models = await client.getModels(dtmi, { dependencyResolution: \"tryFromExpanded\" });\n *\n * // In this case the above dtmi has 2 model dependencies.\n * // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1\n * console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);\n * ```\n *\n * @packageDocumentation\n */\n\nexport { ModelsRepositoryClient } from \"./modelsRepositoryClient.js\";\nexport { GetModelsOptions } from \"./interfaces/getModelsOptions.js\";\nexport { ModelsRepositoryClientOptions } from \"./interfaces/modelsRepositoryClientOptions.js\";\nexport { dependencyResolutionType } from \"./dependencyResolutionType.js\";\nexport { ModelError } from \"./exceptions.js\";\nexport { getModelUri, isValidDtmi } from \"./dtmiConventions.js\";\n"]}
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -8,26 +8,21 @@
|
|
|
8
8
|
* will be mapped to specific models contained in the repository location that the user wishes to get.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* import lib
|
|
14
|
-
* import {ModelsRepositoryClient} from "../../../src";
|
|
11
|
+
* ```ts snippet:ReadmeSampleGetModels
|
|
12
|
+
* import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
* const
|
|
14
|
+
* // Global endpoint client
|
|
15
|
+
* const client = new ModelsRepositoryClient();
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* console.log(result);
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* main().catch((err) => {
|
|
28
|
-
* console.error("The sample encountered an error:", err);
|
|
29
|
-
* });
|
|
17
|
+
* // The output of getModels() will include at least the definition for the target dtmi.
|
|
18
|
+
* // If the model dependency resolution configuration is not disabled, then models in which the
|
|
19
|
+
* // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).
|
|
20
|
+
* const dtmi = "dtmi:com:example:TemperatureController;1";
|
|
21
|
+
* const models = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" });
|
|
30
22
|
*
|
|
23
|
+
* // In this case the above dtmi has 2 model dependencies.
|
|
24
|
+
* // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1
|
|
25
|
+
* console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);
|
|
31
26
|
* ```
|
|
32
27
|
*
|
|
33
28
|
* @packageDocumentation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -13,26 +13,21 @@ exports.isValidDtmi = exports.getModelUri = exports.ModelError = exports.ModelsR
|
|
|
13
13
|
* will be mapped to specific models contained in the repository location that the user wishes to get.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* import lib
|
|
19
|
-
* import {ModelsRepositoryClient} from "../../../src";
|
|
16
|
+
* ```ts snippet:ReadmeSampleGetModels
|
|
17
|
+
* import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
* const
|
|
19
|
+
* // Global endpoint client
|
|
20
|
+
* const client = new ModelsRepositoryClient();
|
|
23
21
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* console.log(result);
|
|
30
|
-
* }
|
|
31
|
-
*
|
|
32
|
-
* main().catch((err) => {
|
|
33
|
-
* console.error("The sample encountered an error:", err);
|
|
34
|
-
* });
|
|
22
|
+
* // The output of getModels() will include at least the definition for the target dtmi.
|
|
23
|
+
* // If the model dependency resolution configuration is not disabled, then models in which the
|
|
24
|
+
* // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).
|
|
25
|
+
* const dtmi = "dtmi:com:example:TemperatureController;1";
|
|
26
|
+
* const models = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" });
|
|
35
27
|
*
|
|
28
|
+
* // In this case the above dtmi has 2 model dependencies.
|
|
29
|
+
* // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1
|
|
30
|
+
* console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);
|
|
36
31
|
* ```
|
|
37
32
|
*
|
|
38
33
|
* @packageDocumentation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAI/B,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,2DAAgE;AAAvD,iHAAA,WAAW,OAAA;AAAE,iHAAA,WAAW,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * This is the ModelsRepositoryClient Library for JavaScript.\n *\n * @remarks\n * This ModelsRepositoryClient is built around getting DTDL Models from a user-specified\n * location. The two main variables are the repositoryLocation, which is a path or URI to either a remote\n * or local repository where the models are located, and the dtmis, which can be one or more dtmis that\n * will be mapped to specific models contained in the repository location that the user wishes to get.\n *\n * @example\n * ```ts snippet:ReadmeSampleGetModels\n * import { ModelsRepositoryClient } from \"@azure/iot-modelsrepository\";\n *\n * // Global endpoint client\n * const client = new ModelsRepositoryClient();\n *\n * // The output of getModels() will include at least the definition for the target dtmi.\n * // If the model dependency resolution configuration is not disabled, then models in which the\n * // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).\n * const dtmi = \"dtmi:com:example:TemperatureController;1\";\n * const models = await client.getModels(dtmi, { dependencyResolution: \"tryFromExpanded\" });\n *\n * // In this case the above dtmi has 2 model dependencies.\n * // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1\n * console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);\n * ```\n *\n * @packageDocumentation\n */\n\nexport { ModelsRepositoryClient } from \"./modelsRepositoryClient.js\";\nexport { GetModelsOptions } from \"./interfaces/getModelsOptions.js\";\nexport { ModelsRepositoryClientOptions } from \"./interfaces/modelsRepositoryClientOptions.js\";\nexport { dependencyResolutionType } from \"./dependencyResolutionType.js\";\nexport { ModelError } from \"./exceptions.js\";\nexport { getModelUri, isValidDtmi } from \"./dtmiConventions.js\";\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -8,26 +8,21 @@
|
|
|
8
8
|
* will be mapped to specific models contained in the repository location that the user wishes to get.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* import lib
|
|
14
|
-
* import {ModelsRepositoryClient} from "../../../src";
|
|
11
|
+
* ```ts snippet:ReadmeSampleGetModels
|
|
12
|
+
* import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
* const
|
|
14
|
+
* // Global endpoint client
|
|
15
|
+
* const client = new ModelsRepositoryClient();
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* console.log(result);
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* main().catch((err) => {
|
|
28
|
-
* console.error("The sample encountered an error:", err);
|
|
29
|
-
* });
|
|
17
|
+
* // The output of getModels() will include at least the definition for the target dtmi.
|
|
18
|
+
* // If the model dependency resolution configuration is not disabled, then models in which the
|
|
19
|
+
* // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).
|
|
20
|
+
* const dtmi = "dtmi:com:example:TemperatureController;1";
|
|
21
|
+
* const models = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" });
|
|
30
22
|
*
|
|
23
|
+
* // In this case the above dtmi has 2 model dependencies.
|
|
24
|
+
* // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1
|
|
25
|
+
* console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);
|
|
31
26
|
* ```
|
|
32
27
|
*
|
|
33
28
|
* @packageDocumentation
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -10,26 +10,21 @@
|
|
|
10
10
|
* will be mapped to specific models contained in the repository location that the user wishes to get.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* import lib
|
|
16
|
-
* import {ModelsRepositoryClient} from "../../../src";
|
|
13
|
+
* ```ts snippet:ReadmeSampleGetModels
|
|
14
|
+
* import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
17
15
|
*
|
|
18
|
-
*
|
|
19
|
-
* const
|
|
16
|
+
* // Global endpoint client
|
|
17
|
+
* const client = new ModelsRepositoryClient();
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* console.log(result);
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* main().catch((err) => {
|
|
30
|
-
* console.error("The sample encountered an error:", err);
|
|
31
|
-
* });
|
|
19
|
+
* // The output of getModels() will include at least the definition for the target dtmi.
|
|
20
|
+
* // If the model dependency resolution configuration is not disabled, then models in which the
|
|
21
|
+
* // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).
|
|
22
|
+
* const dtmi = "dtmi:com:example:TemperatureController;1";
|
|
23
|
+
* const models = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" });
|
|
32
24
|
*
|
|
25
|
+
* // In this case the above dtmi has 2 model dependencies.
|
|
26
|
+
* // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1
|
|
27
|
+
* console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);
|
|
33
28
|
* ```
|
|
34
29
|
*
|
|
35
30
|
* @packageDocumentation
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAIrE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * This is the ModelsRepositoryClient Library for JavaScript.\n *\n * @remarks\n * This ModelsRepositoryClient is built around getting DTDL Models from a user-specified\n * location. The two main variables are the repositoryLocation, which is a path or URI to either a remote\n * or local repository where the models are located, and the dtmis, which can be one or more dtmis that\n * will be mapped to specific models contained in the repository location that the user wishes to get.\n *\n * @example\n * ```ts snippet:ReadmeSampleGetModels\n * import { ModelsRepositoryClient } from \"@azure/iot-modelsrepository\";\n *\n * // Global endpoint client\n * const client = new ModelsRepositoryClient();\n *\n * // The output of getModels() will include at least the definition for the target dtmi.\n * // If the model dependency resolution configuration is not disabled, then models in which the\n * // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).\n * const dtmi = \"dtmi:com:example:TemperatureController;1\";\n * const models = await client.getModels(dtmi, { dependencyResolution: \"tryFromExpanded\" });\n *\n * // In this case the above dtmi has 2 model dependencies.\n * // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1\n * console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);\n * ```\n *\n * @packageDocumentation\n */\n\nexport { ModelsRepositoryClient } from \"./modelsRepositoryClient.js\";\nexport { GetModelsOptions } from \"./interfaces/getModelsOptions.js\";\nexport { ModelsRepositoryClientOptions } from \"./interfaces/modelsRepositoryClientOptions.js\";\nexport { dependencyResolutionType } from \"./dependencyResolutionType.js\";\nexport { ModelError } from \"./exceptions.js\";\nexport { getModelUri, isValidDtmi } from \"./dtmiConventions.js\";\n"]}
|
|
@@ -8,26 +8,21 @@
|
|
|
8
8
|
* will be mapped to specific models contained in the repository location that the user wishes to get.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* import lib
|
|
14
|
-
* import {ModelsRepositoryClient} from "../../../src";
|
|
11
|
+
* ```ts snippet:ReadmeSampleGetModels
|
|
12
|
+
* import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
* const
|
|
14
|
+
* // Global endpoint client
|
|
15
|
+
* const client = new ModelsRepositoryClient();
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* console.log(result);
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* main().catch((err) => {
|
|
28
|
-
* console.error("The sample encountered an error:", err);
|
|
29
|
-
* });
|
|
17
|
+
* // The output of getModels() will include at least the definition for the target dtmi.
|
|
18
|
+
* // If the model dependency resolution configuration is not disabled, then models in which the
|
|
19
|
+
* // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).
|
|
20
|
+
* const dtmi = "dtmi:com:example:TemperatureController;1";
|
|
21
|
+
* const models = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" });
|
|
30
22
|
*
|
|
23
|
+
* // In this case the above dtmi has 2 model dependencies.
|
|
24
|
+
* // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1
|
|
25
|
+
* console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);
|
|
31
26
|
* ```
|
|
32
27
|
*
|
|
33
28
|
* @packageDocumentation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -10,26 +10,21 @@
|
|
|
10
10
|
* will be mapped to specific models contained in the repository location that the user wishes to get.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* import lib
|
|
16
|
-
* import {ModelsRepositoryClient} from "../../../src";
|
|
13
|
+
* ```ts snippet:ReadmeSampleGetModels
|
|
14
|
+
* import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";
|
|
17
15
|
*
|
|
18
|
-
*
|
|
19
|
-
* const
|
|
16
|
+
* // Global endpoint client
|
|
17
|
+
* const client = new ModelsRepositoryClient();
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* console.log(result);
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* main().catch((err) => {
|
|
30
|
-
* console.error("The sample encountered an error:", err);
|
|
31
|
-
* });
|
|
19
|
+
* // The output of getModels() will include at least the definition for the target dtmi.
|
|
20
|
+
* // If the model dependency resolution configuration is not disabled, then models in which the
|
|
21
|
+
* // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).
|
|
22
|
+
* const dtmi = "dtmi:com:example:TemperatureController;1";
|
|
23
|
+
* const models = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" });
|
|
32
24
|
*
|
|
25
|
+
* // In this case the above dtmi has 2 model dependencies.
|
|
26
|
+
* // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1
|
|
27
|
+
* console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);
|
|
33
28
|
* ```
|
|
34
29
|
*
|
|
35
30
|
* @packageDocumentation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAIrE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * This is the ModelsRepositoryClient Library for JavaScript.\n *\n * @remarks\n * This ModelsRepositoryClient is built around getting DTDL Models from a user-specified\n * location. The two main variables are the repositoryLocation, which is a path or URI to either a remote\n * or local repository where the models are located, and the dtmis, which can be one or more dtmis that\n * will be mapped to specific models contained in the repository location that the user wishes to get.\n *\n * @example\n * ```ts snippet:ReadmeSampleGetModels\n * import { ModelsRepositoryClient } from \"@azure/iot-modelsrepository\";\n *\n * // Global endpoint client\n * const client = new ModelsRepositoryClient();\n *\n * // The output of getModels() will include at least the definition for the target dtmi.\n * // If the model dependency resolution configuration is not disabled, then models in which the\n * // target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).\n * const dtmi = \"dtmi:com:example:TemperatureController;1\";\n * const models = await client.getModels(dtmi, { dependencyResolution: \"tryFromExpanded\" });\n *\n * // In this case the above dtmi has 2 model dependencies.\n * // dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1\n * console.log(`${dtmi} resolved in ${Object.keys(models).length} interfaces.`);\n * ```\n *\n * @packageDocumentation\n */\n\nexport { ModelsRepositoryClient } from \"./modelsRepositoryClient.js\";\nexport { GetModelsOptions } from \"./interfaces/getModelsOptions.js\";\nexport { ModelsRepositoryClientOptions } from \"./interfaces/modelsRepositoryClientOptions.js\";\nexport { dependencyResolutionType } from \"./dependencyResolutionType.js\";\nexport { ModelError } from \"./exceptions.js\";\nexport { getModelUri, isValidDtmi } from \"./dtmiConventions.js\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/iot-modelsrepository",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.20250210.1",
|
|
4
4
|
"description": "Device Model Repository Library with typescript type definitions for node.js and browser.",
|
|
5
5
|
"sdk-type": "client",
|
|
6
6
|
"main": "./dist/commonjs/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
32
32
|
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
|
33
33
|
"unit-test:node": "dev-tool run test:vitest",
|
|
34
|
-
"update-snippets": "
|
|
34
|
+
"update-snippets": "dev-tool run update-snippets"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"dist/",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@azure/core-client": "^1.9.2",
|
|
60
|
-
"@azure/core-rest-pipeline": "^1.
|
|
60
|
+
"@azure/core-rest-pipeline": "^1.19.0",
|
|
61
61
|
"@azure/core-tracing": "^1.2.0",
|
|
62
62
|
"@azure/core-util": "^1.11.0",
|
|
63
63
|
"@azure/logger": "^1.1.4",
|
|
@@ -73,15 +73,10 @@
|
|
|
73
73
|
"@vitest/browser": "^3.0.3",
|
|
74
74
|
"@vitest/coverage-istanbul": "^3.0.3",
|
|
75
75
|
"eslint": "^9.9.0",
|
|
76
|
-
"playwright": "^1.
|
|
76
|
+
"playwright": "^1.50.1",
|
|
77
77
|
"typescript": "~5.7.2",
|
|
78
78
|
"vitest": "^3.0.3"
|
|
79
79
|
},
|
|
80
|
-
"standard": {
|
|
81
|
-
"env": [
|
|
82
|
-
"mocha"
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
80
|
"//smokeTestConfiguration": {
|
|
86
81
|
"skipFolder": true
|
|
87
82
|
},
|
|
@@ -103,6 +98,7 @@
|
|
|
103
98
|
},
|
|
104
99
|
"type": "module",
|
|
105
100
|
"tshy": {
|
|
101
|
+
"project": "./tsconfig.src.json",
|
|
106
102
|
"exports": {
|
|
107
103
|
"./package.json": "./package.json",
|
|
108
104
|
".": "./src/index.ts"
|
|
@@ -115,8 +111,7 @@
|
|
|
115
111
|
"browser",
|
|
116
112
|
"react-native"
|
|
117
113
|
],
|
|
118
|
-
"selfLink": false
|
|
119
|
-
"project": "./tsconfig.src.json"
|
|
114
|
+
"selfLink": false
|
|
120
115
|
},
|
|
121
116
|
"exports": {
|
|
122
117
|
"./package.json": "./package.json",
|
|
@@ -138,5 +133,6 @@
|
|
|
138
133
|
"default": "./dist/commonjs/index.js"
|
|
139
134
|
}
|
|
140
135
|
}
|
|
141
|
-
}
|
|
136
|
+
},
|
|
137
|
+
"react-native": "./dist/react-native/index.js"
|
|
142
138
|
}
|