@azure/iot-modelsrepository 1.0.0-alpha.20241122.2 → 1.0.0-alpha.20241126.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.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.12"
8
+ "packageVersion": "7.48.0"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/iot-modelsrepository",
3
- "version": "1.0.0-alpha.20241122.2",
3
+ "version": "1.0.0-alpha.20241126.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",
@@ -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.18.0-alpha <1.18.0-alphb",
60
+ "@azure/core-rest-pipeline": "^1.18.0",
61
61
  "@azure/core-tracing": "^1.2.0",
62
62
  "@azure/core-util": "^1.11.0",
63
63
  "@azure/logger": "^1.1.4",
@@ -1,173 +0,0 @@
1
- /**
2
- * This is the ModelsRepositoryClient Library for JavaScript.
3
- *
4
- * @remarks
5
- * This ModelsRepositoryClient is built around getting DTDL Models from a user-specified
6
- * location. The two main variables are the repositoryLocation, which is a path or URI to either a remote
7
- * or local repository where the models are located, and the dtmis, which can be one or more dtmis that
8
- * will be mapped to specific models contained in the repository location that the user wishes to get.
9
- *
10
- * @example
11
- * Inline code:
12
- * ```typescript
13
- * import lib
14
- * import {ModelsRepositoryClient} from "../../../src";
15
- *
16
- * const repositoryEndpoint = "devicemodels.azure.com";
17
- * const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1";
18
- *
19
- * console.log(repositoryEndpoint, dtmi);
20
- *
21
- * async function main() {
22
- * const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint});
23
- * const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'});
24
- * console.log(result);
25
- * }
26
- *
27
- * main().catch((err) => {
28
- * console.error("The sample encountered an error:", err);
29
- * });
30
- *
31
- * ```
32
- *
33
- * @packageDocumentation
34
- */
35
-
36
- import type { CommonClientOptions } from '@azure/core-client';
37
- import type { OperationOptions } from '@azure/core-client';
38
-
39
- /**
40
- * either dependency resolution is disabled, and only the client will get only the model linked to the dtmi,
41
- * it is enabled, and the client will resolve all dependency models linked to the dtmi within the endpoint,
42
- * or it is set to tryFromExpanded, where the client will attempt to get the expanded JSON format from the endpoint,
43
- * and in the event of failure will fallback on the standard enabled dependency resolution.
44
- *
45
- */
46
- export declare type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded";
47
-
48
- /**
49
- * Options for getting models.
50
- */
51
- export declare interface GetModelsOptions extends OperationOptions {
52
- /**
53
- * This is the format of dependency resolution (no dependency resolution, standard dependency
54
- * resolution, resolution using the expanded json format) that will be used when retrieving
55
- * models. This overwrites the default dependencyResolution settings of the client.
56
- */
57
- dependencyResolution?: dependencyResolutionType;
58
- }
59
-
60
- /**
61
- * Given the dtmi and repository uri, will get a fully qualified model uri.
62
- *
63
- * @param dtmi - digital twins model identifier string
64
- * @param repositoryUri - base URI for repository
65
- * @param expanded - is the Model URI .json or .expanded.json
66
- */
67
- export declare function getModelUri(dtmi: string, repositoryUri: string, expanded?: boolean): string;
68
-
69
- /**
70
- * isValidDtmi validates if a given dtmi matches the convention.
71
- * This is based on the DTMI spec:
72
- * https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md#digital-twin-model-identifier
73
- *
74
- * @param dtmi - digital twins model identifier string
75
- */
76
- export declare function isValidDtmi(dtmi: string): boolean;
77
-
78
- /**
79
- * A ModelError will be thrown in the even the Model in the repo is malformed in some standard way.
80
- */
81
- export declare class ModelError extends Error {
82
- constructor(message: string);
83
- }
84
-
85
- /**
86
- * Initializes a new instance of the IoT Models Repository Client.
87
- */
88
- export declare class ModelsRepositoryClient {
89
- private _repositoryLocation;
90
- private _dependencyResolution;
91
- private _apiVersion;
92
- private _fetcher;
93
- private _resolver;
94
- private _pseudoParser;
95
- /**
96
- * The ModelsRepositoryClient constructor
97
- * @param options - The models repository client options that govern the behavior of the client.
98
- */
99
- constructor(options?: ModelsRepositoryClientOptions);
100
- /**
101
- * improves the readability of the constructor.
102
- * based on a boolean returns the proper dependency resolution setting string.
103
- */
104
- private _checkDefaultDependencyResolution;
105
- /**
106
- * Though currently not relevant, can specify API Version for communicating with
107
- * the service.
108
- */
109
- get apiVersion(): string;
110
- /**
111
- * Configured repository location for this instance. Will be used as the endpoint to get the models from.
112
- */
113
- get repositoryLocation(): string;
114
- /**
115
- * Configured type of dependency resolution for this instance. Dictates how the client deals with model dependencies.
116
- */
117
- get dependencyResolution(): dependencyResolutionType;
118
- /**
119
- * Because of the local / remote optionality of this client, the service client
120
- * must be dynamically generated based on the repository location. If the provided
121
- * repository location is a remote location, then this private method will be used
122
- * to create the IoT Models Repository Service Client.
123
- */
124
- private _createClient;
125
- /**
126
- * The fetcher is an abstraction necessary since this client can communicate with remote or local
127
- * Model Repositories based on the provided location. It will analyze the provided location based
128
- * on that create either an HTTP Fetcher, which uses the IoT Models Repository Service Client,
129
- * or a Filesystem Fetcher.
130
- */
131
- private _createFetcher;
132
- /**
133
- * Retrieve one or more models based upon on or more provided dtmis.
134
- * @param dtmis - one dtmi represented as a string
135
- * @param options - options to govern behavior of model getter.
136
- */
137
- getModels(dtmis: string, options?: GetModelsOptions): Promise<{
138
- [dtmi: string]: unknown;
139
- }>;
140
- /**
141
- * Retrieve one or more models based upon on or more provided dtmis.
142
- * @param dtmis - dtmi strings in an array.
143
- * @param options - options to govern behavior of model getter.
144
- */
145
- getModels(dtmis: string[], options?: GetModelsOptions): Promise<{
146
- [dtmi: string]: unknown;
147
- }>;
148
- }
149
-
150
- /**
151
- * Options for creating a Pipeline to use with ModelsRepositoryClient.
152
- * It serves to configure the client itself, for instance by specifying
153
- * the repository location to use on any getModels call.
154
- */
155
- export declare interface ModelsRepositoryClientOptions extends CommonClientOptions {
156
- /**
157
- * This is the base location (URI or path) that requests will be made against for this client.
158
- */
159
- repositoryLocation?: string;
160
- /**
161
- * Though currently not relevant, can be used in future iterations to specify the API Version
162
- * of the service.
163
- */
164
- apiVersion?: string;
165
- /**
166
- * This is the format of dependency resolution (no dependency resolution, standard dependency
167
- * resolution, resolution using the expanded json format) that will be used when retrieving
168
- * models.
169
- */
170
- dependencyResolution?: dependencyResolutionType;
171
- }
172
-
173
- export { }