From f19be7a37e515273a090191bf86e5e2c4062508e Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Fri, 19 Feb 2021 15:02:40 -0800 Subject: [PATCH 01/81] first commit dmr --- common/config/rush/pnpm-lock.yaml | 51 ++- rush.json | 5 + .../models-repo-tool/.eslintrc.json | 27 ++ sdk/iotplugandplay/models-repo-tool/.npmrc | 1 + sdk/iotplugandplay/models-repo-tool/.nycrc | 14 + .../models-repo-tool/.vscode/launch.json | 56 +++ .../models-repo-tool/CHANGELOG.md | 3 + sdk/iotplugandplay/models-repo-tool/LICENSE | 21 ++ sdk/iotplugandplay/models-repo-tool/README.md | 58 ++++ .../models-repo-tool/api-extractor.json | 31 ++ .../models-repo-tool/out/src/DTDL.js | 5 + .../models-repo-tool/out/src/DTDL.js.map | 1 + .../out/src/dtmiConventions.js | 47 +++ .../out/src/dtmiConventions.js.map | 1 + .../models-repo-tool/out/src/index.js | 8 + .../models-repo-tool/out/src/index.js.map | 1 + .../out/src/localModelFetchers.js | 71 ++++ .../out/src/localModelFetchers.js.map | 1 + .../out/src/modelFetcherHandler.js | 50 +++ .../out/src/modelFetcherHandler.js.map | 1 + .../out/src/modelFetcherHelper.js | 21 ++ .../out/src/modelFetcherHelper.js.map | 1 + .../models-repo-tool/out/src/modelMetadata.js | 41 +++ .../out/src/modelMetadata.js.map | 1 + .../out/src/remoteModelFetchers.js | 78 +++++ .../out/src/remoteModelFetchers.js.map | 1 + .../models-repo-tool/out/src/resolver.js | 25 ++ .../models-repo-tool/out/src/resolver.js.map | 1 + .../out/test/browser/browserTest.spec.js | 28 ++ .../out/test/browser/browserTest.spec.js.map | 1 + .../out/test/node/dtmiConventions.spec.js | 146 ++++++++ .../out/test/node/dtmiConventions.spec.js.map | 1 + .../out/test/node/index.spec.js | 301 ++++++++++++++++ .../out/test/node/index.spec.js.map | 1 + .../models-repo-tool/package.json | 118 +++++++ .../models-repo-tool/rollup.config.js | 11 + .../samples/javascript/local_example.js | 32 ++ .../samples/javascript/package.json | 30 ++ .../samples/javascript/remote_example.js | 32 ++ .../samples/typescript/README.md | 73 ++++ .../samples/typescript/package.json | 39 +++ .../samples/typescript/src/example.ts | 22 ++ .../samples/typescript/tsconfig.json | 17 + .../models-repo-tool/src/CODE_STRUCTURE.md | 75 ++++ .../models-repo-tool/src/DTDL.ts | 17 + .../models-repo-tool/src/dtmiConventions.ts | 44 +++ .../models-repo-tool/src/index.ts | 5 + .../src/localModelFetchers.ts | 64 ++++ .../src/modelFetcherHandler.ts | 42 +++ .../src/modelFetcherHelper.ts | 21 ++ .../models-repo-tool/src/modelMetadata.ts | 44 +++ .../src/remoteModelFetchers.ts | 70 ++++ .../models-repo-tool/src/resolver.ts | 44 +++ .../test/browser/browserTest.spec.ts | 28 ++ .../test/node/dtmiConventions.spec.ts | 165 +++++++++ .../models-repo-tool/test/node/index.spec.ts | 320 ++++++++++++++++++ .../DeviceManagement/deviceinformation-1.json | 64 ++++ .../temperaturecontroller-1.expanded.json | 215 ++++++++++++ .../temperaturecontroller-1.json | 60 ++++ .../temperaturecontroller-2.json | 60 ++++ .../thermostat-1.expanded.json | 91 +++++ .../FakeDeviceManagement/thermostat-1.json | 89 +++++ .../models-repo-tool/tsconfig.json | 34 ++ 63 files changed, 3025 insertions(+), 1 deletion(-) create mode 100644 sdk/iotplugandplay/models-repo-tool/.eslintrc.json create mode 100644 sdk/iotplugandplay/models-repo-tool/.npmrc create mode 100644 sdk/iotplugandplay/models-repo-tool/.nycrc create mode 100644 sdk/iotplugandplay/models-repo-tool/.vscode/launch.json create mode 100644 sdk/iotplugandplay/models-repo-tool/CHANGELOG.md create mode 100644 sdk/iotplugandplay/models-repo-tool/LICENSE create mode 100644 sdk/iotplugandplay/models-repo-tool/README.md create mode 100644 sdk/iotplugandplay/models-repo-tool/api-extractor.json create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/index.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/index.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/resolver.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/resolver.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js create mode 100644 sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js.map create mode 100644 sdk/iotplugandplay/models-repo-tool/package.json create mode 100644 sdk/iotplugandplay/models-repo-tool/rollup.config.js create mode 100644 sdk/iotplugandplay/models-repo-tool/samples/javascript/local_example.js create mode 100644 sdk/iotplugandplay/models-repo-tool/samples/javascript/package.json create mode 100644 sdk/iotplugandplay/models-repo-tool/samples/javascript/remote_example.js create mode 100644 sdk/iotplugandplay/models-repo-tool/samples/typescript/README.md create mode 100644 sdk/iotplugandplay/models-repo-tool/samples/typescript/package.json create mode 100644 sdk/iotplugandplay/models-repo-tool/samples/typescript/src/example.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/samples/typescript/tsconfig.json create mode 100644 sdk/iotplugandplay/models-repo-tool/src/CODE_STRUCTURE.md create mode 100644 sdk/iotplugandplay/models-repo-tool/src/DTDL.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/src/dtmiConventions.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/src/index.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/src/localModelFetchers.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/src/modelFetcherHandler.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/src/modelFetcherHelper.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/src/modelMetadata.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/src/remoteModelFetchers.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/src/resolver.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/test/browser/browserTest.spec.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/test/node/dtmiConventions.spec.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/test/node/index.spec.ts create mode 100644 sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json create mode 100644 sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json create mode 100644 sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json create mode 100644 sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json create mode 100644 sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json create mode 100644 sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json create mode 100644 sdk/iotplugandplay/models-repo-tool/tsconfig.json diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 67e0a07a4379..05915aa4ab82 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -32,6 +32,7 @@ dependencies: '@rush-temp/eventgrid': file:projects/eventgrid.tgz '@rush-temp/eventhubs-checkpointstore-blob': file:projects/eventhubs-checkpointstore-blob.tgz '@rush-temp/identity': file:projects/identity.tgz + '@rush-temp/iot-plugandplay-models-repo-tool': file:projects/iot-plugandplay-models-repo-tool.tgz '@rush-temp/keyvault-admin': file:projects/keyvault-admin.tgz '@rush-temp/keyvault-certificates': file:projects/keyvault-certificates.tgz '@rush-temp/keyvault-common': file:projects/keyvault-common.tgz @@ -9274,6 +9275,50 @@ packages: integrity: sha512-RkgNLuiYgllsKZCWqAgG5YWRjgD/90RbafjKLQa/t0BYJLbvR3k/c9UVNGZDSh6ScpnSCmQ8eCr0+FGM3eB2yg== tarball: file:projects/identity.tgz version: 0.0.0 + file:projects/iot-plugandplay-models-repo-tool.tgz: + dependencies: + '@azure/core-tracing': 1.0.0-preview.9 + '@microsoft/api-extractor': 7.7.11 + '@opentelemetry/api': 0.10.2 + '@types/chai': 4.2.14 + '@types/chai-as-promised': 7.1.3 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + chai: 4.3.0 + chai-as-promised: 7.1.1_chai@4.3.0 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.19.0 + events: 3.2.0 + inherits: 2.0.4 + karma: 5.2.3 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@5.2.3 + karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@5.2.3 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 1.19.1 + rimraf: 3.0.2 + rollup: 1.32.1 + tslib: 2.1.0 + typedoc: 0.15.2 + typescript: 4.1.2 + util: 0.12.3 + dev: false + name: '@rush-temp/iot-plugandplay-models-repo-tool' + resolution: + integrity: sha512-o0sIVRXu073jlfUkqFeSv55+qmoyArKGH4V75WbtIGomYY/YTsgnJf5FlNAmER6bGnwLrgcIBm2yNmaAWoSjxw== + tarball: file:projects/iot-plugandplay-models-repo-tool.tgz + version: 0.0.0 file:projects/keyvault-admin.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.9 @@ -9561,6 +9606,9 @@ packages: file:projects/mock-hub.tgz: dependencies: '@types/node': 8.10.66 + dotenv: 8.2.0 + eslint: 7.19.0 + prettier: 1.19.1 rhea: 1.0.24 rimraf: 3.0.2 tslib: 2.1.0 @@ -9568,7 +9616,7 @@ packages: dev: false name: '@rush-temp/mock-hub' resolution: - integrity: sha512-2MtOIpVJk5Or798q7DCa4gKG3rSE+X+nk0lGPUDlbyXCNt4QDyxHMvrjSO02T6Bvv/KzfJNwIzsFLlgRAgmwQw== + integrity: sha512-Lro7rFcnDNWYuWUIr9czVrfJjSIadiaDU6I945N80JjHUW4RnMZ2WZY9Dr8v+iA1jlMEF7p6Sw0pzIpllGzQqA== tarball: file:projects/mock-hub.tgz version: 0.0.0 file:projects/monitor-opentelemetry-exporter.tgz: @@ -10546,6 +10594,7 @@ specifiers: '@rush-temp/eventgrid': file:./projects/eventgrid.tgz '@rush-temp/eventhubs-checkpointstore-blob': file:./projects/eventhubs-checkpointstore-blob.tgz '@rush-temp/identity': file:./projects/identity.tgz + '@rush-temp/iot-plugandplay-models-repo-tool': file:./projects/iot-plugandplay-models-repo-tool.tgz '@rush-temp/keyvault-admin': file:./projects/keyvault-admin.tgz '@rush-temp/keyvault-certificates': file:./projects/keyvault-certificates.tgz '@rush-temp/keyvault-common': file:./projects/keyvault-common.tgz diff --git a/rush.json b/rush.json index 2382a9981105..1e57eb88cfba 100644 --- a/rush.json +++ b/rush.json @@ -631,6 +631,11 @@ "packageName": "@azure/digital-twins-core", "projectFolder": "sdk/digitaltwins/digital-twins-core", "versionPolicyName": "client" + }, + { + "packageName": "@azure/iot-plugandplay-models-repo-tool", + "projectFolder": "sdk/iotplugandplay/models-repo-tool", + "versionPolicyName": "core" } ] } diff --git a/sdk/iotplugandplay/models-repo-tool/.eslintrc.json b/sdk/iotplugandplay/models-repo-tool/.eslintrc.json new file mode 100644 index 000000000000..dfdd7a770d20 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/.eslintrc.json @@ -0,0 +1,27 @@ +{ + "env": { + "browser": true, + "es6": true, + "node": true + }, + "extends": [ + "standard", + "plugin:mocha/recommended" + ], + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint", + "mocha" + ], + "rules": { + "no-redeclare": "off" + } +} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/.npmrc b/sdk/iotplugandplay/models-repo-tool/.npmrc new file mode 100644 index 000000000000..9cf9495031ec --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/.npmrc @@ -0,0 +1 @@ +package-lock=false \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/.nycrc b/sdk/iotplugandplay/models-repo-tool/.nycrc new file mode 100644 index 000000000000..fe3db50b6a48 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/.nycrc @@ -0,0 +1,14 @@ +{ + "include": [ + "dist-esm/src/**/*.js" + ], + "exclude": [ + "**/*.d.ts", + "dist-esm/src/generated/*" + ], + "exclude-after-remap": false, + "sourceMap": true, + "produce-source-map": true, + "instrument": true, + "all": true + } \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/.vscode/launch.json b/sdk/iotplugandplay/models-repo-tool/.vscode/launch.json new file mode 100644 index 000000000000..cd851651b12c --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/.vscode/launch.json @@ -0,0 +1,56 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Program", + "program": "${workspaceFolder}/samples/javascript/example.js", + "request": "launch", + "skipFiles": [ + "/**" + ], + "console": "integratedTerminal", + "type": "pwa-node" + }, + { + "name": "temp-unit-test", + "request": "launch", + "runtimeArgs": [ + "run", + "temp-unit-test" + ], + "runtimeExecutable": "npm", + "skipFiles": [ + "/**" + ], + "console": "externalTerminal", + "type": "pwa-node" + }, + { + "type": "chrome", + "request": "attach", + "name": "Attach Karma Chrome", + "address": "localhost", + "port": 9876, + "pathMapping": { + "/": "${workspaceRoot}/", + "/base/": "${workspaceRoot}/" + } + }, + { + "type": "pwa-node", + "request": "launch", + "name": "Launch Test", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}\\test\\node\\index.spec.ts", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/out/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/CHANGELOG.md b/sdk/iotplugandplay/models-repo-tool/CHANGELOG.md new file mode 100644 index 000000000000..d1770ea08556 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release History + +CURRENTLY NO RELEASE HISTORY. TO BE FILLED IN AFTER FIRST RELEASE. diff --git a/sdk/iotplugandplay/models-repo-tool/LICENSE b/sdk/iotplugandplay/models-repo-tool/LICENSE new file mode 100644 index 000000000000..4c529f375cc4 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/README.md b/sdk/iotplugandplay/models-repo-tool/README.md new file mode 100644 index 000000000000..22093708f73a --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/README.md @@ -0,0 +1,58 @@ +# Azure IoT Resolver library for Javascript + +The Azure IoT Resolver library for Javascript provides implementations for interacting with the Azure IoT Model Repository. Use the Azure IoT Resolver library for Javascript to pull DTDL files from remote endpoints. + +## Key concepts + +The Azure IoT Resolver library for Javascript is written to interact with the Azure IoT PlugAndPlay Models Repository, for those developers who wish to write applications in Javascript to do so. + + +## Examples + +*THIS WILL CHANGE WHEN MERGED INTO THE MONOREPO* + +To run the javascript examples, go to the samples directory: + +```bash +// FROM THIS DIRECTORY +$ npm install +$ npx tsc +$ cd samples/javascript +$ node example.js +``` + +## Run the temporary test script + +```bash +// FROM THIS DIRECTORY +$ npm install +$ npx tsc +$ npm run temp-unit-test +``` + +### General + +TODO + +### Additional documentation + +TODO + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + + +[azure_portal]: https://portal.azure.com +[npm]: https://www.npmjs.com/ +[iot_pnp_docs]: https://docs.microsoft.com/en-us/azure/iot-pnp/ diff --git a/sdk/iotplugandplay/models-repo-tool/api-extractor.json b/sdk/iotplugandplay/models-repo-tool/api-extractor.json new file mode 100644 index 000000000000..4c2071fb49da --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "types/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/template.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js b/sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js new file mode 100644 index 000000000000..b07b0c67f16c --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=DTDL.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js.map b/sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js.map new file mode 100644 index 000000000000..569f91bb5e90 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DTDL.js","sourceRoot":"","sources":["../../src/DTDL.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\ninterface Contents {\r\n '@type'?: string;\r\n 'name': string;\r\n 'schema': string;\r\n}\r\n\r\nexport interface DTDL extends JSON {\r\n '@context': any[],\r\n '@id': string,\r\n 'extends': string,\r\n 'contents': Contents[]\r\n}\r\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js b/sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js new file mode 100644 index 000000000000..a618f5894d01 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dtmiToQualifiedPath = exports.dtmiToPath = exports.isValidDtmi = void 0; +function isValidDtmi(dtmi) { + if (dtmi) { + const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/; + return re.test(dtmi); // true if dtmi matches regular expression, false otherwise + } + return false; // if not a string return false. +} +exports.isValidDtmi = isValidDtmi; +function dtmiToPath(dtmi) { + // presently this dtmi to path function does not return the path with a + // file format at the end, i.e. does not append .json or .expanded.json. + // that happens in the dtmiToQualifiedPath function + if (isValidDtmi(dtmi)) { + return `${dtmi.toLowerCase().replace(/:/gm, '/').replace(/;/gm, '-')}.json`; + } + else { + throw new Error('DTMI provided is invalid. Ensure it follows DTMI conventions.'); + } +} +exports.dtmiToPath = dtmiToPath; +function ensureStartsWithProtocol(text) { + const re = /^http[s]?:\/\//; + if (text.search(re) !== -1) { + return text; + } + else { + return `https://${text}`; + } +} +function dtmiToQualifiedPath(dtmi, endpoint, isExpanded) { + const dtmiAsPath = dtmiToPath(dtmi); + const endpointWithSlash = endpoint.endsWith('/') ? endpoint : `${endpoint}/`; + const urlEndpoint = ensureStartsWithProtocol(endpointWithSlash); + if (isExpanded) { + return `${urlEndpoint}${dtmiAsPath.replace(/json$/, 'expanded.json')}`; + } + else { + return `${urlEndpoint}${dtmiAsPath}`; + } +} +exports.dtmiToQualifiedPath = dtmiToQualifiedPath; +//# sourceMappingURL=dtmiConventions.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js.map b/sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js.map new file mode 100644 index 000000000000..aa9bf258127b --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dtmiConventions.js","sourceRoot":"","sources":["../../src/dtmiConventions.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;AAEZ,SAAgB,WAAW,CAAE,IAAY;IACvC,IAAI,IAAI,EAAE;QACR,MAAM,EAAE,GAAG,yGAAyG,CAAA;QACpH,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAC,2DAA2D;KACjF;IACD,OAAO,KAAK,CAAA,CAAC,gCAAgC;AAC/C,CAAC;AAND,kCAMC;AAED,SAAgB,UAAU,CAAE,IAAY;IACtC,uEAAuE;IACvE,wEAAwE;IACxE,mDAAmD;IAEnD,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;QACrB,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAA;KAC5E;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;KACjF;AACH,CAAC;AAVD,gCAUC;AAED,SAAS,wBAAwB,CAAE,IAAY;IAC7C,MAAM,EAAE,GAAG,gBAAgB,CAAA;IAC3B,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE;QAC1B,OAAO,IAAI,CAAA;KACZ;SAAM;QACL,OAAO,WAAW,IAAI,EAAE,CAAA;KACzB;AACH,CAAC;AAED,SAAgB,mBAAmB,CAAE,IAAY,EAAE,QAAgB,EAAE,UAAqB;IACxF,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;IACnC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAA;IAC5E,MAAM,WAAW,GAAG,wBAAwB,CAAC,iBAAiB,CAAC,CAAA;IAC/D,IAAI,UAAU,EAAE;QACd,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE,CAAA;KACvE;SAAM;QACL,OAAO,GAAG,WAAW,GAAG,UAAU,EAAE,CAAA;KACrC;AACH,CAAC;AATD,kDASC","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nexport function isValidDtmi (dtmi: string) {\r\n if (dtmi) {\r\n const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/\r\n return re.test(dtmi) // true if dtmi matches regular expression, false otherwise\r\n }\r\n return false // if not a string return false.\r\n}\r\n\r\nexport function dtmiToPath (dtmi: string) {\r\n // presently this dtmi to path function does not return the path with a\r\n // file format at the end, i.e. does not append .json or .expanded.json.\r\n // that happens in the dtmiToQualifiedPath function\r\n\r\n if (isValidDtmi(dtmi)) {\r\n return `${dtmi.toLowerCase().replace(/:/gm, '/').replace(/;/gm, '-')}.json`\r\n } else {\r\n throw new Error('DTMI provided is invalid. Ensure it follows DTMI conventions.')\r\n }\r\n}\r\n\r\nfunction ensureStartsWithProtocol (text: string) {\r\n const re = /^http[s]?:\\/\\//\r\n if (text.search(re) !== -1) {\r\n return text\r\n } else {\r\n return `https://${text}`\r\n }\r\n}\r\n\r\nexport function dtmiToQualifiedPath (dtmi: string, endpoint: string, isExpanded ?: boolean) {\r\n const dtmiAsPath = dtmiToPath(dtmi)\r\n const endpointWithSlash = endpoint.endsWith('/') ? endpoint : `${endpoint}/`\r\n const urlEndpoint = ensureStartsWithProtocol(endpointWithSlash)\r\n if (isExpanded) {\r\n return `${urlEndpoint}${dtmiAsPath.replace(/json$/, 'expanded.json')}`\r\n } else {\r\n return `${urlEndpoint}${dtmiAsPath}`\r\n }\r\n}\r\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/index.js b/sdk/iotplugandplay/models-repo-tool/out/src/index.js new file mode 100644 index 000000000000..73f07b3a33f1 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/index.js @@ -0,0 +1,8 @@ +"use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// exporting the resolver api +tslib_1.__exportStar(require("./resolver"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/index.js.map b/sdk/iotplugandplay/models-repo-tool/out/src/index.js.map new file mode 100644 index 000000000000..a77b1c41e7bf --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,6BAA6B;AAC7B,qDAA0B","sourcesContent":["// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n// exporting the resolver api\r\nexport * from './resolver'\r\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js b/sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js new file mode 100644 index 000000000000..0a6f2db269a3 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.recursiveFetcher = exports.fetcher = void 0; +const tslib_1 = require("tslib"); +const dtmiConventions = tslib_1.__importStar(require("./dtmiConventions")); +const modelMetadata = tslib_1.__importStar(require("./modelMetadata")); +const fs_1 = tslib_1.__importDefault(require("fs")); +const path = tslib_1.__importStar(require("path")); +const modelFetcherHelper_1 = require("./modelFetcherHelper"); +function recursiveFetcher(dtmi, directory, tryFromExpanded) { + return tslib_1.__awaiter(this, void 0, void 0, function* () { + let dependencyModels = {}; + let fetchedModels; + try { + console.log(`Fetching: ${dtmi}`); + fetchedModels = yield fetcher(dtmi, directory, tryFromExpanded); + } + catch (error) { + if (tryFromExpanded && error.code === 'ENOENT') { + console.log('Fetching from expanded failed. Trying without.'); + fetchedModels = yield fetcher(dtmi, directory, false); + } + else { + throw error; + } + } + const dtmis = Object.keys(fetchedModels); + for (let i = 0; i < dtmis.length; i++) { + const currentDtdl = fetchedModels[dtmis[i]]; + const metaModelData = modelMetadata.getModelMetadata(currentDtdl); + const deps = metaModelData.componentSchemas.concat(metaModelData.extends); + if (deps && deps.length > 0) { + for (let j = 0; j < deps.length; j++) { + if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) { + // do nothing + } + else { + const fetchedDependencies = yield recursiveFetcher(deps[j], directory, tryFromExpanded); + dependencyModels = Object.assign(Object.assign({}, dependencyModels), fetchedDependencies); + } + } + } + } + if (Object.keys(dependencyModels).length > 0) { + fetchedModels = Object.assign(Object.assign({}, fetchedModels), dependencyModels); + } + return fetchedModels; + }); +} +exports.recursiveFetcher = recursiveFetcher; +function fetcher(dtmi, directory, tryFromExpanded) { + return tslib_1.__awaiter(this, void 0, void 0, function* () { + const dtmiPath = dtmiConventions.dtmiToPath(dtmi); + const dtmiPathFormatted = tryFromExpanded ? dtmiPath.replace('.json', '.expanded.json') : dtmiPath; + const targetPath = path.join(directory, dtmiPathFormatted); + const dtdlFile = fs_1.default.readFileSync(targetPath, 'utf8'); + const parsedDtdl = JSON.parse(dtdlFile); + if (Array.isArray(parsedDtdl)) { + const result = modelFetcherHelper_1.flattenDtdlResponse(parsedDtdl); + return result; + } + else { + const result = { [dtmi]: parsedDtdl }; + return result; + } + }); +} +exports.fetcher = fetcher; +//# sourceMappingURL=localModelFetchers.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js.map b/sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js.map new file mode 100644 index 000000000000..863d52d77934 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"localModelFetchers.js","sourceRoot":"","sources":["../../src/localModelFetchers.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;;AAEZ,2EAAoD;AACpD,uEAAgD;AAEhD,oDAAmB;AACnB,mDAA4B;AAC5B,6DAA0D;AAE1D,SAAe,gBAAgB,CAAE,IAAY,EAAE,SAAiB,EAAE,eAAwB;;QACxF,IAAI,gBAAgB,GAAuB,EAAE,CAAA;QAC7C,IAAI,aAAmC,CAAA;QACvC,IAAI;YACF,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;YAChC,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,CAAA;SAChE;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,eAAe,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC9C,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAA;gBAC7D,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;aACtD;iBAAM;gBACL,MAAM,KAAK,CAAA;aACZ;SACF;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC3C,MAAM,aAAa,GAAG,aAAa,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;YACjE,MAAM,IAAI,GAAG,aAAa,CAAC,gBAAgB,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;YACzE,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpC,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;wBACnG,aAAa;qBACd;yBAAM;wBACL,MAAM,mBAAmB,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,CAAC,CAAA;wBACvF,gBAAgB,mCAAQ,gBAAgB,GAAK,mBAAmB,CAAE,CAAA;qBACnE;iBACF;aACF;SACF;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5C,aAAa,mCAAQ,aAAa,GAAK,gBAAgB,CAAE,CAAA;SAC1D;QACD,OAAO,aAAa,CAAA;IACtB,CAAC;CAAA;AAiBiB,4CAAgB;AAflC,SAAe,OAAO,CAAE,IAAY,EAAE,SAAiB,EAAE,eAAwB;;QAC/E,MAAM,QAAQ,GAAG,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACjD,MAAM,iBAAiB,GAAG,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;QAClG,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;QAC1D,MAAM,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;QACpD,MAAM,UAAU,GAAkB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QACtD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC7B,MAAM,MAAM,GAAG,wCAAmB,CAAC,UAAoB,CAAC,CAAA;YACxD,OAAO,MAAM,CAAA;SACd;aAAM;YACL,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,UAAkB,EAAE,CAAA;YAC7C,OAAO,MAAM,CAAA;SACd;IACH,CAAC;CAAA;AAEQ,0BAAO","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nimport * as dtmiConventions from './dtmiConventions'\r\nimport * as modelMetadata from './modelMetadata'\r\nimport { DTDL } from './DTDL'\r\nimport fs from 'fs'\r\nimport * as path from 'path'\r\nimport { flattenDtdlResponse } from './modelFetcherHelper'\r\n\r\nasync function recursiveFetcher (dtmi: string, directory: string, tryFromExpanded: boolean): Promise<{[x:string]: DTDL}> {\r\n let dependencyModels: {[x:string]: DTDL} = {}\r\n let fetchedModels: {[x: string]: DTDL }\r\n try {\r\n console.log(`Fetching: ${dtmi}`)\r\n fetchedModels = await fetcher(dtmi, directory, tryFromExpanded)\r\n } catch (error) {\r\n if (tryFromExpanded && error.code === 'ENOENT') {\r\n console.log('Fetching from expanded failed. Trying without.')\r\n fetchedModels = await fetcher(dtmi, directory, false)\r\n } else {\r\n throw error\r\n }\r\n }\r\n const dtmis = Object.keys(fetchedModels)\r\n for (let i = 0; i < dtmis.length; i++) {\r\n const currentDtdl = fetchedModels[dtmis[i]]\r\n const metaModelData = modelMetadata.getModelMetadata(currentDtdl)\r\n const deps = metaModelData.componentSchemas.concat(metaModelData.extends)\r\n if (deps && deps.length > 0) {\r\n for (let j = 0; j < deps.length; j++) {\r\n if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) {\r\n // do nothing\r\n } else {\r\n const fetchedDependencies = await recursiveFetcher(deps[j], directory, tryFromExpanded)\r\n dependencyModels = { ...dependencyModels, ...fetchedDependencies }\r\n }\r\n }\r\n }\r\n }\r\n if (Object.keys(dependencyModels).length > 0) {\r\n fetchedModels = { ...fetchedModels, ...dependencyModels }\r\n }\r\n return fetchedModels\r\n}\r\n\r\nasync function fetcher (dtmi: string, directory: string, tryFromExpanded: boolean): Promise<{ [dtmi: string]: DTDL }> {\r\n const dtmiPath = dtmiConventions.dtmiToPath(dtmi)\r\n const dtmiPathFormatted = tryFromExpanded ? dtmiPath.replace('.json', '.expanded.json') : dtmiPath\r\n const targetPath = path.join(directory, dtmiPathFormatted)\r\n const dtdlFile = fs.readFileSync(targetPath, 'utf8')\r\n const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile)\r\n if (Array.isArray(parsedDtdl)) {\r\n const result = flattenDtdlResponse(parsedDtdl as DTDL[])\r\n return result\r\n } else {\r\n const result = { [dtmi]: parsedDtdl as DTDL }\r\n return result\r\n }\r\n}\r\n\r\nexport { fetcher, recursiveFetcher }\r\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js b/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js new file mode 100644 index 000000000000..25681acc29fe --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.modelFetcher = void 0; +const tslib_1 = require("tslib"); +const fs = tslib_1.__importStar(require("fs")); +const url = tslib_1.__importStar(require("url")); +const localFetchers = tslib_1.__importStar(require("./localModelFetchers")); +const remoteFetchers = tslib_1.__importStar(require("./remoteModelFetchers")); +function isLocalPath(p) { + if (p.startsWith('https://') || p.startsWith('http://')) { + return false; + } + else if (p.startsWith('file://')) { + return true; + } + else { + try { + fs.accessSync(p); + return true; + } + catch (_a) { + return false; + } + } +} +function modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded) { + return tslib_1.__awaiter(this, void 0, void 0, function* () { + if (isLocalPath(endpoint)) { + const formattedDirectory = endpoint.includes('file://') ? url.fileURLToPath(endpoint) : endpoint; + if (tryFromExpanded || resolveDependencies) { + return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded); + } + else { + console.log(`Fetching: ${dtmi}`); + return localFetchers.fetcher(dtmi, formattedDirectory, false); + } + } + else { + if (tryFromExpanded || resolveDependencies) { + return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded); + } + console.log(`Fetching: ${dtmi}`); + return remoteFetchers.fetcher(dtmi, endpoint, false); + } + }); +} +exports.modelFetcher = modelFetcher; +//# sourceMappingURL=modelFetcherHandler.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js.map b/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js.map new file mode 100644 index 000000000000..b9e923c830d0 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"modelFetcherHandler.js","sourceRoot":"","sources":["../../src/modelFetcherHandler.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;;AAEZ,+CAAwB;AACxB,iDAA0B;AAC1B,4EAAqD;AACrD,8EAAuD;AAEvD,SAAS,WAAW,CAAE,CAAS;IAC7B,IAAI,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QACvD,OAAO,KAAK,CAAA;KACb;SAAM,IAAI,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAClC,OAAO,IAAI,CAAA;KACZ;SAAM;QACL,IAAI;YACF,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;YAChB,OAAO,IAAI,CAAA;SACZ;QAAC,WAAM;YACN,OAAO,KAAK,CAAA;SACb;KACF;AACH,CAAC;AAED,SAAsB,YAAY,CAAE,IAAY,EAAE,QAAgB,EAAE,mBAA4B,EAAE,eAAwB;;QACxH,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE;YACzB,MAAM,kBAAkB,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;YAChG,IAAI,eAAe,IAAI,mBAAmB,EAAE;gBAC1C,OAAO,aAAa,CAAC,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,EAAE,eAAe,CAAC,CAAA;aACjF;iBAAM;gBACL,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;gBAChC,OAAO,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAAA;aAC9D;SACF;aAAM;YACL,IAAI,eAAe,IAAI,mBAAmB,EAAE;gBAC1C,OAAO,cAAc,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAA;aACxE;YACD,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;YAChC,OAAO,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;SACrD;IACH,CAAC;CAAA;AAhBD,oCAgBC","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nimport * as fs from 'fs'\r\nimport * as url from 'url'\r\nimport * as localFetchers from './localModelFetchers'\r\nimport * as remoteFetchers from './remoteModelFetchers'\r\n\r\nfunction isLocalPath (p: string): boolean {\r\n if (p.startsWith('https://') || p.startsWith('http://')) {\r\n return false\r\n } else if (p.startsWith('file://')) {\r\n return true\r\n } else {\r\n try {\r\n fs.accessSync(p)\r\n return true\r\n } catch {\r\n return false\r\n }\r\n }\r\n}\r\n\r\nexport async function modelFetcher (dtmi: string, endpoint: string, resolveDependencies: boolean, tryFromExpanded: boolean): Promise<{ [dtmi: string]: JSON | Array }> {\r\n if (isLocalPath(endpoint)) {\r\n const formattedDirectory = endpoint.includes('file://') ? url.fileURLToPath(endpoint) : endpoint\r\n if (tryFromExpanded || resolveDependencies) {\r\n return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded)\r\n } else {\r\n console.log(`Fetching: ${dtmi}`)\r\n return localFetchers.fetcher(dtmi, formattedDirectory, false)\r\n }\r\n } else {\r\n if (tryFromExpanded || resolveDependencies) {\r\n return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded)\r\n }\r\n console.log(`Fetching: ${dtmi}`)\r\n return remoteFetchers.fetcher(dtmi, endpoint, false)\r\n }\r\n}\r\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js b/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js new file mode 100644 index 000000000000..2c01860ea205 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.flattenDtdlResponse = void 0; +function flattenDtdlResponse(input) { + const newResult = {}; + for (let i = 0; i++; i < input.length) { + const currentDtdl = input[i]; + if (!currentDtdl['@id']) { + throw new Error('no @id element found in DTDL. Ensure DTDL contains @id element'); + } + newResult[currentDtdl['@id']] = currentDtdl; + } + input.forEach((element) => { + newResult[element['@id']] = element; + }); + return newResult; +} +exports.flattenDtdlResponse = flattenDtdlResponse; +//# sourceMappingURL=modelFetcherHelper.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js.map b/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js.map new file mode 100644 index 000000000000..52cda8e487bf --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"modelFetcherHelper.js","sourceRoot":"","sources":["../../src/modelFetcherHelper.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;AAIZ,SAAgB,mBAAmB,CAAE,KAAa;IAChD,MAAM,SAAS,GAAwB,EAAE,CAAA;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE;QACrC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;SACnF;QACD,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAA;KAC5C;IACD,KAAK,CAAC,OAAO,CAAC,CAAC,OAAa,EAAE,EAAE;QAC9B,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,OAAO,CAAA;IACrC,CAAC,CAAC,CAAA;IACF,OAAO,SAAS,CAAA;AAClB,CAAC;AAbD,kDAaC","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n'use strict'\n\nimport { DTDL } from './DTDL'\n\nexport function flattenDtdlResponse (input: DTDL[]) {\n const newResult: {[x: string]: DTDL} = {}\n for (let i = 0; i++; i < input.length) {\n const currentDtdl = input[i]\n if (!currentDtdl['@id']) {\n throw new Error('no @id element found in DTDL. Ensure DTDL contains @id element');\n }\n newResult[currentDtdl['@id']] = currentDtdl\n }\n input.forEach((element: DTDL) => {\n newResult[element['@id']] = element\n })\n return newResult\n}\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js b/sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js new file mode 100644 index 000000000000..8301fdcfc43d --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getModelMetadata = void 0; +function getId(input) { + const idElement = input['@id']; + return idElement; +} +function getExtends(input) { + const extendElement = input.extends; + return extendElement; +} +function getComponentSchemas(input) { + const componentSchemas = []; + if (input.contents) { + const contents = input.contents; + contents.forEach((element) => { + if (element['@type'] && + (typeof element['@type'] === 'string') && + (element['@type'] === 'Component')) { + if (element.schema && typeof element.schema === 'string') { + componentSchemas.push(element.schema); + } + } + }); + } + return componentSchemas; +} +function getModelMetadata(input) { + const idElement = getId(input); + const extendsElement = getExtends(input); + const componentSchemas = getComponentSchemas(input); + return { + id: idElement, + extends: extendsElement, + componentSchemas: componentSchemas + }; +} +exports.getModelMetadata = getModelMetadata; +//# sourceMappingURL=modelMetadata.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js.map b/sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js.map new file mode 100644 index 000000000000..e7f84b3e9c53 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"modelMetadata.js","sourceRoot":"","sources":["../../src/modelMetadata.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;AAIZ,SAAS,KAAK,CAAE,KAAW;IACzB,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;IAC9B,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,UAAU,CAAE,KAAW;IAC9B,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAA;IACnC,OAAO,aAAa,CAAA;AACtB,CAAC;AAED,SAAS,mBAAmB,CAAE,KAAW;IACvC,MAAM,gBAAgB,GAAa,EAAE,CAAA;IACrC,IAAI,KAAK,CAAC,QAAQ,EAAE;QAClB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAA;QAC/B,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3B,IAAI,OAAO,CAAC,OAAO,CAAC;gBACd,CAAC,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;gBACtC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,EAAE;gBACxC,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;oBACxD,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;iBACtC;aACF;QACH,CAAC,CAAC,CAAA;KACH;IACD,OAAO,gBAAgB,CAAA;AACzB,CAAC;AAED,SAAgB,gBAAgB,CAAE,KAAW;IAC3C,MAAM,SAAS,GAAW,KAAK,CAAC,KAAK,CAAC,CAAA;IACtC,MAAM,cAAc,GAAW,UAAU,CAAC,KAAK,CAAC,CAAA;IAChD,MAAM,gBAAgB,GAAa,mBAAmB,CAAC,KAAK,CAAC,CAAA;IAC7D,OAAO;QACL,EAAE,EAAE,SAAS;QACb,OAAO,EAAE,cAAc;QACvB,gBAAgB,EAAE,gBAAgB;KACnC,CAAA;AACH,CAAC;AATD,4CASC","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nimport { DTDL } from './DTDL'\r\n\r\nfunction getId (input: DTDL): string {\r\n const idElement = input['@id']\r\n return idElement\r\n}\r\n\r\nfunction getExtends (input: DTDL): string {\r\n const extendElement = input.extends\r\n return extendElement\r\n}\r\n\r\nfunction getComponentSchemas (input: DTDL): string[] {\r\n const componentSchemas: string[] = []\r\n if (input.contents) {\r\n const contents = input.contents\r\n contents.forEach((element) => {\r\n if (element['@type'] &&\r\n (typeof element['@type'] === 'string') &&\r\n (element['@type'] === 'Component')) {\r\n if (element.schema && typeof element.schema === 'string') {\r\n componentSchemas.push(element.schema)\r\n }\r\n }\r\n })\r\n }\r\n return componentSchemas\r\n}\r\n\r\nexport function getModelMetadata (input: DTDL) {\r\n const idElement: string = getId(input)\r\n const extendsElement: string = getExtends(input)\r\n const componentSchemas: string[] = getComponentSchemas(input)\r\n return {\r\n id: idElement,\r\n extends: extendsElement,\r\n componentSchemas: componentSchemas\r\n }\n}\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js b/sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js new file mode 100644 index 000000000000..a3befb5572ab --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.recursiveFetcher = exports.fetcher = void 0; +const tslib_1 = require("tslib"); +const dtmiConventions = tslib_1.__importStar(require("./dtmiConventions")); +const modelMetadata = tslib_1.__importStar(require("./modelMetadata")); +const coreHttp = tslib_1.__importStar(require("@azure/core-http")); +const modelFetcherHelper_1 = require("./modelFetcherHelper"); +function recursiveFetcher(dtmi, endpoint, tryFromExpanded) { + return tslib_1.__awaiter(this, void 0, void 0, function* () { + let dependencyModels = {}; + let fetchedModels; + try { + console.log(`Fetching: ${dtmi}`); + fetchedModels = yield fetcher(dtmi, endpoint, tryFromExpanded); + } + catch (error) { + if (tryFromExpanded && (error.code === 'ENOENT' || !(error.statusCode >= 200 && error.statusCode < 400))) { + console.log('Fetching from expanded failed. Trying without.'); + console.log(`Fetching: ${dtmi}`); + fetchedModels = yield fetcher(dtmi, endpoint, false); + } + else { + throw error; + } + } + const dtmis = Object.keys(fetchedModels); + for (let i = 0; i < dtmis.length; i++) { + const currentDtdl = fetchedModels[dtmis[i]]; + const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas; + if (deps && deps.length > 0) { + for (let j = 0; j < deps.length; j++) { + if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) { + // do nothing + } + else { + const fetchedDependencies = yield recursiveFetcher(deps[j], endpoint, tryFromExpanded); + dependencyModels = Object.assign(Object.assign({}, dependencyModels), fetchedDependencies); + } + } + } + } + if (Object.keys(dependencyModels).length > 0) { + fetchedModels = Object.assign(Object.assign({}, fetchedModels), dependencyModels); + } + return fetchedModels; + }); +} +exports.recursiveFetcher = recursiveFetcher; +function fetcher(dtmi, endpoint, tryFromExpanded) { + return tslib_1.__awaiter(this, void 0, void 0, function* () { + const client = new coreHttp.ServiceClient(); + const req = { + url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), + method: 'GET' + }; + const res = yield client.sendRequest(req); + if (res.status >= 200 && res.status < 400) { + const dtdlAsString = res.bodyAsText || ''; + const parsedDtdl = JSON.parse(dtdlAsString); + if (Array.isArray(parsedDtdl)) { + const result = modelFetcherHelper_1.flattenDtdlResponse(parsedDtdl); + return result; + } + else { + const result = { [dtmi]: parsedDtdl }; + return result; + } + } + else { + throw new coreHttp.RestError('Error on HTTP Request in remote model fetcher', '404', 404, undefined, res); + } + }); +} +exports.fetcher = fetcher; +//# sourceMappingURL=remoteModelFetchers.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js.map b/sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js.map new file mode 100644 index 000000000000..7819575d29b9 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"remoteModelFetchers.js","sourceRoot":"","sources":["../../src/remoteModelFetchers.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;;AAEZ,2EAAoD;AACpD,uEAAgD;AAChD,mEAA4C;AAE5C,6DAA0D;AAE1D,SAAe,gBAAgB,CAAE,IAAY,EAAE,QAAgB,EAAE,eAAwB;;QACvF,IAAI,gBAAgB,GAAuB,EAAE,CAAA;QAC7C,IAAI,aAAmC,CAAA;QACvC,IAAI;YACF,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;YAChC,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAA;SAC/D;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,eAAe,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,UAAU,IAAI,GAAG,IAAI,KAAK,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,EAAE;gBACxG,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAA;gBAC7D,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;gBAChC,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;aACrD;iBAAM;gBACL,MAAM,KAAK,CAAA;aACZ;SACF;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC3C,MAAM,IAAI,GAAG,aAAa,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,gBAAgB,CAAA;YACzE,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpC,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;wBACnG,aAAa;qBACd;yBAAM;wBACL,MAAM,mBAAmB,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAA;wBACtF,gBAAgB,mCAAQ,gBAAgB,GAAK,mBAAmB,CAAE,CAAA;qBACnE;iBACF;aACF;SACF;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5C,aAAa,mCAAQ,aAAa,GAAK,gBAAgB,CAAE,CAAA;SAC1D;QACD,OAAO,aAAa,CAAA;IACtB,CAAC;CAAA;AAwBiB,4CAAgB;AAtBlC,SAAe,OAAO,CAAE,IAAY,EAAE,QAAgB,EAAE,eAAwB;;QAC9E,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAA;QAC3C,MAAM,GAAG,GAAmC;YAC1C,GAAG,EAAE,eAAe,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,CAAC;YACzE,MAAM,EAAE,KAAK;SACd,CAAA;QACD,MAAM,GAAG,GAAmC,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QACzE,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE;YACzC,MAAM,YAAY,GAAG,GAAG,CAAC,UAAU,IAAI,EAAE,CAAA;YACzC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;gBAC7B,MAAM,MAAM,GAAG,wCAAmB,CAAC,UAAoB,CAAC,CAAA;gBACxD,OAAO,MAAM,CAAA;aACd;iBAAM;gBACL,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,UAAkB,EAAE,CAAA;gBAC7C,OAAO,MAAM,CAAA;aACd;SACF;aAAM;YACL,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,+CAA+C,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,CAAC,CAAA;SAC1G;IACH,CAAC;CAAA;AAEQ,0BAAO","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nimport * as dtmiConventions from './dtmiConventions'\r\nimport * as modelMetadata from './modelMetadata'\r\nimport * as coreHttp from '@azure/core-http'\r\nimport { DTDL } from './DTDL'\r\nimport { flattenDtdlResponse } from './modelFetcherHelper'\r\n\r\nasync function recursiveFetcher (dtmi: string, endpoint: string, tryFromExpanded: boolean): Promise<{[dtmi: string]: DTDL }> {\r\n let dependencyModels: {[x:string]: DTDL} = {}\r\n let fetchedModels: {[x: string]: DTDL }\r\n try {\r\n console.log(`Fetching: ${dtmi}`)\r\n fetchedModels = await fetcher(dtmi, endpoint, tryFromExpanded)\r\n } catch (error) {\r\n if (tryFromExpanded && (error.code === 'ENOENT' || !(error.statusCode >= 200 && error.statusCode < 400))) {\r\n console.log('Fetching from expanded failed. Trying without.')\r\n console.log(`Fetching: ${dtmi}`)\r\n fetchedModels = await fetcher(dtmi, endpoint, false)\r\n } else {\r\n throw error\r\n }\r\n }\r\n const dtmis = Object.keys(fetchedModels)\r\n for (let i = 0; i < dtmis.length; i++) {\r\n const currentDtdl = fetchedModels[dtmis[i]]\r\n const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas\r\n if (deps && deps.length > 0) {\r\n for (let j = 0; j < deps.length; j++) {\r\n if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) {\r\n // do nothing\r\n } else {\r\n const fetchedDependencies = await recursiveFetcher(deps[j], endpoint, tryFromExpanded)\r\n dependencyModels = { ...dependencyModels, ...fetchedDependencies }\r\n }\r\n }\r\n }\r\n }\r\n if (Object.keys(dependencyModels).length > 0) {\r\n fetchedModels = { ...fetchedModels, ...dependencyModels }\r\n }\r\n return fetchedModels\r\n}\r\n\r\nasync function fetcher (dtmi: string, endpoint: string, tryFromExpanded: boolean): Promise<{[dtmi: string]: any }> {\r\n const client = new coreHttp.ServiceClient()\r\n const req: coreHttp.RequestPrepareOptions = {\r\n url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded),\r\n method: 'GET'\r\n }\r\n const res: coreHttp.HttpOperationResponse = await client.sendRequest(req)\r\n if (res.status >= 200 && res.status < 400) {\r\n const dtdlAsString = res.bodyAsText || ''\r\n const parsedDtdl = JSON.parse(dtdlAsString)\r\n if (Array.isArray(parsedDtdl)) {\r\n const result = flattenDtdlResponse(parsedDtdl as DTDL[])\r\n return result\r\n } else {\r\n const result = { [dtmi]: parsedDtdl as DTDL }\r\n return result\r\n }\r\n } else {\r\n throw new coreHttp.RestError('Error on HTTP Request in remote model fetcher', '404', 404, undefined, res)\r\n }\r\n}\r\n\r\nexport { fetcher, recursiveFetcher }\r\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/resolver.js b/sdk/iotplugandplay/models-repo-tool/out/src/resolver.js new file mode 100644 index 000000000000..e12e97ef4258 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/resolver.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolve = void 0; +const modelFetcherHandler_1 = require("./modelFetcherHandler"); +function checkIfTryFromExpanded(options) { + if (options && options.resolveDependencies && options.resolveDependencies === 'tryFromExpanded') { + return true; + } + return false; +} +function checkIfResolveDependencies(options) { + if (options && options.resolveDependencies && options.resolveDependencies === 'enabled') { + return true; + } + return false; +} +function resolve(dtmi, endpoint, options) { + const tryFromExpanded = checkIfTryFromExpanded(options); + const resolveDependencies = checkIfResolveDependencies(options); + return modelFetcherHandler_1.modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded); +} +exports.resolve = resolve; +//# sourceMappingURL=resolver.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/resolver.js.map b/sdk/iotplugandplay/models-repo-tool/out/src/resolver.js.map new file mode 100644 index 000000000000..007d3037d947 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/src/resolver.js.map @@ -0,0 +1 @@ +{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/resolver.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;AAEZ,+DAAoD;AAMpD,SAAS,sBAAsB,CAAE,OAAyB;IACxD,IAAI,OAAO,IAAI,OAAO,CAAC,mBAAmB,IAAI,OAAO,CAAC,mBAAmB,KAAK,iBAAiB,EAAE;QAC/F,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,0BAA0B,CAAE,OAAyB;IAC5D,IAAI,OAAO,IAAI,OAAO,CAAC,mBAAmB,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE;QACvF,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAaD,SAAS,OAAO,CAAE,IAAY,EAAE,QAAiB,EAAE,OAA0B;IAC3E,MAAM,eAAe,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAA;IACvD,MAAM,mBAAmB,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAA;IAE/D,OAAO,kCAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,mBAAmB,EAAE,eAAe,CAAC,CAAA;AAC3E,CAAC;AAEQ,0BAAO","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nimport { modelFetcher } from './modelFetcherHandler'\r\n\r\ninterface resolverOptions {\r\n resolveDependencies: 'disabled' | 'enabled' | 'tryFromExpanded'\r\n}\r\n\r\nfunction checkIfTryFromExpanded (options?: resolverOptions): boolean {\r\n if (options && options.resolveDependencies && options.resolveDependencies === 'tryFromExpanded') {\r\n return true\r\n }\r\n return false\r\n}\r\n\r\nfunction checkIfResolveDependencies (options?: resolverOptions): boolean {\r\n if (options && options.resolveDependencies && options.resolveDependencies === 'enabled') {\r\n return true\r\n }\r\n return false\r\n}\r\n\r\n/**\r\n * resolve - get interfaces (dtdls) associated to a given dtmi\r\n *\r\n * @param dtmi code used to label and organize dtdl\r\n * @param endpoint URL or local path for dtdl repository\r\n * @param options object containing optional parameters\r\n *\r\n * @returns Promise that resolves to mapping of dtmi(s) to JSON dtdl(s)\r\n */\r\nfunction resolve(dtmi: string, endpoint: string): Promise<{ [dtmi: string]: any}>\r\nfunction resolve(dtmi: string, endpoint: string, options: resolverOptions): Promise<{ [dtmi: string]: any}>\r\nfunction resolve (dtmi: string, endpoint : string, options ?: resolverOptions): Promise<{ [dtmi: string]:any}> {\r\n const tryFromExpanded = checkIfTryFromExpanded(options)\r\n const resolveDependencies = checkIfResolveDependencies(options)\r\n\r\n return modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded)\r\n}\r\n\r\nexport { resolve }\r\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js b/sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js new file mode 100644 index 000000000000..aeba11e8ad3b --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js @@ -0,0 +1,28 @@ +"use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const lib = tslib_1.__importStar(require("../../src")); +const chai_1 = require("chai"); +const sinon = tslib_1.__importStar(require("sinon")); +describe('resolver - browser', () => { + afterEach(() => { + sinon.restore(); + }); + describe('single resolution (no pseudo-parsing)', () => { + it.only('integration works in browser', function (done) { + const dtmi = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; + const endpoint = 'https://devicemodels.azure.com'; + const fakeData = JSON.stringify({ + fakeDtdl: 'fakeBodyAsText' + }); + const resolveResult = lib.resolve(dtmi, endpoint); + resolveResult.then((actualOutput) => { + chai_1.assert.deepStrictEqual({ [dtmi]: JSON.parse(fakeData) }, actualOutput); + done(); + }).catch((err) => done(err)); + }); + }); +}); +//# sourceMappingURL=browserTest.spec.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js.map b/sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js.map new file mode 100644 index 000000000000..e749d9a73714 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browserTest.spec.js","sourceRoot":"","sources":["../../../test/browser/browserTest.spec.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,uDAAgC;AAEhC,+BAA6B;AAC7B,qDAA8B;AAE9B,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;QACrD,EAAE,CAAC,IAAI,CAAC,8BAA8B,EAAE,UAAU,IAAI;YACpD,MAAM,IAAI,GAAW,iDAAiD,CAAA;YACtE,MAAM,QAAQ,GAAG,gCAAgC,CAAA;YACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;gBAC9B,QAAQ,EAAE,gBAAgB;aAC3B,CAAC,CAAA;YACF,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;YACjD,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;gBACvC,aAAM,CAAC,eAAe,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,CAAA;gBACtE,IAAI,EAAE,CAAA;YACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QACnC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport * as lib from '../../src'\r\n\r\nimport { assert } from 'chai'\r\nimport * as sinon from 'sinon'\r\n\r\ndescribe('resolver - browser', () => {\r\n afterEach(() => {\r\n sinon.restore()\r\n })\r\n\r\n describe('single resolution (no pseudo-parsing)', () => {\r\n it.only('integration works in browser', function (done) {\r\n const dtmi: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const endpoint = 'https://devicemodels.azure.com'\r\n const fakeData = JSON.stringify({\r\n fakeDtdl: 'fakeBodyAsText'\r\n })\r\n const resolveResult = lib.resolve(dtmi, endpoint)\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual({ [dtmi]: JSON.parse(fakeData) }, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n})\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js b/sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js new file mode 100644 index 000000000000..c2811e351f9b --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js @@ -0,0 +1,146 @@ +"use strict"; +/* eslint-disable no-undef */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const lib = tslib_1.__importStar(require("../../src/dtmiConventions")); +// fake class while lib not implemented +const sinon = tslib_1.__importStar(require("sinon")); +const chai_1 = require("chai"); +const validParameters = [ + { + dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;1', + path: 'dtmi/azure/devicemanagement/deviceinformation-1.json', + url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json' + }, + { + dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;10000', + path: 'dtmi/azure/devicemanagement/deviceinformation-10000.json', + url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-10000.json' + }, + { + dtmi: 'dtmi:com:DeviceInformation;1', + path: 'dtmi/com/deviceinformation-1.json', + url: 'https://contoso.com/dtmi/com/deviceinformation-1.json' + }, + { + dtmi: 'dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1', + path: 'dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json', + url: 'https://contoso.com/dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json' + }, + { + dtmi: 'dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7', + path: 'dtmi/azure/devicemanagement/thermometer-7.json', + url: 'https://contoso.com/dtmi/azure/devicemanagement/thermometer-7.json' + }, + { + dtmi: 'dtmi:thermometer;2', + path: 'dtmi/thermometer-2.json', + url: 'https://contoso.com/dtmi/thermometer-2.json' + } +]; +const invalidParameters = [ + { dtmi: 'dtmiazure:DeviceManagement:DeviceInformation;1' }, + { dtmi: 'dtmi;azure;DeviceManagement;DeviceInformation;1' }, + { dtmi: 'asdf' }, + { dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;-1' }, + { dtmi: 'dtmi:azure:DeviceManagement:Device-Information;1' }, + { dtmi: 'DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7' }, + { dtmi: 'dmti:azure:thermometer;10' } +]; +describe('dtmiConventions', function () { + afterEach(function () { + sinon.restore(); + }); + describe('isValidDtmi', function () { + describe('valid', function () { + function validTest(givenDtmi) { + const result = lib.isValidDtmi(givenDtmi); + chai_1.assert(result, 'valid dtmi not found as valid'); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should validate a correctly formatted dtmi (${validParameters[i].dtmi})`, function () { validTest(validParameters[i].dtmi); }); + } + }); + describe('invalid', function () { + function invalidTest(givenDtmi) { + const result = lib.isValidDtmi(givenDtmi); + chai_1.assert(!result, 'invalid dtmi incorrectly labelled as valid'); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should invalidate incorrectly formatted dtmi (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi); }); + } + }); + }); + describe('dtmiToPath', function () { + describe('valid', function () { + function validTest(givenDtmi, expectedPath) { + const result = lib.dtmiToPath(givenDtmi); + chai_1.assert.deepEqual(result, expectedPath); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a generic path (${validParameters[i].dtmi})`, function () { + validTest(validParameters[i].dtmi, validParameters[i].path); + }); + } + }); + describe('invalid', function () { + function invalidTest(givenDtmi) { + chai_1.expect(() => { + lib.dtmiToPath(givenDtmi); + }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.'); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi); }); + } + }); + }); + describe('dtmiToFullyQualifiedPath', function () { + describe('invalid', function () { + function invalidTest(givenDtmi) { + chai_1.expect(() => { + const fakeBasePath = 'https://contoso.com'; + lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); + }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.'); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi); }); + } + }); + describe('valid', function () { + describe('standard url', function () { + function reformatTest(givenDtmi, expected) { + const fakeBasePath = 'https://contoso.com'; + const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); + chai_1.assert.deepEqual(result, expected); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a qualified path (${validParameters[i].dtmi})`, function () { + reformatTest(validParameters[i].dtmi, validParameters[i].url); + }); + } + }); + describe('expanded url', function () { + function addExpandedTest(givenDtmi, expected) { + const fakeBasePath = 'https://contoso.com'; + const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, true); + chai_1.assert.deepEqual(result, expected); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a qualified path with expanded.json (${validParameters[i].dtmi})`, function () { + addExpandedTest(validParameters[i].dtmi, validParameters[i].url.replace('.json', '.expanded.json')); + }); + } + }); + }); + }); +}); +//# sourceMappingURL=dtmiConventions.spec.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js.map b/sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js.map new file mode 100644 index 000000000000..42ca798c28be --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dtmiConventions.spec.js","sourceRoot":"","sources":["../../../test/node/dtmiConventions.spec.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,uCAAuC;AACvC,kCAAkC;;;AAElC,uEAAgD;AAEhD,uCAAuC;AACvC,qDAA8B;AAC9B,+BAAqC;AAQrC,MAAM,eAAe,GAAkB;IACrC;QACE,IAAI,EAAE,iDAAiD;QACvD,IAAI,EAAE,sDAAsD;QAC5D,GAAG,EAAE,0EAA0E;KAChF;IACD;QACE,IAAI,EAAE,qDAAqD;QAC3D,IAAI,EAAE,0DAA0D;QAChE,GAAG,EAAE,8EAA8E;KACpF;IACD;QACE,IAAI,EAAE,8BAA8B;QACpC,IAAI,EAAE,mCAAmC;QACzC,GAAG,EAAE,uDAAuD;KAC7D;IACD;QACE,IAAI,EAAE,sDAAsD;QAC5D,IAAI,EAAE,2DAA2D;QACjE,GAAG,EAAE,+EAA+E;KACrF;IACD;QACE,IAAI,EAAE,2CAA2C;QACjD,IAAI,EAAE,gDAAgD;QACtD,GAAG,EAAE,oEAAoE;KAC1E;IACD;QACE,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,yBAAyB;QAC/B,GAAG,EAAE,6CAA6C;KACnD;CAEF,CAAA;AAED,MAAM,iBAAiB,GAAqB;IAC1C,EAAE,IAAI,EAAE,gDAAgD,EAAE;IAC1D,EAAE,IAAI,EAAE,iDAAiD,EAAE;IAC3D,EAAE,IAAI,EAAE,MAAM,EAAE;IAChB,EAAE,IAAI,EAAE,kDAAkD,EAAE;IAC5D,EAAE,IAAI,EAAE,kDAAkD,EAAE;IAC5D,EAAE,IAAI,EAAE,2CAA2C,EAAE;IACrD,EAAE,IAAI,EAAE,2BAA2B,EAAE;CACtC,CAAA;AAED,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,SAAS,CAAC;QACR,KAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,aAAa,EAAE;QACtB,QAAQ,CAAC,OAAO,EAAE;YAChB,SAAS,SAAS,CAAE,SAAiB;gBACnC,MAAM,MAAM,GAAG,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACzC,aAAM,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAA;YACjD,CAAC;YACD,sDAAsD;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/C,EAAE,CAAC,+CAA+C,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,cAAc,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;aAClI;QACH,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,SAAS,EAAE;YAClB,SAAS,WAAW,CAAE,SAAiB;gBACrC,MAAM,MAAM,GAAG,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACzC,aAAM,CAAC,CAAC,MAAM,EAAE,4CAA4C,CAAC,CAAA;YAC/D,CAAC;YACD,sDAAsD;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACjD,EAAE,CAAC,iDAAiD,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,cAAc,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;aAC1I;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,YAAY,EAAE;QACrB,QAAQ,CAAC,OAAO,EAAE;YAChB,SAAS,SAAS,CAAE,SAAiB,EAAE,YAAoB;gBACzD,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;gBACxC,aAAM,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;YACxC,CAAC;YACD,sDAAsD;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/C,EAAE,CAAC,6CAA6C,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EACxE;oBACE,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;gBAC7D,CAAC,CAAC,CAAA;aACL;QACH,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,SAAS,EAAE;YAClB,SAAS,WAAW,CAAE,SAAiB;gBACrC,aAAM,CAAC,GAAG,EAAE;oBACV,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;gBAC3B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAC9E,CAAC;YACD,sDAAsD;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACjD,EAAE,CAAC,uDAAuD,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,cAAc,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;aAChJ;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,0BAA0B,EAAE;QACnC,QAAQ,CAAC,SAAS,EAAE;YAClB,SAAS,WAAW,CAAE,SAAiB;gBACrC,aAAM,CAAC,GAAG,EAAE;oBACV,MAAM,YAAY,GAAG,qBAAqB,CAAA;oBAC1C,GAAG,CAAC,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;gBACzD,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAC9E,CAAC;YACD,sDAAsD;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACjD,EAAE,CAAC,uDAAuD,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,cAAc,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;aAChJ;QACH,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,OAAO,EAAE;YAChB,QAAQ,CAAC,cAAc,EAAE;gBACvB,SAAS,YAAY,CAAE,SAAiB,EAAE,QAAgB;oBACxD,MAAM,YAAY,GAAG,qBAAqB,CAAA;oBAC1C,MAAM,MAAM,GAAG,GAAG,CAAC,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;oBACtE,aAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;gBACpC,CAAC;gBACD,sDAAsD;gBACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAC/C,EAAE,CAAC,+CAA+C,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAC1E;wBACE,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;oBAC/D,CAAC,CAAC,CAAA;iBACL;YACH,CAAC,CAAC,CAAA;YAEF,QAAQ,CAAC,cAAc,EAAE;gBACvB,SAAS,eAAe,CAAE,SAAiB,EAAE,QAAgB;oBAC3D,MAAM,YAAY,GAAG,qBAAqB,CAAA;oBAC1C,MAAM,MAAM,GAAG,GAAG,CAAC,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;oBACrE,aAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;gBACpC,CAAC;gBAED,sDAAsD;gBACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAC/C,EAAE,CAAC,kEAAkE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAC7F;wBACE,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAA;oBACrG,CAAC,CAAC,CAAA;iBACL;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/* eslint-disable no-undef */\r\n// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport * as lib from '../../src/dtmiConventions'\r\n\r\n// fake class while lib not implemented\r\nimport * as sinon from 'sinon'\r\nimport { assert, expect } from 'chai'\r\n\r\ninterface ValidParams {\r\n dtmi: string,\r\n path: string,\r\n url: string\r\n}\r\n\r\nconst validParameters: ValidParams[] = [\r\n {\r\n dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;1',\r\n path: 'dtmi/azure/devicemanagement/deviceinformation-1.json',\r\n url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json'\r\n },\r\n {\r\n dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;10000',\r\n path: 'dtmi/azure/devicemanagement/deviceinformation-10000.json',\r\n url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-10000.json'\r\n },\r\n {\r\n dtmi: 'dtmi:com:DeviceInformation;1',\r\n path: 'dtmi/com/deviceinformation-1.json',\r\n url: 'https://contoso.com/dtmi/com/deviceinformation-1.json'\r\n },\r\n {\r\n dtmi: 'dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1',\r\n path: 'dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json',\r\n url: 'https://contoso.com/dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json'\r\n },\r\n {\r\n dtmi: 'dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7',\r\n path: 'dtmi/azure/devicemanagement/thermometer-7.json',\r\n url: 'https://contoso.com/dtmi/azure/devicemanagement/thermometer-7.json'\r\n },\r\n {\r\n dtmi: 'dtmi:thermometer;2',\r\n path: 'dtmi/thermometer-2.json',\r\n url: 'https://contoso.com/dtmi/thermometer-2.json'\r\n }\r\n\r\n]\r\n\r\nconst invalidParameters: {dtmi: string}[] = [\r\n { dtmi: 'dtmiazure:DeviceManagement:DeviceInformation;1' },\r\n { dtmi: 'dtmi;azure;DeviceManagement;DeviceInformation;1' },\r\n { dtmi: 'asdf' },\r\n { dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;-1' },\r\n { dtmi: 'dtmi:azure:DeviceManagement:Device-Information;1' },\r\n { dtmi: 'DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7' },\r\n { dtmi: 'dmti:azure:thermometer;10' }\r\n]\r\n\r\ndescribe('dtmiConventions', function () {\r\n afterEach(function () {\r\n sinon.restore()\r\n })\r\n\r\n describe('isValidDtmi', function () {\r\n describe('valid', function () {\r\n function validTest (givenDtmi: string) {\r\n const result = lib.isValidDtmi(givenDtmi)\r\n assert(result, 'valid dtmi not found as valid')\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < validParameters.length; i++) {\r\n it(`should validate a correctly formatted dtmi (${validParameters[i].dtmi})`, function () { validTest(validParameters[i].dtmi) })\r\n }\r\n })\r\n\r\n describe('invalid', function () {\r\n function invalidTest (givenDtmi: string) {\r\n const result = lib.isValidDtmi(givenDtmi)\r\n assert(!result, 'invalid dtmi incorrectly labelled as valid')\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < invalidParameters.length; i++) {\r\n it(`should invalidate incorrectly formatted dtmi (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) })\r\n }\r\n })\r\n })\r\n\r\n describe('dtmiToPath', function () {\r\n describe('valid', function () {\r\n function validTest (givenDtmi: string, expectedPath: string) {\r\n const result = lib.dtmiToPath(givenDtmi)\r\n assert.deepEqual(result, expectedPath)\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < validParameters.length; i++) {\r\n it(`should reformat a DTMI to a generic path (${validParameters[i].dtmi})`,\r\n function () {\r\n validTest(validParameters[i].dtmi, validParameters[i].path)\r\n })\r\n }\r\n })\r\n\r\n describe('invalid', function () {\r\n function invalidTest (givenDtmi: string) {\r\n expect(() => {\r\n lib.dtmiToPath(givenDtmi)\r\n }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.')\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < invalidParameters.length; i++) {\r\n it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) })\r\n }\r\n })\r\n })\r\n\r\n describe('dtmiToFullyQualifiedPath', function () {\r\n describe('invalid', function () {\r\n function invalidTest (givenDtmi: string) {\r\n expect(() => {\r\n const fakeBasePath = 'https://contoso.com'\r\n lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false)\r\n }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.')\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < invalidParameters.length; i++) {\r\n it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) })\r\n }\r\n })\r\n\r\n describe('valid', function () {\r\n describe('standard url', function () {\r\n function reformatTest (givenDtmi: string, expected: string) {\r\n const fakeBasePath = 'https://contoso.com'\r\n const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false)\r\n assert.deepEqual(result, expected)\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < validParameters.length; i++) {\r\n it(`should reformat a DTMI to a qualified path (${validParameters[i].dtmi})`,\r\n function () {\r\n reformatTest(validParameters[i].dtmi, validParameters[i].url)\r\n })\r\n }\r\n })\r\n\r\n describe('expanded url', function () {\r\n function addExpandedTest (givenDtmi: string, expected: string) {\r\n const fakeBasePath = 'https://contoso.com'\r\n const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, true)\r\n assert.deepEqual(result, expected)\r\n }\r\n\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < validParameters.length; i++) {\r\n it(`should reformat a DTMI to a qualified path with expanded.json (${validParameters[i].dtmi})`,\r\n function () {\r\n addExpandedTest(validParameters[i].dtmi, validParameters[i].url.replace('.json', '.expanded.json'))\r\n })\r\n }\r\n })\r\n })\r\n })\r\n})\r\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js b/sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js new file mode 100644 index 000000000000..ea0d44022486 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js @@ -0,0 +1,301 @@ +"use strict"; +/* eslint-disable no-undef */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const resolverTool = tslib_1.__importStar(require("../../src")); +const coreHttp = tslib_1.__importStar(require("@azure/core-http")); +const fs = tslib_1.__importStar(require("fs")); +const chai_1 = require("chai"); +const sinon = tslib_1.__importStar(require("sinon")); +const path = tslib_1.__importStar(require("path")); +describe('resolver - node', function () { + afterEach(function () { + sinon.restore(); + }); + describe('remote URL resolution', function () { + describe('simple DTDL resolution', function () { + it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { + const fakeDtmi = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'; + const fakeEndpoint = 'devicemodels.contoso.com'; + const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json'; + const fakeData = JSON.stringify({ + fakeDtdl: 'fakeBodyAsText' + }); + sinon.stub(coreHttp, 'ServiceClient') + .returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.'); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint); + chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); + resolveResult.then((actualOutput) => { + chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); + done(); + }).catch((err) => done(err)); + }); + }); + describe('depenency resolution (using pseudo-parsing)', function () { + it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { + const fakeDtmi = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'; + const fakeEndpoint = 'devicemodels.contoso.com'; + const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json'; + const fakeData = JSON.stringify({ + fakeKey: 'fakeValue' + }); + sinon.stub(coreHttp, 'ServiceClient') + .returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.'); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'enabled' }); + chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); + resolveResult.then((actualOutput) => { + chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); + done(); + }).catch((err) => done(err)); + }); + it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) { + const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'; + const fakeDtmi2 = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'; + const fakeDtmi3 = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; + const fakeEndpoint = 'devicemodels.contoso.com'; + const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json'; + const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json'; + const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json'; + const localDirectory = path.resolve('./test/node/testModelRepository'); + const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json'); + const fakeData = fs.readFileSync(pathToDtdl).toString(); + const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' }); + const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' }); + const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) }; + const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient'); + serviceClientStub.onFirstCall().returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.'); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + serviceClientStub.onSecondCall().returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.'); + return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); + } + }); + serviceClientStub.onThirdCall().returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.'); + return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); + } + }); + const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'enabled' }); + chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); + resolveResult.then((actualOutput) => { + chai_1.assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output'); + chai_1.assert.deepStrictEqual(expectedOutput, actualOutput); + done(); + }).catch((err) => done(err)); + }); + }); + describe('try from expanded (expanded.json)', function () { + it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { + const fakeDtmi = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'; + const fakeEndpoint = 'devicemodels.contoso.com'; + const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json'; + const fakeData = `[${JSON.stringify({ + '@id': fakeDtmi, + fakeDtdl: 'fakeBodyAsText' + })}]`; + sinon.stub(coreHttp, 'ServiceClient') + .returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.'); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' }); + chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); + resolveResult.then((actualOutput) => { + chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput); + done(); + }).catch((err) => done(err)); + }); + it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) { + const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'; + const fakeDtmi2 = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'; + const fakeDtmi3 = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; + const fakeEndpoint = 'devicemodels.contoso.com'; + const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json'; + const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json'; + const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json'; + const localDirectory = path.resolve('./test/node/testModelRepository'); + const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json'); + const fakeData = fs.readFileSync(pathToDtdl).toString(); + const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' }); + const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' }); + const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) }; + const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient'); + serviceClientStub.onCall(0).returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.'); + return Promise.resolve({ status: 404 }); + } + }); + serviceClientStub.onCall(1).returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.'); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + serviceClientStub.onCall(2).returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri2.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.'); + return Promise.resolve({ status: 404 }); + } + }); + serviceClientStub.onCall(3).returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.'); + return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); + } + }); + serviceClientStub.onCall(4).returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri3.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.'); + return Promise.resolve({ status: 404 }); + } + }); + serviceClientStub.onCall(5).returns({ + sendRequest: function (req) { + chai_1.assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.'); + return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); + } + }); + const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' }); + chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); + resolveResult.then((actualOutput) => { + chai_1.assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output'); + chai_1.assert.deepStrictEqual(expectedOutput, actualOutput); + done(); + }).catch((err) => done(err)); + }); + }); + }); + describe('local file resolution', function () { + describe('simple DTDL resolution', function () { + it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { + const fakeDtmi = 'dtmi:contoso:FakeDeviceManagement:thermostat;1'; + const localDirectory = path.resolve('./test/node/testModelRepository'); + const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json'); + const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, 'utf-8')); + const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory); + chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); + resolveResult.then((actualOutput) => { + chai_1.assert.deepStrictEqual({ [fakeDtmi]: fakeDtdl }, actualOutput, 'the expected dtmi mapping did not match the actual value.'); + done(); + }).catch((err) => done(err)); + }); + }); + describe('dependency resolution (using pseudo-parsing)', function () { + it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) { + const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'; + const fakeDtmi2 = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'; + const fakeDtmi3 = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; + const localDirectory = path.resolve('./test/node/testModelRepository'); + const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json'); + const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json'); + const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json'); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')); + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')); + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')); + const expectedOutput = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'enabled' }); + chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); + resolveResult.then((actualOutput) => { + chai_1.assert.deepStrictEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis do not match'); + Object.keys(actualOutput).forEach((outputDtmi) => { + chai_1.assert.deepStrictEqual(actualOutput[outputDtmi], expectedOutput[outputDtmi], `dtdls for given dtmi (${outputDtmi}) did not line up.`); + }); + chai_1.assert.deepStrictEqual(actualOutput, expectedOutput, 'the expected dtmi mapping did not match the actual value.'); + done(); + }).catch((err) => done(err)); + }); + it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { + const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:thermostat;1'; + const localDirectory = path.resolve('./test/node/testModelRepository'); + const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json'); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')); + const expectedResult = { + [fakeDtmi1]: fakeDtdl1 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory); + chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); + resolveResult.then((actualOutput) => { + chai_1.assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.'); + done(); + }).catch((err) => done(err)); + }); + }); + describe('try from expanded (expanded.json)', function () { + it('should return a promise that resolves to a mapping from the DTMIs to the JSON objects', function (done) { + const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'; + const fakeDtmi2 = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'; + const fakeDtmi3 = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; + const localDirectory = path.resolve('./test/node/testModelRepository'); + const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json'); + const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json'); + const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json'); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')); + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')); + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')); + const expectedResult = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' }); + chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); + resolveResult.then((actualOutput) => { + chai_1.assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.'); + done(); + }).catch((err) => done(err)); + }); + it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) { + const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2'; + const fakeDtmi2 = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'; + const fakeDtmi3 = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; + const localDirectory = path.resolve('./test/node/testModelRepository'); + const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json'); + const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json'); + const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json'); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')); + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')); + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')); + const expectedResult = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' }); + chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); + resolveResult.then((actualOutput) => { + chai_1.assert.deepEqual(Object.keys(expectedResult), Object.keys(actualOutput), 'the expected dtmis do not match'); + Object.keys(expectedResult).forEach(dtmiKey => { + chai_1.assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey]); + }); + done(); + }).catch((err) => done(err)); + }); + }); + }); +}); +//# sourceMappingURL=index.spec.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js.map b/sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js.map new file mode 100644 index 000000000000..6c7e005bbbaf --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../test/node/index.spec.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,uCAAuC;AACvC,kCAAkC;;;AAElC,gEAAyC;AACzC,mEAA4C;AAC5C,+CAAwB;AAExB,+BAA6B;AAC7B,qDAA8B;AAE9B,mDAA4B;AAE5B,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,SAAS,CAAC;QACR,KAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,uBAAuB,EAAE;QAChC,QAAQ,CAAC,wBAAwB,EAAE;YACjC,EAAE,CAAC,iFAAiF,EAAE,UAAU,IAAI;gBAClG,MAAM,QAAQ,GAAW,uDAAuD,CAAA;gBAChF,MAAM,YAAY,GAAG,0BAA0B,CAAA;gBAC/C,MAAM,WAAW,GAAG,6FAA6F,CAAA;gBACjH,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;oBAC9B,QAAQ,EAAE,gBAAgB;iBAC3B,CAAC,CAAA;gBACF,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC;qBAClC,OAAO,CAAC;oBACP,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,0CAA0C,CAAC,CAAA;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC/D,CAAC;iBACF,CAAC,CAAA;gBAEJ,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;gBAClE,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,CAAA;oBAC1E,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,6CAA6C,EAAE;YACtD,EAAE,CAAC,8HAA8H,EAAE,UAAU,IAAI;gBAC/I,MAAM,QAAQ,GAAW,uDAAuD,CAAA;gBAChF,MAAM,YAAY,GAAW,0BAA0B,CAAA;gBACvD,MAAM,WAAW,GAAG,6FAA6F,CAAA;gBACjH,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;oBAC9B,OAAO,EAAE,WAAW;iBACrB,CAAC,CAAA;gBACF,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC;qBAClC,OAAO,CAAC;oBACP,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,0CAA0C,CAAC,CAAA;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC/D,CAAC;iBACF,CAAC,CAAA;gBAEJ,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAC,CAAA;gBACtG,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,CAAA;oBAC1E,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;YAEF,EAAE,CAAC,yHAAyH,EAAE,UAAU,IAAI;gBAC1I,MAAM,SAAS,GAAW,2DAA2D,CAAA;gBACrF,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,SAAS,GAAW,iDAAiD,CAAA;gBAC3E,MAAM,YAAY,GAAW,0BAA0B,CAAA;gBACvD,MAAM,WAAW,GAAG,iGAAiG,CAAA;gBACrH,MAAM,YAAY,GAAG,sFAAsF,CAAA;gBAC3G,MAAM,YAAY,GAAG,uFAAuF,CAAA;gBAC5G,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gEAAgE,CAAC,CAAA;gBAC9G,MAAM,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAA;gBACvD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;gBAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAA;gBAC5D,MAAM,cAAc,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAA;gBACpI,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAA;gBAC/D,iBAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;oBACtC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,0CAA0C,CAAC,CAAA;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC/D,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC;oBACvC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,0CAA0C,CAAC,CAAA;wBACnF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAChE,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;oBACtC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,0CAA0C,CAAC,CAAA;wBACnF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAChE,CAAC;iBACF,CAAC,CAAA;gBAEF,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAC,CAAA;gBACvG,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,0DAA0D,CAAC,CAAA;oBACpI,aAAM,CAAC,eAAe,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;oBACpD,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,mCAAmC,EAAE;YAC5C,EAAE,CAAC,iFAAiF,EAAE,UAAU,IAAI;gBAClG,MAAM,QAAQ,GAAW,uDAAuD,CAAA;gBAChF,MAAM,YAAY,GAAG,0BAA0B,CAAA;gBAC/C,MAAM,WAAW,GAAG,sGAAsG,CAAA;gBAC1H,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC;oBAClC,KAAK,EAAE,QAAQ;oBACf,QAAQ,EAAE,gBAAgB;iBAC3B,CAAC,GAAG,CAAA;gBACL,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC;qBAClC,OAAO,CAAC;oBACP,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,0CAA0C,CAAC,CAAA;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC/D,CAAC;iBACF,CAAC,CAAA;gBAEJ,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC,CAAA;gBAC9G,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,YAAY,CAAC,CAAA;oBAC7E,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;YAEF,EAAE,CAAC,qGAAqG,EAAE,UAAU,IAAI;gBACtH,MAAM,SAAS,GAAW,2DAA2D,CAAA;gBACrF,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,SAAS,GAAW,iDAAiD,CAAA;gBAC3E,MAAM,YAAY,GAAW,0BAA0B,CAAA;gBACvD,MAAM,WAAW,GAAG,iGAAiG,CAAA;gBACrH,MAAM,YAAY,GAAG,sFAAsF,CAAA;gBAC3G,MAAM,YAAY,GAAG,uFAAuF,CAAA;gBAC5G,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gEAAgE,CAAC,CAAA;gBAC9G,MAAM,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAA;gBACvD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;gBAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAA;gBAC5D,MAAM,cAAc,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAA;gBACpI,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAA;gBAC/D,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,0CAA0C,CAAC,CAAA;wBACrH,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBACzC,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,0CAA0C,CAAC,CAAA;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC/D,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,0CAA0C,CAAC,CAAA;wBACtH,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBACzC,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,0CAA0C,CAAC,CAAA;wBACnF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAChE,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,0CAA0C,CAAC,CAAA;wBACtH,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBACzC,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,0CAA0C,CAAC,CAAA;wBACnF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAChE,CAAC;iBACF,CAAC,CAAA;gBAEF,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC,CAAA;gBAC/G,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,0DAA0D,CAAC,CAAA;oBACpI,aAAM,CAAC,eAAe,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;oBACpD,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,uBAAuB,EAAE;QAChC,QAAQ,CAAC,wBAAwB,EAAE;YACjC,EAAE,CAAC,iFAAiF,EAAE,UAAU,IAAI;gBAClG,MAAM,QAAQ,GAAW,gDAAgD,CAAA;gBACzE,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAA;gBACnG,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;gBACjE,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;gBACpE,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,EAAE,2DAA2D,CAAC,CAAA;oBAC3H,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,8CAA8C,EAAE;YACvD,EAAE,CAAC,yHAAyH,EAAE,UAAU,IAAI;gBAC1I,MAAM,SAAS,GAAW,2DAA2D,CAAA;gBACrF,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,SAAS,GAAW,iDAAiD,CAAA;gBAC3E,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gEAAgE,CAAC,CAAA;gBAC/G,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAA;gBACpG,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,sDAAsD,CAAC,CAAA;gBACrG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBAEnE,MAAM,cAAc,GAAG;oBACrB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;iBACvB,CAAA;gBACD,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAC,CAAA;gBACzG,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,oBAAoB,CAAC,CAAA;oBACpG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;wBAC/C,aAAM,CAAC,eAAe,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAAE,yBAAyB,UAAU,oBAAoB,CAAC,CAAA;oBACvI,CAAC,CAAC,CAAA;oBACF,aAAM,CAAC,eAAe,CAAC,YAAY,EAAE,cAAc,EAAE,2DAA2D,CAAC,CAAA;oBACjH,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;YAEF,EAAE,CAAC,8HAA8H,EAAE,UAAU,IAAI;gBAC/I,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAA;gBACpG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBAEnE,MAAM,cAAc,GAAG;oBACrB,CAAC,SAAS,CAAC,EAAE,SAAS;iBACvB,CAAA;gBACD,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;gBACrE,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,cAAc,EAAE,YAAY,EAAE,2DAA2D,CAAC,CAAA;oBACjH,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,mCAAmC,EAAE;YAC5C,EAAE,CAAC,uFAAuF,EAAE,UAAU,IAAI;gBACxG,MAAM,SAAS,GAAW,2DAA2D,CAAA;gBACrF,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,SAAS,GAAW,iDAAiD,CAAA;gBAC3E,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gEAAgE,CAAC,CAAA;gBAC/G,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAA;gBACpG,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,sDAAsD,CAAC,CAAA;gBACrG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBAEnE,MAAM,cAAc,GAAG;oBACrB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;iBACvB,CAAA;gBACD,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC,CAAA;gBACjH,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,cAAc,EAAE,YAAY,EAAE,2DAA2D,CAAC,CAAA;oBACjH,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;YAEF,EAAE,CAAC,qGAAqG,EAAE,UAAU,IAAI;gBACtH,MAAM,SAAS,GAAW,2DAA2D,CAAA;gBACrF,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,SAAS,GAAW,iDAAiD,CAAA;gBAC3E,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gEAAgE,CAAC,CAAA;gBAC/G,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAA;gBACpG,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,sDAAsD,CAAC,CAAA;gBACrG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBAEnE,MAAM,cAAc,GAAG;oBACrB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;iBACvB,CAAA;gBACD,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC,CAAA;gBACjH,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,iCAAiC,CAAC,CAAA;oBAC3G,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;wBAC5C,aAAM,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;oBAClE,CAAC,CAAC,CAAA;oBACF,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/* eslint-disable no-undef */\r\n// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport * as resolverTool from '../../src'\r\nimport * as coreHttp from '@azure/core-http'\r\nimport * as fs from 'fs'\r\n\r\nimport { assert } from 'chai'\r\nimport * as sinon from 'sinon'\r\n\r\nimport * as path from 'path'\r\n\r\ndescribe('resolver - node', function () {\r\n afterEach(function () {\r\n sinon.restore()\r\n })\r\n\r\n describe('remote URL resolution', function () {\r\n describe('simple DTDL resolution', function () {\r\n it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) {\r\n const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'\r\n const fakeEndpoint = 'devicemodels.contoso.com'\r\n const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json'\r\n const fakeData = JSON.stringify({\r\n fakeDtdl: 'fakeBodyAsText'\r\n })\r\n sinon.stub(coreHttp, 'ServiceClient')\r\n .returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData, status: 200 })\r\n }\r\n })\r\n\r\n const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint)\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n\r\n describe('depenency resolution (using pseudo-parsing)', function () {\r\n it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) {\r\n const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'\r\n const fakeEndpoint: string = 'devicemodels.contoso.com'\r\n const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json'\r\n const fakeData = JSON.stringify({\r\n fakeKey: 'fakeValue'\r\n })\r\n sinon.stub(coreHttp, 'ServiceClient')\r\n .returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData, status: 200 })\r\n }\r\n })\r\n\r\n const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'enabled' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n\r\n it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'\r\n const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'\r\n const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const fakeEndpoint: string = 'devicemodels.contoso.com'\r\n const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json'\r\n const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json'\r\n const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json')\r\n const fakeData = fs.readFileSync(pathToDtdl).toString()\r\n const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' })\r\n const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' })\r\n const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) }\r\n const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient')\r\n serviceClientStub.onFirstCall().returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData, status: 200 })\r\n }\r\n })\r\n serviceClientStub.onSecondCall().returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData2, status: 200 })\r\n }\r\n })\r\n serviceClientStub.onThirdCall().returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData3, status: 200 })\r\n }\r\n })\r\n\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'enabled' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output')\r\n assert.deepStrictEqual(expectedOutput, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n\r\n describe('try from expanded (expanded.json)', function () {\r\n it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) {\r\n const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'\r\n const fakeEndpoint = 'devicemodels.contoso.com'\r\n const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json'\r\n const fakeData = `[${JSON.stringify({\r\n '@id': fakeDtmi,\r\n fakeDtdl: 'fakeBodyAsText'\r\n })}]`\r\n sinon.stub(coreHttp, 'ServiceClient')\r\n .returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData, status: 200 })\r\n }\r\n })\r\n\r\n const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n\r\n it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'\r\n const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'\r\n const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const fakeEndpoint: string = 'devicemodels.contoso.com'\r\n const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json'\r\n const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json'\r\n const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json')\r\n const fakeData = fs.readFileSync(pathToDtdl).toString()\r\n const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' })\r\n const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' })\r\n const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) }\r\n const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient')\r\n serviceClientStub.onCall(0).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.')\r\n return Promise.resolve({ status: 404 })\r\n }\r\n })\r\n serviceClientStub.onCall(1).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData, status: 200 })\r\n }\r\n })\r\n serviceClientStub.onCall(2).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri2.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.')\r\n return Promise.resolve({ status: 404 })\r\n }\r\n })\r\n serviceClientStub.onCall(3).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData2, status: 200 })\r\n }\r\n })\r\n serviceClientStub.onCall(4).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri3.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.')\r\n return Promise.resolve({ status: 404 })\r\n }\r\n })\r\n serviceClientStub.onCall(5).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData3, status: 200 })\r\n }\r\n })\r\n\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output')\r\n assert.deepStrictEqual(expectedOutput, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n })\r\n\r\n describe('local file resolution', function () {\r\n describe('simple DTDL resolution', function () {\r\n it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) {\r\n const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:thermostat;1'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json')\r\n const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, 'utf-8'))\r\n const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory)\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual({ [fakeDtmi]: fakeDtdl }, actualOutput, 'the expected dtmi mapping did not match the actual value.')\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n\r\n describe('dependency resolution (using pseudo-parsing)', function () {\r\n it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'\r\n const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'\r\n const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json')\r\n const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json')\r\n const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json')\r\n const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8'))\r\n const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8'))\r\n const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8'))\r\n\r\n const expectedOutput = {\r\n [fakeDtmi1]: fakeDtdl1,\r\n [fakeDtmi2]: fakeDtdl2,\r\n [fakeDtmi3]: fakeDtdl3\r\n }\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'enabled' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis do not match')\r\n Object.keys(actualOutput).forEach((outputDtmi) => {\r\n assert.deepStrictEqual(actualOutput[outputDtmi], expectedOutput[outputDtmi], `dtdls for given dtmi (${outputDtmi}) did not line up.`)\r\n })\r\n assert.deepStrictEqual(actualOutput, expectedOutput, 'the expected dtmi mapping did not match the actual value.')\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n\r\n it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:thermostat;1'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json')\r\n const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8'))\r\n\r\n const expectedResult = {\r\n [fakeDtmi1]: fakeDtdl1\r\n }\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory)\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.')\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n\r\n describe('try from expanded (expanded.json)', function () {\r\n it('should return a promise that resolves to a mapping from the DTMIs to the JSON objects', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'\r\n const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'\r\n const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json')\r\n const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json')\r\n const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json')\r\n const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8'))\r\n const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8'))\r\n const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8'))\r\n\r\n const expectedResult = {\r\n [fakeDtmi1]: fakeDtdl1,\r\n [fakeDtmi2]: fakeDtdl2,\r\n [fakeDtmi3]: fakeDtdl3\r\n }\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.')\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n\r\n it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2'\r\n const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'\r\n const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json')\r\n const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json')\r\n const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json')\r\n const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8'))\r\n const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8'))\r\n const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8'))\r\n\r\n const expectedResult = {\r\n [fakeDtmi1]: fakeDtdl1,\r\n [fakeDtmi2]: fakeDtdl2,\r\n [fakeDtmi3]: fakeDtdl3\r\n }\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepEqual(Object.keys(expectedResult), Object.keys(actualOutput), 'the expected dtmis do not match')\r\n Object.keys(expectedResult).forEach(dtmiKey => {\r\n assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey])\r\n })\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n })\r\n})\r\n"]} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/package.json b/sdk/iotplugandplay/models-repo-tool/package.json new file mode 100644 index 000000000000..aeb45620c678 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/package.json @@ -0,0 +1,118 @@ +{ + "name": "@azure/iot-plugandplay-models-repo-tool", + "version": "0.0.1", + "description": "Device Model Repository Library with typescript type definitions for node.js and browser.", + "sdk-type": "client", + "main": "dist/index.js", + "module": "dist-esm/src/index.js", + "browser": { + "stream": "./node_modules/stream-browserify/index.js", + "./dist-esm/src/print.js": "./dist-esm/src/print.browser.js" + }, + "types": "types/template.d.ts", + "scripts": { + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", + "build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1", + "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", + "build:samples": "dev-tool samples prep && cd dist-samples && tsc -p .", + "build:test": "tsc -p . && rollup -c 2>&1", + "build": "tsc -p . && rollup -c 2>&1 && api-extractor run --local", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "clean": "rimraf dist dist-* test-dist temp types *.tgz *.log", + "execute:samples": "npm run build:samples && dev-tool samples run dist-samples/javascript dist-samples/typescript/dist/dist-samples/typescript/src/", + "extract-api": "tsc -p . && api-extractor run --local", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "integration-test:browser": "karma start --single-run", + "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}/*.spec.js\"", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", + "lint": "eslint package.json api-extractor.json src test --ext .ts", + "pack": "npm pack 2>&1", + "prebuild": "npm run clean", + "test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node", + "test": "npm run build:test && npm run unit-test && npm run integration-test", + "unit-test:browser": "karma start --single-run", + "unit-test:node": "mocha --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/{,!(browser)/**/}/*.spec.ts\"", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "temp-unit-test": "mocha -r ts-node/register --timeout 1200000 test/node/*.spec.ts" + }, + "files": [ + "dist/", + "dist-esm/src/", + "types/template.d.ts", + "README.md", + "LICENSE" + ], + "repository": "github:Azure/azure-sdk-for-js", + "engines": { + "node": ">=10.0.0" + }, + "keywords": [ + "azure", + "cloud", + "typescript" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/", + "sideEffects": false, + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "dependencies": { + "@azure/core-http": "^1.2.0", + "@azure/core-tracing": "1.0.0-preview.9", + "@azure/logger": "^1.0.0", + "@opentelemetry/api": "^0.10.2", + "events": "^3.0.0", + "tslib": "^2.0.0" + }, + "devDependencies": { + "@azure/dev-tool": "^1.0.0", + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/identity": "^1.1.0", + "@azure/test-utils-recorder": "^1.0.0", + "@microsoft/api-extractor": "7.7.11", + "@types/chai": "^4.1.6", + "@types/chai-as-promised": "^7.1.0", + "@types/mocha": "^7.0.2", + "@types/node": "^8.0.0", + "chai": "^4.2.0", + "chai-as-promised": "^7.1.1", + "cross-env": "^7.0.2", + "dotenv": "^8.2.0", + "eslint": "^7.15.0", + "inherits": "^2.0.3", + "karma": "^5.1.0", + "karma-chrome-launcher": "^3.0.0", + "karma-coverage": "^2.0.0", + "karma-edge-launcher": "^0.4.2", + "karma-env-preprocessor": "^0.1.1", + "karma-firefox-launcher": "^1.1.0", + "karma-ie-launcher": "^1.0.0", + "karma-json-preprocessor": "^0.3.3", + "karma-json-to-file-reporter": "^1.0.1", + "karma-junit-reporter": "^2.0.1", + "karma-mocha": "^2.0.1", + "karma-mocha-reporter": "^2.2.5", + "mocha": "^7.1.1", + "mocha-junit-reporter": "^1.18.0", + "nyc": "^14.0.0", + "prettier": "^1.16.4", + "rimraf": "^3.0.0", + "rollup": "^1.16.3", + "typedoc": "0.15.2", + "typescript": "4.1.2", + "util": "^0.12.1" + }, + "standard": { + "env": [ + "mocha" + ] + }, + "//smokeTestConfiguration": { + "skipFolder": true + } +} diff --git a/sdk/iotplugandplay/models-repo-tool/rollup.config.js b/sdk/iotplugandplay/models-repo-tool/rollup.config.js new file mode 100644 index 000000000000..cf168cc1d7a7 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/rollup.config.js @@ -0,0 +1,11 @@ +import resolve from '@rollup/plugin-node-resolve' +import auto from '@rollup/plugin-auto-install' + +export default { + input: 'dist-esm/index.js', + output: { + file: 'bundle.js', + format: 'cjs' + }, + plugins: [ auto(), resolve()], +} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/samples/javascript/local_example.js b/sdk/iotplugandplay/models-repo-tool/samples/javascript/local_example.js new file mode 100644 index 000000000000..a7911da0286e --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/samples/javascript/local_example.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/** + * Demonstrates resolving/obtaining a particular model definition from a remote model repository + */ + +const resolver = require('../../out/src/index.js') + +// You can change the endpoint and dtmi you'd like to access +const directory = process.argv[2] || 'C:/' +const dtmi = 'dtmi:com:example:TemperatureController;1' + +console.log(directory, dtmi) + +async function main () { + // This is where you can change the options for how you want to resolve the dependencies. + const result = await resolver.resolve(dtmi, directory, { resolveDependencies: 'enabled' }) + console.log(result) + Object.keys(result).forEach((fetchedDtmi) => { + console.log(`DTMI is: ${fetchedDtmi}`) + console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`) + console.log(`DTDL Description is: ${result[fetchedDtmi].description}`) + console.log('------------------------------------------------') + console.log(JSON.stringify(result[fetchedDtmi])) + console.log('------------------------------------------------') + }) +} + +main().catch((err) => { + console.error('The sample encountered an error:', err) +}) diff --git a/sdk/iotplugandplay/models-repo-tool/samples/javascript/package.json b/sdk/iotplugandplay/models-repo-tool/samples/javascript/package.json new file mode 100644 index 000000000000..96c88131e8a9 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/samples/javascript/package.json @@ -0,0 +1,30 @@ +{ + "name": "azure-modelsrepository-samples-js", + "private": true, + "version": "0.1.0", + "description": "Azure models repository client library samples for JavaScript", + "engine": { + "node": ">=8.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/template/template" + }, + "keywords": [ + "Azure", + "Node.js", + "JavaScript" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template", + "sideEffects": false, + "dependencies": { + "@azure/template": "latest", + "dotenv": "^8.2.0" + } + } \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/samples/javascript/remote_example.js b/sdk/iotplugandplay/models-repo-tool/samples/javascript/remote_example.js new file mode 100644 index 000000000000..adccea78b3a7 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/samples/javascript/remote_example.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/** + * Demonstrates resolving/obtaining a particular model definition from a remote model repository + */ + +const resolver = require('../../out/src/index.js') + +// You can change the endpoint and dtmi you'd like to access +const repositoryEndpoint = 'https://devicemodels.azure.com/' +const dtmi = process.argv[2] || 'dtmi:rigado:FlicButton;2' + +console.log(repositoryEndpoint, dtmi) + +async function main () { + // This is where you can change the options for how you want to resolve the dependencies. + const result = await resolver.resolve(dtmi, repositoryEndpoint, { resolveDependencies: 'tryFromExpanded' }) + console.log(result) + Object.keys(result).forEach((fetchedDtmi) => { + console.log(`DTMI is: ${fetchedDtmi}`) + console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`) + console.log(`DTDL Description is: ${result[fetchedDtmi].description}`) + console.log('------------------------------------------------') + console.log(JSON.stringify(result[fetchedDtmi])) + console.log('------------------------------------------------') + }) +} + +main().catch((err) => { + console.error('The sample encountered an error:', err) +}) diff --git a/sdk/iotplugandplay/models-repo-tool/samples/typescript/README.md b/sdk/iotplugandplay/models-repo-tool/samples/typescript/README.md new file mode 100644 index 000000000000..7bf7563dcab7 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/samples/typescript/README.md @@ -0,0 +1,73 @@ + + + + +# Azure Template client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for Azure Template in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| [sampleTemplate.ts][sampleTemplate] | sample template | + +## Prerequisites + +The samples are compatible with Node.js >= 8.0.0. + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. Samples retrieve credentials to access the endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/sampleTemplate.js +``` + +Alternatively, run a single sample with the correct environment variables set (step 3 is not required if you do this), for example (cross-platform): + +```bash +npx cross-env ENDPOINT="" API_KEY="" node dist/sampleTemplate.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[sampleTemplate]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template/samples/typescript/src/sampleTemplate.ts +[apiref]: https://docs.microsoft.com/javascript/api +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/samples/typescript/package.json b/sdk/iotplugandplay/models-repo-tool/samples/typescript/package.json new file mode 100644 index 000000000000..b0b033340d07 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/samples/typescript/package.json @@ -0,0 +1,39 @@ +{ + "name": "azure-template-samples-ts", + "private": true, + "version": "0.1.0", + "description": "Azure template client library samples for TypeScript", + "engine": { + "node": ">=8.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/template/template" + }, + "keywords": [ + "Azure", + "Node.js", + "TypeScript" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template", + "sideEffects": false, + "dependencies": { + "@azure/template": "latest", + "dotenv": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "rimraf": "^3.0.0", + "typescript": "~3.6.4" + } +} diff --git a/sdk/iotplugandplay/models-repo-tool/samples/typescript/src/example.ts b/sdk/iotplugandplay/models-repo-tool/samples/typescript/src/example.ts new file mode 100644 index 000000000000..ee2bfb362869 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/samples/typescript/src/example.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/** + * Demonstrates resolving/obtaining a particular model definition from a remote model repository + */ + +import * as resolver from '@azure/iot-modelsrepository-resolver' + +const repositoryEndpoint = 'devicemodels.azure.com' +const dtmi = process.argv[2] || 'dtmi:azure:DeviceManagement:DeviceInformation;1' + +console.log(repositoryEndpoint, dtmi) + +async function main () { + const result = await resolver.resolve(dtmi, repositoryEndpoint) + console.log(result) +} + +main().catch((err) => { + console.error('The sample encountered an error:', err) +}) diff --git a/sdk/iotplugandplay/models-repo-tool/samples/typescript/tsconfig.json b/sdk/iotplugandplay/models-repo-tool/samples/typescript/tsconfig.json new file mode 100644 index 000000000000..ff3cc4c38734 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/samples/typescript/tsconfig.json @@ -0,0 +1,17 @@ + +{ + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + + "allowSyntheticDefaultImports": true, + + "strict": true, + "alwaysStrict": true, + + "outDir": "dist", + "rootDir": "src" + }, + "include": ["src/**.ts"], + "exclude": ["node_modules"] +} diff --git a/sdk/iotplugandplay/models-repo-tool/src/CODE_STRUCTURE.md b/sdk/iotplugandplay/models-repo-tool/src/CODE_STRUCTURE.md new file mode 100644 index 000000000000..02ad5183f5e1 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/src/CODE_STRUCTURE.md @@ -0,0 +1,75 @@ +## index.ts + +For all typescript files there should be an entrance point. That is `index.ts`. This file serves as a translation point per-se, since it should not have any 'logic' code in it. What is exported through this file defines the API of the resolver library. + +Though this is in a client folder, this is not really a client. It is a helper library. Because of the idiosynicatic differences between js, python, and C# (the currently implemented model repo 'clients'), C# is more like a client in that it has instantiation and a slightly different API. + +For js (aka Node), instantiation is not common unless for larger libraries, or where it makes sense to have instances. In this case, there's not strong motivation for instantiation. So the API is simple: + +```js +library.resolve(...) +``` + +This makes the use of our js library more convenient for users. + +## resolver.ts + +Contains the logic for defining the api for the `resolve` method. The implementation logic is not contained in this file. + +The `resolve` method takes two main arguments: + + - `dtmi (type: string)` - This is a user dtmi used for the dtdl the user intends to resolve. dtmi is a standard format, and if the dtmi provided does not follow the format it will be rejected. + - `endpoint (type:string)` - Can be a URL to a server endpoint, local or remote. Alternatively can be an *absolute* file path, if the dtdl is stored locally. In most cases you will be interacting with the device models repository, so the endpoint will be `https://devicemodels.azure.com`, however we do not set defaults so there's no question about behavior. Simple is easier to understand! + +The `resolve` method has optional parameters provided as a single object. You would use it as such: + +```js +resolve(myDtmi, myEndpoint, { 'resolveDependencies': 'disabled' }) +``` + +Currently there is only one parameter in the optional object: + +- `resolveDependencies (type: string)` - This is a useful way to get dependencies in one network call, and is recommended if you want to resolve the full dependency tree of a dtdl stored in the device model repository. These are the three options: + - `disabled` + - `enabled` + - `tryFroExpanded` + + + + +## dtmiConventions.ts + +Contains methods for checking that the DTMI is valid, and to convert the DTMI to a string. This is currently private, however there are discussions around making these helper functions public parts of the API. + +#### `isValidDtmi` + +Validates if the provided dtmi matches the rules for a user dtmi. + +#### `dtmiToPath` + +Validates then converts the dtmi to a generic path. + +#### `dtmiToQualifiedPath` + +Validates the dtmi then converts the endpoint and dtmi to a fully qualified path. To get the `extended.json` version of a dtdl, there is a boolean parameter required. + +## DTDL.ts + +This is used to define an interface uesd in `dtmiConventions.ts`. Though it is an incomplete interface, it is just used to define the psuedo-parsing requirements. + +## modelFetcherHandler.ts + +This handles figuring out which fetcher to use based on the type of endpoint and the options given. It will check the endpoint to see if it is a remote URL or a local file. Then, it will pass the parameters either to the remote fetcher or the local fetcher. + + +## localModelFetchers.ts + +This contains the local `fetcher()` method and the `recursiveFetcher()` method. The regular `fetcher()` method is called when resolverOptions are set to `disabled`, and also used as the basic unit of fetching from a directory for the `recursiveFetcher()`. The `localModelFetchers.ts` and `remoteModelFetchers.ts` are fairly similar, except for handling the formatting of the endpoint/directory, and the use of `filesystem` in the case of the `localModelFetchers`. + +## remoteModelFetchers.ts + +This contains the `fetcher()` method and the `recursiveFetcher()` method for fetching DTDLs from remote endpoints. It is similarly structured to `localModelFetchers.ts`. In order to perform the HTTP requests it uses the Azure `coreHttp` implementation. + +## modelMetadata.ts + +Performs a psuedo-parsing of a given DTDL and gives back information primarily relevant for fetching dependencies. \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/src/DTDL.ts b/sdk/iotplugandplay/models-repo-tool/src/DTDL.ts new file mode 100644 index 000000000000..9e70e85f460d --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/src/DTDL.ts @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +'use strict' + +interface Contents { + '@type'?: string; + 'name': string; + 'schema': string; +} + +export interface DTDL extends JSON { + '@context': any[], + '@id': string, + 'extends': string, + 'contents': Contents[] +} diff --git a/sdk/iotplugandplay/models-repo-tool/src/dtmiConventions.ts b/sdk/iotplugandplay/models-repo-tool/src/dtmiConventions.ts new file mode 100644 index 000000000000..c58e23dc4eff --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/src/dtmiConventions.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +'use strict' + +export function isValidDtmi (dtmi: string) { + if (dtmi) { + const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/ + return re.test(dtmi) // true if dtmi matches regular expression, false otherwise + } + return false // if not a string return false. +} + +export function dtmiToPath (dtmi: string) { + // presently this dtmi to path function does not return the path with a + // file format at the end, i.e. does not append .json or .expanded.json. + // that happens in the dtmiToQualifiedPath function + + if (isValidDtmi(dtmi)) { + return `${dtmi.toLowerCase().replace(/:/gm, '/').replace(/;/gm, '-')}.json` + } else { + throw new Error('DTMI provided is invalid. Ensure it follows DTMI conventions.') + } +} + +function ensureStartsWithProtocol (text: string) { + const re = /^http[s]?:\/\// + if (text.search(re) !== -1) { + return text + } else { + return `https://${text}` + } +} + +export function dtmiToQualifiedPath (dtmi: string, endpoint: string, isExpanded ?: boolean) { + const dtmiAsPath = dtmiToPath(dtmi) + const endpointWithSlash = endpoint.endsWith('/') ? endpoint : `${endpoint}/` + const urlEndpoint = ensureStartsWithProtocol(endpointWithSlash) + if (isExpanded) { + return `${urlEndpoint}${dtmiAsPath.replace(/json$/, 'expanded.json')}` + } else { + return `${urlEndpoint}${dtmiAsPath}` + } +} diff --git a/sdk/iotplugandplay/models-repo-tool/src/index.ts b/sdk/iotplugandplay/models-repo-tool/src/index.ts new file mode 100644 index 000000000000..9eb70e44abcb --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/src/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// exporting the resolver api +export * from './resolver' diff --git a/sdk/iotplugandplay/models-repo-tool/src/localModelFetchers.ts b/sdk/iotplugandplay/models-repo-tool/src/localModelFetchers.ts new file mode 100644 index 000000000000..2b7f5d4e206a --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/src/localModelFetchers.ts @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +'use strict' + +import * as dtmiConventions from './dtmiConventions' +import * as modelMetadata from './modelMetadata' +import { DTDL } from './DTDL' +import fs from 'fs' +import * as path from 'path' +import { flattenDtdlResponse } from './modelFetcherHelper' + +async function recursiveFetcher (dtmi: string, directory: string, tryFromExpanded: boolean): Promise<{[x:string]: DTDL}> { + let dependencyModels: {[x:string]: DTDL} = {} + let fetchedModels: {[x: string]: DTDL } + try { + console.log(`Fetching: ${dtmi}`) + fetchedModels = await fetcher(dtmi, directory, tryFromExpanded) + } catch (error) { + if (tryFromExpanded && error.code === 'ENOENT') { + console.log('Fetching from expanded failed. Trying without.') + fetchedModels = await fetcher(dtmi, directory, false) + } else { + throw error + } + } + const dtmis = Object.keys(fetchedModels) + for (let i = 0; i < dtmis.length; i++) { + const currentDtdl = fetchedModels[dtmis[i]] + const metaModelData = modelMetadata.getModelMetadata(currentDtdl) + const deps = metaModelData.componentSchemas.concat(metaModelData.extends) + if (deps && deps.length > 0) { + for (let j = 0; j < deps.length; j++) { + if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) { + // do nothing + } else { + const fetchedDependencies = await recursiveFetcher(deps[j], directory, tryFromExpanded) + dependencyModels = { ...dependencyModels, ...fetchedDependencies } + } + } + } + } + if (Object.keys(dependencyModels).length > 0) { + fetchedModels = { ...fetchedModels, ...dependencyModels } + } + return fetchedModels +} + +async function fetcher (dtmi: string, directory: string, tryFromExpanded: boolean): Promise<{ [dtmi: string]: DTDL }> { + const dtmiPath = dtmiConventions.dtmiToPath(dtmi) + const dtmiPathFormatted = tryFromExpanded ? dtmiPath.replace('.json', '.expanded.json') : dtmiPath + const targetPath = path.join(directory, dtmiPathFormatted) + const dtdlFile = fs.readFileSync(targetPath, 'utf8') + const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile) + if (Array.isArray(parsedDtdl)) { + const result = flattenDtdlResponse(parsedDtdl as DTDL[]) + return result + } else { + const result = { [dtmi]: parsedDtdl as DTDL } + return result + } +} + +export { fetcher, recursiveFetcher } diff --git a/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHandler.ts b/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHandler.ts new file mode 100644 index 000000000000..1172128a9408 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHandler.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +'use strict' + +import * as fs from 'fs' +import * as url from 'url' +import * as localFetchers from './localModelFetchers' +import * as remoteFetchers from './remoteModelFetchers' + +function isLocalPath (p: string): boolean { + if (p.startsWith('https://') || p.startsWith('http://')) { + return false + } else if (p.startsWith('file://')) { + return true + } else { + try { + fs.accessSync(p) + return true + } catch { + return false + } + } +} + +export async function modelFetcher (dtmi: string, endpoint: string, resolveDependencies: boolean, tryFromExpanded: boolean): Promise<{ [dtmi: string]: JSON | Array }> { + if (isLocalPath(endpoint)) { + const formattedDirectory = endpoint.includes('file://') ? url.fileURLToPath(endpoint) : endpoint + if (tryFromExpanded || resolveDependencies) { + return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded) + } else { + console.log(`Fetching: ${dtmi}`) + return localFetchers.fetcher(dtmi, formattedDirectory, false) + } + } else { + if (tryFromExpanded || resolveDependencies) { + return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded) + } + console.log(`Fetching: ${dtmi}`) + return remoteFetchers.fetcher(dtmi, endpoint, false) + } +} diff --git a/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHelper.ts b/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHelper.ts new file mode 100644 index 000000000000..9dd52db046f5 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHelper.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +'use strict' + +import { DTDL } from './DTDL' + +export function flattenDtdlResponse (input: DTDL[]) { + const newResult: {[x: string]: DTDL} = {} + for (let i = 0; i++; i < input.length) { + const currentDtdl = input[i] + if (!currentDtdl['@id']) { + throw new Error('no @id element found in DTDL. Ensure DTDL contains @id element'); + } + newResult[currentDtdl['@id']] = currentDtdl + } + input.forEach((element: DTDL) => { + newResult[element['@id']] = element + }) + return newResult +} diff --git a/sdk/iotplugandplay/models-repo-tool/src/modelMetadata.ts b/sdk/iotplugandplay/models-repo-tool/src/modelMetadata.ts new file mode 100644 index 000000000000..fa8dccd832e8 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/src/modelMetadata.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +'use strict' + +import { DTDL } from './DTDL' + +function getId (input: DTDL): string { + const idElement = input['@id'] + return idElement +} + +function getExtends (input: DTDL): string { + const extendElement = input.extends + return extendElement +} + +function getComponentSchemas (input: DTDL): string[] { + const componentSchemas: string[] = [] + if (input.contents) { + const contents = input.contents + contents.forEach((element) => { + if (element['@type'] && + (typeof element['@type'] === 'string') && + (element['@type'] === 'Component')) { + if (element.schema && typeof element.schema === 'string') { + componentSchemas.push(element.schema) + } + } + }) + } + return componentSchemas +} + +export function getModelMetadata (input: DTDL) { + const idElement: string = getId(input) + const extendsElement: string = getExtends(input) + const componentSchemas: string[] = getComponentSchemas(input) + return { + id: idElement, + extends: extendsElement, + componentSchemas: componentSchemas + } +} diff --git a/sdk/iotplugandplay/models-repo-tool/src/remoteModelFetchers.ts b/sdk/iotplugandplay/models-repo-tool/src/remoteModelFetchers.ts new file mode 100644 index 000000000000..964d372dd162 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/src/remoteModelFetchers.ts @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +'use strict' + +import * as dtmiConventions from './dtmiConventions' +import * as modelMetadata from './modelMetadata' +import * as coreHttp from '@azure/core-http' +import { DTDL } from './DTDL' +import { flattenDtdlResponse } from './modelFetcherHelper' + +async function recursiveFetcher (dtmi: string, endpoint: string, tryFromExpanded: boolean): Promise<{[dtmi: string]: DTDL }> { + let dependencyModels: {[x:string]: DTDL} = {} + let fetchedModels: {[x: string]: DTDL } + try { + console.log(`Fetching: ${dtmi}`) + fetchedModels = await fetcher(dtmi, endpoint, tryFromExpanded) + } catch (error) { + if (tryFromExpanded && (error.code === 'ENOENT' || !(error.statusCode >= 200 && error.statusCode < 400))) { + console.log('Fetching from expanded failed. Trying without.') + console.log(`Fetching: ${dtmi}`) + fetchedModels = await fetcher(dtmi, endpoint, false) + } else { + throw error + } + } + const dtmis = Object.keys(fetchedModels) + for (let i = 0; i < dtmis.length; i++) { + const currentDtdl = fetchedModels[dtmis[i]] + const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas + if (deps && deps.length > 0) { + for (let j = 0; j < deps.length; j++) { + if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) { + // do nothing + } else { + const fetchedDependencies = await recursiveFetcher(deps[j], endpoint, tryFromExpanded) + dependencyModels = { ...dependencyModels, ...fetchedDependencies } + } + } + } + } + if (Object.keys(dependencyModels).length > 0) { + fetchedModels = { ...fetchedModels, ...dependencyModels } + } + return fetchedModels +} + +async function fetcher (dtmi: string, endpoint: string, tryFromExpanded: boolean): Promise<{[dtmi: string]: any }> { + const client = new coreHttp.ServiceClient() + const req: coreHttp.RequestPrepareOptions = { + url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), + method: 'GET' + } + const res: coreHttp.HttpOperationResponse = await client.sendRequest(req) + if (res.status >= 200 && res.status < 400) { + const dtdlAsString = res.bodyAsText || '' + const parsedDtdl = JSON.parse(dtdlAsString) + if (Array.isArray(parsedDtdl)) { + const result = flattenDtdlResponse(parsedDtdl as DTDL[]) + return result + } else { + const result = { [dtmi]: parsedDtdl as DTDL } + return result + } + } else { + throw new coreHttp.RestError('Error on HTTP Request in remote model fetcher', '404', 404, undefined, res) + } +} + +export { fetcher, recursiveFetcher } diff --git a/sdk/iotplugandplay/models-repo-tool/src/resolver.ts b/sdk/iotplugandplay/models-repo-tool/src/resolver.ts new file mode 100644 index 000000000000..3db450bb9fe6 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/src/resolver.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +'use strict' + +import { modelFetcher } from './modelFetcherHandler' + +interface resolverOptions { + resolveDependencies: 'disabled' | 'enabled' | 'tryFromExpanded' +} + +function checkIfTryFromExpanded (options?: resolverOptions): boolean { + if (options && options.resolveDependencies && options.resolveDependencies === 'tryFromExpanded') { + return true + } + return false +} + +function checkIfResolveDependencies (options?: resolverOptions): boolean { + if (options && options.resolveDependencies && options.resolveDependencies === 'enabled') { + return true + } + return false +} + +/** + * resolve - get interfaces (dtdls) associated to a given dtmi + * + * @param dtmi code used to label and organize dtdl + * @param endpoint URL or local path for dtdl repository + * @param options object containing optional parameters + * + * @returns Promise that resolves to mapping of dtmi(s) to JSON dtdl(s) + */ +function resolve(dtmi: string, endpoint: string): Promise<{ [dtmi: string]: any}> +function resolve(dtmi: string, endpoint: string, options: resolverOptions): Promise<{ [dtmi: string]: any}> +function resolve (dtmi: string, endpoint : string, options ?: resolverOptions): Promise<{ [dtmi: string]:any}> { + const tryFromExpanded = checkIfTryFromExpanded(options) + const resolveDependencies = checkIfResolveDependencies(options) + + return modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded) +} + +export { resolve } diff --git a/sdk/iotplugandplay/models-repo-tool/test/browser/browserTest.spec.ts b/sdk/iotplugandplay/models-repo-tool/test/browser/browserTest.spec.ts new file mode 100644 index 000000000000..a4df921d495e --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/test/browser/browserTest.spec.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import * as lib from '../../src' + +import { assert } from 'chai' +import * as sinon from 'sinon' + +describe('resolver - browser', () => { + afterEach(() => { + sinon.restore() + }) + + describe('single resolution (no pseudo-parsing)', () => { + it.only('integration works in browser', function (done) { + const dtmi: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' + const endpoint = 'https://devicemodels.azure.com' + const fakeData = JSON.stringify({ + fakeDtdl: 'fakeBodyAsText' + }) + const resolveResult = lib.resolve(dtmi, endpoint) + resolveResult.then((actualOutput: any) => { + assert.deepStrictEqual({ [dtmi]: JSON.parse(fakeData) }, actualOutput) + done() + }).catch((err: any) => done(err)) + }) + }) +}) diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/dtmiConventions.spec.ts b/sdk/iotplugandplay/models-repo-tool/test/node/dtmiConventions.spec.ts new file mode 100644 index 000000000000..40bd92a6df8e --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/test/node/dtmiConventions.spec.ts @@ -0,0 +1,165 @@ +/* eslint-disable no-undef */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import * as lib from '../../src/dtmiConventions' + +// fake class while lib not implemented +import * as sinon from 'sinon' +import { assert, expect } from 'chai' + +interface ValidParams { + dtmi: string, + path: string, + url: string +} + +const validParameters: ValidParams[] = [ + { + dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;1', + path: 'dtmi/azure/devicemanagement/deviceinformation-1.json', + url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json' + }, + { + dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;10000', + path: 'dtmi/azure/devicemanagement/deviceinformation-10000.json', + url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-10000.json' + }, + { + dtmi: 'dtmi:com:DeviceInformation;1', + path: 'dtmi/com/deviceinformation-1.json', + url: 'https://contoso.com/dtmi/com/deviceinformation-1.json' + }, + { + dtmi: 'dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1', + path: 'dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json', + url: 'https://contoso.com/dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json' + }, + { + dtmi: 'dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7', + path: 'dtmi/azure/devicemanagement/thermometer-7.json', + url: 'https://contoso.com/dtmi/azure/devicemanagement/thermometer-7.json' + }, + { + dtmi: 'dtmi:thermometer;2', + path: 'dtmi/thermometer-2.json', + url: 'https://contoso.com/dtmi/thermometer-2.json' + } + +] + +const invalidParameters: {dtmi: string}[] = [ + { dtmi: 'dtmiazure:DeviceManagement:DeviceInformation;1' }, + { dtmi: 'dtmi;azure;DeviceManagement;DeviceInformation;1' }, + { dtmi: 'asdf' }, + { dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;-1' }, + { dtmi: 'dtmi:azure:DeviceManagement:Device-Information;1' }, + { dtmi: 'DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7' }, + { dtmi: 'dmti:azure:thermometer;10' } +] + +describe('dtmiConventions', function () { + afterEach(function () { + sinon.restore() + }) + + describe('isValidDtmi', function () { + describe('valid', function () { + function validTest (givenDtmi: string) { + const result = lib.isValidDtmi(givenDtmi) + assert(result, 'valid dtmi not found as valid') + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should validate a correctly formatted dtmi (${validParameters[i].dtmi})`, function () { validTest(validParameters[i].dtmi) }) + } + }) + + describe('invalid', function () { + function invalidTest (givenDtmi: string) { + const result = lib.isValidDtmi(givenDtmi) + assert(!result, 'invalid dtmi incorrectly labelled as valid') + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should invalidate incorrectly formatted dtmi (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) }) + } + }) + }) + + describe('dtmiToPath', function () { + describe('valid', function () { + function validTest (givenDtmi: string, expectedPath: string) { + const result = lib.dtmiToPath(givenDtmi) + assert.deepEqual(result, expectedPath) + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a generic path (${validParameters[i].dtmi})`, + function () { + validTest(validParameters[i].dtmi, validParameters[i].path) + }) + } + }) + + describe('invalid', function () { + function invalidTest (givenDtmi: string) { + expect(() => { + lib.dtmiToPath(givenDtmi) + }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.') + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) }) + } + }) + }) + + describe('dtmiToFullyQualifiedPath', function () { + describe('invalid', function () { + function invalidTest (givenDtmi: string) { + expect(() => { + const fakeBasePath = 'https://contoso.com' + lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false) + }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.') + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) }) + } + }) + + describe('valid', function () { + describe('standard url', function () { + function reformatTest (givenDtmi: string, expected: string) { + const fakeBasePath = 'https://contoso.com' + const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false) + assert.deepEqual(result, expected) + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a qualified path (${validParameters[i].dtmi})`, + function () { + reformatTest(validParameters[i].dtmi, validParameters[i].url) + }) + } + }) + + describe('expanded url', function () { + function addExpandedTest (givenDtmi: string, expected: string) { + const fakeBasePath = 'https://contoso.com' + const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, true) + assert.deepEqual(result, expected) + } + + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a qualified path with expanded.json (${validParameters[i].dtmi})`, + function () { + addExpandedTest(validParameters[i].dtmi, validParameters[i].url.replace('.json', '.expanded.json')) + }) + } + }) + }) + }) +}) diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/index.spec.ts b/sdk/iotplugandplay/models-repo-tool/test/node/index.spec.ts new file mode 100644 index 000000000000..1d18f4acc993 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/test/node/index.spec.ts @@ -0,0 +1,320 @@ +/* eslint-disable no-undef */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import * as resolverTool from '../../src' +import * as coreHttp from '@azure/core-http' +import * as fs from 'fs' + +import { assert } from 'chai' +import * as sinon from 'sinon' + +import * as path from 'path' + +describe('resolver - node', function () { + afterEach(function () { + sinon.restore() + }) + + describe('remote URL resolution', function () { + describe('simple DTDL resolution', function () { + it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { + const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1' + const fakeEndpoint = 'devicemodels.contoso.com' + const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json' + const fakeData = JSON.stringify({ + fakeDtdl: 'fakeBodyAsText' + }) + sinon.stub(coreHttp, 'ServiceClient') + .returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.') + return Promise.resolve({ bodyAsText: fakeData, status: 200 }) + } + }) + + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint) + assert(resolveResult instanceof Promise, 'resolve method did not return a promise') + resolveResult.then((actualOutput: any) => { + assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput) + done() + }).catch((err: any) => done(err)) + }) + }) + + describe('depenency resolution (using pseudo-parsing)', function () { + it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { + const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1' + const fakeEndpoint: string = 'devicemodels.contoso.com' + const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json' + const fakeData = JSON.stringify({ + fakeKey: 'fakeValue' + }) + sinon.stub(coreHttp, 'ServiceClient') + .returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.') + return Promise.resolve({ bodyAsText: fakeData, status: 200 }) + } + }) + + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'enabled' }) + assert(resolveResult instanceof Promise, 'resolve method did not return a promise') + resolveResult.then((actualOutput: any) => { + assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput) + done() + }).catch((err: any) => done(err)) + }) + + it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) { + const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1' + const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1' + const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' + const fakeEndpoint: string = 'devicemodels.contoso.com' + const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json' + const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json' + const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json' + const localDirectory = path.resolve('./test/node/testModelRepository') + const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json') + const fakeData = fs.readFileSync(pathToDtdl).toString() + const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' }) + const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' }) + const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) } + const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient') + serviceClientStub.onFirstCall().returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.') + return Promise.resolve({ bodyAsText: fakeData, status: 200 }) + } + }) + serviceClientStub.onSecondCall().returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.') + return Promise.resolve({ bodyAsText: fakeData2, status: 200 }) + } + }) + serviceClientStub.onThirdCall().returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.') + return Promise.resolve({ bodyAsText: fakeData3, status: 200 }) + } + }) + + const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'enabled' }) + assert(resolveResult instanceof Promise, 'resolve method did not return a promise') + resolveResult.then((actualOutput: any) => { + assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output') + assert.deepStrictEqual(expectedOutput, actualOutput) + done() + }).catch((err: any) => done(err)) + }) + }) + + describe('try from expanded (expanded.json)', function () { + it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { + const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1' + const fakeEndpoint = 'devicemodels.contoso.com' + const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json' + const fakeData = `[${JSON.stringify({ + '@id': fakeDtmi, + fakeDtdl: 'fakeBodyAsText' + })}]` + sinon.stub(coreHttp, 'ServiceClient') + .returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.') + return Promise.resolve({ bodyAsText: fakeData, status: 200 }) + } + }) + + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' }) + assert(resolveResult instanceof Promise, 'resolve method did not return a promise') + resolveResult.then((actualOutput: any) => { + assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput) + done() + }).catch((err: any) => done(err)) + }) + + it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) { + const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1' + const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1' + const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' + const fakeEndpoint: string = 'devicemodels.contoso.com' + const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json' + const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json' + const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json' + const localDirectory = path.resolve('./test/node/testModelRepository') + const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json') + const fakeData = fs.readFileSync(pathToDtdl).toString() + const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' }) + const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' }) + const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) } + const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient') + serviceClientStub.onCall(0).returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.') + return Promise.resolve({ status: 404 }) + } + }) + serviceClientStub.onCall(1).returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.') + return Promise.resolve({ bodyAsText: fakeData, status: 200 }) + } + }) + serviceClientStub.onCall(2).returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri2.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.') + return Promise.resolve({ status: 404 }) + } + }) + serviceClientStub.onCall(3).returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.') + return Promise.resolve({ bodyAsText: fakeData2, status: 200 }) + } + }) + serviceClientStub.onCall(4).returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri3.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.') + return Promise.resolve({ status: 404 }) + } + }) + serviceClientStub.onCall(5).returns({ + sendRequest: function (req: any) { + assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.') + return Promise.resolve({ bodyAsText: fakeData3, status: 200 }) + } + }) + + const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' }) + assert(resolveResult instanceof Promise, 'resolve method did not return a promise') + resolveResult.then((actualOutput: any) => { + assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output') + assert.deepStrictEqual(expectedOutput, actualOutput) + done() + }).catch((err: any) => done(err)) + }) + }) + }) + + describe('local file resolution', function () { + describe('simple DTDL resolution', function () { + it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { + const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:thermostat;1' + const localDirectory = path.resolve('./test/node/testModelRepository') + const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json') + const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, 'utf-8')) + const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory) + assert(resolveResult instanceof Promise, 'resolve method did not return a promise') + resolveResult.then((actualOutput: any) => { + assert.deepStrictEqual({ [fakeDtmi]: fakeDtdl }, actualOutput, 'the expected dtmi mapping did not match the actual value.') + done() + }).catch((err: any) => done(err)) + }) + }) + + describe('dependency resolution (using pseudo-parsing)', function () { + it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) { + const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1' + const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1' + const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' + const localDirectory = path.resolve('./test/node/testModelRepository') + const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json') + const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json') + const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json') + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')) + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')) + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')) + + const expectedOutput = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + } + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'enabled' }) + assert(resolveResult instanceof Promise, 'resolve method did not return a promise') + resolveResult.then((actualOutput: any) => { + assert.deepStrictEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis do not match') + Object.keys(actualOutput).forEach((outputDtmi) => { + assert.deepStrictEqual(actualOutput[outputDtmi], expectedOutput[outputDtmi], `dtdls for given dtmi (${outputDtmi}) did not line up.`) + }) + assert.deepStrictEqual(actualOutput, expectedOutput, 'the expected dtmi mapping did not match the actual value.') + done() + }).catch((err: any) => done(err)) + }) + + it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { + const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:thermostat;1' + const localDirectory = path.resolve('./test/node/testModelRepository') + const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json') + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')) + + const expectedResult = { + [fakeDtmi1]: fakeDtdl1 + } + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory) + assert(resolveResult instanceof Promise, 'resolve method did not return a promise') + resolveResult.then((actualOutput: any) => { + assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.') + done() + }).catch((err: any) => done(err)) + }) + }) + + describe('try from expanded (expanded.json)', function () { + it('should return a promise that resolves to a mapping from the DTMIs to the JSON objects', function (done) { + const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1' + const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1' + const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' + const localDirectory = path.resolve('./test/node/testModelRepository') + const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json') + const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json') + const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json') + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')) + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')) + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')) + + const expectedResult = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + } + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' }) + assert(resolveResult instanceof Promise, 'resolve method did not return a promise') + resolveResult.then((actualOutput: any) => { + assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.') + done() + }).catch((err: any) => done(err)) + }) + + it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) { + const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2' + const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1' + const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' + const localDirectory = path.resolve('./test/node/testModelRepository') + const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json') + const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json') + const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json') + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')) + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')) + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')) + + const expectedResult = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + } + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' }) + assert(resolveResult instanceof Promise, 'resolve method did not return a promise') + resolveResult.then((actualOutput: any) => { + assert.deepEqual(Object.keys(expectedResult), Object.keys(actualOutput), 'the expected dtmis do not match') + Object.keys(expectedResult).forEach(dtmiKey => { + assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey]) + }) + done() + }).catch((err: any) => done(err)) + }) + }) + }) +}) diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json new file mode 100644 index 000000000000..8a37e6d2c2c3 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json @@ -0,0 +1,64 @@ +{ + "@context": "dtmi:dtdl:context;2", + "@id": "dtmi:azure:DeviceManagement:DeviceInformation;1", + "@type": "Interface", + "displayName": "Device Information", + "contents": [ + { + "@type": "Property", + "name": "manufacturer", + "displayName": "Manufacturer", + "schema": "string", + "description": "Company name of the device manufacturer. This could be the same as the name of the original equipment manufacturer (OEM). Ex. Contoso." + }, + { + "@type": "Property", + "name": "model", + "displayName": "Device model", + "schema": "string", + "description": "Device model name or ID. Ex. Surface Book 2." + }, + { + "@type": "Property", + "name": "swVersion", + "displayName": "Software version", + "schema": "string", + "description": "Version of the software on your device. This could be the version of your firmware. Ex. 1.3.45" + }, + { + "@type": "Property", + "name": "osName", + "displayName": "Operating system name", + "schema": "string", + "description": "Name of the operating system on the device. Ex. Windows 10 IoT Core." + }, + { + "@type": "Property", + "name": "processorArchitecture", + "displayName": "Processor architecture", + "schema": "string", + "description": "Architecture of the processor on the device. Ex. x64 or ARM." + }, + { + "@type": "Property", + "name": "processorManufacturer", + "displayName": "Processor manufacturer", + "schema": "string", + "description": "Name of the manufacturer of the processor on the device. Ex. Intel." + }, + { + "@type": "Property", + "name": "totalStorage", + "displayName": "Total storage", + "schema": "double", + "description": "Total available storage on the device in kilobytes. Ex. 2048000 kilobytes." + }, + { + "@type": "Property", + "name": "totalMemory", + "displayName": "Total memory", + "schema": "double", + "description": "Total available memory on the device in kilobytes. Ex. 256000 kilobytes." + } + ] +} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json new file mode 100644 index 000000000000..63a95a10463a --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json @@ -0,0 +1,215 @@ +[ + { + "@context": "dtmi:dtdl:context;2", + "@id": "dtmi:contoso:FakeDeviceManagement:TemperatureController;1", + "@type": "Interface", + "displayName": "Temperature Controller", + "description": "Device with two thermostats and remote reboot.", + "contents": [ + { + "@type": [ + "Telemetry", + "DataSize" + ], + "name": "workingSet", + "displayName": "Working Set", + "description": "Current working set of the device memory in KiB.", + "schema": "double", + "unit": "kibibyte" + }, + { + "@type": "Property", + "name": "serialNumber", + "displayName": "Serial Number", + "description": "Serial number of the device.", + "schema": "string" + }, + { + "@type": "Command", + "name": "reboot", + "displayName": "Reboot", + "description": "Reboots the device after waiting the number of seconds specified.", + "request": { + "name": "delay", + "displayName": "Delay", + "description": "Number of seconds to wait before rebooting the device.", + "schema": "integer" + } + }, + { + "@type": "Component", + "schema": "dtmi:contoso:FakeDeviceManagement:Thermostat;1", + "name": "thermostat1", + "displayName": "Thermostat One", + "description": "Thermostat One of Two." + }, + { + "@type": "Component", + "schema": "dtmi:contoso:FakeDeviceManagement:Thermostat;1", + "name": "thermostat2", + "displayName": "Thermostat Two", + "description": "Thermostat Two of Two." + }, + { + "@type": "Component", + "schema": "dtmi:azure:DeviceManagement:DeviceInformation;1", + "name": "deviceInformation", + "displayName": "Device Information interface", + "description": "Optional interface with basic device hardware information." + } + ] + }, + { + "@context": "dtmi:dtdl:context;2", + "@id": "dtmi:contoso:FakeDeviceManagement:Thermostat;1", + "@type": "Interface", + "displayName": "Thermostat", + "description": "Reports current temperature and provides desired temperature control.", + "contents": [ + { + "@type": [ + "Telemetry", + "Temperature" + ], + "name": "temperature", + "displayName": "Temperature", + "description": "Temperature in degrees Celsius.", + "schema": "double", + "unit": "degreeCelsius" + }, + { + "@type": [ + "Property", + "Temperature" + ], + "name": "targetTemperature", + "schema": "double", + "displayName": "Target Temperature", + "description": "Allows to remotely specify the desired target temperature.", + "unit": "degreeCelsius", + "writable": true + }, + { + "@type": [ + "Property", + "Temperature" + ], + "name": "maxTempSinceLastReboot", + "schema": "double", + "unit": "degreeCelsius", + "displayName": "Max temperature since last reboot.", + "description": "Returns the max temperature since last device reboot." + }, + { + "@type": "Command", + "name": "getMaxMinReport", + "displayName": "Get Max-Min report.", + "description": "This command returns the max, min and average temperature from the specified time to the current time.", + "request": { + "name": "since", + "displayName": "Since", + "description": "Period to return the max-min report.", + "schema": "dateTime" + }, + "response": { + "name": "tempReport", + "displayName": "Temperature Report", + "schema": { + "@type": "Object", + "fields": [ + { + "name": "maxTemp", + "displayName": "Max temperature", + "schema": "double" + }, + { + "name": "minTemp", + "displayName": "Min temperature", + "schema": "double" + }, + { + "name": "avgTemp", + "displayName": "Average Temperature", + "schema": "double" + }, + { + "name": "startTime", + "displayName": "Start Time", + "schema": "dateTime" + }, + { + "name": "endTime", + "displayName": "End Time", + "schema": "dateTime" + } + ] + } + } + } + ] + }, + { + "@context": "dtmi:dtdl:context;2", + "@id": "dtmi:azure:DeviceManagement:DeviceInformation;1", + "@type": "Interface", + "displayName": "Device Information", + "contents": [ + { + "@type": "Property", + "name": "manufacturer", + "displayName": "Manufacturer", + "schema": "string", + "description": "Company name of the device manufacturer. This could be the same as the name of the original equipment manufacturer (OEM). Ex. Contoso." + }, + { + "@type": "Property", + "name": "model", + "displayName": "Device model", + "schema": "string", + "description": "Device model name or ID. Ex. Surface Book 2." + }, + { + "@type": "Property", + "name": "swVersion", + "displayName": "Software version", + "schema": "string", + "description": "Version of the software on your device. This could be the version of your firmware. Ex. 1.3.45" + }, + { + "@type": "Property", + "name": "osName", + "displayName": "Operating system name", + "schema": "string", + "description": "Name of the operating system on the device. Ex. Windows 10 IoT Core." + }, + { + "@type": "Property", + "name": "processorArchitecture", + "displayName": "Processor architecture", + "schema": "string", + "description": "Architecture of the processor on the device. Ex. x64 or ARM." + }, + { + "@type": "Property", + "name": "processorManufacturer", + "displayName": "Processor manufacturer", + "schema": "string", + "description": "Name of the manufacturer of the processor on the device. Ex. Intel." + }, + { + "@type": "Property", + "name": "totalStorage", + "displayName": "Total storage", + "schema": "double", + "description": "Total available storage on the device in kilobytes. Ex. 2048000 kilobytes." + }, + { + "@type": "Property", + "name": "totalMemory", + "displayName": "Total memory", + "schema": "double", + "description": "Total available memory on the device in kilobytes. Ex. 256000 kilobytes." + } + ] + } +] \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json new file mode 100644 index 000000000000..2636a2f0f49f --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json @@ -0,0 +1,60 @@ +{ + "@context": "dtmi:dtdl:context;2", + "@id": "dtmi:contoso:FakeDeviceManagement:TemperatureController;1", + "@type": "Interface", + "displayName": "Temperature Controller", + "description": "Device with two thermostats and remote reboot.", + "contents": [ + { + "@type": [ + "Telemetry", + "DataSize" + ], + "name": "workingSet", + "displayName": "Working Set", + "description": "Current working set of the device memory in KiB.", + "schema": "double", + "unit": "kibibyte" + }, + { + "@type": "Property", + "name": "serialNumber", + "displayName": "Serial Number", + "description": "Serial number of the device.", + "schema": "string" + }, + { + "@type": "Command", + "name": "reboot", + "displayName": "Reboot", + "description": "Reboots the device after waiting the number of seconds specified.", + "request": { + "name": "delay", + "displayName": "Delay", + "description": "Number of seconds to wait before rebooting the device.", + "schema": "integer" + } + }, + { + "@type": "Component", + "schema": "dtmi:contoso:FakeDeviceManagement:Thermostat;1", + "name": "thermostat1", + "displayName": "Thermostat One", + "description": "Thermostat One of Two." + }, + { + "@type": "Component", + "schema": "dtmi:contoso:FakeDeviceManagement:Thermostat;1", + "name": "thermostat2", + "displayName": "Thermostat Two", + "description": "Thermostat Two of Two." + }, + { + "@type": "Component", + "schema": "dtmi:azure:DeviceManagement:DeviceInformation;1", + "name": "deviceInformation", + "displayName": "Device Information interface", + "description": "Optional interface with basic device hardware information." + } + ] +} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json new file mode 100644 index 000000000000..18f31be8301a --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json @@ -0,0 +1,60 @@ +{ + "@context": "dtmi:dtdl:context;2", + "@id": "dtmi:contoso:FakeDeviceManagement:TemperatureController;2", + "@type": "Interface", + "displayName": "Temperature Controller", + "description": "Device with two thermostats and remote reboot.", + "contents": [ + { + "@type": [ + "Telemetry", + "DataSize" + ], + "name": "workingSet", + "displayName": "Working Set", + "description": "Current working set of the device memory in KiB.", + "schema": "double", + "unit": "kibibyte" + }, + { + "@type": "Property", + "name": "serialNumber", + "displayName": "Serial Number", + "description": "Serial number of the device.", + "schema": "string" + }, + { + "@type": "Command", + "name": "reboot", + "displayName": "Reboot", + "description": "Reboots the device after waiting the number of seconds specified.", + "request": { + "name": "delay", + "displayName": "Delay", + "description": "Number of seconds to wait before rebooting the device.", + "schema": "integer" + } + }, + { + "@type": "Component", + "schema": "dtmi:contoso:FakeDeviceManagement:Thermostat;1", + "name": "thermostat1", + "displayName": "Thermostat One", + "description": "Thermostat One of Two." + }, + { + "@type": "Component", + "schema": "dtmi:contoso:FakeDeviceManagement:Thermostat;1", + "name": "thermostat2", + "displayName": "Thermostat Two", + "description": "Thermostat Two of Two." + }, + { + "@type": "Component", + "schema": "dtmi:azure:DeviceManagement:DeviceInformation;1", + "name": "deviceInformation", + "displayName": "Device Information interface", + "description": "Optional interface with basic device hardware information." + } + ] +} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json new file mode 100644 index 000000000000..d14174ced507 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json @@ -0,0 +1,91 @@ +[ + { + "@context": "dtmi:dtdl:context;2", + "@id": "dtmi:contoso:FakeDeviceManagement:Thermostat;1", + "@type": "Interface", + "displayName": "Thermostat", + "description": "Reports current temperature and provides desired temperature control.", + "contents": [ + { + "@type": [ + "Telemetry", + "Temperature" + ], + "name": "temperature", + "displayName": "Temperature", + "description": "Temperature in degrees Celsius.", + "schema": "double", + "unit": "degreeCelsius" + }, + { + "@type": [ + "Property", + "Temperature" + ], + "name": "targetTemperature", + "schema": "double", + "displayName": "Target Temperature", + "description": "Allows to remotely specify the desired target temperature.", + "unit": "degreeCelsius", + "writable": true + }, + { + "@type": [ + "Property", + "Temperature" + ], + "name": "maxTempSinceLastReboot", + "schema": "double", + "unit": "degreeCelsius", + "displayName": "Max temperature since last reboot.", + "description": "Returns the max temperature since last device reboot." + }, + { + "@type": "Command", + "name": "getMaxMinReport", + "displayName": "Get Max-Min report.", + "description": "This command returns the max, min and average temperature from the specified time to the current time.", + "request": { + "name": "since", + "displayName": "Since", + "description": "Period to return the max-min report.", + "schema": "dateTime" + }, + "response": { + "name": "tempReport", + "displayName": "Temperature Report", + "schema": { + "@type": "Object", + "fields": [ + { + "name": "maxTemp", + "displayName": "Max temperature", + "schema": "double" + }, + { + "name": "minTemp", + "displayName": "Min temperature", + "schema": "double" + }, + { + "name": "avgTemp", + "displayName": "Average Temperature", + "schema": "double" + }, + { + "name": "startTime", + "displayName": "Start Time", + "schema": "dateTime" + }, + { + "name": "endTime", + "displayName": "End Time", + "schema": "dateTime" + } + ] + } + } + } + ] + } +] \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json new file mode 100644 index 000000000000..b7747f86d707 --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json @@ -0,0 +1,89 @@ +{ + "@context": "dtmi:dtdl:context;2", + "@id": "dtmi:contoso:FakeDeviceManagement:Thermostat;1", + "@type": "Interface", + "displayName": "Thermostat", + "description": "Reports current temperature and provides desired temperature control.", + "contents": [ + { + "@type": [ + "Telemetry", + "Temperature" + ], + "name": "temperature", + "displayName": "Temperature", + "description": "Temperature in degrees Celsius.", + "schema": "double", + "unit": "degreeCelsius" + }, + { + "@type": [ + "Property", + "Temperature" + ], + "name": "targetTemperature", + "schema": "double", + "displayName": "Target Temperature", + "description": "Allows to remotely specify the desired target temperature.", + "unit": "degreeCelsius", + "writable": true + }, + { + "@type": [ + "Property", + "Temperature" + ], + "name": "maxTempSinceLastReboot", + "schema": "double", + "unit": "degreeCelsius", + "displayName": "Max temperature since last reboot.", + "description": "Returns the max temperature since last device reboot." + }, + { + "@type": "Command", + "name": "getMaxMinReport", + "displayName": "Get Max-Min report.", + "description": "This command returns the max, min and average temperature from the specified time to the current time.", + "request": { + "name": "since", + "displayName": "Since", + "description": "Period to return the max-min report.", + "schema": "dateTime" + }, + "response": { + "name": "tempReport", + "displayName": "Temperature Report", + "schema": { + "@type": "Object", + "fields": [ + { + "name": "maxTemp", + "displayName": "Max temperature", + "schema": "double" + }, + { + "name": "minTemp", + "displayName": "Min temperature", + "schema": "double" + }, + { + "name": "avgTemp", + "displayName": "Average Temperature", + "schema": "double" + }, + { + "name": "startTime", + "displayName": "Start Time", + "schema": "dateTime" + }, + { + "name": "endTime", + "displayName": "End Time", + "schema": "dateTime" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/tsconfig.json b/sdk/iotplugandplay/models-repo-tool/tsconfig.json new file mode 100644 index 000000000000..53e0c1994f0d --- /dev/null +++ b/sdk/iotplugandplay/models-repo-tool/tsconfig.json @@ -0,0 +1,34 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "lib": [], + "declaration": true, + "declarationDir": "./types", + "declarationMap": true, + "inlineSources": true, + "sourceMap": true, + "importHelpers": true, + "strict": true, + "alwaysStrict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "forceConsistentCasingInFileNames": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "outDir": "./out" + }, + "exclude": [ + "node_modules", + "types", + "temp", + "browser", + "dist", + "dist-samples", + "dist-esm", + "./samples/**/*.ts" + ] +} \ No newline at end of file From be96c307bcae9ad4c4406a04d6d4ac125a96b420 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Fri, 19 Feb 2021 15:08:35 -0800 Subject: [PATCH 02/81] rename --- .../resolver-tool/.eslintrc.json | 21 + .../resolver-tool}/.npmrc | 0 .../resolver-tool}/.nycrc | 0 .../resolver-tool/.vscode/launch.json | 45 ++ .../resolver-tool}/CHANGELOG.md | 0 .../resolver-tool}/LICENSE | 0 .../resolver-tool}/README.md | 6 +- .../resolver-tool}/api-extractor.json | 2 +- .../resolver-tool}/out/src/DTDL.js | 4 +- .../resolver-tool}/out/src/DTDL.js.map | 0 .../resolver-tool/out/src/dtmiConventions.js | 47 ++ .../out/src/dtmiConventions.js.map | 0 .../resolver-tool}/out/src/index.js | 2 +- .../resolver-tool}/out/src/index.js.map | 0 .../out/src/localModelFetchers.js | 75 +++ .../out/src/localModelFetchers.js.map | 0 .../out/src/modelFetcherHandler.js | 47 ++ .../out/src/modelFetcherHandler.js.map | 0 .../out/src/modelFetcherHelper.js | 21 + .../out/src/modelFetcherHelper.js.map | 0 .../resolver-tool/out/src/modelMetadata.js | 43 ++ .../out/src/modelMetadata.js.map | 0 .../out/src/remoteModelFetchers.js | 88 ++++ .../out/src/remoteModelFetchers.js.map | 0 .../resolver-tool/out/src/resolver.js | 25 + .../resolver-tool}/out/src/resolver.js.map | 0 .../out/test/browser/browserTest.spec.js | 30 ++ .../out/test/browser/browserTest.spec.js.map | 0 .../out/test/node/dtmiConventions.spec.js | 161 ++++++ .../out/test/node/dtmiConventions.spec.js.map | 0 .../resolver-tool/out/test/node/index.spec.js | 472 ++++++++++++++++++ .../out/test/node/index.spec.js.map | 0 .../resolver-tool}/package.json | 0 .../resolver-tool/rollup.config.js | 11 + .../samples/javascript/local_example.js | 32 +- .../samples/javascript/package.json | 30 ++ .../samples/javascript/remote_example.js | 34 +- .../samples/typescript/README.md | 10 +- .../samples/typescript/package.json | 0 .../samples/typescript/src/example.ts | 22 + .../samples/typescript/tsconfig.json | 1 - .../resolver-tool}/src/CODE_STRUCTURE.md | 14 +- .../resolver-tool}/src/DTDL.ts | 16 +- .../resolver-tool/src/dtmiConventions.ts | 47 ++ .../resolver-tool}/src/index.ts | 2 +- .../resolver-tool/src/localModelFetchers.ts | 77 +++ .../resolver-tool/src/modelFetcherHandler.ts | 49 ++ .../resolver-tool/src/modelFetcherHelper.ts | 21 + .../resolver-tool/src/modelMetadata.ts | 46 ++ .../resolver-tool/src/remoteModelFetchers.ts | 90 ++++ .../resolver-tool}/src/resolver.ts | 46 +- .../test/browser/browserTest.spec.ts | 30 ++ .../test/node/dtmiConventions.spec.ts | 172 +++++++ .../resolver-tool/test/node/index.spec.ts | 455 +++++++++++++++++ .../DeviceManagement/deviceinformation-1.json | 2 +- .../temperaturecontroller-1.expanded.json | 22 +- .../temperaturecontroller-1.json | 7 +- .../temperaturecontroller-2.json | 7 +- .../thermostat-1.expanded.json | 17 +- .../FakeDeviceManagement/thermostat-1.json | 17 +- .../resolver-tool}/tsconfig.json | 2 +- .../models-repo-tool/.eslintrc.json | 27 - .../models-repo-tool/.vscode/launch.json | 56 --- .../out/src/dtmiConventions.js | 47 -- .../out/src/localModelFetchers.js | 71 --- .../out/src/modelFetcherHandler.js | 50 -- .../out/src/modelFetcherHelper.js | 21 - .../models-repo-tool/out/src/modelMetadata.js | 41 -- .../out/src/remoteModelFetchers.js | 78 --- .../models-repo-tool/out/src/resolver.js | 25 - .../out/test/browser/browserTest.spec.js | 28 -- .../out/test/node/dtmiConventions.spec.js | 146 ------ .../out/test/node/index.spec.js | 301 ----------- .../models-repo-tool/rollup.config.js | 11 - .../samples/javascript/package.json | 30 -- .../samples/typescript/src/example.ts | 22 - .../models-repo-tool/src/dtmiConventions.ts | 44 -- .../src/localModelFetchers.ts | 64 --- .../src/modelFetcherHandler.ts | 42 -- .../src/modelFetcherHelper.ts | 21 - .../models-repo-tool/src/modelMetadata.ts | 44 -- .../src/remoteModelFetchers.ts | 70 --- .../test/browser/browserTest.spec.ts | 28 -- .../test/node/dtmiConventions.spec.ts | 165 ------ .../models-repo-tool/test/node/index.spec.ts | 320 ------------ 85 files changed, 2231 insertions(+), 1889 deletions(-) create mode 100644 sdk/iotmodelsrepository/resolver-tool/.eslintrc.json rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/.npmrc (100%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/.nycrc (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/.vscode/launch.json rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/CHANGELOG.md (100%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/LICENSE (100%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/README.md (92%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/api-extractor.json (99%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/DTDL.js (81%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/DTDL.js.map (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/dtmiConventions.js.map (100%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/index.js (88%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/index.js.map (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/localModelFetchers.js.map (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/modelFetcherHandler.js.map (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/modelFetcherHelper.js.map (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/modelMetadata.js.map (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/remoteModelFetchers.js.map (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/src/resolver.js.map (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/test/browser/browserTest.spec.js.map (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/test/node/dtmiConventions.spec.js.map (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/out/test/node/index.spec.js.map (100%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/package.json (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/rollup.config.js rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/samples/javascript/local_example.js (53%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/samples/javascript/package.json rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/samples/javascript/remote_example.js (51%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/samples/typescript/README.md (80%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/samples/typescript/package.json (100%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/samples/typescript/src/example.ts rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/samples/typescript/tsconfig.json (99%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/src/CODE_STRUCTURE.md (81%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/src/DTDL.ts (58%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/src/dtmiConventions.ts rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/src/index.ts (79%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/src/localModelFetchers.ts create mode 100644 sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHandler.ts create mode 100644 sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHelper.ts create mode 100644 sdk/iotmodelsrepository/resolver-tool/src/modelMetadata.ts create mode 100644 sdk/iotmodelsrepository/resolver-tool/src/remoteModelFetchers.ts rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/src/resolver.ts (52%) create mode 100644 sdk/iotmodelsrepository/resolver-tool/test/browser/browserTest.spec.ts create mode 100644 sdk/iotmodelsrepository/resolver-tool/test/node/dtmiConventions.spec.ts create mode 100644 sdk/iotmodelsrepository/resolver-tool/test/node/index.spec.ts rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json (99%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json (95%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json (96%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json (96%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json (91%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json (91%) rename sdk/{iotplugandplay/models-repo-tool => iotmodelsrepository/resolver-tool}/tsconfig.json (99%) delete mode 100644 sdk/iotplugandplay/models-repo-tool/.eslintrc.json delete mode 100644 sdk/iotplugandplay/models-repo-tool/.vscode/launch.json delete mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/out/src/resolver.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/rollup.config.js delete mode 100644 sdk/iotplugandplay/models-repo-tool/samples/javascript/package.json delete mode 100644 sdk/iotplugandplay/models-repo-tool/samples/typescript/src/example.ts delete mode 100644 sdk/iotplugandplay/models-repo-tool/src/dtmiConventions.ts delete mode 100644 sdk/iotplugandplay/models-repo-tool/src/localModelFetchers.ts delete mode 100644 sdk/iotplugandplay/models-repo-tool/src/modelFetcherHandler.ts delete mode 100644 sdk/iotplugandplay/models-repo-tool/src/modelFetcherHelper.ts delete mode 100644 sdk/iotplugandplay/models-repo-tool/src/modelMetadata.ts delete mode 100644 sdk/iotplugandplay/models-repo-tool/src/remoteModelFetchers.ts delete mode 100644 sdk/iotplugandplay/models-repo-tool/test/browser/browserTest.spec.ts delete mode 100644 sdk/iotplugandplay/models-repo-tool/test/node/dtmiConventions.spec.ts delete mode 100644 sdk/iotplugandplay/models-repo-tool/test/node/index.spec.ts diff --git a/sdk/iotmodelsrepository/resolver-tool/.eslintrc.json b/sdk/iotmodelsrepository/resolver-tool/.eslintrc.json new file mode 100644 index 000000000000..75f5bae2bae4 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/.eslintrc.json @@ -0,0 +1,21 @@ +{ + "env": { + "browser": true, + "es6": true, + "node": true + }, + "extends": ["standard", "plugin:mocha/recommended"], + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "plugins": ["@typescript-eslint", "mocha"], + "rules": { + "no-redeclare": "off" + } +} diff --git a/sdk/iotplugandplay/models-repo-tool/.npmrc b/sdk/iotmodelsrepository/resolver-tool/.npmrc similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/.npmrc rename to sdk/iotmodelsrepository/resolver-tool/.npmrc diff --git a/sdk/iotplugandplay/models-repo-tool/.nycrc b/sdk/iotmodelsrepository/resolver-tool/.nycrc similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/.nycrc rename to sdk/iotmodelsrepository/resolver-tool/.nycrc diff --git a/sdk/iotmodelsrepository/resolver-tool/.vscode/launch.json b/sdk/iotmodelsrepository/resolver-tool/.vscode/launch.json new file mode 100644 index 000000000000..0fdeded9567c --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/.vscode/launch.json @@ -0,0 +1,45 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Program", + "program": "${workspaceFolder}/samples/javascript/example.js", + "request": "launch", + "skipFiles": ["/**"], + "console": "integratedTerminal", + "type": "pwa-node" + }, + { + "name": "temp-unit-test", + "request": "launch", + "runtimeArgs": ["run", "temp-unit-test"], + "runtimeExecutable": "npm", + "skipFiles": ["/**"], + "console": "externalTerminal", + "type": "pwa-node" + }, + { + "type": "chrome", + "request": "attach", + "name": "Attach Karma Chrome", + "address": "localhost", + "port": 9876, + "pathMapping": { + "/": "${workspaceRoot}/", + "/base/": "${workspaceRoot}/" + } + }, + { + "type": "pwa-node", + "request": "launch", + "name": "Launch Test", + "skipFiles": ["/**"], + "program": "${workspaceFolder}\\test\\node\\index.spec.ts", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": ["${workspaceFolder}/out/**/*.js"] + } + ] +} diff --git a/sdk/iotplugandplay/models-repo-tool/CHANGELOG.md b/sdk/iotmodelsrepository/resolver-tool/CHANGELOG.md similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/CHANGELOG.md rename to sdk/iotmodelsrepository/resolver-tool/CHANGELOG.md diff --git a/sdk/iotplugandplay/models-repo-tool/LICENSE b/sdk/iotmodelsrepository/resolver-tool/LICENSE similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/LICENSE rename to sdk/iotmodelsrepository/resolver-tool/LICENSE diff --git a/sdk/iotplugandplay/models-repo-tool/README.md b/sdk/iotmodelsrepository/resolver-tool/README.md similarity index 92% rename from sdk/iotplugandplay/models-repo-tool/README.md rename to sdk/iotmodelsrepository/resolver-tool/README.md index 22093708f73a..842e902096dc 100644 --- a/sdk/iotplugandplay/models-repo-tool/README.md +++ b/sdk/iotmodelsrepository/resolver-tool/README.md @@ -6,10 +6,9 @@ The Azure IoT Resolver library for Javascript provides implementations for inter The Azure IoT Resolver library for Javascript is written to interact with the Azure IoT PlugAndPlay Models Repository, for those developers who wish to write applications in Javascript to do so. - ## Examples -*THIS WILL CHANGE WHEN MERGED INTO THE MONOREPO* +_THIS WILL CHANGE WHEN MERGED INTO THE MONOREPO_ To run the javascript examples, go to the samples directory: @@ -40,7 +39,7 @@ TODO ## Contributing -This project welcomes contributions and suggestions. Most contributions require you to agree to a +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. @@ -53,6 +52,7 @@ For more information see the [Code of Conduct FAQ](https://opensource.microsoft. contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + [azure_portal]: https://portal.azure.com [npm]: https://www.npmjs.com/ [iot_pnp_docs]: https://docs.microsoft.com/en-us/azure/iot-pnp/ diff --git a/sdk/iotplugandplay/models-repo-tool/api-extractor.json b/sdk/iotmodelsrepository/resolver-tool/api-extractor.json similarity index 99% rename from sdk/iotplugandplay/models-repo-tool/api-extractor.json rename to sdk/iotmodelsrepository/resolver-tool/api-extractor.json index 4c2071fb49da..12d812611d97 100644 --- a/sdk/iotplugandplay/models-repo-tool/api-extractor.json +++ b/sdk/iotmodelsrepository/resolver-tool/api-extractor.json @@ -28,4 +28,4 @@ } } } -} \ No newline at end of file +} diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js b/sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js similarity index 81% rename from sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js rename to sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js index b07b0c67f16c..e3fab8adf94a 100644 --- a/sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js +++ b/sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=DTDL.js.map \ No newline at end of file +//# sourceMappingURL=DTDL.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/src/DTDL.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js b/sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js new file mode 100644 index 000000000000..fb99d9854fc4 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dtmiToQualifiedPath = exports.dtmiToPath = exports.isValidDtmi = void 0; +function isValidDtmi(dtmi) { + if (dtmi) { + const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/; + return re.test(dtmi); // true if dtmi matches regular expression, false otherwise + } + return false; // if not a string return false. +} +exports.isValidDtmi = isValidDtmi; +function dtmiToPath(dtmi) { + // presently this dtmi to path function does not return the path with a + // file format at the end, i.e. does not append .json or .expanded.json. + // that happens in the dtmiToQualifiedPath function + if (isValidDtmi(dtmi)) { + return `${dtmi + .toLowerCase() + .replace(/:/gm, "/") + .replace(/;/gm, "-")}.json`; + } else { + throw new Error("DTMI provided is invalid. Ensure it follows DTMI conventions."); + } +} +exports.dtmiToPath = dtmiToPath; +function ensureStartsWithProtocol(text) { + const re = /^http[s]?:\/\//; + if (text.search(re) !== -1) { + return text; + } else { + return `https://${text}`; + } +} +function dtmiToQualifiedPath(dtmi, endpoint, isExpanded) { + const dtmiAsPath = dtmiToPath(dtmi); + const endpointWithSlash = endpoint.endsWith("/") ? endpoint : `${endpoint}/`; + const urlEndpoint = ensureStartsWithProtocol(endpointWithSlash); + if (isExpanded) { + return `${urlEndpoint}${dtmiAsPath.replace(/json$/, "expanded.json")}`; + } else { + return `${urlEndpoint}${dtmiAsPath}`; + } +} +exports.dtmiToQualifiedPath = dtmiToQualifiedPath; +//# sourceMappingURL=dtmiConventions.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/index.js b/sdk/iotmodelsrepository/resolver-tool/out/src/index.js similarity index 88% rename from sdk/iotplugandplay/models-repo-tool/out/src/index.js rename to sdk/iotmodelsrepository/resolver-tool/out/src/index.js index 73f07b3a33f1..3b4becdaeafb 100644 --- a/sdk/iotplugandplay/models-repo-tool/out/src/index.js +++ b/sdk/iotmodelsrepository/resolver-tool/out/src/index.js @@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); // exporting the resolver api tslib_1.__exportStar(require("./resolver"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file +//# sourceMappingURL=index.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/index.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/index.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/src/index.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/src/index.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js b/sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js new file mode 100644 index 000000000000..41ef15dd87ad --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.recursiveFetcher = exports.fetcher = void 0; +const tslib_1 = require("tslib"); +const dtmiConventions = tslib_1.__importStar(require("./dtmiConventions")); +const modelMetadata = tslib_1.__importStar(require("./modelMetadata")); +const fs_1 = tslib_1.__importDefault(require("fs")); +const path = tslib_1.__importStar(require("path")); +const modelFetcherHelper_1 = require("./modelFetcherHelper"); +function recursiveFetcher(dtmi, directory, tryFromExpanded) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + let dependencyModels = {}; + let fetchedModels; + try { + console.log(`Fetching: ${dtmi}`); + fetchedModels = yield fetcher(dtmi, directory, tryFromExpanded); + } catch (error) { + if (tryFromExpanded && error.code === "ENOENT") { + console.log("Fetching from expanded failed. Trying without."); + fetchedModels = yield fetcher(dtmi, directory, false); + } else { + throw error; + } + } + const dtmis = Object.keys(fetchedModels); + for (let i = 0; i < dtmis.length; i++) { + const currentDtdl = fetchedModels[dtmis[i]]; + const metaModelData = modelMetadata.getModelMetadata(currentDtdl); + const deps = metaModelData.componentSchemas.concat(metaModelData.extends); + if (deps && deps.length > 0) { + for (let j = 0; j < deps.length; j++) { + if ( + Object.keys(dependencyModels).includes(deps[j]) || + Object.keys(fetchedModels).includes(deps[j]) + ) { + // do nothing + } else { + const fetchedDependencies = yield recursiveFetcher(deps[j], directory, tryFromExpanded); + dependencyModels = Object.assign( + Object.assign({}, dependencyModels), + fetchedDependencies + ); + } + } + } + } + if (Object.keys(dependencyModels).length > 0) { + fetchedModels = Object.assign(Object.assign({}, fetchedModels), dependencyModels); + } + return fetchedModels; + }); +} +exports.recursiveFetcher = recursiveFetcher; +function fetcher(dtmi, directory, tryFromExpanded) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const dtmiPath = dtmiConventions.dtmiToPath(dtmi); + const dtmiPathFormatted = tryFromExpanded + ? dtmiPath.replace(".json", ".expanded.json") + : dtmiPath; + const targetPath = path.join(directory, dtmiPathFormatted); + const dtdlFile = fs_1.default.readFileSync(targetPath, "utf8"); + const parsedDtdl = JSON.parse(dtdlFile); + if (Array.isArray(parsedDtdl)) { + const result = modelFetcherHelper_1.flattenDtdlResponse(parsedDtdl); + return result; + } else { + const result = { [dtmi]: parsedDtdl }; + return result; + } + }); +} +exports.fetcher = fetcher; +//# sourceMappingURL=localModelFetchers.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js b/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js new file mode 100644 index 000000000000..2898f21cff9b --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.modelFetcher = void 0; +const tslib_1 = require("tslib"); +const fs = tslib_1.__importStar(require("fs")); +const url = tslib_1.__importStar(require("url")); +const localFetchers = tslib_1.__importStar(require("./localModelFetchers")); +const remoteFetchers = tslib_1.__importStar(require("./remoteModelFetchers")); +function isLocalPath(p) { + if (p.startsWith("https://") || p.startsWith("http://")) { + return false; + } else if (p.startsWith("file://")) { + return true; + } else { + try { + fs.accessSync(p); + return true; + } catch (_a) { + return false; + } + } +} +function modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + if (isLocalPath(endpoint)) { + const formattedDirectory = endpoint.includes("file://") + ? url.fileURLToPath(endpoint) + : endpoint; + if (tryFromExpanded || resolveDependencies) { + return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded); + } else { + console.log(`Fetching: ${dtmi}`); + return localFetchers.fetcher(dtmi, formattedDirectory, false); + } + } else { + if (tryFromExpanded || resolveDependencies) { + return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded); + } + console.log(`Fetching: ${dtmi}`); + return remoteFetchers.fetcher(dtmi, endpoint, false); + } + }); +} +exports.modelFetcher = modelFetcher; +//# sourceMappingURL=modelFetcherHandler.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js b/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js new file mode 100644 index 000000000000..dbd97c0ed758 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.flattenDtdlResponse = void 0; +function flattenDtdlResponse(input) { + const newResult = {}; + for (let i = 0; i++; i < input.length) { + const currentDtdl = input[i]; + if (!currentDtdl["@id"]) { + throw new Error("no @id element found in DTDL. Ensure DTDL contains @id element"); + } + newResult[currentDtdl["@id"]] = currentDtdl; + } + input.forEach((element) => { + newResult[element["@id"]] = element; + }); + return newResult; +} +exports.flattenDtdlResponse = flattenDtdlResponse; +//# sourceMappingURL=modelFetcherHelper.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js b/sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js new file mode 100644 index 000000000000..7f9445ab12e9 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getModelMetadata = void 0; +function getId(input) { + const idElement = input["@id"]; + return idElement; +} +function getExtends(input) { + const extendElement = input.extends; + return extendElement; +} +function getComponentSchemas(input) { + const componentSchemas = []; + if (input.contents) { + const contents = input.contents; + contents.forEach((element) => { + if ( + element["@type"] && + typeof element["@type"] === "string" && + element["@type"] === "Component" + ) { + if (element.schema && typeof element.schema === "string") { + componentSchemas.push(element.schema); + } + } + }); + } + return componentSchemas; +} +function getModelMetadata(input) { + const idElement = getId(input); + const extendsElement = getExtends(input); + const componentSchemas = getComponentSchemas(input); + return { + id: idElement, + extends: extendsElement, + componentSchemas: componentSchemas + }; +} +exports.getModelMetadata = getModelMetadata; +//# sourceMappingURL=modelMetadata.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js b/sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js new file mode 100644 index 000000000000..be12a565fb8b --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.recursiveFetcher = exports.fetcher = void 0; +const tslib_1 = require("tslib"); +const dtmiConventions = tslib_1.__importStar(require("./dtmiConventions")); +const modelMetadata = tslib_1.__importStar(require("./modelMetadata")); +const coreHttp = tslib_1.__importStar(require("@azure/core-http")); +const modelFetcherHelper_1 = require("./modelFetcherHelper"); +function recursiveFetcher(dtmi, endpoint, tryFromExpanded) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + let dependencyModels = {}; + let fetchedModels; + try { + console.log(`Fetching: ${dtmi}`); + fetchedModels = yield fetcher(dtmi, endpoint, tryFromExpanded); + } catch (error) { + if ( + tryFromExpanded && + (error.code === "ENOENT" || !(error.statusCode >= 200 && error.statusCode < 400)) + ) { + console.log("Fetching from expanded failed. Trying without."); + console.log(`Fetching: ${dtmi}`); + fetchedModels = yield fetcher(dtmi, endpoint, false); + } else { + throw error; + } + } + const dtmis = Object.keys(fetchedModels); + for (let i = 0; i < dtmis.length; i++) { + const currentDtdl = fetchedModels[dtmis[i]]; + const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas; + if (deps && deps.length > 0) { + for (let j = 0; j < deps.length; j++) { + if ( + Object.keys(dependencyModels).includes(deps[j]) || + Object.keys(fetchedModels).includes(deps[j]) + ) { + // do nothing + } else { + const fetchedDependencies = yield recursiveFetcher(deps[j], endpoint, tryFromExpanded); + dependencyModels = Object.assign( + Object.assign({}, dependencyModels), + fetchedDependencies + ); + } + } + } + } + if (Object.keys(dependencyModels).length > 0) { + fetchedModels = Object.assign(Object.assign({}, fetchedModels), dependencyModels); + } + return fetchedModels; + }); +} +exports.recursiveFetcher = recursiveFetcher; +function fetcher(dtmi, endpoint, tryFromExpanded) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const client = new coreHttp.ServiceClient(); + const req = { + url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), + method: "GET" + }; + const res = yield client.sendRequest(req); + if (res.status >= 200 && res.status < 400) { + const dtdlAsString = res.bodyAsText || ""; + const parsedDtdl = JSON.parse(dtdlAsString); + if (Array.isArray(parsedDtdl)) { + const result = modelFetcherHelper_1.flattenDtdlResponse(parsedDtdl); + return result; + } else { + const result = { [dtmi]: parsedDtdl }; + return result; + } + } else { + throw new coreHttp.RestError( + "Error on HTTP Request in remote model fetcher", + "404", + 404, + undefined, + res + ); + } + }); +} +exports.fetcher = fetcher; +//# sourceMappingURL=remoteModelFetchers.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js b/sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js new file mode 100644 index 000000000000..c21c3d319946 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolve = void 0; +const modelFetcherHandler_1 = require("./modelFetcherHandler"); +function checkIfTryFromExpanded(options) { + if (options && options.resolveDependencies && options.resolveDependencies === "tryFromExpanded") { + return true; + } + return false; +} +function checkIfResolveDependencies(options) { + if (options && options.resolveDependencies && options.resolveDependencies === "enabled") { + return true; + } + return false; +} +function resolve(dtmi, endpoint, options) { + const tryFromExpanded = checkIfTryFromExpanded(options); + const resolveDependencies = checkIfResolveDependencies(options); + return modelFetcherHandler_1.modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded); +} +exports.resolve = resolve; +//# sourceMappingURL=resolver.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/resolver.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/src/resolver.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js b/sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js new file mode 100644 index 000000000000..1c4b79b8a370 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js @@ -0,0 +1,30 @@ +"use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const lib = tslib_1.__importStar(require("../../src")); +const chai_1 = require("chai"); +const sinon = tslib_1.__importStar(require("sinon")); +describe("resolver - browser", () => { + afterEach(() => { + sinon.restore(); + }); + describe("single resolution (no pseudo-parsing)", () => { + it.only("integration works in browser", function(done) { + const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const endpoint = "https://devicemodels.azure.com"; + const fakeData = JSON.stringify({ + fakeDtdl: "fakeBodyAsText" + }); + const resolveResult = lib.resolve(dtmi, endpoint); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepStrictEqual({ [dtmi]: JSON.parse(fakeData) }, actualOutput); + done(); + }) + .catch((err) => done(err)); + }); + }); +}); +//# sourceMappingURL=browserTest.spec.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js.map b/sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js b/sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js new file mode 100644 index 000000000000..f890b4f0f14e --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js @@ -0,0 +1,161 @@ +"use strict"; +/* eslint-disable no-undef */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const lib = tslib_1.__importStar(require("../../src/dtmiConventions")); +// fake class while lib not implemented +const sinon = tslib_1.__importStar(require("sinon")); +const chai_1 = require("chai"); +const validParameters = [ + { + dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;1", + path: "dtmi/azure/devicemanagement/deviceinformation-1.json", + url: "https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json" + }, + { + dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;10000", + path: "dtmi/azure/devicemanagement/deviceinformation-10000.json", + url: "https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-10000.json" + }, + { + dtmi: "dtmi:com:DeviceInformation;1", + path: "dtmi/com/deviceinformation-1.json", + url: "https://contoso.com/dtmi/com/deviceinformation-1.json" + }, + { + dtmi: "dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1", + path: "dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json", + url: "https://contoso.com/dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json" + }, + { + dtmi: "dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7", + path: "dtmi/azure/devicemanagement/thermometer-7.json", + url: "https://contoso.com/dtmi/azure/devicemanagement/thermometer-7.json" + }, + { + dtmi: "dtmi:thermometer;2", + path: "dtmi/thermometer-2.json", + url: "https://contoso.com/dtmi/thermometer-2.json" + } +]; +const invalidParameters = [ + { dtmi: "dtmiazure:DeviceManagement:DeviceInformation;1" }, + { dtmi: "dtmi;azure;DeviceManagement;DeviceInformation;1" }, + { dtmi: "asdf" }, + { dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;-1" }, + { dtmi: "dtmi:azure:DeviceManagement:Device-Information;1" }, + { dtmi: "DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7" }, + { dtmi: "dmti:azure:thermometer;10" } +]; +describe("dtmiConventions", function() { + afterEach(function() { + sinon.restore(); + }); + describe("isValidDtmi", function() { + describe("valid", function() { + function validTest(givenDtmi) { + const result = lib.isValidDtmi(givenDtmi); + chai_1.assert(result, "valid dtmi not found as valid"); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should validate a correctly formatted dtmi (${validParameters[i].dtmi})`, function() { + validTest(validParameters[i].dtmi); + }); + } + }); + describe("invalid", function() { + function invalidTest(givenDtmi) { + const result = lib.isValidDtmi(givenDtmi); + chai_1.assert(!result, "invalid dtmi incorrectly labelled as valid"); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should invalidate incorrectly formatted dtmi (${invalidParameters[i].dtmi})`, function() { + invalidTest(invalidParameters[i].dtmi); + }); + } + }); + }); + describe("dtmiToPath", function() { + describe("valid", function() { + function validTest(givenDtmi, expectedPath) { + const result = lib.dtmiToPath(givenDtmi); + chai_1.assert.deepEqual(result, expectedPath); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a generic path (${validParameters[i].dtmi})`, function() { + validTest(validParameters[i].dtmi, validParameters[i].path); + }); + } + }); + describe("invalid", function() { + function invalidTest(givenDtmi) { + chai_1 + .expect(() => { + lib.dtmiToPath(givenDtmi); + }) + .to.throw("DTMI provided is invalid. Ensure it follows DTMI conventions."); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function() { + invalidTest(invalidParameters[i].dtmi); + }); + } + }); + }); + describe("dtmiToFullyQualifiedPath", function() { + describe("invalid", function() { + function invalidTest(givenDtmi) { + chai_1 + .expect(() => { + const fakeBasePath = "https://contoso.com"; + lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); + }) + .to.throw("DTMI provided is invalid. Ensure it follows DTMI conventions."); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function() { + invalidTest(invalidParameters[i].dtmi); + }); + } + }); + describe("valid", function() { + describe("standard url", function() { + function reformatTest(givenDtmi, expected) { + const fakeBasePath = "https://contoso.com"; + const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); + chai_1.assert.deepEqual(result, expected); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a qualified path (${validParameters[i].dtmi})`, function() { + reformatTest(validParameters[i].dtmi, validParameters[i].url); + }); + } + }); + describe("expanded url", function() { + function addExpandedTest(givenDtmi, expected) { + const fakeBasePath = "https://contoso.com"; + const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, true); + chai_1.assert.deepEqual(result, expected); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a qualified path with expanded.json (${validParameters[i].dtmi})`, function() { + addExpandedTest( + validParameters[i].dtmi, + validParameters[i].url.replace(".json", ".expanded.json") + ); + }); + } + }); + }); + }); +}); +//# sourceMappingURL=dtmiConventions.spec.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js.map b/sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js b/sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js new file mode 100644 index 000000000000..c81597c5170d --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js @@ -0,0 +1,472 @@ +"use strict"; +/* eslint-disable no-undef */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const resolverTool = tslib_1.__importStar(require("../../src")); +const coreHttp = tslib_1.__importStar(require("@azure/core-http")); +const fs = tslib_1.__importStar(require("fs")); +const chai_1 = require("chai"); +const sinon = tslib_1.__importStar(require("sinon")); +const path = tslib_1.__importStar(require("path")); +describe("resolver - node", function() { + afterEach(function() { + sinon.restore(); + }); + describe("remote URL resolution", function() { + describe("simple DTDL resolution", function() { + it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + const fakeDtmi = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; + const fakeEndpoint = "devicemodels.contoso.com"; + const expectedUri = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; + const fakeData = JSON.stringify({ + fakeDtdl: "fakeBodyAsText" + }); + sinon.stub(coreHttp, "ServiceClient").returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri, + "URL not formatted for request correctly." + ); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint); + chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); + done(); + }) + .catch((err) => done(err)); + }); + }); + describe("depenency resolution (using pseudo-parsing)", function() { + it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + const fakeDtmi = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; + const fakeEndpoint = "devicemodels.contoso.com"; + const expectedUri = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; + const fakeData = JSON.stringify({ + fakeKey: "fakeValue" + }); + sinon.stub(coreHttp, "ServiceClient").returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri, + "URL not formatted for request correctly." + ); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { + resolveDependencies: "enabled" + }); + chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); + done(); + }) + .catch((err) => done(err)); + }); + it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { + const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + const fakeDtmi2 = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + const fakeDtmi3 = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const fakeEndpoint = "devicemodels.contoso.com"; + const expectedUri = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; + const expectedUri2 = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; + const expectedUri3 = + "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + ); + const fakeData = fs.readFileSync(pathToDtdl).toString(); + const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); + const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); + const expectedOutput = { + [fakeDtmi1]: JSON.parse(fakeData), + [fakeDtmi2]: JSON.parse(fakeData2), + [fakeDtmi3]: JSON.parse(fakeData3) + }; + const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); + serviceClientStub.onFirstCall().returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri, + "URL not formatted for request correctly." + ); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + serviceClientStub.onSecondCall().returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri2, + "URL not formatted for request correctly." + ); + return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); + } + }); + serviceClientStub.onThirdCall().returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri3, + "URL not formatted for request correctly." + ); + return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); + } + }); + const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { + resolveDependencies: "enabled" + }); + chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepEqual( + Object.keys(actualOutput), + Object.keys(expectedOutput), + "dtmis in actual output do not align with expected output" + ); + chai_1.assert.deepStrictEqual(expectedOutput, actualOutput); + done(); + }) + .catch((err) => done(err)); + }); + }); + describe("try from expanded (expanded.json)", function() { + it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + const fakeDtmi = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; + const fakeEndpoint = "devicemodels.contoso.com"; + const expectedUri = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json"; + const fakeData = `[${JSON.stringify({ + "@id": fakeDtmi, + fakeDtdl: "fakeBodyAsText" + })}]`; + sinon.stub(coreHttp, "ServiceClient").returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri, + "URL not formatted for request correctly." + ); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { + resolveDependencies: "tryFromExpanded" + }); + chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput); + done(); + }) + .catch((err) => done(err)); + }); + it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { + const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + const fakeDtmi2 = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + const fakeDtmi3 = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const fakeEndpoint = "devicemodels.contoso.com"; + const expectedUri = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; + const expectedUri2 = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; + const expectedUri3 = + "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + ); + const fakeData = fs.readFileSync(pathToDtdl).toString(); + const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); + const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); + const expectedOutput = { + [fakeDtmi1]: JSON.parse(fakeData), + [fakeDtmi2]: JSON.parse(fakeData2), + [fakeDtmi3]: JSON.parse(fakeData3) + }; + const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); + serviceClientStub.onCall(0).returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri.replace(".json", ".expanded.json"), + "URL not formatted for request correctly." + ); + return Promise.resolve({ status: 404 }); + } + }); + serviceClientStub.onCall(1).returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri, + "URL not formatted for request correctly." + ); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + serviceClientStub.onCall(2).returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri2.replace(".json", ".expanded.json"), + "URL not formatted for request correctly." + ); + return Promise.resolve({ status: 404 }); + } + }); + serviceClientStub.onCall(3).returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri2, + "URL not formatted for request correctly." + ); + return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); + } + }); + serviceClientStub.onCall(4).returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri3.replace(".json", ".expanded.json"), + "URL not formatted for request correctly." + ); + return Promise.resolve({ status: 404 }); + } + }); + serviceClientStub.onCall(5).returns({ + sendRequest: function(req) { + chai_1.assert.deepEqual( + req.url, + expectedUri3, + "URL not formatted for request correctly." + ); + return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); + } + }); + const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { + resolveDependencies: "tryFromExpanded" + }); + chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepEqual( + Object.keys(actualOutput), + Object.keys(expectedOutput), + "dtmis in actual output do not align with expected output" + ); + chai_1.assert.deepStrictEqual(expectedOutput, actualOutput); + done(); + }) + .catch((err) => done(err)); + }); + }); + }); + describe("local file resolution", function() { + describe("simple DTDL resolution", function() { + it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + const fakeDtmi = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + ); + const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, "utf-8")); + const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory); + chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepStrictEqual( + { [fakeDtmi]: fakeDtdl }, + actualOutput, + "the expected dtmi mapping did not match the actual value." + ); + done(); + }) + .catch((err) => done(err)); + }); + }); + describe("dependency resolution (using pseudo-parsing)", function() { + it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { + const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + const fakeDtmi2 = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + const fakeDtmi3 = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl1 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + ); + const pathToDtdl2 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + ); + const pathToDtdl3 = path.join( + localDirectory, + "dtmi/azure/DeviceManagement/deviceinformation-1.json" + ); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); + const expectedOutput = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { + resolveDependencies: "enabled" + }); + chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepStrictEqual( + Object.keys(actualOutput), + Object.keys(expectedOutput), + "dtmis do not match" + ); + Object.keys(actualOutput).forEach((outputDtmi) => { + chai_1.assert.deepStrictEqual( + actualOutput[outputDtmi], + expectedOutput[outputDtmi], + `dtdls for given dtmi (${outputDtmi}) did not line up.` + ); + }); + chai_1.assert.deepStrictEqual( + actualOutput, + expectedOutput, + "the expected dtmi mapping did not match the actual value." + ); + done(); + }) + .catch((err) => done(err)); + }); + it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl1 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + ); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + const expectedResult = { + [fakeDtmi1]: fakeDtdl1 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory); + chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepStrictEqual( + expectedResult, + actualOutput, + "the expected dtmi mapping did not match the actual value." + ); + done(); + }) + .catch((err) => done(err)); + }); + }); + describe("try from expanded (expanded.json)", function() { + it("should return a promise that resolves to a mapping from the DTMIs to the JSON objects", function(done) { + const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + const fakeDtmi2 = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + const fakeDtmi3 = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl1 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + ); + const pathToDtdl2 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + ); + const pathToDtdl3 = path.join( + localDirectory, + "dtmi/azure/DeviceManagement/deviceinformation-1.json" + ); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); + const expectedResult = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { + resolveDependencies: "tryFromExpanded" + }); + chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepStrictEqual( + expectedResult, + actualOutput, + "the expected dtmi mapping did not match the actual value." + ); + done(); + }) + .catch((err) => done(err)); + }); + it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { + const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2"; + const fakeDtmi2 = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + const fakeDtmi3 = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl1 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json" + ); + const pathToDtdl2 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + ); + const pathToDtdl3 = path.join( + localDirectory, + "dtmi/azure/DeviceManagement/deviceinformation-1.json" + ); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); + const expectedResult = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { + resolveDependencies: "tryFromExpanded" + }); + chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput) => { + chai_1.assert.deepEqual( + Object.keys(expectedResult), + Object.keys(actualOutput), + "the expected dtmis do not match" + ); + Object.keys(expectedResult).forEach((dtmiKey) => { + chai_1.assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey]); + }); + done(); + }) + .catch((err) => done(err)); + }); + }); + }); +}); +//# sourceMappingURL=index.spec.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js.map b/sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js.map similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js.map rename to sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js.map diff --git a/sdk/iotplugandplay/models-repo-tool/package.json b/sdk/iotmodelsrepository/resolver-tool/package.json similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/package.json rename to sdk/iotmodelsrepository/resolver-tool/package.json diff --git a/sdk/iotmodelsrepository/resolver-tool/rollup.config.js b/sdk/iotmodelsrepository/resolver-tool/rollup.config.js new file mode 100644 index 000000000000..a173140336a0 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/rollup.config.js @@ -0,0 +1,11 @@ +import resolve from "@rollup/plugin-node-resolve"; +import auto from "@rollup/plugin-auto-install"; + +export default { + input: "dist-esm/index.js", + output: { + file: "bundle.js", + format: "cjs" + }, + plugins: [auto(), resolve()] +}; diff --git a/sdk/iotplugandplay/models-repo-tool/samples/javascript/local_example.js b/sdk/iotmodelsrepository/resolver-tool/samples/javascript/local_example.js similarity index 53% rename from sdk/iotplugandplay/models-repo-tool/samples/javascript/local_example.js rename to sdk/iotmodelsrepository/resolver-tool/samples/javascript/local_example.js index a7911da0286e..b236c41b94b8 100644 --- a/sdk/iotplugandplay/models-repo-tool/samples/javascript/local_example.js +++ b/sdk/iotmodelsrepository/resolver-tool/samples/javascript/local_example.js @@ -5,28 +5,28 @@ * Demonstrates resolving/obtaining a particular model definition from a remote model repository */ -const resolver = require('../../out/src/index.js') +const resolver = require("../../out/src/index.js"); // You can change the endpoint and dtmi you'd like to access -const directory = process.argv[2] || 'C:/' -const dtmi = 'dtmi:com:example:TemperatureController;1' +const directory = process.argv[2] || "C:/"; +const dtmi = "dtmi:com:example:TemperatureController;1"; -console.log(directory, dtmi) +console.log(directory, dtmi); -async function main () { +async function main() { // This is where you can change the options for how you want to resolve the dependencies. - const result = await resolver.resolve(dtmi, directory, { resolveDependencies: 'enabled' }) - console.log(result) + const result = await resolver.resolve(dtmi, directory, { resolveDependencies: "enabled" }); + console.log(result); Object.keys(result).forEach((fetchedDtmi) => { - console.log(`DTMI is: ${fetchedDtmi}`) - console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`) - console.log(`DTDL Description is: ${result[fetchedDtmi].description}`) - console.log('------------------------------------------------') - console.log(JSON.stringify(result[fetchedDtmi])) - console.log('------------------------------------------------') - }) + console.log(`DTMI is: ${fetchedDtmi}`); + console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`); + console.log(`DTDL Description is: ${result[fetchedDtmi].description}`); + console.log("------------------------------------------------"); + console.log(JSON.stringify(result[fetchedDtmi])); + console.log("------------------------------------------------"); + }); } main().catch((err) => { - console.error('The sample encountered an error:', err) -}) + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/iotmodelsrepository/resolver-tool/samples/javascript/package.json b/sdk/iotmodelsrepository/resolver-tool/samples/javascript/package.json new file mode 100644 index 000000000000..606ae70d2a9e --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/samples/javascript/package.json @@ -0,0 +1,30 @@ +{ + "name": "azure-modelsrepository-samples-js", + "private": true, + "version": "0.1.0", + "description": "Azure models repository client library samples for JavaScript", + "engine": { + "node": ">=8.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/template/template" + }, + "keywords": [ + "Azure", + "Node.js", + "JavaScript" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template", + "sideEffects": false, + "dependencies": { + "@azure/template": "latest", + "dotenv": "^8.2.0" + } +} diff --git a/sdk/iotplugandplay/models-repo-tool/samples/javascript/remote_example.js b/sdk/iotmodelsrepository/resolver-tool/samples/javascript/remote_example.js similarity index 51% rename from sdk/iotplugandplay/models-repo-tool/samples/javascript/remote_example.js rename to sdk/iotmodelsrepository/resolver-tool/samples/javascript/remote_example.js index adccea78b3a7..8ceed9ee91cc 100644 --- a/sdk/iotplugandplay/models-repo-tool/samples/javascript/remote_example.js +++ b/sdk/iotmodelsrepository/resolver-tool/samples/javascript/remote_example.js @@ -5,28 +5,30 @@ * Demonstrates resolving/obtaining a particular model definition from a remote model repository */ -const resolver = require('../../out/src/index.js') +const resolver = require("../../out/src/index.js"); // You can change the endpoint and dtmi you'd like to access -const repositoryEndpoint = 'https://devicemodels.azure.com/' -const dtmi = process.argv[2] || 'dtmi:rigado:FlicButton;2' +const repositoryEndpoint = "https://devicemodels.azure.com/"; +const dtmi = process.argv[2] || "dtmi:rigado:FlicButton;2"; -console.log(repositoryEndpoint, dtmi) +console.log(repositoryEndpoint, dtmi); -async function main () { +async function main() { // This is where you can change the options for how you want to resolve the dependencies. - const result = await resolver.resolve(dtmi, repositoryEndpoint, { resolveDependencies: 'tryFromExpanded' }) - console.log(result) + const result = await resolver.resolve(dtmi, repositoryEndpoint, { + resolveDependencies: "tryFromExpanded" + }); + console.log(result); Object.keys(result).forEach((fetchedDtmi) => { - console.log(`DTMI is: ${fetchedDtmi}`) - console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`) - console.log(`DTDL Description is: ${result[fetchedDtmi].description}`) - console.log('------------------------------------------------') - console.log(JSON.stringify(result[fetchedDtmi])) - console.log('------------------------------------------------') - }) + console.log(`DTMI is: ${fetchedDtmi}`); + console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`); + console.log(`DTDL Description is: ${result[fetchedDtmi].description}`); + console.log("------------------------------------------------"); + console.log(JSON.stringify(result[fetchedDtmi])); + console.log("------------------------------------------------"); + }); } main().catch((err) => { - console.error('The sample encountered an error:', err) -}) + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/iotplugandplay/models-repo-tool/samples/typescript/README.md b/sdk/iotmodelsrepository/resolver-tool/samples/typescript/README.md similarity index 80% rename from sdk/iotplugandplay/models-repo-tool/samples/typescript/README.md rename to sdk/iotmodelsrepository/resolver-tool/samples/typescript/README.md index 7bf7563dcab7..d5c888fa19c6 100644 --- a/sdk/iotplugandplay/models-repo-tool/samples/typescript/README.md +++ b/sdk/iotmodelsrepository/resolver-tool/samples/typescript/README.md @@ -14,9 +14,9 @@ urlFragment: template-typescript These sample programs show how to use the TypeScript client libraries for Azure Template in some common scenarios. -| **File Name** | **Description** | -| ------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| [sampleTemplate.ts][sampleTemplate] | sample template | +| **File Name** | **Description** | +| ----------------------------------- | --------------- | +| [sampleTemplate.ts][sampletemplate] | sample template | ## Prerequisites @@ -66,8 +66,8 @@ npx cross-env ENDPOINT="" API_KEY="" node dist/sampleTemplate Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. -[sampleTemplate]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template/samples/typescript/src/sampleTemplate.ts +[sampletemplate]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template/samples/typescript/src/sampleTemplate.ts [apiref]: https://docs.microsoft.com/javascript/api [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html \ No newline at end of file +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/iotplugandplay/models-repo-tool/samples/typescript/package.json b/sdk/iotmodelsrepository/resolver-tool/samples/typescript/package.json similarity index 100% rename from sdk/iotplugandplay/models-repo-tool/samples/typescript/package.json rename to sdk/iotmodelsrepository/resolver-tool/samples/typescript/package.json diff --git a/sdk/iotmodelsrepository/resolver-tool/samples/typescript/src/example.ts b/sdk/iotmodelsrepository/resolver-tool/samples/typescript/src/example.ts new file mode 100644 index 000000000000..f8a2e1f200a9 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/samples/typescript/src/example.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/** + * Demonstrates resolving/obtaining a particular model definition from a remote model repository + */ + +import * as resolver from "@azure/iot-modelsrepository-resolver"; + +const repositoryEndpoint = "devicemodels.azure.com"; +const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; + +console.log(repositoryEndpoint, dtmi); + +async function main() { + const result = await resolver.resolve(dtmi, repositoryEndpoint); + console.log(result); +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/iotplugandplay/models-repo-tool/samples/typescript/tsconfig.json b/sdk/iotmodelsrepository/resolver-tool/samples/typescript/tsconfig.json similarity index 99% rename from sdk/iotplugandplay/models-repo-tool/samples/typescript/tsconfig.json rename to sdk/iotmodelsrepository/resolver-tool/samples/typescript/tsconfig.json index ff3cc4c38734..5ed056486b40 100644 --- a/sdk/iotplugandplay/models-repo-tool/samples/typescript/tsconfig.json +++ b/sdk/iotmodelsrepository/resolver-tool/samples/typescript/tsconfig.json @@ -1,4 +1,3 @@ - { "compilerOptions": { "module": "commonjs", diff --git a/sdk/iotplugandplay/models-repo-tool/src/CODE_STRUCTURE.md b/sdk/iotmodelsrepository/resolver-tool/src/CODE_STRUCTURE.md similarity index 81% rename from sdk/iotplugandplay/models-repo-tool/src/CODE_STRUCTURE.md rename to sdk/iotmodelsrepository/resolver-tool/src/CODE_STRUCTURE.md index 02ad5183f5e1..f9b2c45ed453 100644 --- a/sdk/iotplugandplay/models-repo-tool/src/CODE_STRUCTURE.md +++ b/sdk/iotmodelsrepository/resolver-tool/src/CODE_STRUCTURE.md @@ -18,25 +18,22 @@ Contains the logic for defining the api for the `resolve` method. The implementa The `resolve` method takes two main arguments: - - `dtmi (type: string)` - This is a user dtmi used for the dtdl the user intends to resolve. dtmi is a standard format, and if the dtmi provided does not follow the format it will be rejected. - - `endpoint (type:string)` - Can be a URL to a server endpoint, local or remote. Alternatively can be an *absolute* file path, if the dtdl is stored locally. In most cases you will be interacting with the device models repository, so the endpoint will be `https://devicemodels.azure.com`, however we do not set defaults so there's no question about behavior. Simple is easier to understand! +- `dtmi (type: string)` - This is a user dtmi used for the dtdl the user intends to resolve. dtmi is a standard format, and if the dtmi provided does not follow the format it will be rejected. +- `endpoint (type:string)` - Can be a URL to a server endpoint, local or remote. Alternatively can be an _absolute_ file path, if the dtdl is stored locally. In most cases you will be interacting with the device models repository, so the endpoint will be `https://devicemodels.azure.com`, however we do not set defaults so there's no question about behavior. Simple is easier to understand! The `resolve` method has optional parameters provided as a single object. You would use it as such: ```js -resolve(myDtmi, myEndpoint, { 'resolveDependencies': 'disabled' }) +resolve(myDtmi, myEndpoint, { resolveDependencies: "disabled" }); ``` Currently there is only one parameter in the optional object: -- `resolveDependencies (type: string)` - This is a useful way to get dependencies in one network call, and is recommended if you want to resolve the full dependency tree of a dtdl stored in the device model repository. These are the three options: +- `resolveDependencies (type: string)` - This is a useful way to get dependencies in one network call, and is recommended if you want to resolve the full dependency tree of a dtdl stored in the device model repository. These are the three options: - `disabled` - `enabled` - `tryFroExpanded` - - - ## dtmiConventions.ts Contains methods for checking that the DTMI is valid, and to convert the DTMI to a string. This is currently private, however there are discussions around making these helper functions public parts of the API. @@ -61,7 +58,6 @@ This is used to define an interface uesd in `dtmiConventions.ts`. Though it is a This handles figuring out which fetcher to use based on the type of endpoint and the options given. It will check the endpoint to see if it is a remote URL or a local file. Then, it will pass the parameters either to the remote fetcher or the local fetcher. - ## localModelFetchers.ts This contains the local `fetcher()` method and the `recursiveFetcher()` method. The regular `fetcher()` method is called when resolverOptions are set to `disabled`, and also used as the basic unit of fetching from a directory for the `recursiveFetcher()`. The `localModelFetchers.ts` and `remoteModelFetchers.ts` are fairly similar, except for handling the formatting of the endpoint/directory, and the use of `filesystem` in the case of the `localModelFetchers`. @@ -72,4 +68,4 @@ This contains the `fetcher()` method and the `recursiveFetcher()` method for fet ## modelMetadata.ts -Performs a psuedo-parsing of a given DTDL and gives back information primarily relevant for fetching dependencies. \ No newline at end of file +Performs a psuedo-parsing of a given DTDL and gives back information primarily relevant for fetching dependencies. diff --git a/sdk/iotplugandplay/models-repo-tool/src/DTDL.ts b/sdk/iotmodelsrepository/resolver-tool/src/DTDL.ts similarity index 58% rename from sdk/iotplugandplay/models-repo-tool/src/DTDL.ts rename to sdk/iotmodelsrepository/resolver-tool/src/DTDL.ts index 9e70e85f460d..4251013cc0c2 100644 --- a/sdk/iotplugandplay/models-repo-tool/src/DTDL.ts +++ b/sdk/iotmodelsrepository/resolver-tool/src/DTDL.ts @@ -1,17 +1,17 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -'use strict' +"use strict"; interface Contents { - '@type'?: string; - 'name': string; - 'schema': string; + "@type"?: string; + name: string; + schema: string; } export interface DTDL extends JSON { - '@context': any[], - '@id': string, - 'extends': string, - 'contents': Contents[] + "@context": any[]; + "@id": string; + extends: string; + contents: Contents[]; } diff --git a/sdk/iotmodelsrepository/resolver-tool/src/dtmiConventions.ts b/sdk/iotmodelsrepository/resolver-tool/src/dtmiConventions.ts new file mode 100644 index 000000000000..0f7fb01fc94a --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/src/dtmiConventions.ts @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +"use strict"; + +export function isValidDtmi(dtmi: string) { + if (dtmi) { + const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/; + return re.test(dtmi); // true if dtmi matches regular expression, false otherwise + } + return false; // if not a string return false. +} + +export function dtmiToPath(dtmi: string) { + // presently this dtmi to path function does not return the path with a + // file format at the end, i.e. does not append .json or .expanded.json. + // that happens in the dtmiToQualifiedPath function + + if (isValidDtmi(dtmi)) { + return `${dtmi + .toLowerCase() + .replace(/:/gm, "/") + .replace(/;/gm, "-")}.json`; + } else { + throw new Error("DTMI provided is invalid. Ensure it follows DTMI conventions."); + } +} + +function ensureStartsWithProtocol(text: string) { + const re = /^http[s]?:\/\//; + if (text.search(re) !== -1) { + return text; + } else { + return `https://${text}`; + } +} + +export function dtmiToQualifiedPath(dtmi: string, endpoint: string, isExpanded?: boolean) { + const dtmiAsPath = dtmiToPath(dtmi); + const endpointWithSlash = endpoint.endsWith("/") ? endpoint : `${endpoint}/`; + const urlEndpoint = ensureStartsWithProtocol(endpointWithSlash); + if (isExpanded) { + return `${urlEndpoint}${dtmiAsPath.replace(/json$/, "expanded.json")}`; + } else { + return `${urlEndpoint}${dtmiAsPath}`; + } +} diff --git a/sdk/iotplugandplay/models-repo-tool/src/index.ts b/sdk/iotmodelsrepository/resolver-tool/src/index.ts similarity index 79% rename from sdk/iotplugandplay/models-repo-tool/src/index.ts rename to sdk/iotmodelsrepository/resolver-tool/src/index.ts index 9eb70e44abcb..3133fdcebae1 100644 --- a/sdk/iotplugandplay/models-repo-tool/src/index.ts +++ b/sdk/iotmodelsrepository/resolver-tool/src/index.ts @@ -2,4 +2,4 @@ // Licensed under the MIT license. // exporting the resolver api -export * from './resolver' +export * from "./resolver"; diff --git a/sdk/iotmodelsrepository/resolver-tool/src/localModelFetchers.ts b/sdk/iotmodelsrepository/resolver-tool/src/localModelFetchers.ts new file mode 100644 index 000000000000..f2c61188fc8c --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/src/localModelFetchers.ts @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +"use strict"; + +import * as dtmiConventions from "./dtmiConventions"; +import * as modelMetadata from "./modelMetadata"; +import { DTDL } from "./DTDL"; +import fs from "fs"; +import * as path from "path"; +import { flattenDtdlResponse } from "./modelFetcherHelper"; + +async function recursiveFetcher( + dtmi: string, + directory: string, + tryFromExpanded: boolean +): Promise<{ [x: string]: DTDL }> { + let dependencyModels: { [x: string]: DTDL } = {}; + let fetchedModels: { [x: string]: DTDL }; + try { + console.log(`Fetching: ${dtmi}`); + fetchedModels = await fetcher(dtmi, directory, tryFromExpanded); + } catch (error) { + if (tryFromExpanded && error.code === "ENOENT") { + console.log("Fetching from expanded failed. Trying without."); + fetchedModels = await fetcher(dtmi, directory, false); + } else { + throw error; + } + } + const dtmis = Object.keys(fetchedModels); + for (let i = 0; i < dtmis.length; i++) { + const currentDtdl = fetchedModels[dtmis[i]]; + const metaModelData = modelMetadata.getModelMetadata(currentDtdl); + const deps = metaModelData.componentSchemas.concat(metaModelData.extends); + if (deps && deps.length > 0) { + for (let j = 0; j < deps.length; j++) { + if ( + Object.keys(dependencyModels).includes(deps[j]) || + Object.keys(fetchedModels).includes(deps[j]) + ) { + // do nothing + } else { + const fetchedDependencies = await recursiveFetcher(deps[j], directory, tryFromExpanded); + dependencyModels = { ...dependencyModels, ...fetchedDependencies }; + } + } + } + } + if (Object.keys(dependencyModels).length > 0) { + fetchedModels = { ...fetchedModels, ...dependencyModels }; + } + return fetchedModels; +} + +async function fetcher( + dtmi: string, + directory: string, + tryFromExpanded: boolean +): Promise<{ [dtmi: string]: DTDL }> { + const dtmiPath = dtmiConventions.dtmiToPath(dtmi); + const dtmiPathFormatted = tryFromExpanded + ? dtmiPath.replace(".json", ".expanded.json") + : dtmiPath; + const targetPath = path.join(directory, dtmiPathFormatted); + const dtdlFile = fs.readFileSync(targetPath, "utf8"); + const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); + if (Array.isArray(parsedDtdl)) { + const result = flattenDtdlResponse(parsedDtdl as DTDL[]); + return result; + } else { + const result = { [dtmi]: parsedDtdl as DTDL }; + return result; + } +} + +export { fetcher, recursiveFetcher }; diff --git a/sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHandler.ts b/sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHandler.ts new file mode 100644 index 000000000000..4ec3d3e2192e --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHandler.ts @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +"use strict"; + +import * as fs from "fs"; +import * as url from "url"; +import * as localFetchers from "./localModelFetchers"; +import * as remoteFetchers from "./remoteModelFetchers"; + +function isLocalPath(p: string): boolean { + if (p.startsWith("https://") || p.startsWith("http://")) { + return false; + } else if (p.startsWith("file://")) { + return true; + } else { + try { + fs.accessSync(p); + return true; + } catch { + return false; + } + } +} + +export async function modelFetcher( + dtmi: string, + endpoint: string, + resolveDependencies: boolean, + tryFromExpanded: boolean +): Promise<{ [dtmi: string]: JSON | Array }> { + if (isLocalPath(endpoint)) { + const formattedDirectory = endpoint.includes("file://") + ? url.fileURLToPath(endpoint) + : endpoint; + if (tryFromExpanded || resolveDependencies) { + return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded); + } else { + console.log(`Fetching: ${dtmi}`); + return localFetchers.fetcher(dtmi, formattedDirectory, false); + } + } else { + if (tryFromExpanded || resolveDependencies) { + return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded); + } + console.log(`Fetching: ${dtmi}`); + return remoteFetchers.fetcher(dtmi, endpoint, false); + } +} diff --git a/sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHelper.ts b/sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHelper.ts new file mode 100644 index 000000000000..a927f08b4a6c --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHelper.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +"use strict"; + +import { DTDL } from "./DTDL"; + +export function flattenDtdlResponse(input: DTDL[]) { + const newResult: { [x: string]: DTDL } = {}; + for (let i = 0; i++; i < input.length) { + const currentDtdl = input[i]; + if (!currentDtdl["@id"]) { + throw new Error("no @id element found in DTDL. Ensure DTDL contains @id element"); + } + newResult[currentDtdl["@id"]] = currentDtdl; + } + input.forEach((element: DTDL) => { + newResult[element["@id"]] = element; + }); + return newResult; +} diff --git a/sdk/iotmodelsrepository/resolver-tool/src/modelMetadata.ts b/sdk/iotmodelsrepository/resolver-tool/src/modelMetadata.ts new file mode 100644 index 000000000000..5cd9576c92f7 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/src/modelMetadata.ts @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +"use strict"; + +import { DTDL } from "./DTDL"; + +function getId(input: DTDL): string { + const idElement = input["@id"]; + return idElement; +} + +function getExtends(input: DTDL): string { + const extendElement = input.extends; + return extendElement; +} + +function getComponentSchemas(input: DTDL): string[] { + const componentSchemas: string[] = []; + if (input.contents) { + const contents = input.contents; + contents.forEach((element) => { + if ( + element["@type"] && + typeof element["@type"] === "string" && + element["@type"] === "Component" + ) { + if (element.schema && typeof element.schema === "string") { + componentSchemas.push(element.schema); + } + } + }); + } + return componentSchemas; +} + +export function getModelMetadata(input: DTDL) { + const idElement: string = getId(input); + const extendsElement: string = getExtends(input); + const componentSchemas: string[] = getComponentSchemas(input); + return { + id: idElement, + extends: extendsElement, + componentSchemas: componentSchemas + }; +} diff --git a/sdk/iotmodelsrepository/resolver-tool/src/remoteModelFetchers.ts b/sdk/iotmodelsrepository/resolver-tool/src/remoteModelFetchers.ts new file mode 100644 index 000000000000..e32267508e3f --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/src/remoteModelFetchers.ts @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +"use strict"; + +import * as dtmiConventions from "./dtmiConventions"; +import * as modelMetadata from "./modelMetadata"; +import * as coreHttp from "@azure/core-http"; +import { DTDL } from "./DTDL"; +import { flattenDtdlResponse } from "./modelFetcherHelper"; + +async function recursiveFetcher( + dtmi: string, + endpoint: string, + tryFromExpanded: boolean +): Promise<{ [dtmi: string]: DTDL }> { + let dependencyModels: { [x: string]: DTDL } = {}; + let fetchedModels: { [x: string]: DTDL }; + try { + console.log(`Fetching: ${dtmi}`); + fetchedModels = await fetcher(dtmi, endpoint, tryFromExpanded); + } catch (error) { + if ( + tryFromExpanded && + (error.code === "ENOENT" || !(error.statusCode >= 200 && error.statusCode < 400)) + ) { + console.log("Fetching from expanded failed. Trying without."); + console.log(`Fetching: ${dtmi}`); + fetchedModels = await fetcher(dtmi, endpoint, false); + } else { + throw error; + } + } + const dtmis = Object.keys(fetchedModels); + for (let i = 0; i < dtmis.length; i++) { + const currentDtdl = fetchedModels[dtmis[i]]; + const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas; + if (deps && deps.length > 0) { + for (let j = 0; j < deps.length; j++) { + if ( + Object.keys(dependencyModels).includes(deps[j]) || + Object.keys(fetchedModels).includes(deps[j]) + ) { + // do nothing + } else { + const fetchedDependencies = await recursiveFetcher(deps[j], endpoint, tryFromExpanded); + dependencyModels = { ...dependencyModels, ...fetchedDependencies }; + } + } + } + } + if (Object.keys(dependencyModels).length > 0) { + fetchedModels = { ...fetchedModels, ...dependencyModels }; + } + return fetchedModels; +} + +async function fetcher( + dtmi: string, + endpoint: string, + tryFromExpanded: boolean +): Promise<{ [dtmi: string]: any }> { + const client = new coreHttp.ServiceClient(); + const req: coreHttp.RequestPrepareOptions = { + url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), + method: "GET" + }; + const res: coreHttp.HttpOperationResponse = await client.sendRequest(req); + if (res.status >= 200 && res.status < 400) { + const dtdlAsString = res.bodyAsText || ""; + const parsedDtdl = JSON.parse(dtdlAsString); + if (Array.isArray(parsedDtdl)) { + const result = flattenDtdlResponse(parsedDtdl as DTDL[]); + return result; + } else { + const result = { [dtmi]: parsedDtdl as DTDL }; + return result; + } + } else { + throw new coreHttp.RestError( + "Error on HTTP Request in remote model fetcher", + "404", + 404, + undefined, + res + ); + } +} + +export { fetcher, recursiveFetcher }; diff --git a/sdk/iotplugandplay/models-repo-tool/src/resolver.ts b/sdk/iotmodelsrepository/resolver-tool/src/resolver.ts similarity index 52% rename from sdk/iotplugandplay/models-repo-tool/src/resolver.ts rename to sdk/iotmodelsrepository/resolver-tool/src/resolver.ts index 3db450bb9fe6..b7e57d963e47 100644 --- a/sdk/iotplugandplay/models-repo-tool/src/resolver.ts +++ b/sdk/iotmodelsrepository/resolver-tool/src/resolver.ts @@ -1,26 +1,26 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -'use strict' +"use strict"; -import { modelFetcher } from './modelFetcherHandler' +import { modelFetcher } from "./modelFetcherHandler"; interface resolverOptions { - resolveDependencies: 'disabled' | 'enabled' | 'tryFromExpanded' + resolveDependencies: "disabled" | "enabled" | "tryFromExpanded"; } -function checkIfTryFromExpanded (options?: resolverOptions): boolean { - if (options && options.resolveDependencies && options.resolveDependencies === 'tryFromExpanded') { - return true +function checkIfTryFromExpanded(options?: resolverOptions): boolean { + if (options && options.resolveDependencies && options.resolveDependencies === "tryFromExpanded") { + return true; } - return false + return false; } -function checkIfResolveDependencies (options?: resolverOptions): boolean { - if (options && options.resolveDependencies && options.resolveDependencies === 'enabled') { - return true +function checkIfResolveDependencies(options?: resolverOptions): boolean { + if (options && options.resolveDependencies && options.resolveDependencies === "enabled") { + return true; } - return false + return false; } /** @@ -32,13 +32,21 @@ function checkIfResolveDependencies (options?: resolverOptions): boolean { * * @returns Promise that resolves to mapping of dtmi(s) to JSON dtdl(s) */ -function resolve(dtmi: string, endpoint: string): Promise<{ [dtmi: string]: any}> -function resolve(dtmi: string, endpoint: string, options: resolverOptions): Promise<{ [dtmi: string]: any}> -function resolve (dtmi: string, endpoint : string, options ?: resolverOptions): Promise<{ [dtmi: string]:any}> { - const tryFromExpanded = checkIfTryFromExpanded(options) - const resolveDependencies = checkIfResolveDependencies(options) - - return modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded) +function resolve(dtmi: string, endpoint: string): Promise<{ [dtmi: string]: any }>; +function resolve( + dtmi: string, + endpoint: string, + options: resolverOptions +): Promise<{ [dtmi: string]: any }>; +function resolve( + dtmi: string, + endpoint: string, + options?: resolverOptions +): Promise<{ [dtmi: string]: any }> { + const tryFromExpanded = checkIfTryFromExpanded(options); + const resolveDependencies = checkIfResolveDependencies(options); + + return modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded); } -export { resolve } +export { resolve }; diff --git a/sdk/iotmodelsrepository/resolver-tool/test/browser/browserTest.spec.ts b/sdk/iotmodelsrepository/resolver-tool/test/browser/browserTest.spec.ts new file mode 100644 index 000000000000..a65d2a2795e3 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/test/browser/browserTest.spec.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import * as lib from "../../src"; + +import { assert } from "chai"; +import * as sinon from "sinon"; + +describe("resolver - browser", () => { + afterEach(() => { + sinon.restore(); + }); + + describe("single resolution (no pseudo-parsing)", () => { + it.only("integration works in browser", function(done) { + const dtmi: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const endpoint = "https://devicemodels.azure.com"; + const fakeData = JSON.stringify({ + fakeDtdl: "fakeBodyAsText" + }); + const resolveResult = lib.resolve(dtmi, endpoint); + resolveResult + .then((actualOutput: any) => { + assert.deepStrictEqual({ [dtmi]: JSON.parse(fakeData) }, actualOutput); + done(); + }) + .catch((err: any) => done(err)); + }); + }); +}); diff --git a/sdk/iotmodelsrepository/resolver-tool/test/node/dtmiConventions.spec.ts b/sdk/iotmodelsrepository/resolver-tool/test/node/dtmiConventions.spec.ts new file mode 100644 index 000000000000..aa7d5d2bbd79 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/test/node/dtmiConventions.spec.ts @@ -0,0 +1,172 @@ +/* eslint-disable no-undef */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import * as lib from "../../src/dtmiConventions"; + +// fake class while lib not implemented +import * as sinon from "sinon"; +import { assert, expect } from "chai"; + +interface ValidParams { + dtmi: string; + path: string; + url: string; +} + +const validParameters: ValidParams[] = [ + { + dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;1", + path: "dtmi/azure/devicemanagement/deviceinformation-1.json", + url: "https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json" + }, + { + dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;10000", + path: "dtmi/azure/devicemanagement/deviceinformation-10000.json", + url: "https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-10000.json" + }, + { + dtmi: "dtmi:com:DeviceInformation;1", + path: "dtmi/com/deviceinformation-1.json", + url: "https://contoso.com/dtmi/com/deviceinformation-1.json" + }, + { + dtmi: "dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1", + path: "dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json", + url: "https://contoso.com/dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json" + }, + { + dtmi: "dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7", + path: "dtmi/azure/devicemanagement/thermometer-7.json", + url: "https://contoso.com/dtmi/azure/devicemanagement/thermometer-7.json" + }, + { + dtmi: "dtmi:thermometer;2", + path: "dtmi/thermometer-2.json", + url: "https://contoso.com/dtmi/thermometer-2.json" + } +]; + +const invalidParameters: { dtmi: string }[] = [ + { dtmi: "dtmiazure:DeviceManagement:DeviceInformation;1" }, + { dtmi: "dtmi;azure;DeviceManagement;DeviceInformation;1" }, + { dtmi: "asdf" }, + { dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;-1" }, + { dtmi: "dtmi:azure:DeviceManagement:Device-Information;1" }, + { dtmi: "DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7" }, + { dtmi: "dmti:azure:thermometer;10" } +]; + +describe("dtmiConventions", function() { + afterEach(function() { + sinon.restore(); + }); + + describe("isValidDtmi", function() { + describe("valid", function() { + function validTest(givenDtmi: string) { + const result = lib.isValidDtmi(givenDtmi); + assert(result, "valid dtmi not found as valid"); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should validate a correctly formatted dtmi (${validParameters[i].dtmi})`, function() { + validTest(validParameters[i].dtmi); + }); + } + }); + + describe("invalid", function() { + function invalidTest(givenDtmi: string) { + const result = lib.isValidDtmi(givenDtmi); + assert(!result, "invalid dtmi incorrectly labelled as valid"); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should invalidate incorrectly formatted dtmi (${invalidParameters[i].dtmi})`, function() { + invalidTest(invalidParameters[i].dtmi); + }); + } + }); + }); + + describe("dtmiToPath", function() { + describe("valid", function() { + function validTest(givenDtmi: string, expectedPath: string) { + const result = lib.dtmiToPath(givenDtmi); + assert.deepEqual(result, expectedPath); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a generic path (${validParameters[i].dtmi})`, function() { + validTest(validParameters[i].dtmi, validParameters[i].path); + }); + } + }); + + describe("invalid", function() { + function invalidTest(givenDtmi: string) { + expect(() => { + lib.dtmiToPath(givenDtmi); + }).to.throw("DTMI provided is invalid. Ensure it follows DTMI conventions."); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function() { + invalidTest(invalidParameters[i].dtmi); + }); + } + }); + }); + + describe("dtmiToFullyQualifiedPath", function() { + describe("invalid", function() { + function invalidTest(givenDtmi: string) { + expect(() => { + const fakeBasePath = "https://contoso.com"; + lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); + }).to.throw("DTMI provided is invalid. Ensure it follows DTMI conventions."); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < invalidParameters.length; i++) { + it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function() { + invalidTest(invalidParameters[i].dtmi); + }); + } + }); + + describe("valid", function() { + describe("standard url", function() { + function reformatTest(givenDtmi: string, expected: string) { + const fakeBasePath = "https://contoso.com"; + const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); + assert.deepEqual(result, expected); + } + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a qualified path (${validParameters[i].dtmi})`, function() { + reformatTest(validParameters[i].dtmi, validParameters[i].url); + }); + } + }); + + describe("expanded url", function() { + function addExpandedTest(givenDtmi: string, expected: string) { + const fakeBasePath = "https://contoso.com"; + const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, true); + assert.deepEqual(result, expected); + } + + // eslint-disable-next-line mocha/no-setup-in-describe + for (let i = 0; i < validParameters.length; i++) { + it(`should reformat a DTMI to a qualified path with expanded.json (${validParameters[i].dtmi})`, function() { + addExpandedTest( + validParameters[i].dtmi, + validParameters[i].url.replace(".json", ".expanded.json") + ); + }); + } + }); + }); + }); +}); diff --git a/sdk/iotmodelsrepository/resolver-tool/test/node/index.spec.ts b/sdk/iotmodelsrepository/resolver-tool/test/node/index.spec.ts new file mode 100644 index 000000000000..ebf996843283 --- /dev/null +++ b/sdk/iotmodelsrepository/resolver-tool/test/node/index.spec.ts @@ -0,0 +1,455 @@ +/* eslint-disable no-undef */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import * as resolverTool from "../../src"; +import * as coreHttp from "@azure/core-http"; +import * as fs from "fs"; + +import { assert } from "chai"; +import * as sinon from "sinon"; + +import * as path from "path"; + +describe("resolver - node", function() { + afterEach(function() { + sinon.restore(); + }); + + describe("remote URL resolution", function() { + describe("simple DTDL resolution", function() { + it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; + const fakeEndpoint = "devicemodels.contoso.com"; + const expectedUri = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; + const fakeData = JSON.stringify({ + fakeDtdl: "fakeBodyAsText" + }); + sinon.stub(coreHttp, "ServiceClient").returns({ + sendRequest: function(req: any) { + assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint); + assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput: any) => { + assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); + done(); + }) + .catch((err: any) => done(err)); + }); + }); + + describe("depenency resolution (using pseudo-parsing)", function() { + it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; + const fakeEndpoint: string = "devicemodels.contoso.com"; + const expectedUri = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; + const fakeData = JSON.stringify({ + fakeKey: "fakeValue" + }); + sinon.stub(coreHttp, "ServiceClient").returns({ + sendRequest: function(req: any) { + assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { + resolveDependencies: "enabled" + }); + assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput: any) => { + assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); + done(); + }) + .catch((err: any) => done(err)); + }); + + it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { + const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const fakeEndpoint: string = "devicemodels.contoso.com"; + const expectedUri = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; + const expectedUri2 = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; + const expectedUri3 = + "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + ); + const fakeData = fs.readFileSync(pathToDtdl).toString(); + const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); + const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); + const expectedOutput = { + [fakeDtmi1]: JSON.parse(fakeData), + [fakeDtmi2]: JSON.parse(fakeData2), + [fakeDtmi3]: JSON.parse(fakeData3) + }; + const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); + serviceClientStub.onFirstCall().returns({ + sendRequest: function(req: any) { + assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + serviceClientStub.onSecondCall().returns({ + sendRequest: function(req: any) { + assert.deepEqual(req.url, expectedUri2, "URL not formatted for request correctly."); + return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); + } + }); + serviceClientStub.onThirdCall().returns({ + sendRequest: function(req: any) { + assert.deepEqual(req.url, expectedUri3, "URL not formatted for request correctly."); + return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); + } + }); + + const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { + resolveDependencies: "enabled" + }); + assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput: any) => { + assert.deepEqual( + Object.keys(actualOutput), + Object.keys(expectedOutput), + "dtmis in actual output do not align with expected output" + ); + assert.deepStrictEqual(expectedOutput, actualOutput); + done(); + }) + .catch((err: any) => done(err)); + }); + }); + + describe("try from expanded (expanded.json)", function() { + it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; + const fakeEndpoint = "devicemodels.contoso.com"; + const expectedUri = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json"; + const fakeData = `[${JSON.stringify({ + "@id": fakeDtmi, + fakeDtdl: "fakeBodyAsText" + })}]`; + sinon.stub(coreHttp, "ServiceClient").returns({ + sendRequest: function(req: any) { + assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + + const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { + resolveDependencies: "tryFromExpanded" + }); + assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput: any) => { + assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput); + done(); + }) + .catch((err: any) => done(err)); + }); + + it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { + const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const fakeEndpoint: string = "devicemodels.contoso.com"; + const expectedUri = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; + const expectedUri2 = + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; + const expectedUri3 = + "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + ); + const fakeData = fs.readFileSync(pathToDtdl).toString(); + const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); + const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); + const expectedOutput = { + [fakeDtmi1]: JSON.parse(fakeData), + [fakeDtmi2]: JSON.parse(fakeData2), + [fakeDtmi3]: JSON.parse(fakeData3) + }; + const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); + serviceClientStub.onCall(0).returns({ + sendRequest: function(req: any) { + assert.deepEqual( + req.url, + expectedUri.replace(".json", ".expanded.json"), + "URL not formatted for request correctly." + ); + return Promise.resolve({ status: 404 }); + } + }); + serviceClientStub.onCall(1).returns({ + sendRequest: function(req: any) { + assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); + return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + } + }); + serviceClientStub.onCall(2).returns({ + sendRequest: function(req: any) { + assert.deepEqual( + req.url, + expectedUri2.replace(".json", ".expanded.json"), + "URL not formatted for request correctly." + ); + return Promise.resolve({ status: 404 }); + } + }); + serviceClientStub.onCall(3).returns({ + sendRequest: function(req: any) { + assert.deepEqual(req.url, expectedUri2, "URL not formatted for request correctly."); + return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); + } + }); + serviceClientStub.onCall(4).returns({ + sendRequest: function(req: any) { + assert.deepEqual( + req.url, + expectedUri3.replace(".json", ".expanded.json"), + "URL not formatted for request correctly." + ); + return Promise.resolve({ status: 404 }); + } + }); + serviceClientStub.onCall(5).returns({ + sendRequest: function(req: any) { + assert.deepEqual(req.url, expectedUri3, "URL not formatted for request correctly."); + return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); + } + }); + + const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { + resolveDependencies: "tryFromExpanded" + }); + assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput: any) => { + assert.deepEqual( + Object.keys(actualOutput), + Object.keys(expectedOutput), + "dtmis in actual output do not align with expected output" + ); + assert.deepStrictEqual(expectedOutput, actualOutput); + done(); + }) + .catch((err: any) => done(err)); + }); + }); + }); + + describe("local file resolution", function() { + describe("simple DTDL resolution", function() { + it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + ); + const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, "utf-8")); + const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory); + assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput: any) => { + assert.deepStrictEqual( + { [fakeDtmi]: fakeDtdl }, + actualOutput, + "the expected dtmi mapping did not match the actual value." + ); + done(); + }) + .catch((err: any) => done(err)); + }); + }); + + describe("dependency resolution (using pseudo-parsing)", function() { + it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { + const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl1 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + ); + const pathToDtdl2 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + ); + const pathToDtdl3 = path.join( + localDirectory, + "dtmi/azure/DeviceManagement/deviceinformation-1.json" + ); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); + + const expectedOutput = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { + resolveDependencies: "enabled" + }); + assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput: any) => { + assert.deepStrictEqual( + Object.keys(actualOutput), + Object.keys(expectedOutput), + "dtmis do not match" + ); + Object.keys(actualOutput).forEach((outputDtmi) => { + assert.deepStrictEqual( + actualOutput[outputDtmi], + expectedOutput[outputDtmi], + `dtdls for given dtmi (${outputDtmi}) did not line up.` + ); + }); + assert.deepStrictEqual( + actualOutput, + expectedOutput, + "the expected dtmi mapping did not match the actual value." + ); + done(); + }) + .catch((err: any) => done(err)); + }); + + it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl1 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + ); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + + const expectedResult = { + [fakeDtmi1]: fakeDtdl1 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory); + assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput: any) => { + assert.deepStrictEqual( + expectedResult, + actualOutput, + "the expected dtmi mapping did not match the actual value." + ); + done(); + }) + .catch((err: any) => done(err)); + }); + }); + + describe("try from expanded (expanded.json)", function() { + it("should return a promise that resolves to a mapping from the DTMIs to the JSON objects", function(done) { + const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl1 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + ); + const pathToDtdl2 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + ); + const pathToDtdl3 = path.join( + localDirectory, + "dtmi/azure/DeviceManagement/deviceinformation-1.json" + ); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); + + const expectedResult = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { + resolveDependencies: "tryFromExpanded" + }); + assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput: any) => { + assert.deepStrictEqual( + expectedResult, + actualOutput, + "the expected dtmi mapping did not match the actual value." + ); + done(); + }) + .catch((err: any) => done(err)); + }); + + it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { + const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2"; + const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + const localDirectory = path.resolve("./test/node/testModelRepository"); + const pathToDtdl1 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json" + ); + const pathToDtdl2 = path.join( + localDirectory, + "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + ); + const pathToDtdl3 = path.join( + localDirectory, + "dtmi/azure/DeviceManagement/deviceinformation-1.json" + ); + const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); + const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); + + const expectedResult = { + [fakeDtmi1]: fakeDtdl1, + [fakeDtmi2]: fakeDtdl2, + [fakeDtmi3]: fakeDtdl3 + }; + const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { + resolveDependencies: "tryFromExpanded" + }); + assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + resolveResult + .then((actualOutput: any) => { + assert.deepEqual( + Object.keys(expectedResult), + Object.keys(actualOutput), + "the expected dtmis do not match" + ); + Object.keys(expectedResult).forEach((dtmiKey) => { + assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey]); + }); + done(); + }) + .catch((err: any) => done(err)); + }); + }); + }); +}); diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json similarity index 99% rename from sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json rename to sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json index 8a37e6d2c2c3..37e4a39138e8 100644 --- a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json +++ b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json @@ -61,4 +61,4 @@ "description": "Total available memory on the device in kilobytes. Ex. 256000 kilobytes." } ] -} \ No newline at end of file +} diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json similarity index 95% rename from sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json rename to sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json index 63a95a10463a..cde19984abb6 100644 --- a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json +++ b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json @@ -7,10 +7,7 @@ "description": "Device with two thermostats and remote reboot.", "contents": [ { - "@type": [ - "Telemetry", - "DataSize" - ], + "@type": ["Telemetry", "DataSize"], "name": "workingSet", "displayName": "Working Set", "description": "Current working set of the device memory in KiB.", @@ -67,10 +64,7 @@ "description": "Reports current temperature and provides desired temperature control.", "contents": [ { - "@type": [ - "Telemetry", - "Temperature" - ], + "@type": ["Telemetry", "Temperature"], "name": "temperature", "displayName": "Temperature", "description": "Temperature in degrees Celsius.", @@ -78,10 +72,7 @@ "unit": "degreeCelsius" }, { - "@type": [ - "Property", - "Temperature" - ], + "@type": ["Property", "Temperature"], "name": "targetTemperature", "schema": "double", "displayName": "Target Temperature", @@ -90,10 +81,7 @@ "writable": true }, { - "@type": [ - "Property", - "Temperature" - ], + "@type": ["Property", "Temperature"], "name": "maxTempSinceLastReboot", "schema": "double", "unit": "degreeCelsius", @@ -212,4 +200,4 @@ } ] } -] \ No newline at end of file +] diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json similarity index 96% rename from sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json rename to sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json index 2636a2f0f49f..1527a6dbe1ae 100644 --- a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json +++ b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json @@ -6,10 +6,7 @@ "description": "Device with two thermostats and remote reboot.", "contents": [ { - "@type": [ - "Telemetry", - "DataSize" - ], + "@type": ["Telemetry", "DataSize"], "name": "workingSet", "displayName": "Working Set", "description": "Current working set of the device memory in KiB.", @@ -57,4 +54,4 @@ "description": "Optional interface with basic device hardware information." } ] -} \ No newline at end of file +} diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json similarity index 96% rename from sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json rename to sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json index 18f31be8301a..32cbc7cfd588 100644 --- a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json +++ b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json @@ -6,10 +6,7 @@ "description": "Device with two thermostats and remote reboot.", "contents": [ { - "@type": [ - "Telemetry", - "DataSize" - ], + "@type": ["Telemetry", "DataSize"], "name": "workingSet", "displayName": "Working Set", "description": "Current working set of the device memory in KiB.", @@ -57,4 +54,4 @@ "description": "Optional interface with basic device hardware information." } ] -} \ No newline at end of file +} diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json similarity index 91% rename from sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json rename to sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json index d14174ced507..bae336740ac9 100644 --- a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json +++ b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json @@ -7,10 +7,7 @@ "description": "Reports current temperature and provides desired temperature control.", "contents": [ { - "@type": [ - "Telemetry", - "Temperature" - ], + "@type": ["Telemetry", "Temperature"], "name": "temperature", "displayName": "Temperature", "description": "Temperature in degrees Celsius.", @@ -18,10 +15,7 @@ "unit": "degreeCelsius" }, { - "@type": [ - "Property", - "Temperature" - ], + "@type": ["Property", "Temperature"], "name": "targetTemperature", "schema": "double", "displayName": "Target Temperature", @@ -30,10 +24,7 @@ "writable": true }, { - "@type": [ - "Property", - "Temperature" - ], + "@type": ["Property", "Temperature"], "name": "maxTempSinceLastReboot", "schema": "double", "unit": "degreeCelsius", @@ -88,4 +79,4 @@ } ] } -] \ No newline at end of file +] diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json similarity index 91% rename from sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json rename to sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json index b7747f86d707..7e902ab5b36f 100644 --- a/sdk/iotplugandplay/models-repo-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json +++ b/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json @@ -6,10 +6,7 @@ "description": "Reports current temperature and provides desired temperature control.", "contents": [ { - "@type": [ - "Telemetry", - "Temperature" - ], + "@type": ["Telemetry", "Temperature"], "name": "temperature", "displayName": "Temperature", "description": "Temperature in degrees Celsius.", @@ -17,10 +14,7 @@ "unit": "degreeCelsius" }, { - "@type": [ - "Property", - "Temperature" - ], + "@type": ["Property", "Temperature"], "name": "targetTemperature", "schema": "double", "displayName": "Target Temperature", @@ -29,10 +23,7 @@ "writable": true }, { - "@type": [ - "Property", - "Temperature" - ], + "@type": ["Property", "Temperature"], "name": "maxTempSinceLastReboot", "schema": "double", "unit": "degreeCelsius", @@ -86,4 +77,4 @@ } } ] -} \ No newline at end of file +} diff --git a/sdk/iotplugandplay/models-repo-tool/tsconfig.json b/sdk/iotmodelsrepository/resolver-tool/tsconfig.json similarity index 99% rename from sdk/iotplugandplay/models-repo-tool/tsconfig.json rename to sdk/iotmodelsrepository/resolver-tool/tsconfig.json index 53e0c1994f0d..1930ec602e17 100644 --- a/sdk/iotplugandplay/models-repo-tool/tsconfig.json +++ b/sdk/iotmodelsrepository/resolver-tool/tsconfig.json @@ -31,4 +31,4 @@ "dist-esm", "./samples/**/*.ts" ] -} \ No newline at end of file +} diff --git a/sdk/iotplugandplay/models-repo-tool/.eslintrc.json b/sdk/iotplugandplay/models-repo-tool/.eslintrc.json deleted file mode 100644 index dfdd7a770d20..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/.eslintrc.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "env": { - "browser": true, - "es6": true, - "node": true - }, - "extends": [ - "standard", - "plugin:mocha/recommended" - ], - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 2018, - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint", - "mocha" - ], - "rules": { - "no-redeclare": "off" - } -} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/.vscode/launch.json b/sdk/iotplugandplay/models-repo-tool/.vscode/launch.json deleted file mode 100644 index cd851651b12c..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/.vscode/launch.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch Program", - "program": "${workspaceFolder}/samples/javascript/example.js", - "request": "launch", - "skipFiles": [ - "/**" - ], - "console": "integratedTerminal", - "type": "pwa-node" - }, - { - "name": "temp-unit-test", - "request": "launch", - "runtimeArgs": [ - "run", - "temp-unit-test" - ], - "runtimeExecutable": "npm", - "skipFiles": [ - "/**" - ], - "console": "externalTerminal", - "type": "pwa-node" - }, - { - "type": "chrome", - "request": "attach", - "name": "Attach Karma Chrome", - "address": "localhost", - "port": 9876, - "pathMapping": { - "/": "${workspaceRoot}/", - "/base/": "${workspaceRoot}/" - } - }, - { - "type": "pwa-node", - "request": "launch", - "name": "Launch Test", - "skipFiles": [ - "/**" - ], - "program": "${workspaceFolder}\\test\\node\\index.spec.ts", - "preLaunchTask": "tsc: build - tsconfig.json", - "outFiles": [ - "${workspaceFolder}/out/**/*.js" - ] - } - ] -} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js b/sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js deleted file mode 100644 index a618f5894d01..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/out/src/dtmiConventions.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.dtmiToQualifiedPath = exports.dtmiToPath = exports.isValidDtmi = void 0; -function isValidDtmi(dtmi) { - if (dtmi) { - const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/; - return re.test(dtmi); // true if dtmi matches regular expression, false otherwise - } - return false; // if not a string return false. -} -exports.isValidDtmi = isValidDtmi; -function dtmiToPath(dtmi) { - // presently this dtmi to path function does not return the path with a - // file format at the end, i.e. does not append .json or .expanded.json. - // that happens in the dtmiToQualifiedPath function - if (isValidDtmi(dtmi)) { - return `${dtmi.toLowerCase().replace(/:/gm, '/').replace(/;/gm, '-')}.json`; - } - else { - throw new Error('DTMI provided is invalid. Ensure it follows DTMI conventions.'); - } -} -exports.dtmiToPath = dtmiToPath; -function ensureStartsWithProtocol(text) { - const re = /^http[s]?:\/\//; - if (text.search(re) !== -1) { - return text; - } - else { - return `https://${text}`; - } -} -function dtmiToQualifiedPath(dtmi, endpoint, isExpanded) { - const dtmiAsPath = dtmiToPath(dtmi); - const endpointWithSlash = endpoint.endsWith('/') ? endpoint : `${endpoint}/`; - const urlEndpoint = ensureStartsWithProtocol(endpointWithSlash); - if (isExpanded) { - return `${urlEndpoint}${dtmiAsPath.replace(/json$/, 'expanded.json')}`; - } - else { - return `${urlEndpoint}${dtmiAsPath}`; - } -} -exports.dtmiToQualifiedPath = dtmiToQualifiedPath; -//# sourceMappingURL=dtmiConventions.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js b/sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js deleted file mode 100644 index 0a6f2db269a3..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/out/src/localModelFetchers.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.recursiveFetcher = exports.fetcher = void 0; -const tslib_1 = require("tslib"); -const dtmiConventions = tslib_1.__importStar(require("./dtmiConventions")); -const modelMetadata = tslib_1.__importStar(require("./modelMetadata")); -const fs_1 = tslib_1.__importDefault(require("fs")); -const path = tslib_1.__importStar(require("path")); -const modelFetcherHelper_1 = require("./modelFetcherHelper"); -function recursiveFetcher(dtmi, directory, tryFromExpanded) { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - let dependencyModels = {}; - let fetchedModels; - try { - console.log(`Fetching: ${dtmi}`); - fetchedModels = yield fetcher(dtmi, directory, tryFromExpanded); - } - catch (error) { - if (tryFromExpanded && error.code === 'ENOENT') { - console.log('Fetching from expanded failed. Trying without.'); - fetchedModels = yield fetcher(dtmi, directory, false); - } - else { - throw error; - } - } - const dtmis = Object.keys(fetchedModels); - for (let i = 0; i < dtmis.length; i++) { - const currentDtdl = fetchedModels[dtmis[i]]; - const metaModelData = modelMetadata.getModelMetadata(currentDtdl); - const deps = metaModelData.componentSchemas.concat(metaModelData.extends); - if (deps && deps.length > 0) { - for (let j = 0; j < deps.length; j++) { - if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) { - // do nothing - } - else { - const fetchedDependencies = yield recursiveFetcher(deps[j], directory, tryFromExpanded); - dependencyModels = Object.assign(Object.assign({}, dependencyModels), fetchedDependencies); - } - } - } - } - if (Object.keys(dependencyModels).length > 0) { - fetchedModels = Object.assign(Object.assign({}, fetchedModels), dependencyModels); - } - return fetchedModels; - }); -} -exports.recursiveFetcher = recursiveFetcher; -function fetcher(dtmi, directory, tryFromExpanded) { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - const dtmiPath = dtmiConventions.dtmiToPath(dtmi); - const dtmiPathFormatted = tryFromExpanded ? dtmiPath.replace('.json', '.expanded.json') : dtmiPath; - const targetPath = path.join(directory, dtmiPathFormatted); - const dtdlFile = fs_1.default.readFileSync(targetPath, 'utf8'); - const parsedDtdl = JSON.parse(dtdlFile); - if (Array.isArray(parsedDtdl)) { - const result = modelFetcherHelper_1.flattenDtdlResponse(parsedDtdl); - return result; - } - else { - const result = { [dtmi]: parsedDtdl }; - return result; - } - }); -} -exports.fetcher = fetcher; -//# sourceMappingURL=localModelFetchers.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js b/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js deleted file mode 100644 index 25681acc29fe..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHandler.js +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.modelFetcher = void 0; -const tslib_1 = require("tslib"); -const fs = tslib_1.__importStar(require("fs")); -const url = tslib_1.__importStar(require("url")); -const localFetchers = tslib_1.__importStar(require("./localModelFetchers")); -const remoteFetchers = tslib_1.__importStar(require("./remoteModelFetchers")); -function isLocalPath(p) { - if (p.startsWith('https://') || p.startsWith('http://')) { - return false; - } - else if (p.startsWith('file://')) { - return true; - } - else { - try { - fs.accessSync(p); - return true; - } - catch (_a) { - return false; - } - } -} -function modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded) { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - if (isLocalPath(endpoint)) { - const formattedDirectory = endpoint.includes('file://') ? url.fileURLToPath(endpoint) : endpoint; - if (tryFromExpanded || resolveDependencies) { - return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded); - } - else { - console.log(`Fetching: ${dtmi}`); - return localFetchers.fetcher(dtmi, formattedDirectory, false); - } - } - else { - if (tryFromExpanded || resolveDependencies) { - return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded); - } - console.log(`Fetching: ${dtmi}`); - return remoteFetchers.fetcher(dtmi, endpoint, false); - } - }); -} -exports.modelFetcher = modelFetcher; -//# sourceMappingURL=modelFetcherHandler.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js b/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js deleted file mode 100644 index 2c01860ea205..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/out/src/modelFetcherHelper.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.flattenDtdlResponse = void 0; -function flattenDtdlResponse(input) { - const newResult = {}; - for (let i = 0; i++; i < input.length) { - const currentDtdl = input[i]; - if (!currentDtdl['@id']) { - throw new Error('no @id element found in DTDL. Ensure DTDL contains @id element'); - } - newResult[currentDtdl['@id']] = currentDtdl; - } - input.forEach((element) => { - newResult[element['@id']] = element; - }); - return newResult; -} -exports.flattenDtdlResponse = flattenDtdlResponse; -//# sourceMappingURL=modelFetcherHelper.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js b/sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js deleted file mode 100644 index 8301fdcfc43d..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/out/src/modelMetadata.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getModelMetadata = void 0; -function getId(input) { - const idElement = input['@id']; - return idElement; -} -function getExtends(input) { - const extendElement = input.extends; - return extendElement; -} -function getComponentSchemas(input) { - const componentSchemas = []; - if (input.contents) { - const contents = input.contents; - contents.forEach((element) => { - if (element['@type'] && - (typeof element['@type'] === 'string') && - (element['@type'] === 'Component')) { - if (element.schema && typeof element.schema === 'string') { - componentSchemas.push(element.schema); - } - } - }); - } - return componentSchemas; -} -function getModelMetadata(input) { - const idElement = getId(input); - const extendsElement = getExtends(input); - const componentSchemas = getComponentSchemas(input); - return { - id: idElement, - extends: extendsElement, - componentSchemas: componentSchemas - }; -} -exports.getModelMetadata = getModelMetadata; -//# sourceMappingURL=modelMetadata.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js b/sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js deleted file mode 100644 index a3befb5572ab..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/out/src/remoteModelFetchers.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.recursiveFetcher = exports.fetcher = void 0; -const tslib_1 = require("tslib"); -const dtmiConventions = tslib_1.__importStar(require("./dtmiConventions")); -const modelMetadata = tslib_1.__importStar(require("./modelMetadata")); -const coreHttp = tslib_1.__importStar(require("@azure/core-http")); -const modelFetcherHelper_1 = require("./modelFetcherHelper"); -function recursiveFetcher(dtmi, endpoint, tryFromExpanded) { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - let dependencyModels = {}; - let fetchedModels; - try { - console.log(`Fetching: ${dtmi}`); - fetchedModels = yield fetcher(dtmi, endpoint, tryFromExpanded); - } - catch (error) { - if (tryFromExpanded && (error.code === 'ENOENT' || !(error.statusCode >= 200 && error.statusCode < 400))) { - console.log('Fetching from expanded failed. Trying without.'); - console.log(`Fetching: ${dtmi}`); - fetchedModels = yield fetcher(dtmi, endpoint, false); - } - else { - throw error; - } - } - const dtmis = Object.keys(fetchedModels); - for (let i = 0; i < dtmis.length; i++) { - const currentDtdl = fetchedModels[dtmis[i]]; - const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas; - if (deps && deps.length > 0) { - for (let j = 0; j < deps.length; j++) { - if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) { - // do nothing - } - else { - const fetchedDependencies = yield recursiveFetcher(deps[j], endpoint, tryFromExpanded); - dependencyModels = Object.assign(Object.assign({}, dependencyModels), fetchedDependencies); - } - } - } - } - if (Object.keys(dependencyModels).length > 0) { - fetchedModels = Object.assign(Object.assign({}, fetchedModels), dependencyModels); - } - return fetchedModels; - }); -} -exports.recursiveFetcher = recursiveFetcher; -function fetcher(dtmi, endpoint, tryFromExpanded) { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - const client = new coreHttp.ServiceClient(); - const req = { - url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), - method: 'GET' - }; - const res = yield client.sendRequest(req); - if (res.status >= 200 && res.status < 400) { - const dtdlAsString = res.bodyAsText || ''; - const parsedDtdl = JSON.parse(dtdlAsString); - if (Array.isArray(parsedDtdl)) { - const result = modelFetcherHelper_1.flattenDtdlResponse(parsedDtdl); - return result; - } - else { - const result = { [dtmi]: parsedDtdl }; - return result; - } - } - else { - throw new coreHttp.RestError('Error on HTTP Request in remote model fetcher', '404', 404, undefined, res); - } - }); -} -exports.fetcher = fetcher; -//# sourceMappingURL=remoteModelFetchers.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/src/resolver.js b/sdk/iotplugandplay/models-repo-tool/out/src/resolver.js deleted file mode 100644 index e12e97ef4258..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/out/src/resolver.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.resolve = void 0; -const modelFetcherHandler_1 = require("./modelFetcherHandler"); -function checkIfTryFromExpanded(options) { - if (options && options.resolveDependencies && options.resolveDependencies === 'tryFromExpanded') { - return true; - } - return false; -} -function checkIfResolveDependencies(options) { - if (options && options.resolveDependencies && options.resolveDependencies === 'enabled') { - return true; - } - return false; -} -function resolve(dtmi, endpoint, options) { - const tryFromExpanded = checkIfTryFromExpanded(options); - const resolveDependencies = checkIfResolveDependencies(options); - return modelFetcherHandler_1.modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded); -} -exports.resolve = resolve; -//# sourceMappingURL=resolver.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js b/sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js deleted file mode 100644 index aeba11e8ad3b..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/out/test/browser/browserTest.spec.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const lib = tslib_1.__importStar(require("../../src")); -const chai_1 = require("chai"); -const sinon = tslib_1.__importStar(require("sinon")); -describe('resolver - browser', () => { - afterEach(() => { - sinon.restore(); - }); - describe('single resolution (no pseudo-parsing)', () => { - it.only('integration works in browser', function (done) { - const dtmi = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; - const endpoint = 'https://devicemodels.azure.com'; - const fakeData = JSON.stringify({ - fakeDtdl: 'fakeBodyAsText' - }); - const resolveResult = lib.resolve(dtmi, endpoint); - resolveResult.then((actualOutput) => { - chai_1.assert.deepStrictEqual({ [dtmi]: JSON.parse(fakeData) }, actualOutput); - done(); - }).catch((err) => done(err)); - }); - }); -}); -//# sourceMappingURL=browserTest.spec.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js b/sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js deleted file mode 100644 index c2811e351f9b..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/out/test/node/dtmiConventions.spec.js +++ /dev/null @@ -1,146 +0,0 @@ -"use strict"; -/* eslint-disable no-undef */ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const lib = tslib_1.__importStar(require("../../src/dtmiConventions")); -// fake class while lib not implemented -const sinon = tslib_1.__importStar(require("sinon")); -const chai_1 = require("chai"); -const validParameters = [ - { - dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;1', - path: 'dtmi/azure/devicemanagement/deviceinformation-1.json', - url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json' - }, - { - dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;10000', - path: 'dtmi/azure/devicemanagement/deviceinformation-10000.json', - url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-10000.json' - }, - { - dtmi: 'dtmi:com:DeviceInformation;1', - path: 'dtmi/com/deviceinformation-1.json', - url: 'https://contoso.com/dtmi/com/deviceinformation-1.json' - }, - { - dtmi: 'dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1', - path: 'dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json', - url: 'https://contoso.com/dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json' - }, - { - dtmi: 'dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7', - path: 'dtmi/azure/devicemanagement/thermometer-7.json', - url: 'https://contoso.com/dtmi/azure/devicemanagement/thermometer-7.json' - }, - { - dtmi: 'dtmi:thermometer;2', - path: 'dtmi/thermometer-2.json', - url: 'https://contoso.com/dtmi/thermometer-2.json' - } -]; -const invalidParameters = [ - { dtmi: 'dtmiazure:DeviceManagement:DeviceInformation;1' }, - { dtmi: 'dtmi;azure;DeviceManagement;DeviceInformation;1' }, - { dtmi: 'asdf' }, - { dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;-1' }, - { dtmi: 'dtmi:azure:DeviceManagement:Device-Information;1' }, - { dtmi: 'DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7' }, - { dtmi: 'dmti:azure:thermometer;10' } -]; -describe('dtmiConventions', function () { - afterEach(function () { - sinon.restore(); - }); - describe('isValidDtmi', function () { - describe('valid', function () { - function validTest(givenDtmi) { - const result = lib.isValidDtmi(givenDtmi); - chai_1.assert(result, 'valid dtmi not found as valid'); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should validate a correctly formatted dtmi (${validParameters[i].dtmi})`, function () { validTest(validParameters[i].dtmi); }); - } - }); - describe('invalid', function () { - function invalidTest(givenDtmi) { - const result = lib.isValidDtmi(givenDtmi); - chai_1.assert(!result, 'invalid dtmi incorrectly labelled as valid'); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should invalidate incorrectly formatted dtmi (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi); }); - } - }); - }); - describe('dtmiToPath', function () { - describe('valid', function () { - function validTest(givenDtmi, expectedPath) { - const result = lib.dtmiToPath(givenDtmi); - chai_1.assert.deepEqual(result, expectedPath); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a generic path (${validParameters[i].dtmi})`, function () { - validTest(validParameters[i].dtmi, validParameters[i].path); - }); - } - }); - describe('invalid', function () { - function invalidTest(givenDtmi) { - chai_1.expect(() => { - lib.dtmiToPath(givenDtmi); - }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.'); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi); }); - } - }); - }); - describe('dtmiToFullyQualifiedPath', function () { - describe('invalid', function () { - function invalidTest(givenDtmi) { - chai_1.expect(() => { - const fakeBasePath = 'https://contoso.com'; - lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); - }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.'); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi); }); - } - }); - describe('valid', function () { - describe('standard url', function () { - function reformatTest(givenDtmi, expected) { - const fakeBasePath = 'https://contoso.com'; - const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); - chai_1.assert.deepEqual(result, expected); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a qualified path (${validParameters[i].dtmi})`, function () { - reformatTest(validParameters[i].dtmi, validParameters[i].url); - }); - } - }); - describe('expanded url', function () { - function addExpandedTest(givenDtmi, expected) { - const fakeBasePath = 'https://contoso.com'; - const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, true); - chai_1.assert.deepEqual(result, expected); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a qualified path with expanded.json (${validParameters[i].dtmi})`, function () { - addExpandedTest(validParameters[i].dtmi, validParameters[i].url.replace('.json', '.expanded.json')); - }); - } - }); - }); - }); -}); -//# sourceMappingURL=dtmiConventions.spec.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js b/sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js deleted file mode 100644 index ea0d44022486..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/out/test/node/index.spec.js +++ /dev/null @@ -1,301 +0,0 @@ -"use strict"; -/* eslint-disable no-undef */ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const resolverTool = tslib_1.__importStar(require("../../src")); -const coreHttp = tslib_1.__importStar(require("@azure/core-http")); -const fs = tslib_1.__importStar(require("fs")); -const chai_1 = require("chai"); -const sinon = tslib_1.__importStar(require("sinon")); -const path = tslib_1.__importStar(require("path")); -describe('resolver - node', function () { - afterEach(function () { - sinon.restore(); - }); - describe('remote URL resolution', function () { - describe('simple DTDL resolution', function () { - it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { - const fakeDtmi = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'; - const fakeEndpoint = 'devicemodels.contoso.com'; - const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json'; - const fakeData = JSON.stringify({ - fakeDtdl: 'fakeBodyAsText' - }); - sinon.stub(coreHttp, 'ServiceClient') - .returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.'); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint); - chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); - resolveResult.then((actualOutput) => { - chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); - done(); - }).catch((err) => done(err)); - }); - }); - describe('depenency resolution (using pseudo-parsing)', function () { - it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { - const fakeDtmi = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'; - const fakeEndpoint = 'devicemodels.contoso.com'; - const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json'; - const fakeData = JSON.stringify({ - fakeKey: 'fakeValue' - }); - sinon.stub(coreHttp, 'ServiceClient') - .returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.'); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'enabled' }); - chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); - resolveResult.then((actualOutput) => { - chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); - done(); - }).catch((err) => done(err)); - }); - it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) { - const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'; - const fakeDtmi2 = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'; - const fakeDtmi3 = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; - const fakeEndpoint = 'devicemodels.contoso.com'; - const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json'; - const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json'; - const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json'; - const localDirectory = path.resolve('./test/node/testModelRepository'); - const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json'); - const fakeData = fs.readFileSync(pathToDtdl).toString(); - const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' }); - const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' }); - const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) }; - const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient'); - serviceClientStub.onFirstCall().returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.'); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - serviceClientStub.onSecondCall().returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.'); - return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); - } - }); - serviceClientStub.onThirdCall().returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.'); - return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'enabled' }); - chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); - resolveResult.then((actualOutput) => { - chai_1.assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output'); - chai_1.assert.deepStrictEqual(expectedOutput, actualOutput); - done(); - }).catch((err) => done(err)); - }); - }); - describe('try from expanded (expanded.json)', function () { - it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { - const fakeDtmi = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'; - const fakeEndpoint = 'devicemodels.contoso.com'; - const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json'; - const fakeData = `[${JSON.stringify({ - '@id': fakeDtmi, - fakeDtdl: 'fakeBodyAsText' - })}]`; - sinon.stub(coreHttp, 'ServiceClient') - .returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.'); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' }); - chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); - resolveResult.then((actualOutput) => { - chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput); - done(); - }).catch((err) => done(err)); - }); - it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) { - const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'; - const fakeDtmi2 = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'; - const fakeDtmi3 = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; - const fakeEndpoint = 'devicemodels.contoso.com'; - const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json'; - const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json'; - const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json'; - const localDirectory = path.resolve('./test/node/testModelRepository'); - const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json'); - const fakeData = fs.readFileSync(pathToDtdl).toString(); - const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' }); - const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' }); - const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) }; - const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient'); - serviceClientStub.onCall(0).returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.'); - return Promise.resolve({ status: 404 }); - } - }); - serviceClientStub.onCall(1).returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.'); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - serviceClientStub.onCall(2).returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri2.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.'); - return Promise.resolve({ status: 404 }); - } - }); - serviceClientStub.onCall(3).returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.'); - return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); - } - }); - serviceClientStub.onCall(4).returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri3.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.'); - return Promise.resolve({ status: 404 }); - } - }); - serviceClientStub.onCall(5).returns({ - sendRequest: function (req) { - chai_1.assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.'); - return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' }); - chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); - resolveResult.then((actualOutput) => { - chai_1.assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output'); - chai_1.assert.deepStrictEqual(expectedOutput, actualOutput); - done(); - }).catch((err) => done(err)); - }); - }); - }); - describe('local file resolution', function () { - describe('simple DTDL resolution', function () { - it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { - const fakeDtmi = 'dtmi:contoso:FakeDeviceManagement:thermostat;1'; - const localDirectory = path.resolve('./test/node/testModelRepository'); - const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json'); - const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, 'utf-8')); - const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory); - chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); - resolveResult.then((actualOutput) => { - chai_1.assert.deepStrictEqual({ [fakeDtmi]: fakeDtdl }, actualOutput, 'the expected dtmi mapping did not match the actual value.'); - done(); - }).catch((err) => done(err)); - }); - }); - describe('dependency resolution (using pseudo-parsing)', function () { - it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) { - const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'; - const fakeDtmi2 = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'; - const fakeDtmi3 = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; - const localDirectory = path.resolve('./test/node/testModelRepository'); - const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json'); - const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json'); - const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json'); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')); - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')); - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')); - const expectedOutput = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'enabled' }); - chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); - resolveResult.then((actualOutput) => { - chai_1.assert.deepStrictEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis do not match'); - Object.keys(actualOutput).forEach((outputDtmi) => { - chai_1.assert.deepStrictEqual(actualOutput[outputDtmi], expectedOutput[outputDtmi], `dtdls for given dtmi (${outputDtmi}) did not line up.`); - }); - chai_1.assert.deepStrictEqual(actualOutput, expectedOutput, 'the expected dtmi mapping did not match the actual value.'); - done(); - }).catch((err) => done(err)); - }); - it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { - const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:thermostat;1'; - const localDirectory = path.resolve('./test/node/testModelRepository'); - const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json'); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')); - const expectedResult = { - [fakeDtmi1]: fakeDtdl1 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory); - chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); - resolveResult.then((actualOutput) => { - chai_1.assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.'); - done(); - }).catch((err) => done(err)); - }); - }); - describe('try from expanded (expanded.json)', function () { - it('should return a promise that resolves to a mapping from the DTMIs to the JSON objects', function (done) { - const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'; - const fakeDtmi2 = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'; - const fakeDtmi3 = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; - const localDirectory = path.resolve('./test/node/testModelRepository'); - const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json'); - const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json'); - const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json'); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')); - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')); - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')); - const expectedResult = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' }); - chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); - resolveResult.then((actualOutput) => { - chai_1.assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.'); - done(); - }).catch((err) => done(err)); - }); - it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) { - const fakeDtmi1 = 'dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2'; - const fakeDtmi2 = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'; - const fakeDtmi3 = 'dtmi:azure:DeviceManagement:DeviceInformation;1'; - const localDirectory = path.resolve('./test/node/testModelRepository'); - const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json'); - const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json'); - const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json'); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')); - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')); - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')); - const expectedResult = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' }); - chai_1.assert(resolveResult instanceof Promise, 'resolve method did not return a promise'); - resolveResult.then((actualOutput) => { - chai_1.assert.deepEqual(Object.keys(expectedResult), Object.keys(actualOutput), 'the expected dtmis do not match'); - Object.keys(expectedResult).forEach(dtmiKey => { - chai_1.assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey]); - }); - done(); - }).catch((err) => done(err)); - }); - }); - }); -}); -//# sourceMappingURL=index.spec.js.map \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/rollup.config.js b/sdk/iotplugandplay/models-repo-tool/rollup.config.js deleted file mode 100644 index cf168cc1d7a7..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/rollup.config.js +++ /dev/null @@ -1,11 +0,0 @@ -import resolve from '@rollup/plugin-node-resolve' -import auto from '@rollup/plugin-auto-install' - -export default { - input: 'dist-esm/index.js', - output: { - file: 'bundle.js', - format: 'cjs' - }, - plugins: [ auto(), resolve()], -} \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/samples/javascript/package.json b/sdk/iotplugandplay/models-repo-tool/samples/javascript/package.json deleted file mode 100644 index 96c88131e8a9..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/samples/javascript/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "azure-modelsrepository-samples-js", - "private": true, - "version": "0.1.0", - "description": "Azure models repository client library samples for JavaScript", - "engine": { - "node": ">=8.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/template/template" - }, - "keywords": [ - "Azure", - "Node.js", - "JavaScript" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template", - "sideEffects": false, - "dependencies": { - "@azure/template": "latest", - "dotenv": "^8.2.0" - } - } \ No newline at end of file diff --git a/sdk/iotplugandplay/models-repo-tool/samples/typescript/src/example.ts b/sdk/iotplugandplay/models-repo-tool/samples/typescript/src/example.ts deleted file mode 100644 index ee2bfb362869..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/samples/typescript/src/example.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -/** - * Demonstrates resolving/obtaining a particular model definition from a remote model repository - */ - -import * as resolver from '@azure/iot-modelsrepository-resolver' - -const repositoryEndpoint = 'devicemodels.azure.com' -const dtmi = process.argv[2] || 'dtmi:azure:DeviceManagement:DeviceInformation;1' - -console.log(repositoryEndpoint, dtmi) - -async function main () { - const result = await resolver.resolve(dtmi, repositoryEndpoint) - console.log(result) -} - -main().catch((err) => { - console.error('The sample encountered an error:', err) -}) diff --git a/sdk/iotplugandplay/models-repo-tool/src/dtmiConventions.ts b/sdk/iotplugandplay/models-repo-tool/src/dtmiConventions.ts deleted file mode 100644 index c58e23dc4eff..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/src/dtmiConventions.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -'use strict' - -export function isValidDtmi (dtmi: string) { - if (dtmi) { - const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/ - return re.test(dtmi) // true if dtmi matches regular expression, false otherwise - } - return false // if not a string return false. -} - -export function dtmiToPath (dtmi: string) { - // presently this dtmi to path function does not return the path with a - // file format at the end, i.e. does not append .json or .expanded.json. - // that happens in the dtmiToQualifiedPath function - - if (isValidDtmi(dtmi)) { - return `${dtmi.toLowerCase().replace(/:/gm, '/').replace(/;/gm, '-')}.json` - } else { - throw new Error('DTMI provided is invalid. Ensure it follows DTMI conventions.') - } -} - -function ensureStartsWithProtocol (text: string) { - const re = /^http[s]?:\/\// - if (text.search(re) !== -1) { - return text - } else { - return `https://${text}` - } -} - -export function dtmiToQualifiedPath (dtmi: string, endpoint: string, isExpanded ?: boolean) { - const dtmiAsPath = dtmiToPath(dtmi) - const endpointWithSlash = endpoint.endsWith('/') ? endpoint : `${endpoint}/` - const urlEndpoint = ensureStartsWithProtocol(endpointWithSlash) - if (isExpanded) { - return `${urlEndpoint}${dtmiAsPath.replace(/json$/, 'expanded.json')}` - } else { - return `${urlEndpoint}${dtmiAsPath}` - } -} diff --git a/sdk/iotplugandplay/models-repo-tool/src/localModelFetchers.ts b/sdk/iotplugandplay/models-repo-tool/src/localModelFetchers.ts deleted file mode 100644 index 2b7f5d4e206a..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/src/localModelFetchers.ts +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -'use strict' - -import * as dtmiConventions from './dtmiConventions' -import * as modelMetadata from './modelMetadata' -import { DTDL } from './DTDL' -import fs from 'fs' -import * as path from 'path' -import { flattenDtdlResponse } from './modelFetcherHelper' - -async function recursiveFetcher (dtmi: string, directory: string, tryFromExpanded: boolean): Promise<{[x:string]: DTDL}> { - let dependencyModels: {[x:string]: DTDL} = {} - let fetchedModels: {[x: string]: DTDL } - try { - console.log(`Fetching: ${dtmi}`) - fetchedModels = await fetcher(dtmi, directory, tryFromExpanded) - } catch (error) { - if (tryFromExpanded && error.code === 'ENOENT') { - console.log('Fetching from expanded failed. Trying without.') - fetchedModels = await fetcher(dtmi, directory, false) - } else { - throw error - } - } - const dtmis = Object.keys(fetchedModels) - for (let i = 0; i < dtmis.length; i++) { - const currentDtdl = fetchedModels[dtmis[i]] - const metaModelData = modelMetadata.getModelMetadata(currentDtdl) - const deps = metaModelData.componentSchemas.concat(metaModelData.extends) - if (deps && deps.length > 0) { - for (let j = 0; j < deps.length; j++) { - if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) { - // do nothing - } else { - const fetchedDependencies = await recursiveFetcher(deps[j], directory, tryFromExpanded) - dependencyModels = { ...dependencyModels, ...fetchedDependencies } - } - } - } - } - if (Object.keys(dependencyModels).length > 0) { - fetchedModels = { ...fetchedModels, ...dependencyModels } - } - return fetchedModels -} - -async function fetcher (dtmi: string, directory: string, tryFromExpanded: boolean): Promise<{ [dtmi: string]: DTDL }> { - const dtmiPath = dtmiConventions.dtmiToPath(dtmi) - const dtmiPathFormatted = tryFromExpanded ? dtmiPath.replace('.json', '.expanded.json') : dtmiPath - const targetPath = path.join(directory, dtmiPathFormatted) - const dtdlFile = fs.readFileSync(targetPath, 'utf8') - const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile) - if (Array.isArray(parsedDtdl)) { - const result = flattenDtdlResponse(parsedDtdl as DTDL[]) - return result - } else { - const result = { [dtmi]: parsedDtdl as DTDL } - return result - } -} - -export { fetcher, recursiveFetcher } diff --git a/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHandler.ts b/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHandler.ts deleted file mode 100644 index 1172128a9408..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHandler.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -'use strict' - -import * as fs from 'fs' -import * as url from 'url' -import * as localFetchers from './localModelFetchers' -import * as remoteFetchers from './remoteModelFetchers' - -function isLocalPath (p: string): boolean { - if (p.startsWith('https://') || p.startsWith('http://')) { - return false - } else if (p.startsWith('file://')) { - return true - } else { - try { - fs.accessSync(p) - return true - } catch { - return false - } - } -} - -export async function modelFetcher (dtmi: string, endpoint: string, resolveDependencies: boolean, tryFromExpanded: boolean): Promise<{ [dtmi: string]: JSON | Array }> { - if (isLocalPath(endpoint)) { - const formattedDirectory = endpoint.includes('file://') ? url.fileURLToPath(endpoint) : endpoint - if (tryFromExpanded || resolveDependencies) { - return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded) - } else { - console.log(`Fetching: ${dtmi}`) - return localFetchers.fetcher(dtmi, formattedDirectory, false) - } - } else { - if (tryFromExpanded || resolveDependencies) { - return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded) - } - console.log(`Fetching: ${dtmi}`) - return remoteFetchers.fetcher(dtmi, endpoint, false) - } -} diff --git a/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHelper.ts b/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHelper.ts deleted file mode 100644 index 9dd52db046f5..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/src/modelFetcherHelper.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -'use strict' - -import { DTDL } from './DTDL' - -export function flattenDtdlResponse (input: DTDL[]) { - const newResult: {[x: string]: DTDL} = {} - for (let i = 0; i++; i < input.length) { - const currentDtdl = input[i] - if (!currentDtdl['@id']) { - throw new Error('no @id element found in DTDL. Ensure DTDL contains @id element'); - } - newResult[currentDtdl['@id']] = currentDtdl - } - input.forEach((element: DTDL) => { - newResult[element['@id']] = element - }) - return newResult -} diff --git a/sdk/iotplugandplay/models-repo-tool/src/modelMetadata.ts b/sdk/iotplugandplay/models-repo-tool/src/modelMetadata.ts deleted file mode 100644 index fa8dccd832e8..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/src/modelMetadata.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -'use strict' - -import { DTDL } from './DTDL' - -function getId (input: DTDL): string { - const idElement = input['@id'] - return idElement -} - -function getExtends (input: DTDL): string { - const extendElement = input.extends - return extendElement -} - -function getComponentSchemas (input: DTDL): string[] { - const componentSchemas: string[] = [] - if (input.contents) { - const contents = input.contents - contents.forEach((element) => { - if (element['@type'] && - (typeof element['@type'] === 'string') && - (element['@type'] === 'Component')) { - if (element.schema && typeof element.schema === 'string') { - componentSchemas.push(element.schema) - } - } - }) - } - return componentSchemas -} - -export function getModelMetadata (input: DTDL) { - const idElement: string = getId(input) - const extendsElement: string = getExtends(input) - const componentSchemas: string[] = getComponentSchemas(input) - return { - id: idElement, - extends: extendsElement, - componentSchemas: componentSchemas - } -} diff --git a/sdk/iotplugandplay/models-repo-tool/src/remoteModelFetchers.ts b/sdk/iotplugandplay/models-repo-tool/src/remoteModelFetchers.ts deleted file mode 100644 index 964d372dd162..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/src/remoteModelFetchers.ts +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -'use strict' - -import * as dtmiConventions from './dtmiConventions' -import * as modelMetadata from './modelMetadata' -import * as coreHttp from '@azure/core-http' -import { DTDL } from './DTDL' -import { flattenDtdlResponse } from './modelFetcherHelper' - -async function recursiveFetcher (dtmi: string, endpoint: string, tryFromExpanded: boolean): Promise<{[dtmi: string]: DTDL }> { - let dependencyModels: {[x:string]: DTDL} = {} - let fetchedModels: {[x: string]: DTDL } - try { - console.log(`Fetching: ${dtmi}`) - fetchedModels = await fetcher(dtmi, endpoint, tryFromExpanded) - } catch (error) { - if (tryFromExpanded && (error.code === 'ENOENT' || !(error.statusCode >= 200 && error.statusCode < 400))) { - console.log('Fetching from expanded failed. Trying without.') - console.log(`Fetching: ${dtmi}`) - fetchedModels = await fetcher(dtmi, endpoint, false) - } else { - throw error - } - } - const dtmis = Object.keys(fetchedModels) - for (let i = 0; i < dtmis.length; i++) { - const currentDtdl = fetchedModels[dtmis[i]] - const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas - if (deps && deps.length > 0) { - for (let j = 0; j < deps.length; j++) { - if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) { - // do nothing - } else { - const fetchedDependencies = await recursiveFetcher(deps[j], endpoint, tryFromExpanded) - dependencyModels = { ...dependencyModels, ...fetchedDependencies } - } - } - } - } - if (Object.keys(dependencyModels).length > 0) { - fetchedModels = { ...fetchedModels, ...dependencyModels } - } - return fetchedModels -} - -async function fetcher (dtmi: string, endpoint: string, tryFromExpanded: boolean): Promise<{[dtmi: string]: any }> { - const client = new coreHttp.ServiceClient() - const req: coreHttp.RequestPrepareOptions = { - url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), - method: 'GET' - } - const res: coreHttp.HttpOperationResponse = await client.sendRequest(req) - if (res.status >= 200 && res.status < 400) { - const dtdlAsString = res.bodyAsText || '' - const parsedDtdl = JSON.parse(dtdlAsString) - if (Array.isArray(parsedDtdl)) { - const result = flattenDtdlResponse(parsedDtdl as DTDL[]) - return result - } else { - const result = { [dtmi]: parsedDtdl as DTDL } - return result - } - } else { - throw new coreHttp.RestError('Error on HTTP Request in remote model fetcher', '404', 404, undefined, res) - } -} - -export { fetcher, recursiveFetcher } diff --git a/sdk/iotplugandplay/models-repo-tool/test/browser/browserTest.spec.ts b/sdk/iotplugandplay/models-repo-tool/test/browser/browserTest.spec.ts deleted file mode 100644 index a4df921d495e..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/test/browser/browserTest.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import * as lib from '../../src' - -import { assert } from 'chai' -import * as sinon from 'sinon' - -describe('resolver - browser', () => { - afterEach(() => { - sinon.restore() - }) - - describe('single resolution (no pseudo-parsing)', () => { - it.only('integration works in browser', function (done) { - const dtmi: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' - const endpoint = 'https://devicemodels.azure.com' - const fakeData = JSON.stringify({ - fakeDtdl: 'fakeBodyAsText' - }) - const resolveResult = lib.resolve(dtmi, endpoint) - resolveResult.then((actualOutput: any) => { - assert.deepStrictEqual({ [dtmi]: JSON.parse(fakeData) }, actualOutput) - done() - }).catch((err: any) => done(err)) - }) - }) -}) diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/dtmiConventions.spec.ts b/sdk/iotplugandplay/models-repo-tool/test/node/dtmiConventions.spec.ts deleted file mode 100644 index 40bd92a6df8e..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/test/node/dtmiConventions.spec.ts +++ /dev/null @@ -1,165 +0,0 @@ -/* eslint-disable no-undef */ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import * as lib from '../../src/dtmiConventions' - -// fake class while lib not implemented -import * as sinon from 'sinon' -import { assert, expect } from 'chai' - -interface ValidParams { - dtmi: string, - path: string, - url: string -} - -const validParameters: ValidParams[] = [ - { - dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;1', - path: 'dtmi/azure/devicemanagement/deviceinformation-1.json', - url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json' - }, - { - dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;10000', - path: 'dtmi/azure/devicemanagement/deviceinformation-10000.json', - url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-10000.json' - }, - { - dtmi: 'dtmi:com:DeviceInformation;1', - path: 'dtmi/com/deviceinformation-1.json', - url: 'https://contoso.com/dtmi/com/deviceinformation-1.json' - }, - { - dtmi: 'dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1', - path: 'dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json', - url: 'https://contoso.com/dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json' - }, - { - dtmi: 'dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7', - path: 'dtmi/azure/devicemanagement/thermometer-7.json', - url: 'https://contoso.com/dtmi/azure/devicemanagement/thermometer-7.json' - }, - { - dtmi: 'dtmi:thermometer;2', - path: 'dtmi/thermometer-2.json', - url: 'https://contoso.com/dtmi/thermometer-2.json' - } - -] - -const invalidParameters: {dtmi: string}[] = [ - { dtmi: 'dtmiazure:DeviceManagement:DeviceInformation;1' }, - { dtmi: 'dtmi;azure;DeviceManagement;DeviceInformation;1' }, - { dtmi: 'asdf' }, - { dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;-1' }, - { dtmi: 'dtmi:azure:DeviceManagement:Device-Information;1' }, - { dtmi: 'DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7' }, - { dtmi: 'dmti:azure:thermometer;10' } -] - -describe('dtmiConventions', function () { - afterEach(function () { - sinon.restore() - }) - - describe('isValidDtmi', function () { - describe('valid', function () { - function validTest (givenDtmi: string) { - const result = lib.isValidDtmi(givenDtmi) - assert(result, 'valid dtmi not found as valid') - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should validate a correctly formatted dtmi (${validParameters[i].dtmi})`, function () { validTest(validParameters[i].dtmi) }) - } - }) - - describe('invalid', function () { - function invalidTest (givenDtmi: string) { - const result = lib.isValidDtmi(givenDtmi) - assert(!result, 'invalid dtmi incorrectly labelled as valid') - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should invalidate incorrectly formatted dtmi (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) }) - } - }) - }) - - describe('dtmiToPath', function () { - describe('valid', function () { - function validTest (givenDtmi: string, expectedPath: string) { - const result = lib.dtmiToPath(givenDtmi) - assert.deepEqual(result, expectedPath) - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a generic path (${validParameters[i].dtmi})`, - function () { - validTest(validParameters[i].dtmi, validParameters[i].path) - }) - } - }) - - describe('invalid', function () { - function invalidTest (givenDtmi: string) { - expect(() => { - lib.dtmiToPath(givenDtmi) - }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.') - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) }) - } - }) - }) - - describe('dtmiToFullyQualifiedPath', function () { - describe('invalid', function () { - function invalidTest (givenDtmi: string) { - expect(() => { - const fakeBasePath = 'https://contoso.com' - lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false) - }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.') - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) }) - } - }) - - describe('valid', function () { - describe('standard url', function () { - function reformatTest (givenDtmi: string, expected: string) { - const fakeBasePath = 'https://contoso.com' - const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false) - assert.deepEqual(result, expected) - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a qualified path (${validParameters[i].dtmi})`, - function () { - reformatTest(validParameters[i].dtmi, validParameters[i].url) - }) - } - }) - - describe('expanded url', function () { - function addExpandedTest (givenDtmi: string, expected: string) { - const fakeBasePath = 'https://contoso.com' - const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, true) - assert.deepEqual(result, expected) - } - - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a qualified path with expanded.json (${validParameters[i].dtmi})`, - function () { - addExpandedTest(validParameters[i].dtmi, validParameters[i].url.replace('.json', '.expanded.json')) - }) - } - }) - }) - }) -}) diff --git a/sdk/iotplugandplay/models-repo-tool/test/node/index.spec.ts b/sdk/iotplugandplay/models-repo-tool/test/node/index.spec.ts deleted file mode 100644 index 1d18f4acc993..000000000000 --- a/sdk/iotplugandplay/models-repo-tool/test/node/index.spec.ts +++ /dev/null @@ -1,320 +0,0 @@ -/* eslint-disable no-undef */ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import * as resolverTool from '../../src' -import * as coreHttp from '@azure/core-http' -import * as fs from 'fs' - -import { assert } from 'chai' -import * as sinon from 'sinon' - -import * as path from 'path' - -describe('resolver - node', function () { - afterEach(function () { - sinon.restore() - }) - - describe('remote URL resolution', function () { - describe('simple DTDL resolution', function () { - it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { - const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1' - const fakeEndpoint = 'devicemodels.contoso.com' - const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json' - const fakeData = JSON.stringify({ - fakeDtdl: 'fakeBodyAsText' - }) - sinon.stub(coreHttp, 'ServiceClient') - .returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.') - return Promise.resolve({ bodyAsText: fakeData, status: 200 }) - } - }) - - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint) - assert(resolveResult instanceof Promise, 'resolve method did not return a promise') - resolveResult.then((actualOutput: any) => { - assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput) - done() - }).catch((err: any) => done(err)) - }) - }) - - describe('depenency resolution (using pseudo-parsing)', function () { - it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { - const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1' - const fakeEndpoint: string = 'devicemodels.contoso.com' - const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json' - const fakeData = JSON.stringify({ - fakeKey: 'fakeValue' - }) - sinon.stub(coreHttp, 'ServiceClient') - .returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.') - return Promise.resolve({ bodyAsText: fakeData, status: 200 }) - } - }) - - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'enabled' }) - assert(resolveResult instanceof Promise, 'resolve method did not return a promise') - resolveResult.then((actualOutput: any) => { - assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput) - done() - }).catch((err: any) => done(err)) - }) - - it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) { - const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1' - const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1' - const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' - const fakeEndpoint: string = 'devicemodels.contoso.com' - const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json' - const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json' - const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json' - const localDirectory = path.resolve('./test/node/testModelRepository') - const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json') - const fakeData = fs.readFileSync(pathToDtdl).toString() - const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' }) - const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' }) - const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) } - const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient') - serviceClientStub.onFirstCall().returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.') - return Promise.resolve({ bodyAsText: fakeData, status: 200 }) - } - }) - serviceClientStub.onSecondCall().returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.') - return Promise.resolve({ bodyAsText: fakeData2, status: 200 }) - } - }) - serviceClientStub.onThirdCall().returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.') - return Promise.resolve({ bodyAsText: fakeData3, status: 200 }) - } - }) - - const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'enabled' }) - assert(resolveResult instanceof Promise, 'resolve method did not return a promise') - resolveResult.then((actualOutput: any) => { - assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output') - assert.deepStrictEqual(expectedOutput, actualOutput) - done() - }).catch((err: any) => done(err)) - }) - }) - - describe('try from expanded (expanded.json)', function () { - it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { - const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1' - const fakeEndpoint = 'devicemodels.contoso.com' - const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json' - const fakeData = `[${JSON.stringify({ - '@id': fakeDtmi, - fakeDtdl: 'fakeBodyAsText' - })}]` - sinon.stub(coreHttp, 'ServiceClient') - .returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.') - return Promise.resolve({ bodyAsText: fakeData, status: 200 }) - } - }) - - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' }) - assert(resolveResult instanceof Promise, 'resolve method did not return a promise') - resolveResult.then((actualOutput: any) => { - assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput) - done() - }).catch((err: any) => done(err)) - }) - - it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) { - const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1' - const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1' - const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' - const fakeEndpoint: string = 'devicemodels.contoso.com' - const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json' - const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json' - const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json' - const localDirectory = path.resolve('./test/node/testModelRepository') - const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json') - const fakeData = fs.readFileSync(pathToDtdl).toString() - const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' }) - const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' }) - const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) } - const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient') - serviceClientStub.onCall(0).returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.') - return Promise.resolve({ status: 404 }) - } - }) - serviceClientStub.onCall(1).returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.') - return Promise.resolve({ bodyAsText: fakeData, status: 200 }) - } - }) - serviceClientStub.onCall(2).returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri2.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.') - return Promise.resolve({ status: 404 }) - } - }) - serviceClientStub.onCall(3).returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.') - return Promise.resolve({ bodyAsText: fakeData2, status: 200 }) - } - }) - serviceClientStub.onCall(4).returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri3.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.') - return Promise.resolve({ status: 404 }) - } - }) - serviceClientStub.onCall(5).returns({ - sendRequest: function (req: any) { - assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.') - return Promise.resolve({ bodyAsText: fakeData3, status: 200 }) - } - }) - - const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' }) - assert(resolveResult instanceof Promise, 'resolve method did not return a promise') - resolveResult.then((actualOutput: any) => { - assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output') - assert.deepStrictEqual(expectedOutput, actualOutput) - done() - }).catch((err: any) => done(err)) - }) - }) - }) - - describe('local file resolution', function () { - describe('simple DTDL resolution', function () { - it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { - const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:thermostat;1' - const localDirectory = path.resolve('./test/node/testModelRepository') - const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json') - const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, 'utf-8')) - const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory) - assert(resolveResult instanceof Promise, 'resolve method did not return a promise') - resolveResult.then((actualOutput: any) => { - assert.deepStrictEqual({ [fakeDtmi]: fakeDtdl }, actualOutput, 'the expected dtmi mapping did not match the actual value.') - done() - }).catch((err: any) => done(err)) - }) - }) - - describe('dependency resolution (using pseudo-parsing)', function () { - it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) { - const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1' - const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1' - const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' - const localDirectory = path.resolve('./test/node/testModelRepository') - const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json') - const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json') - const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json') - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')) - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')) - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')) - - const expectedOutput = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - } - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'enabled' }) - assert(resolveResult instanceof Promise, 'resolve method did not return a promise') - resolveResult.then((actualOutput: any) => { - assert.deepStrictEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis do not match') - Object.keys(actualOutput).forEach((outputDtmi) => { - assert.deepStrictEqual(actualOutput[outputDtmi], expectedOutput[outputDtmi], `dtdls for given dtmi (${outputDtmi}) did not line up.`) - }) - assert.deepStrictEqual(actualOutput, expectedOutput, 'the expected dtmi mapping did not match the actual value.') - done() - }).catch((err: any) => done(err)) - }) - - it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) { - const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:thermostat;1' - const localDirectory = path.resolve('./test/node/testModelRepository') - const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json') - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')) - - const expectedResult = { - [fakeDtmi1]: fakeDtdl1 - } - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory) - assert(resolveResult instanceof Promise, 'resolve method did not return a promise') - resolveResult.then((actualOutput: any) => { - assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.') - done() - }).catch((err: any) => done(err)) - }) - }) - - describe('try from expanded (expanded.json)', function () { - it('should return a promise that resolves to a mapping from the DTMIs to the JSON objects', function (done) { - const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1' - const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1' - const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' - const localDirectory = path.resolve('./test/node/testModelRepository') - const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json') - const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json') - const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json') - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')) - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')) - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')) - - const expectedResult = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - } - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' }) - assert(resolveResult instanceof Promise, 'resolve method did not return a promise') - resolveResult.then((actualOutput: any) => { - assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.') - done() - }).catch((err: any) => done(err)) - }) - - it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) { - const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2' - const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1' - const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1' - const localDirectory = path.resolve('./test/node/testModelRepository') - const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json') - const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json') - const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json') - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8')) - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8')) - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8')) - - const expectedResult = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - } - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' }) - assert(resolveResult instanceof Promise, 'resolve method did not return a promise') - resolveResult.then((actualOutput: any) => { - assert.deepEqual(Object.keys(expectedResult), Object.keys(actualOutput), 'the expected dtmis do not match') - Object.keys(expectedResult).forEach(dtmiKey => { - assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey]) - }) - done() - }).catch((err: any) => done(err)) - }) - }) - }) -}) From bdfc7fd6e54efe94cd5bc79947781f374ecda87e Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 8 Apr 2021 13:50:09 -0700 Subject: [PATCH 03/81] many changes --- sdk/iot/modelsrepository/package.json | 118 ++++++++++++++++++ .../src/remoteModelFetchers.ts | 90 +++++++++++++ 2 files changed, 208 insertions(+) create mode 100644 sdk/iot/modelsrepository/package.json create mode 100644 sdk/iot/modelsrepository/src/remoteModelFetchers.ts diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json new file mode 100644 index 000000000000..6b7b8d8aa140 --- /dev/null +++ b/sdk/iot/modelsrepository/package.json @@ -0,0 +1,118 @@ +{ + "name": "@azure/iot-modelsrepository-client", + "version": "0.0.1", + "description": "Device Model Repository Library with typescript type definitions for node.js and browser.", + "sdk-type": "client", + "main": "dist/index.js", + "module": "dist-esm/src/index.js", + "browser": { + "stream": "./node_modules/stream-browserify/index.js", + "./dist-esm/src/print.js": "./dist-esm/src/print.browser.js" + }, + "types": "types/template.d.ts", + "scripts": { + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", + "build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1", + "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", + "build:samples": "dev-tool samples prep && cd dist-samples && tsc -p .", + "build:test": "tsc -p . && rollup -c 2>&1", + "build": "tsc -p . && rollup -c 2>&1 && api-extractor run --local", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "clean": "rimraf dist dist-* test-dist temp types *.tgz *.log", + "execute:samples": "npm run build:samples && dev-tool samples run dist-samples/javascript dist-samples/typescript/dist/dist-samples/typescript/src/", + "extract-api": "tsc -p . && api-extractor run --local", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "integration-test:browser": "karma start --single-run", + "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}/*.spec.js\"", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", + "lint": "eslint package.json api-extractor.json src test --ext .ts", + "pack": "npm pack 2>&1", + "prebuild": "npm run clean", + "test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node", + "test": "npm run build:test && npm run unit-test && npm run integration-test", + "unit-test:browser": "karma start --single-run", + "unit-test:node": "mocha --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/{,!(browser)/**/}/*.spec.ts\"", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "temp-unit-test": "mocha -r ts-node/register --timeout 1200000 test/node/*.spec.ts" + }, + "files": [ + "dist/", + "dist-esm/src/", + "types/template.d.ts", + "README.md", + "LICENSE" + ], + "repository": "github:Azure/azure-sdk-for-js", + "engines": { + "node": ">=10.0.0" + }, + "keywords": [ + "azure", + "cloud", + "typescript" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/", + "sideEffects": false, + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "dependencies": { + "@azure/core-http": "^1.2.0", + "@azure/core-tracing": "1.0.0-preview.9", + "@azure/logger": "^1.0.0", + "@opentelemetry/api": "^0.10.2", + "events": "^3.0.0", + "tslib": "^2.0.0" + }, + "devDependencies": { + "@azure/dev-tool": "^1.0.0", + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/identity": "^1.1.0", + "@azure/test-utils-recorder": "^1.0.0", + "@microsoft/api-extractor": "7.7.11", + "@types/chai": "^4.1.6", + "@types/chai-as-promised": "^7.1.0", + "@types/mocha": "^7.0.2", + "@types/node": "^8.0.0", + "chai": "^4.2.0", + "chai-as-promised": "^7.1.1", + "cross-env": "^7.0.2", + "dotenv": "^8.2.0", + "eslint": "^7.15.0", + "inherits": "^2.0.3", + "karma": "^5.1.0", + "karma-chrome-launcher": "^3.0.0", + "karma-coverage": "^2.0.0", + "karma-edge-launcher": "^0.4.2", + "karma-env-preprocessor": "^0.1.1", + "karma-firefox-launcher": "^1.1.0", + "karma-ie-launcher": "^1.0.0", + "karma-json-preprocessor": "^0.3.3", + "karma-json-to-file-reporter": "^1.0.1", + "karma-junit-reporter": "^2.0.1", + "karma-mocha": "^2.0.1", + "karma-mocha-reporter": "^2.2.5", + "mocha": "^7.1.1", + "mocha-junit-reporter": "^1.18.0", + "nyc": "^14.0.0", + "prettier": "^1.16.4", + "rimraf": "^3.0.0", + "rollup": "^1.16.3", + "typedoc": "0.15.2", + "typescript": "4.1.2", + "util": "^0.12.1" + }, + "standard": { + "env": [ + "mocha" + ] + }, + "//smokeTestConfiguration": { + "skipFolder": true + } +} diff --git a/sdk/iot/modelsrepository/src/remoteModelFetchers.ts b/sdk/iot/modelsrepository/src/remoteModelFetchers.ts new file mode 100644 index 000000000000..5b4526e2704a --- /dev/null +++ b/sdk/iot/modelsrepository/src/remoteModelFetchers.ts @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +"use strict"; + +import * as dtmiConventions from "./dtmiConventions"; +import * as modelMetadata from "./modelMetadata"; +import * as coreHttp from "@azure/core-http"; +import { DTDL } from "./DTDL"; +import { flattenDtdlResponse } from "./modelFetcherHelper"; + +async function recursiveFetcher( + dtmi: string, + endpoint: string, + tryFromExpanded: boolean +): Promise<{ [dtmi: string]: DTDL }> { + let dependencyModels: { [x: string]: DTDL } = {}; + let fetchedModels: { [x: string]: DTDL }; + try { + console.log(`Fetching: ${dtmi}`); + fetchedModels = await fetcher(dtmi, endpoint, tryFromExpanded); + } catch (error) { + if ( + tryFromExpanded && + (error.code === "ENOENT" || !(error.statusCode >= 200 && error.statusCode < 400)) + ) { + console.log("Fetching from expanded failed. Trying without."); + console.log(`Fetching: ${dtmi}`); + fetchedModels = await fetcher(dtmi, endpoint, false); + } else { + throw error; + } + } + const dtmis = Object.keys(fetchedModels); + for (let i = 0; i < dtmis.length; i++) { + const currentDtdl = fetchedModels[dtmis[i]]; + const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas; + if (deps && deps.length > 0) { + for (let j = 0; j < deps.length; j++) { + if ( + Object.keys(dependencyModels).includes(deps[j]) || + Object.keys(fetchedModels).includes(deps[j]) + ) { + // do nothing + } else { + const fetchedDependencies = await recursiveFetcher(deps[j], endpoint, tryFromExpanded); + dependencyModels = { ...dependencyModels, ...fetchedDependencies }; + } + } + } + } + if (Object.keys(dependencyModels).length > 0) { + fetchedModels = { ...fetchedModels, ...dependencyModels }; + } + return fetchedModels; +} + +async function fetcher( + dtmi: string, + endpoint: string, + tryFromExpanded: boolean +): Promise<{ [dtmi: string]: any }> { + const client = new coreHttp.ServiceClient(); + const req: coreHttp.RequestPrepareOptions = { + url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), + method: "GET" + }; + const res: coreHttp.HttpOperationResponse = await client.sendRequest(req); + if (res.status >= 200 && res.status < 400) { + const dtdlAsString = res.bodyAsText || ""; + const parsedDtdl = JSON.parse(dtdlAsString); + if (Array.isArray(parsedDtdl)) { + const result = flattenDtdlResponse(parsedDtdl as DTDL[]); + return result; + } else { + const result = { [dtmi]: parsedDtdl as DTDL }; + return result; + } + } else { + throw new coreHttp.RestError( + "Error on HTTP Request in remote model fetcher", + "404", + 404, + undefined, + res + ); + } +} + +export { fetcher, recursiveFetcher }; From 3f9798a5d323151540904bb4666b0a26f4b3f697 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 8 Apr 2021 13:54:04 -0700 Subject: [PATCH 04/81] alot --- rush.json | 2 +- .../modelsrepository}/.npmrc | 0 .../modelsrepository}/.nycrc | 0 .../modelsrepository}/.vscode/launch.json | 0 .../modelsrepository}/CHANGELOG.md | 0 .../modelsrepository}/LICENSE | 0 .../modelsrepository}/README.md | 0 .../modelsrepository}/api-extractor.json | 0 .../modelsrepository}/rollup.config.js | 0 .../samples/javascript/local_example.js | 0 .../samples/javascript/package.json | 0 .../samples/javascript/remote_example.js | 0 .../samples/typescript/README.md | 0 .../samples/typescript/package.json | 0 .../samples/typescript/src/example.ts | 0 .../samples/typescript/tsconfig.json | 0 .../modelsrepository}/src/CODE_STRUCTURE.md | 0 .../modelsrepository}/src/DTDL.ts | 4 +- sdk/iot/modelsrepository/src/client.ts | 82 +++ sdk/iot/modelsrepository/src/constants.ts | 12 + .../src/dependencyResolutionType.ts | 4 + .../modelsrepository}/src/dtmiConventions.ts | 4 +- .../modelsrepository}/src/index.ts | 2 +- .../src/localModelFetchers.ts | 4 +- sdk/iot/modelsrepository/src/logger.ts | 9 + .../src/modelFetcherHandler.ts | 18 +- .../src/modelFetcherHelper.ts | 4 +- .../modelsrepository}/src/modelMetadata.ts | 4 +- .../src/remoteModelFetchers.ts | 2 +- .../modelsrepository}/src/resolver.ts | 4 +- .../test/browser/browserTest.spec.ts | 0 .../test/node/dtmiConventions.spec.ts | 0 .../modelsrepository}/test/node/index.spec.ts | 0 .../DeviceManagement/deviceinformation-1.json | 0 .../temperaturecontroller-1.expanded.json | 0 .../temperaturecontroller-1.json | 0 .../temperaturecontroller-2.json | 0 .../thermostat-1.expanded.json | 0 .../FakeDeviceManagement/thermostat-1.json | 0 .../modelsrepository}/tsconfig.json | 0 .../resolver-tool/.eslintrc.json | 21 - .../resolver-tool/out/src/DTDL.js | 5 - .../resolver-tool/out/src/DTDL.js.map | 1 - .../resolver-tool/out/src/dtmiConventions.js | 47 -- .../out/src/dtmiConventions.js.map | 1 - .../resolver-tool/out/src/index.js | 8 - .../resolver-tool/out/src/index.js.map | 1 - .../out/src/localModelFetchers.js | 75 --- .../out/src/localModelFetchers.js.map | 1 - .../out/src/modelFetcherHandler.js | 47 -- .../out/src/modelFetcherHandler.js.map | 1 - .../out/src/modelFetcherHelper.js | 21 - .../out/src/modelFetcherHelper.js.map | 1 - .../resolver-tool/out/src/modelMetadata.js | 43 -- .../out/src/modelMetadata.js.map | 1 - .../out/src/remoteModelFetchers.js | 88 ---- .../out/src/remoteModelFetchers.js.map | 1 - .../resolver-tool/out/src/resolver.js | 25 - .../resolver-tool/out/src/resolver.js.map | 1 - .../out/test/browser/browserTest.spec.js | 30 -- .../out/test/browser/browserTest.spec.js.map | 1 - .../out/test/node/dtmiConventions.spec.js | 161 ------ .../out/test/node/dtmiConventions.spec.js.map | 1 - .../resolver-tool/out/test/node/index.spec.js | 472 ------------------ .../out/test/node/index.spec.js.map | 1 - .../resolver-tool/package.json | 118 ----- .../resolver-tool/src/remoteModelFetchers.ts | 90 ---- 67 files changed, 133 insertions(+), 1285 deletions(-) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/.npmrc (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/.nycrc (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/.vscode/launch.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/CHANGELOG.md (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/LICENSE (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/README.md (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/api-extractor.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/rollup.config.js (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/samples/javascript/local_example.js (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/samples/javascript/package.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/samples/javascript/remote_example.js (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/samples/typescript/README.md (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/samples/typescript/package.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/samples/typescript/src/example.ts (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/samples/typescript/tsconfig.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/src/CODE_STRUCTURE.md (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/src/DTDL.ts (58%) create mode 100644 sdk/iot/modelsrepository/src/client.ts create mode 100644 sdk/iot/modelsrepository/src/constants.ts create mode 100644 sdk/iot/modelsrepository/src/dependencyResolutionType.ts rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/src/dtmiConventions.ts (90%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/src/index.ts (70%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/src/localModelFetchers.ts (94%) create mode 100644 sdk/iot/modelsrepository/src/logger.ts rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/src/modelFetcherHandler.ts (77%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/src/modelFetcherHelper.ts (77%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/src/modelMetadata.ts (87%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/src/resolver.ts (90%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/test/browser/browserTest.spec.ts (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/test/node/dtmiConventions.spec.ts (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/test/node/index.spec.ts (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json (100%) rename sdk/{iotmodelsrepository/resolver-tool => iot/modelsrepository}/tsconfig.json (100%) delete mode 100644 sdk/iotmodelsrepository/resolver-tool/.eslintrc.json delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/index.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/index.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js delete mode 100644 sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js.map delete mode 100644 sdk/iotmodelsrepository/resolver-tool/package.json delete mode 100644 sdk/iotmodelsrepository/resolver-tool/src/remoteModelFetchers.ts diff --git a/rush.json b/rush.json index 1e57eb88cfba..aa8586c6a6e1 100644 --- a/rush.json +++ b/rush.json @@ -634,7 +634,7 @@ }, { "packageName": "@azure/iot-plugandplay-models-repo-tool", - "projectFolder": "sdk/iotplugandplay/models-repo-tool", + "projectFolder": "sdk/iot/modelsrepository", "versionPolicyName": "core" } ] diff --git a/sdk/iotmodelsrepository/resolver-tool/.npmrc b/sdk/iot/modelsrepository/.npmrc similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/.npmrc rename to sdk/iot/modelsrepository/.npmrc diff --git a/sdk/iotmodelsrepository/resolver-tool/.nycrc b/sdk/iot/modelsrepository/.nycrc similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/.nycrc rename to sdk/iot/modelsrepository/.nycrc diff --git a/sdk/iotmodelsrepository/resolver-tool/.vscode/launch.json b/sdk/iot/modelsrepository/.vscode/launch.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/.vscode/launch.json rename to sdk/iot/modelsrepository/.vscode/launch.json diff --git a/sdk/iotmodelsrepository/resolver-tool/CHANGELOG.md b/sdk/iot/modelsrepository/CHANGELOG.md similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/CHANGELOG.md rename to sdk/iot/modelsrepository/CHANGELOG.md diff --git a/sdk/iotmodelsrepository/resolver-tool/LICENSE b/sdk/iot/modelsrepository/LICENSE similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/LICENSE rename to sdk/iot/modelsrepository/LICENSE diff --git a/sdk/iotmodelsrepository/resolver-tool/README.md b/sdk/iot/modelsrepository/README.md similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/README.md rename to sdk/iot/modelsrepository/README.md diff --git a/sdk/iotmodelsrepository/resolver-tool/api-extractor.json b/sdk/iot/modelsrepository/api-extractor.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/api-extractor.json rename to sdk/iot/modelsrepository/api-extractor.json diff --git a/sdk/iotmodelsrepository/resolver-tool/rollup.config.js b/sdk/iot/modelsrepository/rollup.config.js similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/rollup.config.js rename to sdk/iot/modelsrepository/rollup.config.js diff --git a/sdk/iotmodelsrepository/resolver-tool/samples/javascript/local_example.js b/sdk/iot/modelsrepository/samples/javascript/local_example.js similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/samples/javascript/local_example.js rename to sdk/iot/modelsrepository/samples/javascript/local_example.js diff --git a/sdk/iotmodelsrepository/resolver-tool/samples/javascript/package.json b/sdk/iot/modelsrepository/samples/javascript/package.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/samples/javascript/package.json rename to sdk/iot/modelsrepository/samples/javascript/package.json diff --git a/sdk/iotmodelsrepository/resolver-tool/samples/javascript/remote_example.js b/sdk/iot/modelsrepository/samples/javascript/remote_example.js similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/samples/javascript/remote_example.js rename to sdk/iot/modelsrepository/samples/javascript/remote_example.js diff --git a/sdk/iotmodelsrepository/resolver-tool/samples/typescript/README.md b/sdk/iot/modelsrepository/samples/typescript/README.md similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/samples/typescript/README.md rename to sdk/iot/modelsrepository/samples/typescript/README.md diff --git a/sdk/iotmodelsrepository/resolver-tool/samples/typescript/package.json b/sdk/iot/modelsrepository/samples/typescript/package.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/samples/typescript/package.json rename to sdk/iot/modelsrepository/samples/typescript/package.json diff --git a/sdk/iotmodelsrepository/resolver-tool/samples/typescript/src/example.ts b/sdk/iot/modelsrepository/samples/typescript/src/example.ts similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/samples/typescript/src/example.ts rename to sdk/iot/modelsrepository/samples/typescript/src/example.ts diff --git a/sdk/iotmodelsrepository/resolver-tool/samples/typescript/tsconfig.json b/sdk/iot/modelsrepository/samples/typescript/tsconfig.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/samples/typescript/tsconfig.json rename to sdk/iot/modelsrepository/samples/typescript/tsconfig.json diff --git a/sdk/iotmodelsrepository/resolver-tool/src/CODE_STRUCTURE.md b/sdk/iot/modelsrepository/src/CODE_STRUCTURE.md similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/src/CODE_STRUCTURE.md rename to sdk/iot/modelsrepository/src/CODE_STRUCTURE.md diff --git a/sdk/iotmodelsrepository/resolver-tool/src/DTDL.ts b/sdk/iot/modelsrepository/src/DTDL.ts similarity index 58% rename from sdk/iotmodelsrepository/resolver-tool/src/DTDL.ts rename to sdk/iot/modelsrepository/src/DTDL.ts index 4251013cc0c2..a436d2353840 100644 --- a/sdk/iotmodelsrepository/resolver-tool/src/DTDL.ts +++ b/sdk/iot/modelsrepository/src/DTDL.ts @@ -1,5 +1,5 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Copyright (c) Microsoft. +// Licensed under the MIT license. "use strict"; diff --git a/sdk/iot/modelsrepository/src/client.ts b/sdk/iot/modelsrepository/src/client.ts new file mode 100644 index 000000000000..69441aa2445f --- /dev/null +++ b/sdk/iot/modelsrepository/src/client.ts @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +import * as constants from './constants'; +import { + InternalPipelineOptions, + createPipelineFromOptions, + OperationOptions, + PipelineOptions, + ServiceClientOptions +} from "@azure/core-http"; +import {dependencyResolutionType} from './dependencyResolutionType'; +import {logger} from './logger'; +import {modelFetcher} from './modelFetcherHandler'; + +export interface ModelsRepositoryClientOptions extends PipelineOptions, OperationOptions { + repositoryLocation: string | undefined; + dependencyResolution: dependencyResolutionType; + apiVersion: string | undefined; +} + +/** + * Client providing APIs for Models Repository Operations + */ +export class ModelsRepositoryClient { + private _repositoryLocation: string; + private _dependencyResolution: string; + private _apiVersion: string; + private _pipeline: ServiceClientOptions; + + constructor(options?: ModelsRepositoryClientOptions) { + this._repositoryLocation = options?.repositoryLocation || constants.DEFAULT_REPOSITORY_LOCATION; + this._dependencyResolution = options?.dependencyResolution || this._checkDefaultDependencyResolution(!!options?.repositoryLocation); + this._apiVersion = options?.apiVersion || constants.DEFAULT_API_VERSION; + + const { ...pipelineOptions } = options; + + const libInfo = `azsdk-js-ai-anomalydetector/${constants.SDK_VERSION}`; + if (!pipelineOptions.userAgentOptions) { + pipelineOptions.userAgentOptions = {}; + } + if (pipelineOptions.userAgentOptions.userAgentPrefix) { + pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`; + } else { + pipelineOptions.userAgentOptions.userAgentPrefix = libInfo; + } + + const internalPipelineOptions: InternalPipelineOptions = { + ...pipelineOptions, + ...{ + loggingOptions: { + logger: logger.info + } + } + }; + + this._pipeline = createPipelineFromOptions(internalPipelineOptions); + } + + get apiVersion() { + return this._apiVersion; + } + + private _checkDefaultDependencyResolution(customRepository: boolean) { + if (customRepository) { + return 'enabled'; + } else { + return 'tryFromExpanded'; + } + } + + getModels(dtmi: string, dependencyResolution: dependencyResolutionType): Promise<{ [dtmi: string]: any }>; + getModels(dtmis: string[], dependencyResolution: dependencyResolutionType): Promise<{[dtmi:string]: any }>; + getModels(dtmis: string | string[], dependencyResolution: dependencyResolutionType): Promise<{[dtmi: string]: any}> { + if (!Array.isArray(dtmis)) { + dtmis = [dtmis]; + } + return modelFetcher(this._pipeline, client, dtmi, this._repositoryLocation, dependencyResolution || this._dependencyResolution); + } + + +} diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts new file mode 100644 index 000000000000..dde3aa879b9d --- /dev/null +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +const isBrowser=new Function("try {return this===window;}catch(e){ return false;}"); +const isNode=new Function("try {return this===global;}catch(e){return false;}"); + +const currentPlatform = isBrowser ? 'browser' : (isNode ? 'node' : 'undefined'); + +export const SDK_VERSION = "0.0.0-preview" +export const DEFAULT_USER_AGENT = `azsdk-node-modelsrepository/${SDK_VERSION} (${currentPlatform})` +export const DEFAULT_REPOSITORY_LOCATION = 'https://devicemodels.azure.com'; +export const DEFAULT_API_VERSION = "2021-02-11" diff --git a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts new file mode 100644 index 000000000000..a49a0ee2a520 --- /dev/null +++ b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +export type dependencyResolutionType = 'disabled' | 'enabled' | 'tryFromExpanded' | undefined; diff --git a/sdk/iotmodelsrepository/resolver-tool/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts similarity index 90% rename from sdk/iotmodelsrepository/resolver-tool/src/dtmiConventions.ts rename to sdk/iot/modelsrepository/src/dtmiConventions.ts index 0f7fb01fc94a..099bb0c4aea8 100644 --- a/sdk/iotmodelsrepository/resolver-tool/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -1,5 +1,5 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Copyright (c) Microsoft. +// Licensed under the MIT license. "use strict"; diff --git a/sdk/iotmodelsrepository/resolver-tool/src/index.ts b/sdk/iot/modelsrepository/src/index.ts similarity index 70% rename from sdk/iotmodelsrepository/resolver-tool/src/index.ts rename to sdk/iot/modelsrepository/src/index.ts index 3133fdcebae1..8ef45fdc1c53 100644 --- a/sdk/iotmodelsrepository/resolver-tool/src/index.ts +++ b/sdk/iot/modelsrepository/src/index.ts @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft. // Licensed under the MIT license. // exporting the resolver api diff --git a/sdk/iotmodelsrepository/resolver-tool/src/localModelFetchers.ts b/sdk/iot/modelsrepository/src/localModelFetchers.ts similarity index 94% rename from sdk/iotmodelsrepository/resolver-tool/src/localModelFetchers.ts rename to sdk/iot/modelsrepository/src/localModelFetchers.ts index f2c61188fc8c..d4e3b0392549 100644 --- a/sdk/iotmodelsrepository/resolver-tool/src/localModelFetchers.ts +++ b/sdk/iot/modelsrepository/src/localModelFetchers.ts @@ -1,5 +1,5 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Copyright (c) Microsoft. +// Licensed under the MIT license. "use strict"; diff --git a/sdk/iot/modelsrepository/src/logger.ts b/sdk/iot/modelsrepository/src/logger.ts new file mode 100644 index 000000000000..b04bd5f34807 --- /dev/null +++ b/sdk/iot/modelsrepository/src/logger.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { createClientLogger } from "@azure/logger"; + +/** + * The @azure/logger configuration for this package. + */ +export const logger = createClientLogger("iot-modelsrepository"); diff --git a/sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHandler.ts b/sdk/iot/modelsrepository/src/modelFetcherHandler.ts similarity index 77% rename from sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHandler.ts rename to sdk/iot/modelsrepository/src/modelFetcherHandler.ts index 4ec3d3e2192e..45645e18a232 100644 --- a/sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHandler.ts +++ b/sdk/iot/modelsrepository/src/modelFetcherHandler.ts @@ -1,8 +1,9 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Copyright (c) Microsoft. +// Licensed under the MIT license. "use strict"; +import { PipelineOptions } from "@azure/core-http"; import * as fs from "fs"; import * as url from "url"; import * as localFetchers from "./localModelFetchers"; @@ -23,11 +24,14 @@ function isLocalPath(p: string): boolean { } } -export async function modelFetcher( - dtmi: string, - endpoint: string, - resolveDependencies: boolean, - tryFromExpanded: boolean +interface modelFetcherParams { + pipeline: PipelineOptions + dtmis: string[]; + endpoint: string; + dependencyResolution: Dependency +} + +export async function modelFetcher({dtmis, endpoint, resolveDependencies}: modelFetcherParams ): Promise<{ [dtmi: string]: JSON | Array }> { if (isLocalPath(endpoint)) { const formattedDirectory = endpoint.includes("file://") diff --git a/sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHelper.ts b/sdk/iot/modelsrepository/src/modelFetcherHelper.ts similarity index 77% rename from sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHelper.ts rename to sdk/iot/modelsrepository/src/modelFetcherHelper.ts index a927f08b4a6c..87fb172b73ce 100644 --- a/sdk/iotmodelsrepository/resolver-tool/src/modelFetcherHelper.ts +++ b/sdk/iot/modelsrepository/src/modelFetcherHelper.ts @@ -1,5 +1,5 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Copyright (c) Microsoft. +// Licensed under the MIT license. "use strict"; diff --git a/sdk/iotmodelsrepository/resolver-tool/src/modelMetadata.ts b/sdk/iot/modelsrepository/src/modelMetadata.ts similarity index 87% rename from sdk/iotmodelsrepository/resolver-tool/src/modelMetadata.ts rename to sdk/iot/modelsrepository/src/modelMetadata.ts index 5cd9576c92f7..c46785d0826b 100644 --- a/sdk/iotmodelsrepository/resolver-tool/src/modelMetadata.ts +++ b/sdk/iot/modelsrepository/src/modelMetadata.ts @@ -1,5 +1,5 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Copyright (c) Microsoft. +// Licensed under the MIT license. "use strict"; diff --git a/sdk/iot/modelsrepository/src/remoteModelFetchers.ts b/sdk/iot/modelsrepository/src/remoteModelFetchers.ts index 5b4526e2704a..222e456800ff 100644 --- a/sdk/iot/modelsrepository/src/remoteModelFetchers.ts +++ b/sdk/iot/modelsrepository/src/remoteModelFetchers.ts @@ -1,6 +1,6 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. - + "use strict"; import * as dtmiConventions from "./dtmiConventions"; diff --git a/sdk/iotmodelsrepository/resolver-tool/src/resolver.ts b/sdk/iot/modelsrepository/src/resolver.ts similarity index 90% rename from sdk/iotmodelsrepository/resolver-tool/src/resolver.ts rename to sdk/iot/modelsrepository/src/resolver.ts index b7e57d963e47..30a76ded382e 100644 --- a/sdk/iotmodelsrepository/resolver-tool/src/resolver.ts +++ b/sdk/iot/modelsrepository/src/resolver.ts @@ -1,5 +1,5 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Copyright (c) Microsoft. +// Licensed under the MIT license. "use strict"; diff --git a/sdk/iotmodelsrepository/resolver-tool/test/browser/browserTest.spec.ts b/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/test/browser/browserTest.spec.ts rename to sdk/iot/modelsrepository/test/browser/browserTest.spec.ts diff --git a/sdk/iotmodelsrepository/resolver-tool/test/node/dtmiConventions.spec.ts b/sdk/iot/modelsrepository/test/node/dtmiConventions.spec.ts similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/test/node/dtmiConventions.spec.ts rename to sdk/iot/modelsrepository/test/node/dtmiConventions.spec.ts diff --git a/sdk/iotmodelsrepository/resolver-tool/test/node/index.spec.ts b/sdk/iot/modelsrepository/test/node/index.spec.ts similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/test/node/index.spec.ts rename to sdk/iot/modelsrepository/test/node/index.spec.ts diff --git a/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json rename to sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json diff --git a/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json rename to sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json diff --git a/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json rename to sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json diff --git a/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json rename to sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json diff --git a/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json rename to sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json diff --git a/sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json rename to sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json diff --git a/sdk/iotmodelsrepository/resolver-tool/tsconfig.json b/sdk/iot/modelsrepository/tsconfig.json similarity index 100% rename from sdk/iotmodelsrepository/resolver-tool/tsconfig.json rename to sdk/iot/modelsrepository/tsconfig.json diff --git a/sdk/iotmodelsrepository/resolver-tool/.eslintrc.json b/sdk/iotmodelsrepository/resolver-tool/.eslintrc.json deleted file mode 100644 index 75f5bae2bae4..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "env": { - "browser": true, - "es6": true, - "node": true - }, - "extends": ["standard", "plugin:mocha/recommended"], - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 2018, - "sourceType": "module" - }, - "plugins": ["@typescript-eslint", "mocha"], - "rules": { - "no-redeclare": "off" - } -} diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js b/sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js deleted file mode 100644 index e3fab8adf94a..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=DTDL.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js.map deleted file mode 100644 index 569f91bb5e90..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/DTDL.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DTDL.js","sourceRoot":"","sources":["../../src/DTDL.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\ninterface Contents {\r\n '@type'?: string;\r\n 'name': string;\r\n 'schema': string;\r\n}\r\n\r\nexport interface DTDL extends JSON {\r\n '@context': any[],\r\n '@id': string,\r\n 'extends': string,\r\n 'contents': Contents[]\r\n}\r\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js b/sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js deleted file mode 100644 index fb99d9854fc4..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.dtmiToQualifiedPath = exports.dtmiToPath = exports.isValidDtmi = void 0; -function isValidDtmi(dtmi) { - if (dtmi) { - const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/; - return re.test(dtmi); // true if dtmi matches regular expression, false otherwise - } - return false; // if not a string return false. -} -exports.isValidDtmi = isValidDtmi; -function dtmiToPath(dtmi) { - // presently this dtmi to path function does not return the path with a - // file format at the end, i.e. does not append .json or .expanded.json. - // that happens in the dtmiToQualifiedPath function - if (isValidDtmi(dtmi)) { - return `${dtmi - .toLowerCase() - .replace(/:/gm, "/") - .replace(/;/gm, "-")}.json`; - } else { - throw new Error("DTMI provided is invalid. Ensure it follows DTMI conventions."); - } -} -exports.dtmiToPath = dtmiToPath; -function ensureStartsWithProtocol(text) { - const re = /^http[s]?:\/\//; - if (text.search(re) !== -1) { - return text; - } else { - return `https://${text}`; - } -} -function dtmiToQualifiedPath(dtmi, endpoint, isExpanded) { - const dtmiAsPath = dtmiToPath(dtmi); - const endpointWithSlash = endpoint.endsWith("/") ? endpoint : `${endpoint}/`; - const urlEndpoint = ensureStartsWithProtocol(endpointWithSlash); - if (isExpanded) { - return `${urlEndpoint}${dtmiAsPath.replace(/json$/, "expanded.json")}`; - } else { - return `${urlEndpoint}${dtmiAsPath}`; - } -} -exports.dtmiToQualifiedPath = dtmiToQualifiedPath; -//# sourceMappingURL=dtmiConventions.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js.map deleted file mode 100644 index aa9bf258127b..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/dtmiConventions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dtmiConventions.js","sourceRoot":"","sources":["../../src/dtmiConventions.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;AAEZ,SAAgB,WAAW,CAAE,IAAY;IACvC,IAAI,IAAI,EAAE;QACR,MAAM,EAAE,GAAG,yGAAyG,CAAA;QACpH,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAC,2DAA2D;KACjF;IACD,OAAO,KAAK,CAAA,CAAC,gCAAgC;AAC/C,CAAC;AAND,kCAMC;AAED,SAAgB,UAAU,CAAE,IAAY;IACtC,uEAAuE;IACvE,wEAAwE;IACxE,mDAAmD;IAEnD,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;QACrB,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAA;KAC5E;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;KACjF;AACH,CAAC;AAVD,gCAUC;AAED,SAAS,wBAAwB,CAAE,IAAY;IAC7C,MAAM,EAAE,GAAG,gBAAgB,CAAA;IAC3B,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE;QAC1B,OAAO,IAAI,CAAA;KACZ;SAAM;QACL,OAAO,WAAW,IAAI,EAAE,CAAA;KACzB;AACH,CAAC;AAED,SAAgB,mBAAmB,CAAE,IAAY,EAAE,QAAgB,EAAE,UAAqB;IACxF,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;IACnC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAA;IAC5E,MAAM,WAAW,GAAG,wBAAwB,CAAC,iBAAiB,CAAC,CAAA;IAC/D,IAAI,UAAU,EAAE;QACd,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE,CAAA;KACvE;SAAM;QACL,OAAO,GAAG,WAAW,GAAG,UAAU,EAAE,CAAA;KACrC;AACH,CAAC;AATD,kDASC","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nexport function isValidDtmi (dtmi: string) {\r\n if (dtmi) {\r\n const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/\r\n return re.test(dtmi) // true if dtmi matches regular expression, false otherwise\r\n }\r\n return false // if not a string return false.\r\n}\r\n\r\nexport function dtmiToPath (dtmi: string) {\r\n // presently this dtmi to path function does not return the path with a\r\n // file format at the end, i.e. does not append .json or .expanded.json.\r\n // that happens in the dtmiToQualifiedPath function\r\n\r\n if (isValidDtmi(dtmi)) {\r\n return `${dtmi.toLowerCase().replace(/:/gm, '/').replace(/;/gm, '-')}.json`\r\n } else {\r\n throw new Error('DTMI provided is invalid. Ensure it follows DTMI conventions.')\r\n }\r\n}\r\n\r\nfunction ensureStartsWithProtocol (text: string) {\r\n const re = /^http[s]?:\\/\\//\r\n if (text.search(re) !== -1) {\r\n return text\r\n } else {\r\n return `https://${text}`\r\n }\r\n}\r\n\r\nexport function dtmiToQualifiedPath (dtmi: string, endpoint: string, isExpanded ?: boolean) {\r\n const dtmiAsPath = dtmiToPath(dtmi)\r\n const endpointWithSlash = endpoint.endsWith('/') ? endpoint : `${endpoint}/`\r\n const urlEndpoint = ensureStartsWithProtocol(endpointWithSlash)\r\n if (isExpanded) {\r\n return `${urlEndpoint}${dtmiAsPath.replace(/json$/, 'expanded.json')}`\r\n } else {\r\n return `${urlEndpoint}${dtmiAsPath}`\r\n }\r\n}\r\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/index.js b/sdk/iotmodelsrepository/resolver-tool/out/src/index.js deleted file mode 100644 index 3b4becdaeafb..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -// exporting the resolver api -tslib_1.__exportStar(require("./resolver"), exports); -//# sourceMappingURL=index.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/index.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/index.js.map deleted file mode 100644 index a77b1c41e7bf..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,6BAA6B;AAC7B,qDAA0B","sourcesContent":["// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n// exporting the resolver api\r\nexport * from './resolver'\r\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js b/sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js deleted file mode 100644 index 41ef15dd87ad..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.recursiveFetcher = exports.fetcher = void 0; -const tslib_1 = require("tslib"); -const dtmiConventions = tslib_1.__importStar(require("./dtmiConventions")); -const modelMetadata = tslib_1.__importStar(require("./modelMetadata")); -const fs_1 = tslib_1.__importDefault(require("fs")); -const path = tslib_1.__importStar(require("path")); -const modelFetcherHelper_1 = require("./modelFetcherHelper"); -function recursiveFetcher(dtmi, directory, tryFromExpanded) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - let dependencyModels = {}; - let fetchedModels; - try { - console.log(`Fetching: ${dtmi}`); - fetchedModels = yield fetcher(dtmi, directory, tryFromExpanded); - } catch (error) { - if (tryFromExpanded && error.code === "ENOENT") { - console.log("Fetching from expanded failed. Trying without."); - fetchedModels = yield fetcher(dtmi, directory, false); - } else { - throw error; - } - } - const dtmis = Object.keys(fetchedModels); - for (let i = 0; i < dtmis.length; i++) { - const currentDtdl = fetchedModels[dtmis[i]]; - const metaModelData = modelMetadata.getModelMetadata(currentDtdl); - const deps = metaModelData.componentSchemas.concat(metaModelData.extends); - if (deps && deps.length > 0) { - for (let j = 0; j < deps.length; j++) { - if ( - Object.keys(dependencyModels).includes(deps[j]) || - Object.keys(fetchedModels).includes(deps[j]) - ) { - // do nothing - } else { - const fetchedDependencies = yield recursiveFetcher(deps[j], directory, tryFromExpanded); - dependencyModels = Object.assign( - Object.assign({}, dependencyModels), - fetchedDependencies - ); - } - } - } - } - if (Object.keys(dependencyModels).length > 0) { - fetchedModels = Object.assign(Object.assign({}, fetchedModels), dependencyModels); - } - return fetchedModels; - }); -} -exports.recursiveFetcher = recursiveFetcher; -function fetcher(dtmi, directory, tryFromExpanded) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const dtmiPath = dtmiConventions.dtmiToPath(dtmi); - const dtmiPathFormatted = tryFromExpanded - ? dtmiPath.replace(".json", ".expanded.json") - : dtmiPath; - const targetPath = path.join(directory, dtmiPathFormatted); - const dtdlFile = fs_1.default.readFileSync(targetPath, "utf8"); - const parsedDtdl = JSON.parse(dtdlFile); - if (Array.isArray(parsedDtdl)) { - const result = modelFetcherHelper_1.flattenDtdlResponse(parsedDtdl); - return result; - } else { - const result = { [dtmi]: parsedDtdl }; - return result; - } - }); -} -exports.fetcher = fetcher; -//# sourceMappingURL=localModelFetchers.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js.map deleted file mode 100644 index 863d52d77934..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/localModelFetchers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"localModelFetchers.js","sourceRoot":"","sources":["../../src/localModelFetchers.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;;AAEZ,2EAAoD;AACpD,uEAAgD;AAEhD,oDAAmB;AACnB,mDAA4B;AAC5B,6DAA0D;AAE1D,SAAe,gBAAgB,CAAE,IAAY,EAAE,SAAiB,EAAE,eAAwB;;QACxF,IAAI,gBAAgB,GAAuB,EAAE,CAAA;QAC7C,IAAI,aAAmC,CAAA;QACvC,IAAI;YACF,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;YAChC,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,CAAA;SAChE;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,eAAe,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC9C,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAA;gBAC7D,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;aACtD;iBAAM;gBACL,MAAM,KAAK,CAAA;aACZ;SACF;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC3C,MAAM,aAAa,GAAG,aAAa,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;YACjE,MAAM,IAAI,GAAG,aAAa,CAAC,gBAAgB,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;YACzE,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpC,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;wBACnG,aAAa;qBACd;yBAAM;wBACL,MAAM,mBAAmB,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,CAAC,CAAA;wBACvF,gBAAgB,mCAAQ,gBAAgB,GAAK,mBAAmB,CAAE,CAAA;qBACnE;iBACF;aACF;SACF;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5C,aAAa,mCAAQ,aAAa,GAAK,gBAAgB,CAAE,CAAA;SAC1D;QACD,OAAO,aAAa,CAAA;IACtB,CAAC;CAAA;AAiBiB,4CAAgB;AAflC,SAAe,OAAO,CAAE,IAAY,EAAE,SAAiB,EAAE,eAAwB;;QAC/E,MAAM,QAAQ,GAAG,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACjD,MAAM,iBAAiB,GAAG,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;QAClG,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;QAC1D,MAAM,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;QACpD,MAAM,UAAU,GAAkB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QACtD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC7B,MAAM,MAAM,GAAG,wCAAmB,CAAC,UAAoB,CAAC,CAAA;YACxD,OAAO,MAAM,CAAA;SACd;aAAM;YACL,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,UAAkB,EAAE,CAAA;YAC7C,OAAO,MAAM,CAAA;SACd;IACH,CAAC;CAAA;AAEQ,0BAAO","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nimport * as dtmiConventions from './dtmiConventions'\r\nimport * as modelMetadata from './modelMetadata'\r\nimport { DTDL } from './DTDL'\r\nimport fs from 'fs'\r\nimport * as path from 'path'\r\nimport { flattenDtdlResponse } from './modelFetcherHelper'\r\n\r\nasync function recursiveFetcher (dtmi: string, directory: string, tryFromExpanded: boolean): Promise<{[x:string]: DTDL}> {\r\n let dependencyModels: {[x:string]: DTDL} = {}\r\n let fetchedModels: {[x: string]: DTDL }\r\n try {\r\n console.log(`Fetching: ${dtmi}`)\r\n fetchedModels = await fetcher(dtmi, directory, tryFromExpanded)\r\n } catch (error) {\r\n if (tryFromExpanded && error.code === 'ENOENT') {\r\n console.log('Fetching from expanded failed. Trying without.')\r\n fetchedModels = await fetcher(dtmi, directory, false)\r\n } else {\r\n throw error\r\n }\r\n }\r\n const dtmis = Object.keys(fetchedModels)\r\n for (let i = 0; i < dtmis.length; i++) {\r\n const currentDtdl = fetchedModels[dtmis[i]]\r\n const metaModelData = modelMetadata.getModelMetadata(currentDtdl)\r\n const deps = metaModelData.componentSchemas.concat(metaModelData.extends)\r\n if (deps && deps.length > 0) {\r\n for (let j = 0; j < deps.length; j++) {\r\n if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) {\r\n // do nothing\r\n } else {\r\n const fetchedDependencies = await recursiveFetcher(deps[j], directory, tryFromExpanded)\r\n dependencyModels = { ...dependencyModels, ...fetchedDependencies }\r\n }\r\n }\r\n }\r\n }\r\n if (Object.keys(dependencyModels).length > 0) {\r\n fetchedModels = { ...fetchedModels, ...dependencyModels }\r\n }\r\n return fetchedModels\r\n}\r\n\r\nasync function fetcher (dtmi: string, directory: string, tryFromExpanded: boolean): Promise<{ [dtmi: string]: DTDL }> {\r\n const dtmiPath = dtmiConventions.dtmiToPath(dtmi)\r\n const dtmiPathFormatted = tryFromExpanded ? dtmiPath.replace('.json', '.expanded.json') : dtmiPath\r\n const targetPath = path.join(directory, dtmiPathFormatted)\r\n const dtdlFile = fs.readFileSync(targetPath, 'utf8')\r\n const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile)\r\n if (Array.isArray(parsedDtdl)) {\r\n const result = flattenDtdlResponse(parsedDtdl as DTDL[])\r\n return result\r\n } else {\r\n const result = { [dtmi]: parsedDtdl as DTDL }\r\n return result\r\n }\r\n}\r\n\r\nexport { fetcher, recursiveFetcher }\r\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js b/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js deleted file mode 100644 index 2898f21cff9b..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.modelFetcher = void 0; -const tslib_1 = require("tslib"); -const fs = tslib_1.__importStar(require("fs")); -const url = tslib_1.__importStar(require("url")); -const localFetchers = tslib_1.__importStar(require("./localModelFetchers")); -const remoteFetchers = tslib_1.__importStar(require("./remoteModelFetchers")); -function isLocalPath(p) { - if (p.startsWith("https://") || p.startsWith("http://")) { - return false; - } else if (p.startsWith("file://")) { - return true; - } else { - try { - fs.accessSync(p); - return true; - } catch (_a) { - return false; - } - } -} -function modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - if (isLocalPath(endpoint)) { - const formattedDirectory = endpoint.includes("file://") - ? url.fileURLToPath(endpoint) - : endpoint; - if (tryFromExpanded || resolveDependencies) { - return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded); - } else { - console.log(`Fetching: ${dtmi}`); - return localFetchers.fetcher(dtmi, formattedDirectory, false); - } - } else { - if (tryFromExpanded || resolveDependencies) { - return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded); - } - console.log(`Fetching: ${dtmi}`); - return remoteFetchers.fetcher(dtmi, endpoint, false); - } - }); -} -exports.modelFetcher = modelFetcher; -//# sourceMappingURL=modelFetcherHandler.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js.map deleted file mode 100644 index b9e923c830d0..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"modelFetcherHandler.js","sourceRoot":"","sources":["../../src/modelFetcherHandler.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;;AAEZ,+CAAwB;AACxB,iDAA0B;AAC1B,4EAAqD;AACrD,8EAAuD;AAEvD,SAAS,WAAW,CAAE,CAAS;IAC7B,IAAI,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QACvD,OAAO,KAAK,CAAA;KACb;SAAM,IAAI,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAClC,OAAO,IAAI,CAAA;KACZ;SAAM;QACL,IAAI;YACF,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;YAChB,OAAO,IAAI,CAAA;SACZ;QAAC,WAAM;YACN,OAAO,KAAK,CAAA;SACb;KACF;AACH,CAAC;AAED,SAAsB,YAAY,CAAE,IAAY,EAAE,QAAgB,EAAE,mBAA4B,EAAE,eAAwB;;QACxH,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE;YACzB,MAAM,kBAAkB,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;YAChG,IAAI,eAAe,IAAI,mBAAmB,EAAE;gBAC1C,OAAO,aAAa,CAAC,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,EAAE,eAAe,CAAC,CAAA;aACjF;iBAAM;gBACL,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;gBAChC,OAAO,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAAA;aAC9D;SACF;aAAM;YACL,IAAI,eAAe,IAAI,mBAAmB,EAAE;gBAC1C,OAAO,cAAc,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAA;aACxE;YACD,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;YAChC,OAAO,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;SACrD;IACH,CAAC;CAAA;AAhBD,oCAgBC","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nimport * as fs from 'fs'\r\nimport * as url from 'url'\r\nimport * as localFetchers from './localModelFetchers'\r\nimport * as remoteFetchers from './remoteModelFetchers'\r\n\r\nfunction isLocalPath (p: string): boolean {\r\n if (p.startsWith('https://') || p.startsWith('http://')) {\r\n return false\r\n } else if (p.startsWith('file://')) {\r\n return true\r\n } else {\r\n try {\r\n fs.accessSync(p)\r\n return true\r\n } catch {\r\n return false\r\n }\r\n }\r\n}\r\n\r\nexport async function modelFetcher (dtmi: string, endpoint: string, resolveDependencies: boolean, tryFromExpanded: boolean): Promise<{ [dtmi: string]: JSON | Array }> {\r\n if (isLocalPath(endpoint)) {\r\n const formattedDirectory = endpoint.includes('file://') ? url.fileURLToPath(endpoint) : endpoint\r\n if (tryFromExpanded || resolveDependencies) {\r\n return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded)\r\n } else {\r\n console.log(`Fetching: ${dtmi}`)\r\n return localFetchers.fetcher(dtmi, formattedDirectory, false)\r\n }\r\n } else {\r\n if (tryFromExpanded || resolveDependencies) {\r\n return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded)\r\n }\r\n console.log(`Fetching: ${dtmi}`)\r\n return remoteFetchers.fetcher(dtmi, endpoint, false)\r\n }\r\n}\r\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js b/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js deleted file mode 100644 index dbd97c0ed758..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.flattenDtdlResponse = void 0; -function flattenDtdlResponse(input) { - const newResult = {}; - for (let i = 0; i++; i < input.length) { - const currentDtdl = input[i]; - if (!currentDtdl["@id"]) { - throw new Error("no @id element found in DTDL. Ensure DTDL contains @id element"); - } - newResult[currentDtdl["@id"]] = currentDtdl; - } - input.forEach((element) => { - newResult[element["@id"]] = element; - }); - return newResult; -} -exports.flattenDtdlResponse = flattenDtdlResponse; -//# sourceMappingURL=modelFetcherHelper.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js.map deleted file mode 100644 index 52cda8e487bf..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/modelFetcherHelper.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"modelFetcherHelper.js","sourceRoot":"","sources":["../../src/modelFetcherHelper.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;AAIZ,SAAgB,mBAAmB,CAAE,KAAa;IAChD,MAAM,SAAS,GAAwB,EAAE,CAAA;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE;QACrC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;SACnF;QACD,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAA;KAC5C;IACD,KAAK,CAAC,OAAO,CAAC,CAAC,OAAa,EAAE,EAAE;QAC9B,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,OAAO,CAAA;IACrC,CAAC,CAAC,CAAA;IACF,OAAO,SAAS,CAAA;AAClB,CAAC;AAbD,kDAaC","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n'use strict'\n\nimport { DTDL } from './DTDL'\n\nexport function flattenDtdlResponse (input: DTDL[]) {\n const newResult: {[x: string]: DTDL} = {}\n for (let i = 0; i++; i < input.length) {\n const currentDtdl = input[i]\n if (!currentDtdl['@id']) {\n throw new Error('no @id element found in DTDL. Ensure DTDL contains @id element');\n }\n newResult[currentDtdl['@id']] = currentDtdl\n }\n input.forEach((element: DTDL) => {\n newResult[element['@id']] = element\n })\n return newResult\n}\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js b/sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js deleted file mode 100644 index 7f9445ab12e9..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getModelMetadata = void 0; -function getId(input) { - const idElement = input["@id"]; - return idElement; -} -function getExtends(input) { - const extendElement = input.extends; - return extendElement; -} -function getComponentSchemas(input) { - const componentSchemas = []; - if (input.contents) { - const contents = input.contents; - contents.forEach((element) => { - if ( - element["@type"] && - typeof element["@type"] === "string" && - element["@type"] === "Component" - ) { - if (element.schema && typeof element.schema === "string") { - componentSchemas.push(element.schema); - } - } - }); - } - return componentSchemas; -} -function getModelMetadata(input) { - const idElement = getId(input); - const extendsElement = getExtends(input); - const componentSchemas = getComponentSchemas(input); - return { - id: idElement, - extends: extendsElement, - componentSchemas: componentSchemas - }; -} -exports.getModelMetadata = getModelMetadata; -//# sourceMappingURL=modelMetadata.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js.map deleted file mode 100644 index e7f84b3e9c53..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/modelMetadata.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"modelMetadata.js","sourceRoot":"","sources":["../../src/modelMetadata.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;AAIZ,SAAS,KAAK,CAAE,KAAW;IACzB,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;IAC9B,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,UAAU,CAAE,KAAW;IAC9B,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAA;IACnC,OAAO,aAAa,CAAA;AACtB,CAAC;AAED,SAAS,mBAAmB,CAAE,KAAW;IACvC,MAAM,gBAAgB,GAAa,EAAE,CAAA;IACrC,IAAI,KAAK,CAAC,QAAQ,EAAE;QAClB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAA;QAC/B,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3B,IAAI,OAAO,CAAC,OAAO,CAAC;gBACd,CAAC,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;gBACtC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,EAAE;gBACxC,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;oBACxD,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;iBACtC;aACF;QACH,CAAC,CAAC,CAAA;KACH;IACD,OAAO,gBAAgB,CAAA;AACzB,CAAC;AAED,SAAgB,gBAAgB,CAAE,KAAW;IAC3C,MAAM,SAAS,GAAW,KAAK,CAAC,KAAK,CAAC,CAAA;IACtC,MAAM,cAAc,GAAW,UAAU,CAAC,KAAK,CAAC,CAAA;IAChD,MAAM,gBAAgB,GAAa,mBAAmB,CAAC,KAAK,CAAC,CAAA;IAC7D,OAAO;QACL,EAAE,EAAE,SAAS;QACb,OAAO,EAAE,cAAc;QACvB,gBAAgB,EAAE,gBAAgB;KACnC,CAAA;AACH,CAAC;AATD,4CASC","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nimport { DTDL } from './DTDL'\r\n\r\nfunction getId (input: DTDL): string {\r\n const idElement = input['@id']\r\n return idElement\r\n}\r\n\r\nfunction getExtends (input: DTDL): string {\r\n const extendElement = input.extends\r\n return extendElement\r\n}\r\n\r\nfunction getComponentSchemas (input: DTDL): string[] {\r\n const componentSchemas: string[] = []\r\n if (input.contents) {\r\n const contents = input.contents\r\n contents.forEach((element) => {\r\n if (element['@type'] &&\r\n (typeof element['@type'] === 'string') &&\r\n (element['@type'] === 'Component')) {\r\n if (element.schema && typeof element.schema === 'string') {\r\n componentSchemas.push(element.schema)\r\n }\r\n }\r\n })\r\n }\r\n return componentSchemas\r\n}\r\n\r\nexport function getModelMetadata (input: DTDL) {\r\n const idElement: string = getId(input)\r\n const extendsElement: string = getExtends(input)\r\n const componentSchemas: string[] = getComponentSchemas(input)\r\n return {\r\n id: idElement,\r\n extends: extendsElement,\r\n componentSchemas: componentSchemas\r\n }\n}\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js b/sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js deleted file mode 100644 index be12a565fb8b..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.recursiveFetcher = exports.fetcher = void 0; -const tslib_1 = require("tslib"); -const dtmiConventions = tslib_1.__importStar(require("./dtmiConventions")); -const modelMetadata = tslib_1.__importStar(require("./modelMetadata")); -const coreHttp = tslib_1.__importStar(require("@azure/core-http")); -const modelFetcherHelper_1 = require("./modelFetcherHelper"); -function recursiveFetcher(dtmi, endpoint, tryFromExpanded) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - let dependencyModels = {}; - let fetchedModels; - try { - console.log(`Fetching: ${dtmi}`); - fetchedModels = yield fetcher(dtmi, endpoint, tryFromExpanded); - } catch (error) { - if ( - tryFromExpanded && - (error.code === "ENOENT" || !(error.statusCode >= 200 && error.statusCode < 400)) - ) { - console.log("Fetching from expanded failed. Trying without."); - console.log(`Fetching: ${dtmi}`); - fetchedModels = yield fetcher(dtmi, endpoint, false); - } else { - throw error; - } - } - const dtmis = Object.keys(fetchedModels); - for (let i = 0; i < dtmis.length; i++) { - const currentDtdl = fetchedModels[dtmis[i]]; - const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas; - if (deps && deps.length > 0) { - for (let j = 0; j < deps.length; j++) { - if ( - Object.keys(dependencyModels).includes(deps[j]) || - Object.keys(fetchedModels).includes(deps[j]) - ) { - // do nothing - } else { - const fetchedDependencies = yield recursiveFetcher(deps[j], endpoint, tryFromExpanded); - dependencyModels = Object.assign( - Object.assign({}, dependencyModels), - fetchedDependencies - ); - } - } - } - } - if (Object.keys(dependencyModels).length > 0) { - fetchedModels = Object.assign(Object.assign({}, fetchedModels), dependencyModels); - } - return fetchedModels; - }); -} -exports.recursiveFetcher = recursiveFetcher; -function fetcher(dtmi, endpoint, tryFromExpanded) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const client = new coreHttp.ServiceClient(); - const req = { - url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), - method: "GET" - }; - const res = yield client.sendRequest(req); - if (res.status >= 200 && res.status < 400) { - const dtdlAsString = res.bodyAsText || ""; - const parsedDtdl = JSON.parse(dtdlAsString); - if (Array.isArray(parsedDtdl)) { - const result = modelFetcherHelper_1.flattenDtdlResponse(parsedDtdl); - return result; - } else { - const result = { [dtmi]: parsedDtdl }; - return result; - } - } else { - throw new coreHttp.RestError( - "Error on HTTP Request in remote model fetcher", - "404", - 404, - undefined, - res - ); - } - }); -} -exports.fetcher = fetcher; -//# sourceMappingURL=remoteModelFetchers.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js.map deleted file mode 100644 index 7819575d29b9..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/remoteModelFetchers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"remoteModelFetchers.js","sourceRoot":"","sources":["../../src/remoteModelFetchers.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;;AAEZ,2EAAoD;AACpD,uEAAgD;AAChD,mEAA4C;AAE5C,6DAA0D;AAE1D,SAAe,gBAAgB,CAAE,IAAY,EAAE,QAAgB,EAAE,eAAwB;;QACvF,IAAI,gBAAgB,GAAuB,EAAE,CAAA;QAC7C,IAAI,aAAmC,CAAA;QACvC,IAAI;YACF,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;YAChC,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAA;SAC/D;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,eAAe,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,UAAU,IAAI,GAAG,IAAI,KAAK,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,EAAE;gBACxG,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAA;gBAC7D,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;gBAChC,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;aACrD;iBAAM;gBACL,MAAM,KAAK,CAAA;aACZ;SACF;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC3C,MAAM,IAAI,GAAG,aAAa,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,gBAAgB,CAAA;YACzE,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpC,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;wBACnG,aAAa;qBACd;yBAAM;wBACL,MAAM,mBAAmB,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAA;wBACtF,gBAAgB,mCAAQ,gBAAgB,GAAK,mBAAmB,CAAE,CAAA;qBACnE;iBACF;aACF;SACF;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5C,aAAa,mCAAQ,aAAa,GAAK,gBAAgB,CAAE,CAAA;SAC1D;QACD,OAAO,aAAa,CAAA;IACtB,CAAC;CAAA;AAwBiB,4CAAgB;AAtBlC,SAAe,OAAO,CAAE,IAAY,EAAE,QAAgB,EAAE,eAAwB;;QAC9E,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAA;QAC3C,MAAM,GAAG,GAAmC;YAC1C,GAAG,EAAE,eAAe,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,CAAC;YACzE,MAAM,EAAE,KAAK;SACd,CAAA;QACD,MAAM,GAAG,GAAmC,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QACzE,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE;YACzC,MAAM,YAAY,GAAG,GAAG,CAAC,UAAU,IAAI,EAAE,CAAA;YACzC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;gBAC7B,MAAM,MAAM,GAAG,wCAAmB,CAAC,UAAoB,CAAC,CAAA;gBACxD,OAAO,MAAM,CAAA;aACd;iBAAM;gBACL,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,UAAkB,EAAE,CAAA;gBAC7C,OAAO,MAAM,CAAA;aACd;SACF;aAAM;YACL,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,+CAA+C,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,CAAC,CAAA;SAC1G;IACH,CAAC;CAAA;AAEQ,0BAAO","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nimport * as dtmiConventions from './dtmiConventions'\r\nimport * as modelMetadata from './modelMetadata'\r\nimport * as coreHttp from '@azure/core-http'\r\nimport { DTDL } from './DTDL'\r\nimport { flattenDtdlResponse } from './modelFetcherHelper'\r\n\r\nasync function recursiveFetcher (dtmi: string, endpoint: string, tryFromExpanded: boolean): Promise<{[dtmi: string]: DTDL }> {\r\n let dependencyModels: {[x:string]: DTDL} = {}\r\n let fetchedModels: {[x: string]: DTDL }\r\n try {\r\n console.log(`Fetching: ${dtmi}`)\r\n fetchedModels = await fetcher(dtmi, endpoint, tryFromExpanded)\r\n } catch (error) {\r\n if (tryFromExpanded && (error.code === 'ENOENT' || !(error.statusCode >= 200 && error.statusCode < 400))) {\r\n console.log('Fetching from expanded failed. Trying without.')\r\n console.log(`Fetching: ${dtmi}`)\r\n fetchedModels = await fetcher(dtmi, endpoint, false)\r\n } else {\r\n throw error\r\n }\r\n }\r\n const dtmis = Object.keys(fetchedModels)\r\n for (let i = 0; i < dtmis.length; i++) {\r\n const currentDtdl = fetchedModels[dtmis[i]]\r\n const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas\r\n if (deps && deps.length > 0) {\r\n for (let j = 0; j < deps.length; j++) {\r\n if (Object.keys(dependencyModels).includes(deps[j]) || Object.keys(fetchedModels).includes(deps[j])) {\r\n // do nothing\r\n } else {\r\n const fetchedDependencies = await recursiveFetcher(deps[j], endpoint, tryFromExpanded)\r\n dependencyModels = { ...dependencyModels, ...fetchedDependencies }\r\n }\r\n }\r\n }\r\n }\r\n if (Object.keys(dependencyModels).length > 0) {\r\n fetchedModels = { ...fetchedModels, ...dependencyModels }\r\n }\r\n return fetchedModels\r\n}\r\n\r\nasync function fetcher (dtmi: string, endpoint: string, tryFromExpanded: boolean): Promise<{[dtmi: string]: any }> {\r\n const client = new coreHttp.ServiceClient()\r\n const req: coreHttp.RequestPrepareOptions = {\r\n url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded),\r\n method: 'GET'\r\n }\r\n const res: coreHttp.HttpOperationResponse = await client.sendRequest(req)\r\n if (res.status >= 200 && res.status < 400) {\r\n const dtdlAsString = res.bodyAsText || ''\r\n const parsedDtdl = JSON.parse(dtdlAsString)\r\n if (Array.isArray(parsedDtdl)) {\r\n const result = flattenDtdlResponse(parsedDtdl as DTDL[])\r\n return result\r\n } else {\r\n const result = { [dtmi]: parsedDtdl as DTDL }\r\n return result\r\n }\r\n } else {\r\n throw new coreHttp.RestError('Error on HTTP Request in remote model fetcher', '404', 404, undefined, res)\r\n }\r\n}\r\n\r\nexport { fetcher, recursiveFetcher }\r\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js b/sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js deleted file mode 100644 index c21c3d319946..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.resolve = void 0; -const modelFetcherHandler_1 = require("./modelFetcherHandler"); -function checkIfTryFromExpanded(options) { - if (options && options.resolveDependencies && options.resolveDependencies === "tryFromExpanded") { - return true; - } - return false; -} -function checkIfResolveDependencies(options) { - if (options && options.resolveDependencies && options.resolveDependencies === "enabled") { - return true; - } - return false; -} -function resolve(dtmi, endpoint, options) { - const tryFromExpanded = checkIfTryFromExpanded(options); - const resolveDependencies = checkIfResolveDependencies(options); - return modelFetcherHandler_1.modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded); -} -exports.resolve = resolve; -//# sourceMappingURL=resolver.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js.map b/sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js.map deleted file mode 100644 index 007d3037d947..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/src/resolver.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/resolver.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AAErG,YAAY,CAAA;;;AAEZ,+DAAoD;AAMpD,SAAS,sBAAsB,CAAE,OAAyB;IACxD,IAAI,OAAO,IAAI,OAAO,CAAC,mBAAmB,IAAI,OAAO,CAAC,mBAAmB,KAAK,iBAAiB,EAAE;QAC/F,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,0BAA0B,CAAE,OAAyB;IAC5D,IAAI,OAAO,IAAI,OAAO,CAAC,mBAAmB,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE;QACvF,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAaD,SAAS,OAAO,CAAE,IAAY,EAAE,QAAiB,EAAE,OAA0B;IAC3E,MAAM,eAAe,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAA;IACvD,MAAM,mBAAmB,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAA;IAE/D,OAAO,kCAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,mBAAmB,EAAE,eAAe,CAAC,CAAA;AAC3E,CAAC;AAEQ,0BAAO","sourcesContent":["// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\r\n\r\n'use strict'\r\n\r\nimport { modelFetcher } from './modelFetcherHandler'\r\n\r\ninterface resolverOptions {\r\n resolveDependencies: 'disabled' | 'enabled' | 'tryFromExpanded'\r\n}\r\n\r\nfunction checkIfTryFromExpanded (options?: resolverOptions): boolean {\r\n if (options && options.resolveDependencies && options.resolveDependencies === 'tryFromExpanded') {\r\n return true\r\n }\r\n return false\r\n}\r\n\r\nfunction checkIfResolveDependencies (options?: resolverOptions): boolean {\r\n if (options && options.resolveDependencies && options.resolveDependencies === 'enabled') {\r\n return true\r\n }\r\n return false\r\n}\r\n\r\n/**\r\n * resolve - get interfaces (dtdls) associated to a given dtmi\r\n *\r\n * @param dtmi code used to label and organize dtdl\r\n * @param endpoint URL or local path for dtdl repository\r\n * @param options object containing optional parameters\r\n *\r\n * @returns Promise that resolves to mapping of dtmi(s) to JSON dtdl(s)\r\n */\r\nfunction resolve(dtmi: string, endpoint: string): Promise<{ [dtmi: string]: any}>\r\nfunction resolve(dtmi: string, endpoint: string, options: resolverOptions): Promise<{ [dtmi: string]: any}>\r\nfunction resolve (dtmi: string, endpoint : string, options ?: resolverOptions): Promise<{ [dtmi: string]:any}> {\r\n const tryFromExpanded = checkIfTryFromExpanded(options)\r\n const resolveDependencies = checkIfResolveDependencies(options)\r\n\r\n return modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded)\r\n}\r\n\r\nexport { resolve }\r\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js b/sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js deleted file mode 100644 index 1c4b79b8a370..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const lib = tslib_1.__importStar(require("../../src")); -const chai_1 = require("chai"); -const sinon = tslib_1.__importStar(require("sinon")); -describe("resolver - browser", () => { - afterEach(() => { - sinon.restore(); - }); - describe("single resolution (no pseudo-parsing)", () => { - it.only("integration works in browser", function(done) { - const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const endpoint = "https://devicemodels.azure.com"; - const fakeData = JSON.stringify({ - fakeDtdl: "fakeBodyAsText" - }); - const resolveResult = lib.resolve(dtmi, endpoint); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepStrictEqual({ [dtmi]: JSON.parse(fakeData) }, actualOutput); - done(); - }) - .catch((err) => done(err)); - }); - }); -}); -//# sourceMappingURL=browserTest.spec.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js.map b/sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js.map deleted file mode 100644 index e749d9a73714..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/test/browser/browserTest.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browserTest.spec.js","sourceRoot":"","sources":["../../../test/browser/browserTest.spec.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,uDAAgC;AAEhC,+BAA6B;AAC7B,qDAA8B;AAE9B,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;QACrD,EAAE,CAAC,IAAI,CAAC,8BAA8B,EAAE,UAAU,IAAI;YACpD,MAAM,IAAI,GAAW,iDAAiD,CAAA;YACtE,MAAM,QAAQ,GAAG,gCAAgC,CAAA;YACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;gBAC9B,QAAQ,EAAE,gBAAgB;aAC3B,CAAC,CAAA;YACF,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;YACjD,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;gBACvC,aAAM,CAAC,eAAe,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,CAAA;gBACtE,IAAI,EAAE,CAAA;YACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QACnC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport * as lib from '../../src'\r\n\r\nimport { assert } from 'chai'\r\nimport * as sinon from 'sinon'\r\n\r\ndescribe('resolver - browser', () => {\r\n afterEach(() => {\r\n sinon.restore()\r\n })\r\n\r\n describe('single resolution (no pseudo-parsing)', () => {\r\n it.only('integration works in browser', function (done) {\r\n const dtmi: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const endpoint = 'https://devicemodels.azure.com'\r\n const fakeData = JSON.stringify({\r\n fakeDtdl: 'fakeBodyAsText'\r\n })\r\n const resolveResult = lib.resolve(dtmi, endpoint)\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual({ [dtmi]: JSON.parse(fakeData) }, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n})\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js b/sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js deleted file mode 100644 index f890b4f0f14e..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js +++ /dev/null @@ -1,161 +0,0 @@ -"use strict"; -/* eslint-disable no-undef */ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const lib = tslib_1.__importStar(require("../../src/dtmiConventions")); -// fake class while lib not implemented -const sinon = tslib_1.__importStar(require("sinon")); -const chai_1 = require("chai"); -const validParameters = [ - { - dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;1", - path: "dtmi/azure/devicemanagement/deviceinformation-1.json", - url: "https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json" - }, - { - dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;10000", - path: "dtmi/azure/devicemanagement/deviceinformation-10000.json", - url: "https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-10000.json" - }, - { - dtmi: "dtmi:com:DeviceInformation;1", - path: "dtmi/com/deviceinformation-1.json", - url: "https://contoso.com/dtmi/com/deviceinformation-1.json" - }, - { - dtmi: "dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1", - path: "dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json", - url: "https://contoso.com/dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json" - }, - { - dtmi: "dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7", - path: "dtmi/azure/devicemanagement/thermometer-7.json", - url: "https://contoso.com/dtmi/azure/devicemanagement/thermometer-7.json" - }, - { - dtmi: "dtmi:thermometer;2", - path: "dtmi/thermometer-2.json", - url: "https://contoso.com/dtmi/thermometer-2.json" - } -]; -const invalidParameters = [ - { dtmi: "dtmiazure:DeviceManagement:DeviceInformation;1" }, - { dtmi: "dtmi;azure;DeviceManagement;DeviceInformation;1" }, - { dtmi: "asdf" }, - { dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;-1" }, - { dtmi: "dtmi:azure:DeviceManagement:Device-Information;1" }, - { dtmi: "DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7" }, - { dtmi: "dmti:azure:thermometer;10" } -]; -describe("dtmiConventions", function() { - afterEach(function() { - sinon.restore(); - }); - describe("isValidDtmi", function() { - describe("valid", function() { - function validTest(givenDtmi) { - const result = lib.isValidDtmi(givenDtmi); - chai_1.assert(result, "valid dtmi not found as valid"); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should validate a correctly formatted dtmi (${validParameters[i].dtmi})`, function() { - validTest(validParameters[i].dtmi); - }); - } - }); - describe("invalid", function() { - function invalidTest(givenDtmi) { - const result = lib.isValidDtmi(givenDtmi); - chai_1.assert(!result, "invalid dtmi incorrectly labelled as valid"); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should invalidate incorrectly formatted dtmi (${invalidParameters[i].dtmi})`, function() { - invalidTest(invalidParameters[i].dtmi); - }); - } - }); - }); - describe("dtmiToPath", function() { - describe("valid", function() { - function validTest(givenDtmi, expectedPath) { - const result = lib.dtmiToPath(givenDtmi); - chai_1.assert.deepEqual(result, expectedPath); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a generic path (${validParameters[i].dtmi})`, function() { - validTest(validParameters[i].dtmi, validParameters[i].path); - }); - } - }); - describe("invalid", function() { - function invalidTest(givenDtmi) { - chai_1 - .expect(() => { - lib.dtmiToPath(givenDtmi); - }) - .to.throw("DTMI provided is invalid. Ensure it follows DTMI conventions."); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function() { - invalidTest(invalidParameters[i].dtmi); - }); - } - }); - }); - describe("dtmiToFullyQualifiedPath", function() { - describe("invalid", function() { - function invalidTest(givenDtmi) { - chai_1 - .expect(() => { - const fakeBasePath = "https://contoso.com"; - lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); - }) - .to.throw("DTMI provided is invalid. Ensure it follows DTMI conventions."); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function() { - invalidTest(invalidParameters[i].dtmi); - }); - } - }); - describe("valid", function() { - describe("standard url", function() { - function reformatTest(givenDtmi, expected) { - const fakeBasePath = "https://contoso.com"; - const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); - chai_1.assert.deepEqual(result, expected); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a qualified path (${validParameters[i].dtmi})`, function() { - reformatTest(validParameters[i].dtmi, validParameters[i].url); - }); - } - }); - describe("expanded url", function() { - function addExpandedTest(givenDtmi, expected) { - const fakeBasePath = "https://contoso.com"; - const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, true); - chai_1.assert.deepEqual(result, expected); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a qualified path with expanded.json (${validParameters[i].dtmi})`, function() { - addExpandedTest( - validParameters[i].dtmi, - validParameters[i].url.replace(".json", ".expanded.json") - ); - }); - } - }); - }); - }); -}); -//# sourceMappingURL=dtmiConventions.spec.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js.map b/sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js.map deleted file mode 100644 index 42ca798c28be..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/test/node/dtmiConventions.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dtmiConventions.spec.js","sourceRoot":"","sources":["../../../test/node/dtmiConventions.spec.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,uCAAuC;AACvC,kCAAkC;;;AAElC,uEAAgD;AAEhD,uCAAuC;AACvC,qDAA8B;AAC9B,+BAAqC;AAQrC,MAAM,eAAe,GAAkB;IACrC;QACE,IAAI,EAAE,iDAAiD;QACvD,IAAI,EAAE,sDAAsD;QAC5D,GAAG,EAAE,0EAA0E;KAChF;IACD;QACE,IAAI,EAAE,qDAAqD;QAC3D,IAAI,EAAE,0DAA0D;QAChE,GAAG,EAAE,8EAA8E;KACpF;IACD;QACE,IAAI,EAAE,8BAA8B;QACpC,IAAI,EAAE,mCAAmC;QACzC,GAAG,EAAE,uDAAuD;KAC7D;IACD;QACE,IAAI,EAAE,sDAAsD;QAC5D,IAAI,EAAE,2DAA2D;QACjE,GAAG,EAAE,+EAA+E;KACrF;IACD;QACE,IAAI,EAAE,2CAA2C;QACjD,IAAI,EAAE,gDAAgD;QACtD,GAAG,EAAE,oEAAoE;KAC1E;IACD;QACE,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,yBAAyB;QAC/B,GAAG,EAAE,6CAA6C;KACnD;CAEF,CAAA;AAED,MAAM,iBAAiB,GAAqB;IAC1C,EAAE,IAAI,EAAE,gDAAgD,EAAE;IAC1D,EAAE,IAAI,EAAE,iDAAiD,EAAE;IAC3D,EAAE,IAAI,EAAE,MAAM,EAAE;IAChB,EAAE,IAAI,EAAE,kDAAkD,EAAE;IAC5D,EAAE,IAAI,EAAE,kDAAkD,EAAE;IAC5D,EAAE,IAAI,EAAE,2CAA2C,EAAE;IACrD,EAAE,IAAI,EAAE,2BAA2B,EAAE;CACtC,CAAA;AAED,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,SAAS,CAAC;QACR,KAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,aAAa,EAAE;QACtB,QAAQ,CAAC,OAAO,EAAE;YAChB,SAAS,SAAS,CAAE,SAAiB;gBACnC,MAAM,MAAM,GAAG,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACzC,aAAM,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAA;YACjD,CAAC;YACD,sDAAsD;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/C,EAAE,CAAC,+CAA+C,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,cAAc,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;aAClI;QACH,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,SAAS,EAAE;YAClB,SAAS,WAAW,CAAE,SAAiB;gBACrC,MAAM,MAAM,GAAG,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACzC,aAAM,CAAC,CAAC,MAAM,EAAE,4CAA4C,CAAC,CAAA;YAC/D,CAAC;YACD,sDAAsD;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACjD,EAAE,CAAC,iDAAiD,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,cAAc,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;aAC1I;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,YAAY,EAAE;QACrB,QAAQ,CAAC,OAAO,EAAE;YAChB,SAAS,SAAS,CAAE,SAAiB,EAAE,YAAoB;gBACzD,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;gBACxC,aAAM,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;YACxC,CAAC;YACD,sDAAsD;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/C,EAAE,CAAC,6CAA6C,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EACxE;oBACE,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;gBAC7D,CAAC,CAAC,CAAA;aACL;QACH,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,SAAS,EAAE;YAClB,SAAS,WAAW,CAAE,SAAiB;gBACrC,aAAM,CAAC,GAAG,EAAE;oBACV,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;gBAC3B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAC9E,CAAC;YACD,sDAAsD;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACjD,EAAE,CAAC,uDAAuD,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,cAAc,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;aAChJ;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,0BAA0B,EAAE;QACnC,QAAQ,CAAC,SAAS,EAAE;YAClB,SAAS,WAAW,CAAE,SAAiB;gBACrC,aAAM,CAAC,GAAG,EAAE;oBACV,MAAM,YAAY,GAAG,qBAAqB,CAAA;oBAC1C,GAAG,CAAC,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;gBACzD,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAC9E,CAAC;YACD,sDAAsD;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACjD,EAAE,CAAC,uDAAuD,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,cAAc,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;aAChJ;QACH,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,OAAO,EAAE;YAChB,QAAQ,CAAC,cAAc,EAAE;gBACvB,SAAS,YAAY,CAAE,SAAiB,EAAE,QAAgB;oBACxD,MAAM,YAAY,GAAG,qBAAqB,CAAA;oBAC1C,MAAM,MAAM,GAAG,GAAG,CAAC,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;oBACtE,aAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;gBACpC,CAAC;gBACD,sDAAsD;gBACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAC/C,EAAE,CAAC,+CAA+C,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAC1E;wBACE,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;oBAC/D,CAAC,CAAC,CAAA;iBACL;YACH,CAAC,CAAC,CAAA;YAEF,QAAQ,CAAC,cAAc,EAAE;gBACvB,SAAS,eAAe,CAAE,SAAiB,EAAE,QAAgB;oBAC3D,MAAM,YAAY,GAAG,qBAAqB,CAAA;oBAC1C,MAAM,MAAM,GAAG,GAAG,CAAC,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;oBACrE,aAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;gBACpC,CAAC;gBAED,sDAAsD;gBACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAC/C,EAAE,CAAC,kEAAkE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAC7F;wBACE,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAA;oBACrG,CAAC,CAAC,CAAA;iBACL;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/* eslint-disable no-undef */\r\n// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport * as lib from '../../src/dtmiConventions'\r\n\r\n// fake class while lib not implemented\r\nimport * as sinon from 'sinon'\r\nimport { assert, expect } from 'chai'\r\n\r\ninterface ValidParams {\r\n dtmi: string,\r\n path: string,\r\n url: string\r\n}\r\n\r\nconst validParameters: ValidParams[] = [\r\n {\r\n dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;1',\r\n path: 'dtmi/azure/devicemanagement/deviceinformation-1.json',\r\n url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json'\r\n },\r\n {\r\n dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;10000',\r\n path: 'dtmi/azure/devicemanagement/deviceinformation-10000.json',\r\n url: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-10000.json'\r\n },\r\n {\r\n dtmi: 'dtmi:com:DeviceInformation;1',\r\n path: 'dtmi/com/deviceinformation-1.json',\r\n url: 'https://contoso.com/dtmi/com/deviceinformation-1.json'\r\n },\r\n {\r\n dtmi: 'dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1',\r\n path: 'dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json',\r\n url: 'https://contoso.com/dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json'\r\n },\r\n {\r\n dtmi: 'dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7',\r\n path: 'dtmi/azure/devicemanagement/thermometer-7.json',\r\n url: 'https://contoso.com/dtmi/azure/devicemanagement/thermometer-7.json'\r\n },\r\n {\r\n dtmi: 'dtmi:thermometer;2',\r\n path: 'dtmi/thermometer-2.json',\r\n url: 'https://contoso.com/dtmi/thermometer-2.json'\r\n }\r\n\r\n]\r\n\r\nconst invalidParameters: {dtmi: string}[] = [\r\n { dtmi: 'dtmiazure:DeviceManagement:DeviceInformation;1' },\r\n { dtmi: 'dtmi;azure;DeviceManagement;DeviceInformation;1' },\r\n { dtmi: 'asdf' },\r\n { dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;-1' },\r\n { dtmi: 'dtmi:azure:DeviceManagement:Device-Information;1' },\r\n { dtmi: 'DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7' },\r\n { dtmi: 'dmti:azure:thermometer;10' }\r\n]\r\n\r\ndescribe('dtmiConventions', function () {\r\n afterEach(function () {\r\n sinon.restore()\r\n })\r\n\r\n describe('isValidDtmi', function () {\r\n describe('valid', function () {\r\n function validTest (givenDtmi: string) {\r\n const result = lib.isValidDtmi(givenDtmi)\r\n assert(result, 'valid dtmi not found as valid')\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < validParameters.length; i++) {\r\n it(`should validate a correctly formatted dtmi (${validParameters[i].dtmi})`, function () { validTest(validParameters[i].dtmi) })\r\n }\r\n })\r\n\r\n describe('invalid', function () {\r\n function invalidTest (givenDtmi: string) {\r\n const result = lib.isValidDtmi(givenDtmi)\r\n assert(!result, 'invalid dtmi incorrectly labelled as valid')\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < invalidParameters.length; i++) {\r\n it(`should invalidate incorrectly formatted dtmi (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) })\r\n }\r\n })\r\n })\r\n\r\n describe('dtmiToPath', function () {\r\n describe('valid', function () {\r\n function validTest (givenDtmi: string, expectedPath: string) {\r\n const result = lib.dtmiToPath(givenDtmi)\r\n assert.deepEqual(result, expectedPath)\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < validParameters.length; i++) {\r\n it(`should reformat a DTMI to a generic path (${validParameters[i].dtmi})`,\r\n function () {\r\n validTest(validParameters[i].dtmi, validParameters[i].path)\r\n })\r\n }\r\n })\r\n\r\n describe('invalid', function () {\r\n function invalidTest (givenDtmi: string) {\r\n expect(() => {\r\n lib.dtmiToPath(givenDtmi)\r\n }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.')\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < invalidParameters.length; i++) {\r\n it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) })\r\n }\r\n })\r\n })\r\n\r\n describe('dtmiToFullyQualifiedPath', function () {\r\n describe('invalid', function () {\r\n function invalidTest (givenDtmi: string) {\r\n expect(() => {\r\n const fakeBasePath = 'https://contoso.com'\r\n lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false)\r\n }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.')\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < invalidParameters.length; i++) {\r\n it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function () { invalidTest(invalidParameters[i].dtmi) })\r\n }\r\n })\r\n\r\n describe('valid', function () {\r\n describe('standard url', function () {\r\n function reformatTest (givenDtmi: string, expected: string) {\r\n const fakeBasePath = 'https://contoso.com'\r\n const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false)\r\n assert.deepEqual(result, expected)\r\n }\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < validParameters.length; i++) {\r\n it(`should reformat a DTMI to a qualified path (${validParameters[i].dtmi})`,\r\n function () {\r\n reformatTest(validParameters[i].dtmi, validParameters[i].url)\r\n })\r\n }\r\n })\r\n\r\n describe('expanded url', function () {\r\n function addExpandedTest (givenDtmi: string, expected: string) {\r\n const fakeBasePath = 'https://contoso.com'\r\n const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, true)\r\n assert.deepEqual(result, expected)\r\n }\r\n\r\n // eslint-disable-next-line mocha/no-setup-in-describe\r\n for (let i = 0; i < validParameters.length; i++) {\r\n it(`should reformat a DTMI to a qualified path with expanded.json (${validParameters[i].dtmi})`,\r\n function () {\r\n addExpandedTest(validParameters[i].dtmi, validParameters[i].url.replace('.json', '.expanded.json'))\r\n })\r\n }\r\n })\r\n })\r\n })\r\n})\r\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js b/sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js deleted file mode 100644 index c81597c5170d..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js +++ /dev/null @@ -1,472 +0,0 @@ -"use strict"; -/* eslint-disable no-undef */ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const resolverTool = tslib_1.__importStar(require("../../src")); -const coreHttp = tslib_1.__importStar(require("@azure/core-http")); -const fs = tslib_1.__importStar(require("fs")); -const chai_1 = require("chai"); -const sinon = tslib_1.__importStar(require("sinon")); -const path = tslib_1.__importStar(require("path")); -describe("resolver - node", function() { - afterEach(function() { - sinon.restore(); - }); - describe("remote URL resolution", function() { - describe("simple DTDL resolution", function() { - it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - const fakeDtmi = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; - const fakeEndpoint = "devicemodels.contoso.com"; - const expectedUri = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; - const fakeData = JSON.stringify({ - fakeDtdl: "fakeBodyAsText" - }); - sinon.stub(coreHttp, "ServiceClient").returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri, - "URL not formatted for request correctly." - ); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint); - chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); - done(); - }) - .catch((err) => done(err)); - }); - }); - describe("depenency resolution (using pseudo-parsing)", function() { - it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - const fakeDtmi = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; - const fakeEndpoint = "devicemodels.contoso.com"; - const expectedUri = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; - const fakeData = JSON.stringify({ - fakeKey: "fakeValue" - }); - sinon.stub(coreHttp, "ServiceClient").returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri, - "URL not formatted for request correctly." - ); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { - resolveDependencies: "enabled" - }); - chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); - done(); - }) - .catch((err) => done(err)); - }); - it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { - const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - const fakeDtmi2 = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - const fakeDtmi3 = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const fakeEndpoint = "devicemodels.contoso.com"; - const expectedUri = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; - const expectedUri2 = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; - const expectedUri3 = - "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - ); - const fakeData = fs.readFileSync(pathToDtdl).toString(); - const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); - const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); - const expectedOutput = { - [fakeDtmi1]: JSON.parse(fakeData), - [fakeDtmi2]: JSON.parse(fakeData2), - [fakeDtmi3]: JSON.parse(fakeData3) - }; - const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); - serviceClientStub.onFirstCall().returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri, - "URL not formatted for request correctly." - ); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - serviceClientStub.onSecondCall().returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri2, - "URL not formatted for request correctly." - ); - return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); - } - }); - serviceClientStub.onThirdCall().returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri3, - "URL not formatted for request correctly." - ); - return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { - resolveDependencies: "enabled" - }); - chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepEqual( - Object.keys(actualOutput), - Object.keys(expectedOutput), - "dtmis in actual output do not align with expected output" - ); - chai_1.assert.deepStrictEqual(expectedOutput, actualOutput); - done(); - }) - .catch((err) => done(err)); - }); - }); - describe("try from expanded (expanded.json)", function() { - it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - const fakeDtmi = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; - const fakeEndpoint = "devicemodels.contoso.com"; - const expectedUri = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json"; - const fakeData = `[${JSON.stringify({ - "@id": fakeDtmi, - fakeDtdl: "fakeBodyAsText" - })}]`; - sinon.stub(coreHttp, "ServiceClient").returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri, - "URL not formatted for request correctly." - ); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { - resolveDependencies: "tryFromExpanded" - }); - chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput); - done(); - }) - .catch((err) => done(err)); - }); - it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { - const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - const fakeDtmi2 = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - const fakeDtmi3 = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const fakeEndpoint = "devicemodels.contoso.com"; - const expectedUri = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; - const expectedUri2 = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; - const expectedUri3 = - "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - ); - const fakeData = fs.readFileSync(pathToDtdl).toString(); - const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); - const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); - const expectedOutput = { - [fakeDtmi1]: JSON.parse(fakeData), - [fakeDtmi2]: JSON.parse(fakeData2), - [fakeDtmi3]: JSON.parse(fakeData3) - }; - const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); - serviceClientStub.onCall(0).returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri.replace(".json", ".expanded.json"), - "URL not formatted for request correctly." - ); - return Promise.resolve({ status: 404 }); - } - }); - serviceClientStub.onCall(1).returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri, - "URL not formatted for request correctly." - ); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - serviceClientStub.onCall(2).returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri2.replace(".json", ".expanded.json"), - "URL not formatted for request correctly." - ); - return Promise.resolve({ status: 404 }); - } - }); - serviceClientStub.onCall(3).returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri2, - "URL not formatted for request correctly." - ); - return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); - } - }); - serviceClientStub.onCall(4).returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri3.replace(".json", ".expanded.json"), - "URL not formatted for request correctly." - ); - return Promise.resolve({ status: 404 }); - } - }); - serviceClientStub.onCall(5).returns({ - sendRequest: function(req) { - chai_1.assert.deepEqual( - req.url, - expectedUri3, - "URL not formatted for request correctly." - ); - return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { - resolveDependencies: "tryFromExpanded" - }); - chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepEqual( - Object.keys(actualOutput), - Object.keys(expectedOutput), - "dtmis in actual output do not align with expected output" - ); - chai_1.assert.deepStrictEqual(expectedOutput, actualOutput); - done(); - }) - .catch((err) => done(err)); - }); - }); - }); - describe("local file resolution", function() { - describe("simple DTDL resolution", function() { - it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - const fakeDtmi = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - ); - const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, "utf-8")); - const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory); - chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepStrictEqual( - { [fakeDtmi]: fakeDtdl }, - actualOutput, - "the expected dtmi mapping did not match the actual value." - ); - done(); - }) - .catch((err) => done(err)); - }); - }); - describe("dependency resolution (using pseudo-parsing)", function() { - it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { - const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - const fakeDtmi2 = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - const fakeDtmi3 = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl1 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - ); - const pathToDtdl2 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - ); - const pathToDtdl3 = path.join( - localDirectory, - "dtmi/azure/DeviceManagement/deviceinformation-1.json" - ); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); - const expectedOutput = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { - resolveDependencies: "enabled" - }); - chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepStrictEqual( - Object.keys(actualOutput), - Object.keys(expectedOutput), - "dtmis do not match" - ); - Object.keys(actualOutput).forEach((outputDtmi) => { - chai_1.assert.deepStrictEqual( - actualOutput[outputDtmi], - expectedOutput[outputDtmi], - `dtdls for given dtmi (${outputDtmi}) did not line up.` - ); - }); - chai_1.assert.deepStrictEqual( - actualOutput, - expectedOutput, - "the expected dtmi mapping did not match the actual value." - ); - done(); - }) - .catch((err) => done(err)); - }); - it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl1 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - ); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - const expectedResult = { - [fakeDtmi1]: fakeDtdl1 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory); - chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepStrictEqual( - expectedResult, - actualOutput, - "the expected dtmi mapping did not match the actual value." - ); - done(); - }) - .catch((err) => done(err)); - }); - }); - describe("try from expanded (expanded.json)", function() { - it("should return a promise that resolves to a mapping from the DTMIs to the JSON objects", function(done) { - const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - const fakeDtmi2 = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - const fakeDtmi3 = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl1 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - ); - const pathToDtdl2 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - ); - const pathToDtdl3 = path.join( - localDirectory, - "dtmi/azure/DeviceManagement/deviceinformation-1.json" - ); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); - const expectedResult = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { - resolveDependencies: "tryFromExpanded" - }); - chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepStrictEqual( - expectedResult, - actualOutput, - "the expected dtmi mapping did not match the actual value." - ); - done(); - }) - .catch((err) => done(err)); - }); - it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { - const fakeDtmi1 = "dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2"; - const fakeDtmi2 = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - const fakeDtmi3 = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl1 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json" - ); - const pathToDtdl2 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - ); - const pathToDtdl3 = path.join( - localDirectory, - "dtmi/azure/DeviceManagement/deviceinformation-1.json" - ); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); - const expectedResult = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { - resolveDependencies: "tryFromExpanded" - }); - chai_1.assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput) => { - chai_1.assert.deepEqual( - Object.keys(expectedResult), - Object.keys(actualOutput), - "the expected dtmis do not match" - ); - Object.keys(expectedResult).forEach((dtmiKey) => { - chai_1.assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey]); - }); - done(); - }) - .catch((err) => done(err)); - }); - }); - }); -}); -//# sourceMappingURL=index.spec.js.map diff --git a/sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js.map b/sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js.map deleted file mode 100644 index 6c7e005bbbaf..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/out/test/node/index.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../test/node/index.spec.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,uCAAuC;AACvC,kCAAkC;;;AAElC,gEAAyC;AACzC,mEAA4C;AAC5C,+CAAwB;AAExB,+BAA6B;AAC7B,qDAA8B;AAE9B,mDAA4B;AAE5B,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,SAAS,CAAC;QACR,KAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,uBAAuB,EAAE;QAChC,QAAQ,CAAC,wBAAwB,EAAE;YACjC,EAAE,CAAC,iFAAiF,EAAE,UAAU,IAAI;gBAClG,MAAM,QAAQ,GAAW,uDAAuD,CAAA;gBAChF,MAAM,YAAY,GAAG,0BAA0B,CAAA;gBAC/C,MAAM,WAAW,GAAG,6FAA6F,CAAA;gBACjH,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;oBAC9B,QAAQ,EAAE,gBAAgB;iBAC3B,CAAC,CAAA;gBACF,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC;qBAClC,OAAO,CAAC;oBACP,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,0CAA0C,CAAC,CAAA;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC/D,CAAC;iBACF,CAAC,CAAA;gBAEJ,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;gBAClE,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,CAAA;oBAC1E,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,6CAA6C,EAAE;YACtD,EAAE,CAAC,8HAA8H,EAAE,UAAU,IAAI;gBAC/I,MAAM,QAAQ,GAAW,uDAAuD,CAAA;gBAChF,MAAM,YAAY,GAAW,0BAA0B,CAAA;gBACvD,MAAM,WAAW,GAAG,6FAA6F,CAAA;gBACjH,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;oBAC9B,OAAO,EAAE,WAAW;iBACrB,CAAC,CAAA;gBACF,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC;qBAClC,OAAO,CAAC;oBACP,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,0CAA0C,CAAC,CAAA;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC/D,CAAC;iBACF,CAAC,CAAA;gBAEJ,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAC,CAAA;gBACtG,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,CAAA;oBAC1E,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;YAEF,EAAE,CAAC,yHAAyH,EAAE,UAAU,IAAI;gBAC1I,MAAM,SAAS,GAAW,2DAA2D,CAAA;gBACrF,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,SAAS,GAAW,iDAAiD,CAAA;gBAC3E,MAAM,YAAY,GAAW,0BAA0B,CAAA;gBACvD,MAAM,WAAW,GAAG,iGAAiG,CAAA;gBACrH,MAAM,YAAY,GAAG,sFAAsF,CAAA;gBAC3G,MAAM,YAAY,GAAG,uFAAuF,CAAA;gBAC5G,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gEAAgE,CAAC,CAAA;gBAC9G,MAAM,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAA;gBACvD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;gBAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAA;gBAC5D,MAAM,cAAc,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAA;gBACpI,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAA;gBAC/D,iBAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;oBACtC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,0CAA0C,CAAC,CAAA;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC/D,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC;oBACvC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,0CAA0C,CAAC,CAAA;wBACnF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAChE,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;oBACtC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,0CAA0C,CAAC,CAAA;wBACnF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAChE,CAAC;iBACF,CAAC,CAAA;gBAEF,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAC,CAAA;gBACvG,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,0DAA0D,CAAC,CAAA;oBACpI,aAAM,CAAC,eAAe,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;oBACpD,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,mCAAmC,EAAE;YAC5C,EAAE,CAAC,iFAAiF,EAAE,UAAU,IAAI;gBAClG,MAAM,QAAQ,GAAW,uDAAuD,CAAA;gBAChF,MAAM,YAAY,GAAG,0BAA0B,CAAA;gBAC/C,MAAM,WAAW,GAAG,sGAAsG,CAAA;gBAC1H,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC;oBAClC,KAAK,EAAE,QAAQ;oBACf,QAAQ,EAAE,gBAAgB;iBAC3B,CAAC,GAAG,CAAA;gBACL,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC;qBAClC,OAAO,CAAC;oBACP,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,0CAA0C,CAAC,CAAA;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC/D,CAAC;iBACF,CAAC,CAAA;gBAEJ,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC,CAAA;gBAC9G,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,YAAY,CAAC,CAAA;oBAC7E,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;YAEF,EAAE,CAAC,qGAAqG,EAAE,UAAU,IAAI;gBACtH,MAAM,SAAS,GAAW,2DAA2D,CAAA;gBACrF,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,SAAS,GAAW,iDAAiD,CAAA;gBAC3E,MAAM,YAAY,GAAW,0BAA0B,CAAA;gBACvD,MAAM,WAAW,GAAG,iGAAiG,CAAA;gBACrH,MAAM,YAAY,GAAG,sFAAsF,CAAA;gBAC3G,MAAM,YAAY,GAAG,uFAAuF,CAAA;gBAC5G,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gEAAgE,CAAC,CAAA;gBAC9G,MAAM,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAA;gBACvD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;gBAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAA;gBAC5D,MAAM,cAAc,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAA;gBACpI,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAA;gBAC/D,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,0CAA0C,CAAC,CAAA;wBACrH,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBACzC,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,0CAA0C,CAAC,CAAA;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC/D,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,0CAA0C,CAAC,CAAA;wBACtH,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBACzC,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,0CAA0C,CAAC,CAAA;wBACnF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAChE,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,0CAA0C,CAAC,CAAA;wBACtH,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBACzC,CAAC;iBACF,CAAC,CAAA;gBACF,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAClC,WAAW,EAAE,UAAU,GAAQ;wBAC7B,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,0CAA0C,CAAC,CAAA;wBACnF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;oBAChE,CAAC;iBACF,CAAC,CAAA;gBAEF,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC,CAAA;gBAC/G,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,0DAA0D,CAAC,CAAA;oBACpI,aAAM,CAAC,eAAe,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;oBACpD,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,uBAAuB,EAAE;QAChC,QAAQ,CAAC,wBAAwB,EAAE;YACjC,EAAE,CAAC,iFAAiF,EAAE,UAAU,IAAI;gBAClG,MAAM,QAAQ,GAAW,gDAAgD,CAAA;gBACzE,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAA;gBACnG,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;gBACjE,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;gBACpE,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,EAAE,2DAA2D,CAAC,CAAA;oBAC3H,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,8CAA8C,EAAE;YACvD,EAAE,CAAC,yHAAyH,EAAE,UAAU,IAAI;gBAC1I,MAAM,SAAS,GAAW,2DAA2D,CAAA;gBACrF,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,SAAS,GAAW,iDAAiD,CAAA;gBAC3E,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gEAAgE,CAAC,CAAA;gBAC/G,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAA;gBACpG,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,sDAAsD,CAAC,CAAA;gBACrG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBAEnE,MAAM,cAAc,GAAG;oBACrB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;iBACvB,CAAA;gBACD,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAC,CAAA;gBACzG,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,oBAAoB,CAAC,CAAA;oBACpG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;wBAC/C,aAAM,CAAC,eAAe,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAAE,yBAAyB,UAAU,oBAAoB,CAAC,CAAA;oBACvI,CAAC,CAAC,CAAA;oBACF,aAAM,CAAC,eAAe,CAAC,YAAY,EAAE,cAAc,EAAE,2DAA2D,CAAC,CAAA;oBACjH,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;YAEF,EAAE,CAAC,8HAA8H,EAAE,UAAU,IAAI;gBAC/I,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAA;gBACpG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBAEnE,MAAM,cAAc,GAAG;oBACrB,CAAC,SAAS,CAAC,EAAE,SAAS;iBACvB,CAAA;gBACD,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;gBACrE,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,cAAc,EAAE,YAAY,EAAE,2DAA2D,CAAC,CAAA;oBACjH,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,mCAAmC,EAAE;YAC5C,EAAE,CAAC,uFAAuF,EAAE,UAAU,IAAI;gBACxG,MAAM,SAAS,GAAW,2DAA2D,CAAA;gBACrF,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,SAAS,GAAW,iDAAiD,CAAA;gBAC3E,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gEAAgE,CAAC,CAAA;gBAC/G,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAA;gBACpG,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,sDAAsD,CAAC,CAAA;gBACrG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBAEnE,MAAM,cAAc,GAAG;oBACrB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;iBACvB,CAAA;gBACD,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC,CAAA;gBACjH,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,eAAe,CAAC,cAAc,EAAE,YAAY,EAAE,2DAA2D,CAAC,CAAA;oBACjH,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;YAEF,EAAE,CAAC,qGAAqG,EAAE,UAAU,IAAI;gBACtH,MAAM,SAAS,GAAW,2DAA2D,CAAA;gBACrF,MAAM,SAAS,GAAW,gDAAgD,CAAA;gBAC1E,MAAM,SAAS,GAAW,iDAAiD,CAAA;gBAC3E,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;gBACtE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gEAAgE,CAAC,CAAA;gBAC/G,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAA;gBACpG,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,sDAAsD,CAAC,CAAA;gBACrG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;gBAEnE,MAAM,cAAc,GAAG;oBACrB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;oBACtB,CAAC,SAAS,CAAC,EAAE,SAAS;iBACvB,CAAA;gBACD,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC,CAAA;gBACjH,aAAM,CAAC,aAAa,YAAY,OAAO,EAAE,yCAAyC,CAAC,CAAA;gBACnF,aAAa,CAAC,IAAI,CAAC,CAAC,YAAiB,EAAE,EAAE;oBACvC,aAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,iCAAiC,CAAC,CAAA;oBAC3G,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;wBAC5C,aAAM,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;oBAClE,CAAC,CAAC,CAAA;oBACF,IAAI,EAAE,CAAA;gBACR,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/* eslint-disable no-undef */\r\n// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport * as resolverTool from '../../src'\r\nimport * as coreHttp from '@azure/core-http'\r\nimport * as fs from 'fs'\r\n\r\nimport { assert } from 'chai'\r\nimport * as sinon from 'sinon'\r\n\r\nimport * as path from 'path'\r\n\r\ndescribe('resolver - node', function () {\r\n afterEach(function () {\r\n sinon.restore()\r\n })\r\n\r\n describe('remote URL resolution', function () {\r\n describe('simple DTDL resolution', function () {\r\n it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) {\r\n const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'\r\n const fakeEndpoint = 'devicemodels.contoso.com'\r\n const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json'\r\n const fakeData = JSON.stringify({\r\n fakeDtdl: 'fakeBodyAsText'\r\n })\r\n sinon.stub(coreHttp, 'ServiceClient')\r\n .returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData, status: 200 })\r\n }\r\n })\r\n\r\n const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint)\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n\r\n describe('depenency resolution (using pseudo-parsing)', function () {\r\n it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) {\r\n const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'\r\n const fakeEndpoint: string = 'devicemodels.contoso.com'\r\n const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json'\r\n const fakeData = JSON.stringify({\r\n fakeKey: 'fakeValue'\r\n })\r\n sinon.stub(coreHttp, 'ServiceClient')\r\n .returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData, status: 200 })\r\n }\r\n })\r\n\r\n const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'enabled' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n\r\n it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'\r\n const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'\r\n const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const fakeEndpoint: string = 'devicemodels.contoso.com'\r\n const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json'\r\n const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json'\r\n const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json')\r\n const fakeData = fs.readFileSync(pathToDtdl).toString()\r\n const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' })\r\n const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' })\r\n const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) }\r\n const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient')\r\n serviceClientStub.onFirstCall().returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData, status: 200 })\r\n }\r\n })\r\n serviceClientStub.onSecondCall().returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData2, status: 200 })\r\n }\r\n })\r\n serviceClientStub.onThirdCall().returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData3, status: 200 })\r\n }\r\n })\r\n\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'enabled' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output')\r\n assert.deepStrictEqual(expectedOutput, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n\r\n describe('try from expanded (expanded.json)', function () {\r\n it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) {\r\n const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1'\r\n const fakeEndpoint = 'devicemodels.contoso.com'\r\n const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json'\r\n const fakeData = `[${JSON.stringify({\r\n '@id': fakeDtmi,\r\n fakeDtdl: 'fakeBodyAsText'\r\n })}]`\r\n sinon.stub(coreHttp, 'ServiceClient')\r\n .returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData, status: 200 })\r\n }\r\n })\r\n\r\n const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n\r\n it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'\r\n const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'\r\n const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const fakeEndpoint: string = 'devicemodels.contoso.com'\r\n const expectedUri = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json'\r\n const expectedUri2 = 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json'\r\n const expectedUri3 = 'https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json')\r\n const fakeData = fs.readFileSync(pathToDtdl).toString()\r\n const fakeData2 = JSON.stringify({ fakeKey: 'fakeValue' })\r\n const fakeData3 = JSON.stringify({ fakeKey2: 'fakeValue2' })\r\n const expectedOutput = { [fakeDtmi1]: JSON.parse(fakeData), [fakeDtmi2]: JSON.parse(fakeData2), [fakeDtmi3]: JSON.parse(fakeData3) }\r\n const serviceClientStub = sinon.stub(coreHttp, 'ServiceClient')\r\n serviceClientStub.onCall(0).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.')\r\n return Promise.resolve({ status: 404 })\r\n }\r\n })\r\n serviceClientStub.onCall(1).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData, status: 200 })\r\n }\r\n })\r\n serviceClientStub.onCall(2).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri2.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.')\r\n return Promise.resolve({ status: 404 })\r\n }\r\n })\r\n serviceClientStub.onCall(3).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri2, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData2, status: 200 })\r\n }\r\n })\r\n serviceClientStub.onCall(4).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri3.replace('.json', '.expanded.json'), 'URL not formatted for request correctly.')\r\n return Promise.resolve({ status: 404 })\r\n }\r\n })\r\n serviceClientStub.onCall(5).returns({\r\n sendRequest: function (req: any) {\r\n assert.deepEqual(req.url, expectedUri3, 'URL not formatted for request correctly.')\r\n return Promise.resolve({ bodyAsText: fakeData3, status: 200 })\r\n }\r\n })\r\n\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { resolveDependencies: 'tryFromExpanded' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis in actual output do not align with expected output')\r\n assert.deepStrictEqual(expectedOutput, actualOutput)\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n })\r\n\r\n describe('local file resolution', function () {\r\n describe('simple DTDL resolution', function () {\r\n it('should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) {\r\n const fakeDtmi: string = 'dtmi:contoso:FakeDeviceManagement:thermostat;1'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json')\r\n const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, 'utf-8'))\r\n const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory)\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual({ [fakeDtmi]: fakeDtdl }, actualOutput, 'the expected dtmi mapping did not match the actual value.')\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n\r\n describe('dependency resolution (using pseudo-parsing)', function () {\r\n it('given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'\r\n const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'\r\n const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json')\r\n const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json')\r\n const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json')\r\n const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8'))\r\n const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8'))\r\n const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8'))\r\n\r\n const expectedOutput = {\r\n [fakeDtmi1]: fakeDtdl1,\r\n [fakeDtmi2]: fakeDtdl2,\r\n [fakeDtmi3]: fakeDtdl3\r\n }\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'enabled' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual(Object.keys(actualOutput), Object.keys(expectedOutput), 'dtmis do not match')\r\n Object.keys(actualOutput).forEach((outputDtmi) => {\r\n assert.deepStrictEqual(actualOutput[outputDtmi], expectedOutput[outputDtmi], `dtdls for given dtmi (${outputDtmi}) did not line up.`)\r\n })\r\n assert.deepStrictEqual(actualOutput, expectedOutput, 'the expected dtmi mapping did not match the actual value.')\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n\r\n it('given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:thermostat;1'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json')\r\n const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8'))\r\n\r\n const expectedResult = {\r\n [fakeDtmi1]: fakeDtdl1\r\n }\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory)\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.')\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n\r\n describe('try from expanded (expanded.json)', function () {\r\n it('should return a promise that resolves to a mapping from the DTMIs to the JSON objects', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:TemperatureController;1'\r\n const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'\r\n const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json')\r\n const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json')\r\n const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json')\r\n const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8'))\r\n const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8'))\r\n const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8'))\r\n\r\n const expectedResult = {\r\n [fakeDtmi1]: fakeDtdl1,\r\n [fakeDtmi2]: fakeDtdl2,\r\n [fakeDtmi3]: fakeDtdl3\r\n }\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepStrictEqual(expectedResult, actualOutput, 'the expected dtmi mapping did not match the actual value.')\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n\r\n it('given no expanded format exists for the given DTMI, should fallback to resolution with dependencies', function (done) {\r\n const fakeDtmi1: string = 'dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2'\r\n const fakeDtmi2: string = 'dtmi:contoso:FakeDeviceManagement:Thermostat;1'\r\n const fakeDtmi3: string = 'dtmi:azure:DeviceManagement:DeviceInformation;1'\r\n const localDirectory = path.resolve('./test/node/testModelRepository')\r\n const pathToDtdl1 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json')\r\n const pathToDtdl2 = path.join(localDirectory, 'dtmi/contoso/FakeDeviceManagement/thermostat-1.json')\r\n const pathToDtdl3 = path.join(localDirectory, 'dtmi/azure/DeviceManagement/deviceinformation-1.json')\r\n const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, 'utf-8'))\r\n const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, 'utf-8'))\r\n const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, 'utf-8'))\r\n\r\n const expectedResult = {\r\n [fakeDtmi1]: fakeDtdl1,\r\n [fakeDtmi2]: fakeDtdl2,\r\n [fakeDtmi3]: fakeDtdl3\r\n }\r\n const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { resolveDependencies: 'tryFromExpanded' })\r\n assert(resolveResult instanceof Promise, 'resolve method did not return a promise')\r\n resolveResult.then((actualOutput: any) => {\r\n assert.deepEqual(Object.keys(expectedResult), Object.keys(actualOutput), 'the expected dtmis do not match')\r\n Object.keys(expectedResult).forEach(dtmiKey => {\r\n assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey])\r\n })\r\n done()\r\n }).catch((err: any) => done(err))\r\n })\r\n })\r\n })\r\n})\r\n"]} \ No newline at end of file diff --git a/sdk/iotmodelsrepository/resolver-tool/package.json b/sdk/iotmodelsrepository/resolver-tool/package.json deleted file mode 100644 index aeb45620c678..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/package.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "name": "@azure/iot-plugandplay-models-repo-tool", - "version": "0.0.1", - "description": "Device Model Repository Library with typescript type definitions for node.js and browser.", - "sdk-type": "client", - "main": "dist/index.js", - "module": "dist-esm/src/index.js", - "browser": { - "stream": "./node_modules/stream-browserify/index.js", - "./dist-esm/src/print.js": "./dist-esm/src/print.browser.js" - }, - "types": "types/template.d.ts", - "scripts": { - "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", - "build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1", - "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", - "build:samples": "dev-tool samples prep && cd dist-samples && tsc -p .", - "build:test": "tsc -p . && rollup -c 2>&1", - "build": "tsc -p . && rollup -c 2>&1 && api-extractor run --local", - "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", - "clean": "rimraf dist dist-* test-dist temp types *.tgz *.log", - "execute:samples": "npm run build:samples && dev-tool samples run dist-samples/javascript dist-samples/typescript/dist/dist-samples/typescript/src/", - "extract-api": "tsc -p . && api-extractor run --local", - "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", - "integration-test:browser": "karma start --single-run", - "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}/*.spec.js\"", - "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", - "lint": "eslint package.json api-extractor.json src test --ext .ts", - "pack": "npm pack 2>&1", - "prebuild": "npm run clean", - "test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser", - "test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node", - "test": "npm run build:test && npm run unit-test && npm run integration-test", - "unit-test:browser": "karma start --single-run", - "unit-test:node": "mocha --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/{,!(browser)/**/}/*.spec.ts\"", - "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "temp-unit-test": "mocha -r ts-node/register --timeout 1200000 test/node/*.spec.ts" - }, - "files": [ - "dist/", - "dist-esm/src/", - "types/template.d.ts", - "README.md", - "LICENSE" - ], - "repository": "github:Azure/azure-sdk-for-js", - "engines": { - "node": ">=10.0.0" - }, - "keywords": [ - "azure", - "cloud", - "typescript" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/", - "sideEffects": false, - "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", - "dependencies": { - "@azure/core-http": "^1.2.0", - "@azure/core-tracing": "1.0.0-preview.9", - "@azure/logger": "^1.0.0", - "@opentelemetry/api": "^0.10.2", - "events": "^3.0.0", - "tslib": "^2.0.0" - }, - "devDependencies": { - "@azure/dev-tool": "^1.0.0", - "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@azure/identity": "^1.1.0", - "@azure/test-utils-recorder": "^1.0.0", - "@microsoft/api-extractor": "7.7.11", - "@types/chai": "^4.1.6", - "@types/chai-as-promised": "^7.1.0", - "@types/mocha": "^7.0.2", - "@types/node": "^8.0.0", - "chai": "^4.2.0", - "chai-as-promised": "^7.1.1", - "cross-env": "^7.0.2", - "dotenv": "^8.2.0", - "eslint": "^7.15.0", - "inherits": "^2.0.3", - "karma": "^5.1.0", - "karma-chrome-launcher": "^3.0.0", - "karma-coverage": "^2.0.0", - "karma-edge-launcher": "^0.4.2", - "karma-env-preprocessor": "^0.1.1", - "karma-firefox-launcher": "^1.1.0", - "karma-ie-launcher": "^1.0.0", - "karma-json-preprocessor": "^0.3.3", - "karma-json-to-file-reporter": "^1.0.1", - "karma-junit-reporter": "^2.0.1", - "karma-mocha": "^2.0.1", - "karma-mocha-reporter": "^2.2.5", - "mocha": "^7.1.1", - "mocha-junit-reporter": "^1.18.0", - "nyc": "^14.0.0", - "prettier": "^1.16.4", - "rimraf": "^3.0.0", - "rollup": "^1.16.3", - "typedoc": "0.15.2", - "typescript": "4.1.2", - "util": "^0.12.1" - }, - "standard": { - "env": [ - "mocha" - ] - }, - "//smokeTestConfiguration": { - "skipFolder": true - } -} diff --git a/sdk/iotmodelsrepository/resolver-tool/src/remoteModelFetchers.ts b/sdk/iotmodelsrepository/resolver-tool/src/remoteModelFetchers.ts deleted file mode 100644 index e32267508e3f..000000000000 --- a/sdk/iotmodelsrepository/resolver-tool/src/remoteModelFetchers.ts +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -"use strict"; - -import * as dtmiConventions from "./dtmiConventions"; -import * as modelMetadata from "./modelMetadata"; -import * as coreHttp from "@azure/core-http"; -import { DTDL } from "./DTDL"; -import { flattenDtdlResponse } from "./modelFetcherHelper"; - -async function recursiveFetcher( - dtmi: string, - endpoint: string, - tryFromExpanded: boolean -): Promise<{ [dtmi: string]: DTDL }> { - let dependencyModels: { [x: string]: DTDL } = {}; - let fetchedModels: { [x: string]: DTDL }; - try { - console.log(`Fetching: ${dtmi}`); - fetchedModels = await fetcher(dtmi, endpoint, tryFromExpanded); - } catch (error) { - if ( - tryFromExpanded && - (error.code === "ENOENT" || !(error.statusCode >= 200 && error.statusCode < 400)) - ) { - console.log("Fetching from expanded failed. Trying without."); - console.log(`Fetching: ${dtmi}`); - fetchedModels = await fetcher(dtmi, endpoint, false); - } else { - throw error; - } - } - const dtmis = Object.keys(fetchedModels); - for (let i = 0; i < dtmis.length; i++) { - const currentDtdl = fetchedModels[dtmis[i]]; - const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas; - if (deps && deps.length > 0) { - for (let j = 0; j < deps.length; j++) { - if ( - Object.keys(dependencyModels).includes(deps[j]) || - Object.keys(fetchedModels).includes(deps[j]) - ) { - // do nothing - } else { - const fetchedDependencies = await recursiveFetcher(deps[j], endpoint, tryFromExpanded); - dependencyModels = { ...dependencyModels, ...fetchedDependencies }; - } - } - } - } - if (Object.keys(dependencyModels).length > 0) { - fetchedModels = { ...fetchedModels, ...dependencyModels }; - } - return fetchedModels; -} - -async function fetcher( - dtmi: string, - endpoint: string, - tryFromExpanded: boolean -): Promise<{ [dtmi: string]: any }> { - const client = new coreHttp.ServiceClient(); - const req: coreHttp.RequestPrepareOptions = { - url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), - method: "GET" - }; - const res: coreHttp.HttpOperationResponse = await client.sendRequest(req); - if (res.status >= 200 && res.status < 400) { - const dtdlAsString = res.bodyAsText || ""; - const parsedDtdl = JSON.parse(dtdlAsString); - if (Array.isArray(parsedDtdl)) { - const result = flattenDtdlResponse(parsedDtdl as DTDL[]); - return result; - } else { - const result = { [dtmi]: parsedDtdl as DTDL }; - return result; - } - } else { - throw new coreHttp.RestError( - "Error on HTTP Request in remote model fetcher", - "404", - 404, - undefined, - res - ); - } -} - -export { fetcher, recursiveFetcher }; From 8219fa95ea9d3f1f9d681884d88ab884da86501f Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 13 Apr 2021 01:52:20 -0700 Subject: [PATCH 05/81] refactor around new architecture --- common/config/rush/pnpm-lock.yaml | 15 +- rush.json | 2 +- sdk/iot/modelsrepository/package.json | 2 +- sdk/iot/modelsrepository/src/DTDL.ts | 2 +- sdk/iot/modelsrepository/src/client.ts | 143 ++++++++++++++---- sdk/iot/modelsrepository/src/constants.ts | 18 ++- .../src/dependencyResolutionType.ts | 2 +- sdk/iot/modelsrepository/src/fetcher.ts | 7 + .../src/filesystemModelFetcher.ts | 106 +++++++++++++ .../modelsrepository/src/httpModelFetcher.ts | 135 +++++++++++++++++ .../src/localModelFetchers.ts | 77 ---------- .../src/modelFetcherHandler.ts | 131 +++++++++------- .../src/modelFetcherHelper.ts | 5 + sdk/iot/modelsrepository/src/modelMetadata.ts | 46 ------ sdk/iot/modelsrepository/src/psuedoParser.ts | 75 +++++++++ .../src/remoteModelFetchers.ts | 90 ----------- sdk/iot/modelsrepository/src/resolver.ts | 95 +++++++----- 17 files changed, 601 insertions(+), 350 deletions(-) create mode 100644 sdk/iot/modelsrepository/src/fetcher.ts create mode 100644 sdk/iot/modelsrepository/src/filesystemModelFetcher.ts create mode 100644 sdk/iot/modelsrepository/src/httpModelFetcher.ts delete mode 100644 sdk/iot/modelsrepository/src/localModelFetchers.ts delete mode 100644 sdk/iot/modelsrepository/src/modelMetadata.ts create mode 100644 sdk/iot/modelsrepository/src/psuedoParser.ts delete mode 100644 sdk/iot/modelsrepository/src/remoteModelFetchers.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 05915aa4ab82..f0f35643f522 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -32,7 +32,7 @@ dependencies: '@rush-temp/eventgrid': file:projects/eventgrid.tgz '@rush-temp/eventhubs-checkpointstore-blob': file:projects/eventhubs-checkpointstore-blob.tgz '@rush-temp/identity': file:projects/identity.tgz - '@rush-temp/iot-plugandplay-models-repo-tool': file:projects/iot-plugandplay-models-repo-tool.tgz + '@rush-temp/iot-modelsrepository-client': file:projects/iot-modelsrepository-client.tgz '@rush-temp/keyvault-admin': file:projects/keyvault-admin.tgz '@rush-temp/keyvault-certificates': file:projects/keyvault-certificates.tgz '@rush-temp/keyvault-common': file:projects/keyvault-common.tgz @@ -7510,6 +7510,7 @@ packages: resolution: integrity: sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0= /xmldom/0.4.0: + deprecated: Deprecated due to CVE-2021-21366 resolved in 0.5.0 dev: false engines: node: '>=10.0.0' @@ -9275,7 +9276,7 @@ packages: integrity: sha512-RkgNLuiYgllsKZCWqAgG5YWRjgD/90RbafjKLQa/t0BYJLbvR3k/c9UVNGZDSh6ScpnSCmQ8eCr0+FGM3eB2yg== tarball: file:projects/identity.tgz version: 0.0.0 - file:projects/iot-plugandplay-models-repo-tool.tgz: + file:projects/iot-modelsrepository-client.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.9 '@microsoft/api-extractor': 7.7.11 @@ -9283,7 +9284,7 @@ packages: '@types/chai': 4.2.14 '@types/chai-as-promised': 7.1.3 '@types/mocha': 7.0.2 - '@types/node': 8.10.66 + '@types/node': 10.17.51 chai: 4.3.0 chai-as-promised: 7.1.1_chai@4.3.0 cross-env: 7.0.3 @@ -9314,10 +9315,10 @@ packages: typescript: 4.1.2 util: 0.12.3 dev: false - name: '@rush-temp/iot-plugandplay-models-repo-tool' + name: '@rush-temp/iot-modelsrepository-client' resolution: - integrity: sha512-o0sIVRXu073jlfUkqFeSv55+qmoyArKGH4V75WbtIGomYY/YTsgnJf5FlNAmER6bGnwLrgcIBm2yNmaAWoSjxw== - tarball: file:projects/iot-plugandplay-models-repo-tool.tgz + integrity: sha512-eo8GMH/Pb5NyBd9X5YuI/vHWuwPSe/sOewFeZQ0jwdMlmkbCqsnWINFvmNEF/94yXAPwJKoFHk4JfYnRHBjVAQ== + tarball: file:projects/iot-modelsrepository-client.tgz version: 0.0.0 file:projects/keyvault-admin.tgz: dependencies: @@ -10594,7 +10595,7 @@ specifiers: '@rush-temp/eventgrid': file:./projects/eventgrid.tgz '@rush-temp/eventhubs-checkpointstore-blob': file:./projects/eventhubs-checkpointstore-blob.tgz '@rush-temp/identity': file:./projects/identity.tgz - '@rush-temp/iot-plugandplay-models-repo-tool': file:./projects/iot-plugandplay-models-repo-tool.tgz + '@rush-temp/iot-modelsrepository-client': file:./projects/iot-modelsrepository-client.tgz '@rush-temp/keyvault-admin': file:./projects/keyvault-admin.tgz '@rush-temp/keyvault-certificates': file:./projects/keyvault-certificates.tgz '@rush-temp/keyvault-common': file:./projects/keyvault-common.tgz diff --git a/rush.json b/rush.json index aa8586c6a6e1..5aaad9b4abdb 100644 --- a/rush.json +++ b/rush.json @@ -633,7 +633,7 @@ "versionPolicyName": "client" }, { - "packageName": "@azure/iot-plugandplay-models-repo-tool", + "packageName": "@azure/iot-modelsrepository-client", "projectFolder": "sdk/iot/modelsrepository", "versionPolicyName": "core" } diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index 6b7b8d8aa140..a9183f7a5acc 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -78,7 +78,7 @@ "@types/chai": "^4.1.6", "@types/chai-as-promised": "^7.1.0", "@types/mocha": "^7.0.2", - "@types/node": "^8.0.0", + "@types/node": "^10.0.0", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "cross-env": "^7.0.2", diff --git a/sdk/iot/modelsrepository/src/DTDL.ts b/sdk/iot/modelsrepository/src/DTDL.ts index a436d2353840..0979fc87e7c6 100644 --- a/sdk/iot/modelsrepository/src/DTDL.ts +++ b/sdk/iot/modelsrepository/src/DTDL.ts @@ -12,6 +12,6 @@ interface Contents { export interface DTDL extends JSON { "@context": any[]; "@id": string; - extends: string; + extends: string | Array; contents: Contents[]; } diff --git a/sdk/iot/modelsrepository/src/client.ts b/sdk/iot/modelsrepository/src/client.ts index 69441aa2445f..fda70c58d0d0 100644 --- a/sdk/iot/modelsrepository/src/client.ts +++ b/sdk/iot/modelsrepository/src/client.ts @@ -1,17 +1,25 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Copyright (c) Microsoft. +// Licensed under the MIT license. -import * as constants from './constants'; +import * as constants from "./constants"; import { InternalPipelineOptions, createPipelineFromOptions, OperationOptions, PipelineOptions, - ServiceClientOptions + ServiceClient } from "@azure/core-http"; -import {dependencyResolutionType} from './dependencyResolutionType'; -import {logger} from './logger'; -import {modelFetcher} from './modelFetcherHandler'; +import { dependencyResolutionType } from "./dependencyResolutionType"; +import { logger } from "./logger"; +import { URL, fileURLToPath } from "url"; +import { DtmiResolver, ResolverError } from "./resolver"; +import { HttpFetcher } from "./httpModelFetcher"; +import { FilesystemFetcher } from "./filesystemModelFetcher"; +import { isLocalPath } from "./modelFetcherHelper"; +import * as path from 'path'; +import { PseudoParser } from "./psuedoParser"; + + export interface ModelsRepositoryClientOptions extends PipelineOptions, OperationOptions { repositoryLocation: string | undefined; @@ -26,23 +34,47 @@ export class ModelsRepositoryClient { private _repositoryLocation: string; private _dependencyResolution: string; private _apiVersion: string; - private _pipeline: ServiceClientOptions; + private _fetcher: any; + private _resolver: any; + private _pseudoParser: any; constructor(options?: ModelsRepositoryClientOptions) { this._repositoryLocation = options?.repositoryLocation || constants.DEFAULT_REPOSITORY_LOCATION; - this._dependencyResolution = options?.dependencyResolution || this._checkDefaultDependencyResolution(!!options?.repositoryLocation); - this._apiVersion = options?.apiVersion || constants.DEFAULT_API_VERSION; + logger.info(`Client configured for repository location ${this._repositoryLocation}`); + this._dependencyResolution = + options?.dependencyResolution || + this._checkDefaultDependencyResolution(!!options?.repositoryLocation); + logger.info(`Client configured for dependency mode: ${this._dependencyResolution}`); + this._fetcher = this._createFetcher(this._repositoryLocation, options); + this._resolver = new DtmiResolver(this._fetcher); + this._pseudoParser = new PseudoParser(this._resolver); + // Store api version here (for now). Currently doesn't do anything + this._apiVersion = options?.apiVersion || constants.DEFAULT_API_VERSION; + } + + private _checkDefaultDependencyResolution(customRepository: boolean) { + if (customRepository) { + return 'enabled'; + } else { + return 'tryFromExpanded'; + } + } + + get apiVersion() { + return this._apiVersion; + } + + private _createPipeline(options: any) { const { ...pipelineOptions } = options; - const libInfo = `azsdk-js-ai-anomalydetector/${constants.SDK_VERSION}`; if (!pipelineOptions.userAgentOptions) { pipelineOptions.userAgentOptions = {}; } if (pipelineOptions.userAgentOptions.userAgentPrefix) { - pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`; + pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${constants.DEFAULT_USER_AGENT}`; } else { - pipelineOptions.userAgentOptions.userAgentPrefix = libInfo; + pipelineOptions.userAgentOptions.userAgentPrefix = constants.DEFAULT_USER_AGENT; } const internalPipelineOptions: InternalPipelineOptions = { @@ -54,29 +86,86 @@ export class ModelsRepositoryClient { } }; - this._pipeline = createPipelineFromOptions(internalPipelineOptions); - } - - get apiVersion() { - return this._apiVersion; + const myServiceClientOptions = createPipelineFromOptions(internalPipelineOptions); + return new ServiceClient(undefined, myServiceClientOptions); } - private _checkDefaultDependencyResolution(customRepository: boolean) { - if (customRepository) { - return 'enabled'; + private _createFetcher(location: string, options: any) { + // Return a Fetcher based upon the type of location + let locationURL; + let fetcher; + if (isLocalPath(location)) { + const localPath = path.normalize(location); + // POSIX Filesystem Path or Windows Filesystem Path + logger.info(`Repository location identified as filesystem path - using FilesystemFetcher`) + fetcher = new FilesystemFetcher(localPath); } else { - return 'tryFromExpanded'; + locationURL = new URL(location); + if (locationURL.protocol in ['http', 'https']) { + logger.info(`Repository location identified as HTTP/HTTPS endpoint - using HttpFetcher`); + const pipeline = this._createPipeline(options); + fetcher = new HttpFetcher(location, pipeline); + } + else if (locationURL.protocol === 'file') { + // filesystem URI + logger.info('Repository Location identified as filesystem URI - using FilesystemFetcher'); + const localPath = fileURLToPath(location); + fetcher = new FilesystemFetcher(localPath); + } else if (locationURL.protocol === '' && location.startsWith('/')) { + } else if (locationURL.protocol === '' && location.search(/\.[a-zA-Z]{2,63}$/)) { + // Web URL with protocol unspecified - default to HTTPS + logger.info('Repository Location identified as remote endpoint without protocol specified - using HttpFetcher'); + const fLocation = 'https://' + location; + const pipeline = this._createPipeline(options); + fetcher = new HttpFetcher(fLocation, pipeline); + // TODO: make the next line match a regex specified. + } else { + throw new EvalError(`Unable to identify location: ${location}`); + } } + + } - getModels(dtmi: string, dependencyResolution: dependencyResolutionType): Promise<{ [dtmi: string]: any }>; - getModels(dtmis: string[], dependencyResolution: dependencyResolutionType): Promise<{[dtmi:string]: any }>; - getModels(dtmis: string | string[], dependencyResolution: dependencyResolutionType): Promise<{[dtmi: string]: any}> { + getModels(dtmi: string, options: any): Promise<{ [dtmi: string]: any }>; + getModels(dtmis: string[], options: any): Promise<{ [dtmi: string]: any }>; + getModels(dtmis: string | string[], options: any): Promise<{ [dtmi: string]: any }> { + let modelMap; if (!Array.isArray(dtmis)) { dtmis = [dtmis]; } - return modelFetcher(this._pipeline, client, dtmi, this._repositoryLocation, dependencyResolution || this._dependencyResolution); - } + const dependencyResolution = options.dependencyResolution || this._dependencyResolution; + + if (dependencyResolution === constants.DEPENDENCY_MODE_DISABLED) { + logger.info('Getting models w/ dependency resolution mode: disabled'); + logger.info(`Retreiving model(s): ${dtmis}...`); + modelMap = this._resolver.resolve(dtmis); + } + else if (dependencyResolution === constants.DEPENDENCY_MODE_ENABLED) { + logger.info(`Getting models w/ dependency resolution mode: enabled`); + logger.info(`Retreiving model(s): ${dtmis}...`); + const baseModelMap = this._resolver.resolve(dtmis); + const baseModelList = [baseModelMap.values()]; + logger.info(`Retreiving model dependencies for ${dtmis}...`); + modelMap = this._pseudoParser.expand(baseModelList); + } + else if (dependencyResolution === constants.DEPENDENCY_MODE_TRY_FROM_EXPANDED) { + logger.info(`Getting models w/ dependency resolution mode: tryFromExpanded`); + try { + logger.info(`Retreiving expanded model(s): ${dtmis}...`); + modelMap = this._resolver.resolve(dtmis, {expandedModel: true}); + } catch (e) { + if (e instanceof ResolverError) {} + else { + Promise.reject(e); + } + } + } + else { + Promise.reject(EvalError(`Invalid dependency resolution mode: ${dependencyResolution}`)) + } + return modelMap; + } } diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts index dde3aa879b9d..c2affb94b1a0 100644 --- a/sdk/iot/modelsrepository/src/constants.ts +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -1,12 +1,16 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -const isBrowser=new Function("try {return this===window;}catch(e){ return false;}"); -const isNode=new Function("try {return this===global;}catch(e){return false;}"); +const isBrowser = new Function("try {return this===window;}catch(e){ return false;}"); +const isNode = new Function("try {return this===global;}catch(e){return false;}"); -const currentPlatform = isBrowser ? 'browser' : (isNode ? 'node' : 'undefined'); +const currentPlatform = isBrowser ? "browser" : isNode ? "node" : "undefined"; -export const SDK_VERSION = "0.0.0-preview" -export const DEFAULT_USER_AGENT = `azsdk-node-modelsrepository/${SDK_VERSION} (${currentPlatform})` -export const DEFAULT_REPOSITORY_LOCATION = 'https://devicemodels.azure.com'; -export const DEFAULT_API_VERSION = "2021-02-11" +export const SDK_VERSION = "0.0.0-preview"; +export const DEFAULT_USER_AGENT = `azsdk-node-modelsrepository/${SDK_VERSION} (${currentPlatform})`; +export const DEFAULT_REPOSITORY_LOCATION = "https://devicemodels.azure.com"; +export const DEFAULT_API_VERSION = "2021-02-11"; + +export const DEPENDENCY_MODE_DISABLED = 'disabled'; +export const DEPENDENCY_MODE_ENABLED = 'enabled'; +export const DEPENDENCY_MODE_TRY_FROM_EXPANDED = 'tryFromExpanded'; \ No newline at end of file diff --git a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts index a49a0ee2a520..b7e5f79a7b27 100644 --- a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts +++ b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -export type dependencyResolutionType = 'disabled' | 'enabled' | 'tryFromExpanded' | undefined; +export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded" | undefined; diff --git a/sdk/iot/modelsrepository/src/fetcher.ts b/sdk/iot/modelsrepository/src/fetcher.ts new file mode 100644 index 000000000000..86a6d30886b0 --- /dev/null +++ b/sdk/iot/modelsrepository/src/fetcher.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +export abstract class Fetcher { + + abstract fetch(path:string): any; +} diff --git a/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts b/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts new file mode 100644 index 000000000000..a27fbdb9968e --- /dev/null +++ b/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +import { DTDL } from "./DTDL"; +import fs from "fs"; +import * as path from 'path'; +import { Fetcher } from "./fetcher"; +import { logger } from "./logger"; +import { FetcherError } from "./resolver"; + +export class FilesystemFetcher extends Fetcher { + private _baseFilePath: string; + + constructor(baseFilePath: string) { + super(); + this._baseFilePath = baseFilePath; + } + + fetch(filePath: string) { + logger.info(`Fetching ${filePath} from local filesystem`); + const absolutePath = path.join(this._baseFilePath, filePath); + + try { + logger.info(`File open on ${absolutePath}`); + const dtdlFile = fs.readFileSync(absolutePath, "utf8"); + const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); + return parsedDtdl; + } catch (e) { + throw new FetcherError('Failed to fetch from Filesystem', e); + } + } +} + + + + + + + + + +// async function recursiveFetcher( +// dtmi: string, +// directory: string, +// tryFromExpanded: boolean +// ): Promise<{ [x: string]: DTDL }> { +// let dependencyModels: { [x: string]: DTDL } = {}; +// let fetchedModels: { [x: string]: DTDL }; +// try { +// console.log(`Fetching: ${dtmi}`); +// fetchedModels = await fetcher(dtmi, directory, tryFromExpanded); +// } catch (error) { +// if (tryFromExpanded && error.code === "ENOENT") { +// console.log("Fetching from expanded failed. Trying without."); +// fetchedModels = await fetcher(dtmi, directory, false); +// } else { +// throw error; +// } +// } +// const dtmis = Object.keys(fetchedModels); +// for (let i = 0; i < dtmis.length; i++) { +// const currentDtdl = fetchedModels[dtmis[i]]; +// const metaModelData = modelMetadata.getModelMetadata(currentDtdl); +// const deps = metaModelData.componentSchemas.concat(metaModelData.extends); +// if (deps && deps.length > 0) { +// for (let j = 0; j < deps.length; j++) { +// if ( +// Object.keys(dependencyModels).includes(deps[j]) || +// Object.keys(fetchedModels).includes(deps[j]) +// ) { +// // do nothing +// } else { +// const fetchedDependencies = await recursiveFetcher(deps[j], directory, tryFromExpanded); +// dependencyModels = { ...dependencyModels, ...fetchedDependencies }; +// } +// } +// } +// } +// if (Object.keys(dependencyModels).length > 0) { +// fetchedModels = { ...fetchedModels, ...dependencyModels }; +// } +// return fetchedModels; +// } + +// async function fetcher( +// dtmi: string, +// directory: string, +// tryFromExpanded: boolean +// ): Promise<{ [dtmi: string]: DTDL }> { +// const dtmiPath = dtmiConventions.dtmiToPath(dtmi); +// const dtmiPathFormatted = tryFromExpanded +// ? dtmiPath.replace(".json", ".expanded.json") +// : dtmiPath; +// const targetPath = path.join(directory, dtmiPathFormatted); +// const dtdlFile = fs.readFileSync(targetPath, "utf8"); +// const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); +// if (Array.isArray(parsedDtdl)) { +// const result = flattenDtdlResponse(parsedDtdl as DTDL[]); +// return result; +// } else { +// const result = { [dtmi]: parsedDtdl as DTDL }; +// return result; +// } +// } + +// export { fetcher, recursiveFetcher }; diff --git a/sdk/iot/modelsrepository/src/httpModelFetcher.ts b/sdk/iot/modelsrepository/src/httpModelFetcher.ts new file mode 100644 index 000000000000..259ca07d641a --- /dev/null +++ b/sdk/iot/modelsrepository/src/httpModelFetcher.ts @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +"use strict"; + +import * as coreHttp from "@azure/core-http"; +import { logger } from "./logger"; +import { RequestPrepareOptions } from "@azure/core-http"; +import { Fetcher } from "./fetcher"; + + + +export class HttpFetcher extends Fetcher { + private _pipeline: coreHttp.ServiceClient; + private _baseURL: string; + + constructor(baseURL: string, pipeline: coreHttp.ServiceClient) { + super(); + this._pipeline = pipeline; + this._baseURL = baseURL; + } + + async fetch(path: string) { + logger.info(`Fetching ${path} from remote endpoint`); + const myURL = this._baseURL + path; + const request: RequestPrepareOptions = { + url: myURL, + method: 'GET' + } + const res: coreHttp.HttpOperationResponse = await this._pipeline.sendRequest(request); + + if (res.status >= 200 && res.status < 400) { + const dtdlAsString = res.bodyAsText || ""; + const parsedDtdl = JSON.parse(dtdlAsString); + return parsedDtdl; + // if (Array.isArray(parsedDtdl)) { + // const result = flattenDtdlResponse(parsedDtdl as DTDL[]); + // return result; + // } else { + // const result = { [dtmi]: parsedDtdl as DTDL }; + // return result; + // } + } else { + throw new coreHttp.RestError( + "Error on HTTP Request in remote model fetcher", + "404", + 404, + undefined, + res + ); + } + } +} + + + +// async function recursiveFetcher( +// dtmi: string, +// endpoint: string, +// tryFromExpanded: boolean +// ): Promise<{ [dtmi: string]: DTDL }> { +// let dependencyModels: { [x: string]: DTDL } = {}; +// let fetchedModels: { [x: string]: DTDL }; +// try { +// console.log(`Fetching: ${dtmi}`); +// fetchedModels = await fetcher(dtmi, endpoint, tryFromExpanded); +// } catch (error) { +// if ( +// tryFromExpanded && +// (error.code === "ENOENT" || !(error.statusCode >= 200 && error.statusCode < 400)) +// ) { +// console.log("Fetching from expanded failed. Trying without."); +// console.log(`Fetching: ${dtmi}`); +// fetchedModels = await fetcher(dtmi, endpoint, false); +// } else { +// throw error; +// } +// } +// const dtmis = Object.keys(fetchedModels); +// for (let i = 0; i < dtmis.length; i++) { +// const currentDtdl = fetchedModels[dtmis[i]]; +// const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas; +// if (deps && deps.length > 0) { +// for (let j = 0; j < deps.length; j++) { +// if ( +// Object.keys(dependencyModels).includes(deps[j]) || +// Object.keys(fetchedModels).includes(deps[j]) +// ) { +// // do nothing +// } else { +// const fetchedDependencies = await recursiveFetcher(deps[j], endpoint, tryFromExpanded); +// dependencyModels = { ...dependencyModels, ...fetchedDependencies }; +// } +// } +// } +// } +// if (Object.keys(dependencyModels).length > 0) { +// fetchedModels = { ...fetchedModels, ...dependencyModels }; +// } +// return fetchedModels; +// } + +// async function fetcher( +// dtmi: string, +// endpoint: string, +// tryFromExpanded: boolean +// ): Promise<{ [dtmi: string]: any }> { +// const client = new coreHttp.ServiceClient(); +// const req: coreHttp.RequestPrepareOptions = { +// url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), +// method: "GET" +// }; +// const res: coreHttp.HttpOperationResponse = await client.sendRequest(req); +// if (res.status >= 200 && res.status < 400) { +// const dtdlAsString = res.bodyAsText || ""; +// const parsedDtdl = JSON.parse(dtdlAsString); +// if (Array.isArray(parsedDtdl)) { +// const result = flattenDtdlResponse(parsedDtdl as DTDL[]); +// return result; +// } else { +// const result = { [dtmi]: parsedDtdl as DTDL }; +// return result; +// } +// } else { +// throw new coreHttp.RestError( +// "Error on HTTP Request in remote model fetcher", +// "404", +// 404, +// undefined, +// res +// ); +// } +// } +// +// export { fetcher, recursiveFetcher }; diff --git a/sdk/iot/modelsrepository/src/localModelFetchers.ts b/sdk/iot/modelsrepository/src/localModelFetchers.ts deleted file mode 100644 index d4e3b0392549..000000000000 --- a/sdk/iot/modelsrepository/src/localModelFetchers.ts +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -"use strict"; - -import * as dtmiConventions from "./dtmiConventions"; -import * as modelMetadata from "./modelMetadata"; -import { DTDL } from "./DTDL"; -import fs from "fs"; -import * as path from "path"; -import { flattenDtdlResponse } from "./modelFetcherHelper"; - -async function recursiveFetcher( - dtmi: string, - directory: string, - tryFromExpanded: boolean -): Promise<{ [x: string]: DTDL }> { - let dependencyModels: { [x: string]: DTDL } = {}; - let fetchedModels: { [x: string]: DTDL }; - try { - console.log(`Fetching: ${dtmi}`); - fetchedModels = await fetcher(dtmi, directory, tryFromExpanded); - } catch (error) { - if (tryFromExpanded && error.code === "ENOENT") { - console.log("Fetching from expanded failed. Trying without."); - fetchedModels = await fetcher(dtmi, directory, false); - } else { - throw error; - } - } - const dtmis = Object.keys(fetchedModels); - for (let i = 0; i < dtmis.length; i++) { - const currentDtdl = fetchedModels[dtmis[i]]; - const metaModelData = modelMetadata.getModelMetadata(currentDtdl); - const deps = metaModelData.componentSchemas.concat(metaModelData.extends); - if (deps && deps.length > 0) { - for (let j = 0; j < deps.length; j++) { - if ( - Object.keys(dependencyModels).includes(deps[j]) || - Object.keys(fetchedModels).includes(deps[j]) - ) { - // do nothing - } else { - const fetchedDependencies = await recursiveFetcher(deps[j], directory, tryFromExpanded); - dependencyModels = { ...dependencyModels, ...fetchedDependencies }; - } - } - } - } - if (Object.keys(dependencyModels).length > 0) { - fetchedModels = { ...fetchedModels, ...dependencyModels }; - } - return fetchedModels; -} - -async function fetcher( - dtmi: string, - directory: string, - tryFromExpanded: boolean -): Promise<{ [dtmi: string]: DTDL }> { - const dtmiPath = dtmiConventions.dtmiToPath(dtmi); - const dtmiPathFormatted = tryFromExpanded - ? dtmiPath.replace(".json", ".expanded.json") - : dtmiPath; - const targetPath = path.join(directory, dtmiPathFormatted); - const dtdlFile = fs.readFileSync(targetPath, "utf8"); - const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); - if (Array.isArray(parsedDtdl)) { - const result = flattenDtdlResponse(parsedDtdl as DTDL[]); - return result; - } else { - const result = { [dtmi]: parsedDtdl as DTDL }; - return result; - } -} - -export { fetcher, recursiveFetcher }; diff --git a/sdk/iot/modelsrepository/src/modelFetcherHandler.ts b/sdk/iot/modelsrepository/src/modelFetcherHandler.ts index 45645e18a232..2983577ab124 100644 --- a/sdk/iot/modelsrepository/src/modelFetcherHandler.ts +++ b/sdk/iot/modelsrepository/src/modelFetcherHandler.ts @@ -1,53 +1,78 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -"use strict"; - -import { PipelineOptions } from "@azure/core-http"; -import * as fs from "fs"; -import * as url from "url"; -import * as localFetchers from "./localModelFetchers"; -import * as remoteFetchers from "./remoteModelFetchers"; - -function isLocalPath(p: string): boolean { - if (p.startsWith("https://") || p.startsWith("http://")) { - return false; - } else if (p.startsWith("file://")) { - return true; - } else { - try { - fs.accessSync(p); - return true; - } catch { - return false; - } - } -} - -interface modelFetcherParams { - pipeline: PipelineOptions - dtmis: string[]; - endpoint: string; - dependencyResolution: Dependency -} - -export async function modelFetcher({dtmis, endpoint, resolveDependencies}: modelFetcherParams -): Promise<{ [dtmi: string]: JSON | Array }> { - if (isLocalPath(endpoint)) { - const formattedDirectory = endpoint.includes("file://") - ? url.fileURLToPath(endpoint) - : endpoint; - if (tryFromExpanded || resolveDependencies) { - return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded); - } else { - console.log(`Fetching: ${dtmi}`); - return localFetchers.fetcher(dtmi, formattedDirectory, false); - } - } else { - if (tryFromExpanded || resolveDependencies) { - return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded); - } - console.log(`Fetching: ${dtmi}`); - return remoteFetchers.fetcher(dtmi, endpoint, false); - } -} +// // Copyright (c) Microsoft. +// // Licensed under the MIT license. + +// "use strict"; + +// import { PipelineOptions } from "@azure/core-http"; +// import * as fs from "fs"; +// import * as url from "url"; +// import * as localFetchers from "./filesystemModelFetcher"; +// import * as remoteFetchers from "./httpModelFetcher"; + +// function isLocalPath(p: string): boolean { +// if (p.startsWith("https://") || p.startsWith("http://")) { +// return false; +// } else if (p.startsWith("file://")) { +// return true; +// } else { +// try { +// fs.accessSync(p); +// return true; +// } catch { +// return false; +// } +// } +// } + +// interface modelFetcherParams { +// pipeline: PipelineOptions; +// dtmis: string[]; +// endpoint: string; +// dependencyResolution: Dependency; +// } + +// export class ModelFetcher { +// constructor(location, ) { +// this._location = location; +// } + +// fetch(dtdlPath) { +// this._fetcher. +// } + + +// static createHttpFetcher(location) { + +// } + +// static createFileSystemFetcher(location) { +// return new ModelFetcher() +// } +// } + + + + +// export async function modelFetcher({ +// dtmis, +// endpoint, +// resolveDependencies +// }: modelFetcherParams): Promise<{ [dtmi: string]: JSON | Array }> { +// if (isLocalPath(endpoint)) { +// const formattedDirectory = endpoint.includes("file://") +// ? url.fileURLToPath(endpoint) +// : endpoint; +// if (tryFromExpanded || resolveDependencies) { +// return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded); +// } else { +// console.log(`Fetching: ${dtmi}`); +// return localFetchers.fetcher(dtmi, formattedDirectory, false); +// } +// } else { +// if (tryFromExpanded || resolveDependencies) { +// return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded); +// } +// console.log(`Fetching: ${dtmi}`); +// return remoteFetchers.fetcher(dtmi, endpoint, false); +// } +// } diff --git a/sdk/iot/modelsrepository/src/modelFetcherHelper.ts b/sdk/iot/modelsrepository/src/modelFetcherHelper.ts index 87fb172b73ce..3f935e80e41b 100644 --- a/sdk/iot/modelsrepository/src/modelFetcherHelper.ts +++ b/sdk/iot/modelsrepository/src/modelFetcherHelper.ts @@ -5,6 +5,11 @@ import { DTDL } from "./DTDL"; +export function isLocalPath(p: string): boolean { + const myRegex = RegExp(/^(?:[a-zA-Z]\:|\\\\[\w\.]+\\[\w.$]+)\\(?:[\w]+\\)*\w([\w.])+$/g); + return !!p.match(myRegex); +} + export function flattenDtdlResponse(input: DTDL[]) { const newResult: { [x: string]: DTDL } = {}; for (let i = 0; i++; i < input.length) { diff --git a/sdk/iot/modelsrepository/src/modelMetadata.ts b/sdk/iot/modelsrepository/src/modelMetadata.ts deleted file mode 100644 index c46785d0826b..000000000000 --- a/sdk/iot/modelsrepository/src/modelMetadata.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -"use strict"; - -import { DTDL } from "./DTDL"; - -function getId(input: DTDL): string { - const idElement = input["@id"]; - return idElement; -} - -function getExtends(input: DTDL): string { - const extendElement = input.extends; - return extendElement; -} - -function getComponentSchemas(input: DTDL): string[] { - const componentSchemas: string[] = []; - if (input.contents) { - const contents = input.contents; - contents.forEach((element) => { - if ( - element["@type"] && - typeof element["@type"] === "string" && - element["@type"] === "Component" - ) { - if (element.schema && typeof element.schema === "string") { - componentSchemas.push(element.schema); - } - } - }); - } - return componentSchemas; -} - -export function getModelMetadata(input: DTDL) { - const idElement: string = getId(input); - const extendsElement: string = getExtends(input); - const componentSchemas: string[] = getComponentSchemas(input); - return { - id: idElement, - extends: extendsElement, - componentSchemas: componentSchemas - }; -} diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts new file mode 100644 index 000000000000..e8fd86ef4991 --- /dev/null +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +import { DTDL } from "./DTDL"; +import { logger } from "./logger"; +import { DtmiResolver } from "./resolver"; + +export class PseudoParser { + private _resolver; + + constructor(resolver: DtmiResolver) { + this._resolver = resolver; + } + + expand(models: any[]) { + let expandedMap: any = {}; + + for (let model of models) { + expandedMap[model['@id']] = model; + this._expand(model, expandedMap); + } + return expandedMap; + } + + private _expand(model: DTDL, modelMap: any) { + logger.info(`Expanding model: ${model['@id']}`); + let dependencies = this._getModelDependencies(model); + let dependenciesToResolve = dependencies.filter((dependency: string) => {return !(dependency in modelMap)}); + if (dependenciesToResolve.length !== 0) { + logger.info(`Outstanding dependencies found: ${dependenciesToResolve}`); + let resolvedDependenciesMap = this._resolver.resolve(dependenciesToResolve); + modelMap = {...modelMap, ...resolvedDependenciesMap}; + for (let dependencyModel of resolvedDependenciesMap.values()) { + this._expand(dependencyModel, modelMap); + } + } + } + + private _getModelDependencies(model: DTDL) { + let dependencies = []; + + if (model.contents !== undefined) { + const contents = model.contents; + contents.forEach((element) => { + if ( + element["@type"] && + typeof element["@type"] === "string" && + element["@type"] === "Component" + ) { + if (element.schema && typeof element.schema === "string") { + dependencies.push(element.schema); + } + } + }); + } + + if (model.extends !== undefined) { + if (typeof model.extends === 'string') { + dependencies.push(model.extends); + } else if (Array.isArray(model.extends)) { + model.extends.forEach(element => { + if (typeof element === 'string') { + dependencies.push(element); + } else if (typeof element === 'object') { + dependencies.push(this._getModelDependencies(element)); + } + }); + } + } + + dependencies = Array.from(new Set(dependencies)); + return dependencies; + } + +} \ No newline at end of file diff --git a/sdk/iot/modelsrepository/src/remoteModelFetchers.ts b/sdk/iot/modelsrepository/src/remoteModelFetchers.ts deleted file mode 100644 index 222e456800ff..000000000000 --- a/sdk/iot/modelsrepository/src/remoteModelFetchers.ts +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -"use strict"; - -import * as dtmiConventions from "./dtmiConventions"; -import * as modelMetadata from "./modelMetadata"; -import * as coreHttp from "@azure/core-http"; -import { DTDL } from "./DTDL"; -import { flattenDtdlResponse } from "./modelFetcherHelper"; - -async function recursiveFetcher( - dtmi: string, - endpoint: string, - tryFromExpanded: boolean -): Promise<{ [dtmi: string]: DTDL }> { - let dependencyModels: { [x: string]: DTDL } = {}; - let fetchedModels: { [x: string]: DTDL }; - try { - console.log(`Fetching: ${dtmi}`); - fetchedModels = await fetcher(dtmi, endpoint, tryFromExpanded); - } catch (error) { - if ( - tryFromExpanded && - (error.code === "ENOENT" || !(error.statusCode >= 200 && error.statusCode < 400)) - ) { - console.log("Fetching from expanded failed. Trying without."); - console.log(`Fetching: ${dtmi}`); - fetchedModels = await fetcher(dtmi, endpoint, false); - } else { - throw error; - } - } - const dtmis = Object.keys(fetchedModels); - for (let i = 0; i < dtmis.length; i++) { - const currentDtdl = fetchedModels[dtmis[i]]; - const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas; - if (deps && deps.length > 0) { - for (let j = 0; j < deps.length; j++) { - if ( - Object.keys(dependencyModels).includes(deps[j]) || - Object.keys(fetchedModels).includes(deps[j]) - ) { - // do nothing - } else { - const fetchedDependencies = await recursiveFetcher(deps[j], endpoint, tryFromExpanded); - dependencyModels = { ...dependencyModels, ...fetchedDependencies }; - } - } - } - } - if (Object.keys(dependencyModels).length > 0) { - fetchedModels = { ...fetchedModels, ...dependencyModels }; - } - return fetchedModels; -} - -async function fetcher( - dtmi: string, - endpoint: string, - tryFromExpanded: boolean -): Promise<{ [dtmi: string]: any }> { - const client = new coreHttp.ServiceClient(); - const req: coreHttp.RequestPrepareOptions = { - url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), - method: "GET" - }; - const res: coreHttp.HttpOperationResponse = await client.sendRequest(req); - if (res.status >= 200 && res.status < 400) { - const dtdlAsString = res.bodyAsText || ""; - const parsedDtdl = JSON.parse(dtdlAsString); - if (Array.isArray(parsedDtdl)) { - const result = flattenDtdlResponse(parsedDtdl as DTDL[]); - return result; - } else { - const result = { [dtmi]: parsedDtdl as DTDL }; - return result; - } - } else { - throw new coreHttp.RestError( - "Error on HTTP Request in remote model fetcher", - "404", - 404, - undefined, - res - ); - } -} - -export { fetcher, recursiveFetcher }; diff --git a/sdk/iot/modelsrepository/src/resolver.ts b/sdk/iot/modelsrepository/src/resolver.ts index 30a76ded382e..c64e2d41b9a8 100644 --- a/sdk/iot/modelsrepository/src/resolver.ts +++ b/sdk/iot/modelsrepository/src/resolver.ts @@ -1,52 +1,69 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -"use strict"; +import { dtmiToPath } from "./dtmiConventions"; +import { logger } from "./logger"; -import { modelFetcher } from "./modelFetcherHandler"; +export class FetcherError extends Error { + cause: Error | undefined; -interface resolverOptions { - resolveDependencies: "disabled" | "enabled" | "tryFromExpanded"; + constructor(message: string, cause?: Error) { + super(message); + this.cause = cause; + } } -function checkIfTryFromExpanded(options?: resolverOptions): boolean { - if (options && options.resolveDependencies && options.resolveDependencies === "tryFromExpanded") { - return true; +export class ResolverError extends Error { + cause: Error | undefined; + + constructor(message: string, cause?: Error) { + super(message); + this.cause = cause; } - return false; } -function checkIfResolveDependencies(options?: resolverOptions): boolean { - if (options && options.resolveDependencies && options.resolveDependencies === "enabled") { - return true; +export class DtmiResolver { + private _fetcher; + constructor(fetcher: any) { + this._fetcher = fetcher; } - return false; -} -/** - * resolve - get interfaces (dtdls) associated to a given dtmi - * - * @param dtmi code used to label and organize dtdl - * @param endpoint URL or local path for dtdl repository - * @param options object containing optional parameters - * - * @returns Promise that resolves to mapping of dtmi(s) to JSON dtdl(s) - */ -function resolve(dtmi: string, endpoint: string): Promise<{ [dtmi: string]: any }>; -function resolve( - dtmi: string, - endpoint: string, - options: resolverOptions -): Promise<{ [dtmi: string]: any }>; -function resolve( - dtmi: string, - endpoint: string, - options?: resolverOptions -): Promise<{ [dtmi: string]: any }> { - const tryFromExpanded = checkIfTryFromExpanded(options); - const resolveDependencies = checkIfResolveDependencies(options); - - return modelFetcher(dtmi, endpoint, resolveDependencies, tryFromExpanded); -} + resolve(dtmis: string[], expandedModel?: boolean) { + let modelMap: any = {}; + + + for (let dtmi of dtmis) { + let dtdl: any[] | any; + let dtdlPath = dtmiToPath(dtmi); + if (expandedModel) { + dtdlPath = dtdlPath.replace('.json', '.expanded.json'); + } + logger.info(`Model ${dtmi} located in repository at ${dtdlPath}`); -export { resolve }; + try { + dtdl = this._fetcher.fetch(dtdlPath); + } catch (e) { + if (e instanceof FetcherError) { + return Promise.reject(new ResolverError(`Failed to resolve dtmi: ${dtmi}`, e)); + } else { + return Promise.reject(e); + } + } + + if (expandedModel) { + for (let model of dtdl) { + modelMap[model['@id']] = model; + } + } else { + let model = dtdl; + if (model['@id'] != dtmi) { + return Promise.reject(new ResolverError(`DTMI mismatch - Request: ${dtmi}, Response ${model['@id']}`)); + } + + modelMap[`${dtmi}`] = dtdl; + } + } + + return modelMap; + } +} From 7e15c99b9250b110d1211fba42f0f7df23786ca0 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 13 Apr 2021 01:52:46 -0700 Subject: [PATCH 06/81] add more changes --- sdk/iot/modelsrepository/src/client.ts | 54 +++++++++---------- sdk/iot/modelsrepository/src/constants.ts | 6 +-- sdk/iot/modelsrepository/src/fetcher.ts | 3 +- .../src/filesystemModelFetcher.ts | 12 +---- .../modelsrepository/src/httpModelFetcher.ts | 12 ++--- .../src/modelFetcherHandler.ts | 4 -- sdk/iot/modelsrepository/src/psuedoParser.ts | 23 ++++---- sdk/iot/modelsrepository/src/resolver.ts | 11 ++-- 8 files changed, 52 insertions(+), 73 deletions(-) diff --git a/sdk/iot/modelsrepository/src/client.ts b/sdk/iot/modelsrepository/src/client.ts index fda70c58d0d0..ebfbb2e23e94 100644 --- a/sdk/iot/modelsrepository/src/client.ts +++ b/sdk/iot/modelsrepository/src/client.ts @@ -16,11 +16,9 @@ import { DtmiResolver, ResolverError } from "./resolver"; import { HttpFetcher } from "./httpModelFetcher"; import { FilesystemFetcher } from "./filesystemModelFetcher"; import { isLocalPath } from "./modelFetcherHelper"; -import * as path from 'path'; +import * as path from "path"; import { PseudoParser } from "./psuedoParser"; - - export interface ModelsRepositoryClientOptions extends PipelineOptions, OperationOptions { repositoryLocation: string | undefined; dependencyResolution: dependencyResolutionType; @@ -48,16 +46,16 @@ export class ModelsRepositoryClient { this._fetcher = this._createFetcher(this._repositoryLocation, options); this._resolver = new DtmiResolver(this._fetcher); this._pseudoParser = new PseudoParser(this._resolver); - + // Store api version here (for now). Currently doesn't do anything this._apiVersion = options?.apiVersion || constants.DEFAULT_API_VERSION; } private _checkDefaultDependencyResolution(customRepository: boolean) { if (customRepository) { - return 'enabled'; + return "enabled"; } else { - return 'tryFromExpanded'; + return "tryFromExpanded"; } } @@ -92,30 +90,31 @@ export class ModelsRepositoryClient { private _createFetcher(location: string, options: any) { // Return a Fetcher based upon the type of location - let locationURL; + let locationURL; let fetcher; if (isLocalPath(location)) { const localPath = path.normalize(location); // POSIX Filesystem Path or Windows Filesystem Path - logger.info(`Repository location identified as filesystem path - using FilesystemFetcher`) + logger.info(`Repository location identified as filesystem path - using FilesystemFetcher`); fetcher = new FilesystemFetcher(localPath); } else { locationURL = new URL(location); - if (locationURL.protocol in ['http', 'https']) { + if (locationURL.protocol in ["http", "https"]) { logger.info(`Repository location identified as HTTP/HTTPS endpoint - using HttpFetcher`); const pipeline = this._createPipeline(options); fetcher = new HttpFetcher(location, pipeline); - } - else if (locationURL.protocol === 'file') { + } else if (locationURL.protocol === "file") { // filesystem URI - logger.info('Repository Location identified as filesystem URI - using FilesystemFetcher'); + logger.info("Repository Location identified as filesystem URI - using FilesystemFetcher"); const localPath = fileURLToPath(location); fetcher = new FilesystemFetcher(localPath); - } else if (locationURL.protocol === '' && location.startsWith('/')) { - } else if (locationURL.protocol === '' && location.search(/\.[a-zA-Z]{2,63}$/)) { + } else if (locationURL.protocol === "" && location.startsWith("/")) { + } else if (locationURL.protocol === "" && location.search(/\.[a-zA-Z]{2,63}$/)) { // Web URL with protocol unspecified - default to HTTPS - logger.info('Repository Location identified as remote endpoint without protocol specified - using HttpFetcher'); - const fLocation = 'https://' + location; + logger.info( + "Repository Location identified as remote endpoint without protocol specified - using HttpFetcher" + ); + const fLocation = "https://" + location; const pipeline = this._createPipeline(options); fetcher = new HttpFetcher(fLocation, pipeline); // TODO: make the next line match a regex specified. @@ -123,8 +122,6 @@ export class ModelsRepositoryClient { throw new EvalError(`Unable to identify location: ${location}`); } } - - } getModels(dtmi: string, options: any): Promise<{ [dtmi: string]: any }>; @@ -136,34 +133,31 @@ export class ModelsRepositoryClient { } const dependencyResolution = options.dependencyResolution || this._dependencyResolution; - + if (dependencyResolution === constants.DEPENDENCY_MODE_DISABLED) { - logger.info('Getting models w/ dependency resolution mode: disabled'); + logger.info("Getting models w/ dependency resolution mode: disabled"); logger.info(`Retreiving model(s): ${dtmis}...`); modelMap = this._resolver.resolve(dtmis); - } - else if (dependencyResolution === constants.DEPENDENCY_MODE_ENABLED) { + } else if (dependencyResolution === constants.DEPENDENCY_MODE_ENABLED) { logger.info(`Getting models w/ dependency resolution mode: enabled`); logger.info(`Retreiving model(s): ${dtmis}...`); const baseModelMap = this._resolver.resolve(dtmis); const baseModelList = [baseModelMap.values()]; logger.info(`Retreiving model dependencies for ${dtmis}...`); modelMap = this._pseudoParser.expand(baseModelList); - } - else if (dependencyResolution === constants.DEPENDENCY_MODE_TRY_FROM_EXPANDED) { + } else if (dependencyResolution === constants.DEPENDENCY_MODE_TRY_FROM_EXPANDED) { logger.info(`Getting models w/ dependency resolution mode: tryFromExpanded`); try { logger.info(`Retreiving expanded model(s): ${dtmis}...`); - modelMap = this._resolver.resolve(dtmis, {expandedModel: true}); + modelMap = this._resolver.resolve(dtmis, { expandedModel: true }); } catch (e) { - if (e instanceof ResolverError) {} - else { + if (e instanceof ResolverError) { + } else { Promise.reject(e); } } - } - else { - Promise.reject(EvalError(`Invalid dependency resolution mode: ${dependencyResolution}`)) + } else { + Promise.reject(EvalError(`Invalid dependency resolution mode: ${dependencyResolution}`)); } return modelMap; diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts index c2affb94b1a0..b0ee839f1845 100644 --- a/sdk/iot/modelsrepository/src/constants.ts +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -11,6 +11,6 @@ export const DEFAULT_USER_AGENT = `azsdk-node-modelsrepository/${SDK_VERSION} ($ export const DEFAULT_REPOSITORY_LOCATION = "https://devicemodels.azure.com"; export const DEFAULT_API_VERSION = "2021-02-11"; -export const DEPENDENCY_MODE_DISABLED = 'disabled'; -export const DEPENDENCY_MODE_ENABLED = 'enabled'; -export const DEPENDENCY_MODE_TRY_FROM_EXPANDED = 'tryFromExpanded'; \ No newline at end of file +export const DEPENDENCY_MODE_DISABLED = "disabled"; +export const DEPENDENCY_MODE_ENABLED = "enabled"; +export const DEPENDENCY_MODE_TRY_FROM_EXPANDED = "tryFromExpanded"; diff --git a/sdk/iot/modelsrepository/src/fetcher.ts b/sdk/iot/modelsrepository/src/fetcher.ts index 86a6d30886b0..3e13613d576d 100644 --- a/sdk/iot/modelsrepository/src/fetcher.ts +++ b/sdk/iot/modelsrepository/src/fetcher.ts @@ -2,6 +2,5 @@ // Licensed under the MIT license. export abstract class Fetcher { - - abstract fetch(path:string): any; + abstract fetch(path: string): any; } diff --git a/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts b/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts index a27fbdb9968e..6fab85421685 100644 --- a/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts +++ b/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts @@ -3,7 +3,7 @@ import { DTDL } from "./DTDL"; import fs from "fs"; -import * as path from 'path'; +import * as path from "path"; import { Fetcher } from "./fetcher"; import { logger } from "./logger"; import { FetcherError } from "./resolver"; @@ -26,19 +26,11 @@ export class FilesystemFetcher extends Fetcher { const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); return parsedDtdl; } catch (e) { - throw new FetcherError('Failed to fetch from Filesystem', e); + throw new FetcherError("Failed to fetch from Filesystem", e); } } } - - - - - - - - // async function recursiveFetcher( // dtmi: string, // directory: string, diff --git a/sdk/iot/modelsrepository/src/httpModelFetcher.ts b/sdk/iot/modelsrepository/src/httpModelFetcher.ts index 259ca07d641a..a08714bcd7c3 100644 --- a/sdk/iot/modelsrepository/src/httpModelFetcher.ts +++ b/sdk/iot/modelsrepository/src/httpModelFetcher.ts @@ -8,8 +8,6 @@ import { logger } from "./logger"; import { RequestPrepareOptions } from "@azure/core-http"; import { Fetcher } from "./fetcher"; - - export class HttpFetcher extends Fetcher { private _pipeline: coreHttp.ServiceClient; private _baseURL: string; @@ -25,10 +23,10 @@ export class HttpFetcher extends Fetcher { const myURL = this._baseURL + path; const request: RequestPrepareOptions = { url: myURL, - method: 'GET' - } + method: "GET" + }; const res: coreHttp.HttpOperationResponse = await this._pipeline.sendRequest(request); - + if (res.status >= 200 && res.status < 400) { const dtdlAsString = res.bodyAsText || ""; const parsedDtdl = JSON.parse(dtdlAsString); @@ -52,8 +50,6 @@ export class HttpFetcher extends Fetcher { } } - - // async function recursiveFetcher( // dtmi: string, // endpoint: string, @@ -131,5 +127,5 @@ export class HttpFetcher extends Fetcher { // ); // } // } -// +// // export { fetcher, recursiveFetcher }; diff --git a/sdk/iot/modelsrepository/src/modelFetcherHandler.ts b/sdk/iot/modelsrepository/src/modelFetcherHandler.ts index 2983577ab124..da164cc0b936 100644 --- a/sdk/iot/modelsrepository/src/modelFetcherHandler.ts +++ b/sdk/iot/modelsrepository/src/modelFetcherHandler.ts @@ -40,7 +40,6 @@ // this._fetcher. // } - // static createHttpFetcher(location) { // } @@ -50,9 +49,6 @@ // } // } - - - // export async function modelFetcher({ // dtmis, // endpoint, diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index e8fd86ef4991..f463505cc109 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -16,20 +16,22 @@ export class PseudoParser { let expandedMap: any = {}; for (let model of models) { - expandedMap[model['@id']] = model; + expandedMap[model["@id"]] = model; this._expand(model, expandedMap); } return expandedMap; } private _expand(model: DTDL, modelMap: any) { - logger.info(`Expanding model: ${model['@id']}`); + logger.info(`Expanding model: ${model["@id"]}`); let dependencies = this._getModelDependencies(model); - let dependenciesToResolve = dependencies.filter((dependency: string) => {return !(dependency in modelMap)}); + let dependenciesToResolve = dependencies.filter((dependency: string) => { + return !(dependency in modelMap); + }); if (dependenciesToResolve.length !== 0) { logger.info(`Outstanding dependencies found: ${dependenciesToResolve}`); let resolvedDependenciesMap = this._resolver.resolve(dependenciesToResolve); - modelMap = {...modelMap, ...resolvedDependenciesMap}; + modelMap = { ...modelMap, ...resolvedDependenciesMap }; for (let dependencyModel of resolvedDependenciesMap.values()) { this._expand(dependencyModel, modelMap); } @@ -55,13 +57,13 @@ export class PseudoParser { } if (model.extends !== undefined) { - if (typeof model.extends === 'string') { - dependencies.push(model.extends); + if (typeof model.extends === "string") { + dependencies.push(model.extends); } else if (Array.isArray(model.extends)) { - model.extends.forEach(element => { - if (typeof element === 'string') { + model.extends.forEach((element) => { + if (typeof element === "string") { dependencies.push(element); - } else if (typeof element === 'object') { + } else if (typeof element === "object") { dependencies.push(this._getModelDependencies(element)); } }); @@ -71,5 +73,4 @@ export class PseudoParser { dependencies = Array.from(new Set(dependencies)); return dependencies; } - -} \ No newline at end of file +} diff --git a/sdk/iot/modelsrepository/src/resolver.ts b/sdk/iot/modelsrepository/src/resolver.ts index c64e2d41b9a8..15cb25b2229e 100644 --- a/sdk/iot/modelsrepository/src/resolver.ts +++ b/sdk/iot/modelsrepository/src/resolver.ts @@ -31,12 +31,11 @@ export class DtmiResolver { resolve(dtmis: string[], expandedModel?: boolean) { let modelMap: any = {}; - for (let dtmi of dtmis) { let dtdl: any[] | any; let dtdlPath = dtmiToPath(dtmi); if (expandedModel) { - dtdlPath = dtdlPath.replace('.json', '.expanded.json'); + dtdlPath = dtdlPath.replace(".json", ".expanded.json"); } logger.info(`Model ${dtmi} located in repository at ${dtdlPath}`); @@ -52,12 +51,14 @@ export class DtmiResolver { if (expandedModel) { for (let model of dtdl) { - modelMap[model['@id']] = model; + modelMap[model["@id"]] = model; } } else { let model = dtdl; - if (model['@id'] != dtmi) { - return Promise.reject(new ResolverError(`DTMI mismatch - Request: ${dtmi}, Response ${model['@id']}`)); + if (model["@id"] != dtmi) { + return Promise.reject( + new ResolverError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`) + ); } modelMap[`${dtmi}`] = dtdl; From 438238f550278653bebade26e0ce4d58a1a864d7 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 13 Apr 2021 08:44:45 -0700 Subject: [PATCH 07/81] remove tests and fix readme --- sdk/iot/modelsrepository/README.md | 67 ++++--- .../test/node/dtmiConventions.spec.ts | 172 ------------------ 2 files changed, 46 insertions(+), 193 deletions(-) delete mode 100644 sdk/iot/modelsrepository/test/node/dtmiConventions.spec.ts diff --git a/sdk/iot/modelsrepository/README.md b/sdk/iot/modelsrepository/README.md index 842e902096dc..61211b53b405 100644 --- a/sdk/iot/modelsrepository/README.md +++ b/sdk/iot/modelsrepository/README.md @@ -1,41 +1,66 @@ # Azure IoT Resolver library for Javascript -The Azure IoT Resolver library for Javascript provides implementations for interacting with the Azure IoT Model Repository. Use the Azure IoT Resolver library for Javascript to pull DTDL files from remote endpoints. +This package contains an isomorphic Client Library for Azure IoT Models Repository in Javascript. Use the Azure IoT Resolver library for Javascript to pull DTDL files from remote endpoints. ## Key concepts The Azure IoT Resolver library for Javascript is written to interact with the Azure IoT PlugAndPlay Models Repository, for those developers who wish to write applications in Javascript to do so. -## Examples +### Currently supported environments -_THIS WILL CHANGE WHEN MERGED INTO THE MONOREPO_ +- Node.js version 10.x.x or higher +- Browser JavaScript -To run the javascript examples, go to the samples directory: +### How to Install -```bash -// FROM THIS DIRECTORY -$ npm install -$ npx tsc -$ cd samples/javascript -$ node example.js +``` +npm install @azure/iot-modelsrepository-client ``` -## Run the temporary test script +### How to use -```bash -// FROM THIS DIRECTORY -$ npm install -$ npx tsc -$ npm run temp-unit-test -``` +#### nodejs - Authentication, client creation and get ioTSpaces as an example written in TypeScript. + +##### Sample code -### General +```ts +import {ModelsRepositoryClient} from "@azure/iot-modelsrepository-client"; -TODO +const client = new ModelsRepositoryClient('https://devicemodels.azure.com'); +const result = await client.getModels('dtmi:azure:DeviceManagement:DeviceInformation;1'); +console.log(result); +``` + +#### browser - Authentication, client creation and get ioTSpaces as an example written in JavaScript. + +##### Sample code + +- index.html +```html + + + + @azure/iot-modelsrepository-client sample + + + + + +``` -### Additional documentation +## Related projects -TODO +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) ## Contributing diff --git a/sdk/iot/modelsrepository/test/node/dtmiConventions.spec.ts b/sdk/iot/modelsrepository/test/node/dtmiConventions.spec.ts deleted file mode 100644 index aa7d5d2bbd79..000000000000 --- a/sdk/iot/modelsrepository/test/node/dtmiConventions.spec.ts +++ /dev/null @@ -1,172 +0,0 @@ -/* eslint-disable no-undef */ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import * as lib from "../../src/dtmiConventions"; - -// fake class while lib not implemented -import * as sinon from "sinon"; -import { assert, expect } from "chai"; - -interface ValidParams { - dtmi: string; - path: string; - url: string; -} - -const validParameters: ValidParams[] = [ - { - dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;1", - path: "dtmi/azure/devicemanagement/deviceinformation-1.json", - url: "https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json" - }, - { - dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;10000", - path: "dtmi/azure/devicemanagement/deviceinformation-10000.json", - url: "https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-10000.json" - }, - { - dtmi: "dtmi:com:DeviceInformation;1", - path: "dtmi/com/deviceinformation-1.json", - url: "https://contoso.com/dtmi/com/deviceinformation-1.json" - }, - { - dtmi: "dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1", - path: "dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json", - url: "https://contoso.com/dtmi/test/devicemanagement/foo/bar/testonetwothree-1.json" - }, - { - dtmi: "dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7", - path: "dtmi/azure/devicemanagement/thermometer-7.json", - url: "https://contoso.com/dtmi/azure/devicemanagement/thermometer-7.json" - }, - { - dtmi: "dtmi:thermometer;2", - path: "dtmi/thermometer-2.json", - url: "https://contoso.com/dtmi/thermometer-2.json" - } -]; - -const invalidParameters: { dtmi: string }[] = [ - { dtmi: "dtmiazure:DeviceManagement:DeviceInformation;1" }, - { dtmi: "dtmi;azure;DeviceManagement;DeviceInformation;1" }, - { dtmi: "asdf" }, - { dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;-1" }, - { dtmi: "dtmi:azure:DeviceManagement:Device-Information;1" }, - { dtmi: "DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7" }, - { dtmi: "dmti:azure:thermometer;10" } -]; - -describe("dtmiConventions", function() { - afterEach(function() { - sinon.restore(); - }); - - describe("isValidDtmi", function() { - describe("valid", function() { - function validTest(givenDtmi: string) { - const result = lib.isValidDtmi(givenDtmi); - assert(result, "valid dtmi not found as valid"); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should validate a correctly formatted dtmi (${validParameters[i].dtmi})`, function() { - validTest(validParameters[i].dtmi); - }); - } - }); - - describe("invalid", function() { - function invalidTest(givenDtmi: string) { - const result = lib.isValidDtmi(givenDtmi); - assert(!result, "invalid dtmi incorrectly labelled as valid"); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should invalidate incorrectly formatted dtmi (${invalidParameters[i].dtmi})`, function() { - invalidTest(invalidParameters[i].dtmi); - }); - } - }); - }); - - describe("dtmiToPath", function() { - describe("valid", function() { - function validTest(givenDtmi: string, expectedPath: string) { - const result = lib.dtmiToPath(givenDtmi); - assert.deepEqual(result, expectedPath); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a generic path (${validParameters[i].dtmi})`, function() { - validTest(validParameters[i].dtmi, validParameters[i].path); - }); - } - }); - - describe("invalid", function() { - function invalidTest(givenDtmi: string) { - expect(() => { - lib.dtmiToPath(givenDtmi); - }).to.throw("DTMI provided is invalid. Ensure it follows DTMI conventions."); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function() { - invalidTest(invalidParameters[i].dtmi); - }); - } - }); - }); - - describe("dtmiToFullyQualifiedPath", function() { - describe("invalid", function() { - function invalidTest(givenDtmi: string) { - expect(() => { - const fakeBasePath = "https://contoso.com"; - lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); - }).to.throw("DTMI provided is invalid. Ensure it follows DTMI conventions."); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < invalidParameters.length; i++) { - it(`should fail if the dtmi is not formatted correctly (${invalidParameters[i].dtmi})`, function() { - invalidTest(invalidParameters[i].dtmi); - }); - } - }); - - describe("valid", function() { - describe("standard url", function() { - function reformatTest(givenDtmi: string, expected: string) { - const fakeBasePath = "https://contoso.com"; - const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, false); - assert.deepEqual(result, expected); - } - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a qualified path (${validParameters[i].dtmi})`, function() { - reformatTest(validParameters[i].dtmi, validParameters[i].url); - }); - } - }); - - describe("expanded url", function() { - function addExpandedTest(givenDtmi: string, expected: string) { - const fakeBasePath = "https://contoso.com"; - const result = lib.dtmiToQualifiedPath(givenDtmi, fakeBasePath, true); - assert.deepEqual(result, expected); - } - - // eslint-disable-next-line mocha/no-setup-in-describe - for (let i = 0; i < validParameters.length; i++) { - it(`should reformat a DTMI to a qualified path with expanded.json (${validParameters[i].dtmi})`, function() { - addExpandedTest( - validParameters[i].dtmi, - validParameters[i].url.replace(".json", ".expanded.json") - ); - }); - } - }); - }); - }); -}); From da8a359c85d324f8a268480dd26a42ec21c68820 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 13 Apr 2021 08:49:58 -0700 Subject: [PATCH 08/81] readme --- sdk/iot/modelsrepository/README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sdk/iot/modelsrepository/README.md b/sdk/iot/modelsrepository/README.md index 61211b53b405..23ee4853130d 100644 --- a/sdk/iot/modelsrepository/README.md +++ b/sdk/iot/modelsrepository/README.md @@ -24,10 +24,10 @@ npm install @azure/iot-modelsrepository-client ##### Sample code ```ts -import {ModelsRepositoryClient} from "@azure/iot-modelsrepository-client"; +import { ModelsRepositoryClient } from "@azure/iot-modelsrepository-client"; -const client = new ModelsRepositoryClient('https://devicemodels.azure.com'); -const result = await client.getModels('dtmi:azure:DeviceManagement:DeviceInformation;1'); +const client = new ModelsRepositoryClient("https://devicemodels.azure.com"); +const result = await client.getModels("dtmi:azure:DeviceManagement:DeviceInformation;1"); console.log(result); ``` @@ -36,6 +36,7 @@ console.log(result); ##### Sample code - index.html + ```html @@ -47,11 +48,14 @@ console.log(result); const repositoryLocation = ""; // async / await OR chaining can be used. const client = new Azure.IotModelsrepositoryClient.ModelsRepositoryClient(repositoryLocation); - client.getModels(dtmi).then((result) => { - console.log(`The result is: ${result}`); - }).catch((err) => { - console.log(`An error occured: ${err}`); - }); + client + .getModels(dtmi) + .then((result) => { + console.log(`The result is: ${result}`); + }) + .catch((err) => { + console.log(`An error occured: ${err}`); + }); From b537e91e2cf15524bb997b897d56a0d8836df529 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 13 Apr 2021 15:42:54 -0700 Subject: [PATCH 09/81] update infrastructure --- common/config/rush/pnpm-lock.yaml | 14 +- sdk/iot/modelsrepository/.nycrc | 7 +- sdk/iot/modelsrepository/karma.conf.js | 138 ++++++++++++ sdk/iot/modelsrepository/package.json | 21 +- .../modelsrepository/rollup.base.config.js | 202 ++++++++++++++++++ sdk/iot/modelsrepository/rollup.config.js | 24 ++- .../samples/javascript/remote_example.js | 11 +- sdk/iot/modelsrepository/src/psuedoParser.ts | 7 +- .../modelsrepository/test/node/index.spec.ts | 74 ++++++- .../deviceinformation-1.json | 0 .../FakeDeviceManagement/thermostat-2.json | 89 ++++++++ sdk/iot/modelsrepository/tsconfig.json | 33 +-- 12 files changed, 561 insertions(+), 59 deletions(-) create mode 100644 sdk/iot/modelsrepository/karma.conf.js create mode 100644 sdk/iot/modelsrepository/rollup.base.config.js create mode 100644 sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/deviceinformation-1.json create mode 100644 sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index f0f35643f522..77cea54bd785 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -9281,10 +9281,15 @@ packages: '@azure/core-tracing': 1.0.0-preview.9 '@microsoft/api-extractor': 7.7.11 '@opentelemetry/api': 0.10.2 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 '@types/chai': 4.2.14 '@types/chai-as-promised': 7.1.3 '@types/mocha': 7.0.2 - '@types/node': 10.17.51 + '@types/node': 8.10.66 chai: 4.3.0 chai-as-promised: 7.1.1_chai@4.3.0 cross-env: 7.0.3 @@ -9310,6 +9315,11 @@ packages: prettier: 1.19.1 rimraf: 3.0.2 rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup-plugin-terser: 5.3.1_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + sinon: 9.2.4 + ts-node: 8.10.2_typescript@4.1.2 tslib: 2.1.0 typedoc: 0.15.2 typescript: 4.1.2 @@ -9317,7 +9327,7 @@ packages: dev: false name: '@rush-temp/iot-modelsrepository-client' resolution: - integrity: sha512-eo8GMH/Pb5NyBd9X5YuI/vHWuwPSe/sOewFeZQ0jwdMlmkbCqsnWINFvmNEF/94yXAPwJKoFHk4JfYnRHBjVAQ== + integrity: sha512-DsB8EEFo7NXzIx9bIHea+DGKkG7SxhAcsMRdCxgi6OWHQucV9n3vGix2mDLcWqByIkvCBGg44nVXheAX/rWUbg== tarball: file:projects/iot-modelsrepository-client.tgz version: 0.0.0 file:projects/keyvault-admin.tgz: diff --git a/sdk/iot/modelsrepository/.nycrc b/sdk/iot/modelsrepository/.nycrc index fe3db50b6a48..320eddfeffb9 100644 --- a/sdk/iot/modelsrepository/.nycrc +++ b/sdk/iot/modelsrepository/.nycrc @@ -6,9 +6,14 @@ "**/*.d.ts", "dist-esm/src/generated/*" ], + "reporter": [ + "text-summary", + "html", + "cobertura" + ], "exclude-after-remap": false, "sourceMap": true, "produce-source-map": true, "instrument": true, "all": true - } \ No newline at end of file + } diff --git a/sdk/iot/modelsrepository/karma.conf.js b/sdk/iot/modelsrepository/karma.conf.js new file mode 100644 index 000000000000..9bca108da550 --- /dev/null +++ b/sdk/iot/modelsrepository/karma.conf.js @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// https://github.com/karma-runner/karma-chrome-launcher +process.env.CHROME_BIN = require("puppeteer").executablePath(); +require("dotenv").config(); +const { + jsonRecordingFilterFunction, + isPlaybackMode, + isSoftRecordMode, + isRecordMode +} = require("@azure/test-utils-recorder"); + +module.exports = function(config) { + config.set({ + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: "./", + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ["mocha"], + + plugins: [ + "karma-mocha", + "karma-mocha-reporter", + "karma-chrome-launcher", + "karma-edge-launcher", + "karma-firefox-launcher", + "karma-ie-launcher", + "karma-env-preprocessor", + "karma-coverage", + "karma-junit-reporter", + "karma-json-to-file-reporter", + "karma-json-preprocessor" + ], + + // list of files / patterns to load in the browser + files: [ + "dist-test/index.browser.js", + { pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true } + ].concat(isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []), + + // list of files / patterns to exclude + exclude: [], + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + "**/*.js": ["env"], + "recordings/browsers/**/*.json": ["json"], + // IMPORTANT: COMMENT following line if you want to debug in your browsers!! + // Preprocess source file to calculate code coverage, however this will make source file unreadable + "test-browser/index.js": ["coverage"] + }, + + envPreprocessor: [ + "TEST_MODE", + "APPCONFIG_ENDPOINT", + "APPCONFIG_TEST_SETTING_KEY", + "APPCONFIG_TEST_SETTING_EXPECTED_VALUE", + "AZURE_CLIENT_ID", + "AZURE_CLIENT_SECRET", + "AZURE_TENANT_ID" + ], + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ["mocha", "coverage", "junit", "json-to-file"], + + coverageReporter: { + // specify a common output directory + dir: "coverage-browser/", + reporters: [{ type: "json", subdir: ".", file: "coverage.json" }] + }, + + junitReporter: { + outputDir: "", // results will be saved as $outputDir/$browserName.xml + outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile + suite: "", // suite will become the package name attribute in xml testsuite element + useBrowserName: false, // add browser name to report and classes names + nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element + classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element + properties: {} // key value pair of properties to add to the section of the report + }, + + jsonToFileReporter: { + filter: jsonRecordingFilterFunction, + outputPath: "." + }, + + // web server port + port: 9876, + + // enable / disable colors in the output (reporters and logs) + colors: true, + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + // --no-sandbox allows our tests to run in Linux without having to change the system. + // --disable-web-security allows us to authenticate from the browser without having to write tests using interactive auth, which would be far more complex. + browsers: ["ChromeHeadlessNoSandbox"], + customLaunchers: { + ChromeHeadlessNoSandbox: { + base: "ChromeHeadless", + flags: ["--no-sandbox", "--disable-web-security"] + } + }, + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: 1, + + browserNoActivityTimeout: 600000, + browserDisconnectTimeout: 10000, + browserDisconnectTolerance: 3, + browserConsoleLogOptions: { + terminal: !isRecordMode() + }, + + client: { + mocha: { + // change Karma's debug.html to the mocha web reporter + reporter: "html", + timeout: "600000" + } + } + }); +}; diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index a9183f7a5acc..38657acec51b 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -42,11 +42,13 @@ "dist-esm/src/", "types/template.d.ts", "README.md", - "LICENSE" + "LICENSE", + "rollup.config.js", + "tsconfig.json" ], "repository": "github:Azure/azure-sdk-for-js", "engines": { - "node": ">=10.0.0" + "node": ">=8.0.0" }, "keywords": [ "azure", @@ -72,15 +74,13 @@ "devDependencies": { "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@azure/identity": "^1.1.0", "@azure/test-utils-recorder": "^1.0.0", "@microsoft/api-extractor": "7.7.11", "@types/chai": "^4.1.6", - "@types/chai-as-promised": "^7.1.0", "@types/mocha": "^7.0.2", - "@types/node": "^10.0.0", + "@types/node": "^8.0.0", + "ts-node": "^8.3.0", "chai": "^4.2.0", - "chai-as-promised": "^7.1.1", "cross-env": "^7.0.2", "dotenv": "^8.2.0", "eslint": "^7.15.0", @@ -103,6 +103,15 @@ "prettier": "^1.16.4", "rimraf": "^3.0.0", "rollup": "^1.16.3", + "rollup-plugin-sourcemaps": "^0.4.2", + "rollup-plugin-terser": "^5.1.1", + "rollup-plugin-visualizer": "^4.0.4", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "@rollup/plugin-replace": "^2.2.0", + "sinon": "^9.0.2", "typedoc": "0.15.2", "typescript": "4.1.2", "util": "^0.12.1" diff --git a/sdk/iot/modelsrepository/rollup.base.config.js b/sdk/iot/modelsrepository/rollup.base.config.js new file mode 100644 index 000000000000..dfe95962951c --- /dev/null +++ b/sdk/iot/modelsrepository/rollup.base.config.js @@ -0,0 +1,202 @@ +import path from "path"; +import nodeResolve from "@rollup/plugin-node-resolve"; +import multiEntry from "@rollup/plugin-multi-entry"; +import cjs from "@rollup/plugin-commonjs"; +import replace from "@rollup/plugin-replace"; +import { terser } from "rollup-plugin-terser"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import viz from "rollup-plugin-visualizer"; +import shim from "rollup-plugin-shim"; +import inject from "@rollup/plugin-inject"; + +const pkg = require("./package.json"); +const depNames = Object.keys(pkg.dependencies); +const devDepNames = Object.keys(pkg.devDependencies); +const input = "dist-esm/src/index.js"; +const production = process.env.NODE_ENV === "production"; +const testModes = ["unit", "integration"]; + +export function nodeConfig() { + const externalNodeBuiltins = ["crypto", "url"]; + const baseConfig = { + input: input, + external: depNames.concat(externalNodeBuiltins), + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [ + sourcemaps(), + replace({ + delimiters: ["", ""], + values: { + // replace dynamic checks with if (true) since this is for node only. + // Allows rollup's dead code elimination to be more aggressive. + "if (isNode)": "if (true)" + } + }), + nodeResolve({ preferBuiltins: true }), + cjs() + ] + }; + + if (production) { + baseConfig.plugins.push(terser()); + } + + return baseConfig; +} + +export function browserConfig() { + const baseConfig = { + input: input, + external: ["fs-extra", "nock", "path"], + output: { + file: "dist-browser/data-tables.js", + format: "umd", + name: "Azure.Data.Tables", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + sourcemaps(), + replace({ + delimiters: ["", ""], + values: { + // replace dynamic checks with if (false) since this is for + // browser only. Rollup's dead code elimination will remove + // any code guarded by if (isNode) { ... } + "if (isNode)": "if (false)" + } + }), + // os is not used by the browser bundle, so just shim it + shim({ + fs: `export default {}`, + path: `export function join() {}`, + stream: `export default {}`, + dotenv: `export function config() { }`, + os: ` + export function arch() { return "javascript" } + export function type() { return "Browser" } + export function release() { typeof navigator === 'undefined' ? '' : navigator.appVersion } + `, + constants: `export default {}` + }), + nodeResolve({ + mainFields: ["module", "browser"], + preferBuiltins: false + }), + cjs({ + namedExports: { + chai: ["assert"], + "@opentelemetry/api": ["CanonicalCode", "SpanKind", "TraceFlags"] + } + }), + inject({ + modules: { + process: "process" + }, + exclude: ["./**/package.json"] + }), + viz({ filename: "dist-browser/browser-stats.html", sourcemap: false }) + ] + }; + + return baseConfig; +} + +export function nodeTestConfig(testMode) { + if (!testModes.includes(testMode)) { + throw new Error(`Unknown test mode ${testMode}. Supported modes ${testModes.join(",")}`); + } + + const baseConfig = nodeConfig(); + + const input = + testMode === "unit" + ? [ + // common tests + "dist-esm/test/unit/*.spec.js", + // node specific tests + "dist-esm/test/unit/node/*.spec.js" + ] + : [ + // common tests + "dist-esm/test/integration/*.spec.js", + // node specific tests + "dist-esm/test/integration/node/*.spec.js" + ]; + + // Entry points - test files under the `test` folder(common for both browser and node), node specific test files + baseConfig.input = input; + baseConfig.plugins.unshift(multiEntry({ exports: false })); + + // different output file + baseConfig.output.file = `dist-test/${testMode}.index.node.js`; + + // mark devdeps as external + baseConfig.external.push(...devDepNames); + + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, rollup started respecting + // the "sideEffects" field in package.json. Since our package.json sets "sideEffects=false", this also + // applies to test code, which causes all tests to be removed by tree-shaking. + baseConfig.treeshake = false; + + return baseConfig; +} + +export function browserTestConfig(testMode) { + if (!testModes.includes(testMode)) { + throw new Error(`Unknown test mode ${testMode}. Supported modes ${testModes.join(",")}`); + } + + const baseConfig = browserConfig(); + + const input = + testMode === "unit" + ? [ + // common tests + "dist-esm/test/unit/*.spec.js", + // browser specific tests + "dist-esm/test/unit/browser/*.spec.js" + ] + : [ + // common tests + "dist-esm/test/integration/*.spec.js", + // browser specific tests + "dist-esm/test/integration/browser/*.spec.js" + ]; + + // Entry points - test files under the `test` folder(common for both browser and node), browser specific test files + baseConfig.input = input; + baseConfig.plugins.unshift(multiEntry({ exports: false })); + baseConfig.output.file = `dist-test/${testMode}.index.browser.js`; + + // mark fs-extra as external + baseConfig.external = ["fs-extra", "process"]; + + baseConfig.output.globals = { + ...baseConfig.output.globals, + "fs-extra": "fs", + process: "process" + }; + + baseConfig.context = "null"; + + baseConfig.onwarn = (warning) => { + if ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer.indexOf(path.normalize("node_modules/chai/lib") === 0) + ) { + // Chai contains circular references, but they are not fatal and can be ignored. + return; + } + + console.error(`(!) ${warning.message}`); + }; + + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, rollup started respecting + // the "sideEffects" field in package.json. Since our package.json sets "sideEffects=false", this also + // applies to test code, which causes all tests to be removed by tree-shaking. + baseConfig.treeshake = false; + + return baseConfig; +} diff --git a/sdk/iot/modelsrepository/rollup.config.js b/sdk/iot/modelsrepository/rollup.config.js index a173140336a0..14652aa67ed8 100644 --- a/sdk/iot/modelsrepository/rollup.config.js +++ b/sdk/iot/modelsrepository/rollup.config.js @@ -1,11 +1,13 @@ -import resolve from "@rollup/plugin-node-resolve"; -import auto from "@rollup/plugin-auto-install"; - -export default { - input: "dist-esm/index.js", - output: { - file: "bundle.js", - format: "cjs" - }, - plugins: [auto(), resolve()] -}; +import * as base from "./rollup.base.config"; + +const inputs = []; + +if (!process.env.ONLY_BROWSER) { + inputs.push(base.nodeConfig()); +} + +if (!process.env.ONLY_NODE) { + inputs.push(base.browserConfig()); +} + +export default inputs; diff --git a/sdk/iot/modelsrepository/samples/javascript/remote_example.js b/sdk/iot/modelsrepository/samples/javascript/remote_example.js index 8ceed9ee91cc..79418f656937 100644 --- a/sdk/iot/modelsrepository/samples/javascript/remote_example.js +++ b/sdk/iot/modelsrepository/samples/javascript/remote_example.js @@ -5,19 +5,18 @@ * Demonstrates resolving/obtaining a particular model definition from a remote model repository */ -const resolver = require("../../out/src/index.js"); +const DtmiResolver = require('../../dist-esm/src/client'); // You can change the endpoint and dtmi you'd like to access -const repositoryEndpoint = "https://devicemodels.azure.com/"; +const repositoryLocation = "https://devicemodels.azure.com/"; const dtmi = process.argv[2] || "dtmi:rigado:FlicButton;2"; -console.log(repositoryEndpoint, dtmi); +console.log(repositoryLocation, dtmi); async function main() { // This is where you can change the options for how you want to resolve the dependencies. - const result = await resolver.resolve(dtmi, repositoryEndpoint, { - resolveDependencies: "tryFromExpanded" - }); + const client = new DtmiResolver(repositoryLocation); + const result = await client.getmodels(dtmi); console.log(result); Object.keys(result).forEach((fetchedDtmi) => { console.log(`DTMI is: ${fetchedDtmi}`); diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index f463505cc109..79719dc35ff9 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -12,13 +12,14 @@ export class PseudoParser { this._resolver = resolver; } - expand(models: any[]) { + expand(models: DTDL[]) { let expandedMap: any = {}; - for (let model of models) { + models.forEach((model: DTDL) => { expandedMap[model["@id"]] = model; this._expand(model, expandedMap); - } + }); + return expandedMap; } diff --git a/sdk/iot/modelsrepository/test/node/index.spec.ts b/sdk/iot/modelsrepository/test/node/index.spec.ts index ebf996843283..6ba22bb93a3e 100644 --- a/sdk/iot/modelsrepository/test/node/index.spec.ts +++ b/sdk/iot/modelsrepository/test/node/index.spec.ts @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import * as resolverTool from "../../src"; +import {DtmiResolver} from "../../src"; import * as coreHttp from "@azure/core-http"; import * as fs from "fs"; @@ -11,12 +11,84 @@ import * as sinon from "sinon"; import * as path from "path"; +interface remoteResolutionScenario { + name: string; + clientOptions: { + dependencyResolution: string; + repositoryLocation: string; + }; + dtmis: { + dtmi: string; + expectedURI: string + expectedOutput: { + fakeDtdl: string; + }; + }[]; +}; + +const remoteResolutionScenarios: remoteResolutionScenario[] = [ + { + name: 'dependencyResolution: disabled, single DTMI, no dependencies', + clientOptions: { + dependencyResolution: 'disabled', + repositoryLocation: 'devicemodels.contoso.com', + }, + dtmis: [{ + dtmi: 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1', + expectedURI: 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json', + expectedOutput: {fakeDtdl: 'fakeBodyAsText'} + }] + }, + { + name: 'dependencyResolution: enabled, single DTMI, no dependencies', + clientOptions: { + dependencyResolution: 'enabled', + repositoryLocation: 'devicemodels.contoso.com', + }, + dtmis: [{ + dtmi: 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1', + expectedURI: 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json', + expectedOutput: {fakeDtdl: 'fakeBodyAsText'} + }] + }, + { + name: 'dependencyResolution: tryFromExpanded, single DTMI, no dependencies', + clientOptions: { + dependencyResolution: 'tryFromExpanded', + repositoryLocation: 'devicemodels.contoso.com', + }, + dtmis: [{ + dtmi: 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1', + expectedURI: 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json', + expectedOutput: {fakeDtdl: 'fakeBodyAsText'} + }] + }, + { + name: 'dependencyResolution: disabled, multiple DTMI, no dependencies', + clientOptions: { + dependencyResolution: 'tryFromExpanded', + repositoryLocation: 'devicemodels.contoso.com', + }, + dtmis: [{ + dtmi: 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1', + expectedURI: 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json', + expectedOutput: {fakeDtdl: 'fakeBodyAsText'} + }] + }, +] + + describe("resolver - node", function() { afterEach(function() { sinon.restore(); }); describe("remote URL resolution", function() { + remoteResolutionScenarios.forEach((scenario: remoteResolutionScenario) => { + it(scenario.name, function(done) { + + }) + }) describe("simple DTDL resolution", function() { it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/deviceinformation-1.json b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/deviceinformation-1.json new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json new file mode 100644 index 000000000000..870355c53d4d --- /dev/null +++ b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json @@ -0,0 +1,89 @@ +{ + "@context": "dtmi:dtdl:context;2", + "@id": "dtmi:com:example:Thermostat;2", + "@type": "Interface", + "displayName": "Thermostat", + "description": "Reports current temperature and provides desired temperature control.", + "contents": [ + { + "@type": [ + "Telemetry", + "Temperature" + ], + "name": "temperature", + "displayName": "Temperature", + "description": "Temperature in degrees Celsius.", + "schema": "double", + "unit": "degreeCelsius" + }, + { + "@type": [ + "Property", + "Temperature" + ], + "name": "targetTemperature", + "schema": "double", + "displayName": "Target Temperature", + "description": "Allows to remotely specify the desired target temperature.", + "unit": "degreeCelsius", + "writable": true + }, + { + "@type": [ + "Property", + "Temperature" + ], + "name": "maxTempSinceLastReboot", + "schema": "double", + "unit": "degreeCelsius", + "displayName": "Max temperature since last reboot.", + "description": "Returns the max temperature since last device reboot." + }, + { + "@type": "Command", + "name": "getMaxMinReport", + "displayName": "Get Max-Min report.", + "description": "This command returns the max, min and average temperature from the specified time to the current time.", + "request": { + "name": "since", + "displayName": "Since", + "description": "Period to return the max-min report.", + "schema": "dateTime" + }, + "response": { + "name": "tempReport", + "displayName": "Temperature Report", + "schema": { + "@type": "Object", + "fields": [ + { + "name": "maxTemp", + "displayName": "Max temperature", + "schema": "double" + }, + { + "name": "minTemp", + "displayName": "Min temperature", + "schema": "double" + }, + { + "name": "avgTemp", + "displayName": "Average Temperature", + "schema": "double" + }, + { + "name": "startTime", + "displayName": "Start Time", + "schema": "dateTime" + }, + { + "name": "endTime", + "displayName": "End Time", + "schema": "dateTime" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/sdk/iot/modelsrepository/tsconfig.json b/sdk/iot/modelsrepository/tsconfig.json index 1930ec602e17..2c46b7ce0a47 100644 --- a/sdk/iot/modelsrepository/tsconfig.json +++ b/sdk/iot/modelsrepository/tsconfig.json @@ -1,34 +1,9 @@ { + "extends": "../../../tsconfig.package", "compilerOptions": { - "target": "es6", - "module": "commonjs", - "lib": [], - "declaration": true, + "outDir": "./dist-esm", "declarationDir": "./types", - "declarationMap": true, - "inlineSources": true, - "sourceMap": true, - "importHelpers": true, - "strict": true, - "alwaysStrict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "outDir": "./out" + "lib": ["dom", "esnext"] }, - "exclude": [ - "node_modules", - "types", - "temp", - "browser", - "dist", - "dist-samples", - "dist-esm", - "./samples/**/*.ts" - ] + "exclude": ["node_modules", "types", "temp", "browser", "dist", "dist-esm", "./samples/**/*.ts"] } From 117b6ba718298e6402689f62c78d38a339ecbf91 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 13 Apr 2021 15:43:21 -0700 Subject: [PATCH 10/81] more --- .../samples/javascript/remote_example.js | 2 +- sdk/iot/modelsrepository/src/psuedoParser.ts | 2 +- .../modelsrepository/test/node/index.spec.ts | 105 ++++++++++-------- .../FakeDeviceManagement/thermostat-2.json | 17 +-- 4 files changed, 63 insertions(+), 63 deletions(-) diff --git a/sdk/iot/modelsrepository/samples/javascript/remote_example.js b/sdk/iot/modelsrepository/samples/javascript/remote_example.js index 79418f656937..b4e4207ccc4a 100644 --- a/sdk/iot/modelsrepository/samples/javascript/remote_example.js +++ b/sdk/iot/modelsrepository/samples/javascript/remote_example.js @@ -5,7 +5,7 @@ * Demonstrates resolving/obtaining a particular model definition from a remote model repository */ -const DtmiResolver = require('../../dist-esm/src/client'); +const DtmiResolver = require("../../dist-esm/src/client"); // You can change the endpoint and dtmi you'd like to access const repositoryLocation = "https://devicemodels.azure.com/"; diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index 79719dc35ff9..f9471f940723 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -19,7 +19,7 @@ export class PseudoParser { expandedMap[model["@id"]] = model; this._expand(model, expandedMap); }); - + return expandedMap; } diff --git a/sdk/iot/modelsrepository/test/node/index.spec.ts b/sdk/iot/modelsrepository/test/node/index.spec.ts index 6ba22bb93a3e..d7cd57c28780 100644 --- a/sdk/iot/modelsrepository/test/node/index.spec.ts +++ b/sdk/iot/modelsrepository/test/node/index.spec.ts @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import {DtmiResolver} from "../../src"; +import { DtmiResolver } from "../../src"; import * as coreHttp from "@azure/core-http"; import * as fs from "fs"; @@ -14,69 +14,80 @@ import * as path from "path"; interface remoteResolutionScenario { name: string; clientOptions: { - dependencyResolution: string; - repositoryLocation: string; + dependencyResolution: string; + repositoryLocation: string; }; dtmis: { - dtmi: string; - expectedURI: string - expectedOutput: { - fakeDtdl: string; - }; + dtmi: string; + expectedURI: string; + expectedOutput: { + fakeDtdl: string; + }; }[]; -}; +} const remoteResolutionScenarios: remoteResolutionScenario[] = [ { - name: 'dependencyResolution: disabled, single DTMI, no dependencies', + name: "dependencyResolution: disabled, single DTMI, no dependencies", clientOptions: { - dependencyResolution: 'disabled', - repositoryLocation: 'devicemodels.contoso.com', + dependencyResolution: "disabled", + repositoryLocation: "devicemodels.contoso.com" }, - dtmis: [{ - dtmi: 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1', - expectedURI: 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json', - expectedOutput: {fakeDtdl: 'fakeBodyAsText'} - }] + dtmis: [ + { + dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + expectedURI: + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", + expectedOutput: { fakeDtdl: "fakeBodyAsText" } + } + ] }, { - name: 'dependencyResolution: enabled, single DTMI, no dependencies', + name: "dependencyResolution: enabled, single DTMI, no dependencies", clientOptions: { - dependencyResolution: 'enabled', - repositoryLocation: 'devicemodels.contoso.com', + dependencyResolution: "enabled", + repositoryLocation: "devicemodels.contoso.com" }, - dtmis: [{ - dtmi: 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1', - expectedURI: 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json', - expectedOutput: {fakeDtdl: 'fakeBodyAsText'} - }] + dtmis: [ + { + dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + expectedURI: + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", + expectedOutput: { fakeDtdl: "fakeBodyAsText" } + } + ] }, { - name: 'dependencyResolution: tryFromExpanded, single DTMI, no dependencies', + name: "dependencyResolution: tryFromExpanded, single DTMI, no dependencies", clientOptions: { - dependencyResolution: 'tryFromExpanded', - repositoryLocation: 'devicemodels.contoso.com', + dependencyResolution: "tryFromExpanded", + repositoryLocation: "devicemodels.contoso.com" }, - dtmis: [{ - dtmi: 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1', - expectedURI: 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json', - expectedOutput: {fakeDtdl: 'fakeBodyAsText'} - }] + dtmis: [ + { + dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + expectedURI: + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", + expectedOutput: { fakeDtdl: "fakeBodyAsText" } + } + ] }, { - name: 'dependencyResolution: disabled, multiple DTMI, no dependencies', + name: "dependencyResolution: disabled, multiple DTMI, no dependencies", clientOptions: { - dependencyResolution: 'tryFromExpanded', - repositoryLocation: 'devicemodels.contoso.com', + dependencyResolution: "tryFromExpanded", + repositoryLocation: "devicemodels.contoso.com" }, - dtmis: [{ - dtmi: 'dtmi:contoso:FakeDeviceManagement:DeviceInformation;1', - expectedURI: 'https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json', - expectedOutput: {fakeDtdl: 'fakeBodyAsText'} - }] - }, -] - + dtmis: [ + { + dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + expectedURI: + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", + expectedOutput: { fakeDtdl: "fakeBodyAsText" } + } + ] + } +]; describe("resolver - node", function() { afterEach(function() { @@ -85,10 +96,8 @@ describe("resolver - node", function() { describe("remote URL resolution", function() { remoteResolutionScenarios.forEach((scenario: remoteResolutionScenario) => { - it(scenario.name, function(done) { - - }) - }) + it(scenario.name, function(done) {}); + }); describe("simple DTDL resolution", function() { it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json index 870355c53d4d..3c9027e825cc 100644 --- a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json +++ b/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json @@ -6,10 +6,7 @@ "description": "Reports current temperature and provides desired temperature control.", "contents": [ { - "@type": [ - "Telemetry", - "Temperature" - ], + "@type": ["Telemetry", "Temperature"], "name": "temperature", "displayName": "Temperature", "description": "Temperature in degrees Celsius.", @@ -17,10 +14,7 @@ "unit": "degreeCelsius" }, { - "@type": [ - "Property", - "Temperature" - ], + "@type": ["Property", "Temperature"], "name": "targetTemperature", "schema": "double", "displayName": "Target Temperature", @@ -29,10 +23,7 @@ "writable": true }, { - "@type": [ - "Property", - "Temperature" - ], + "@type": ["Property", "Temperature"], "name": "maxTempSinceLastReboot", "schema": "double", "unit": "degreeCelsius", @@ -86,4 +77,4 @@ } } ] -} \ No newline at end of file +} From f0c69e1afd0b190afe18dda5674ccaa37fee9ddf Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Mon, 19 Apr 2021 12:10:21 -0700 Subject: [PATCH 11/81] adding stuff --- common/config/rush/pnpm-lock.yaml | 60 +- sdk/iot/modelsrepository/api-extractor.json | 2 +- sdk/iot/modelsrepository/package.json | 16 +- .../modelsrepository/rollup.base.config.js | 202 ---- sdk/iot/modelsrepository/rollup.config.js | 14 +- .../samples/typescript/tsconfig.json | 15 +- sdk/iot/modelsrepository/src/DTDL.ts | 8 +- sdk/iot/modelsrepository/src/client.ts | 101 +- sdk/iot/modelsrepository/src/constants.ts | 18 +- .../src/dependencyResolutionType.ts | 2 +- .../modelsrepository/src/dtmiConventions.ts | 42 +- .../src/filesystemModelFetcher.ts | 24 +- .../modelsrepository/src/httpModelFetcher.ts | 46 +- sdk/iot/modelsrepository/src/index.ts | 2 +- sdk/iot/modelsrepository/src/logger.ts | 4 +- .../src/modelFetcherHandler.ts | 74 -- .../src/modelFetcherHelper.ts | 11 +- sdk/iot/modelsrepository/src/psuedoParser.ts | 24 +- sdk/iot/modelsrepository/src/resolver.ts | 17 +- sdk/iot/modelsrepository/src/serviceClient.ts | 37 + .../test/browser/browserTest.spec.ts | 20 +- .../modelsrepository/test/node/index.spec.ts | 891 +++++++++--------- 22 files changed, 717 insertions(+), 913 deletions(-) delete mode 100644 sdk/iot/modelsrepository/rollup.base.config.js delete mode 100644 sdk/iot/modelsrepository/src/modelFetcherHandler.ts create mode 100644 sdk/iot/modelsrepository/src/serviceClient.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 77cea54bd785..75ef958e6b07 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -119,6 +119,15 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-+j1embyH1jqf04AIfJPdLafd5SC1y6z1Jz4i+USR1XkTp6KM8P5u4/AjmWMVoEQdM/M29PJcRDZcCEWjK9S1bw== + /@azure/core-auth/1.3.0: + dependencies: + '@azure/abort-controller': 1.0.2 + tslib: 2.1.0 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-kSDSZBL6c0CYdhb+7KuutnKGf2geeT+bCJAgccB0DD7wmNJSsQPcF7TcuoZX83B7VK4tLz/u+8sOO/CnCsYp8A== /@azure/core-client/1.0.0-beta.1: dependencies: '@azure/abort-controller': 1.0.2 @@ -135,7 +144,7 @@ packages: /@azure/core-http/1.2.2: dependencies: '@azure/abort-controller': 1.0.2 - '@azure/core-auth': 1.1.4 + '@azure/core-auth': 1.3.0 '@azure/core-tracing': 1.0.0-preview.9 '@azure/logger': 1.0.1 '@opentelemetry/api': 0.10.2 @@ -157,7 +166,7 @@ packages: /@azure/core-https/1.0.0-beta.1: dependencies: '@azure/abort-controller': 1.0.2 - '@azure/core-auth': 1.1.4 + '@azure/core-auth': 1.3.0 '@azure/core-tracing': 1.0.0-preview.9 '@azure/logger': 1.0.1 '@opentelemetry/api': 0.10.2 @@ -189,6 +198,33 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-his7Ah40ThEYORSpIAwuh6B8wkGwO/zG7gqVtmSE4WAJ46e36zUDXTKReUCLBDc6HmjjApQQxxcRFy5FruG79A== + /@azure/core-rest-pipeline/1.0.2: + dependencies: + '@azure/abort-controller': 1.0.2 + '@azure/core-auth': 1.3.0 + '@azure/core-tracing': 1.0.0-preview.10 + '@azure/logger': 1.0.1 + '@opentelemetry/api': 0.10.2 + form-data: 3.0.0 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.0 + tslib: 2.1.0 + uuid: 8.3.2 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-3raRQBhdr7gjJlHPkYQGWIbhskthQAA+452oIG4wrdsrEPUQhmXrIhE6tGOTe9bWWJyFZgo6aszQg6l3ABphCQ== + /@azure/core-tracing/1.0.0-preview.10: + dependencies: + '@opencensus/web-types': 0.0.7 + '@opentelemetry/api': 0.10.2 + tslib: 2.1.0 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-iIwjtMwQnsxB7cYkugMx+s4W1nfy3+pT/ceo+uW1fv4YDgYe84nh+QP0fEC9IH/3UATLSWbIBemdMHzk2APUrw== /@azure/core-tracing/1.0.0-preview.9: dependencies: '@opencensus/web-types': 0.0.7 @@ -827,6 +863,12 @@ packages: dev: false resolution: integrity: sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ== + /@tootallnate/once/1.1.2: + dev: false + engines: + node: '>= 6' + resolution: + integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== /@types/argparse/1.0.33: dev: false resolution: @@ -3715,6 +3757,16 @@ packages: node: '>= 4.5.0' resolution: integrity: sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg== + /http-proxy-agent/4.0.1: + dependencies: + '@tootallnate/once': 1.1.2 + agent-base: 6.0.2 + debug: 4.3.1 + dev: false + engines: + node: '>= 6' + resolution: + integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg== /http-proxy/1.18.1: dependencies: eventemitter3: 4.0.7 @@ -9278,6 +9330,8 @@ packages: version: 0.0.0 file:projects/iot-modelsrepository-client.tgz: dependencies: + '@azure/core-client': 1.0.0-beta.1 + '@azure/core-rest-pipeline': 1.0.2 '@azure/core-tracing': 1.0.0-preview.9 '@microsoft/api-extractor': 7.7.11 '@opentelemetry/api': 0.10.2 @@ -9327,7 +9381,7 @@ packages: dev: false name: '@rush-temp/iot-modelsrepository-client' resolution: - integrity: sha512-DsB8EEFo7NXzIx9bIHea+DGKkG7SxhAcsMRdCxgi6OWHQucV9n3vGix2mDLcWqByIkvCBGg44nVXheAX/rWUbg== + integrity: sha512-96etcDKO1kZ2nOyI6vllxFET6KNL0bOjzurXuqPLiianpvTH/pZ/10WEt4hzWBKqOZGLbO5Bgn4KWRmgt8ejYA== tarball: file:projects/iot-modelsrepository-client.tgz version: 0.0.0 file:projects/keyvault-admin.tgz: diff --git a/sdk/iot/modelsrepository/api-extractor.json b/sdk/iot/modelsrepository/api-extractor.json index 12d812611d97..1aeaf380fcff 100644 --- a/sdk/iot/modelsrepository/api-extractor.json +++ b/sdk/iot/modelsrepository/api-extractor.json @@ -11,7 +11,7 @@ "dtsRollup": { "enabled": true, "untrimmedFilePath": "", - "publicTrimmedFilePath": "./types/template.d.ts" + "publicTrimmedFilePath": "./types/iot-models-repository.d.ts" }, "messages": { "tsdocMessageReporting": { diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index 38657acec51b..c276b6a1c81b 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -64,7 +64,8 @@ "sideEffects": false, "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", "dependencies": { - "@azure/core-http": "^1.2.0", + "@azure/core-client": "1.0.0-beta.1", + "@azure/core-rest-pipeline": "1.0.2", "@azure/core-tracing": "1.0.0-preview.9", "@azure/logger": "^1.0.0", "@opentelemetry/api": "^0.10.2", @@ -76,10 +77,15 @@ "@azure/eslint-plugin-azure-sdk": "^3.0.0", "@azure/test-utils-recorder": "^1.0.0", "@microsoft/api-extractor": "7.7.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "@rollup/plugin-replace": "^2.2.0", "@types/chai": "^4.1.6", "@types/mocha": "^7.0.2", "@types/node": "^8.0.0", - "ts-node": "^8.3.0", + "@types/sinon": "^9.0.4", "chai": "^4.2.0", "cross-env": "^7.0.2", "dotenv": "^8.2.0", @@ -106,12 +112,8 @@ "rollup-plugin-sourcemaps": "^0.4.2", "rollup-plugin-terser": "^5.1.1", "rollup-plugin-visualizer": "^4.0.4", - "@rollup/plugin-commonjs": "11.0.2", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", - "@rollup/plugin-replace": "^2.2.0", "sinon": "^9.0.2", + "ts-node": "^8.3.0", "typedoc": "0.15.2", "typescript": "4.1.2", "util": "^0.12.1" diff --git a/sdk/iot/modelsrepository/rollup.base.config.js b/sdk/iot/modelsrepository/rollup.base.config.js deleted file mode 100644 index dfe95962951c..000000000000 --- a/sdk/iot/modelsrepository/rollup.base.config.js +++ /dev/null @@ -1,202 +0,0 @@ -import path from "path"; -import nodeResolve from "@rollup/plugin-node-resolve"; -import multiEntry from "@rollup/plugin-multi-entry"; -import cjs from "@rollup/plugin-commonjs"; -import replace from "@rollup/plugin-replace"; -import { terser } from "rollup-plugin-terser"; -import sourcemaps from "rollup-plugin-sourcemaps"; -import viz from "rollup-plugin-visualizer"; -import shim from "rollup-plugin-shim"; -import inject from "@rollup/plugin-inject"; - -const pkg = require("./package.json"); -const depNames = Object.keys(pkg.dependencies); -const devDepNames = Object.keys(pkg.devDependencies); -const input = "dist-esm/src/index.js"; -const production = process.env.NODE_ENV === "production"; -const testModes = ["unit", "integration"]; - -export function nodeConfig() { - const externalNodeBuiltins = ["crypto", "url"]; - const baseConfig = { - input: input, - external: depNames.concat(externalNodeBuiltins), - output: { file: "dist/index.js", format: "cjs", sourcemap: true }, - preserveSymlinks: false, - plugins: [ - sourcemaps(), - replace({ - delimiters: ["", ""], - values: { - // replace dynamic checks with if (true) since this is for node only. - // Allows rollup's dead code elimination to be more aggressive. - "if (isNode)": "if (true)" - } - }), - nodeResolve({ preferBuiltins: true }), - cjs() - ] - }; - - if (production) { - baseConfig.plugins.push(terser()); - } - - return baseConfig; -} - -export function browserConfig() { - const baseConfig = { - input: input, - external: ["fs-extra", "nock", "path"], - output: { - file: "dist-browser/data-tables.js", - format: "umd", - name: "Azure.Data.Tables", - sourcemap: true - }, - preserveSymlinks: false, - plugins: [ - sourcemaps(), - replace({ - delimiters: ["", ""], - values: { - // replace dynamic checks with if (false) since this is for - // browser only. Rollup's dead code elimination will remove - // any code guarded by if (isNode) { ... } - "if (isNode)": "if (false)" - } - }), - // os is not used by the browser bundle, so just shim it - shim({ - fs: `export default {}`, - path: `export function join() {}`, - stream: `export default {}`, - dotenv: `export function config() { }`, - os: ` - export function arch() { return "javascript" } - export function type() { return "Browser" } - export function release() { typeof navigator === 'undefined' ? '' : navigator.appVersion } - `, - constants: `export default {}` - }), - nodeResolve({ - mainFields: ["module", "browser"], - preferBuiltins: false - }), - cjs({ - namedExports: { - chai: ["assert"], - "@opentelemetry/api": ["CanonicalCode", "SpanKind", "TraceFlags"] - } - }), - inject({ - modules: { - process: "process" - }, - exclude: ["./**/package.json"] - }), - viz({ filename: "dist-browser/browser-stats.html", sourcemap: false }) - ] - }; - - return baseConfig; -} - -export function nodeTestConfig(testMode) { - if (!testModes.includes(testMode)) { - throw new Error(`Unknown test mode ${testMode}. Supported modes ${testModes.join(",")}`); - } - - const baseConfig = nodeConfig(); - - const input = - testMode === "unit" - ? [ - // common tests - "dist-esm/test/unit/*.spec.js", - // node specific tests - "dist-esm/test/unit/node/*.spec.js" - ] - : [ - // common tests - "dist-esm/test/integration/*.spec.js", - // node specific tests - "dist-esm/test/integration/node/*.spec.js" - ]; - - // Entry points - test files under the `test` folder(common for both browser and node), node specific test files - baseConfig.input = input; - baseConfig.plugins.unshift(multiEntry({ exports: false })); - - // different output file - baseConfig.output.file = `dist-test/${testMode}.index.node.js`; - - // mark devdeps as external - baseConfig.external.push(...devDepNames); - - // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, rollup started respecting - // the "sideEffects" field in package.json. Since our package.json sets "sideEffects=false", this also - // applies to test code, which causes all tests to be removed by tree-shaking. - baseConfig.treeshake = false; - - return baseConfig; -} - -export function browserTestConfig(testMode) { - if (!testModes.includes(testMode)) { - throw new Error(`Unknown test mode ${testMode}. Supported modes ${testModes.join(",")}`); - } - - const baseConfig = browserConfig(); - - const input = - testMode === "unit" - ? [ - // common tests - "dist-esm/test/unit/*.spec.js", - // browser specific tests - "dist-esm/test/unit/browser/*.spec.js" - ] - : [ - // common tests - "dist-esm/test/integration/*.spec.js", - // browser specific tests - "dist-esm/test/integration/browser/*.spec.js" - ]; - - // Entry points - test files under the `test` folder(common for both browser and node), browser specific test files - baseConfig.input = input; - baseConfig.plugins.unshift(multiEntry({ exports: false })); - baseConfig.output.file = `dist-test/${testMode}.index.browser.js`; - - // mark fs-extra as external - baseConfig.external = ["fs-extra", "process"]; - - baseConfig.output.globals = { - ...baseConfig.output.globals, - "fs-extra": "fs", - process: "process" - }; - - baseConfig.context = "null"; - - baseConfig.onwarn = (warning) => { - if ( - warning.code === "CIRCULAR_DEPENDENCY" && - warning.importer.indexOf(path.normalize("node_modules/chai/lib") === 0) - ) { - // Chai contains circular references, but they are not fatal and can be ignored. - return; - } - - console.error(`(!) ${warning.message}`); - }; - - // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, rollup started respecting - // the "sideEffects" field in package.json. Since our package.json sets "sideEffects=false", this also - // applies to test code, which causes all tests to be removed by tree-shaking. - baseConfig.treeshake = false; - - return baseConfig; -} diff --git a/sdk/iot/modelsrepository/rollup.config.js b/sdk/iot/modelsrepository/rollup.config.js index 14652aa67ed8..5d7deee44c14 100644 --- a/sdk/iot/modelsrepository/rollup.config.js +++ b/sdk/iot/modelsrepository/rollup.config.js @@ -1,13 +1,3 @@ -import * as base from "./rollup.base.config"; +import { makeConfig } from "@azure/dev-tool/shared-config/rollup"; -const inputs = []; - -if (!process.env.ONLY_BROWSER) { - inputs.push(base.nodeConfig()); -} - -if (!process.env.ONLY_NODE) { - inputs.push(base.browserConfig()); -} - -export default inputs; +export default makeConfig(require("./package.json")); diff --git a/sdk/iot/modelsrepository/samples/typescript/tsconfig.json b/sdk/iot/modelsrepository/samples/typescript/tsconfig.json index 5ed056486b40..3a37abdb0902 100644 --- a/sdk/iot/modelsrepository/samples/typescript/tsconfig.json +++ b/sdk/iot/modelsrepository/samples/typescript/tsconfig.json @@ -1,16 +1,9 @@ { + "extends": "../tsconfig.json", "compilerOptions": { "module": "commonjs", - "moduleResolution": "node", - - "allowSyntheticDefaultImports": true, - - "strict": true, - "alwaysStrict": true, - - "outDir": "dist", - "rootDir": "src" + "outDir": "typescript/dist" }, - "include": ["src/**.ts"], - "exclude": ["node_modules"] + "include": ["typescript/src/**.ts"], + "exclude": ["typescript/*.json", "**/node_modules/", "../node_modules", "../typings"] } diff --git a/sdk/iot/modelsrepository/src/DTDL.ts b/sdk/iot/modelsrepository/src/DTDL.ts index 0979fc87e7c6..eb8cd9264d99 100644 --- a/sdk/iot/modelsrepository/src/DTDL.ts +++ b/sdk/iot/modelsrepository/src/DTDL.ts @@ -1,17 +1,15 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -"use strict"; - interface Contents { - "@type"?: string; + '@type'?: string; name: string; schema: string; } export interface DTDL extends JSON { - "@context": any[]; - "@id": string; + '@context': any[]; + '@id': string; extends: string | Array; contents: Contents[]; } diff --git a/sdk/iot/modelsrepository/src/client.ts b/sdk/iot/modelsrepository/src/client.ts index ebfbb2e23e94..e750c79356e8 100644 --- a/sdk/iot/modelsrepository/src/client.ts +++ b/sdk/iot/modelsrepository/src/client.ts @@ -1,28 +1,24 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import * as constants from "./constants"; -import { - InternalPipelineOptions, - createPipelineFromOptions, - OperationOptions, - PipelineOptions, - ServiceClient -} from "@azure/core-http"; -import { dependencyResolutionType } from "./dependencyResolutionType"; -import { logger } from "./logger"; -import { URL, fileURLToPath } from "url"; -import { DtmiResolver, ResolverError } from "./resolver"; -import { HttpFetcher } from "./httpModelFetcher"; -import { FilesystemFetcher } from "./filesystemModelFetcher"; -import { isLocalPath } from "./modelFetcherHelper"; -import * as path from "path"; -import { PseudoParser } from "./psuedoParser"; - -export interface ModelsRepositoryClientOptions extends PipelineOptions, OperationOptions { - repositoryLocation: string | undefined; - dependencyResolution: dependencyResolutionType; - apiVersion: string | undefined; +import * as constants from './constants'; + +import {createClientPipeline, ClientPipelineOptions} from "@azure/core-client"; +import {dependencyResolutionType} from './dependencyResolutionType'; +import {logger} from './logger'; +import {URL} from 'url'; +import {DtmiResolver, ResolverError} from './resolver'; +import {HttpFetcher} from './httpModelFetcher'; +import {FilesystemFetcher} from './filesystemModelFetcher'; +import {isLocalPath} from './modelFetcherHelper'; +import * as path from 'path'; +import {PseudoParser} from './psuedoParser'; +import { MyServiceClient } from './serviceClient'; + +export interface ModelsRepositoryClientOptions extends ClientPipelineOptions { + repositoryLocation?: string; + apiVersion?: string; + dependencyResolution?: dependencyResolutionType; } /** @@ -30,11 +26,12 @@ export interface ModelsRepositoryClientOptions extends PipelineOptions, Operatio */ export class ModelsRepositoryClient { private _repositoryLocation: string; - private _dependencyResolution: string; + private _dependencyResolution: dependencyResolutionType; private _apiVersion: string; private _fetcher: any; private _resolver: any; private _pseudoParser: any; + client: any; constructor(options?: ModelsRepositoryClientOptions) { this._repositoryLocation = options?.repositoryLocation || constants.DEFAULT_REPOSITORY_LOCATION; @@ -53,9 +50,9 @@ export class ModelsRepositoryClient { private _checkDefaultDependencyResolution(customRepository: boolean) { if (customRepository) { - return "enabled"; + return 'enabled'; } else { - return "tryFromExpanded"; + return 'tryFromExpanded'; } } @@ -63,7 +60,7 @@ export class ModelsRepositoryClient { return this._apiVersion; } - private _createPipeline(options: any) { + private _createClient(options: any) { const { ...pipelineOptions } = options; if (!pipelineOptions.userAgentOptions) { @@ -75,7 +72,7 @@ export class ModelsRepositoryClient { pipelineOptions.userAgentOptions.userAgentPrefix = constants.DEFAULT_USER_AGENT; } - const internalPipelineOptions: InternalPipelineOptions = { + const internalPipelineOptions: ClientPipelineOptions = { ...pipelineOptions, ...{ loggingOptions: { @@ -84,8 +81,9 @@ export class ModelsRepositoryClient { } }; - const myServiceClientOptions = createPipelineFromOptions(internalPipelineOptions); - return new ServiceClient(undefined, myServiceClientOptions); + const pipeline = createClientPipeline(internalPipelineOptions); + const client = new MyServiceClient(this._repositoryLocation, { pipeline }); + return client; } private _createFetcher(location: string, options: any) { @@ -93,49 +91,49 @@ export class ModelsRepositoryClient { let locationURL; let fetcher; if (isLocalPath(location)) { - const localPath = path.normalize(location); // POSIX Filesystem Path or Windows Filesystem Path logger.info(`Repository location identified as filesystem path - using FilesystemFetcher`); - fetcher = new FilesystemFetcher(localPath); + fetcher = new FilesystemFetcher(path.normalize(location)); } else { locationURL = new URL(location); - if (locationURL.protocol in ["http", "https"]) { + if (locationURL.protocol in ['http', 'https']) { logger.info(`Repository location identified as HTTP/HTTPS endpoint - using HttpFetcher`); - const pipeline = this._createPipeline(options); - fetcher = new HttpFetcher(location, pipeline); - } else if (locationURL.protocol === "file") { + const client = this._createClient(options); + fetcher = new HttpFetcher(location, client); + } else if (locationURL.protocol === 'file') { // filesystem URI - logger.info("Repository Location identified as filesystem URI - using FilesystemFetcher"); - const localPath = fileURLToPath(location); - fetcher = new FilesystemFetcher(localPath); - } else if (locationURL.protocol === "" && location.startsWith("/")) { - } else if (locationURL.protocol === "" && location.search(/\.[a-zA-Z]{2,63}$/)) { + logger.info('Repository Location identified as filesystem URI - using FilesystemFetcher'); + fetcher = new FilesystemFetcher(location); + } else if (locationURL.protocol === '' && location.startsWith('/')) { + } else if (locationURL.protocol === '' && location.search(/\.[a-zA-Z]{2,63}$/)) { // Web URL with protocol unspecified - default to HTTPS logger.info( - "Repository Location identified as remote endpoint without protocol specified - using HttpFetcher" + 'Repository Location identified as remote endpoint without protocol specified - using HttpFetcher' ); - const fLocation = "https://" + location; - const pipeline = this._createPipeline(options); - fetcher = new HttpFetcher(fLocation, pipeline); + const fLocation = 'https://' + location; + const client = this._createClient(options); + fetcher = new HttpFetcher(fLocation, client); // TODO: make the next line match a regex specified. } else { throw new EvalError(`Unable to identify location: ${location}`); } } + + return fetcher; } - getModels(dtmi: string, options: any): Promise<{ [dtmi: string]: any }>; - getModels(dtmis: string[], options: any): Promise<{ [dtmi: string]: any }>; - getModels(dtmis: string | string[], options: any): Promise<{ [dtmi: string]: any }> { + getModels(dtmi: string, options?: getModelsOptions): Promise<{ [dtmi: string]: any }>; + getModels(dtmis: string[], options?: getModelsOptions): Promise<{ [dtmi: string]: any }>; + getModels(dtmis: string | string[], options?: getModelsOptions): Promise<{ [dtmi: string]: any }> { let modelMap; if (!Array.isArray(dtmis)) { dtmis = [dtmis]; } - const dependencyResolution = options.dependencyResolution || this._dependencyResolution; + const dependencyResolution = options?.dependencyResolution || this._dependencyResolution; if (dependencyResolution === constants.DEPENDENCY_MODE_DISABLED) { - logger.info("Getting models w/ dependency resolution mode: disabled"); + logger.info('Getting models w/ dependency resolution mode: disabled'); logger.info(`Retreiving model(s): ${dtmis}...`); modelMap = this._resolver.resolve(dtmis); } else if (dependencyResolution === constants.DEPENDENCY_MODE_ENABLED) { @@ -163,3 +161,8 @@ export class ModelsRepositoryClient { return modelMap; } } + + +interface getModelsOptions { + dependencyResolution: dependencyResolutionType +} diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts index b0ee839f1845..4bff2255ec66 100644 --- a/sdk/iot/modelsrepository/src/constants.ts +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -const isBrowser = new Function("try {return this===window;}catch(e){ return false;}"); -const isNode = new Function("try {return this===global;}catch(e){return false;}"); +const isBrowser = new Function('try {return this===window;}catch(e){ return false;}'); +const isNode = new Function('try {return this===global;}catch(e){return false;}'); -const currentPlatform = isBrowser ? "browser" : isNode ? "node" : "undefined"; +const currentPlatform = isBrowser ? 'browser' : isNode ? 'node' : 'undefined'; -export const SDK_VERSION = "0.0.0-preview"; +export const SDK_VERSION = '0.0.0-preview'; export const DEFAULT_USER_AGENT = `azsdk-node-modelsrepository/${SDK_VERSION} (${currentPlatform})`; -export const DEFAULT_REPOSITORY_LOCATION = "https://devicemodels.azure.com"; -export const DEFAULT_API_VERSION = "2021-02-11"; +export const DEFAULT_REPOSITORY_LOCATION = 'https://devicemodels.azure.com'; +export const DEFAULT_API_VERSION = '2021-02-11'; -export const DEPENDENCY_MODE_DISABLED = "disabled"; -export const DEPENDENCY_MODE_ENABLED = "enabled"; -export const DEPENDENCY_MODE_TRY_FROM_EXPANDED = "tryFromExpanded"; +export const DEPENDENCY_MODE_DISABLED = 'disabled'; +export const DEPENDENCY_MODE_ENABLED = 'enabled'; +export const DEPENDENCY_MODE_TRY_FROM_EXPANDED = 'tryFromExpanded'; diff --git a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts index b7e5f79a7b27..a49a0ee2a520 100644 --- a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts +++ b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded" | undefined; +export type dependencyResolutionType = 'disabled' | 'enabled' | 'tryFromExpanded' | undefined; diff --git a/sdk/iot/modelsrepository/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts index 099bb0c4aea8..3de658e4aa95 100644 --- a/sdk/iot/modelsrepository/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -"use strict"; - export function isValidDtmi(dtmi: string) { if (dtmi) { const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/; @@ -11,37 +9,25 @@ export function isValidDtmi(dtmi: string) { return false; // if not a string return false. } -export function dtmiToPath(dtmi: string) { +export function getModelUri(dtmi: string, repositoryUri: string, expanded: boolean = false) { + if (!repositoryUri.endsWith('/')) { + repositoryUri = repositoryUri.concat('/'); + } + const modelUri = repositoryUri + convertDtmiToPath(dtmi, expanded); + return modelUri; +} + +export function convertDtmiToPath(dtmi: string, expanded: boolean) { // presently this dtmi to path function does not return the path with a // file format at the end, i.e. does not append .json or .expanded.json. // that happens in the dtmiToQualifiedPath function if (isValidDtmi(dtmi)) { - return `${dtmi - .toLowerCase() - .replace(/:/gm, "/") - .replace(/;/gm, "-")}.json`; - } else { - throw new Error("DTMI provided is invalid. Ensure it follows DTMI conventions."); - } -} - -function ensureStartsWithProtocol(text: string) { - const re = /^http[s]?:\/\//; - if (text.search(re) !== -1) { - return text; - } else { - return `https://${text}`; - } -} - -export function dtmiToQualifiedPath(dtmi: string, endpoint: string, isExpanded?: boolean) { - const dtmiAsPath = dtmiToPath(dtmi); - const endpointWithSlash = endpoint.endsWith("/") ? endpoint : `${endpoint}/`; - const urlEndpoint = ensureStartsWithProtocol(endpointWithSlash); - if (isExpanded) { - return `${urlEndpoint}${dtmiAsPath.replace(/json$/, "expanded.json")}`; + let thePath = `${dtmi.toLowerCase().replace(/:/gm, '/').replace(/;/gm, '-')}.json`; + if (expanded) { + thePath = thePath.replace('.json', '.expanded.json'); + } } else { - return `${urlEndpoint}${dtmiAsPath}`; + throw new Error('DTMI provided is invalid. Ensure it follows DTMI conventions.'); } } diff --git a/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts b/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts index 6fab85421685..756415f0153a 100644 --- a/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts +++ b/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { DTDL } from "./DTDL"; -import fs from "fs"; -import * as path from "path"; -import { Fetcher } from "./fetcher"; -import { logger } from "./logger"; -import { FetcherError } from "./resolver"; +import { DTDL } from './DTDL'; +import fs from 'fs'; +import * as path from 'path'; +import { Fetcher } from './fetcher'; +import { logger } from './logger'; +import { FetcherError } from './resolver'; export class FilesystemFetcher extends Fetcher { private _baseFilePath: string; @@ -22,11 +22,11 @@ export class FilesystemFetcher extends Fetcher { try { logger.info(`File open on ${absolutePath}`); - const dtdlFile = fs.readFileSync(absolutePath, "utf8"); + const dtdlFile = fs.readFileSync(absolutePath, 'utf8'); const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); return parsedDtdl; } catch (e) { - throw new FetcherError("Failed to fetch from Filesystem", e); + throw new FetcherError('Failed to fetch from Filesystem', e); } } } @@ -42,8 +42,8 @@ export class FilesystemFetcher extends Fetcher { // console.log(`Fetching: ${dtmi}`); // fetchedModels = await fetcher(dtmi, directory, tryFromExpanded); // } catch (error) { -// if (tryFromExpanded && error.code === "ENOENT") { -// console.log("Fetching from expanded failed. Trying without."); +// if (tryFromExpanded && error.code === 'ENOENT') { +// console.log('Fetching from expanded failed. Trying without.'); // fetchedModels = await fetcher(dtmi, directory, false); // } else { // throw error; @@ -81,10 +81,10 @@ export class FilesystemFetcher extends Fetcher { // ): Promise<{ [dtmi: string]: DTDL }> { // const dtmiPath = dtmiConventions.dtmiToPath(dtmi); // const dtmiPathFormatted = tryFromExpanded -// ? dtmiPath.replace(".json", ".expanded.json") +// ? dtmiPath.replace('.json', '.expanded.json') // : dtmiPath; // const targetPath = path.join(directory, dtmiPathFormatted); -// const dtdlFile = fs.readFileSync(targetPath, "utf8"); +// const dtdlFile = fs.readFileSync(targetPath, 'utf8'); // const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); // if (Array.isArray(parsedDtdl)) { // const result = flattenDtdlResponse(parsedDtdl as DTDL[]); diff --git a/sdk/iot/modelsrepository/src/httpModelFetcher.ts b/sdk/iot/modelsrepository/src/httpModelFetcher.ts index a08714bcd7c3..13185fe91649 100644 --- a/sdk/iot/modelsrepository/src/httpModelFetcher.ts +++ b/sdk/iot/modelsrepository/src/httpModelFetcher.ts @@ -1,34 +1,33 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -"use strict"; - -import * as coreHttp from "@azure/core-http"; -import { logger } from "./logger"; -import { RequestPrepareOptions } from "@azure/core-http"; -import { Fetcher } from "./fetcher"; +import {ServiceClient} from '@azure/core-client'; +import {PipelineResponse, RestError} from '@azure/core-rest-pipeline'; +import { logger } from './logger'; +import { Fetcher } from './fetcher'; export class HttpFetcher extends Fetcher { - private _pipeline: coreHttp.ServiceClient; + private _client: ServiceClient; private _baseURL: string; - constructor(baseURL: string, pipeline: coreHttp.ServiceClient) { + constructor(baseURL: string, client: ServiceClient) { super(); - this._pipeline = pipeline; + this._client = client; this._baseURL = baseURL; } async fetch(path: string) { logger.info(`Fetching ${path} from remote endpoint`); const myURL = this._baseURL + path; - const request: RequestPrepareOptions = { + + const request: any = { url: myURL, - method: "GET" + method: 'GET' }; - const res: coreHttp.HttpOperationResponse = await this._pipeline.sendRequest(request); + const res: PipelineResponse = await this._client.sendRequest(request); if (res.status >= 200 && res.status < 400) { - const dtdlAsString = res.bodyAsText || ""; + const dtdlAsString = res.bodyAsText || ''; const parsedDtdl = JSON.parse(dtdlAsString); return parsedDtdl; // if (Array.isArray(parsedDtdl)) { @@ -39,13 +38,8 @@ export class HttpFetcher extends Fetcher { // return result; // } } else { - throw new coreHttp.RestError( - "Error on HTTP Request in remote model fetcher", - "404", - 404, - undefined, - res - ); + throw new RestError( + 'Error on HTTP Request in remote model fetcher'); } } } @@ -63,9 +57,9 @@ export class HttpFetcher extends Fetcher { // } catch (error) { // if ( // tryFromExpanded && -// (error.code === "ENOENT" || !(error.statusCode >= 200 && error.statusCode < 400)) +// (error.code === 'ENOENT' || !(error.statusCode >= 200 && error.statusCode < 400)) // ) { -// console.log("Fetching from expanded failed. Trying without."); +// console.log('Fetching from expanded failed. Trying without.'); // console.log(`Fetching: ${dtmi}`); // fetchedModels = await fetcher(dtmi, endpoint, false); // } else { @@ -104,11 +98,11 @@ export class HttpFetcher extends Fetcher { // const client = new coreHttp.ServiceClient(); // const req: coreHttp.RequestPrepareOptions = { // url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), -// method: "GET" +// method: 'GET' // }; // const res: coreHttp.HttpOperationResponse = await client.sendRequest(req); // if (res.status >= 200 && res.status < 400) { -// const dtdlAsString = res.bodyAsText || ""; +// const dtdlAsString = res.bodyAsText || ''; // const parsedDtdl = JSON.parse(dtdlAsString); // if (Array.isArray(parsedDtdl)) { // const result = flattenDtdlResponse(parsedDtdl as DTDL[]); @@ -119,8 +113,8 @@ export class HttpFetcher extends Fetcher { // } // } else { // throw new coreHttp.RestError( -// "Error on HTTP Request in remote model fetcher", -// "404", +// 'Error on HTTP Request in remote model fetcher', +// '404', // 404, // undefined, // res diff --git a/sdk/iot/modelsrepository/src/index.ts b/sdk/iot/modelsrepository/src/index.ts index 8ef45fdc1c53..31dfbda31863 100644 --- a/sdk/iot/modelsrepository/src/index.ts +++ b/sdk/iot/modelsrepository/src/index.ts @@ -2,4 +2,4 @@ // Licensed under the MIT license. // exporting the resolver api -export * from "./resolver"; +export * from './client'; diff --git a/sdk/iot/modelsrepository/src/logger.ts b/sdk/iot/modelsrepository/src/logger.ts index b04bd5f34807..3726b5254e7f 100644 --- a/sdk/iot/modelsrepository/src/logger.ts +++ b/sdk/iot/modelsrepository/src/logger.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { createClientLogger } from "@azure/logger"; +import { createClientLogger } from '@azure/logger'; /** * The @azure/logger configuration for this package. */ -export const logger = createClientLogger("iot-modelsrepository"); +export const logger = createClientLogger('iot-modelsrepository'); diff --git a/sdk/iot/modelsrepository/src/modelFetcherHandler.ts b/sdk/iot/modelsrepository/src/modelFetcherHandler.ts deleted file mode 100644 index da164cc0b936..000000000000 --- a/sdk/iot/modelsrepository/src/modelFetcherHandler.ts +++ /dev/null @@ -1,74 +0,0 @@ -// // Copyright (c) Microsoft. -// // Licensed under the MIT license. - -// "use strict"; - -// import { PipelineOptions } from "@azure/core-http"; -// import * as fs from "fs"; -// import * as url from "url"; -// import * as localFetchers from "./filesystemModelFetcher"; -// import * as remoteFetchers from "./httpModelFetcher"; - -// function isLocalPath(p: string): boolean { -// if (p.startsWith("https://") || p.startsWith("http://")) { -// return false; -// } else if (p.startsWith("file://")) { -// return true; -// } else { -// try { -// fs.accessSync(p); -// return true; -// } catch { -// return false; -// } -// } -// } - -// interface modelFetcherParams { -// pipeline: PipelineOptions; -// dtmis: string[]; -// endpoint: string; -// dependencyResolution: Dependency; -// } - -// export class ModelFetcher { -// constructor(location, ) { -// this._location = location; -// } - -// fetch(dtdlPath) { -// this._fetcher. -// } - -// static createHttpFetcher(location) { - -// } - -// static createFileSystemFetcher(location) { -// return new ModelFetcher() -// } -// } - -// export async function modelFetcher({ -// dtmis, -// endpoint, -// resolveDependencies -// }: modelFetcherParams): Promise<{ [dtmi: string]: JSON | Array }> { -// if (isLocalPath(endpoint)) { -// const formattedDirectory = endpoint.includes("file://") -// ? url.fileURLToPath(endpoint) -// : endpoint; -// if (tryFromExpanded || resolveDependencies) { -// return localFetchers.recursiveFetcher(dtmi, formattedDirectory, tryFromExpanded); -// } else { -// console.log(`Fetching: ${dtmi}`); -// return localFetchers.fetcher(dtmi, formattedDirectory, false); -// } -// } else { -// if (tryFromExpanded || resolveDependencies) { -// return remoteFetchers.recursiveFetcher(dtmi, endpoint, tryFromExpanded); -// } -// console.log(`Fetching: ${dtmi}`); -// return remoteFetchers.fetcher(dtmi, endpoint, false); -// } -// } diff --git a/sdk/iot/modelsrepository/src/modelFetcherHelper.ts b/sdk/iot/modelsrepository/src/modelFetcherHelper.ts index 3f935e80e41b..66d5b07b83ba 100644 --- a/sdk/iot/modelsrepository/src/modelFetcherHelper.ts +++ b/sdk/iot/modelsrepository/src/modelFetcherHelper.ts @@ -1,9 +1,8 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -"use strict"; -import { DTDL } from "./DTDL"; +import { DTDL } from './DTDL'; export function isLocalPath(p: string): boolean { const myRegex = RegExp(/^(?:[a-zA-Z]\:|\\\\[\w\.]+\\[\w.$]+)\\(?:[\w]+\\)*\w([\w.])+$/g); @@ -14,13 +13,13 @@ export function flattenDtdlResponse(input: DTDL[]) { const newResult: { [x: string]: DTDL } = {}; for (let i = 0; i++; i < input.length) { const currentDtdl = input[i]; - if (!currentDtdl["@id"]) { - throw new Error("no @id element found in DTDL. Ensure DTDL contains @id element"); + if (!currentDtdl['@id']) { + throw new Error('no @id element found in DTDL. Ensure DTDL contains @id element'); } - newResult[currentDtdl["@id"]] = currentDtdl; + newResult[currentDtdl['@id']] = currentDtdl; } input.forEach((element: DTDL) => { - newResult[element["@id"]] = element; + newResult[element['@id']] = element; }); return newResult; } diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index f9471f940723..ff540c67b696 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { DTDL } from "./DTDL"; -import { logger } from "./logger"; -import { DtmiResolver } from "./resolver"; +import { DTDL } from './DTDL'; +import { logger } from './logger'; +import { DtmiResolver } from './resolver'; export class PseudoParser { private _resolver; @@ -16,7 +16,7 @@ export class PseudoParser { let expandedMap: any = {}; models.forEach((model: DTDL) => { - expandedMap[model["@id"]] = model; + expandedMap[model['@id']] = model; this._expand(model, expandedMap); }); @@ -24,7 +24,7 @@ export class PseudoParser { } private _expand(model: DTDL, modelMap: any) { - logger.info(`Expanding model: ${model["@id"]}`); + logger.info(`Expanding model: ${model['@id']}`); let dependencies = this._getModelDependencies(model); let dependenciesToResolve = dependencies.filter((dependency: string) => { return !(dependency in modelMap); @@ -46,11 +46,11 @@ export class PseudoParser { const contents = model.contents; contents.forEach((element) => { if ( - element["@type"] && - typeof element["@type"] === "string" && - element["@type"] === "Component" + element['@type'] && + typeof element['@type'] === 'string' && + element['@type'] === 'Component' ) { - if (element.schema && typeof element.schema === "string") { + if (element.schema && typeof element.schema === 'string') { dependencies.push(element.schema); } } @@ -58,13 +58,13 @@ export class PseudoParser { } if (model.extends !== undefined) { - if (typeof model.extends === "string") { + if (typeof model.extends === 'string') { dependencies.push(model.extends); } else if (Array.isArray(model.extends)) { model.extends.forEach((element) => { - if (typeof element === "string") { + if (typeof element === 'string') { dependencies.push(element); - } else if (typeof element === "object") { + } else if (typeof element === 'object') { dependencies.push(this._getModelDependencies(element)); } }); diff --git a/sdk/iot/modelsrepository/src/resolver.ts b/sdk/iot/modelsrepository/src/resolver.ts index 15cb25b2229e..5c06ee1d27c0 100644 --- a/sdk/iot/modelsrepository/src/resolver.ts +++ b/sdk/iot/modelsrepository/src/resolver.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { dtmiToPath } from "./dtmiConventions"; -import { logger } from "./logger"; +import { convertDtmiToPath } from './dtmiConventions'; +import { logger } from './logger'; export class FetcherError extends Error { cause: Error | undefined; @@ -28,15 +28,12 @@ export class DtmiResolver { this._fetcher = fetcher; } - resolve(dtmis: string[], expandedModel?: boolean) { + resolve(dtmis: string[], expandedModel: boolean = false) { let modelMap: any = {}; for (let dtmi of dtmis) { let dtdl: any[] | any; - let dtdlPath = dtmiToPath(dtmi); - if (expandedModel) { - dtdlPath = dtdlPath.replace(".json", ".expanded.json"); - } + let dtdlPath = convertDtmiToPath(dtmi, expandedModel); logger.info(`Model ${dtmi} located in repository at ${dtdlPath}`); try { @@ -51,13 +48,13 @@ export class DtmiResolver { if (expandedModel) { for (let model of dtdl) { - modelMap[model["@id"]] = model; + modelMap[model['@id']] = model; } } else { let model = dtdl; - if (model["@id"] != dtmi) { + if (model['@id'] != dtmi) { return Promise.reject( - new ResolverError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`) + new ResolverError(`DTMI mismatch - Request: ${dtmi}, Response ${model['@id']}`) ); } diff --git a/sdk/iot/modelsrepository/src/serviceClient.ts b/sdk/iot/modelsrepository/src/serviceClient.ts new file mode 100644 index 000000000000..a5798c39a9dc --- /dev/null +++ b/sdk/iot/modelsrepository/src/serviceClient.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +import { ServiceClientOptions, ServiceClient } from "@azure/core-client"; + +interface MyServiceClientOptions extends ServiceClientOptions { + version?: string; + endpoint?: string; +} + +export class MyServiceClient extends ServiceClient { + url: string; + version: string; + + /** + * Initializes a new instance of the GeneratedClient class. + * @param url The URL of the service account or table that is the target of the desired operation. + * @param options The parameter options + */ + constructor(url: string, options: MyServiceClientOptions = {}) { + const defaults: MyServiceClientOptions = { + baseUri: `${url}`, + requestContentType: 'application/json; charset=utf-8' + }; + + const optionsWithDefaults = { + ...defaults, + ...options + }; + + super(optionsWithDefaults); + + this.url = url; + this.version = options.version || "2019-02-02"; + } + +} diff --git a/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts b/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts index a65d2a2795e3..0e216e690be4 100644 --- a/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts +++ b/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts @@ -1,27 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import * as lib from "../../src"; - -import { assert } from "chai"; -import * as sinon from "sinon"; +import { expect } from "chai"; +import { ModelsRepositoryClient } from "../../src"; describe("resolver - browser", () => { - afterEach(() => { - sinon.restore(); - }); - describe("single resolution (no pseudo-parsing)", () => { it.only("integration works in browser", function(done) { const dtmi: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; const endpoint = "https://devicemodels.azure.com"; - const fakeData = JSON.stringify({ - fakeDtdl: "fakeBodyAsText" - }); - const resolveResult = lib.resolve(dtmi, endpoint); - resolveResult + const client = new ModelsRepositoryClient({repositoryLocation: endpoint}); + const result = client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); + result .then((actualOutput: any) => { - assert.deepStrictEqual({ [dtmi]: JSON.parse(fakeData) }, actualOutput); + expect(actualOutput).to.equal('test'); done(); }) .catch((err: any) => done(err)); diff --git a/sdk/iot/modelsrepository/test/node/index.spec.ts b/sdk/iot/modelsrepository/test/node/index.spec.ts index d7cd57c28780..0aab558c9240 100644 --- a/sdk/iot/modelsrepository/test/node/index.spec.ts +++ b/sdk/iot/modelsrepository/test/node/index.spec.ts @@ -2,25 +2,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DtmiResolver } from "../../src"; -import * as coreHttp from "@azure/core-http"; -import * as fs from "fs"; +import { ModelsRepositoryClient, ModelsRepositoryClientOptions } from "../../src"; +import * as coreClient from "@azure/core-client"; -import { assert } from "chai"; +import { assert, expect } from "chai"; import * as sinon from "sinon"; -import * as path from "path"; +import { dependencyResolutionType } from "../../src/dependencyResolutionType"; interface remoteResolutionScenario { name: string; clientOptions: { - dependencyResolution: string; + dependencyResolution: dependencyResolutionType; repositoryLocation: string; }; + getModelsOptions: any, dtmis: { dtmi: string; - expectedURI: string; - expectedOutput: { + expectedUri: string; + expectedOutputJson: { fakeDtdl: string; }; }[]; @@ -33,12 +33,13 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ dependencyResolution: "disabled", repositoryLocation: "devicemodels.contoso.com" }, + getModelsOptions: {}, dtmis: [ { dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", - expectedURI: + expectedUri: "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", - expectedOutput: { fakeDtdl: "fakeBodyAsText" } + expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } } ] }, @@ -48,12 +49,13 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ dependencyResolution: "enabled", repositoryLocation: "devicemodels.contoso.com" }, + getModelsOptions: {}, dtmis: [ { dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", - expectedURI: + expectedUri: "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", - expectedOutput: { fakeDtdl: "fakeBodyAsText" } + expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } } ] }, @@ -63,12 +65,13 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ dependencyResolution: "tryFromExpanded", repositoryLocation: "devicemodels.contoso.com" }, + getModelsOptions: {}, dtmis: [ { dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", - expectedURI: + expectedUri: "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", - expectedOutput: { fakeDtdl: "fakeBodyAsText" } + expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } } ] }, @@ -78,12 +81,13 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ dependencyResolution: "tryFromExpanded", repositoryLocation: "devicemodels.contoso.com" }, + getModelsOptions: {}, dtmis: [ { dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", - expectedURI: + expectedUri: "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", - expectedOutput: { fakeDtdl: "fakeBodyAsText" } + expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } } ] } @@ -96,441 +100,472 @@ describe("resolver - node", function() { describe("remote URL resolution", function() { remoteResolutionScenarios.forEach((scenario: remoteResolutionScenario) => { - it(scenario.name, function(done) {}); - }); - describe("simple DTDL resolution", function() { - it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; - const fakeEndpoint = "devicemodels.contoso.com"; - const expectedUri = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; - const fakeData = JSON.stringify({ - fakeDtdl: "fakeBodyAsText" - }); - sinon.stub(coreHttp, "ServiceClient").returns({ - sendRequest: function(req: any) { - assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); + it(scenario.name, function(done) { + let myStub = sinon.stub(coreClient, 'ServiceClient'); + for (let i = 0; i < scenario.dtmis.length; i++) { + myStub.onCall(i).returns({ + sendRequest: function(req: any) { + assert.deepEqual(req.url, scenario.dtmis[i].expectedUri, "URL not formatted for request correctly."); + return Promise.resolve({ bodyAsText: JSON.stringify(scenario.dtmis[i].expectedOutputJson), status: 200 }); + } + }); + } - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint); - assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult + const myOptions: ModelsRepositoryClientOptions = scenario.clientOptions; + const dtmiClient = new ModelsRepositoryClient(myOptions); + const listOfDtmis = scenario.dtmis.map(x => x.dtmi); + const result = dtmiClient.getModels(listOfDtmis, scenario.getModelsOptions); + const expectedOutput:any = {}; + scenario.dtmis.forEach(element => { + expectedOutput[element.dtmi] = element.expectedOutputJson + }); + assert(result instanceof Promise, "resolve method did not return a promise"); + result .then((actualOutput: any) => { - assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); + expect(actualOutput).to.deep.equal(expectedOutput) done(); }) .catch((err: any) => done(err)); + + }); }); - describe("depenency resolution (using pseudo-parsing)", function() { - it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; - const fakeEndpoint: string = "devicemodels.contoso.com"; - const expectedUri = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; - const fakeData = JSON.stringify({ - fakeKey: "fakeValue" - }); - sinon.stub(coreHttp, "ServiceClient").returns({ - sendRequest: function(req: any) { - assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { - resolveDependencies: "enabled" - }); - assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput: any) => { - assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); - done(); - }) - .catch((err: any) => done(err)); - }); - it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { - const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const fakeEndpoint: string = "devicemodels.contoso.com"; - const expectedUri = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; - const expectedUri2 = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; - const expectedUri3 = - "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - ); - const fakeData = fs.readFileSync(pathToDtdl).toString(); - const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); - const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); - const expectedOutput = { - [fakeDtmi1]: JSON.parse(fakeData), - [fakeDtmi2]: JSON.parse(fakeData2), - [fakeDtmi3]: JSON.parse(fakeData3) - }; - const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); - serviceClientStub.onFirstCall().returns({ - sendRequest: function(req: any) { - assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - serviceClientStub.onSecondCall().returns({ - sendRequest: function(req: any) { - assert.deepEqual(req.url, expectedUri2, "URL not formatted for request correctly."); - return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); - } - }); - serviceClientStub.onThirdCall().returns({ - sendRequest: function(req: any) { - assert.deepEqual(req.url, expectedUri3, "URL not formatted for request correctly."); - return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); - } - }); + // describe("simple DTDL resolution", function() { + // it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + // const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; + // const fakeEndpoint = "devicemodels.contoso.com"; + // const expectedUri = + // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; + // const fakeData = JSON.stringify({ + // fakeDtdl: "fakeBodyAsText" + // }); + // sinon.stub(coreHttp, "ServiceClient").returns({ + // sendRequest: function(req: any) { + // assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); + // return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + // } + // }); - const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { - resolveDependencies: "enabled" - }); - assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput: any) => { - assert.deepEqual( - Object.keys(actualOutput), - Object.keys(expectedOutput), - "dtmis in actual output do not align with expected output" - ); - assert.deepStrictEqual(expectedOutput, actualOutput); - done(); - }) - .catch((err: any) => done(err)); - }); - }); + // const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint); + // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + // resolveResult + // .then((actualOutput: any) => { + // assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); + // done(); + // }) + // .catch((err: any) => done(err)); + // }); + // }); - describe("try from expanded (expanded.json)", function() { - it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; - const fakeEndpoint = "devicemodels.contoso.com"; - const expectedUri = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json"; - const fakeData = `[${JSON.stringify({ - "@id": fakeDtmi, - fakeDtdl: "fakeBodyAsText" - })}]`; - sinon.stub(coreHttp, "ServiceClient").returns({ - sendRequest: function(req: any) { - assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); + // describe("depenency resolution (using pseudo-parsing)", function() { + // it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + // const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; + // const fakeEndpoint: string = "devicemodels.contoso.com"; + // const expectedUri = + // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; + // const fakeData = JSON.stringify({ + // fakeKey: "fakeValue" + // }); + // sinon.stub(coreHttp, "ServiceClient").returns({ + // sendRequest: function(req: any) { + // assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); + // return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + // } + // }); - const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { - resolveDependencies: "tryFromExpanded" - }); - assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput: any) => { - assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput); - done(); - }) - .catch((err: any) => done(err)); - }); + // const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { + // resolveDependencies: "enabled" + // }); + // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + // resolveResult + // .then((actualOutput: any) => { + // assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); + // done(); + // }) + // .catch((err: any) => done(err)); + // }); - it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { - const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const fakeEndpoint: string = "devicemodels.contoso.com"; - const expectedUri = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; - const expectedUri2 = - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; - const expectedUri3 = - "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - ); - const fakeData = fs.readFileSync(pathToDtdl).toString(); - const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); - const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); - const expectedOutput = { - [fakeDtmi1]: JSON.parse(fakeData), - [fakeDtmi2]: JSON.parse(fakeData2), - [fakeDtmi3]: JSON.parse(fakeData3) - }; - const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); - serviceClientStub.onCall(0).returns({ - sendRequest: function(req: any) { - assert.deepEqual( - req.url, - expectedUri.replace(".json", ".expanded.json"), - "URL not formatted for request correctly." - ); - return Promise.resolve({ status: 404 }); - } - }); - serviceClientStub.onCall(1).returns({ - sendRequest: function(req: any) { - assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); - return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - } - }); - serviceClientStub.onCall(2).returns({ - sendRequest: function(req: any) { - assert.deepEqual( - req.url, - expectedUri2.replace(".json", ".expanded.json"), - "URL not formatted for request correctly." - ); - return Promise.resolve({ status: 404 }); - } - }); - serviceClientStub.onCall(3).returns({ - sendRequest: function(req: any) { - assert.deepEqual(req.url, expectedUri2, "URL not formatted for request correctly."); - return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); - } - }); - serviceClientStub.onCall(4).returns({ - sendRequest: function(req: any) { - assert.deepEqual( - req.url, - expectedUri3.replace(".json", ".expanded.json"), - "URL not formatted for request correctly." - ); - return Promise.resolve({ status: 404 }); - } - }); - serviceClientStub.onCall(5).returns({ - sendRequest: function(req: any) { - assert.deepEqual(req.url, expectedUri3, "URL not formatted for request correctly."); - return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); - } - }); + // it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { + // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + // const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + // const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + // const fakeEndpoint: string = "devicemodels.contoso.com"; + // const expectedUri = + // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; + // const expectedUri2 = + // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; + // const expectedUri3 = + // "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; + // const localDirectory = path.resolve("./test/node/testModelRepository"); + // const pathToDtdl = path.join( + // localDirectory, + // "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + // ); + // const fakeData = fs.readFileSync(pathToDtdl).toString(); + // const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); + // const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); + // const expectedOutput = { + // [fakeDtmi1]: JSON.parse(fakeData), + // [fakeDtmi2]: JSON.parse(fakeData2), + // [fakeDtmi3]: JSON.parse(fakeData3) + // }; + // const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); + // serviceClientStub.onFirstCall().returns({ + // sendRequest: function(req: any) { + // assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); + // return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + // } + // }); + // serviceClientStub.onSecondCall().returns({ + // sendRequest: function(req: any) { + // assert.deepEqual(req.url, expectedUri2, "URL not formatted for request correctly."); + // return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); + // } + // }); + // serviceClientStub.onThirdCall().returns({ + // sendRequest: function(req: any) { + // assert.deepEqual(req.url, expectedUri3, "URL not formatted for request correctly."); + // return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); + // } + // }); - const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { - resolveDependencies: "tryFromExpanded" - }); - assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput: any) => { - assert.deepEqual( - Object.keys(actualOutput), - Object.keys(expectedOutput), - "dtmis in actual output do not align with expected output" - ); - assert.deepStrictEqual(expectedOutput, actualOutput); - done(); - }) - .catch((err: any) => done(err)); - }); - }); + // const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { + // resolveDependencies: "enabled" + // }); + // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + // resolveResult + // .then((actualOutput: any) => { + // assert.deepEqual( + // Object.keys(actualOutput), + // Object.keys(expectedOutput), + // "dtmis in actual output do not align with expected output" + // ); + // assert.deepStrictEqual(expectedOutput, actualOutput); + // done(); + // }) + // .catch((err: any) => done(err)); + // }); + // }); + + // describe("try from expanded (expanded.json)", function() { + // it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + // const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; + // const fakeEndpoint = "devicemodels.contoso.com"; + // const expectedUri = + // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json"; + // const fakeData = `[${JSON.stringify({ + // "@id": fakeDtmi, + // fakeDtdl: "fakeBodyAsText" + // })}]`; + // sinon.stub(coreHttp, "ServiceClient").returns({ + // sendRequest: function(req: any) { + // assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); + // return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + // } + // }); + + // const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { + // resolveDependencies: "tryFromExpanded" + // }); + // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + // resolveResult + // .then((actualOutput: any) => { + // assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput); + // done(); + // }) + // .catch((err: any) => done(err)); + // }); + + // it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { + // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + // const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + // const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + // const fakeEndpoint: string = "devicemodels.contoso.com"; + // const expectedUri = + // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; + // const expectedUri2 = + // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; + // const expectedUri3 = + // "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; + // const localDirectory = path.resolve("./test/node/testModelRepository"); + // const pathToDtdl = path.join( + // localDirectory, + // "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + // ); + // const fakeData = fs.readFileSync(pathToDtdl).toString(); + // const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); + // const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); + // const expectedOutput = { + // [fakeDtmi1]: JSON.parse(fakeData), + // [fakeDtmi2]: JSON.parse(fakeData2), + // [fakeDtmi3]: JSON.parse(fakeData3) + // }; + // const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); + // serviceClientStub.onCall(0).returns({ + // sendRequest: function(req: any) { + // assert.deepEqual( + // req.url, + // expectedUri.replace(".json", ".expanded.json"), + // "URL not formatted for request correctly." + // ); + // return Promise.resolve({ status: 404 }); + // } + // }); + // serviceClientStub.onCall(1).returns({ + // sendRequest: function(req: any) { + // assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); + // return Promise.resolve({ bodyAsText: fakeData, status: 200 }); + // } + // }); + // serviceClientStub.onCall(2).returns({ + // sendRequest: function(req: any) { + // assert.deepEqual( + // req.url, + // expectedUri2.replace(".json", ".expanded.json"), + // "URL not formatted for request correctly." + // ); + // return Promise.resolve({ status: 404 }); + // } + // }); + // serviceClientStub.onCall(3).returns({ + // sendRequest: function(req: any) { + // assert.deepEqual(req.url, expectedUri2, "URL not formatted for request correctly."); + // return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); + // } + // }); + // serviceClientStub.onCall(4).returns({ + // sendRequest: function(req: any) { + // assert.deepEqual( + // req.url, + // expectedUri3.replace(".json", ".expanded.json"), + // "URL not formatted for request correctly." + // ); + // return Promise.resolve({ status: 404 }); + // } + // }); + // serviceClientStub.onCall(5).returns({ + // sendRequest: function(req: any) { + // assert.deepEqual(req.url, expectedUri3, "URL not formatted for request correctly."); + // return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); + // } + // }); + + // const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { + // resolveDependencies: "tryFromExpanded" + // }); + // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + // resolveResult + // .then((actualOutput: any) => { + // assert.deepEqual( + // Object.keys(actualOutput), + // Object.keys(expectedOutput), + // "dtmis in actual output do not align with expected output" + // ); + // assert.deepStrictEqual(expectedOutput, actualOutput); + // done(); + // }) + // .catch((err: any) => done(err)); + // }); + // }); }); - describe("local file resolution", function() { - describe("simple DTDL resolution", function() { - it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - ); - const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, "utf-8")); - const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory); - assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput: any) => { - assert.deepStrictEqual( - { [fakeDtmi]: fakeDtdl }, - actualOutput, - "the expected dtmi mapping did not match the actual value." - ); - done(); - }) - .catch((err: any) => done(err)); - }); - }); + // describe("local file resolution", function() { + // describe("simple DTDL resolution", function() { + // it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + // const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; + // const localDirectory = path.resolve("./test/node/testModelRepository"); + // const pathToDtdl = path.join( + // localDirectory, + // "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + // ); + // const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, "utf-8")); + // const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory); + // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + // resolveResult + // .then((actualOutput: any) => { + // assert.deepStrictEqual( + // { [fakeDtmi]: fakeDtdl }, + // actualOutput, + // "the expected dtmi mapping did not match the actual value." + // ); + // done(); + // }) + // .catch((err: any) => done(err)); + // }); + // }); - describe("dependency resolution (using pseudo-parsing)", function() { - it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { - const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl1 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - ); - const pathToDtdl2 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - ); - const pathToDtdl3 = path.join( - localDirectory, - "dtmi/azure/DeviceManagement/deviceinformation-1.json" - ); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); + // describe("dependency resolution (using pseudo-parsing)", function() { + // it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { + // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + // const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + // const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + // const localDirectory = path.resolve("./test/node/testModelRepository"); + // const pathToDtdl1 = path.join( + // localDirectory, + // "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + // ); + // const pathToDtdl2 = path.join( + // localDirectory, + // "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + // ); + // const pathToDtdl3 = path.join( + // localDirectory, + // "dtmi/azure/DeviceManagement/deviceinformation-1.json" + // ); + // const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + // const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); + // const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); - const expectedOutput = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { - resolveDependencies: "enabled" - }); - assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput: any) => { - assert.deepStrictEqual( - Object.keys(actualOutput), - Object.keys(expectedOutput), - "dtmis do not match" - ); - Object.keys(actualOutput).forEach((outputDtmi) => { - assert.deepStrictEqual( - actualOutput[outputDtmi], - expectedOutput[outputDtmi], - `dtdls for given dtmi (${outputDtmi}) did not line up.` - ); - }); - assert.deepStrictEqual( - actualOutput, - expectedOutput, - "the expected dtmi mapping did not match the actual value." - ); - done(); - }) - .catch((err: any) => done(err)); - }); + // const expectedOutput = { + // [fakeDtmi1]: fakeDtdl1, + // [fakeDtmi2]: fakeDtdl2, + // [fakeDtmi3]: fakeDtdl3 + // }; + // const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { + // resolveDependencies: "enabled" + // }); + // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + // resolveResult + // .then((actualOutput: any) => { + // assert.deepStrictEqual( + // Object.keys(actualOutput), + // Object.keys(expectedOutput), + // "dtmis do not match" + // ); + // Object.keys(actualOutput).forEach((outputDtmi) => { + // assert.deepStrictEqual( + // actualOutput[outputDtmi], + // expectedOutput[outputDtmi], + // `dtdls for given dtmi (${outputDtmi}) did not line up.` + // ); + // }); + // assert.deepStrictEqual( + // actualOutput, + // expectedOutput, + // "the expected dtmi mapping did not match the actual value." + // ); + // done(); + // }) + // .catch((err: any) => done(err)); + // }); - it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl1 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - ); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + // it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { + // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; + // const localDirectory = path.resolve("./test/node/testModelRepository"); + // const pathToDtdl1 = path.join( + // localDirectory, + // "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + // ); + // const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - const expectedResult = { - [fakeDtmi1]: fakeDtdl1 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory); - assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput: any) => { - assert.deepStrictEqual( - expectedResult, - actualOutput, - "the expected dtmi mapping did not match the actual value." - ); - done(); - }) - .catch((err: any) => done(err)); - }); - }); + // const expectedResult = { + // [fakeDtmi1]: fakeDtdl1 + // }; + // const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory); + // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + // resolveResult + // .then((actualOutput: any) => { + // assert.deepStrictEqual( + // expectedResult, + // actualOutput, + // "the expected dtmi mapping did not match the actual value." + // ); + // done(); + // }) + // .catch((err: any) => done(err)); + // }); + // }); - describe("try from expanded (expanded.json)", function() { - it("should return a promise that resolves to a mapping from the DTMIs to the JSON objects", function(done) { - const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl1 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - ); - const pathToDtdl2 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - ); - const pathToDtdl3 = path.join( - localDirectory, - "dtmi/azure/DeviceManagement/deviceinformation-1.json" - ); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); + // describe("try from expanded (expanded.json)", function() { + // it("should return a promise that resolves to a mapping from the DTMIs to the JSON objects", function(done) { + // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; + // const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + // const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + // const localDirectory = path.resolve("./test/node/testModelRepository"); + // const pathToDtdl1 = path.join( + // localDirectory, + // "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" + // ); + // const pathToDtdl2 = path.join( + // localDirectory, + // "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + // ); + // const pathToDtdl3 = path.join( + // localDirectory, + // "dtmi/azure/DeviceManagement/deviceinformation-1.json" + // ); + // const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + // const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); + // const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); - const expectedResult = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { - resolveDependencies: "tryFromExpanded" - }); - assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput: any) => { - assert.deepStrictEqual( - expectedResult, - actualOutput, - "the expected dtmi mapping did not match the actual value." - ); - done(); - }) - .catch((err: any) => done(err)); - }); + // const expectedResult = { + // [fakeDtmi1]: fakeDtdl1, + // [fakeDtmi2]: fakeDtdl2, + // [fakeDtmi3]: fakeDtdl3 + // }; + // const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { + // resolveDependencies: "tryFromExpanded" + // }); + // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + // resolveResult + // .then((actualOutput: any) => { + // assert.deepStrictEqual( + // expectedResult, + // actualOutput, + // "the expected dtmi mapping did not match the actual value." + // ); + // done(); + // }) + // .catch((err: any) => done(err)); + // }); - it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { - const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2"; - const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - const localDirectory = path.resolve("./test/node/testModelRepository"); - const pathToDtdl1 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json" - ); - const pathToDtdl2 = path.join( - localDirectory, - "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - ); - const pathToDtdl3 = path.join( - localDirectory, - "dtmi/azure/DeviceManagement/deviceinformation-1.json" - ); - const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); - const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); + // it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { + // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2"; + // const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; + // const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + // const localDirectory = path.resolve("./test/node/testModelRepository"); + // const pathToDtdl1 = path.join( + // localDirectory, + // "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json" + // ); + // const pathToDtdl2 = path.join( + // localDirectory, + // "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" + // ); + // const pathToDtdl3 = path.join( + // localDirectory, + // "dtmi/azure/DeviceManagement/deviceinformation-1.json" + // ); + // const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); + // const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); + // const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); - const expectedResult = { - [fakeDtmi1]: fakeDtdl1, - [fakeDtmi2]: fakeDtdl2, - [fakeDtmi3]: fakeDtdl3 - }; - const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { - resolveDependencies: "tryFromExpanded" - }); - assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - resolveResult - .then((actualOutput: any) => { - assert.deepEqual( - Object.keys(expectedResult), - Object.keys(actualOutput), - "the expected dtmis do not match" - ); - Object.keys(expectedResult).forEach((dtmiKey) => { - assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey]); - }); - done(); - }) - .catch((err: any) => done(err)); - }); - }); - }); + // const expectedResult = { + // [fakeDtmi1]: fakeDtdl1, + // [fakeDtmi2]: fakeDtdl2, + // [fakeDtmi3]: fakeDtdl3 + // }; + // const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { + // resolveDependencies: "tryFromExpanded" + // }); + // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); + // resolveResult + // .then((actualOutput: any) => { + // assert.deepEqual( + // Object.keys(expectedResult), + // Object.keys(actualOutput), + // "the expected dtmis do not match" + // ); + // Object.keys(expectedResult).forEach((dtmiKey) => { + // assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey]); + // }); + // done(); + // }) + // .catch((err: any) => done(err)); + // }); + // }); + // }); }); From 4fca6439de5f2ed72bcbea9e0cc400970c7276e2 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 20 Apr 2021 08:38:52 -0700 Subject: [PATCH 12/81] linting --- sdk/iot/modelsrepository/src/DTDL.ts | 6 +-- sdk/iot/modelsrepository/src/client.ts | 54 ++++++++++--------- sdk/iot/modelsrepository/src/constants.ts | 18 +++---- .../src/dependencyResolutionType.ts | 2 +- .../modelsrepository/src/dtmiConventions.ts | 13 +++-- .../src/filesystemModelFetcher.ts | 16 +++--- .../modelsrepository/src/httpModelFetcher.ts | 15 +++--- sdk/iot/modelsrepository/src/index.ts | 2 +- sdk/iot/modelsrepository/src/logger.ts | 4 +- .../src/modelFetcherHelper.ts | 11 ++-- sdk/iot/modelsrepository/src/psuedoParser.ts | 24 ++++----- sdk/iot/modelsrepository/src/resolver.ts | 10 ++-- sdk/iot/modelsrepository/src/serviceClient.ts | 3 +- .../test/browser/browserTest.spec.ts | 6 +-- .../modelsrepository/test/node/index.spec.ts | 29 +++++----- 15 files changed, 109 insertions(+), 104 deletions(-) diff --git a/sdk/iot/modelsrepository/src/DTDL.ts b/sdk/iot/modelsrepository/src/DTDL.ts index eb8cd9264d99..4e23d72128bc 100644 --- a/sdk/iot/modelsrepository/src/DTDL.ts +++ b/sdk/iot/modelsrepository/src/DTDL.ts @@ -2,14 +2,14 @@ // Licensed under the MIT license. interface Contents { - '@type'?: string; + "@type"?: string; name: string; schema: string; } export interface DTDL extends JSON { - '@context': any[]; - '@id': string; + "@context": any[]; + "@id": string; extends: string | Array; contents: Contents[]; } diff --git a/sdk/iot/modelsrepository/src/client.ts b/sdk/iot/modelsrepository/src/client.ts index e750c79356e8..90afc5613e72 100644 --- a/sdk/iot/modelsrepository/src/client.ts +++ b/sdk/iot/modelsrepository/src/client.ts @@ -1,19 +1,19 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import * as constants from './constants'; - -import {createClientPipeline, ClientPipelineOptions} from "@azure/core-client"; -import {dependencyResolutionType} from './dependencyResolutionType'; -import {logger} from './logger'; -import {URL} from 'url'; -import {DtmiResolver, ResolverError} from './resolver'; -import {HttpFetcher} from './httpModelFetcher'; -import {FilesystemFetcher} from './filesystemModelFetcher'; -import {isLocalPath} from './modelFetcherHelper'; -import * as path from 'path'; -import {PseudoParser} from './psuedoParser'; -import { MyServiceClient } from './serviceClient'; +import * as constants from "./constants"; + +import { createClientPipeline, ClientPipelineOptions } from "@azure/core-client"; +import { dependencyResolutionType } from "./dependencyResolutionType"; +import { logger } from "./logger"; +import { URL } from "url"; +import { DtmiResolver, ResolverError } from "./resolver"; +import { HttpFetcher } from "./httpModelFetcher"; +import { FilesystemFetcher } from "./filesystemModelFetcher"; +import { isLocalPath } from "./modelFetcherHelper"; +import * as path from "path"; +import { PseudoParser } from "./psuedoParser"; +import { MyServiceClient } from "./serviceClient"; export interface ModelsRepositoryClientOptions extends ClientPipelineOptions { repositoryLocation?: string; @@ -50,9 +50,9 @@ export class ModelsRepositoryClient { private _checkDefaultDependencyResolution(customRepository: boolean) { if (customRepository) { - return 'enabled'; + return "enabled"; } else { - return 'tryFromExpanded'; + return "tryFromExpanded"; } } @@ -96,21 +96,21 @@ export class ModelsRepositoryClient { fetcher = new FilesystemFetcher(path.normalize(location)); } else { locationURL = new URL(location); - if (locationURL.protocol in ['http', 'https']) { + if (locationURL.protocol in ["http", "https"]) { logger.info(`Repository location identified as HTTP/HTTPS endpoint - using HttpFetcher`); const client = this._createClient(options); fetcher = new HttpFetcher(location, client); - } else if (locationURL.protocol === 'file') { + } else if (locationURL.protocol === "file") { // filesystem URI - logger.info('Repository Location identified as filesystem URI - using FilesystemFetcher'); + logger.info("Repository Location identified as filesystem URI - using FilesystemFetcher"); fetcher = new FilesystemFetcher(location); - } else if (locationURL.protocol === '' && location.startsWith('/')) { - } else if (locationURL.protocol === '' && location.search(/\.[a-zA-Z]{2,63}$/)) { + } else if (locationURL.protocol === "" && location.startsWith("/")) { + } else if (locationURL.protocol === "" && location.search(/\.[a-zA-Z]{2,63}$/)) { // Web URL with protocol unspecified - default to HTTPS logger.info( - 'Repository Location identified as remote endpoint without protocol specified - using HttpFetcher' + "Repository Location identified as remote endpoint without protocol specified - using HttpFetcher" ); - const fLocation = 'https://' + location; + const fLocation = "https://" + location; const client = this._createClient(options); fetcher = new HttpFetcher(fLocation, client); // TODO: make the next line match a regex specified. @@ -124,7 +124,10 @@ export class ModelsRepositoryClient { getModels(dtmi: string, options?: getModelsOptions): Promise<{ [dtmi: string]: any }>; getModels(dtmis: string[], options?: getModelsOptions): Promise<{ [dtmi: string]: any }>; - getModels(dtmis: string | string[], options?: getModelsOptions): Promise<{ [dtmi: string]: any }> { + getModels( + dtmis: string | string[], + options?: getModelsOptions + ): Promise<{ [dtmi: string]: any }> { let modelMap; if (!Array.isArray(dtmis)) { dtmis = [dtmis]; @@ -133,7 +136,7 @@ export class ModelsRepositoryClient { const dependencyResolution = options?.dependencyResolution || this._dependencyResolution; if (dependencyResolution === constants.DEPENDENCY_MODE_DISABLED) { - logger.info('Getting models w/ dependency resolution mode: disabled'); + logger.info("Getting models w/ dependency resolution mode: disabled"); logger.info(`Retreiving model(s): ${dtmis}...`); modelMap = this._resolver.resolve(dtmis); } else if (dependencyResolution === constants.DEPENDENCY_MODE_ENABLED) { @@ -162,7 +165,6 @@ export class ModelsRepositoryClient { } } - interface getModelsOptions { - dependencyResolution: dependencyResolutionType + dependencyResolution: dependencyResolutionType; } diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts index 4bff2255ec66..b0ee839f1845 100644 --- a/sdk/iot/modelsrepository/src/constants.ts +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -const isBrowser = new Function('try {return this===window;}catch(e){ return false;}'); -const isNode = new Function('try {return this===global;}catch(e){return false;}'); +const isBrowser = new Function("try {return this===window;}catch(e){ return false;}"); +const isNode = new Function("try {return this===global;}catch(e){return false;}"); -const currentPlatform = isBrowser ? 'browser' : isNode ? 'node' : 'undefined'; +const currentPlatform = isBrowser ? "browser" : isNode ? "node" : "undefined"; -export const SDK_VERSION = '0.0.0-preview'; +export const SDK_VERSION = "0.0.0-preview"; export const DEFAULT_USER_AGENT = `azsdk-node-modelsrepository/${SDK_VERSION} (${currentPlatform})`; -export const DEFAULT_REPOSITORY_LOCATION = 'https://devicemodels.azure.com'; -export const DEFAULT_API_VERSION = '2021-02-11'; +export const DEFAULT_REPOSITORY_LOCATION = "https://devicemodels.azure.com"; +export const DEFAULT_API_VERSION = "2021-02-11"; -export const DEPENDENCY_MODE_DISABLED = 'disabled'; -export const DEPENDENCY_MODE_ENABLED = 'enabled'; -export const DEPENDENCY_MODE_TRY_FROM_EXPANDED = 'tryFromExpanded'; +export const DEPENDENCY_MODE_DISABLED = "disabled"; +export const DEPENDENCY_MODE_ENABLED = "enabled"; +export const DEPENDENCY_MODE_TRY_FROM_EXPANDED = "tryFromExpanded"; diff --git a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts index a49a0ee2a520..b7e5f79a7b27 100644 --- a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts +++ b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -export type dependencyResolutionType = 'disabled' | 'enabled' | 'tryFromExpanded' | undefined; +export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded" | undefined; diff --git a/sdk/iot/modelsrepository/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts index 3de658e4aa95..73097a0bba33 100644 --- a/sdk/iot/modelsrepository/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -10,8 +10,8 @@ export function isValidDtmi(dtmi: string) { } export function getModelUri(dtmi: string, repositoryUri: string, expanded: boolean = false) { - if (!repositoryUri.endsWith('/')) { - repositoryUri = repositoryUri.concat('/'); + if (!repositoryUri.endsWith("/")) { + repositoryUri = repositoryUri.concat("/"); } const modelUri = repositoryUri + convertDtmiToPath(dtmi, expanded); return modelUri; @@ -23,11 +23,14 @@ export function convertDtmiToPath(dtmi: string, expanded: boolean) { // that happens in the dtmiToQualifiedPath function if (isValidDtmi(dtmi)) { - let thePath = `${dtmi.toLowerCase().replace(/:/gm, '/').replace(/;/gm, '-')}.json`; + let thePath = `${dtmi + .toLowerCase() + .replace(/:/gm, "/") + .replace(/;/gm, "-")}.json`; if (expanded) { - thePath = thePath.replace('.json', '.expanded.json'); + thePath = thePath.replace(".json", ".expanded.json"); } } else { - throw new Error('DTMI provided is invalid. Ensure it follows DTMI conventions.'); + throw new Error("DTMI provided is invalid. Ensure it follows DTMI conventions."); } } diff --git a/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts b/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts index 756415f0153a..43daf724515e 100644 --- a/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts +++ b/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { DTDL } from './DTDL'; -import fs from 'fs'; -import * as path from 'path'; -import { Fetcher } from './fetcher'; -import { logger } from './logger'; -import { FetcherError } from './resolver'; +import { DTDL } from "./DTDL"; +import fs from "fs"; +import * as path from "path"; +import { Fetcher } from "./fetcher"; +import { logger } from "./logger"; +import { FetcherError } from "./resolver"; export class FilesystemFetcher extends Fetcher { private _baseFilePath: string; @@ -22,11 +22,11 @@ export class FilesystemFetcher extends Fetcher { try { logger.info(`File open on ${absolutePath}`); - const dtdlFile = fs.readFileSync(absolutePath, 'utf8'); + const dtdlFile = fs.readFileSync(absolutePath, "utf8"); const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); return parsedDtdl; } catch (e) { - throw new FetcherError('Failed to fetch from Filesystem', e); + throw new FetcherError("Failed to fetch from Filesystem", e); } } } diff --git a/sdk/iot/modelsrepository/src/httpModelFetcher.ts b/sdk/iot/modelsrepository/src/httpModelFetcher.ts index 13185fe91649..c473f71e27fa 100644 --- a/sdk/iot/modelsrepository/src/httpModelFetcher.ts +++ b/sdk/iot/modelsrepository/src/httpModelFetcher.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import {ServiceClient} from '@azure/core-client'; -import {PipelineResponse, RestError} from '@azure/core-rest-pipeline'; -import { logger } from './logger'; -import { Fetcher } from './fetcher'; +import { ServiceClient } from "@azure/core-client"; +import { PipelineResponse, RestError } from "@azure/core-rest-pipeline"; +import { logger } from "./logger"; +import { Fetcher } from "./fetcher"; export class HttpFetcher extends Fetcher { private _client: ServiceClient; @@ -22,12 +22,12 @@ export class HttpFetcher extends Fetcher { const request: any = { url: myURL, - method: 'GET' + method: "GET" }; const res: PipelineResponse = await this._client.sendRequest(request); if (res.status >= 200 && res.status < 400) { - const dtdlAsString = res.bodyAsText || ''; + const dtdlAsString = res.bodyAsText || ""; const parsedDtdl = JSON.parse(dtdlAsString); return parsedDtdl; // if (Array.isArray(parsedDtdl)) { @@ -38,8 +38,7 @@ export class HttpFetcher extends Fetcher { // return result; // } } else { - throw new RestError( - 'Error on HTTP Request in remote model fetcher'); + throw new RestError("Error on HTTP Request in remote model fetcher"); } } } diff --git a/sdk/iot/modelsrepository/src/index.ts b/sdk/iot/modelsrepository/src/index.ts index 31dfbda31863..6f6eede48edb 100644 --- a/sdk/iot/modelsrepository/src/index.ts +++ b/sdk/iot/modelsrepository/src/index.ts @@ -2,4 +2,4 @@ // Licensed under the MIT license. // exporting the resolver api -export * from './client'; +export * from "./client"; diff --git a/sdk/iot/modelsrepository/src/logger.ts b/sdk/iot/modelsrepository/src/logger.ts index 3726b5254e7f..b04bd5f34807 100644 --- a/sdk/iot/modelsrepository/src/logger.ts +++ b/sdk/iot/modelsrepository/src/logger.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { createClientLogger } from '@azure/logger'; +import { createClientLogger } from "@azure/logger"; /** * The @azure/logger configuration for this package. */ -export const logger = createClientLogger('iot-modelsrepository'); +export const logger = createClientLogger("iot-modelsrepository"); diff --git a/sdk/iot/modelsrepository/src/modelFetcherHelper.ts b/sdk/iot/modelsrepository/src/modelFetcherHelper.ts index 66d5b07b83ba..e82a631db035 100644 --- a/sdk/iot/modelsrepository/src/modelFetcherHelper.ts +++ b/sdk/iot/modelsrepository/src/modelFetcherHelper.ts @@ -1,8 +1,7 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. - -import { DTDL } from './DTDL'; +import { DTDL } from "./DTDL"; export function isLocalPath(p: string): boolean { const myRegex = RegExp(/^(?:[a-zA-Z]\:|\\\\[\w\.]+\\[\w.$]+)\\(?:[\w]+\\)*\w([\w.])+$/g); @@ -13,13 +12,13 @@ export function flattenDtdlResponse(input: DTDL[]) { const newResult: { [x: string]: DTDL } = {}; for (let i = 0; i++; i < input.length) { const currentDtdl = input[i]; - if (!currentDtdl['@id']) { - throw new Error('no @id element found in DTDL. Ensure DTDL contains @id element'); + if (!currentDtdl["@id"]) { + throw new Error("no @id element found in DTDL. Ensure DTDL contains @id element"); } - newResult[currentDtdl['@id']] = currentDtdl; + newResult[currentDtdl["@id"]] = currentDtdl; } input.forEach((element: DTDL) => { - newResult[element['@id']] = element; + newResult[element["@id"]] = element; }); return newResult; } diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index ff540c67b696..f9471f940723 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { DTDL } from './DTDL'; -import { logger } from './logger'; -import { DtmiResolver } from './resolver'; +import { DTDL } from "./DTDL"; +import { logger } from "./logger"; +import { DtmiResolver } from "./resolver"; export class PseudoParser { private _resolver; @@ -16,7 +16,7 @@ export class PseudoParser { let expandedMap: any = {}; models.forEach((model: DTDL) => { - expandedMap[model['@id']] = model; + expandedMap[model["@id"]] = model; this._expand(model, expandedMap); }); @@ -24,7 +24,7 @@ export class PseudoParser { } private _expand(model: DTDL, modelMap: any) { - logger.info(`Expanding model: ${model['@id']}`); + logger.info(`Expanding model: ${model["@id"]}`); let dependencies = this._getModelDependencies(model); let dependenciesToResolve = dependencies.filter((dependency: string) => { return !(dependency in modelMap); @@ -46,11 +46,11 @@ export class PseudoParser { const contents = model.contents; contents.forEach((element) => { if ( - element['@type'] && - typeof element['@type'] === 'string' && - element['@type'] === 'Component' + element["@type"] && + typeof element["@type"] === "string" && + element["@type"] === "Component" ) { - if (element.schema && typeof element.schema === 'string') { + if (element.schema && typeof element.schema === "string") { dependencies.push(element.schema); } } @@ -58,13 +58,13 @@ export class PseudoParser { } if (model.extends !== undefined) { - if (typeof model.extends === 'string') { + if (typeof model.extends === "string") { dependencies.push(model.extends); } else if (Array.isArray(model.extends)) { model.extends.forEach((element) => { - if (typeof element === 'string') { + if (typeof element === "string") { dependencies.push(element); - } else if (typeof element === 'object') { + } else if (typeof element === "object") { dependencies.push(this._getModelDependencies(element)); } }); diff --git a/sdk/iot/modelsrepository/src/resolver.ts b/sdk/iot/modelsrepository/src/resolver.ts index 5c06ee1d27c0..3504d2f8a22c 100644 --- a/sdk/iot/modelsrepository/src/resolver.ts +++ b/sdk/iot/modelsrepository/src/resolver.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { convertDtmiToPath } from './dtmiConventions'; -import { logger } from './logger'; +import { convertDtmiToPath } from "./dtmiConventions"; +import { logger } from "./logger"; export class FetcherError extends Error { cause: Error | undefined; @@ -48,13 +48,13 @@ export class DtmiResolver { if (expandedModel) { for (let model of dtdl) { - modelMap[model['@id']] = model; + modelMap[model["@id"]] = model; } } else { let model = dtdl; - if (model['@id'] != dtmi) { + if (model["@id"] != dtmi) { return Promise.reject( - new ResolverError(`DTMI mismatch - Request: ${dtmi}, Response ${model['@id']}`) + new ResolverError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`) ); } diff --git a/sdk/iot/modelsrepository/src/serviceClient.ts b/sdk/iot/modelsrepository/src/serviceClient.ts index a5798c39a9dc..a42c440f2d6a 100644 --- a/sdk/iot/modelsrepository/src/serviceClient.ts +++ b/sdk/iot/modelsrepository/src/serviceClient.ts @@ -20,7 +20,7 @@ export class MyServiceClient extends ServiceClient { constructor(url: string, options: MyServiceClientOptions = {}) { const defaults: MyServiceClientOptions = { baseUri: `${url}`, - requestContentType: 'application/json; charset=utf-8' + requestContentType: "application/json; charset=utf-8" }; const optionsWithDefaults = { @@ -33,5 +33,4 @@ export class MyServiceClient extends ServiceClient { this.url = url; this.version = options.version || "2019-02-02"; } - } diff --git a/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts b/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts index 0e216e690be4..289d2d8e86ab 100644 --- a/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts +++ b/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts @@ -9,11 +9,11 @@ describe("resolver - browser", () => { it.only("integration works in browser", function(done) { const dtmi: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; const endpoint = "https://devicemodels.azure.com"; - const client = new ModelsRepositoryClient({repositoryLocation: endpoint}); - const result = client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); + const client = new ModelsRepositoryClient({ repositoryLocation: endpoint }); + const result = client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" }); result .then((actualOutput: any) => { - expect(actualOutput).to.equal('test'); + expect(actualOutput).to.equal("test"); done(); }) .catch((err: any) => done(err)); diff --git a/sdk/iot/modelsrepository/test/node/index.spec.ts b/sdk/iot/modelsrepository/test/node/index.spec.ts index 0aab558c9240..f213044e7250 100644 --- a/sdk/iot/modelsrepository/test/node/index.spec.ts +++ b/sdk/iot/modelsrepository/test/node/index.spec.ts @@ -16,7 +16,7 @@ interface remoteResolutionScenario { dependencyResolution: dependencyResolutionType; repositoryLocation: string; }; - getModelsOptions: any, + getModelsOptions: any; dtmis: { dtmi: string; expectedUri: string; @@ -101,38 +101,41 @@ describe("resolver - node", function() { describe("remote URL resolution", function() { remoteResolutionScenarios.forEach((scenario: remoteResolutionScenario) => { it(scenario.name, function(done) { - let myStub = sinon.stub(coreClient, 'ServiceClient'); + let myStub = sinon.stub(coreClient, "ServiceClient"); for (let i = 0; i < scenario.dtmis.length; i++) { myStub.onCall(i).returns({ sendRequest: function(req: any) { - assert.deepEqual(req.url, scenario.dtmis[i].expectedUri, "URL not formatted for request correctly."); - return Promise.resolve({ bodyAsText: JSON.stringify(scenario.dtmis[i].expectedOutputJson), status: 200 }); + assert.deepEqual( + req.url, + scenario.dtmis[i].expectedUri, + "URL not formatted for request correctly." + ); + return Promise.resolve({ + bodyAsText: JSON.stringify(scenario.dtmis[i].expectedOutputJson), + status: 200 + }); } }); } const myOptions: ModelsRepositoryClientOptions = scenario.clientOptions; const dtmiClient = new ModelsRepositoryClient(myOptions); - const listOfDtmis = scenario.dtmis.map(x => x.dtmi); + const listOfDtmis = scenario.dtmis.map((x) => x.dtmi); const result = dtmiClient.getModels(listOfDtmis, scenario.getModelsOptions); - const expectedOutput:any = {}; - scenario.dtmis.forEach(element => { - expectedOutput[element.dtmi] = element.expectedOutputJson + const expectedOutput: any = {}; + scenario.dtmis.forEach((element) => { + expectedOutput[element.dtmi] = element.expectedOutputJson; }); assert(result instanceof Promise, "resolve method did not return a promise"); result .then((actualOutput: any) => { - expect(actualOutput).to.deep.equal(expectedOutput) + expect(actualOutput).to.deep.equal(expectedOutput); done(); }) .catch((err: any) => done(err)); - - }); }); - - // describe("simple DTDL resolution", function() { // it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { // const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; From 3f7c51023e7df42e95b9d8b88decdbf94267dcf8 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 20 Apr 2021 08:51:38 -0700 Subject: [PATCH 13/81] add launch.json to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 5386990e97c6..5bee0401f2a1 100644 --- a/.gitignore +++ b/.gitignore @@ -152,3 +152,6 @@ swagger/*.json #autorest artifacts code-model-* + +# vscode launch.json +**/.vscode/launch.json From c48dd65ad160dce52d9c0cd0016c503d48abc150 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 20 Apr 2021 08:52:59 -0700 Subject: [PATCH 14/81] fix vscode ignore --- .gitignore | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5bee0401f2a1..d3b03d80a9df 100644 --- a/.gitignore +++ b/.gitignore @@ -88,7 +88,8 @@ examples/bin .vs TestResults/* .vscode/* -./**/.vscode/* +**/.vscode/* + # Node # **/node_modules/ @@ -151,7 +152,4 @@ sdk/cosmosdb/cosmos/lib swagger/*.json #autorest artifacts -code-model-* - -# vscode launch.json -**/.vscode/launch.json +code-model-* \ No newline at end of file From b755192c238289da0571bc7ec31e7d6c13edee86 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 20 Apr 2021 08:53:13 -0700 Subject: [PATCH 15/81] multiple --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d3b03d80a9df..7a04207791be 100644 --- a/.gitignore +++ b/.gitignore @@ -89,6 +89,7 @@ examples/bin TestResults/* .vscode/* **/.vscode/* +./**/.vscode/* # Node # From 6e78c4ee1ebde8409b9b0eca68eb1c21300261f7 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 20 Apr 2021 15:46:21 -0700 Subject: [PATCH 16/81] adding api --- common/config/rush/pnpm-lock.yaml | 4684 +++++++++-------- rush.json | 2 +- sdk/iot/modelsrepository/package.json | 13 +- .../review/iot-modelsrepository-client.api.md | 43 + .../samples/typescript/src/example.ts | 5 +- sdk/iot/modelsrepository/src/client.ts | 58 +- 6 files changed, 2689 insertions(+), 2116 deletions(-) create mode 100644 sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 75ef958e6b07..ca78d7bc6611 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1,26 +1,30 @@ dependencies: '@rush-temp/abort-controller': file:projects/abort-controller.tgz '@rush-temp/ai-anomaly-detector': file:projects/ai-anomaly-detector.tgz + '@rush-temp/ai-document-translator': file:projects/ai-document-translator.tgz '@rush-temp/ai-form-recognizer': file:projects/ai-form-recognizer.tgz '@rush-temp/ai-metrics-advisor': file:projects/ai-metrics-advisor.tgz '@rush-temp/ai-text-analytics': file:projects/ai-text-analytics.tgz '@rush-temp/app-configuration': file:projects/app-configuration.tgz '@rush-temp/attestation': file:projects/attestation.tgz - '@rush-temp/communication-administration': file:projects/communication-administration.tgz '@rush-temp/communication-chat': file:projects/communication-chat.tgz '@rush-temp/communication-common': file:projects/communication-common.tgz '@rush-temp/communication-identity': file:projects/communication-identity.tgz + '@rush-temp/communication-phone-numbers': file:projects/communication-phone-numbers.tgz '@rush-temp/communication-sms': file:projects/communication-sms.tgz + '@rush-temp/container-registry': file:projects/container-registry.tgz '@rush-temp/core-amqp': file:projects/core-amqp.tgz '@rush-temp/core-asynciterator-polyfill': file:projects/core-asynciterator-polyfill.tgz '@rush-temp/core-auth': file:projects/core-auth.tgz '@rush-temp/core-client': file:projects/core-client.tgz + '@rush-temp/core-client-1': file:projects/core-client-1.tgz '@rush-temp/core-crypto': file:projects/core-crypto.tgz '@rush-temp/core-http': file:projects/core-http.tgz - '@rush-temp/core-https': file:projects/core-https.tgz '@rush-temp/core-lro': file:projects/core-lro.tgz '@rush-temp/core-paging': file:projects/core-paging.tgz + '@rush-temp/core-rest-pipeline': file:projects/core-rest-pipeline.tgz '@rush-temp/core-tracing': file:projects/core-tracing.tgz + '@rush-temp/core-util': file:projects/core-util.tgz '@rush-temp/core-xml': file:projects/core-xml.tgz '@rush-temp/cosmos': file:projects/cosmos.tgz '@rush-temp/data-tables': file:projects/data-tables.tgz @@ -32,6 +36,7 @@ dependencies: '@rush-temp/eventgrid': file:projects/eventgrid.tgz '@rush-temp/eventhubs-checkpointstore-blob': file:projects/eventhubs-checkpointstore-blob.tgz '@rush-temp/identity': file:projects/identity.tgz + '@rush-temp/iot-device-update': file:projects/iot-device-update.tgz '@rush-temp/iot-modelsrepository-client': file:projects/iot-modelsrepository-client.tgz '@rush-temp/keyvault-admin': file:projects/keyvault-admin.tgz '@rush-temp/keyvault-certificates': file:projects/keyvault-certificates.tgz @@ -39,8 +44,21 @@ dependencies: '@rush-temp/keyvault-keys': file:projects/keyvault-keys.tgz '@rush-temp/keyvault-secrets': file:projects/keyvault-secrets.tgz '@rush-temp/logger': file:projects/logger.tgz + '@rush-temp/mixedreality-authentication': file:projects/mixedreality-authentication.tgz '@rush-temp/mock-hub': file:projects/mock-hub.tgz '@rush-temp/monitor-opentelemetry-exporter': file:projects/monitor-opentelemetry-exporter.tgz + '@rush-temp/perf-ai-form-recognizer': file:projects/perf-ai-form-recognizer.tgz + '@rush-temp/perf-ai-metrics-advisor': file:projects/perf-ai-metrics-advisor.tgz + '@rush-temp/perf-ai-text-analytics': file:projects/perf-ai-text-analytics.tgz + '@rush-temp/perf-eventgrid': file:projects/perf-eventgrid.tgz + '@rush-temp/perf-identity': file:projects/perf-identity.tgz + '@rush-temp/perf-keyvault-certificates': file:projects/perf-keyvault-certificates.tgz + '@rush-temp/perf-keyvault-keys': file:projects/perf-keyvault-keys.tgz + '@rush-temp/perf-keyvault-secrets': file:projects/perf-keyvault-secrets.tgz + '@rush-temp/perf-search-documents': file:projects/perf-search-documents.tgz + '@rush-temp/perf-storage-blob': file:projects/perf-storage-blob.tgz + '@rush-temp/perf-storage-file-datalake': file:projects/perf-storage-file-datalake.tgz + '@rush-temp/perf-storage-file-share': file:projects/perf-storage-file-share.tgz '@rush-temp/quantum-jobs': file:projects/quantum-jobs.tgz '@rush-temp/schema-registry': file:projects/schema-registry.tgz '@rush-temp/schema-registry-avro': file:projects/schema-registry-avro.tgz @@ -61,17 +79,31 @@ dependencies: '@rush-temp/test-utils-multi-version': file:projects/test-utils-multi-version.tgz '@rush-temp/test-utils-perfstress': file:projects/test-utils-perfstress.tgz '@rush-temp/test-utils-recorder': file:projects/test-utils-recorder.tgz - '@rush-temp/testhub': file:projects/testhub.tgz lockfileVersion: 5.2 packages: - /@azure/abort-controller/1.0.2: + /@azure/abort-controller/1.0.4: dependencies: - tslib: 2.1.0 + tslib: 2.2.0 dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-XUyTo+bcyxHEf+jlN2MXA7YU9nxVehaubngHV1MIZZaqYmZqykkoeAz/JMMEeR7t3TcyDwbFa3Zw8BZywmIx4g== + integrity: sha512-lNUmDRVGpanCsiUN3NWxFTdwmdFI53xwhkTFfHDGTYk46ca7Ind3nanJc+U6Zj9Tv+9nTCWRBscWEW1DyKOpTw== + /@azure/ai-metrics-advisor/1.0.0-beta.3: + dependencies: + '@azure/core-auth': 1.3.0 + '@azure/core-http': 1.2.4 + '@azure/core-lro': 1.0.4 + '@azure/core-paging': 1.1.3 + '@azure/core-tracing': 1.0.0-preview.9 + '@azure/logger': 1.0.2 + '@opentelemetry/api': 0.10.2 + tslib: 2.2.0 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-7C1wodDLnLrdS7rmA/UoItoTAtpZdhkEoaxC7+j5l+LlrcWAe7K2JO1y5psVr5Pe8Y6cUGK4KfpgsAQAcSUDEw== /@azure/amqp-common/1.0.0-preview.9: dependencies: '@azure/ms-rest-nodeauth': 0.9.3_debug@3.2.7 @@ -80,7 +112,7 @@ packages: async-lock: 1.2.8 buffer: 5.7.1 debug: 3.2.7 - events: 3.2.0 + events: 3.3.0 is-buffer: 2.0.5 jssha: 2.4.2 process: 0.11.10 @@ -93,68 +125,75 @@ packages: dev: false resolution: integrity: sha512-RVG1Ad3Afv9gwFFmpeCXQAm+Sa0L8KEZRJJAAZEGoYDb6EoO1iQDVmoBz720h8mdrGpi0D60xNU/KhriIwuZfQ== - /@azure/communication-signaling/1.0.0-beta.2: + /@azure/arm-containerregistry/8.0.0: + dependencies: + '@azure/ms-rest-azure-js': 2.1.0 + '@azure/ms-rest-js': 2.3.0 + tslib: 1.14.1 + dev: false + resolution: + integrity: sha512-8v+3YtATbaFv5qMGvhFVR+qx1QPc1+NBy2MWWoJ69SmEE1X91ySvXDbEa0Pr7znm/bqbBYWOLJN5L3Aa7Q0fpg== + /@azure/communication-signaling/1.0.0-beta.3: dependencies: - '@azure/core-http': 1.2.2 + '@azure/core-http': 1.2.4 '@azure/core-tracing': 1.0.0-preview.9 - '@azure/logger': 1.0.1 + '@azure/logger': 1.0.2 '@opentelemetry/api': 0.10.2 - events: 3.2.0 + events: 3.3.0 tslib: 1.14.1 dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-2Nbm6OEtouz94kWiWu40VhG2ckTwAI4Ng7ji77yCha1obrVhzxA1wfveMZmEmXk4s7YGN5L7xAj/hFATe7WknQ== - /@azure/core-asynciterator-polyfill/1.0.0: - dev: false - resolution: - integrity: sha512-kmv8CGrPfN9SwMwrkiBK9VTQYxdFQEGe0BmQk+M8io56P9KNzpAxcWE/1fxJj7uouwN4kXF0BHW8DNlgx+wtCg== - /@azure/core-auth/1.1.4: + integrity: sha512-WargzA8PMc9SEvQpjhM0vVq/HB0wGUScplW8Us9nEFLHy/ZvgVjbRHlCALCa/tlU/Pv3RgZhk7XuPfwip17MCQ== + /@azure/core-amqp/2.2.0: dependencies: - '@azure/abort-controller': 1.0.2 - tslib: 2.1.0 + '@azure/abort-controller': 1.0.4 + '@azure/core-auth': 1.3.0 + '@azure/logger': 1.0.2 + '@types/async-lock': 1.1.2 + async-lock: 1.2.8 + buffer: 5.7.1 + events: 3.3.0 + jssha: 3.2.0 + process: 0.11.10 + rhea: 1.0.24 + rhea-promise: 1.2.1 + tslib: 2.2.0 + url: 0.11.0 + util: 0.12.3 dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-+j1embyH1jqf04AIfJPdLafd5SC1y6z1Jz4i+USR1XkTp6KM8P5u4/AjmWMVoEQdM/M29PJcRDZcCEWjK9S1bw== - /@azure/core-auth/1.3.0: - dependencies: - '@azure/abort-controller': 1.0.2 - tslib: 2.1.0 + integrity: sha512-Nt81a8097+ofBAQfnil5UWw0o5/D3bYfqyJY7e1wrP2RlR/6Fig9zSj4tLe/oiMmE4gvDoK5X8kGIbhswne0Yw== + /@azure/core-asynciterator-polyfill/1.0.0: dev: false - engines: - node: '>=8.0.0' resolution: - integrity: sha512-kSDSZBL6c0CYdhb+7KuutnKGf2geeT+bCJAgccB0DD7wmNJSsQPcF7TcuoZX83B7VK4tLz/u+8sOO/CnCsYp8A== - /@azure/core-client/1.0.0-beta.1: + integrity: sha512-kmv8CGrPfN9SwMwrkiBK9VTQYxdFQEGe0BmQk+M8io56P9KNzpAxcWE/1fxJj7uouwN4kXF0BHW8DNlgx+wtCg== + /@azure/core-auth/1.3.0: dependencies: - '@azure/abort-controller': 1.0.2 - '@azure/core-auth': 1.1.4 - '@azure/core-https': 1.0.0-beta.1 - '@azure/core-tracing': 1.0.0-preview.9 - '@opentelemetry/api': 0.10.2 - tslib: 2.1.0 + '@azure/abort-controller': 1.0.4 + tslib: 2.2.0 dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-RGCqdHGtYepkfD5EG5DtgBpCcF4D/ZEfL7CaHfgFYsumCh0/xb0/bbe1g5LBKNPSnDBbrk8KJRzi+5rvGYdUPw== - /@azure/core-http/1.2.2: + integrity: sha512-kSDSZBL6c0CYdhb+7KuutnKGf2geeT+bCJAgccB0DD7wmNJSsQPcF7TcuoZX83B7VK4tLz/u+8sOO/CnCsYp8A== + /@azure/core-http/1.2.4: dependencies: - '@azure/abort-controller': 1.0.2 + '@azure/abort-controller': 1.0.4 + '@azure/core-asynciterator-polyfill': 1.0.0 '@azure/core-auth': 1.3.0 - '@azure/core-tracing': 1.0.0-preview.9 - '@azure/logger': 1.0.1 - '@opentelemetry/api': 0.10.2 - '@types/node-fetch': 2.5.8 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/logger': 1.0.2 + '@types/node-fetch': 2.5.10 '@types/tunnel': 0.0.1 - form-data: 3.0.0 + form-data: 3.0.1 node-fetch: 2.6.1 process: 0.11.10 tough-cookie: 4.0.0 - tslib: 2.1.0 + tslib: 2.2.0 tunnel: 0.0.6 uuid: 8.3.2 xml2js: 0.4.23 @@ -162,34 +201,19 @@ packages: engines: node: '>=8.0.0' resolution: - integrity: sha512-9eu2OcbR7e44gqBy4U1Uv8NTWgLIMwKXMEGgO2MahsJy5rdTiAhs5fJHQffPq8uX2MFh21iBODwO9R/Xlov88A== - /@azure/core-https/1.0.0-beta.1: - dependencies: - '@azure/abort-controller': 1.0.2 - '@azure/core-auth': 1.3.0 - '@azure/core-tracing': 1.0.0-preview.9 - '@azure/logger': 1.0.1 - '@opentelemetry/api': 0.10.2 - form-data: 3.0.0 - https-proxy-agent: 5.0.0 - tslib: 2.1.0 - uuid: 8.3.2 - dev: false - engines: - node: '>=8.0.0' - resolution: - integrity: sha512-LN1z3/6VeBdebO4vn251wz/gmWXZVw3DAjFz340ft+mWAj+NA/c5JaqJw+Dt9CCpm6i/1IvsUkNo3IvxZnVOiA== - /@azure/core-lro/1.0.3: + integrity: sha512-cNumz3ckyFZY5zWOgcTHSO7AKRVwxbodG8WfcEGcdH+ZJL3KvJEI/vN58H6xk5v3ijulU2x/WPGJqrMVvcI79A== + /@azure/core-lro/1.0.4: dependencies: - '@azure/abort-controller': 1.0.2 - '@azure/core-http': 1.2.2 - events: 3.2.0 - tslib: 2.1.0 + '@azure/abort-controller': 1.0.4 + '@azure/core-http': 1.2.4 + '@azure/core-tracing': 1.0.0-preview.11 + events: 3.3.0 + tslib: 2.2.0 dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-Py2crJ84qx1rXkzIwfKw5Ni4WJuzVU7KAF6i1yP3ce8fbynUeu8eEWS4JGtSQgU7xv02G55iPDROifmSDbxeHA== + integrity: sha512-4IVqLl6NIqxVzL+zMdf9Nwa1ZUPuoG/IAMoWQIA6qgpKuAiPy/KiH4Q5j0Zn0q20GFiymQeLcCIH82LSlbQBTQ== /@azure/core-paging/1.1.3: dependencies: '@azure/core-asynciterator-polyfill': 1.0.0 @@ -198,38 +222,21 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-his7Ah40ThEYORSpIAwuh6B8wkGwO/zG7gqVtmSE4WAJ46e36zUDXTKReUCLBDc6HmjjApQQxxcRFy5FruG79A== - /@azure/core-rest-pipeline/1.0.2: - dependencies: - '@azure/abort-controller': 1.0.2 - '@azure/core-auth': 1.3.0 - '@azure/core-tracing': 1.0.0-preview.10 - '@azure/logger': 1.0.1 - '@opentelemetry/api': 0.10.2 - form-data: 3.0.0 - http-proxy-agent: 4.0.1 - https-proxy-agent: 5.0.0 - tslib: 2.1.0 - uuid: 8.3.2 - dev: false - engines: - node: '>=8.0.0' - resolution: - integrity: sha512-3raRQBhdr7gjJlHPkYQGWIbhskthQAA+452oIG4wrdsrEPUQhmXrIhE6tGOTe9bWWJyFZgo6aszQg6l3ABphCQ== - /@azure/core-tracing/1.0.0-preview.10: + /@azure/core-tracing/1.0.0-preview.11: dependencies: '@opencensus/web-types': 0.0.7 - '@opentelemetry/api': 0.10.2 - tslib: 2.1.0 + '@opentelemetry/api': 1.0.0-rc.0 + tslib: 2.2.0 dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-iIwjtMwQnsxB7cYkugMx+s4W1nfy3+pT/ceo+uW1fv4YDgYe84nh+QP0fEC9IH/3UATLSWbIBemdMHzk2APUrw== + integrity: sha512-frF0pJc9HTmKncVokhBxCqipjbql02DThQ1ZJ9wLi7SDMLdPAFyDI5xZNzX5guLz+/DtPkY+SGK2li9FIXqshQ== /@azure/core-tracing/1.0.0-preview.9: dependencies: '@opencensus/web-types': 0.0.7 '@opentelemetry/api': 0.10.2 - tslib: 2.1.0 + tslib: 2.2.0 dev: false engines: node: '>=8.0.0' @@ -237,7 +244,7 @@ packages: integrity: sha512-zczolCLJ5QG42AEPQ+Qg9SRYNUyB+yZ5dzof4YEc+dyWczO9G2sBqbAjLB7IqrsdHN2apkiB2oXeDKCsq48jug== /@azure/core-xml/1.0.0-beta.1: dependencies: - tslib: 2.1.0 + tslib: 2.2.0 xml2js: 0.4.23 dev: false engines: @@ -258,27 +265,87 @@ packages: dev: false resolution: integrity: sha512-CxaMaEjwtsmIhWtjHyGimKO7RmES0YxPqGQ9+jKqGygNlhG5NYHktDaiQu6w7k3g+I51VaLXtVSt+BVFd6VWfQ== + /@azure/identity/1.3.0: + dependencies: + '@azure/core-http': 1.2.4 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/logger': 1.0.2 + '@azure/msal-node': 1.0.0-beta.6 + '@types/stoppable': 1.1.0 + axios: 0.21.1 + events: 3.3.0 + jws: 4.0.0 + msal: 1.4.9 + open: 7.4.2 + qs: 6.10.1 + stoppable: 1.1.0 + tslib: 2.2.0 + uuid: 8.3.2 + dev: false + engines: + node: '>=8.0.0' + optionalDependencies: + keytar: 7.6.0 + resolution: + integrity: sha512-qYTaWA+5ir4+/iEry7n3l1TyeNhTHP8IRpjsbNv8ur8W/QjqZmCz1H2naebRp5tQmehXfo1pUrp2ew+qGhTh0g== + /@azure/identity/1.3.0_debug@4.3.1: + dependencies: + '@azure/core-http': 1.2.4 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/logger': 1.0.2 + '@azure/msal-node': 1.0.0-beta.6_debug@4.3.1 + '@types/stoppable': 1.1.0 + axios: 0.21.1_debug@4.3.1 + events: 3.3.0 + jws: 4.0.0 + msal: 1.4.9 + open: 7.4.2 + qs: 6.10.1 + stoppable: 1.1.0 + tslib: 2.2.0 + uuid: 8.3.2 + dev: false + engines: + node: '>=8.0.0' + optionalDependencies: + keytar: 7.6.0 + peerDependencies: + debug: '*' + resolution: + integrity: sha512-qYTaWA+5ir4+/iEry7n3l1TyeNhTHP8IRpjsbNv8ur8W/QjqZmCz1H2naebRp5tQmehXfo1pUrp2ew+qGhTh0g== /@azure/logger-js/1.3.2: dependencies: tslib: 1.14.1 dev: false resolution: integrity: sha512-h58oEROO2tniBTSmFmuHBGvuiFuYsHQBWTVdpT2AiOED4F2Kgf7rs0MPYPXiBcDvihC70M7QPRhIQ3JK1H/ygw== - /@azure/logger/1.0.1: + /@azure/logger/1.0.2: dependencies: - tslib: 2.1.0 + tslib: 2.2.0 dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-QYQeaJ+A5x6aMNu8BG5qdsVBnYBop9UMwgUvGihSjf1PdZZXB+c/oMdM2ajKwzobLBh9e9QuMQkN9iL+IxLBLA== + integrity: sha512-YZNjNV0vL3nN2nedmcjQBcpCTo3oqceXmgiQtEm6fLpucjRZyQKAQruhCmCpRlB1iykqKJJ/Y8CDmT5rIE6IJw== /@azure/ms-rest-azure-env/1.1.2: dev: false resolution: integrity: sha512-l7z0DPCi2Hp88w12JhDTtx5d0Y3+vhfE7JKJb9O7sEz71Cwp053N8piTtTnnk/tUor9oZHgEKi/p3tQQmLPjvA== - /@azure/ms-rest-js/1.10.0_debug@3.2.7: + /@azure/ms-rest-azure-env/2.0.0: + dev: false + resolution: + integrity: sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw== + /@azure/ms-rest-azure-js/2.1.0: + dependencies: + '@azure/core-auth': 1.3.0 + '@azure/ms-rest-js': 2.3.0 + tslib: 1.14.1 + dev: false + resolution: + integrity: sha512-CjZjB8apvXl5h97Ck6SbeeCmU0sk56YPozPtTyGudPp1RGoHXNjFNtoOvwOG76EdpmMpxbK10DqcygI16Lu60Q== + /@azure/ms-rest-js/1.11.2_debug@3.2.7: dependencies: - '@types/tunnel': 0.0.0 + '@azure/core-auth': 1.3.0 axios: 0.21.1_debug@3.2.7 form-data: 2.5.1 tough-cookie: 2.5.0 @@ -290,10 +357,10 @@ packages: peerDependencies: debug: '*' resolution: - integrity: sha512-04wejNh2Y9JveoGcFUlQDIAuBvTsUP0fchqm/bppTlCPr9YXA+/nsBlVOC5zR+VdoQiiJytUS7D2DTQLNdddLA== - /@azure/ms-rest-js/1.10.0_debug@4.3.1: + integrity: sha512-2AyQ1IKmLGKW7DU3/x3TsTBzZLcbC9YRI+yuDPuXAQrv3zar340K9wsxU413kHFIDjkWNCo9T0w5VtwcyWxhbQ== + /@azure/ms-rest-js/1.11.2_debug@4.3.1: dependencies: - '@types/tunnel': 0.0.0 + '@azure/core-auth': 1.3.0 axios: 0.21.1_debug@4.3.1 form-data: 2.5.1 tough-cookie: 2.5.0 @@ -305,11 +372,25 @@ packages: peerDependencies: debug: '*' resolution: - integrity: sha512-04wejNh2Y9JveoGcFUlQDIAuBvTsUP0fchqm/bppTlCPr9YXA+/nsBlVOC5zR+VdoQiiJytUS7D2DTQLNdddLA== + integrity: sha512-2AyQ1IKmLGKW7DU3/x3TsTBzZLcbC9YRI+yuDPuXAQrv3zar340K9wsxU413kHFIDjkWNCo9T0w5VtwcyWxhbQ== + /@azure/ms-rest-js/2.3.0: + dependencies: + '@azure/core-auth': 1.3.0 + abort-controller: 3.0.0 + form-data: 2.5.1 + node-fetch: 2.6.1 + tough-cookie: 3.0.1 + tslib: 1.14.1 + tunnel: 0.0.6 + uuid: 3.4.0 + xml2js: 0.4.23 + dev: false + resolution: + integrity: sha512-8NOnHgovi61NpcUld53zRkY/IcQJBBO48VeMntNTUtaPo8yYYTnu1hWRvp6b6vpBnur7HGmuj692J9li5Kx6/Q== /@azure/ms-rest-nodeauth/0.9.3_debug@3.2.7: dependencies: '@azure/ms-rest-azure-env': 1.1.2 - '@azure/ms-rest-js': 1.10.0_debug@3.2.7 + '@azure/ms-rest-js': 1.11.2_debug@3.2.7 adal-node: 0.1.28 dev: false peerDependencies: @@ -319,146 +400,229 @@ packages: /@azure/ms-rest-nodeauth/0.9.3_debug@4.3.1: dependencies: '@azure/ms-rest-azure-env': 1.1.2 - '@azure/ms-rest-js': 1.10.0_debug@4.3.1 + '@azure/ms-rest-js': 1.11.2_debug@4.3.1 adal-node: 0.1.28 dev: false peerDependencies: debug: '*' resolution: integrity: sha512-aFHRw/IHhg3I9ZJW+Va4L+sCirFHMVIu6B7lFdL5mGLfG3xC5vDIdd957LRXFgy2OiKFRUC0QaKknd0YCsQIqA== - /@azure/msal-common/4.0.0: + /@azure/ms-rest-nodeauth/3.0.9: + dependencies: + '@azure/ms-rest-azure-env': 2.0.0 + '@azure/ms-rest-js': 2.3.0 + adal-node: 0.1.28 + dev: false + resolution: + integrity: sha512-+GdDHUJlWtIDanRZemFooLy68NsBDhN/Oni9DSFeoXIFNGlSe1IOes8/IRkQdrNXyUvBanuzzR7I5WYYzYQsmA== + /@azure/msal-browser/2.9.0: + dependencies: + '@azure/msal-common': 2.1.0 + dev: false + engines: + node: '>=0.8.0' + resolution: + integrity: sha512-Zyus+skNaVWL5fXfSjC17c94XZ95Z3a+bZc7YKkP26KT3Dj26jbfz2oT9KJxAT4XVtH/1WPY/fPFeEFTRvytJQ== + /@azure/msal-common/2.1.0: dependencies: debug: 4.3.1 dev: false engines: node: '>=0.8.0' resolution: - integrity: sha512-aGIUZgaIyb48m9353oepMsoy8tAan4BM6MvQ9FFybRJdMtTlHkXo7BfGcygVSFJlB2AGnW7HhCKAwCKNEpjzeQ== + integrity: sha512-Y1Id+jG59S3eY2ZQQtUA/lxwbRcgjcWaiib9YX+SwV3zeRauKfEiZT7l3z+lwV+T+Sst20F6l1mJsfQcfE7CEQ== + /@azure/msal-common/4.0.3: + dependencies: + debug: 4.3.1 + dev: false + engines: + node: '>=0.8.0' + resolution: + integrity: sha512-EihnqHh2EE6xcB0Dh2LF30jE1Ga9cgh9PyRkX4fj+KpvYfL4ae57hvQwJGkynUgpf3V1xQxU5yaJVXOElfXiGw== + /@azure/msal-common/4.2.0: + dependencies: + debug: 4.3.1 + dev: false + engines: + node: '>=0.8.0' + resolution: + integrity: sha512-dOImswKoo0E0t/j6ePcWYBZ2oPrt9I7LeuXfW9zxbPBRwfqpd0MBHjTXkCFZinn0xW8UbzCnWT7DxP/4UsOQLA== /@azure/msal-node/1.0.0-beta.6: dependencies: - '@azure/msal-common': 4.0.0 + '@azure/msal-common': 4.2.0 axios: 0.21.1 jsonwebtoken: 8.5.1 uuid: 8.3.2 dev: false resolution: integrity: sha512-ZQI11Uz1j0HJohb9JZLRD8z0moVcPks1AFW4Q/Gcl67+QvH4aKEJti7fjCcipEEZYb/qzLSO8U6IZgPYytsiJQ== - /@azure/storage-blob/12.4.1: + /@azure/msal-node/1.0.0-beta.6_debug@4.3.1: + dependencies: + '@azure/msal-common': 4.2.0 + axios: 0.21.1_debug@4.3.1 + jsonwebtoken: 8.5.1 + uuid: 8.3.2 + dev: false + peerDependencies: + debug: '*' + resolution: + integrity: sha512-ZQI11Uz1j0HJohb9JZLRD8z0moVcPks1AFW4Q/Gcl67+QvH4aKEJti7fjCcipEEZYb/qzLSO8U6IZgPYytsiJQ== + /@azure/msal-node/1.0.2: + dependencies: + '@azure/msal-common': 4.2.0 + axios: 0.21.1 + jsonwebtoken: 8.5.1 + uuid: 8.3.2 + dev: false + engines: + node: 10 || 12 || 14 + resolution: + integrity: sha512-ZOHmoImpePXWTUS+78jzMgbhyTzeW0ydI3dJ9DupZZBxImV+Bqz5wfth0yKdNGV65rKWYuUIQtBVjnGwSqmpTQ== + /@azure/service-bus/7.0.5: dependencies: - '@azure/abort-controller': 1.0.2 - '@azure/core-http': 1.2.2 - '@azure/core-lro': 1.0.3 + '@azure/abort-controller': 1.0.4 + '@azure/core-amqp': 2.2.0 + '@azure/core-asynciterator-polyfill': 1.0.0 + '@azure/core-auth': 1.3.0 + '@azure/core-http': 1.2.4 '@azure/core-paging': 1.1.3 - '@azure/core-tracing': 1.0.0-preview.9 - '@azure/logger': 1.0.1 - '@opentelemetry/api': 0.10.2 - events: 3.2.0 - tslib: 2.1.0 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/logger': 1.0.2 + '@types/is-buffer': 2.0.0 + '@types/long': 4.0.1 + buffer: 5.7.1 + is-buffer: 2.0.5 + jssha: 3.2.0 + long: 4.0.0 + process: 0.11.10 + rhea-promise: 1.2.1 + tslib: 2.2.0 dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-RH6ru8LbnCC+m1rlVLon6mYUXdHsTcyUXFCJAWRQQM7p0XOwVKPS+UiVk2tZXfvMWd3q/qT/meOrEbHEcp/c4g== + integrity: sha512-x3VgZFLsmhnTka6IpKePHcibm3znMhcrSsVoVlMOCQSgoJrTSTuczRh4S9/c55pj8M+EQ6FdPweQY6Ld+g/qiQ== + /@babel/code-frame/7.12.11: + dependencies: + '@babel/highlight': 7.13.10 + dev: false + resolution: + integrity: sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== /@babel/code-frame/7.12.13: dependencies: - '@babel/highlight': 7.12.13 + '@babel/highlight': 7.13.10 dev: false resolution: integrity: sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g== - /@babel/core/7.12.13: + /@babel/compat-data/7.13.12: + dev: false + resolution: + integrity: sha512-3eJJ841uKxeV8dcN/2yGEUy+RfgQspPEgQat85umsE1rotuquQ2AbIub4S6j7c50a2d+4myc+zSlnXeIHrOnhQ== + /@babel/core/7.13.14: dependencies: '@babel/code-frame': 7.12.13 - '@babel/generator': 7.12.13 - '@babel/helper-module-transforms': 7.12.13 - '@babel/helpers': 7.12.13 - '@babel/parser': 7.12.14 + '@babel/generator': 7.13.9 + '@babel/helper-compilation-targets': 7.13.13_@babel+core@7.13.14 + '@babel/helper-module-transforms': 7.13.14 + '@babel/helpers': 7.13.10 + '@babel/parser': 7.13.13 '@babel/template': 7.12.13 - '@babel/traverse': 7.12.13 - '@babel/types': 7.12.13 + '@babel/traverse': 7.13.13 + '@babel/types': 7.13.14 convert-source-map: 1.7.0 debug: 4.3.1 gensync: 1.0.0-beta.2 json5: 2.2.0 - lodash: 4.17.20 - semver: 5.7.1 + semver: 6.3.0 source-map: 0.5.7 dev: false engines: node: '>=6.9.0' resolution: - integrity: sha512-BQKE9kXkPlXHPeqissfxo0lySWJcYdEP0hdtJOH/iJfDdhOCcgtNCjftCJg3qqauB4h+lz2N6ixM++b9DN1Tcw== - /@babel/generator/7.12.13: + integrity: sha512-wZso/vyF4ki0l0znlgM4inxbdrUvCb+cVz8grxDq+6C9k6qbqoIJteQOKicaKjCipU3ISV+XedCqpL2RJJVehA== + /@babel/generator/7.13.9: dependencies: - '@babel/types': 7.12.13 + '@babel/types': 7.13.14 jsesc: 2.5.2 source-map: 0.5.7 dev: false resolution: - integrity: sha512-9qQ8Fgo8HaSvHEt6A5+BATP7XktD/AdAnObUeTRz5/e2y3kbrxZgz32qUJJsdmwUvBJzF4AeV21nGTNwv05Mpw== + integrity: sha512-mHOOmY0Axl/JCTkxTU6Lf5sWOg/v8nUa+Xkt4zMTftX0wqmb6Sh7J8gvcehBw7q0AhrhAR+FDacKjCZ2X8K+Sw== + /@babel/helper-compilation-targets/7.13.13_@babel+core@7.13.14: + dependencies: + '@babel/compat-data': 7.13.12 + '@babel/core': 7.13.14 + '@babel/helper-validator-option': 7.12.17 + browserslist: 4.16.3 + semver: 6.3.0 + dev: false + peerDependencies: + '@babel/core': ^7.0.0 + resolution: + integrity: sha512-q1kcdHNZehBwD9jYPh3WyXcsFERi39X4I59I3NadciWtNDyZ6x+GboOxncFK0kXlKIv6BJm5acncehXWUjWQMQ== /@babel/helper-function-name/7.12.13: dependencies: '@babel/helper-get-function-arity': 7.12.13 '@babel/template': 7.12.13 - '@babel/types': 7.12.13 + '@babel/types': 7.13.14 dev: false resolution: integrity: sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA== /@babel/helper-get-function-arity/7.12.13: dependencies: - '@babel/types': 7.12.13 + '@babel/types': 7.13.14 dev: false resolution: integrity: sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg== - /@babel/helper-member-expression-to-functions/7.12.13: + /@babel/helper-member-expression-to-functions/7.13.12: dependencies: - '@babel/types': 7.12.13 + '@babel/types': 7.13.14 dev: false resolution: - integrity: sha512-B+7nN0gIL8FZ8SvMcF+EPyB21KnCcZHQZFczCxbiNGV/O0rsrSBlWGLzmtBJ3GMjSVMIm4lpFhR+VdVBuIsUcQ== - /@babel/helper-module-imports/7.12.13: + integrity: sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw== + /@babel/helper-module-imports/7.13.12: dependencies: - '@babel/types': 7.12.13 + '@babel/types': 7.13.14 dev: false resolution: - integrity: sha512-NGmfvRp9Rqxy0uHSSVP+SRIW1q31a7Ji10cLBcqSDUngGentY4FRiHOFZFE1CLU5eiL0oE8reH7Tg1y99TDM/g== - /@babel/helper-module-transforms/7.12.13: + integrity: sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA== + /@babel/helper-module-transforms/7.13.14: dependencies: - '@babel/helper-module-imports': 7.12.13 - '@babel/helper-replace-supers': 7.12.13 - '@babel/helper-simple-access': 7.12.13 + '@babel/helper-module-imports': 7.13.12 + '@babel/helper-replace-supers': 7.13.12 + '@babel/helper-simple-access': 7.13.12 '@babel/helper-split-export-declaration': 7.12.13 '@babel/helper-validator-identifier': 7.12.11 '@babel/template': 7.12.13 - '@babel/traverse': 7.12.13 - '@babel/types': 7.12.13 - lodash: 4.17.20 + '@babel/traverse': 7.13.13 + '@babel/types': 7.13.14 dev: false resolution: - integrity: sha512-acKF7EjqOR67ASIlDTupwkKM1eUisNAjaSduo5Cz+793ikfnpe7p4Q7B7EWU2PCoSTPWsQkR7hRUWEIZPiVLGA== + integrity: sha512-QuU/OJ0iAOSIatyVZmfqB0lbkVP0kDRiKj34xy+QNsnVZi/PA6BoSoreeqnxxa9EHFAIL0R9XOaAR/G9WlIy5g== /@babel/helper-optimise-call-expression/7.12.13: dependencies: - '@babel/types': 7.12.13 + '@babel/types': 7.13.14 dev: false resolution: integrity: sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA== - /@babel/helper-replace-supers/7.12.13: + /@babel/helper-replace-supers/7.13.12: dependencies: - '@babel/helper-member-expression-to-functions': 7.12.13 + '@babel/helper-member-expression-to-functions': 7.13.12 '@babel/helper-optimise-call-expression': 7.12.13 - '@babel/traverse': 7.12.13 - '@babel/types': 7.12.13 + '@babel/traverse': 7.13.13 + '@babel/types': 7.13.14 dev: false resolution: - integrity: sha512-pctAOIAMVStI2TMLhozPKbf5yTEXc0OJa0eENheb4w09SrgOWEs+P4nTOZYJQCqs8JlErGLDPDJTiGIp3ygbLg== - /@babel/helper-simple-access/7.12.13: + integrity: sha512-Gz1eiX+4yDO8mT+heB94aLVNCL+rbuT2xy4YfyNqu8F+OI6vMvJK891qGBTqL9Uc8wxEvRW92Id6G7sDen3fFw== + /@babel/helper-simple-access/7.13.12: dependencies: - '@babel/types': 7.12.13 + '@babel/types': 7.13.14 dev: false resolution: - integrity: sha512-0ski5dyYIHEfwpWGx5GPWhH35j342JaflmCeQmsPWcrOQDtCN6C1zKAVRFVbK53lPW2c9TsuLLSUDf0tIGJ5hA== + integrity: sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA== /@babel/helper-split-export-declaration/7.12.13: dependencies: - '@babel/types': 7.12.13 + '@babel/types': 7.13.14 dev: false resolution: integrity: sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg== @@ -466,65 +630,68 @@ packages: dev: false resolution: integrity: sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== - /@babel/helpers/7.12.13: + /@babel/helper-validator-option/7.12.17: + dev: false + resolution: + integrity: sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw== + /@babel/helpers/7.13.10: dependencies: '@babel/template': 7.12.13 - '@babel/traverse': 7.12.13 - '@babel/types': 7.12.13 + '@babel/traverse': 7.13.13 + '@babel/types': 7.13.14 dev: false resolution: - integrity: sha512-oohVzLRZ3GQEk4Cjhfs9YkJA4TdIDTObdBEZGrd6F/T0GPSnuV6l22eMcxlvcvzVIPH3VTtxbseudM1zIE+rPQ== - /@babel/highlight/7.12.13: + integrity: sha512-4VO883+MWPDUVRF3PhiLBUFHoX/bsLTGFpFK/HqvvfBZz2D57u9XzPVNFVBTc0PW/CWR9BXTOKt8NF4DInUHcQ== + /@babel/highlight/7.13.10: dependencies: '@babel/helper-validator-identifier': 7.12.11 chalk: 2.4.2 js-tokens: 4.0.0 dev: false resolution: - integrity: sha512-kocDQvIbgMKlWxXe9fof3TQ+gkIPOUSEYhJjqUjvKMez3krV7vbzYCDq39Oj11UAVK7JqPVGQPlgE85dPNlQww== - /@babel/parser/7.12.14: + integrity: sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg== + /@babel/parser/7.13.13: dev: false engines: node: '>=6.0.0' hasBin: true resolution: - integrity: sha512-xcfxDq3OrBnDsA/Z8eK5/2iPcLD8qbOaSSfOw4RA6jp4i7e6dEQ7+wTwxItEwzcXPQcsry5nZk96gmVPKletjQ== - /@babel/runtime/7.12.13: + integrity: sha512-OhsyMrqygfk5v8HmWwOzlYjJrtLaFhF34MrfG/Z73DgYCI6ojNUTUp2TYbtnjo8PegeJp12eamsNettCQjKjVw== + /@babel/runtime/7.13.10: dependencies: regenerator-runtime: 0.13.7 dev: false resolution: - integrity: sha512-8+3UMPBrjFa/6TtKi/7sehPKqfAm4g6K+YQjyyFOLUTxzOngcRZTlAVY8sc2CORJYqdHQY8gRPHmn+qo15rCBw== + integrity: sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw== /@babel/template/7.12.13: dependencies: '@babel/code-frame': 7.12.13 - '@babel/parser': 7.12.14 - '@babel/types': 7.12.13 + '@babel/parser': 7.13.13 + '@babel/types': 7.13.14 dev: false resolution: integrity: sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA== - /@babel/traverse/7.12.13: + /@babel/traverse/7.13.13: dependencies: '@babel/code-frame': 7.12.13 - '@babel/generator': 7.12.13 + '@babel/generator': 7.13.9 '@babel/helper-function-name': 7.12.13 '@babel/helper-split-export-declaration': 7.12.13 - '@babel/parser': 7.12.14 - '@babel/types': 7.12.13 + '@babel/parser': 7.13.13 + '@babel/types': 7.13.14 debug: 4.3.1 globals: 11.12.0 - lodash: 4.17.20 dev: false resolution: - integrity: sha512-3Zb4w7eE/OslI0fTp8c7b286/cQps3+vdLW3UcwC8VSJC6GbKn55aeVVu2QJNuCDoeKyptLOFrPq8WqZZBodyA== - /@babel/types/7.12.13: + integrity: sha512-CblEcwmXKR6eP43oQGG++0QMTtCjAsa3frUuzHoiIJWpaIIi8dwMyEFUJoXRLxagGqCK+jALRwIO+o3R9p/uUg== + /@babel/types/7.13.14: dependencies: '@babel/helper-validator-identifier': 7.12.11 - lodash: 4.17.20 + lodash: 4.17.21 to-fast-properties: 2.0.0 dev: false resolution: - integrity: sha512-oKrdZTld2im1z8bDwTOQvUbxKwE+854zc16qWZQlcTqMN00pWxHQ4ZeOq0yDMnisOpRykH2/5Qqcrk/OlbAjiQ== + integrity: sha512-A2aa3QTkWoyqsZZFl56MLUsfmh7O0gN41IPvXAE/++8ojpbz12SszD7JEGYVdn4f9Kt4amIei07swF1h4AqmmQ== /@bahmutov/data-driven/1.0.0: dependencies: check-more-types: 2.24.0 @@ -534,7 +701,7 @@ packages: node: '>=6' resolution: integrity: sha512-YqW3hPS0RXriqjcCrLOTJj+LWe3c8JpwlL83k1ka1Q8U05ZjAKbGQZYeTzUd0NFEnnfPtsUiKGpFEBJG6kFuvg== - /@eslint/eslintrc/0.3.0: + /@eslint/eslintrc/0.4.0: dependencies: ajv: 6.12.6 debug: 4.3.1 @@ -543,33 +710,26 @@ packages: ignore: 4.0.6 import-fresh: 3.3.0 js-yaml: 3.14.1 - lodash: 4.17.20 minimatch: 3.0.4 strip-json-comments: 3.1.1 dev: false engines: node: ^10.12.0 || >=12.0.0 resolution: - integrity: sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg== - /@istanbuljs/schema/0.1.2: + integrity: sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog== + /@istanbuljs/schema/0.1.3: dev: false engines: node: '>=8' resolution: - integrity: sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== - /@microsoft/api-documenter/7.8.56: + integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== + /@microsoft/api-extractor-model/7.12.2: dependencies: - '@microsoft/api-extractor-model': 7.9.7 - '@microsoft/tsdoc': 0.12.19 - '@rushstack/node-core-library': 3.33.6 - '@rushstack/ts-command-line': 4.6.10 - colors: 1.2.5 - js-yaml: 3.13.1 - resolve: 1.17.0 + '@microsoft/tsdoc': 0.12.24 + '@rushstack/node-core-library': 3.36.0 dev: false - hasBin: true resolution: - integrity: sha512-nf2hRScOib5O6kAi+gbnixWdmrpcpNxaiyzGh3P+hts6BpW1F2dgRSFpLT6cMZlCNjw6NrHA58XaLqc36QUltg== + integrity: sha512-EU+U09Mj65zUH0qwPF4PFJiL6Y+PQQE/RRGEHEDGJJzab/mRQDpKOyrzSdb00xvcd/URehIHJqC55cY2Y4jGOA== /@microsoft/api-extractor-model/7.7.10: dependencies: '@microsoft/tsdoc': 0.12.19 @@ -577,13 +737,23 @@ packages: dev: false resolution: integrity: sha512-gMFDXwUgoQYz9TgatyNPALDdZN4xBC3Un3fGwlzME+vM13PoJ26pGuqI7kv/OlK9+q2sgrEdxWns8D3UnLf2TA== - /@microsoft/api-extractor-model/7.9.7: + /@microsoft/api-extractor/7.13.2: dependencies: - '@microsoft/tsdoc': 0.12.19 - '@rushstack/node-core-library': 3.33.6 + '@microsoft/api-extractor-model': 7.12.2 + '@microsoft/tsdoc': 0.12.24 + '@rushstack/node-core-library': 3.36.0 + '@rushstack/rig-package': 0.2.10 + '@rushstack/ts-command-line': 4.7.8 + colors: 1.2.5 + lodash: 4.17.21 + resolve: 1.17.0 + semver: 7.3.5 + source-map: 0.6.1 + typescript: 4.1.5 dev: false + hasBin: true resolution: - integrity: sha512-9ztrVtUYsnpUC6S+0PR72h7CGvzAX6ljdo6FOzq+jVte743Nb9TMdV97fnJO/n8XRSGUOAKsApgED0GgAek4jw== + integrity: sha512-2fD0c8OxZW+e6NTaxbtrdNxXVuX7aqil3+cqig3pKsHymvUuRJVCEAcAJmZrJ/ENqYXNiB265EyqOT6VxbMysw== /@microsoft/api-extractor/7.7.11: dependencies: '@microsoft/api-extractor-model': 7.7.10 @@ -591,10 +761,10 @@ packages: '@rushstack/node-core-library': 3.19.6 '@rushstack/ts-command-line': 4.3.13 colors: 1.2.5 - lodash: 4.17.20 + lodash: 4.17.21 resolve: 1.8.1 source-map: 0.6.1 - typescript: 3.7.5 + typescript: 3.7.7 dev: false hasBin: true resolution: @@ -612,6 +782,10 @@ packages: dev: false resolution: integrity: sha512-IpgPxHrNxZiMNUSXqR1l/gePKPkfAmIKoDRP9hp7OwjU29ZR8WCJsOJ8iBKgw0Qk+pFwR+8Y1cy8ImLY6e9m4A== + /@microsoft/tsdoc/0.12.24: + dev: false + resolution: + integrity: sha512-Mfmij13RUTmHEMi9vRUhMXD7rnGR2VvxeNYtaGtaJ4redwwjT4UXYJ+nzmVJF7hhd4pn/Fx5sncDKxMVFJSWPg== /@microsoft/tsdoc/0.13.0: dev: false resolution: @@ -619,7 +793,7 @@ packages: /@nodelib/fs.scandir/2.1.4: dependencies: '@nodelib/fs.stat': 2.0.4 - run-parallel: 1.1.10 + run-parallel: 1.2.0 dev: false engines: node: '>= 8' @@ -634,7 +808,7 @@ packages: /@nodelib/fs.walk/1.2.6: dependencies: '@nodelib/fs.scandir': 2.1.4 - fastq: 1.10.1 + fastq: 1.11.0 dev: false engines: node: '>= 8' @@ -654,71 +828,67 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-GtpMGd6vkzDMYcpu2t9LlhEgMy/SzBwRnz48EejlRArYqZzqSzAsKmegUK7zHgl+EOIaK9mKHhnRaQu3qw20cA== - /@opentelemetry/api/0.16.0: - dependencies: - '@opentelemetry/context-base': 0.16.0 + /@opentelemetry/api/0.18.1: dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-y5mNFAiktm7Zyf0GrQ6kjsRqace/WCXk9gMo/sOOna4TtMW8NaZgJceKrsQZl3qiPY9Upu8O9VvdlETXDx4U5A== - /@opentelemetry/context-base/0.10.2: + integrity: sha512-pKNxHe3AJ5T2N5G3AlT9gx6FyF5K2FS9ZNc+FipC+f1CpVF/EY+JHTJ749dnM2kWIgZTbDJFiGMuc0FYjNSCOg== + /@opentelemetry/api/1.0.0-rc.0: dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-hZNKjKOYsckoOEgBziGMnBcX0M7EtstnCmwz5jZUOUYwlZ+/xxX6z3jPu1XVO2Jivk0eLfuP9GP+vFD49CMetw== - /@opentelemetry/context-base/0.16.0: + integrity: sha512-iXKByCMfrlO5S6Oh97BuM56tM2cIBB0XsL/vWF/AtJrJEKx4MC/Xdu0xDsGXMGcNWpqF7ujMsjjnp0+UHBwnDQ== + /@opentelemetry/context-base/0.10.2: dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-2h2s+3P40wIu8ZaJiqBF6E0rEJPeSVOErFlkx2MfRGPs9Vs9Th+i5YSpgvCW4s5LeYTFAf2BRwut39JivEyH9w== - /@opentelemetry/core/0.16.0: + integrity: sha512-hZNKjKOYsckoOEgBziGMnBcX0M7EtstnCmwz5jZUOUYwlZ+/xxX6z3jPu1XVO2Jivk0eLfuP9GP+vFD49CMetw== + /@opentelemetry/core/0.18.2: dependencies: - '@opentelemetry/api': 0.16.0 - '@opentelemetry/context-base': 0.16.0 - semver: 7.3.4 + '@opentelemetry/api': 0.18.1 + semver: 7.3.5 dev: false engines: node: '>=8.5.0' resolution: - integrity: sha512-NFZwEW5TeFIAUlNty9al0KU9AQzpEiBowem/33d3ftxYHZ7dG1JklFnyKLTVb+pAZFm/peTziVddfHoTsIY4Rg== - /@opentelemetry/resources/0.16.0: + integrity: sha512-WG8veOEd8xZHuBaOHddzWQg5yj794lrEPAe6W1qI0YkV7pyqYXvhJdCxOU5Lyo1SWzTAjI5xrCUQ9J2WlrqzYA== + /@opentelemetry/resources/0.18.2: dependencies: - '@opentelemetry/api': 0.16.0 - '@opentelemetry/core': 0.16.0 + '@opentelemetry/api': 0.18.1 + '@opentelemetry/core': 0.18.2 dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-HOAmcRnZGbEhcddsjqvz3Q/mEg75PyEoH/CZZ3YGqYmwTPimTiusm8iz5nXMxp1UpT8rkzlEGei/E21SQ/Zh9g== - /@opentelemetry/semantic-conventions/0.16.0: + integrity: sha512-EBPqFsreXgFaqkMmWCE8vh6pFhbWExRHSO24qSeGhxFmM5SQP/D1jJqMp/jVUSmrF97fPkMS0aEH5z7NOWdxQA== + /@opentelemetry/semantic-conventions/0.18.2: dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-RDYLf6lUtikIDTr6yVDehsUAlNb1U680eOV1QuDN0w6FDGubTnjbADlgpF41ByOow1Jp/WGmynFfOh19Ix4NWw== - /@opentelemetry/tracing/0.16.0: + integrity: sha512-+0P+PrP9qSFVaayNdek4P1OAGE+PEl2SsufuHDRmUpOY25Wzjo7Atyar56Trjc32jkNy4lID6ZFT6BahsR9P9A== + /@opentelemetry/tracing/0.18.2: dependencies: - '@opentelemetry/api': 0.16.0 - '@opentelemetry/context-base': 0.16.0 - '@opentelemetry/core': 0.16.0 - '@opentelemetry/resources': 0.16.0 - '@opentelemetry/semantic-conventions': 0.16.0 + '@opentelemetry/api': 0.18.1 + '@opentelemetry/core': 0.18.2 + '@opentelemetry/resources': 0.18.2 + '@opentelemetry/semantic-conventions': 0.18.2 lodash.merge: 4.6.2 dev: false engines: node: '>=8.0.0' resolution: - integrity: sha512-8UrNbzO56m8fe9ge+XR0Lruwld+W6SM6aWFQT32YCU8lS+Hzz2P6TbevmgT4DzeKszJxnHqzNnqx8HziNeUjTA== + integrity: sha512-IQSu+NwMhX8O9Wkjc4HjNqs/aKfkcInCE3dQuAOBBec/saLrM6jqd+Fa5QUzg03WMOqpDuZm5KTkr5+6DUrr0g== /@rollup/plugin-commonjs/11.0.2_rollup@1.32.1: dependencies: '@rollup/pluginutils': 3.1.0_rollup@1.32.1 estree-walker: 1.0.1 is-reference: 1.2.1 magic-string: 0.25.7 - resolve: 1.19.0 + resolve: 1.20.0 rollup: 1.32.1 dev: false engines: @@ -764,7 +934,7 @@ packages: deep-freeze: 0.0.1 deepmerge: 4.2.2 is-module: 1.0.0 - resolve: 1.19.0 + resolve: 1.20.0 rollup: 1.32.1 dev: false engines: @@ -773,7 +943,7 @@ packages: rollup: ^1.20.0||^2.0.0 resolution: integrity: sha512-LFqKdRLn0ShtQyf6SBYO69bGE1upV6wUhBX0vFOUnLAyzx5cwp8svA0eHUnu8+YU57XOkrMtfG63QOpQx25pHQ== - /@rollup/plugin-replace/2.3.4_rollup@1.32.1: + /@rollup/plugin-replace/2.4.2_rollup@1.32.1: dependencies: '@rollup/pluginutils': 3.1.0_rollup@1.32.1 magic-string: 0.25.7 @@ -782,7 +952,7 @@ packages: peerDependencies: rollup: ^1.20.0 || ^2.0.0 resolution: - integrity: sha512-waBhMzyAtjCL1GwZes2jaE9MjuQ/DQF2BatH3fRivUF3z0JBFrU0U6iBNC/4WR+2rLKhaAhPWDNPYp4mI6RqdQ== + integrity: sha512-IGcu+cydlUMZ5En85jxHH4qj2hta/11BHq95iHEyb2sbgiN0eCdzvUcHw5gt9pBL5lTi4JDYJ1acCoMGpTvEZg== /@rollup/pluginutils/3.1.0_rollup@1.32.1: dependencies: '@types/estree': 0.0.39 @@ -808,7 +978,7 @@ packages: dev: false resolution: integrity: sha512-1+FoymIdr9W9k0D8fdZBBPwi5YcMwh/RyESuL5bY29rLICFxSLOPK+ImVZ1OcWj9GEMsvDx5pNpJ311mHQk+MA== - /@rushstack/node-core-library/3.33.6: + /@rushstack/node-core-library/3.36.0: dependencies: '@types/node': 10.17.13 colors: 1.2.5 @@ -816,12 +986,19 @@ packages: import-lazy: 4.0.0 jju: 1.4.0 resolve: 1.17.0 - semver: 7.3.4 + semver: 7.3.5 timsort: 0.3.0 z-schema: 3.18.4 dev: false resolution: - integrity: sha512-930AP4Zj14Z4ulQ6ty2v3DM+D31zpLslAJuHB5E1qh/0+8JLkA0cf+wd2QiXjdIBpG/UdrHbReh5e9/e920YJw== + integrity: sha512-bID2vzXpg8zweXdXgQkKToEdZwVrVCN9vE9viTRk58gqzYaTlz4fMId6V3ZfpXN6H0d319uGi2KDlm+lUEeqCg== + /@rushstack/rig-package/0.2.10: + dependencies: + resolve: 1.17.0 + strip-json-comments: 3.1.1 + dev: false + resolution: + integrity: sha512-WXYerEJEPf8bS3ruqfM57NnwXtA7ehn8VJjLjrjls6eSduE5CRydcob/oBTzlHKsQ7N196XKlqQl9P6qIyYG2A== /@rushstack/ts-command-line/4.3.13: dependencies: '@types/argparse': 1.0.33 @@ -830,7 +1007,7 @@ packages: dev: false resolution: integrity: sha512-BUBbjYu67NJGQkpHu8aYm7kDoMFizL1qx78+72XE3mX/vDdXYJzw/FWS7TPcMJmY4kNlYs979v2B0Q0qa2wRiw== - /@rushstack/ts-command-line/4.6.10: + /@rushstack/ts-command-line/4.7.8: dependencies: '@types/argparse': 1.0.38 argparse: 1.0.10 @@ -838,7 +1015,7 @@ packages: string-argv: 0.3.1 dev: false resolution: - integrity: sha512-WhB/+yGvfmdsMFhEeVaJ9lBwPANFdsoKPsEkzSOVj60qG4aLWABeEl5rOdEwbbnx83RaNN2oQW8TX3enD+vdmw== + integrity: sha512-8ghIWhkph7NnLCMDJtthpsb7TMOsVGXVDvmxjE/CeklTqjbbUFBjGXizJfpbEkRQTELuZQ2+vGn7sGwIWKN2uA== /@sinonjs/commons/1.8.2: dependencies: type-detect: 4.0.8 @@ -884,26 +1061,26 @@ packages: /@types/body-parser/1.19.0: dependencies: '@types/connect': 3.4.34 - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ== /@types/chai-as-promised/7.1.3: dependencies: - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 dev: false resolution: integrity: sha512-FQnh1ohPXJELpKhzjuDkPLR2BZCAqed+a6xV4MI/T3XzHfd2FlarfUGUdZYgqYe8oxkYn0fchHEeHfHqdZ96sg== /@types/chai-string/1.4.2: dependencies: - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 dev: false resolution: integrity: sha512-ld/1hV5qcPRGuwlPdvRfvM3Ka/iofOk2pH4VkasK4b1JJP1LjNmWWn0LsISf6RRzyhVOvs93rb9tM09e+UuF8Q== - /@types/chai/4.2.14: + /@types/chai/4.2.16: dev: false resolution: - integrity: sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ== + integrity: sha512-vI5iOAsez9+roLS3M3+Xx7w+WRuDtSmF8bQkrbcIJ2sC1PcDgVoA0WGpa+bIrJ+y8zqY2oi//fUctkxtIcXJCw== /@types/chalk/2.2.0: dependencies: chalk: 4.1.0 @@ -911,44 +1088,56 @@ packages: dev: false resolution: integrity: sha512-1zzPV9FDe1I/WHhRkf9SNgqtRJWZqrBWgu7JGveuHmmyR9CnAPCie2N/x+iHrgnpYBIcCJWHBoMRv2TRWktsvw== + /@types/component-emitter/1.2.10: + dev: false + resolution: + integrity: sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg== /@types/connect/3.4.34: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-ePPA/JuI+X0vb+gSWlPKOY0NdNAie/rPUqX2GUPpbZwiKTkSPhjXWuee47E4MtE54QVzGCQMQkAL6JhV2E1+cQ== + /@types/cookie/0.4.0: + dev: false + resolution: + integrity: sha512-y7mImlc/rNkvCRmg8gC3/lj87S7pTUIJ6QGjwHR9WQJcFs+ZMTOaoPrkdFA/YdbuqVEmEbb5RdhVxMkAcgOnpg== + /@types/cors/2.8.10: + dev: false + resolution: + integrity: sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ== /@types/debug/4.1.5: dev: false resolution: integrity: sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== - /@types/eslint/7.2.6: + /@types/eslint/7.2.8: dependencies: - '@types/estree': 0.0.46 + '@types/estree': 0.0.47 '@types/json-schema': 7.0.7 dev: false resolution: - integrity: sha512-I+1sYH+NPQ3/tVqCeUSBwTE/0heyvtXqpIopUUArlBm0Kpocb8FbMa3AZ/ASKIFpN3rnEx932TTXDbt9OXsNDw== + integrity: sha512-RTKvBsfz0T8CKOGZMfuluDNyMFHnu5lvNr4hWEsQeHXH6FcmIDIozOyWMh36nLGMwVd5UFNXC2xztA8lln22MQ== /@types/estree/0.0.39: dev: false resolution: integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== - /@types/estree/0.0.46: + /@types/estree/0.0.47: dev: false resolution: - integrity: sha512-laIjwTQaD+5DukBZaygQ79K1Z0jb1bPEMRrkXSLjtCcZm+abyp5YbrqpSLzD42FwWW6gK/aS4NYpJ804nG2brg== - /@types/express-serve-static-core/4.17.18: + integrity: sha512-c5ciR06jK8u9BstrmJyO97m+klJrrhCf9u3rLu3DEAJBirxRqSCvDQoYKmxuYwQI5SZChAWu+tq9oVlGRuzPAg== + /@types/express-serve-static-core/4.17.19: dependencies: - '@types/node': 10.17.51 - '@types/qs': 6.9.5 + '@types/node': 14.14.37 + '@types/qs': 6.9.6 '@types/range-parser': 1.2.3 dev: false resolution: - integrity: sha512-m4JTwx5RUBNZvky/JJ8swEJPKFd8si08pPF2PfizYjGZOKr/svUWPcoUmLow6MmPzhasphB7gSTINY67xn3JNA== + integrity: sha512-DJOSHzX7pCiSElWaGR8kCprwibCB/3yW6vcT8VG3P0SJjnv19gnWG/AZMfM60Xj/YJIp/YCaDHyvzsFVeniARA== /@types/express/4.17.11: dependencies: '@types/body-parser': 1.19.0 - '@types/express-serve-static-core': 4.17.18 - '@types/qs': 6.9.5 + '@types/express-serve-static-core': 4.17.19 + '@types/qs': 6.9.6 '@types/serve-static': 1.13.9 dev: false resolution: @@ -959,20 +1148,20 @@ packages: integrity: sha512-mky/O83TXmGY39P1H9YbUpjV6l6voRYlufqfFCvel8l1phuy8HRjdWc1rrPuN53ITBJlbyMSV6z3niOySO5pgQ== /@types/fs-extra/8.1.1: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w== /@types/glob/7.1.3: dependencies: - '@types/minimatch': 3.0.3 - '@types/node': 10.17.51 + '@types/minimatch': 3.0.4 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w== /@types/is-buffer/2.0.0: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw== @@ -984,13 +1173,13 @@ packages: dev: false resolution: integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4= - /@types/jsrsasign/8.0.9: + /@types/jsrsasign/8.0.10: dev: false resolution: - integrity: sha512-Od34HkZR4DAaNpl6/fGEFVMQ5gWlwfwsbEeBjVDMMh9zlQD7hDwVEs0oUQDiVSfHImb0tlJVgfVGkp1jL9zOkg== + integrity: sha512-TtLis3HRTt7wLfdpkDBem6vs+MbEGMsC7ob5gNYsJV40tHNAFxw00HMMsEHsg9FWduD38NtACWuSqQpXbFulUg== /@types/jws/3.2.3: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-g54CHxwvaHvyJyeuZqe7VQujV9SfCXwEkboJp355INPL+kjlS3Aq153EHptaeO/Cch/NPJ1i2sHz0sDDizn7LQ== @@ -1002,12 +1191,12 @@ packages: dev: false resolution: integrity: sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== - /@types/md5/2.2.1: + /@types/md5/2.3.0: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: - integrity: sha512-bZB0jqBL7JETFqvRKyuDETFceFaVcLm2MBPP5LFEEL/SZuqLnyvzF37tXmMERDncC3oeEj/fOUw88ftJeMpZaw== + integrity: sha512-556YJ7ejzxIqSSxzyGGpctuZOarNZJt/zlEkhmmDc1f/slOEANHuwu2ZX7YaZ40rMiWoxt8GvAhoDpW1cmSy6A== /@types/mime/1.3.2: dev: false resolution: @@ -1016,6 +1205,10 @@ packages: dev: false resolution: integrity: sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + /@types/minimatch/3.0.4: + dev: false + resolution: + integrity: sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA== /@types/minimist/1.2.1: dev: false resolution: @@ -1026,13 +1219,13 @@ packages: integrity: sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w== /@types/mock-fs/4.10.0: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-FQ5alSzmHMmliqcL36JqIA4Yyn9jyJKvRSGV3mvPh108VFatX7naJDzSG4fnFQNZFq9dIx0Dzoe6ddflMB2Xkg== /@types/mock-require/2.0.0: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-nOgjoE5bBiDeiA+z41i95makyHUSMWQMOPocP+J67Pqx/68HAXaeWN1NFtrAYYV6LrISIZZ8vKHm/a50k0f6Sg== @@ -1040,21 +1233,25 @@ packages: dev: false resolution: integrity: sha512-DPxmjiDwubsNmguG5X4fEJ+XCyzWM3GXWsqQlvUcjJKa91IOoJUy51meDr0GkzK64qqNcq85ymLlyjoct9tInw== - /@types/node-fetch/2.5.8: + /@types/node-fetch/2.5.10: dependencies: - '@types/node': 10.17.51 - form-data: 3.0.0 + '@types/node': 14.14.37 + form-data: 3.0.1 dev: false resolution: - integrity: sha512-fbjI6ja0N5ZA8TV53RUqzsKNkl9fv8Oj3T7zxW7FGv1GSH7gwJaNF8dzCjrqKaxKeUpTz4yT1DaJFq/omNpGfw== + integrity: sha512-IpkX0AasN44hgEad0gEF/V6EgR5n69VEqPEgnmoM8GsIGro3PowbWs4tR6IhxUTyPLpOn+fiGG6nrQhcmoCuIQ== /@types/node/10.17.13: dev: false resolution: integrity: sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== - /@types/node/10.17.51: + /@types/node/10.17.56: dev: false resolution: - integrity: sha512-KANw+MkL626tq90l++hGelbl67irOJzGhUJk6a1Bt8QHOeh9tztJx+L0AqttraWKinmZn7Qi5lJZJzx45Gq0dg== + integrity: sha512-LuAa6t1t0Bfw4CuSR0UITsm1hP17YL+u82kfHGrHUWdhlBtH7sa7jGY5z7glGaIj/WDYDkRtgGd+KCjCzxBW1w== + /@types/node/14.14.37: + dev: false + resolution: + integrity: sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw== /@types/node/8.10.66: dev: false resolution: @@ -1067,10 +1264,10 @@ packages: dev: false resolution: integrity: sha1-bqrDJHpMXO/JRILl2Hw3MLNfUFM= - /@types/qs/6.9.5: + /@types/qs/6.9.6: dev: false resolution: - integrity: sha512-/JHkVHtx/REVG0VVToGRGH2+23hsYLHdyG+GrvoUGlGAd0ErauXDyvHtRI/7H7mzLm+tBCKA7pfcpkQ1lf58iQ== + integrity: sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA== /@types/query-string/6.2.0: dev: false resolution: @@ -1081,113 +1278,87 @@ packages: integrity: sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA== /@types/resolve/1.17.1: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw== - /@types/semaphore/1.1.0: + /@types/semaphore/1.1.1: dev: false resolution: - integrity: sha512-YD+lyrPhrsJdSOaxmA9K1lzsCoN0J29IsQGMKd67SbkPDXxJPdwdqpok1sytD19NEozUaFpjIsKOWnJDOYO/GA== + integrity: sha512-jmFpMslMtBGOXY2s7x6O8vBebcj6zhkwl0Pd/viZApo1uZaPk733P8doPvaiBbCG+R7201OLOl4QP7l1mFyuyw== /@types/serve-static/1.13.9: dependencies: '@types/mime': 1.3.2 - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-ZFqF6qa48XsPdjXV5Gsz0Zqmux2PerNd3a/ktL45mHpa19cuMi/cL8tcxdAx497yRh+QtYPuofjT9oWw9P7nkA== - /@types/sinon/9.0.10: + /@types/sinon/9.0.11: dependencies: '@types/sinonjs__fake-timers': 6.0.2 dev: false resolution: - integrity: sha512-/faDC0erR06wMdybwI/uR8wEKV/E83T0k4sepIpB7gXuy2gzx2xiOjmztq6a2Y6rIGJ04D+6UU0VBmWy+4HEMA== + integrity: sha512-PwP4UY33SeeVKodNE37ZlOsR9cReypbMJOhZ7BVE0lB+Hix3efCOxiJWiE5Ia+yL9Cn2Ch72EjFTRze8RZsNtg== /@types/sinonjs__fake-timers/6.0.2: dev: false resolution: integrity: sha512-dIPoZ3g5gcx9zZEszaxLSVTvMReD3xxyyDnQUjA6IYDG9Ba2AV0otMPs+77sG9ojB4Qr2N2Vk5RnKeuA0X/0bg== - /@types/tough-cookie/4.0.0: + /@types/stoppable/1.1.0: + dependencies: + '@types/node': 14.14.37 dev: false resolution: - integrity: sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A== - /@types/tunnel/0.0.0: - dependencies: - '@types/node': 10.17.51 + integrity: sha512-BRR23Q9CJduH7AM6mk4JRttd8XyFkb4qIPZu4mdLF+VoP+wcjIxIWIKiBbN78NBbEuynrAyMPtzOHnIp2B/JPQ== + /@types/tough-cookie/4.0.0: dev: false resolution: - integrity: sha512-FGDp0iBRiBdPjOgjJmn1NH0KDLN+Z8fRmo+9J7XGBhubq1DPrGrbmG4UTlGzrpbCpesMqD0sWkzi27EYkOMHyg== + integrity: sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A== /@types/tunnel/0.0.1: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A== - /@types/underscore/1.10.24: + /@types/underscore/1.11.1: dev: false resolution: - integrity: sha512-T3NQD8hXNW2sRsSbLNjF/aBo18MyJlbw0lSpQHB/eZZtScPdexN4HSa8cByYwTw9Wy7KuOFr81mlDQcQQaZ79w== + integrity: sha512-mW23Xkp9HYgdMV7gnwuzqnPx6aG0J7xg/b7erQszOcyOizWylwCr9cgYM/BVVJHezUDxwyigG6+wCFQwCvyMBw== /@types/uuid/8.3.0: dev: false resolution: integrity: sha512-eQ9qFW/fhfGJF8WKHGEHZEyVWfZxrT+6CLIJGBcZPfxUh/+BnEj+UCGYMlr9qZuX/2AltsvwrGqp0LhEW8D0zQ== - /@types/ws/7.4.0: + /@types/ws/7.4.1: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: - integrity: sha512-Y29uQ3Uy+58bZrFLhX36hcI3Np37nqWE7ky5tjiDoy1GDZnIwVxS0CgF+s+1bXMzjKBFy+fqaRfb708iNzdinw== + integrity: sha512-ISCK1iFnR+jYv7+jLNX0wDqesZ/5RAeY3wUx6QaphmocphU61h+b+PHjS18TF4WIPTu/MMzxIq2PHr32o2TS5Q== /@types/xml2js/0.4.8: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false resolution: integrity: sha512-EyvT83ezOdec7BhDaEcsklWy7RSIdi6CNe95tmOAK0yx/Lm30C9K75snT3fYayK59ApC2oyW+rcHErdG05FHJA== - /@types/yargs-parser/20.2.0: - dev: false - resolution: - integrity: sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA== - /@types/yargs/15.0.13: - dependencies: - '@types/yargs-parser': 20.2.0 - dev: false - resolution: - integrity: sha512-kQ5JNTrbDv3Rp5X2n/iUu37IJBDU2gsZ5R/g1/KHOOEc5IKfUFjXT6DENPGduh08I/pamwtEq4oul7gUqKTQDQ== /@types/yauzl/2.9.1: dependencies: - '@types/node': 10.17.51 + '@types/node': 14.14.37 dev: false optional: true resolution: integrity: sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA== - /@typescript-eslint/eslint-plugin-tslint/4.14.2_3e70afb83b6e686448c8a54281cd77ac: + /@typescript-eslint/eslint-plugin/4.19.0_1a11d0673659f3a5e0fd221432005aeb: dependencies: - '@typescript-eslint/experimental-utils': 4.14.2_eslint@7.19.0+typescript@4.1.2 - eslint: 7.19.0 - lodash: 4.17.20 - tslint: 5.20.1_typescript@4.1.2 - typescript: 4.1.2 - dev: false - engines: - node: ^10.12.0 || >=12.0.0 - peerDependencies: - eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 - tslint: ^5.0.0 || ^6.0.0 - typescript: '*' - resolution: - integrity: sha512-4zkwVU9osU60HnB1jSp4TvyxME5LGcgGk37eRxj2OQ6pzXi6Dcb81B6m3PlEvnqhE0kB48jl+0KKfHM9+egX1Q== - /@typescript-eslint/eslint-plugin/4.13.0_85649cb1d193687858ee685cdd7abf38: - dependencies: - '@typescript-eslint/experimental-utils': 4.13.0_eslint@7.19.0+typescript@4.1.2 - '@typescript-eslint/parser': 4.13.0_eslint@7.19.0+typescript@4.1.2 - '@typescript-eslint/scope-manager': 4.13.0 + '@typescript-eslint/experimental-utils': 4.19.0_eslint@7.23.0+typescript@4.2.4 + '@typescript-eslint/parser': 4.19.0_eslint@7.23.0+typescript@4.2.4 + '@typescript-eslint/scope-manager': 4.19.0 debug: 4.3.1 - eslint: 7.19.0 + eslint: 7.23.0 functional-red-black-tree: 1.0.1 - lodash: 4.17.20 + lodash: 4.17.21 regexpp: 3.1.0 - semver: 7.3.4 - tsutils: 3.20.0_typescript@4.1.2 - typescript: 4.1.2 + semver: 7.3.5 + tsutils: 3.21.0_typescript@4.2.4 + typescript: 4.2.4 dev: false engines: node: ^10.12.0 || >=12.0.0 @@ -1199,14 +1370,14 @@ packages: typescript: optional: true resolution: - integrity: sha512-ygqDUm+BUPvrr0jrXqoteMqmIaZ/bixYOc3A4BRwzEPTZPi6E+n44rzNZWaB0YvtukgP+aoj0i/fyx7FkM2p1w== - /@typescript-eslint/experimental-utils/4.13.0_eslint@7.19.0+typescript@4.1.2: + integrity: sha512-CRQNQ0mC2Pa7VLwKFbrGVTArfdVDdefS+gTw0oC98vSI98IX5A8EVH4BzJ2FOB0YlCmm8Im36Elad/Jgtvveaw== + /@typescript-eslint/experimental-utils/4.19.0_eslint@7.23.0+typescript@4.2.4: dependencies: '@types/json-schema': 7.0.7 - '@typescript-eslint/scope-manager': 4.13.0 - '@typescript-eslint/types': 4.13.0 - '@typescript-eslint/typescript-estree': 4.13.0_typescript@4.1.2 - eslint: 7.19.0 + '@typescript-eslint/scope-manager': 4.19.0 + '@typescript-eslint/types': 4.19.0 + '@typescript-eslint/typescript-estree': 4.19.0_typescript@4.2.4 + eslint: 7.23.0 eslint-scope: 5.1.1 eslint-utils: 2.1.0 dev: false @@ -1216,32 +1387,15 @@ packages: eslint: '*' typescript: '*' resolution: - integrity: sha512-/ZsuWmqagOzNkx30VWYV3MNB/Re/CGv/7EzlqZo5RegBN8tMuPaBgNK6vPBCQA8tcYrbsrTdbx3ixMRRKEEGVw== - /@typescript-eslint/experimental-utils/4.14.2_eslint@7.19.0+typescript@4.1.2: + integrity: sha512-9/23F1nnyzbHKuoTqFN1iXwN3bvOm/PRIXSBR3qFAYotK/0LveEOHr5JT1WZSzcD6BESl8kPOG3OoDRKO84bHA== + /@typescript-eslint/parser/4.19.0_eslint@7.23.0+typescript@4.2.4: dependencies: - '@types/json-schema': 7.0.7 - '@typescript-eslint/scope-manager': 4.14.2 - '@typescript-eslint/types': 4.14.2 - '@typescript-eslint/typescript-estree': 4.14.2_typescript@4.1.2 - eslint: 7.19.0 - eslint-scope: 5.1.1 - eslint-utils: 2.1.0 - dev: false - engines: - node: ^10.12.0 || >=12.0.0 - peerDependencies: - eslint: '*' - typescript: '*' - resolution: - integrity: sha512-mV9pmET4C2y2WlyHmD+Iun8SAEqkLahHGBkGqDVslHkmoj3VnxnGP4ANlwuxxfq1BsKdl/MPieDbohCEQgKrwA== - /@typescript-eslint/parser/4.13.0_eslint@7.19.0+typescript@4.1.2: - dependencies: - '@typescript-eslint/scope-manager': 4.13.0 - '@typescript-eslint/types': 4.13.0 - '@typescript-eslint/typescript-estree': 4.13.0_typescript@4.1.2 + '@typescript-eslint/scope-manager': 4.19.0 + '@typescript-eslint/types': 4.19.0 + '@typescript-eslint/typescript-estree': 4.19.0_typescript@4.2.4 debug: 4.3.1 - eslint: 7.19.0 - typescript: 4.1.2 + eslint: 7.23.0 + typescript: 4.2.4 dev: false engines: node: ^10.12.0 || >=12.0.0 @@ -1252,69 +1406,32 @@ packages: typescript: optional: true resolution: - integrity: sha512-KO0J5SRF08pMXzq9+abyHnaGQgUJZ3Z3ax+pmqz9vl81JxmTTOUfQmq7/4awVfq09b6C4owNlOgOwp61pYRBSg== - /@typescript-eslint/scope-manager/4.13.0: - dependencies: - '@typescript-eslint/types': 4.13.0 - '@typescript-eslint/visitor-keys': 4.13.0 - dev: false - engines: - node: ^8.10.0 || ^10.13.0 || >=11.10.1 - resolution: - integrity: sha512-UpK7YLG2JlTp/9G4CHe7GxOwd93RBf3aHO5L+pfjIrhtBvZjHKbMhBXTIQNkbz7HZ9XOe++yKrXutYm5KmjWgQ== - /@typescript-eslint/scope-manager/4.14.2: + integrity: sha512-/uabZjo2ZZhm66rdAu21HA8nQebl3lAIDcybUoOxoI7VbZBYavLIwtOOmykKCJy+Xq6Vw6ugkiwn8Js7D6wieA== + /@typescript-eslint/scope-manager/4.19.0: dependencies: - '@typescript-eslint/types': 4.14.2 - '@typescript-eslint/visitor-keys': 4.14.2 + '@typescript-eslint/types': 4.19.0 + '@typescript-eslint/visitor-keys': 4.19.0 dev: false engines: node: ^8.10.0 || ^10.13.0 || >=11.10.1 resolution: - integrity: sha512-cuV9wMrzKm6yIuV48aTPfIeqErt5xceTheAgk70N1V4/2Ecj+fhl34iro/vIssJlb7XtzcaD07hWk7Jk0nKghg== - /@typescript-eslint/types/4.13.0: + integrity: sha512-GGy4Ba/hLXwJXygkXqMzduqOMc+Na6LrJTZXJWVhRrSuZeXmu8TAnniQVKgj8uTRKe4igO2ysYzH+Np879G75g== + /@typescript-eslint/types/4.19.0: dev: false engines: node: ^8.10.0 || ^10.13.0 || >=11.10.1 resolution: - integrity: sha512-/+aPaq163oX+ObOG00M0t9tKkOgdv9lq0IQv/y4SqGkAXmhFmCfgsELV7kOCTb2vVU5VOmVwXBXJTDr353C1rQ== - /@typescript-eslint/types/4.14.2: - dev: false - engines: - node: ^8.10.0 || ^10.13.0 || >=11.10.1 - resolution: - integrity: sha512-LltxawRW6wXy4Gck6ZKlBD05tCHQUj4KLn4iR69IyRiDHX3d3NCAhO+ix5OR2Q+q9bjCrHE/HKt+riZkd1At8Q== - /@typescript-eslint/typescript-estree/4.13.0_typescript@4.1.2: - dependencies: - '@typescript-eslint/types': 4.13.0 - '@typescript-eslint/visitor-keys': 4.13.0 - debug: 4.3.1 - globby: 11.0.2 - is-glob: 4.0.1 - lodash: 4.17.20 - semver: 7.3.4 - tsutils: 3.20.0_typescript@4.1.2 - typescript: 4.1.2 - dev: false - engines: - node: ^10.12.0 || >=12.0.0 - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - resolution: - integrity: sha512-9A0/DFZZLlGXn5XA349dWQFwPZxcyYyCFX5X88nWs2uachRDwGeyPz46oTsm9ZJE66EALvEns1lvBwa4d9QxMg== - /@typescript-eslint/typescript-estree/4.14.2_typescript@4.1.2: + integrity: sha512-A4iAlexVvd4IBsSTNxdvdepW0D4uR/fwxDrKUa+iEY9UWvGREu2ZyB8ylTENM1SH8F7bVC9ac9+si3LWNxcBuA== + /@typescript-eslint/typescript-estree/4.19.0_typescript@4.2.4: dependencies: - '@typescript-eslint/types': 4.14.2 - '@typescript-eslint/visitor-keys': 4.14.2 + '@typescript-eslint/types': 4.19.0 + '@typescript-eslint/visitor-keys': 4.19.0 debug: 4.3.1 - globby: 11.0.2 + globby: 11.0.3 is-glob: 4.0.1 - lodash: 4.17.20 - semver: 7.3.4 - tsutils: 3.20.0_typescript@4.1.2 - typescript: 4.1.2 + semver: 7.3.5 + tsutils: 3.21.0_typescript@4.2.4 + typescript: 4.2.4 dev: false engines: node: ^10.12.0 || >=12.0.0 @@ -1324,28 +1441,27 @@ packages: typescript: optional: true resolution: - integrity: sha512-ESiFl8afXxt1dNj8ENEZT12p+jl9PqRur+Y19m0Z/SPikGL6rqq4e7Me60SU9a2M28uz48/8yct97VQYaGl0Vg== - /@typescript-eslint/visitor-keys/4.13.0: + integrity: sha512-3xqArJ/A62smaQYRv2ZFyTA+XxGGWmlDYrsfZG68zJeNbeqRScnhf81rUVa6QG4UgzHnXw5VnMT5cg75dQGDkA== + /@typescript-eslint/visitor-keys/4.19.0: dependencies: - '@typescript-eslint/types': 4.13.0 + '@typescript-eslint/types': 4.19.0 eslint-visitor-keys: 2.0.0 dev: false engines: node: ^8.10.0 || ^10.13.0 || >=11.10.1 resolution: - integrity: sha512-6RoxWK05PAibukE7jElqAtNMq+RWZyqJ6Q/GdIxaiUj2Ept8jh8+FUVlbq9WxMYxkmEOPvCE5cRSyupMpwW31g== - /@typescript-eslint/visitor-keys/4.14.2: + integrity: sha512-aGPS6kz//j7XLSlgpzU2SeTqHPsmRYxFztj2vPuMMFJXZudpRSehE3WCV+BaxwZFvfAqMoSd86TEuM0PQ59E/A== + /abort-controller/3.0.0: dependencies: - '@typescript-eslint/types': 4.14.2 - eslint-visitor-keys: 2.0.0 + event-target-shim: 5.0.1 dev: false engines: - node: ^8.10.0 || ^10.13.0 || >=11.10.1 + node: '>=6.5' resolution: - integrity: sha512-KBB+xLBxnBdTENs/rUgeUKO0UkPBRs2vD09oMRRIkj5BEN8PX1ToXV532desXfpQnZsYTyLLviS7JrPhdL154w== + integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== /accepts/1.3.7: dependencies: - mime-types: 2.1.28 + mime-types: 2.1.30 negotiator: 0.6.2 dev: false engines: @@ -1374,35 +1490,15 @@ packages: date-utils: 1.2.21 jws: 3.2.2 request: 2.88.2 - underscore: 1.12.0 + underscore: 1.12.1 uuid: 3.4.0 - xmldom: 0.4.0 + xmldom: 0.5.0 xpath.js: 1.1.0 dev: false engines: node: '>= 0.6.15' resolution: integrity: sha1-RoxLs+u9lrEnBmn0ucuk4AZepIU= - /after/0.8.2: - dev: false - resolution: - integrity: sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8= - /agent-base/4.2.1: - dependencies: - es6-promisify: 5.0.0 - dev: false - engines: - node: '>= 4.0.0' - resolution: - integrity: sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg== - /agent-base/4.3.0: - dependencies: - es6-promisify: 5.0.0 - dev: false - engines: - node: '>= 4.0.0' - resolution: - integrity: sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== /agent-base/5.1.1: dev: false engines: @@ -1426,7 +1522,7 @@ packages: dev: false resolution: integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== - /ajv/7.0.4: + /ajv/8.0.5: dependencies: fast-deep-equal: 3.1.3 json-schema-traverse: 1.0.0 @@ -1434,7 +1530,7 @@ packages: uri-js: 4.4.1 dev: false resolution: - integrity: sha512-xzzzaqgEQfmuhbhAoqjJ8T/1okb6gAzXn/eQRNpAN1AEUoHJTNF9xCDRTtf/s3SKldtZfa+RJeTs+BQq+eZ/sw== + integrity: sha512-RkiLa/AeJx7+9OvniQ/qeWu0w74A8DiPPBclQ6ji3ZQkv5KamO+QGpqmi7O4JIw3rHGUXZ6CoP9tsAkn3gyazg== /ansi-colors/3.2.3: dev: false engines: @@ -1493,7 +1589,7 @@ packages: node: '>=8' resolution: integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - /anymatch/3.1.1: + /anymatch/3.1.2: dependencies: normalize-path: 3.0.0 picomatch: 2.2.2 @@ -1501,7 +1597,7 @@ packages: engines: node: '>= 8' resolution: - integrity: sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== + integrity: sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== /append-transform/1.0.0: dependencies: default-require-extensions: 2.0.0 @@ -1527,10 +1623,6 @@ packages: optional: true resolution: integrity: sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== - /arg/4.1.0: - dev: false - resolution: - integrity: sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg== /arg/4.1.3: dev: false resolution: @@ -1555,18 +1647,18 @@ packages: dev: false resolution: integrity: sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= - /array-includes/3.1.2: + /array-includes/3.1.3: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 - es-abstract: 1.18.0-next.2 + es-abstract: 1.18.0 get-intrinsic: 1.1.1 is-string: 1.0.5 dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-w2GspexNQpx+PutG3QpT437/BenZBj0M/MZGn5mzv/MofYqo0xmRHzn4lFsoDlWJ+THYsGJmFlW68WlDFx7VRw== + integrity: sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A== /array-union/2.1.0: dev: false engines: @@ -1577,16 +1669,12 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 - es-abstract: 1.18.0-next.2 + es-abstract: 1.18.0 dev: false engines: node: '>= 0.4' resolution: integrity: sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg== - /arraybuffer.slice/0.0.7: - dev: false - resolution: - integrity: sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog== /asap/2.0.6: dev: false resolution: @@ -1614,14 +1702,14 @@ packages: dev: false resolution: integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== - /ast-types/0.14.2: + /ast-types/0.13.4: dependencies: - tslib: 2.1.0 + tslib: 2.2.0 dev: false engines: node: '>=4' resolution: - integrity: sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA== + integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w== /astral-regex/2.0.0: dev: false engines: @@ -1661,12 +1749,12 @@ packages: node: '>= 0.4' resolution: integrity: sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ== - /avsc/5.5.3: + /avsc/5.6.1: dev: false engines: node: '>=0.11' resolution: - integrity: sha512-LaBbmBsus1mpK+6i99AF57/tUP8/wAj9+ZZm/5HGNIWN0dUZWUEp4/o79pAiRz49Mdb3PskltbCFD3w115TdZQ== + integrity: sha512-Ro3/+ElCgfTgz6ZoVpdLvCV4TrcjKYKHJjyMp5dzuTczTEEHNCKV2vvJ5EORa4ofkB+nU5/UVM6NBP/+bFLAiw== /aws-sign2/0.7.0: dev: false resolution: @@ -1677,13 +1765,13 @@ packages: integrity: sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== /axios/0.21.1: dependencies: - follow-redirects: 1.13.2 + follow-redirects: 1.13.3 dev: false resolution: integrity: sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== /axios/0.21.1_debug@3.2.7: dependencies: - follow-redirects: 1.13.2_debug@3.2.7 + follow-redirects: 1.13.3_debug@3.2.7 dev: false peerDependencies: debug: '*' @@ -1691,7 +1779,7 @@ packages: integrity: sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== /axios/0.21.1_debug@4.3.1: dependencies: - follow-redirects: 1.13.2_debug@4.3.1 + follow-redirects: 1.13.3_debug@4.3.1 dev: false peerDependencies: debug: '*' @@ -1724,18 +1812,14 @@ packages: integrity: sha1-llxwWGaOgrVde/4E/yM3vItWR/4= /backbone/1.4.0: dependencies: - underscore: 1.12.0 + underscore: 1.12.1 dev: false resolution: integrity: sha512-RLmDrRXkVdouTg38jcgHhyQ/2zjg7a8E6sz2zxfz21Hh17xDJYUHBZimVIt5fUyS8vbfpeSmTL3gUjTEvUV3qQ== - /backo2/1.0.2: + /balanced-match/1.0.2: dev: false resolution: - integrity: sha1-MasayLEpNjRj41s+u2n038+6eUc= - /balanced-match/1.0.0: - dev: false - resolution: - integrity: sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== /base64-arraybuffer/0.1.4: dev: false engines: @@ -1764,18 +1848,14 @@ packages: node: '>=8' resolution: integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== - /bl/4.0.4: + /bl/4.1.0: dependencies: buffer: 5.7.1 inherits: 2.0.4 readable-stream: 3.6.0 dev: false resolution: - integrity: sha512-7tdr4EpSd7jJ6tuQ21vu2ke8w7pNEstzj1O8wwq6sNNzO3UDi5MA8Gny/gquCj7r2C6fHudg8tKRGyjRgmvNxQ== - /blob/0.0.5: - dev: false - resolution: - integrity: sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig== + integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== /body-parser/1.19.0: dependencies: bytes: 3.1.0 @@ -1795,7 +1875,7 @@ packages: integrity: sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw== /brace-expansion/1.1.11: dependencies: - balanced-match: 1.0.0 + balanced-match: 1.0.2 concat-map: 0.0.1 dev: false resolution: @@ -1816,6 +1896,19 @@ packages: dev: false resolution: integrity: sha1-rrGvKN5sDXpqLOQK22j/GEIq8x8= + /browserslist/4.16.3: + dependencies: + caniuse-lite: 1.0.30001207 + colorette: 1.2.2 + electron-to-chromium: 1.3.710 + escalade: 3.1.1 + node-releases: 1.1.71 + dev: false + engines: + node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7 + hasBin: true + resolution: + integrity: sha512-vIyhWmIkULaq04Gt93txdh+j02yX/JzlyhLYbV3YQCn/zvES3JnY7TifHHvvr1w5hTDluNKMkV05cs4vy8Q7sw== /buffer-crc32/0.2.13: dev: false resolution: @@ -1835,12 +1928,6 @@ packages: dev: false resolution: integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== - /builtin-modules/1.1.1: - dev: false - engines: - node: '>=0.10.0' - resolution: - integrity: sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= /builtin-modules/2.0.0: dev: false engines: @@ -1895,37 +1982,41 @@ packages: node: '>=6' resolution: integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + /caniuse-lite/1.0.30001207: + dev: false + resolution: + integrity: sha512-UPQZdmAsyp2qfCTiMU/zqGSWOYaY9F9LL61V8f+8MrubsaDGpaHD9HRV/EWZGULZn0Hxu48SKzI5DgFwTvHuYw== /caseless/0.12.0: dev: false resolution: integrity: sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= - /chai-as-promised/7.1.1_chai@4.3.0: + /chai-as-promised/7.1.1_chai@4.3.4: dependencies: - chai: 4.3.0 + chai: 4.3.4 check-error: 1.0.2 dev: false peerDependencies: chai: '>= 2.1.2 < 5' resolution: integrity: sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA== - /chai-exclude/2.0.2_chai@4.3.0: + /chai-exclude/2.0.3_chai@4.3.4: dependencies: - chai: 4.3.0 + chai: 4.3.4 fclone: 1.0.11 dev: false peerDependencies: chai: '>= 4.0.0 < 5' resolution: - integrity: sha512-QmNVnvdSw8Huccdjm49mKu3HtoHxvjdavgYkY0KPQ5MI5UWfbc9sX1YqRgaMPf2GGtDXPoF2ram3AeNS4945Xw== - /chai-string/1.5.0_chai@4.3.0: + integrity: sha512-6VuTQX25rsh4hKPdLzsOtL20k9+tszksLQrLtsu6szTmSVJP9+gUkqYUsyM+xqCeGZKeRJCsamCMRUQJhWsQ+g== + /chai-string/1.5.0_chai@4.3.4: dependencies: - chai: 4.3.0 + chai: 4.3.4 dev: false peerDependencies: chai: ^4.1.2 resolution: integrity: sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw== - /chai/4.3.0: + /chai/4.3.4: dependencies: assertion-error: 1.1.0 check-error: 1.0.2 @@ -1935,9 +2026,9 @@ packages: type-detect: 4.0.8 dev: false engines: - node: '>=8' + node: '>=4' resolution: - integrity: sha512-/BFd2J30EcOwmdOgXvVsmM48l0Br0nmZPlO0uOW4XKh6kpsUumRXBgPV+IlaqFaqr9cYbeoZAM1Npx0i4A+aiA== + integrity: sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA== /chalk/1.1.3: dependencies: ansi-styles: 2.2.1 @@ -1994,9 +2085,9 @@ packages: integrity: sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA= /chokidar/3.3.0: dependencies: - anymatch: 3.1.1 + anymatch: 3.1.2 braces: 3.0.2 - glob-parent: 5.1.1 + glob-parent: 5.1.2 is-binary-path: 2.1.0 is-glob: 4.0.1 normalize-path: 3.0.0 @@ -2010,9 +2101,9 @@ packages: integrity: sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A== /chokidar/3.5.1: dependencies: - anymatch: 3.1.1 + anymatch: 3.1.2 braces: 3.0.2 - glob-parent: 5.1.1 + glob-parent: 5.1.2 is-binary-path: 2.1.0 is-glob: 4.0.1 normalize-path: 3.0.0 @@ -2021,7 +2112,7 @@ packages: engines: node: '>= 8.10.0' optionalDependencies: - fsevents: 2.3.1 + fsevents: 2.3.2 resolution: integrity: sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw== /chownr/1.1.4: @@ -2040,29 +2131,14 @@ packages: dev: false resolution: integrity: sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== - /cliui/6.0.0: - dependencies: - string-width: 4.2.0 - strip-ansi: 6.0.0 - wrap-ansi: 6.2.0 - dev: false - resolution: - integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== /cliui/7.0.4: dependencies: - string-width: 4.2.0 + string-width: 4.2.2 strip-ansi: 6.0.0 wrap-ansi: 7.0.0 dev: false resolution: integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - /co/4.6.0: - dev: false - engines: - iojs: '>= 1.0.0' - node: '>= 0.12.0' - resolution: - integrity: sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= /code-point-at/1.1.0: dev: false engines: @@ -2092,6 +2168,10 @@ packages: dev: false resolution: integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + /colorette/1.2.2: + dev: false + resolution: + integrity: sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== /colors/1.2.5: dev: false engines: @@ -2126,22 +2206,10 @@ packages: dev: false resolution: integrity: sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= - /component-bind/1.0.0: - dev: false - resolution: - integrity: sha1-AMYIq33Nk4l8AAllGx06jh5zu9E= - /component-emitter/1.2.1: - dev: false - resolution: - integrity: sha1-E3kY1teCg/ffemt8WmPhQOaUJeY= /component-emitter/1.3.0: dev: false resolution: integrity: sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== - /component-inherit/0.0.3: - dev: false - resolution: - integrity: sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM= /concat-map/0.0.1: dev: false resolution: @@ -2210,18 +2278,27 @@ packages: requiresBuild: true resolution: integrity: sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== - /core-js/3.8.3: + /core-js/3.10.1: dev: false requiresBuild: true resolution: - integrity: sha512-KPYXeVZYemC2TkNEkX/01I+7yd+nX3KddKwZ1Ww7SKWdI2wQprSgLmrTddT8nw92AjEklTsPBoSdQBhbI1bQ6Q== + integrity: sha512-pwCxEXnj27XG47mu7SXAwhLP3L5CrlvCB91ANUkIz40P27kUcvNfSdvyZJ9CLHiVoKSp+TTChMQMSKQEH/IQxA== /core-util-is/1.0.2: dev: false resolution: integrity: sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + /cors/2.8.5: + dependencies: + object-assign: 4.1.1 + vary: 1.1.2 + dev: false + engines: + node: '>= 0.10' + resolution: + integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== /cp-file/6.2.0: dependencies: - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 make-dir: 2.1.0 nested-error-stacks: 2.1.0 pify: 4.0.1 @@ -2231,6 +2308,10 @@ packages: node: '>=6' resolution: integrity: sha512-fmvV4caBnofhPe8kOcitBwSn2f39QLjnAnGq3gO9dfd75mUytzKNZB1hde6QHunW2Rt+OwuBOMc3i1tNElbszA== + /create-require/1.1.1: + dev: false + resolution: + integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== /cross-env/7.0.3: dependencies: cross-spawn: 7.0.3 @@ -2275,10 +2356,10 @@ packages: dev: false resolution: integrity: sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs= - /csv-parse/4.15.1: + /csv-parse/4.15.3: dev: false resolution: - integrity: sha512-TXIvRtNp0fqMJbk3yPR35bQIDzMH4khDwduElzE7Fl1wgnl25mnWYLSLqd/wS5GsDoX1rWtysivEYMNsz5jKwQ== + integrity: sha512-jlTqDvLdHnYMSr08ynNfk4IAUSJgJjTKy2U5CQBSu4cN9vQOJonLVZP4Qo4gKKrIgIQ5dr07UwOJdi+lRqT12w== /custom-event/1.0.1: dev: false resolution: @@ -2291,10 +2372,12 @@ packages: node: '>=0.10' resolution: integrity: sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= - /data-uri-to-buffer/1.2.0: + /data-uri-to-buffer/3.0.1: dev: false + engines: + node: '>= 6' resolution: - integrity: sha512-vKQ9DTQPN1FLYiiEEOQ6IBGFqvjCa5rSK3cWMy/Nespm5d/x3dGFT9UBZnkLxCwua/IXBi2TYnwTEpsOvhC4UQ== + integrity: sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og== /date-format/2.1.0: dev: false engines: @@ -2313,26 +2396,16 @@ packages: node: '>0.4.0' resolution: integrity: sha1-YfsWzcEnSzyayq/+n8ad+HIKK2Q= - /death/1.1.0: - dev: false - resolution: - integrity: sha1-AaqcQB7dknUFFEcLgmY5DGbGcxg= - /debounce/1.2.0: + /debounce/1.2.1: dev: false resolution: - integrity: sha512-mYtLl1xfZLi1m4RtQYlZgJUNQjl4ZxVnHzIR8nLLgi4q1YT8o/WM+MK/f8yfcc9s5Ir5zRaPZyZU6xs1Syoocg== + integrity: sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== /debug/2.6.9: dependencies: ms: 2.0.0 dev: false resolution: integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - /debug/3.1.0: - dependencies: - ms: 2.0.0 - dev: false - resolution: - integrity: sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== /debug/3.2.6: dependencies: ms: 2.1.3 @@ -2432,14 +2505,16 @@ packages: node: '>= 0.4' resolution: integrity: sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== - /degenerator/1.0.4: + /degenerator/2.2.0: dependencies: - ast-types: 0.14.2 + ast-types: 0.13.4 escodegen: 1.14.3 - esprima: 3.1.3 + esprima: 4.0.1 dev: false + engines: + node: '>= 6' resolution: - integrity: sha1-/PSQo37OJmRk2cxDGrmMWBnO0JU= + integrity: sha512-aiQcQowF01RxFI4ZLFMpzyotbQonhNpBao6dkI8JPk5a+hmSjR5ErHp2CQySmQe8os3VBqLCIh87nDBgZXvsmg== /delay/4.4.1: dev: false engines: @@ -2548,7 +2623,7 @@ packages: /downlevel-dts/0.4.0: dependencies: shelljs: 0.8.4 - typescript: 3.9.7 + typescript: 3.9.9 dev: false hasBin: true resolution: @@ -2574,6 +2649,10 @@ packages: dev: false resolution: integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= + /electron-to-chromium/1.3.710: + dev: false + resolution: + integrity: sha512-b3r0E2o4yc7mNmBeJviejF1rEx49PUBi+2NPa7jHEX3arkAXnVgLhR0YmV8oi6/Qf3HH2a8xzQmCjHNH0IpXWQ== /emoji-regex/7.0.3: dev: false resolution: @@ -2594,45 +2673,28 @@ packages: dev: false resolution: integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== - /engine.io-client/3.5.0: + /engine.io-parser/4.0.2: dependencies: - component-emitter: 1.3.0 - component-inherit: 0.0.3 - debug: 3.1.0 - engine.io-parser: 2.2.1 - has-cors: 1.1.0 - indexof: 0.0.1 - parseqs: 0.0.6 - parseuri: 0.0.6 - ws: 7.4.3 - xmlhttprequest-ssl: 1.5.5 - yeast: 0.1.2 - dev: false - resolution: - integrity: sha512-12wPRfMrugVw/DNyJk34GQ5vIVArEcVMXWugQGGuw2XxUSztFNmJggZmv8IZlLyEdnpO1QB9LkcjeWewO2vxtA== - /engine.io-parser/2.2.1: - dependencies: - after: 0.8.2 - arraybuffer.slice: 0.0.7 base64-arraybuffer: 0.1.4 - blob: 0.0.5 - has-binary2: 1.0.3 dev: false + engines: + node: '>=8.0.0' resolution: - integrity: sha512-x+dN/fBH8Ro8TFwJ+rkB2AmuVw9Yu2mockR/p3W8f8YtExwFgDvBDi0GWyb4ZLkpahtDGZgtr3zLovanJghPqg== - /engine.io/3.5.0: + integrity: sha512-sHfEQv6nmtJrq6TKuIz5kyEKH/qSdK56H/A+7DnAuUPWosnIZAS2NHNcPLmyjtY3cGS/MqJdZbUjW97JU72iYg== + /engine.io/4.1.1: dependencies: accepts: 1.3.7 base64id: 2.0.0 cookie: 0.4.1 - debug: 4.1.1 - engine.io-parser: 2.2.1 - ws: 7.4.3 + cors: 2.8.5 + debug: 4.3.1 + engine.io-parser: 4.0.2 + ws: 7.4.4 dev: false engines: - node: '>=8.0.0' + node: '>=10.0.0' resolution: - integrity: sha512-21HlvPUKaitDGE4GXNtQ7PLP0Sz4aWLddMPw2VTyFz1FVZqu/kZsJUO8WNpKuE/OCL7nkfRaOui2ZCJloGznGA== + integrity: sha512-t2E9wLlssQjGw0nluF6aYyfX8LwYU8Jj0xct+pAhfWfv/YrBn6TSNtEYsgxHIfaMqfrLx07czcMg9bMN6di+3w== /enquirer/2.3.6: dependencies: ansi-colors: 4.1.1 @@ -2651,27 +2713,29 @@ packages: dev: false resolution: integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== - /es-abstract/1.18.0-next.2: + /es-abstract/1.18.0: dependencies: call-bind: 1.0.2 es-to-primitive: 1.2.1 function-bind: 1.1.1 get-intrinsic: 1.1.1 has: 1.0.3 - has-symbols: 1.0.1 + has-symbols: 1.0.2 is-callable: 1.2.3 is-negative-zero: 2.0.1 is-regex: 1.1.2 + is-string: 1.0.5 object-inspect: 1.9.0 object-keys: 1.1.1 object.assign: 4.1.2 - string.prototype.trimend: 1.0.3 - string.prototype.trimstart: 1.0.3 + string.prototype.trimend: 1.0.4 + string.prototype.trimstart: 1.0.4 + unbox-primitive: 1.0.1 dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-Ih4ZMFHEtZupnUh6497zEL4y2+w8+1ljnCyaTa+adcoafI1GOvMwFlDjBLfWR7y9VLfrjRJe9ocuHY1PSR9jjw== + integrity: sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw== /es-to-primitive/1.2.1: dependencies: is-callable: 1.2.3 @@ -2690,12 +2754,6 @@ packages: dev: false resolution: integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== - /es6-promisify/5.0.0: - dependencies: - es6-promise: 4.2.8 - dev: false - resolution: - integrity: sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= /escalade/3.1.1: dev: false engines: @@ -2732,9 +2790,9 @@ packages: source-map: 0.6.1 resolution: integrity: sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw== - /eslint-config-prettier/7.2.0_eslint@7.19.0: + /eslint-config-prettier/7.2.0_eslint@7.23.0: dependencies: - eslint: 7.19.0 + eslint: 7.23.0 dev: false hasBin: true peerDependencies: @@ -2744,7 +2802,7 @@ packages: /eslint-import-resolver-node/0.3.4: dependencies: debug: 2.6.9 - resolve: 1.19.0 + resolve: 1.20.0 dev: false resolution: integrity: sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA== @@ -2757,9 +2815,9 @@ packages: node: '>=4' resolution: integrity: sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA== - /eslint-plugin-es/3.0.1_eslint@7.19.0: + /eslint-plugin-es/3.0.1_eslint@7.23.0: dependencies: - eslint: 7.19.0 + eslint: 7.23.0 eslint-utils: 2.1.0 regexpp: 3.1.0 dev: false @@ -2769,21 +2827,21 @@ packages: eslint: '>=4.19.1' resolution: integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ== - /eslint-plugin-import/2.22.1_eslint@7.19.0: + /eslint-plugin-import/2.22.1_eslint@7.23.0: dependencies: - array-includes: 3.1.2 + array-includes: 3.1.3 array.prototype.flat: 1.2.4 contains-path: 0.1.0 debug: 2.6.9 doctrine: 1.5.0 - eslint: 7.19.0 + eslint: 7.23.0 eslint-import-resolver-node: 0.3.4 eslint-module-utils: 2.6.0 has: 1.0.3 minimatch: 3.0.4 - object.values: 1.1.2 + object.values: 1.1.3 read-pkg-up: 2.0.0 - resolve: 1.19.0 + resolve: 1.20.0 tsconfig-paths: 3.9.0 dev: false engines: @@ -2792,30 +2850,20 @@ packages: eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 resolution: integrity: sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw== - /eslint-plugin-no-null/1.0.2_eslint@7.19.0: - dependencies: - eslint: 7.19.0 - dev: false - engines: - node: '>=5.0.0' - peerDependencies: - eslint: '>=3.0.0' - resolution: - integrity: sha1-EjaoEjkTkKGHetQAfCbnRTQclR8= /eslint-plugin-no-only-tests/2.4.0: dev: false engines: node: '>=4.0.0' resolution: integrity: sha512-azP9PwQYfGtXJjW273nIxQH9Ygr+5/UyeW2wEjYoDtVYPI+WPKwbj0+qcAKYUXFZLRumq4HKkFaoDBAwBoXImQ== - /eslint-plugin-node/11.1.0_eslint@7.19.0: + /eslint-plugin-node/11.1.0_eslint@7.23.0: dependencies: - eslint: 7.19.0 - eslint-plugin-es: 3.0.1_eslint@7.19.0 + eslint: 7.23.0 + eslint-plugin-es: 3.0.1_eslint@7.23.0 eslint-utils: 2.1.0 ignore: 5.1.8 minimatch: 3.0.4 - resolve: 1.19.0 + resolve: 1.20.0 semver: 6.3.0 dev: false engines: @@ -2824,12 +2872,12 @@ packages: eslint: '>=5.16.0' resolution: integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g== - /eslint-plugin-promise/4.2.1: + /eslint-plugin-promise/4.3.1: dev: false engines: node: '>=6' resolution: - integrity: sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw== + integrity: sha512-bY2sGqyptzFBDLh/GMbAxfdJC+b0f23ME63FOE4+Jao0oZ3E1LEwFtWJX/1pGMJLiTtrSSern2CRM/g+dfc0eQ== /eslint-plugin-tsdoc/0.2.11: dependencies: '@microsoft/tsdoc': 0.13.0 @@ -2866,10 +2914,10 @@ packages: node: '>=10' resolution: integrity: sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== - /eslint/7.19.0: + /eslint/7.23.0: dependencies: - '@babel/code-frame': 7.12.13 - '@eslint/eslintrc': 0.3.0 + '@babel/code-frame': 7.12.11 + '@eslint/eslintrc': 0.4.0 ajv: 6.12.6 chalk: 4.1.0 cross-spawn: 7.0.3 @@ -2880,12 +2928,12 @@ packages: eslint-utils: 2.1.0 eslint-visitor-keys: 2.0.0 espree: 7.3.1 - esquery: 1.3.1 + esquery: 1.4.0 esutils: 2.0.3 - file-entry-cache: 6.0.0 + file-entry-cache: 6.0.1 functional-red-black-tree: 1.0.1 - glob-parent: 5.1.1 - globals: 12.4.0 + glob-parent: 5.1.2 + globals: 13.7.0 ignore: 4.0.6 import-fresh: 3.3.0 imurmurhash: 0.1.4 @@ -2893,24 +2941,24 @@ packages: js-yaml: 3.14.1 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 - lodash: 4.17.20 + lodash: 4.17.21 minimatch: 3.0.4 natural-compare: 1.4.0 optionator: 0.9.1 progress: 2.0.3 regexpp: 3.1.0 - semver: 7.3.4 + semver: 7.3.5 strip-ansi: 6.0.0 strip-json-comments: 3.1.1 - table: 6.0.7 + table: 6.0.9 text-table: 0.2.0 - v8-compile-cache: 2.2.0 + v8-compile-cache: 2.3.0 dev: false engines: node: ^10.12.0 || >=12.0.0 hasBin: true resolution: - integrity: sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg== + integrity: sha512-kqvNVbdkjzpFy0XOszNwjkKzZ+6TcwCQ/h+ozlcIWwaimBBuhlQ4nN6kbiM2L+OjDcznkTJxzYfRFH92sx4a0Q== /esm/3.2.25: dev: false engines: @@ -2927,13 +2975,6 @@ packages: node: ^10.12.0 || >=12.0.0 resolution: integrity: sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== - /esprima/3.1.3: - dev: false - engines: - node: '>=4' - hasBin: true - resolution: - integrity: sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= /esprima/4.0.1: dev: false engines: @@ -2941,14 +2982,14 @@ packages: hasBin: true resolution: integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - /esquery/1.3.1: + /esquery/1.4.0: dependencies: estraverse: 5.2.0 dev: false engines: node: '>=0.10' resolution: - integrity: sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== + integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== /esrecurse/4.3.0: dependencies: estraverse: 5.2.0 @@ -2989,16 +3030,22 @@ packages: node: '>= 0.6' resolution: integrity: sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= + /event-target-shim/5.0.1: + dev: false + engines: + node: '>=6' + resolution: + integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== /eventemitter3/4.0.7: dev: false resolution: integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== - /events/3.2.0: + /events/3.3.0: dev: false engines: node: '>=0.8.x' resolution: - integrity: sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg== + integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== /execa/3.4.0: dependencies: cross-spawn: 7.0.3 @@ -3099,7 +3146,7 @@ packages: dependencies: '@nodelib/fs.stat': 2.0.4 '@nodelib/fs.walk': 1.2.6 - glob-parent: 5.1.1 + glob-parent: 5.1.2 merge2: 1.4.1 micromatch: 4.0.2 picomatch: 2.2.2 @@ -3116,12 +3163,12 @@ packages: dev: false resolution: integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= - /fastq/1.10.1: + /fastq/1.11.0: dependencies: reusify: 1.0.4 dev: false resolution: - integrity: sha512-AWuv6Ery3pM+dY7LYS8YIaCiQvUaos9OB1RyNgaOWnaX+Tik7Onvcsf8x8c+YtDeT0maYLniBip2hox5KtEXXA== + integrity: sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g== /fclone/1.0.11: dev: false resolution: @@ -3134,16 +3181,16 @@ packages: integrity: sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4= /fetch-mock/9.11.0_node-fetch@2.6.1: dependencies: - '@babel/core': 7.12.13 - '@babel/runtime': 7.12.13 - core-js: 3.8.3 + '@babel/core': 7.13.14 + '@babel/runtime': 7.13.10 + core-js: 3.10.1 debug: 4.3.1 glob-to-regexp: 0.4.1 is-subset: 0.1.1 lodash.isequal: 4.5.0 node-fetch: 2.6.1 path-to-regexp: 2.4.0 - querystring: 0.2.0 + querystring: 0.2.1 whatwg-url: 6.5.0 dev: false engines: @@ -3155,18 +3202,20 @@ packages: optional: true resolution: integrity: sha512-PG1XUv+x7iag5p/iNHD4/jdpxL9FtVSqRMUQhPab4hVDt80T1MH5ehzVrL2IdXO9Q2iBggArFvPqjUbHFuI58Q== - /file-entry-cache/6.0.0: + /file-entry-cache/6.0.1: dependencies: flat-cache: 3.0.4 dev: false engines: node: ^10.12.0 || >=12.0.0 resolution: - integrity: sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA== - /file-uri-to-path/1.0.0: + integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + /file-uri-to-path/2.0.0: dev: false + engines: + node: '>= 6' resolution: - integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + integrity: sha512-hjPFI8oE/2iQPVe4gbrJ73Pp+Xfub2+WI2LlXDbsaJBwT5wuMh35WNWVYYTpnz895shtwfyutMFLFywpQAFdLg== /fill-range/7.0.1: dependencies: to-regex-range: 5.0.1 @@ -3215,15 +3264,6 @@ packages: node: '>=6' resolution: integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== - /find-up/4.1.0: - dependencies: - locate-path: 5.0.0 - path-exists: 4.0.0 - dev: false - engines: - node: '>=8' - resolution: - integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== /flat-cache/3.0.4: dependencies: flatted: 3.1.1 @@ -3252,7 +3292,7 @@ packages: dev: false resolution: integrity: sha512-+8GbtQBwEqutP0v3uajDDoN64K2ehmHd0cjlghhxh0WpcfPzAIjPA03e1VvHlxL02FVGR0A6lwXsNQKn3H1RNQ== - /follow-redirects/1.13.2: + /follow-redirects/1.13.3: dev: false engines: node: '>=4.0' @@ -3262,8 +3302,8 @@ packages: debug: optional: true resolution: - integrity: sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA== - /follow-redirects/1.13.2_debug@3.2.7: + integrity: sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA== + /follow-redirects/1.13.3_debug@3.2.7: dependencies: debug: 3.2.7 dev: false @@ -3275,8 +3315,8 @@ packages: debug: optional: true resolution: - integrity: sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA== - /follow-redirects/1.13.2_debug@4.3.1: + integrity: sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA== + /follow-redirects/1.13.3_debug@4.3.1: dependencies: debug: 4.3.1 dev: false @@ -3288,7 +3328,7 @@ packages: debug: optional: true resolution: - integrity: sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA== + integrity: sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA== /foreach/2.0.5: dev: false resolution: @@ -3308,7 +3348,7 @@ packages: dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 - mime-types: 2.1.28 + mime-types: 2.1.30 dev: false engines: node: '>= 0.12' @@ -3318,22 +3358,22 @@ packages: dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 - mime-types: 2.1.28 + mime-types: 2.1.30 dev: false engines: node: '>= 0.12' resolution: integrity: sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA== - /form-data/3.0.0: + /form-data/3.0.1: dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 - mime-types: 2.1.28 + mime-types: 2.1.30 dev: false engines: node: '>= 6' resolution: - integrity: sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg== + integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== /forwarded/0.1.2: dev: false engines: @@ -3352,7 +3392,7 @@ packages: integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== /fs-extra/7.0.1: dependencies: - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 jsonfile: 4.0.0 universalify: 0.1.2 dev: false @@ -3362,7 +3402,7 @@ packages: integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== /fs-extra/8.1.0: dependencies: - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 jsonfile: 4.0.0 universalify: 0.1.2 dev: false @@ -3384,7 +3424,7 @@ packages: - darwin resolution: integrity: sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== - /fsevents/2.3.1: + /fsevents/2.3.2: dev: false engines: node: ^8.16.0 || ^10.6.0 || >=11.0.0 @@ -3392,7 +3432,7 @@ packages: os: - darwin resolution: - integrity: sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw== + integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== /ftp/0.3.10: dependencies: readable-stream: 1.1.14 @@ -3448,7 +3488,7 @@ packages: dependencies: function-bind: 1.1.1 has: 1.0.3 - has-symbols: 1.0.1 + has-symbols: 1.0.2 dev: false resolution: integrity: sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== @@ -3460,17 +3500,19 @@ packages: node: '>=8' resolution: integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== - /get-uri/2.0.4: + /get-uri/3.0.2: dependencies: - data-uri-to-buffer: 1.2.0 - debug: 2.6.9 - extend: 3.0.2 - file-uri-to-path: 1.0.0 + '@tootallnate/once': 1.1.2 + data-uri-to-buffer: 3.0.1 + debug: 4.3.1 + file-uri-to-path: 2.0.0 + fs-extra: 8.1.0 ftp: 0.3.10 - readable-stream: 2.3.7 dev: false + engines: + node: '>= 6' resolution: - integrity: sha512-v7LT/s8kVjs+Tx0ykk1I+H/rbpzkHvuIq87LmeXptcf5sNWm9uQiwjNAt94SJPA1zOlCntmnOlJvVWKmzsxG8Q== + integrity: sha512-+5s0SJbGoyiJTZZ2JTpFPLMPSch72KEqGOTvQsBqg0RBWvwhWUSYZFAtz3TPW0GXJuLBJPts1E241iHg+VRfhg== /getpass/0.1.7: dependencies: assert-plus: 1.0.0 @@ -3482,14 +3524,14 @@ packages: optional: true resolution: integrity: sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= - /glob-parent/5.1.1: + /glob-parent/5.1.2: dependencies: is-glob: 4.0.1 dev: false engines: node: '>= 6' resolution: - integrity: sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== + integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== /glob-to-regexp/0.4.1: dev: false resolution: @@ -3559,7 +3601,15 @@ packages: node: '>=8' resolution: integrity: sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== - /globby/11.0.2: + /globals/13.7.0: + dependencies: + type-fest: 0.20.2 + dev: false + engines: + node: '>=8' + resolution: + integrity: sha512-Aipsz6ZKRxa/xQkZhNg0qIWXT6x6rD46f6x/PCnBomlttdIyAPak4YD9jTmKpZ72uROSMU87qJtcgpgHaVchiA== + /globby/11.0.3: dependencies: array-union: 2.1.0 dir-glob: 3.0.1 @@ -3571,11 +3621,11 @@ packages: engines: node: '>=10' resolution: - integrity: sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og== - /graceful-fs/4.2.4: + integrity: sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg== + /graceful-fs/4.2.6: dev: false resolution: - integrity: sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== + integrity: sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== /growl/1.10.5: dev: false engines: @@ -3586,7 +3636,7 @@ packages: dev: false resolution: integrity: sha512-Y8T4vYhEfwJOTbouREvG+3XDsjr8E3kIr7uf+JZ0BYloFsttiHU0WfvANVsR7TxNUJa/WpCnw/Ino/p+DeBhBQ== - /handlebars/4.7.6: + /handlebars/4.7.7: dependencies: minimist: 1.2.5 neo-async: 2.6.2 @@ -3597,9 +3647,9 @@ packages: node: '>=0.4.7' hasBin: true optionalDependencies: - uglify-js: 3.12.6 + uglify-js: 3.13.3 resolution: - integrity: sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA== + integrity: sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== /har-schema/2.0.0: dev: false engines: @@ -3624,16 +3674,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= - /has-binary2/1.0.3: - dependencies: - isarray: 2.0.1 - dev: false - resolution: - integrity: sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw== - /has-cors/1.1.0: + /has-bigints/1.0.1: dev: false resolution: - integrity: sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk= + integrity: sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== /has-flag/3.0.0: dev: false engines: @@ -3660,12 +3704,12 @@ packages: node: '>=6' resolution: integrity: sha512-3GuFy9rDw0xvovCHb4SOKiRImbZ+a8boFBUyGNRPVd2mRyQOzYdau5G9nodUXC1ZKYN59hrHFkW1lgBQscYfTg== - /has-symbols/1.0.1: + /has-symbols/1.0.2: dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== + integrity: sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== /has-unicode/2.0.1: dev: false optional: true @@ -3716,10 +3760,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA== - /hosted-git-info/2.8.8: + /hosted-git-info/2.8.9: dev: false resolution: - integrity: sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== + integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== /html-escaper/2.0.2: dev: false resolution: @@ -3748,15 +3792,6 @@ packages: node: '>= 0.6' resolution: integrity: sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== - /http-proxy-agent/2.1.0: - dependencies: - agent-base: 4.3.0 - debug: 3.1.0 - dev: false - engines: - node: '>= 4.5.0' - resolution: - integrity: sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg== /http-proxy-agent/4.0.1: dependencies: '@tootallnate/once': 1.1.2 @@ -3770,7 +3805,7 @@ packages: /http-proxy/1.18.1: dependencies: eventemitter3: 4.0.7 - follow-redirects: 1.13.2 + follow-redirects: 1.13.3 requires-port: 1.0.0 dev: false engines: @@ -3780,7 +3815,7 @@ packages: /http-proxy/1.18.1_debug@4.3.1: dependencies: eventemitter3: 4.0.7 - follow-redirects: 1.13.2_debug@4.3.1 + follow-redirects: 1.13.3_debug@4.3.1 requires-port: 1.0.0 dev: false engines: @@ -3800,15 +3835,6 @@ packages: npm: '>=1.3.7' resolution: integrity: sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= - /https-proxy-agent/3.0.1: - dependencies: - agent-base: 4.3.0 - debug: 3.2.7 - dev: false - engines: - node: '>= 4.5.0' - resolution: - integrity: sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg== /https-proxy-agent/4.0.0: dependencies: agent-base: 5.1.1 @@ -3878,10 +3904,6 @@ packages: node: '>=0.8.19' resolution: integrity: sha1-khi5srkoojixPcT7a21XbyMUU+o= - /indexof/0.0.1: - dev: false - resolution: - integrity: sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10= /inflight/1.0.6: dependencies: once: 1.4.0 @@ -3911,6 +3933,12 @@ packages: node: '>= 0.10' resolution: integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== + /ip-regex/2.1.0: + dev: false + engines: + node: '>=4' + resolution: + integrity: sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= /ip/1.1.5: dev: false resolution: @@ -3933,6 +3961,10 @@ packages: dev: false resolution: integrity: sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + /is-bigint/1.0.1: + dev: false + resolution: + integrity: sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg== /is-binary-path/2.1.0: dependencies: binary-extensions: 2.2.0 @@ -3941,6 +3973,14 @@ packages: node: '>=8' resolution: integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + /is-boolean-object/1.1.0: + dependencies: + call-bind: 1.0.2 + dev: false + engines: + node: '>= 0.4' + resolution: + integrity: sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA== /is-buffer/1.1.6: dev: false resolution: @@ -3976,13 +4016,13 @@ packages: node: '>= 0.4' resolution: integrity: sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== - /is-docker/2.1.1: + /is-docker/2.2.0: dev: false engines: node: '>=8' hasBin: true resolution: - integrity: sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw== + integrity: sha512-K4GwB4i/HzhAzwP/XSlspzRdFTI9N8OxJOyOU7Y5Rz+p+WBokXWVWblaJeBkggthmoSV0OoGTH5thJNvplpkvQ== /is-extglob/2.1.1: dev: false engines: @@ -4042,6 +4082,12 @@ packages: node: '>= 0.4' resolution: integrity: sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== + /is-number-object/1.0.4: + dev: false + engines: + node: '>= 0.4' + resolution: + integrity: sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw== /is-number/7.0.0: dev: false engines: @@ -4050,14 +4096,14 @@ packages: integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== /is-reference/1.2.1: dependencies: - '@types/estree': 0.0.46 + '@types/estree': 0.0.47 dev: false resolution: integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== /is-regex/1.1.2: dependencies: call-bind: 1.0.2 - has-symbols: 1.0.1 + has-symbols: 1.0.2 dev: false engines: node: '>= 0.4' @@ -4087,24 +4133,24 @@ packages: integrity: sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY= /is-symbol/1.0.3: dependencies: - has-symbols: 1.0.1 + has-symbols: 1.0.2 dev: false engines: node: '>= 0.4' resolution: integrity: sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== - /is-typed-array/1.1.4: + /is-typed-array/1.1.5: dependencies: available-typed-arrays: 1.0.2 call-bind: 1.0.2 - es-abstract: 1.18.0-next.2 + es-abstract: 1.18.0 foreach: 2.0.5 - has-symbols: 1.0.1 + has-symbols: 1.0.2 dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-ILaRgn4zaSrVNXNGtON6iFNotXW3hAPF3+0fB1usg2jFlWqo5fEDdmJkz0zBfoi7Dgskr8Khi2xZ8cXqZEfXNA== + integrity: sha512-S+GRDgJlR3PyEbsX/Fobd9cqpZBuvUS+8asRqYDMLCb2qMzt1oz5m5oxQCxOgUDxiWsOVNi4yaF+/uvdlHlYug== /is-typedarray/1.0.0: dev: false resolution: @@ -4123,7 +4169,7 @@ packages: integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== /is-wsl/2.2.0: dependencies: - is-docker: 2.1.1 + is-docker: 2.2.0 dev: false engines: node: '>=8' @@ -4137,10 +4183,6 @@ packages: dev: false resolution: integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= - /isarray/2.0.1: - dev: false - resolution: - integrity: sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4= /isbinaryfile/4.0.6: dev: false engines: @@ -4177,11 +4219,11 @@ packages: integrity: sha512-vrRztU9VRRFDyC+aklfLoeXyNdTfga2EI3udDGn4cZ6fpSXpHLV9X6CHvfoMCPtggg8zvDDmC4b9xfu0z6/llA== /istanbul-lib-instrument/3.3.0: dependencies: - '@babel/generator': 7.12.13 - '@babel/parser': 7.12.14 + '@babel/generator': 7.13.9 + '@babel/parser': 7.13.13 '@babel/template': 7.12.13 - '@babel/traverse': 7.12.13 - '@babel/types': 7.12.13 + '@babel/traverse': 7.13.13 + '@babel/types': 7.13.14 istanbul-lib-coverage: 2.0.5 semver: 6.3.0 dev: false @@ -4191,8 +4233,8 @@ packages: integrity: sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA== /istanbul-lib-instrument/4.0.3: dependencies: - '@babel/core': 7.12.13 - '@istanbuljs/schema': 0.1.2 + '@babel/core': 7.13.14 + '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.0.0 semver: 6.3.0 dev: false @@ -4278,10 +4320,10 @@ packages: dev: false resolution: integrity: sha1-o6vicYryQaKykE+EpiWXDzia4yo= - /jquery/3.5.1: + /jquery/3.6.0: dev: false resolution: - integrity: sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg== + integrity: sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw== /js-tokens/4.0.0: dev: false resolution: @@ -4370,7 +4412,7 @@ packages: /jsonfile/4.0.0: dev: false optionalDependencies: - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 resolution: integrity: sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= /jsonparse/1.2.0: @@ -4408,10 +4450,10 @@ packages: '0': node >=0.6.0 resolution: integrity: sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= - /jsrsasign/10.1.5: + /jsrsasign/10.2.0: dev: false resolution: - integrity: sha512-xlCtvZ+S2fPnw6YQyPkgMZ1dgMJ02bmK5Rt1umpo/KThBP6Zzq9awzXU71NEw1NYxXmLFnjorpQYKLZzMdF3lg== + integrity: sha512-khMrV/10U02DRzmXhjuLQjddUF39GHndaJZ/3YiiKkbyEl1T5M6EQF9nQUq0DFVCHusmd/jl8TWl4mWt+1L5hg== /jssha/2.4.2: deprecated: jsSHA versions < 3.0.0 will no longer receive feature updates dev: false @@ -4421,10 +4463,10 @@ packages: dev: false resolution: integrity: sha512-QuruyBENDWdN4tZwJbQq7/eAK85FqrI4oDbXjy5IBhYD+2pTJyBUWZe8ctWaCkrV0gy6AaelgOZZBMeswEa/6Q== - /just-extend/4.1.1: + /just-extend/4.2.1: dev: false resolution: - integrity: sha512-aWgeGFW67BP3e5181Ep1Fv2v8z//iBJfrvyTnq8wG86vEESwmonn1zPBJ0VfmT9CJq2FIT0VsETtrNFm2a+SHA== + integrity: sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg== /jwa/1.4.1: dependencies: buffer-equal-constant-time: 1.0.1 @@ -4459,10 +4501,10 @@ packages: dev: false resolution: integrity: sha1-fYa9VmefWM5qhHBKZX3TkruoGnk= - /karma-chai/0.1.0_chai@4.3.0+karma@5.2.3: + /karma-chai/0.1.0_chai@4.3.4+karma@6.3.2: dependencies: - chai: 4.3.0 - karma: 5.2.3 + chai: 4.3.4 + karma: 6.3.2 dev: false peerDependencies: chai: '*' @@ -4488,10 +4530,10 @@ packages: node: '>=10.0.0' resolution: integrity: sha512-atDvLQqvPcLxhED0cmXYdsPMCQuh6Asa9FMZW1bhNqlVEhJoB9qyZ2BY1gu7D/rr5GLGb5QzYO4siQskxaWP/g== - /karma-edge-launcher/0.4.2_karma@5.2.3: + /karma-edge-launcher/0.4.2_karma@6.3.2: dependencies: edge-launcher: 1.2.2 - karma: 5.2.3 + karma: 6.3.2 dev: false engines: node: '>=4' @@ -4509,18 +4551,18 @@ packages: dev: false resolution: integrity: sha512-Fi7xPhwrRgr+94BnHX0F5dCl1miIW4RHnzjIGxF8GaIEp7rNqX7LSi7ok63VXs3PS/5MQaQMhGxw+bvD+pibBQ== - /karma-ie-launcher/1.0.0_karma@5.2.3: + /karma-ie-launcher/1.0.0_karma@6.3.2: dependencies: - karma: 5.2.3 - lodash: 4.17.20 + karma: 6.3.2 + lodash: 4.17.21 dev: false peerDependencies: karma: '>=0.9' resolution: integrity: sha1-SXmGhCxJAZA0bNifVJTKmDDG1Zw= - /karma-json-preprocessor/0.3.3_karma@5.2.3: + /karma-json-preprocessor/0.3.3_karma@6.3.2: dependencies: - karma: 5.2.3 + karma: 6.3.2 dev: false peerDependencies: karma: '>=0.9' @@ -4532,9 +4574,9 @@ packages: dev: false resolution: integrity: sha512-kNCi+0UrXAeTJMpMsHkHNbfmlErsYT+/haNakJIhsE/gtj3Jx7zWRg7BTc1HHSbH5KeVXVRJr3/KLB/NHWY7Hg== - /karma-junit-reporter/2.0.1_karma@5.2.3: + /karma-junit-reporter/2.0.1_karma@6.3.2: dependencies: - karma: 5.2.3 + karma: 6.3.2 path-is-absolute: 1.0.1 xmlbuilder: 12.0.0 dev: false @@ -4544,10 +4586,10 @@ packages: karma: '>=0.9' resolution: integrity: sha512-VtcGfE0JE4OE1wn0LK8xxDKaTP7slN8DO3I+4xg6gAi1IoAHAXOJ1V9G/y45Xg6sxdxPOR3THCFtDlAfBo9Afw== - /karma-mocha-reporter/2.2.5_karma@5.2.3: + /karma-mocha-reporter/2.2.5_karma@6.3.2: dependencies: chalk: 2.4.2 - karma: 5.2.3 + karma: 6.3.2 log-symbols: 2.2.0 strip-ansi: 4.0.0 dev: false @@ -4561,10 +4603,10 @@ packages: dev: false resolution: integrity: sha512-Tzd5HBjm8his2OA4bouAsATYEpZrp9vC7z5E5j4C5Of5Rrs1jY67RAwXNcVmd/Bnk1wgvQRou0zGVLey44G4tQ== - /karma-rollup-preprocessor/7.0.5_rollup@1.32.1: + /karma-rollup-preprocessor/7.0.7_rollup@1.32.1: dependencies: chokidar: 3.5.1 - debounce: 1.2.0 + debounce: 1.2.1 rollup: 1.32.1 dev: false engines: @@ -4572,7 +4614,7 @@ packages: peerDependencies: rollup: '>= 1.0.0' resolution: - integrity: sha512-VhZI81l8LZBvBrSf4xaojsbur7bcycsSlxXkYaTOjV6DQwx1gtAM0CQVdue7LuIbXB1AohYIg0S5at+dqDtMxQ== + integrity: sha512-Y1QwsTCiCBp8sSALZdqmqry/mWIWIy0V6zonUIpy+0/D/Kpb2XZvR+JZrWfacQvcvKQdZFJvg6EwlnKtjepu3Q== /karma-source-map-support/1.4.0: dependencies: source-map-support: 0.5.19 @@ -4581,11 +4623,11 @@ packages: integrity: sha512-RsBECncGO17KAoJCYXjv+ckIz+Ii9NCi+9enk+rq6XC81ezYkb4/RHE6CTXdA7IOJqoF3wcaLfVG0CPmE5ca6A== /karma-sourcemap-loader/0.3.8: dependencies: - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 dev: false resolution: integrity: sha512-zorxyAakYZuBcHRJE+vbrK2o2JXLFWK8VVjiT/6P+ltLBUGUvqTEkUiQ119MGdOrK7mrmxXHZF1/pfT6GgIZ6g== - /karma/5.2.3: + /karma/6.3.2: dependencies: body-parser: 1.19.0 braces: 3.0.2 @@ -4595,28 +4637,28 @@ packages: di: 0.0.1 dom-serialize: 2.2.1 glob: 7.1.6 - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 http-proxy: 1.18.1 isbinaryfile: 4.0.6 - lodash: 4.17.20 + lodash: 4.17.21 log4js: 6.3.0 - mime: 2.5.0 + mime: 2.5.2 minimatch: 3.0.4 qjobs: 1.2.0 range-parser: 1.2.1 rimraf: 3.0.2 - socket.io: 2.4.1 + socket.io: 3.1.2 source-map: 0.6.1 tmp: 0.2.1 - ua-parser-js: 0.7.22 - yargs: 15.4.1 + ua-parser-js: 0.7.27 + yargs: 16.2.0 dev: false engines: node: '>= 10' hasBin: true resolution: - integrity: sha512-tHdyFADhVVPBorIKCX8A37iLHxc6RBRphkSoQ+MLKdAtFn1k97tD8WUGi1KlEtDZKL3hui0qhsY9HXUfSNDYPQ== - /karma/5.2.3_debug@4.3.1: + integrity: sha512-fo4Wt0S99/8vylZMxNj4cBFyOBBnC1bewZ0QOlePij/2SZVWxqbyLeIddY13q6URa2EpLRW8ixvFRUMjkmo1bw== + /karma/6.3.2_debug@4.3.1: dependencies: body-parser: 1.19.0 braces: 3.0.2 @@ -4626,21 +4668,21 @@ packages: di: 0.0.1 dom-serialize: 2.2.1 glob: 7.1.6 - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 http-proxy: 1.18.1_debug@4.3.1 isbinaryfile: 4.0.6 - lodash: 4.17.20 + lodash: 4.17.21 log4js: 6.3.0 - mime: 2.5.0 + mime: 2.5.2 minimatch: 3.0.4 qjobs: 1.2.0 range-parser: 1.2.1 rimraf: 3.0.2 - socket.io: 2.4.1 + socket.io: 3.1.2 source-map: 0.6.1 tmp: 0.2.1 - ua-parser-js: 0.7.22 - yargs: 15.4.1 + ua-parser-js: 0.7.27 + yargs: 16.2.0 dev: false engines: node: '>= 10' @@ -4648,16 +4690,16 @@ packages: peerDependencies: debug: '*' resolution: - integrity: sha512-tHdyFADhVVPBorIKCX8A37iLHxc6RBRphkSoQ+MLKdAtFn1k97tD8WUGi1KlEtDZKL3hui0qhsY9HXUfSNDYPQ== - /keytar/7.3.0: + integrity: sha512-fo4Wt0S99/8vylZMxNj4cBFyOBBnC1bewZ0QOlePij/2SZVWxqbyLeIddY13q6URa2EpLRW8ixvFRUMjkmo1bw== + /keytar/7.6.0: dependencies: node-addon-api: 3.1.0 - prebuild-install: 6.0.0 + prebuild-install: 6.1.1 dev: false optional: true requiresBuild: true resolution: - integrity: sha512-t8YD0ETO5AeRxCaaN4N/hzj3JusIH0ugjVooE724+ozaVG9+l16Mau62T+U8tEhCv7SozY/g69BWF1U+o47qJg== + integrity: sha512-H3cvrTzWb11+iv0NOAnoNAPgEapVZnYLVHZQyxmh7jdmVfR/c0jNNFEZ6AI38W/4DeTGTaY66ZX4Z1SbfKPvCQ== /lazy-ass/1.6.0: dev: false engines: @@ -4684,7 +4726,7 @@ packages: integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== /load-json-file/2.0.0: dependencies: - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 parse-json: 2.2.0 pify: 2.3.0 strip-bom: 3.0.0 @@ -4695,7 +4737,7 @@ packages: integrity: sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= /load-json-file/4.0.0: dependencies: - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 parse-json: 4.0.0 pify: 3.0.0 strip-bom: 3.0.0 @@ -4722,14 +4764,14 @@ packages: node: '>=6' resolution: integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== - /locate-path/5.0.0: - dependencies: - p-locate: 4.1.0 + /lodash.clonedeep/4.5.0: dev: false - engines: - node: '>=8' resolution: - integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + integrity: sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= + /lodash.flatten/4.4.0: + dev: false + resolution: + integrity: sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= /lodash.flattendeep/4.4.0: dev: false resolution: @@ -4778,10 +4820,14 @@ packages: dev: false resolution: integrity: sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= - /lodash/4.17.20: + /lodash.truncate/4.4.2: + dev: false + resolution: + integrity: sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= + /lodash/4.17.21: dev: false resolution: - integrity: sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== + integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== /log-symbols/2.2.0: dependencies: chalk: 2.4.2 @@ -4803,7 +4849,7 @@ packages: date-format: 3.0.0 debug: 4.3.1 flatted: 2.0.2 - rfdc: 1.2.0 + rfdc: 1.3.0 streamroller: 2.2.4 dev: false engines: @@ -4948,20 +4994,20 @@ packages: node: '>=8' resolution: integrity: sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== - /mime-db/1.45.0: + /mime-db/1.47.0: dev: false engines: node: '>= 0.6' resolution: - integrity: sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w== - /mime-types/2.1.28: + integrity: sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw== + /mime-types/2.1.30: dependencies: - mime-db: 1.45.0 + mime-db: 1.47.0 dev: false engines: node: '>= 0.6' resolution: - integrity: sha512-0TO2yJ5YHYr7M2zzT7gDU1tbwHxEUWBCLt0lscSNpcdAfFyJOVEpRYNS7EXVcTLNj/25QO8gulHC5JtTzSE2UQ== + integrity: sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg== /mime/1.6.0: dev: false engines: @@ -4969,13 +5015,13 @@ packages: hasBin: true resolution: integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - /mime/2.5.0: + /mime/2.5.2: dev: false engines: node: '>=4.0.0' hasBin: true resolution: - integrity: sha512-ft3WayFSFUVBuJj7BMLKAQcSlItKtfjsKDDsii3rqFDAZ7t11zRe8ASw/GlmivGwVUYtwkQrxiGGpL6gFvB0ag== + integrity: sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg== /mimic-fn/2.1.0: dev: false engines: @@ -5101,21 +5147,21 @@ packages: dev: false resolution: integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - /msal/1.4.5: + /msal/1.4.9: dependencies: tslib: 1.14.1 dev: false engines: node: '>=0.8.0' resolution: - integrity: sha512-tKn7j7QXfH5GHtOQ2edbFmylN8z8g2bfBWU3tmZ/b09fXDQt+pelfQ0NKNu1hso83sLXjEKHF1XIbjAqVGYSsA== - /nanoid/3.1.20: + integrity: sha512-UPNG8AgGAWJbW6JbY2K8EYrrAbSmFrXicdk6Klpfy7u6Lszhop+5vi2eWGmM39ul7DQfq5p2qUlehAMF5yb2Vg== + /nanoid/3.1.22: dev: false engines: node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1 hasBin: true resolution: - integrity: sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw== + integrity: sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ== /napi-build-utils/1.0.2: dev: false optional: true @@ -5139,48 +5185,48 @@ packages: dev: false resolution: integrity: sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug== - /netmask/1.0.6: + /netmask/2.0.2: dev: false engines: node: '>= 0.4.0' resolution: - integrity: sha1-ICl+idhvb2QA8lDZ9Pa0wZRfzTU= + integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg== /nice-try/1.0.5: dev: false resolution: integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== - /nise/4.0.4: + /nise/4.1.0: dependencies: '@sinonjs/commons': 1.8.2 '@sinonjs/fake-timers': 6.0.1 '@sinonjs/text-encoding': 0.7.1 - just-extend: 4.1.1 + just-extend: 4.2.1 path-to-regexp: 1.8.0 dev: false resolution: - integrity: sha512-bTTRUNlemx6deJa+ZyoCUTRvH3liK5+N6VQZ4NIw90AgDXY6iPnsqplNFf6STcj+ePk0H/xqxnP75Lr0J0Fq3A== + integrity: sha512-eQMEmGN/8arp0xsvGoQ+B1qvSkR73B1nWSCh7nOt5neMCtwcQVYQGdzQMhcNscktTsWB54xnlSQFzOAPJD8nXA== /nock/12.0.3: dependencies: debug: 4.3.1 json-stringify-safe: 5.0.1 - lodash: 4.17.20 + lodash: 4.17.21 propagate: 2.0.1 dev: false engines: node: '>= 10.13' resolution: integrity: sha512-QNb/j8kbFnKCiyqi9C5DD0jH/FubFGj5rt9NQFONXwQm3IPB0CULECg/eS3AU1KgZb/6SwUa4/DTRKhVxkGABw== - /node-abi/2.19.3: + /node-abi/2.21.0: dependencies: semver: 5.7.1 dev: false optional: true resolution: - integrity: sha512-9xZrlyfvKhWme2EXFKQhZRp1yNWT/uI1luYPr3sFl+H4keYY4xR+1jO7mvTTijIsHf1M+QDe9uWuKeEpLInIlg== - /node-abort-controller/1.1.0: + integrity: sha512-smhrivuPqEM3H5LmnY3KU6HfYv0u4QklgAxfFyRNujKUzbUcYZ+Jc2EhukB9SRcD2VpqhxM7n/MIcp1Ua1/JMg== + /node-abort-controller/1.2.1: dev: false resolution: - integrity: sha512-dEYmUqjtbivotqjraOe8UvhT/poFfog1BQRNsZm/MSEDDESk2cQ1tvD8kGyuN07TM/zoW+n42odL8zTeJupYdQ== + integrity: sha512-79PYeJuj6S9+yOHirR0JBLFOgjB6sQCir10uN6xRx25iD+ZD4ULqgRn3MwWBRaQGB0vEgReJzWwJo42T1R6YbQ== /node-addon-api/3.1.0: dev: false optional: true @@ -5188,7 +5234,7 @@ packages: integrity: sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw== /node-environment-flags/1.0.6: dependencies: - object.getownpropertydescriptors: 2.1.1 + object.getownpropertydescriptors: 2.1.2 semver: 5.7.1 dev: false resolution: @@ -5199,6 +5245,10 @@ packages: node: 4.x || >=6.0.0 resolution: integrity: sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + /node-releases/1.1.71: + dev: false + resolution: + integrity: sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg== /noop-logger/0.1.1: dev: false optional: true @@ -5206,8 +5256,8 @@ packages: integrity: sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI= /normalize-package-data/2.5.0: dependencies: - hosted-git-info: 2.8.8 - resolve: 1.19.0 + hosted-git-info: 2.8.9 + resolve: 1.20.0 semver: 5.7.1 validate-npm-package-license: 3.0.4 dev: false @@ -5237,7 +5287,7 @@ packages: pidtree: 0.3.1 read-pkg: 3.0.0 shell-quote: 1.7.2 - string.prototype.padend: 3.1.1 + string.prototype.padend: 3.1.2 dev: false engines: node: '>= 4' @@ -5326,7 +5376,7 @@ packages: dependencies: define-properties: 1.1.3 function-bind: 1.1.1 - has-symbols: 1.0.1 + has-symbols: 1.0.2 object-keys: 1.1.1 dev: false engines: @@ -5337,34 +5387,34 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 - has-symbols: 1.0.1 + has-symbols: 1.0.2 object-keys: 1.1.1 dev: false engines: node: '>= 0.4' resolution: integrity: sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== - /object.getownpropertydescriptors/2.1.1: + /object.getownpropertydescriptors/2.1.2: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 - es-abstract: 1.18.0-next.2 + es-abstract: 1.18.0 dev: false engines: node: '>= 0.8' resolution: - integrity: sha512-6DtXgZ/lIZ9hqx4GtZETobXLR/ZLaa0aqV0kzbn80Rf8Z2e/XFnhA0I7p07N2wH8bBBltr2xQPi6sbKWAY2Eng== - /object.values/1.1.2: + integrity: sha512-WtxeKSzfBjlzL+F9b7M7hewDzMwy+C8NRssHd1YrNlzHzIDrXcXiNOMrezdAEM4UXixgV+vvnyBeN7Rygl2ttQ== + /object.values/1.1.3: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 - es-abstract: 1.18.0-next.2 + es-abstract: 1.18.0 has: 1.0.3 dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-MYC0jvJopr8EK6dPBiO8Nb9mvjdypOachO5REGk6MXzujbBrAisKo3HmdEI6kZDL6fC31Mwee/5YbtMebixeag== + integrity: sha512-nkF6PfDB9alkOUxpf1HNm/QlkeW3SReqL5WXeBLpEJJnlPSvRaDQpW3gQTksTN3fgJX4hL42RzKyOin6ff3tyw== /on-finished/2.3.0: dependencies: ee-first: 1.1.1 @@ -5387,15 +5437,15 @@ packages: node: '>=6' resolution: integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - /open/7.4.0: + /open/7.4.2: dependencies: - is-docker: 2.1.1 + is-docker: 2.2.0 is-wsl: 2.2.0 dev: false engines: node: '>=8' resolution: - integrity: sha512-PGoBCX/lclIWlpS/R2PQuIR4NJoXh6X5AwVzE7WXnWRGvHg7+4TBCgsujUgiPpm0K1y4qvQeWnCWVTpTKZBtvA== + integrity: sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q== /optionator/0.8.3: dependencies: deep-is: 0.1.3 @@ -5466,14 +5516,6 @@ packages: node: '>=6' resolution: integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== - /p-locate/4.1.0: - dependencies: - p-limit: 2.3.0 - dev: false - engines: - node: '>=8' - resolution: - integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== /p-try/1.0.0: dev: false engines: @@ -5486,32 +5528,35 @@ packages: node: '>=6' resolution: integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - /pac-proxy-agent/3.0.1: + /pac-proxy-agent/4.1.0: dependencies: - agent-base: 4.3.0 + '@tootallnate/once': 1.1.2 + agent-base: 6.0.2 debug: 4.3.1 - get-uri: 2.0.4 - http-proxy-agent: 2.1.0 - https-proxy-agent: 3.0.1 - pac-resolver: 3.0.0 + get-uri: 3.0.2 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.0 + pac-resolver: 4.2.0 raw-body: 2.4.1 - socks-proxy-agent: 4.0.2 + socks-proxy-agent: 5.0.0 dev: false + engines: + node: '>= 6' resolution: - integrity: sha512-44DUg21G/liUZ48dJpUSjZnFfZro/0K5JTyFYLBcmh9+T6Ooi4/i4efwUiEy0+4oQusCBqWdhv16XohIj1GqnQ== - /pac-resolver/3.0.0: + integrity: sha512-ejNgYm2HTXSIYX9eFlkvqFp8hyJ374uDf0Zq5YUAifiSh1D6fo+iBivQZirGvVv8dCYUsLhmLBRhlAYvBKI5+Q== + /pac-resolver/4.2.0: dependencies: - co: 4.6.0 - degenerator: 1.0.4 + degenerator: 2.2.0 ip: 1.1.5 - netmask: 1.0.6 - thunkify: 2.1.2 + netmask: 2.0.2 dev: false + engines: + node: '>= 6' resolution: - integrity: sha512-tcc38bsjuE3XZ5+4vP96OfhOugrX+JcnpUbhfuc4LuXBLQhoTthOstZeoQJBDnQUDYzYmdImKsbz0xSl1/9qeA== + integrity: sha512-rPACZdUyuxT5Io/gFKUeeZFfE5T7ve7cAkE5TUZRRfuKP0u5Hocwe48X7ZEm6mYB+bTB0Qf+xlVlA/RM/i6RCQ== /package-hash/3.0.0: dependencies: - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 hasha: 3.0.0 lodash.flattendeep: 4.4.0 release-zalgo: 1.0.0 @@ -5551,14 +5596,6 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= - /parseqs/0.0.6: - dev: false - resolution: - integrity: sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w== - /parseuri/0.0.6: - dev: false - resolution: - integrity: sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow== /parseurl/1.3.3: dev: false engines: @@ -5575,12 +5612,6 @@ packages: node: '>=4' resolution: integrity: sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= - /path-exists/4.0.0: - dev: false - engines: - node: '>=8' - resolution: - integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== /path-is-absolute/1.0.1: dev: false engines: @@ -5704,7 +5735,7 @@ packages: node: '>=4' resolution: integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== - /prebuild-install/6.0.0: + /prebuild-install/6.1.1: dependencies: detect-libc: 1.0.3 expand-template: 2.0.3 @@ -5712,7 +5743,7 @@ packages: minimist: 1.2.5 mkdirp-classic: 0.5.3 napi-build-utils: 1.0.2 - node-abi: 2.19.3 + node-abi: 2.21.0 noop-logger: 0.1.1 npmlog: 4.1.2 pump: 3.0.0 @@ -5720,14 +5751,13 @@ packages: simple-get: 3.1.0 tar-fs: 2.1.1 tunnel-agent: 0.6.0 - which-pm-runs: 1.0.0 dev: false engines: node: '>=6' hasBin: true optional: true resolution: - integrity: sha512-h2ZJ1PXHKWZpp1caLw0oX9sagVpL2YTk+ZwInQbQ3QqNd4J03O6MpFNmMTJlkfgPENWqe5kP0WjQLqz5OjLfsw== + integrity: sha512-M+cKwofFlHa5VpTWub7GLg5RLcunYIcLqtY5pKcls/u7xaAb8FrXZ520qY8rkpYy5xw90tYCyMO0MP5ggzR3Sw== /prelude-ls/1.1.2: dev: false engines: @@ -5747,6 +5777,13 @@ packages: hasBin: true resolution: integrity: sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== + /prettier/2.2.1: + dev: false + engines: + node: '>=10.13.0' + hasBin: true + resolution: + integrity: sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== /priorityqueuejs/1.0.0: dev: false resolution: @@ -5792,21 +5829,21 @@ packages: node: '>= 0.10' resolution: integrity: sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw== - /proxy-agent/3.1.1: + /proxy-agent/4.0.1: dependencies: - agent-base: 4.3.0 + agent-base: 6.0.2 debug: 4.3.1 - http-proxy-agent: 2.1.0 - https-proxy-agent: 3.0.1 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.0 lru-cache: 5.1.1 - pac-proxy-agent: 3.0.1 + pac-proxy-agent: 4.1.0 proxy-from-env: 1.1.0 - socks-proxy-agent: 4.0.2 + socks-proxy-agent: 5.0.0 dev: false engines: node: '>=6' resolution: - integrity: sha512-WudaR0eTsDx33O3EJE16PjBRZWcX8GqCEeERw1W3hZJgH/F2a46g7jty6UGty6NeJ4CKQy8ds2CJPMiyeqaTvw== + integrity: sha512-ODnQnW2jc/FUVwHHuaZEfN5otg/fMbvMxz9nMSUQfJ9JU7q2SZvSULSsjLloVgJOiv9yhc8GlNMKc4GkFmcVEA== /proxy-from-env/1.1.0: dev: false resolution: @@ -5841,13 +5878,13 @@ packages: debug: 4.3.1 extract-zip: 2.0.1 https-proxy-agent: 4.0.0 - mime: 2.5.0 + mime: 2.5.2 progress: 2.0.3 proxy-from-env: 1.1.0 rimraf: 3.0.2 tar-fs: 2.1.1 unbzip2-stream: 1.4.3 - ws: 7.4.3 + ws: 7.4.4 dev: false engines: node: '>=10.18.1' @@ -5860,24 +5897,26 @@ packages: node: '>=0.9' resolution: integrity: sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg== - /qs/6.5.2: + /qs/6.10.1: + dependencies: + side-channel: 1.0.4 dev: false engines: node: '>=0.6' resolution: - integrity: sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== - /qs/6.7.0: + integrity: sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg== + /qs/6.5.2: dev: false engines: node: '>=0.6' resolution: - integrity: sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== - /qs/6.9.6: + integrity: sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + /qs/6.7.0: dev: false engines: node: '>=0.6' resolution: - integrity: sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ== + integrity: sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== /query-string/5.1.1: dependencies: decode-uri-component: 0.2.0 @@ -5894,14 +5933,20 @@ packages: node: '>=0.4.x' resolution: integrity: sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= - /quote/0.4.0: + /querystring/0.2.1: + dev: false + engines: + node: '>=0.4.x' + resolution: + integrity: sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg== + /queue-microtask/1.2.3: dev: false resolution: - integrity: sha1-EIOSF/bBNiuJGUBE0psjP9fzLwE= - /ramda/0.26.1: + integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + /quote/0.4.0: dev: false resolution: - integrity: sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ== + integrity: sha1-EIOSF/bBNiuJGUBE0psjP9fzLwE= /ramda/0.27.1: dev: false resolution: @@ -6049,7 +6094,7 @@ packages: integrity: sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ== /rechoir/0.6.2: dependencies: - resolve: 1.19.0 + resolve: 1.20.0 dev: false engines: node: '>= 0.10' @@ -6095,7 +6140,7 @@ packages: is-typedarray: 1.0.0 isstream: 0.1.2 json-stringify-safe: 5.0.1 - mime-types: 2.1.28 + mime-types: 2.1.30 oauth-sign: 0.9.0 performance-now: 2.1.0 qs: 6.5.2 @@ -6169,6 +6214,13 @@ packages: dev: false resolution: integrity: sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== + /resolve/1.20.0: + dependencies: + is-core-module: 2.2.0 + path-parse: 1.0.6 + dev: false + resolution: + integrity: sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== /resolve/1.8.1: dependencies: path-parse: 1.0.6 @@ -6182,10 +6234,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== - /rfdc/1.2.0: + /rfdc/1.3.0: dev: false resolution: - integrity: sha512-ijLyszTMmUrXvjSooucVQwimGUk84eRcmCuLV8Xghe3UO85mjUtRAHRyoMM6XtyqbECaXuBWx18La3523sXINA== + integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA== /rhea-promise/0.1.15: dependencies: debug: 3.2.7 @@ -6194,14 +6246,14 @@ packages: dev: false resolution: integrity: sha512-+6uilZXSJGyiqVeHQI3Krv6NTAd8cWRCY2uyCxmzR4/5IFtBqqFem1HV2OiwSj0Gu7OFChIJDfH2JyjN7J0vRA== - /rhea-promise/1.1.0: + /rhea-promise/1.2.1: dependencies: debug: 3.2.7 rhea: 1.0.24 tslib: 1.14.1 dev: false resolution: - integrity: sha512-LKcyeh7Df4q4wApcsi5+HhMI7T636y0hz+5qVI9ESZi0D6SnFPRbefWzYQXCZmqvLgWeTOyKQbjJaJFSYp2kAA== + integrity: sha512-m0aa+/TM6Cl5qu+mHNPn7aadNf1525WxpKwQKINP/knvoi4otB74G16iPDoTDbnGcJo1lc0AQEbVku8Gdoqmuw== /rhea/1.0.24: dependencies: debug: 3.2.7 @@ -6230,7 +6282,7 @@ packages: dependencies: builtin-modules: 2.0.0 is-module: 1.0.0 - resolve: 1.19.0 + resolve: 1.20.0 deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-node-resolve. dev: false resolution: @@ -6265,10 +6317,10 @@ packages: rollup: '>=0.66.0 <3' resolution: integrity: sha512-1pkwkervMJQGFYvM9nscrUoncPwiKR/K+bHdjv6PFgRo3cgPHoRT83y2Aa3GvINj4539S15t/tpFPb775TDs6w== - /rollup-plugin-visualizer/4.2.0_rollup@1.32.1: + /rollup-plugin-visualizer/4.2.2_rollup@1.32.1: dependencies: - nanoid: 3.1.20 - open: 7.4.0 + nanoid: 3.1.22 + open: 7.4.2 rollup: 1.32.1 source-map: 0.7.3 yargs: 16.2.0 @@ -6279,7 +6331,7 @@ packages: peerDependencies: rollup: '>=1.20.0' resolution: - integrity: sha512-xjfvoK4x0G7lBT3toMx8K/9tkCEWhRehnSJnn+PLY3Hjk8sNvyo407b68Cd3hdV9j42xcb8HXt0ZrmRi5NWeaQ== + integrity: sha512-10/TsugsaQL5rdynl0lrklBngTtkRBESZdxUJy+3fN+xKqNdg5cr7JQU1OoPx4p5mhQ+nspa6EvX3qc8SsBvnA== /rollup-pluginutils/2.8.2: dependencies: estree-walker: 0.6.1 @@ -6288,17 +6340,19 @@ packages: integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== /rollup/1.32.1: dependencies: - '@types/estree': 0.0.46 - '@types/node': 10.17.51 + '@types/estree': 0.0.47 + '@types/node': 14.14.37 acorn: 7.4.1 dev: false hasBin: true resolution: integrity: sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A== - /run-parallel/1.1.10: + /run-parallel/1.2.0: + dependencies: + queue-microtask: 1.2.3 dev: false resolution: - integrity: sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw== + integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== /safe-buffer/5.1.2: dev: false resolution: @@ -6340,7 +6394,7 @@ packages: hasBin: true resolution: integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== - /semver/7.3.4: + /semver/7.3.5: dependencies: lru-cache: 6.0.0 dev: false @@ -6348,7 +6402,7 @@ packages: node: '>=10' hasBin: true resolution: - integrity: sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + integrity: sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== /send/0.17.1: dependencies: debug: 2.6.9 @@ -6447,6 +6501,14 @@ packages: hasBin: true resolution: integrity: sha512-nZJ3HFWVoTSyyB+evEKjJ1STiixGztlqwKLTUNV5KqMWtGey9fTd4KU1gdZ1X9BV6215pswQ/Jew9NsuS/fNDA== + /side-channel/1.0.4: + dependencies: + call-bind: 1.0.2 + get-intrinsic: 1.1.1 + object-inspect: 1.9.0 + dev: false + resolution: + integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== /signal-exit/3.0.3: dev: false resolution: @@ -6471,7 +6533,7 @@ packages: '@sinonjs/fake-timers': 6.0.1 '@sinonjs/samsam': 5.3.1 diff: 4.0.2 - nise: 4.0.4 + nise: 4.1.0 supports-color: 7.2.0 dev: false resolution: @@ -6513,12 +6575,12 @@ packages: node: '>=6' resolution: integrity: sha512-bdwNOAGuKwPU+qsn0ASxTv+QfkXU+3VmkcDOkt965tes+JQQc8d6SfoLiEiRVhCey4v+ip2IjNUSbZm5nnkI9g== - /snap-shot-core/10.2.1: + /snap-shot-core/10.2.4: dependencies: - arg: 4.1.0 + arg: 4.1.3 check-more-types: 2.24.0 common-tags: 1.8.0 - debug: 4.1.1 + debug: 4.3.1 escape-quotes: 1.0.2 folktale: 2.3.2 is-ci: 2.0.0 @@ -6527,97 +6589,81 @@ packages: mkdirp: 1.0.4 pluralize: 8.0.0 quote: 0.4.0 - ramda: 0.26.1 + ramda: 0.27.1 dev: false engines: node: '>=6' hasBin: true resolution: - integrity: sha512-fApr6/GQi7kfLyperpF70SxG9mp9L3gQgb3czXH97iuix1QrfThS9kATx43r3wIl0Ik5sWmWvor/Xcb3+2cteQ== - /snap-shot-it/7.9.4: + integrity: sha512-A7tkcfmvnRKge4VzFLAWA4UYMkvFY4TZKyL+D6hnHjI3HJ4pTepjG5DfR2ACeDKMzCSTQ5EwR2iOotI+Z37zsg== + /snap-shot-it/7.9.6: dependencies: '@bahmutov/data-driven': 1.0.0 check-more-types: 2.24.0 common-tags: 1.8.0 - debug: 4.1.1 + debug: 4.3.1 has-only: 1.1.1 its-name: 1.0.0 lazy-ass: 1.6.0 pluralize: 8.0.0 ramda: 0.27.1 snap-shot-compare: 3.0.0 - snap-shot-core: 10.2.1 + snap-shot-core: 10.2.4 dev: false engines: node: '>=6' resolution: - integrity: sha512-Pp7UJDFqiB4QrOdSGlmrEDh4yBdGB5V0cxHNy3Mn1mmGOYSCnsxEYCI5ls/sm7Ekeg9PuiO4GihLRcjkf+9xfg== - /socket.io-adapter/1.1.2: - dev: false - resolution: - integrity: sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g== - /socket.io-client/2.4.0: - dependencies: - backo2: 1.0.2 - component-bind: 1.0.0 - component-emitter: 1.3.0 - debug: 3.1.0 - engine.io-client: 3.5.0 - has-binary2: 1.0.3 - indexof: 0.0.1 - parseqs: 0.0.6 - parseuri: 0.0.6 - socket.io-parser: 3.3.2 - to-array: 0.1.4 + integrity: sha512-t/ADZfQ8EUk4J76S5cmynye7qg1ecUFqQfANiOMNy0sFmYUaqfx9K/AWwpdcpr3vFsDptM+zSuTtKD0A1EOLqA== + /socket.io-adapter/2.1.0: dev: false resolution: - integrity: sha512-M6xhnKQHuuZd4Ba9vltCLT9oa+YvTsP8j9NcEiLElfIg8KeYPyhWOes6x4t+LTAC8enQbE/995AdTem2uNyKKQ== - /socket.io-parser/3.3.2: + integrity: sha512-+vDov/aTsLjViYTwS9fPy5pEtTkrbEKsw2M+oVSoFGw6OD1IpvlV1VPhUzNbofCQ8oyMbdYJqDtGdmHQK6TdPg== + /socket.io-parser/4.0.4: dependencies: + '@types/component-emitter': 1.2.10 component-emitter: 1.3.0 - debug: 3.1.0 - isarray: 2.0.1 - dev: false - resolution: - integrity: sha512-FJvDBuOALxdCI9qwRrO/Rfp9yfndRtc1jSgVgV8FDraihmSP/MLGD5PEuJrNfjALvcQ+vMDM/33AWOYP/JSjDg== - /socket.io-parser/3.4.1: - dependencies: - component-emitter: 1.2.1 - debug: 4.1.1 - isarray: 2.0.1 + debug: 4.3.1 dev: false + engines: + node: '>=10.0.0' resolution: - integrity: sha512-11hMgzL+WCLWf1uFtHSNvliI++tcRUWdoeYuwIl+Axvwy9z2gQM+7nJyN3STj1tLj5JyIUH8/gpDGxzAlDdi0A== - /socket.io/2.4.1: + integrity: sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g== + /socket.io/3.1.2: dependencies: - debug: 4.1.1 - engine.io: 3.5.0 - has-binary2: 1.0.3 - socket.io-adapter: 1.1.2 - socket.io-client: 2.4.0 - socket.io-parser: 3.4.1 + '@types/cookie': 0.4.0 + '@types/cors': 2.8.10 + '@types/node': 14.14.37 + accepts: 1.3.7 + base64id: 2.0.0 + debug: 4.3.1 + engine.io: 4.1.1 + socket.io-adapter: 2.1.0 + socket.io-parser: 4.0.4 dev: false + engines: + node: '>=10.0.0' resolution: - integrity: sha512-Si18v0mMXGAqLqCVpTxBa8MGqriHGQh8ccEOhmsmNS3thNCGBwO8WGrwMibANsWtQQ5NStdZwHqZR3naJVFc3w== - /socks-proxy-agent/4.0.2: + integrity: sha512-JubKZnTQ4Z8G4IZWtaAZSiRP3I/inpy8c/Bsx2jrwGrTbKeVU5xd6qkKMHpChYeM3dWZSO0QACiGK+obhBNwYw== + /socks-proxy-agent/5.0.0: dependencies: - agent-base: 4.2.1 - socks: 2.3.3 + agent-base: 6.0.2 + debug: 4.3.1 + socks: 2.6.0 dev: false engines: node: '>= 6' resolution: - integrity: sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg== - /socks/2.3.3: + integrity: sha512-lEpa1zsWCChxiynk+lCycKuC502RxDWLKJZoIhnxrWNjLSDGYRFflHA1/228VkRcnv9TIb8w98derGbpKxJRgA== + /socks/2.6.0: dependencies: ip: 1.1.5 smart-buffer: 4.1.0 dev: false engines: - node: '>= 6.0.0' + node: '>= 10.13.0' npm: '>= 3.0.0' resolution: - integrity: sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA== + integrity: sha512-mNmr9owlinMplev0Wd7UHFlqI4ofnBnNzFuzrm63PPaHgbkqCFe4T5LzwKmtQ/f2tX0NTpcdVLyD/FHxFBstYw== /source-map-resolve/0.5.3: dependencies: atob: 2.1.2 @@ -6721,6 +6767,13 @@ packages: node: '>= 0.6' resolution: integrity: sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= + /stoppable/1.1.0: + dev: false + engines: + node: '>=4' + npm: '>=6' + resolution: + integrity: sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw== /stream-browserify/2.0.2: dependencies: inherits: 2.0.4 @@ -6780,7 +6833,7 @@ packages: node: '>=6' resolution: integrity: sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== - /string-width/4.2.0: + /string-width/4.2.2: dependencies: emoji-regex: 8.0.0 is-fullwidth-code-point: 3.0.0 @@ -6789,31 +6842,31 @@ packages: engines: node: '>=8' resolution: - integrity: sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== - /string.prototype.padend/3.1.1: + integrity: sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== + /string.prototype.padend/3.1.2: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 - es-abstract: 1.18.0-next.2 + es-abstract: 1.18.0 dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-eCzTASPnoCr5Ht+Vn1YXgm8SB015hHKgEIMu9Nr9bQmLhRBxKRfmzSj/IQsxDFc8JInJDDFA0qXwK+xxI7wDkg== - /string.prototype.trimend/1.0.3: + integrity: sha512-/AQFLdYvePENU3W5rgurfWSMU6n+Ww8n/3cUt7E+vPBB/D7YDG8x+qjoFs4M/alR2bW7Qg6xMjVwWUOvuQ0XpQ== + /string.prototype.trimend/1.0.4: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 dev: false resolution: - integrity: sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw== - /string.prototype.trimstart/1.0.3: + integrity: sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A== + /string.prototype.trimstart/1.0.4: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 dev: false resolution: - integrity: sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg== + integrity: sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw== /string_decoder/0.10.31: dev: false resolution: @@ -6924,17 +6977,22 @@ packages: node: '>=8' resolution: integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - /table/6.0.7: + /table/6.0.9: dependencies: - ajv: 7.0.4 - lodash: 4.17.20 + ajv: 8.0.5 + is-boolean-object: 1.1.0 + is-number-object: 1.0.4 + is-string: 1.0.5 + lodash.clonedeep: 4.5.0 + lodash.flatten: 4.4.0 + lodash.truncate: 4.4.2 slice-ansi: 4.0.0 - string-width: 4.2.0 + string-width: 4.2.2 dev: false engines: node: '>=10.0.0' resolution: - integrity: sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g== + integrity: sha512-F3cLs9a3hL1Z7N4+EkSscsel3z55XT950AvB05bwayrNg5T1/gykXtigioTAjbltvbMSJvvhFCbnf6mX+ntnJQ== /tar-fs/2.1.1: dependencies: chownr: 1.1.4 @@ -6946,7 +7004,7 @@ packages: integrity: sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== /tar-stream/2.2.0: dependencies: - bl: 4.0.4 + bl: 4.1.0 end-of-stream: 1.4.4 fs-constants: 1.0.0 inherits: 2.0.4 @@ -6986,10 +7044,6 @@ packages: dev: false resolution: integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= - /thunkify/2.1.2: - dev: false - resolution: - integrity: sha1-+qDp0jDFGsyVyhOjYawFyn4EVT0= /timsort/0.3.0: dev: false resolution: @@ -7002,10 +7056,6 @@ packages: node: '>=8.17.0' resolution: integrity: sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== - /to-array/0.1.4: - dev: false - resolution: - integrity: sha1-F+bBH3PdTz10zaek/zI46a2b+JA= /to-fast-properties/2.0.0: dev: false engines: @@ -7035,6 +7085,16 @@ packages: node: '>=0.8' resolution: integrity: sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + /tough-cookie/3.0.1: + dependencies: + ip-regex: 2.1.0 + psl: 1.8.0 + punycode: 2.1.1 + dev: false + engines: + node: '>=6' + resolution: + integrity: sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg== /tough-cookie/4.0.0: dependencies: psl: 1.8.0 @@ -7051,22 +7111,23 @@ packages: dev: false resolution: integrity: sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= - /ts-node/8.10.2_typescript@4.1.2: + /ts-node/9.1.1_typescript@4.2.4: dependencies: arg: 4.1.3 + create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 source-map-support: 0.5.19 - typescript: 4.1.2 + typescript: 4.2.4 yn: 3.1.1 dev: false engines: - node: '>=6.0.0' + node: '>=10.0.0' hasBin: true peerDependencies: typescript: '>=2.7' resolution: - integrity: sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA== + integrity: sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== /tsconfig-paths/3.9.0: dependencies: '@types/json5': 0.0.29 @@ -7080,61 +7141,21 @@ packages: dev: false resolution: integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== - /tslib/2.1.0: - dev: false - resolution: - integrity: sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== - /tslint-config-prettier/1.18.0: - dev: false - engines: - node: '>=4.0.0' - hasBin: true - resolution: - integrity: sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg== - /tslint/5.20.1_typescript@4.1.2: - dependencies: - '@babel/code-frame': 7.12.13 - builtin-modules: 1.1.1 - chalk: 2.4.2 - commander: 2.20.3 - diff: 4.0.2 - glob: 7.1.6 - js-yaml: 3.14.1 - minimatch: 3.0.4 - mkdirp: 0.5.5 - resolve: 1.19.0 - semver: 5.7.1 - tslib: 1.14.1 - tsutils: 2.29.0_typescript@4.1.2 - typescript: 4.1.2 - dev: false - engines: - node: '>=4.8.0' - hasBin: true - peerDependencies: - typescript: '>=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev' - resolution: - integrity: sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg== - /tsutils/2.29.0_typescript@4.1.2: - dependencies: - tslib: 1.14.1 - typescript: 4.1.2 + /tslib/2.2.0: dev: false - peerDependencies: - typescript: '>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev' resolution: - integrity: sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== - /tsutils/3.20.0_typescript@4.1.2: + integrity: sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w== + /tsutils/3.21.0_typescript@4.2.4: dependencies: tslib: 1.14.1 - typescript: 4.1.2 + typescript: 4.2.4 dev: false engines: node: '>= 6' peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' resolution: - integrity: sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg== + integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== /tunnel-agent/0.6.0: dependencies: safe-buffer: 5.2.1 @@ -7173,6 +7194,12 @@ packages: node: '>=4' resolution: integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + /type-fest/0.20.2: + dev: false + engines: + node: '>=10' + resolution: + integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== /type-fest/0.8.1: dev: false engines: @@ -7182,7 +7209,7 @@ packages: /type-is/1.6.18: dependencies: media-typer: 0.3.0 - mime-types: 2.1.28 + mime-types: 2.1.30 dev: false engines: node: '>= 0.6' @@ -7191,9 +7218,9 @@ packages: /typedoc-default-themes/0.6.3: dependencies: backbone: 1.4.0 - jquery: 3.5.1 + jquery: 3.6.0 lunr: 2.3.9 - underscore: 1.12.0 + underscore: 1.12.1 dev: false engines: node: '>= 8' @@ -7203,53 +7230,69 @@ packages: dependencies: '@types/minimatch': 3.0.3 fs-extra: 8.1.0 - handlebars: 4.7.6 + handlebars: 4.7.7 highlight.js: 9.18.5 - lodash: 4.17.20 + lodash: 4.17.21 marked: 0.7.0 minimatch: 3.0.4 progress: 2.0.3 shelljs: 0.8.4 typedoc-default-themes: 0.6.3 - typescript: 3.7.5 + typescript: 3.7.7 dev: false engines: node: '>= 6.0.0' hasBin: true resolution: integrity: sha512-K2nFEtyDQTVdXOzYtECw3TwuT3lM91Zc0dzGSLuor5R8qzZbwqBoCw7xYGVBow6+mEZAvKGznLFsl7FzG+wAgQ== - /typescript/3.7.5: + /typescript/3.7.7: + dev: false + engines: + node: '>=4.2.0' + hasBin: true + resolution: + integrity: sha512-MmQdgo/XenfZPvVLtKZOq9jQQvzaUAUpcKW8Z43x9B2fOm4S5g//tPtMweZUIP+SoBqrVPEIm+dJeQ9dfO0QdA== + /typescript/3.9.9: dev: false engines: node: '>=4.2.0' hasBin: true resolution: - integrity: sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== - /typescript/3.9.7: + integrity: sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w== + /typescript/4.1.5: dev: false engines: node: '>=4.2.0' hasBin: true resolution: - integrity: sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== - /typescript/4.1.2: + integrity: sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== + /typescript/4.2.4: dev: false engines: node: '>=4.2.0' hasBin: true resolution: - integrity: sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ== - /ua-parser-js/0.7.22: + integrity: sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg== + /ua-parser-js/0.7.27: dev: false resolution: - integrity: sha512-YUxzMjJ5T71w6a8WWVcMGM6YWOTX27rCoIQgLXiWaxqXSx9D7DNjiGWn1aJIRSQ5qr0xuhra77bSIh6voR/46Q== - /uglify-js/3.12.6: + integrity: sha512-eXMaRYK2skomGocoX0x9sBXzx5A1ZVQgXfrW4mTc8dT0zS7olEcyfudAzRC5tIIRgLxQ69B6jut3DI+n5hslPA== + /uglify-js/3.13.3: dev: false engines: node: '>=0.8.0' hasBin: true resolution: - integrity: sha512-aqWHe3DfQmZUDGWBbabZ2eQnJlQd1fKlMUu7gV+MiTuDzdgDw31bI3wA2jLLsV/hNcDP26IfyEgSVoft5+0SVw== + integrity: sha512-otIc7O9LyxpUcQoXzj2hL4LPWKklO6LJWoJUzNa8A17Xgi4fOeDC8FBDOLHnC/Slo1CQgsZMcM6as0M76BZaig== + /unbox-primitive/1.0.1: + dependencies: + function-bind: 1.1.1 + has-bigints: 1.0.1 + has-symbols: 1.0.2 + which-boxed-primitive: 1.0.2 + dev: false + resolution: + integrity: sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== /unbzip2-stream/1.4.3: dependencies: buffer: 5.7.1 @@ -7257,10 +7300,10 @@ packages: dev: false resolution: integrity: sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg== - /underscore/1.12.0: + /underscore/1.12.1: dev: false resolution: - integrity: sha512-21rQzss/XPMjolTiIezSu3JAjgagXKROtNrYFEOWK109qY1Uv2tVjPTZ1ci2HgvQDA16gHYSthQIJfB+XId/rQ== + integrity: sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw== /underscore/1.8.3: dev: false resolution: @@ -7320,7 +7363,7 @@ packages: inherits: 2.0.4 is-arguments: 1.1.0 is-generator-function: 1.0.8 - is-typed-array: 1.1.4 + is-typed-array: 1.1.5 safe-buffer: 5.2.1 which-typed-array: 1.1.4 dev: false @@ -7342,10 +7385,10 @@ packages: hasBin: true resolution: integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== - /v8-compile-cache/2.2.0: + /v8-compile-cache/2.3.0: dev: false resolution: - integrity: sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q== + integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== /validate-npm-package-license/3.0.4: dependencies: spdx-correct: 3.1.1 @@ -7406,24 +7449,29 @@ packages: dev: false resolution: integrity: sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== - /which-module/2.0.0: + /which-boxed-primitive/1.0.2: + dependencies: + is-bigint: 1.0.1 + is-boolean-object: 1.1.0 + is-number-object: 1.0.4 + is-string: 1.0.5 + is-symbol: 1.0.3 dev: false resolution: - integrity: sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= - /which-pm-runs/1.0.0: + integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== + /which-module/2.0.0: dev: false - optional: true resolution: - integrity: sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs= + integrity: sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= /which-typed-array/1.1.4: dependencies: available-typed-arrays: 1.0.2 call-bind: 1.0.2 - es-abstract: 1.18.0-next.2 + es-abstract: 1.18.0 foreach: 2.0.5 function-bind: 1.1.1 - has-symbols: 1.0.1 - is-typed-array: 1.1.4 + has-symbols: 1.0.2 + is-typed-array: 1.1.5 dev: false engines: node: '>= 0.4' @@ -7471,20 +7519,10 @@ packages: node: '>=6' resolution: integrity: sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== - /wrap-ansi/6.2.0: - dependencies: - ansi-styles: 4.3.0 - string-width: 4.2.0 - strip-ansi: 6.0.0 - dev: false - engines: - node: '>=8' - resolution: - integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== /wrap-ansi/7.0.0: dependencies: ansi-styles: 4.3.0 - string-width: 4.2.0 + string-width: 4.2.2 strip-ansi: 6.0.0 dev: false engines: @@ -7497,13 +7535,13 @@ packages: integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= /write-file-atomic/2.4.3: dependencies: - graceful-fs: 4.2.4 + graceful-fs: 4.2.6 imurmurhash: 0.1.4 signal-exit: 3.0.3 dev: false resolution: integrity: sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== - /ws/7.4.3: + /ws/7.4.4: dev: false engines: node: '>=8.3.0' @@ -7516,7 +7554,7 @@ packages: utf-8-validate: optional: true resolution: - integrity: sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA== + integrity: sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw== /xhr-mock/2.5.1: dependencies: global: 4.4.0 @@ -7561,19 +7599,12 @@ packages: node: '>=4.0' resolution: integrity: sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0= - /xmldom/0.4.0: - deprecated: Deprecated due to CVE-2021-21366 resolved in 0.5.0 + /xmldom/0.5.0: dev: false engines: node: '>=10.0.0' resolution: - integrity: sha512-2E93k08T30Ugs+34HBSTQLVtpi6mCddaY8uO+pMNk1pqSjV5vElzn4mmh6KLxN3hki8rNcHSYzILoh3TEWORvA== - /xmlhttprequest-ssl/1.5.5: - dev: false - engines: - node: '>=0.4.0' - resolution: - integrity: sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4= + integrity: sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA== /xpath.js/1.1.0: dev: false engines: @@ -7584,16 +7615,16 @@ packages: dev: false resolution: integrity: sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM= - /y18n/4.0.1: + /y18n/4.0.3: dev: false resolution: - integrity: sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== - /y18n/5.0.5: + integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== + /y18n/5.0.8: dev: false engines: node: '>=10' resolution: - integrity: sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg== + integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== /yallist/2.1.2: dev: false resolution: @@ -7606,32 +7637,29 @@ packages: dev: false resolution: integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - /yargs-parser/13.1.2: - dependencies: - camelcase: 5.3.1 - decamelize: 1.2.0 + /yaml/1.10.2: dev: false + engines: + node: '>= 6' resolution: - integrity: sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== - /yargs-parser/18.1.3: + integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== + /yargs-parser/13.1.2: dependencies: camelcase: 5.3.1 decamelize: 1.2.0 dev: false - engines: - node: '>=6' resolution: - integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== - /yargs-parser/20.2.4: + integrity: sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== + /yargs-parser/20.2.7: dev: false engines: node: '>=10' resolution: - integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== + integrity: sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw== /yargs-unparser/1.6.0: dependencies: flat: 4.1.1 - lodash: 4.17.20 + lodash: 4.17.21 yargs: 13.3.2 dev: false engines: @@ -7648,38 +7676,20 @@ packages: set-blocking: 2.0.0 string-width: 3.1.0 which-module: 2.0.0 - y18n: 4.0.1 + y18n: 4.0.3 yargs-parser: 13.1.2 dev: false resolution: integrity: sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== - /yargs/15.4.1: - dependencies: - cliui: 6.0.0 - decamelize: 1.2.0 - find-up: 4.1.0 - get-caller-file: 2.0.5 - require-directory: 2.1.1 - require-main-filename: 2.0.0 - set-blocking: 2.0.0 - string-width: 4.2.0 - which-module: 2.0.0 - y18n: 4.0.1 - yargs-parser: 18.1.3 - dev: false - engines: - node: '>=8' - resolution: - integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== /yargs/16.2.0: dependencies: cliui: 7.0.4 escalade: 3.1.1 get-caller-file: 2.0.5 require-directory: 2.1.1 - string-width: 4.2.0 - y18n: 5.0.5 - yargs-parser: 20.2.4 + string-width: 4.2.2 + y18n: 5.0.8 + yargs-parser: 20.2.7 dev: false engines: node: '>=10' @@ -7692,10 +7702,6 @@ packages: dev: false resolution: integrity: sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk= - /yeast/0.1.2: - dev: false - resolution: - integrity: sha1-AI4G2AlDIMNy28L47XagymyKxBk= /yn/3.1.1: dev: false engines: @@ -7719,24 +7725,24 @@ packages: '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 assert: 1.5.0 cross-env: 7.0.3 delay: 4.4.1 downlevel-dts: 0.4.0 - eslint: 7.19.0 - karma: 5.2.3 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -7746,45 +7752,45 @@ packages: rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/abort-controller' resolution: - integrity: sha512-+o3sVHmEvCh0ezHz3KWwdUo1d444Wqgnzs88P49XJaejLjBGNMgsPPJcxrtgncDADyuKsnHS4643rnjzWJuYrg== + integrity: sha512-1VaqPBS+YkeUe/pXKV43zUAiFz2vKwP6UOF1hP+dhCe7SJ3uvoKNvGrnOtzmI1sT8VDfhhPezfUsxypmviNBtg== tarball: file:projects/abort-controller.tgz version: 0.0.0 file:projects/ai-anomaly-detector.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 - csv-parse: 4.15.1 + csv-parse: 4.15.3 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -7795,43 +7801,84 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 - tslib: 2.1.0 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/ai-anomaly-detector' resolution: - integrity: sha512-PZCerjQuCAQte4Q0znsG1jlfRw1y7mtdSLjQxYYl1fo2+/9S5Gh3riGid9/64EIammrIymTg0eEVmer+nuLWCg== + integrity: sha512-BSoBzszi0XM9x7Dv2vIqf1SCCP0HIvWzcqJgk8bryS3stf5oCFIVzJ5qpzlb8MLXhg/OiLCA1dwhTUOD0pwM8A== tarball: file:projects/ai-anomaly-detector.tgz version: 0.0.0 + file:projects/ai-document-translator.tgz: + dependencies: + '@azure/identity': 1.3.0 + '@microsoft/api-extractor': 7.13.2 + '@types/chai': 4.2.16 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + chai: 4.3.4 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-source-map-support: 1.4.0 + karma-sourcemap-loader: 0.3.8 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 2.2.1 + rimraf: 3.0.2 + rollup: 1.32.1 + source-map-support: 0.5.19 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + dev: false + name: '@rush-temp/ai-document-translator' + resolution: + integrity: sha512-dKk6kAyDxOTFMIn74Biij9flT5ae7+6AWKzuI9N5yJNEPWzXGHUndSYjFSt7O5/UsLClgfelyiqY0dAKxOiDLw== + tarball: file:projects/ai-document-translator.tgz + version: 0.0.0 file:projects/ai-form-recognizer.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + '@types/sinon': 9.0.11 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - karma: 5.2.3 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -7841,41 +7888,41 @@ packages: rollup: 1.32.1 sinon: 9.2.4 source-map-support: 0.5.19 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/ai-form-recognizer' resolution: - integrity: sha512-9xOseHY7PsxgELzLuuJg2YvbOosQQYKzLrTjJkz0PLryRjaPmY+y+SwdWh+ItprdabUwBznjkhhF+KP9Iq+eKQ== + integrity: sha512-HUMGckigflkhjr74AUhw1mA05fWVbje5nS218AdXl0wrFsvMURVAAWba/igZx+9FJWQHDTrvnXOpljDPv1YRiQ== tarball: file:projects/ai-form-recognizer.tgz version: 0.0.0 file:projects/ai-metrics-advisor.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + '@types/sinon': 9.0.11 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - karma: 5.2.3 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -7885,43 +7932,43 @@ packages: rollup: 1.32.1 sinon: 9.2.4 source-map-support: 0.5.19 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/ai-metrics-advisor' resolution: - integrity: sha512-sjvb9T7w/Lq6HYMMc+T6c6ALv9j2Q2LcZ33Ou92dZpxTJ0IKpjMDKBpO2K8E/1Qbs6gk6EkscQdmhNH+kAdITw== + integrity: sha512-sbco9iDzQIZH/W1ha+BQfthAqikz7j3Ykt755Uv6Vc/uRitcQdTYCKWTspEpS/TJS04RFBrQbFxVgfJQQIUlaA== tarball: file:projects/ai-metrics-advisor.tgz version: 0.0.0 file:projects/ai-text-analytics.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + '@types/sinon': 9.0.11 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - karma: 5.2.3 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-source-map-support: 1.4.0 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 @@ -7932,47 +7979,47 @@ packages: rollup: 1.32.1 sinon: 9.2.4 source-map-support: 0.5.19 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/ai-text-analytics' resolution: - integrity: sha512-+NHOEVzOlGo75S26z9PRSPQwzRtC0RdCN9jLfTlKoDJIU3Q41HfLT/pLhHoZ7x64UeqJpkdEMLUl7mssfKsoXQ== + integrity: sha512-99pEvJ4z5j42gxikMrqfl5owp5uDGFuNT9v5oVg2snIYHdmSNeYAawsMU4+WZD39+/c+EnInUT8fAn8mc5NvsA== tarball: file:projects/ai-text-analytics.tgz version: 0.0.0 file:projects/app-configuration.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-inject': 4.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -7985,44 +8032,45 @@ packages: rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 sinon: 9.2.4 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - uglify-js: 3.12.6 + typescript: 4.2.4 + uglify-js: 3.13.3 dev: false name: '@rush-temp/app-configuration' resolution: - integrity: sha512-yJDtTyHY5zn/FYWeUSqeDtNd3VSJUA5gpTfyf++Yb/UzqxP4NfsAK/JGKFHmOO22JwdL4Fe38e/to62LC7cH8A== + integrity: sha512-iItMzob++ct7sGjHGLQKISCJK+oW9NwDIucpCrPpEMt2MH2TyBaSHv4DOuDa2Y/jBtO9W4Hj0Fbt/aKXewREYw== tarball: file:projects/app-configuration.tgz version: 0.0.0 file:projects/attestation.tgz: dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 - '@types/jsrsasign': 8.0.9 + '@types/jsrsasign': 8.0.10 '@types/mocha': 7.0.2 '@types/node': 8.10.66 buffer: 5.7.1 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 dotenv: 8.2.0 - eslint: 7.19.0 - jsrsasign: 10.1.5 - karma: 5.2.3 + eslint: 7.23.0 + jsrsasign: 10.2.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-source-map-support: 1.4.0 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 @@ -8033,50 +8081,49 @@ packages: rollup-plugin-node-resolve: 3.4.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 safe-buffer: 5.2.1 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/attestation' resolution: - integrity: sha512-9jKCXnBFfSRuCq5M55p3cw7GB3Jdsxd8TxG+lsVZeWYnvEvYlY6ecZhBwEHmBrCoYksFAgJNVdvt9nQUarBRLA== + integrity: sha512-308IFrOUbXclBJTqvF46pGIb+PckBwJ9PufzEE3dbB8mA9JIj+9838qEppUW8x9k2ENMx43+T6/FCh15qXsTgg== tarball: file:projects/attestation.tgz version: 0.0.0 - file:projects/communication-administration.tgz: + file:projects/communication-chat.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 - '@microsoft/api-documenter': 7.8.56 + '@azure/communication-signaling': 1.0.0-beta.3 + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - events: 3.2.0 + eslint: 7.23.0 + events: 3.3.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8087,51 +8134,51 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 + util: 0.12.3 dev: false - name: '@rush-temp/communication-administration' + name: '@rush-temp/communication-chat' resolution: - integrity: sha512-DlH2e+6tExD7zxBhMDBu339Y/a/BkEdmdW33woggxl9qA3aQwX2YqdUHyjkYWJhvJ99GjhwfD/l8TfqIRDLDuA== - tarball: file:projects/communication-administration.tgz + integrity: sha512-msX+ilu4T1qt+42YXKajobqKgqDulCHJhnPH4qRjnQNzWmFUsXjLPp2Zef9QluTUP/i1h4kmBtxQGdjpFE60qA== + tarball: file:projects/communication-chat.tgz version: 0.0.0 - file:projects/communication-chat.tgz: + file:projects/communication-common.tgz: dependencies: - '@azure/communication-signaling': 1.0.0-beta.2 - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 + '@types/chai-as-promised': 7.1.3 + '@types/jwt-decode': 2.2.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.19.0 - events: 3.2.0 + eslint: 7.23.0 + events: 3.3.0 inherits: 2.0.4 - karma: 5.2.3 + jwt-decode: 2.2.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 - karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8139,54 +8186,53 @@ packages: prettier: 1.19.1 rimraf: 3.0.2 rollup: 1.32.1 - rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false - name: '@rush-temp/communication-chat' + name: '@rush-temp/communication-common' resolution: - integrity: sha512-h3+kFVIyH06CQ8dvxDRYlw5Ewa9pvPGAW/XJ/qHJ7qvwSF7ndJjlH0maY76ociUBLjRaN+OIiqr2aona/lua7A== - tarball: file:projects/communication-chat.tgz + integrity: sha512-vRy7pUghd+31tM6DNGNMnMfOcQtTD01OFxa1ngPYMP+cB8GaoGC4GE20q4SRV8AkSIBVbr4BGQdRt4+lrsjBlw== + tarball: file:projects/communication-common.tgz version: 0.0.0 - file:projects/communication-common.tgz: + file:projects/communication-identity.tgz: dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 - '@types/chai-as-promised': 7.1.3 - '@types/jwt-decode': 2.2.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + chai: 4.3.4 cross-env: 7.0.3 - eslint: 7.19.0 - events: 3.2.0 + dotenv: 8.2.0 + eslint: 7.23.0 + events: 3.3.0 inherits: 2.0.4 - jwt-decode: 2.2.0 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8194,54 +8240,53 @@ packages: prettier: 1.19.1 rimraf: 3.0.2 rollup: 1.32.1 + rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - util: 0.12.3 + typescript: 4.2.4 dev: false - name: '@rush-temp/communication-common' + name: '@rush-temp/communication-identity' resolution: - integrity: sha512-Vs8kd6GWppCNcbkO/+cJvaxsx3V1RhDySVLmGVziz7I8sm9ykatUaIp0XaGxd9qRWdXgs5R9RPLLry2JNwIbkA== - tarball: file:projects/communication-common.tgz + integrity: sha512-0QvoVTuWaVxaNqcm9kuUiJODW2qUB4uKPrHA8Pv3FGQQ7Y74P6Q9NaN2F9CP1TyXHQZlrD37p9LJnTQgbwXFqg== + tarball: file:projects/communication-identity.tgz version: 0.0.0 - file:projects/communication-identity.tgz: + file:projects/communication-phone-numbers.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 - '@microsoft/api-documenter': 7.8.56 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - events: 3.2.0 + eslint: 7.23.0 + events: 3.3.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8252,48 +8297,48 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false - name: '@rush-temp/communication-identity' + name: '@rush-temp/communication-phone-numbers' resolution: - integrity: sha512-GL4qaJfqxoP4zSobWm6zUqhsb7R4CtTVS7/Vo2Phv6ScgXNXLKuyufAQ23uSMG4+fCSe1xDevyouXY7uCsB3Cg== - tarball: file:projects/communication-identity.tgz + integrity: sha512-ZxxqkvDAbF3E1MKUdq9dO3+d/Rzf81GValySfhgqqkq9GYmRIViBGzOJKPGs3cpM38w5ek5gd/bk8xzvEwWWAw== + tarball: file:projects/communication-phone-numbers.tgz version: 0.0.0 file:projects/communication-sms.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - events: 3.2.0 + eslint: 7.23.0 + events: 3.3.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8304,49 +8349,95 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/communication-sms' resolution: - integrity: sha512-cfyaA/9f1wYUE9I7NAfRaHHbPfZJ6YS/CguUA9DvtwmoD73EuZoCRhWuIn+CPpvP8JSELzXSqN/gsoPJjXtyog== + integrity: sha512-iUDYbSKEqU9Onayru0k/Lzkp/tGDk5SuzxrcExxfXqhbCI0jIsL49TI9iEvPKvIZBwmauMnTTWG2dq6HG5c5dg== tarball: file:projects/communication-sms.tgz version: 0.0.0 + file:projects/container-registry.tgz: + dependencies: + '@azure/arm-containerregistry': 8.0.0 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 + '@azure/ms-rest-nodeauth': 3.0.9 + '@microsoft/api-extractor': 7.7.11 + '@types/chai': 4.2.16 + '@types/chai-as-promised': 7.1.3 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + inherits: 2.0.4 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-sourcemap-loader: 0.3.8 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 1.19.1 + rimraf: 3.0.2 + rollup: 1.32.1 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + util: 0.12.3 + dev: false + name: '@rush-temp/container-registry' + resolution: + integrity: sha512-SsPsb2h7leU8zPAUjD+0e1wte3wUfwm+C8Hph+HIElBIROIv0pJsZGtM6pQIw2Bza3r39oegtO3TY3fAxJR8/g== + tarball: file:projects/container-registry.tgz + version: 0.0.0 file:projects/core-amqp.tgz: dependencies: + '@azure/identity': 1.3.0_debug@4.3.1 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-inject': 4.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/async-lock': 1.1.2 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/debug': 4.1.5 - '@types/is-buffer': 2.0.0 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 + '@types/ws': 7.4.1 assert: 1.5.0 async-lock: 1.2.8 buffer: 5.7.1 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 debug: 4.3.1 dotenv: 8.2.0 downlevel-dts: 0.4.0 - eslint: 7.19.0 - events: 3.2.0 - is-buffer: 2.0.5 + eslint: 7.23.0 + events: 3.3.0 jssha: 3.2.0 - karma: 5.2.3_debug@4.3.1 + karma: 6.3.2_debug@4.3.1 karma-chrome-launcher: 3.1.0 karma-mocha: 2.0.1 mocha: 7.2.0 @@ -8356,37 +8447,37 @@ packages: process: 0.11.10 puppeteer: 3.3.0 rhea: 1.0.24 - rhea-promise: 1.1.0 + rhea-promise: 1.2.1 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 sinon: 9.2.4 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 url: 0.11.0 util: 0.12.3 - ws: 7.4.3 + ws: 7.4.4 dev: false name: '@rush-temp/core-amqp' resolution: - integrity: sha512-VHx+NSvtudVq+DYQPekrLd/8i6u44TjJCE3UYa4S89aydZd06xoXUKjPX7eEy74hl0e9Bf1+poilr8IaqvNhGg== + integrity: sha512-CW9xpW4t7TdHmCyP+ZPd/mb0oUjG2dVh6C/RGhzPS8ImdZvcY13QO84eWugbS0PajYfHbIgxbMOiPUaxRTpxeQ== tarball: file:projects/core-amqp.tgz version: 0.0.0 file:projects/core-asynciterator-polyfill.tgz: dependencies: '@types/node': 8.10.66 - eslint: 7.19.0 + eslint: 7.23.0 prettier: 1.19.1 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/core-asynciterator-polyfill' resolution: - integrity: sha512-jy74F2u4O8uwYNc431X48WTXB1Hm2uTrsb2l98x8+ikj53lnqDIXceEMUr3lBVlnWpNxiy4DUp3BXr4v2fKGIQ== + integrity: sha512-h5Lxt61X7fYi0y86q4KioMXa/CaIuIUcdXt9A0+fBuuBbvaZsIJWy8xBRRj8avO2l4dEqorlHeoTrp/tLCojfA== tarball: file:projects/core-asynciterator-polyfill.tgz version: 0.0.0 file:projects/core-auth.tgz: @@ -8396,13 +8487,13 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 assert: 1.5.0 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.19.0 + eslint: 7.23.0 inherits: 2.0.4 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8411,48 +8502,46 @@ packages: rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 - tslib: 2.1.0 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/core-auth' resolution: - integrity: sha512-kTInp6XjafW6ycFXXP67d2hULulZAnRD8MfwaVYz7uydPp8sCS2Az0eBZa/i9kI654LDReTFCIfmA9p2EqL5aA== + integrity: sha512-/FcyvPOvKjNPulEcKL64t6cl870h1H5UEoucinxeXxFQ0TEyHRnXafG4PhBpm7RBtFzba7MlnbYrVHWwlPum9Q== tarball: file:projects/core-auth.tgz version: 0.0.0 - file:projects/core-client.tgz: + file:projects/core-client-1.tgz: dependencies: - '@azure/core-https': 1.0.0-beta.1 - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 '@azure/core-xml': 1.0.0-beta.1 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 - chai: 4.3.0 + '@types/sinon': 9.0.11 + chai: 4.3.4 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.19.0 + eslint: 7.23.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8461,16 +8550,65 @@ packages: rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + sinon: 9.2.4 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + util: 0.12.3 + dev: false + name: '@rush-temp/core-client-1' + resolution: + integrity: sha512-21H/GvL5vjCaXYQD8ETNkbn4a2s35EY9ohVTqK7bR996ytd0gTX1XCcwlbLrnPFJpJD22X2oCZBmwx3tUDsJag== + tarball: file:projects/core-client-1.tgz + version: 0.0.0 + file:projects/core-client.tgz: + dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/core-xml': 1.0.0-beta.1 + '@microsoft/api-extractor': 7.13.2 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + '@types/sinon': 9.0.11 + chai: 4.3.4 + cross-env: 7.0.3 + downlevel-dts: 0.4.0 + eslint: 7.23.0 + inherits: 2.0.4 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-sourcemap-loader: 0.3.8 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + prettier: 2.2.1 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup-plugin-terser: 5.3.1_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/core-client' resolution: - integrity: sha512-psMzl45hb18MrlCDJFo74ZGhySHCUfBuGzODksA6BLAplX2sGc5WFtT57/jUVsjhr4SNhYEDJm0uUu7+BN5ISg== + integrity: sha512-ysfQQBePlUwpeDJmTUCRqYxf/zHdH+UTQ+EAByVTDOvM/2ekmsXjwhJIBwp78vBnQURbtNjIuSFYKk2od3amBg== tarball: file:projects/core-client.tgz version: 0.0.0 file:projects/core-crypto.tgz: @@ -8480,26 +8618,26 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.19.0 - karma: 5.2.3 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8509,52 +8647,51 @@ packages: rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/core-crypto' resolution: - integrity: sha512-buR2x0kE682JR/oMS4D5DViLaQ8BNCb8lrkk7Bsoylqqq2Lig0n8CtAxmQbJOlOXCMscTWw8sRizPSQUDZd63A== + integrity: sha512-BN8htqkXL30dg1Hi2uP6vmjvh/NQWNwyAGLUO26qwLQSYI7WVI2W50JVKmK+oZfrGi3P+wMfjdf++uCCRV5Zjw== tarball: file:projects/core-crypto.tgz version: 0.0.0 file:projects/core-http.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 '@azure/logger-js': 1.3.2 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/express': 4.17.11 '@types/glob': 7.1.3 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/node-fetch': 2.5.8 - '@types/sinon': 9.0.10 + '@types/node-fetch': 2.5.10 + '@types/sinon': 9.0.11 '@types/tough-cookie': 4.0.0 '@types/tunnel': 0.0.1 '@types/uuid': 8.3.0 '@types/xml2js': 0.4.8 babel-runtime: 6.26.0 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.19.0 + eslint: 7.23.0 express: 4.17.1 fetch-mock: 9.11.0_node-fetch@2.6.1 - form-data: 3.0.0 + form-data: 3.0.1 glob: 7.1.6 - karma: 5.2.3 - karma-chai: 0.1.0_chai@4.3.0+karma@5.2.3 + karma: 6.3.2 + karma-chai: 0.1.0_chai@4.3.4+karma@6.3.2 karma-chrome-launcher: 3.1.0 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-firefox-launcher: 1.3.0 karma-mocha: 2.0.1 - karma-rollup-preprocessor: 7.0.5_rollup@1.32.1 + karma-rollup-preprocessor: 7.0.7_rollup@1.32.1 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8568,157 +8705,206 @@ packages: rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 shx: 0.3.3 sinon: 9.2.4 tough-cookie: 4.0.0 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 tunnel: 0.0.6 typedoc: 0.15.2 - typescript: 4.1.2 - uglify-js: 3.12.6 + typescript: 4.2.4 + uglify-js: 3.13.3 uuid: 8.3.2 xhr-mock: 2.5.1 xml2js: 0.4.23 dev: false name: '@rush-temp/core-http' resolution: - integrity: sha512-+St9d5cr/iK9KkExfb6Zd+pl0oLZrl/F7ZbmmqJB1qfRrE12r19wPxJg+MR2YuXniYWcrHY0ZNluuT8ZTWh3XQ== + integrity: sha512-eMAAgtKqqU7D05NWN5bHakktFTX6jz0KHj/Rkn3xbT/zmJ/WUZzz1poNZz75cA0GWvMFt2MFr5K/yd5dnEwsvA== tarball: file:projects/core-http.tgz version: 0.0.0 - file:projects/core-https.tgz: + file:projects/core-lro.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 - '@types/uuid': 8.3.0 - chai: 4.3.0 + assert: 1.5.0 + chai: 4.3.4 cross-env: 7.0.3 - downlevel-dts: 0.4.0 - eslint: 7.19.0 - form-data: 3.0.0 - https-proxy-agent: 5.0.0 - inherits: 2.0.4 - karma: 5.2.3 + eslint: 7.23.0 + events: 3.3.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 + npm-run-all: 4.1.5 + nyc: 14.1.1 prettier: 1.19.1 rimraf: 3.0.2 rollup: 1.32.1 + rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 - sinon: 9.2.4 - source-map-support: 0.5.19 - tslib: 2.1.0 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - util: 0.12.3 - uuid: 8.3.2 + typescript: 4.2.4 + uglify-js: 3.13.3 dev: false - name: '@rush-temp/core-https' + name: '@rush-temp/core-lro' resolution: - integrity: sha512-9PE/jCLFQ4LVFN/HSloQa97TRdVJ4ADnO7jOGWxrfqv3MfwfwZ4wv8fOb2/JeV7d+eeMYsbJr48ZphweZk9l+Q== - tarball: file:projects/core-https.tgz + integrity: sha512-k9e2Zl5E31KvVZGhHuDCrUdUuOum3voT02rYjX5U8dAjseE7tDLObxdewMAT4PnWQ5act0oxRhjbERWldHHBBA== + tarball: file:projects/core-lro.tgz version: 0.0.0 - file:projects/core-lro.tgz: + file:projects/core-paging.tgz: + dependencies: + '@types/node': 8.10.66 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + typedoc: 0.15.2 + typescript: 4.2.4 + dev: false + name: '@rush-temp/core-paging' + resolution: + integrity: sha512-MWcTO+6523oBrcVxrW0PZx7ZSvSg5BalwS+vpArIhQ2v8AEByYp9LJhTdmX5KNIs1wMSYzOSCYL0bWOMCf8smw== + tarball: file:projects/core-paging.tgz + version: 0.0.0 + file:projects/core-rest-pipeline.tgz: dependencies: + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - assert: 1.5.0 - chai: 4.3.0 - eslint: 7.19.0 - events: 3.2.0 - karma: 5.2.3 + '@types/sinon': 9.0.11 + '@types/uuid': 8.3.0 + chai: 4.3.4 + cross-env: 7.0.3 + downlevel-dts: 0.4.0 + eslint: 7.23.0 + form-data: 3.0.1 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.0 + inherits: 2.0.4 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 - npm-run-all: 4.1.5 - nyc: 14.1.1 prettier: 1.19.1 rimraf: 3.0.2 rollup: 1.32.1 - rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + sinon: 9.2.4 + source-map-support: 0.5.19 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - uglify-js: 3.12.6 + typescript: 4.2.4 + util: 0.12.3 + uuid: 8.3.2 dev: false - name: '@rush-temp/core-lro' + name: '@rush-temp/core-rest-pipeline' resolution: - integrity: sha512-rmOOOAVy2ARW+f9uBSRHrvOoY6KIE3LsfLLDDWZUhZdGOuhbdQVjMmOt0Wy/HTRo+Zxh/c5WAYAbTXqZfARP1Q== - tarball: file:projects/core-lro.tgz + integrity: sha512-gAlR8h7yd1rGOqnRGel11Up9XL65EzTBs+scsr6hsSbPicEEbgCkq8ykSD251xfENKeKJL1t8p5wn96jY714Dw== + tarball: file:projects/core-rest-pipeline.tgz version: 0.0.0 - file:projects/core-paging.tgz: + file:projects/core-tracing.tgz: dependencies: + '@microsoft/api-extractor': 7.7.11 + '@opencensus/web-types': 0.0.7 + '@opentelemetry/api': 1.0.0-rc.0 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/mocha': 7.0.2 '@types/node': 8.10.66 - eslint: 7.19.0 + '@types/sinon': 9.0.11 + assert: 1.5.0 + cross-env: 7.0.3 + eslint: 7.23.0 + inherits: 2.0.4 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 prettier: 1.19.1 rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup-plugin-terser: 5.3.1_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + sinon: 9.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 + util: 0.12.3 dev: false - name: '@rush-temp/core-paging' + name: '@rush-temp/core-tracing' resolution: - integrity: sha512-fmp2XqjuUmGjL6MhkibDUFt7jUiC8RBweI3+slBIi9YSGIxrXn8tZfoAYRgG58Db7eXK74VN4lUMjUqQh4JnbA== - tarball: file:projects/core-paging.tgz + integrity: sha512-Tc2a/MYDRNdd0WnJm+5KhRblSFh/WyKj1V7LrK63PCNzSAgUfzjo2TFHV/2NB/Nvm3fy2UUbNldipZCo0Hdqbw== + tarball: file:projects/core-tracing.tgz version: 0.0.0 - file:projects/core-tracing.tgz: + file:projects/core-util.tgz: dependencies: - '@microsoft/api-extractor': 7.7.11 - '@opencensus/web-types': 0.0.7 - '@opentelemetry/api': 0.10.2 + '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - assert: 1.5.0 + '@types/sinon': 9.0.11 + chai: 4.3.4 cross-env: 7.0.3 - eslint: 7.19.0 + downlevel-dts: 0.4.0 + eslint: 7.23.0 inherits: 2.0.4 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 prettier: 1.19.1 @@ -8726,16 +8912,17 @@ packages: rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 - tslib: 2.1.0 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + sinon: 9.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false - name: '@rush-temp/core-tracing' + name: '@rush-temp/core-util' resolution: - integrity: sha512-RtN+18nx0UH2T5DZHfYKbabNL6B8w0IVRMnjlt3XCnbpj48Il4a69qhN4V8+QKmVFW8T5mdF1VsKFZ6TBvcjBg== - tarball: file:projects/core-tracing.tgz + integrity: sha512-YBvq/Oe2x36tuYyuBRafHNfZgNJU+uDchxKORmd8dXw44iwVaqsoq93Xa25Mg05SybgbB4mU2VPNPuJTEm5CRA== + tarball: file:projects/core-util.tgz version: 0.0.0 file:projects/core-xml.tgz: dependencies: @@ -8744,27 +8931,27 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 '@types/xml2js': 0.4.8 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.19.0 + eslint: 7.23.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8773,21 +8960,22 @@ packages: rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 xml2js: 0.4.23 dev: false name: '@rush-temp/core-xml' resolution: - integrity: sha512-59ASfw4Rwrhn3Fj4E1W+blv2ZdkYUHSfnF3eEPED9Yp3ULjLkHeY5N1R7ExMTPkYsVrdmULLzup50MwEm9niTQ== + integrity: sha512-8VQhejhzjl9zACr14nVCodaIPoCpIWNb969ukwPcYvp18nmKTLX/K+b6zWAij/26DBtvFWrFbvmGngrHsjHfGA== tarball: file:projects/core-xml.tgz version: 0.0.0 file:projects/cosmos.tgz: dependencies: + '@azure/identity': 1.3.0_debug@4.3.1 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 @@ -8795,87 +8983,81 @@ packages: '@types/fast-json-stable-stringify': 2.0.0 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/node-fetch': 2.5.8 + '@types/node-fetch': 2.5.10 '@types/priorityqueuejs': 1.0.1 - '@types/semaphore': 1.1.0 - '@types/sinon': 9.0.10 + '@types/semaphore': 1.1.1 + '@types/sinon': 9.0.11 '@types/tunnel': 0.0.1 - '@types/underscore': 1.10.24 + '@types/underscore': 1.11.1 '@types/uuid': 8.3.0 - '@typescript-eslint/eslint-plugin-tslint': 4.14.2_3e70afb83b6e686448c8a54281cd77ac cross-env: 7.0.3 debug: 4.3.1 dotenv: 8.2.0 downlevel-dts: 0.4.0 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 execa: 3.4.0 fast-json-stable-stringify: 2.1.0 jsbi: 3.1.4 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 - node-abort-controller: 1.1.0 + node-abort-controller: 1.2.1 node-fetch: 2.6.1 prettier: 1.19.1 priorityqueuejs: 1.0.0 - proxy-agent: 3.1.1 + proxy-agent: 4.0.1 requirejs: 2.3.6 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-local-resolve: 1.0.7 semaphore: 1.1.0 sinon: 9.2.4 - snap-shot-it: 7.9.4 + snap-shot-it: 7.9.6 source-map-support: 0.5.19 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 - tslint: 5.20.1_typescript@4.1.2 - tslint-config-prettier: 1.18.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 universal-user-agent: 6.0.0 uuid: 8.3.2 dev: false name: '@rush-temp/cosmos' resolution: - integrity: sha512-I745iqJTw3qCozHy60mRJTyaMXfDJRhT+4bjEKnqxo1HtLV8d+Mksl34z3KoyUhrIC4dlOR08VIHF+d/xz5Mag== + integrity: sha512-/8qOC/V8y69zIekhbyW9qcgapO8Gr4csxVV9jeRJ3bqGevunFJ2wr9DaVxx34ztDmQqvQE5I6L0/lSopgQpMuA== tarball: file:projects/cosmos.tgz version: 0.0.0 file:projects/data-tables.tgz: dependencies: - '@azure/core-client': 1.0.0-beta.1 - '@azure/core-https': 1.0.0-beta.1 - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 '@azure/core-xml': 1.0.0-beta.1 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-inject': 4.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 '@types/uuid': 8.3.0 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 downlevel-dts: 0.4.0 - eslint: 7.19.0 + eslint: 7.23.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8886,18 +9068,18 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 uuid: 8.3.2 dev: false name: '@rush-temp/data-tables' resolution: - integrity: sha512-m3hHFly6ovHcHiyvPoQC8OUWj3NQxxigI1j6BwX/5zenfRzKIgcgTLqgYfC90O/s6FJ1LgrkWdN9rx9T6pScvw== + integrity: sha512-9hK/ry3jr4Vfm2IUotAKYubi8mN1LaPqz//ggrWAyc1rSyMjOjNAkDnoCFWZkL99NdYXrM8wxcXlOOmuRlynmw== tarball: file:projects/data-tables.tgz version: 0.0.0 file:projects/dev-tool.tgz: @@ -8906,7 +9088,7 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/chalk': 2.2.0 '@types/fs-extra': 8.1.1 @@ -8915,10 +9097,11 @@ packages: '@types/node': 8.10.66 '@types/prettier': 2.0.2 builtin-modules: 3.1.0 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 chalk: 3.0.0 - eslint: 7.19.0 + dotenv: 8.2.0 + eslint: 7.23.0 fs-extra: 8.1.0 minimist: 1.2.5 mocha: 7.2.0 @@ -8926,47 +9109,50 @@ packages: rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 - ts-node: 8.10.2_typescript@4.1.2 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 + yaml: 1.10.2 dev: false name: '@rush-temp/dev-tool' resolution: - integrity: sha512-S3WDkxotlIQoQrW4rQosXC1EdpsvvCE3Z06fv1w4tAcaVwfY+aO/nzRDhye/48C2xNEyvOQwZ2dMU2N2lsx89g== + integrity: sha512-rGtMfFPo8M7iE/unoqu6pixlEPyvRqJvFT7CE8yAnJR0MzVLOv+joUAkAuzH+iAP86N20cqLtR0Cax0fqjzFhw== tarball: file:projects/dev-tool.tgz version: 0.0.0 file:projects/digital-twins-core.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 - chai: 4.3.0 + '@types/sinon': 9.0.11 + '@types/uuid': 8.3.0 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8977,37 +9163,38 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 + uuid: 8.3.2 dev: false name: '@rush-temp/digital-twins-core' resolution: - integrity: sha512-0CjcSbQui3L29TEfVxqqFJ80Yd9Q78fj+fIYT96YaKJHqXashlW4pPjvMjxDdB4NbzlNK1O7qRCOSN2PwecDkA== + integrity: sha512-HATRz9UgjGJhJhHWrb4PL9PRfnCe/kjkDIyJZUGuA2ZFn8HIkDlR8y53sXJU32OZKTlbvCPjkq+odAQUmH5m9A== tarball: file:projects/digital-twins-core.tgz version: 0.0.0 file:projects/eslint-plugin-azure-sdk.tgz: dependencies: - '@types/chai': 4.2.14 - '@types/eslint': 7.2.6 - '@types/estree': 0.0.46 + '@types/chai': 4.2.16 + '@types/eslint': 7.2.8 + '@types/estree': 0.0.47 '@types/glob': 7.1.3 '@types/json-schema': 7.0.7 '@types/mocha': 7.0.2 - '@types/node': 8.10.66 - '@typescript-eslint/eslint-plugin': 4.13.0_85649cb1d193687858ee685cdd7abf38 - '@typescript-eslint/experimental-utils': 4.13.0_eslint@7.19.0+typescript@4.1.2 - '@typescript-eslint/parser': 4.13.0_eslint@7.19.0+typescript@4.1.2 - '@typescript-eslint/typescript-estree': 4.13.0_typescript@4.1.2 - chai: 4.3.0 - eslint: 7.19.0 - eslint-config-prettier: 7.2.0_eslint@7.19.0 - eslint-plugin-import: 2.22.1_eslint@7.19.0 + '@types/node': 10.17.56 + '@typescript-eslint/eslint-plugin': 4.19.0_1a11d0673659f3a5e0fd221432005aeb + '@typescript-eslint/experimental-utils': 4.19.0_eslint@7.23.0+typescript@4.2.4 + '@typescript-eslint/parser': 4.19.0_eslint@7.23.0+typescript@4.2.4 + '@typescript-eslint/typescript-estree': 4.19.0_typescript@4.2.4 + chai: 4.3.4 + eslint: 7.23.0 + eslint-config-prettier: 7.2.0_eslint@7.23.0 + eslint-plugin-import: 2.22.1_eslint@7.23.0 eslint-plugin-no-only-tests: 2.4.0 - eslint-plugin-promise: 4.2.1 + eslint-plugin-promise: 4.3.1 eslint-plugin-tsdoc: 0.2.11 glob: 7.1.6 json-schema: 0.3.0 @@ -9016,61 +9203,61 @@ packages: prettier: 1.19.1 rimraf: 3.0.2 source-map-support: 0.5.19 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/eslint-plugin-azure-sdk' resolution: - integrity: sha512-JNWQRRsexu1eih1J4kcqkFiMNA9PrhDapMiKfw3oCS4VMKIbI0YMFaftO+mQ7KyD5umGMRLI2H39oryCgbtdpQ== + integrity: sha512-wLyGQcJAesPoDV5NNA+PpFNXz9C64U1PRPPYxy2TVtjOvPLOzrclj8KK5e4nwhsFLpgrPwSO+ostRSsicofQTA== tarball: file:projects/eslint-plugin-azure-sdk.tgz version: 0.0.0 file:projects/event-hubs.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0_debug@4.3.1 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-inject': 4.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/async-lock': 1.1.2 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/chai-string': 1.4.2 '@types/debug': 4.1.5 '@types/long': 4.0.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 '@types/uuid': 8.3.0 - '@types/ws': 7.4.0 + '@types/ws': 7.4.1 assert: 1.5.0 buffer: 5.7.1 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 - chai-string: 1.5.0_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 + chai-string: 1.5.0_chai@4.3.4 cross-env: 7.0.3 debug: 4.3.1 dotenv: 8.2.0 downlevel-dts: 0.4.0 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 https-proxy-agent: 5.0.0 is-buffer: 2.0.5 jssha: 3.2.0 - karma: 5.2.3_debug@4.3.1 + karma: 6.3.2_debug@4.3.1 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9079,23 +9266,23 @@ packages: prettier: 1.19.1 process: 0.11.10 puppeteer: 3.3.0 - rhea-promise: 1.1.0 + rhea-promise: 1.2.1 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 sinon: 9.2.4 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 uuid: 8.3.2 - ws: 7.4.3 + ws: 7.4.4 dev: false name: '@rush-temp/event-hubs' resolution: - integrity: sha512-20T2CbtsC2nRkXKbFGASPFDQtYsdCC8dSjnI6HI98yR4PYGDe9GOrqSkw83CS5EtVIOdm/Q8ciexMLZzHt7gIw== + integrity: sha512-8kvTC/cK5o9v8o0ZupbFtRjjOGERHFFr3srAOwWo+27nBCMo8F5hw9o9oHBMghESkh0uZFaiAzZG79/g7pFNxg== tarball: file:projects/event-hubs.tgz version: 0.0.0 file:projects/event-processor-host.tgz: @@ -9107,25 +9294,25 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/async-lock': 1.1.2 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/chai-string': 1.4.2 '@types/debug': 4.1.5 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/uuid': 8.3.0 - '@types/ws': 7.4.0 + '@types/ws': 7.4.1 async-lock: 1.2.8 azure-storage: 2.10.3 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 - chai-string: 1.5.0_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 + chai-string: 1.5.0_chai@4.3.4 cross-env: 7.0.3 debug: 4.3.1 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 https-proxy-agent: 5.0.0 mocha: 7.2.0 @@ -9136,53 +9323,51 @@ packages: rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 uuid: 8.3.2 - ws: 7.4.3 + ws: 7.4.4 dev: false name: '@rush-temp/event-processor-host' resolution: - integrity: sha512-mAkqTeMcDCdX+Qx9gT7+t5eQNZeg1E6V5XyaEI8JGWddGj8gyB2lUnwsCLb7VsnbTSlBaCSZR5tGE0dscunDVQ== + integrity: sha512-yShrxTmWGPufLf7C+gUIqFzc9Q2UHJ6Gc5eomvX3OMoFEyZxvAC3GWu9lyJMDeXZU89CJ7O4WvLhOre43ONRZQ== tarball: file:projects/event-processor-host.tgz version: 0.0.0 file:projects/eventgrid.tgz: dependencies: - '@azure/core-client': 1.0.0-beta.1 - '@azure/core-https': 1.0.0-beta.1 - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/service-bus': 7.0.5 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 '@types/uuid': 8.3.0 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - karma: 5.2.3 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9193,58 +9378,57 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 source-map-support: 0.5.19 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 uuid: 8.3.2 dev: false name: '@rush-temp/eventgrid' resolution: - integrity: sha512-i50r+d62Gt8OFidnqrlQpC8eN34OiPdZJDeH9DmNCq7OPjx/rJVaAxmAH18Lfr/timcPP+EwbZTo6jwG0BTQ7w== + integrity: sha512-xh6kgtOlv01x9G/APg7o96Or8mejiJNCTIzIPGfOhGuQ3cJdkgmDt4BIRvcwNHlaLarZ4v+ytKhAw0JCj122cQ== tarball: file:projects/eventgrid.tgz version: 0.0.0 file:projects/eventhubs-checkpointstore-blob.tgz: dependencies: - '@azure/storage-blob': 12.4.1 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-inject': 4.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/chai-string': 1.4.2 '@types/debug': 4.1.5 '@types/mocha': 7.0.2 '@types/node': 8.10.66 assert: 1.5.0 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 - chai-string: 1.5.0_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 + chai-string: 1.5.0_chai@4.3.4 cross-env: 7.0.3 debug: 4.3.1 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 - events: 3.2.0 + events: 3.3.0 guid-typescript: 1.0.9 inherits: 2.0.4 - karma: 5.2.3_debug@4.3.1 + karma: 6.3.2_debug@4.3.1 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9255,114 +9439,138 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/eventhubs-checkpointstore-blob' resolution: - integrity: sha512-SRFOlixCIfs+OakbeGaZ60FmRwcvAQqeRy/wxiGIrvj80+tx6rVIZP/FnMex0abF0KO3442vl3cY0HlpPvPJKw== + integrity: sha512-HVGnI1U0A0SyBMpjRlQDZINX71Kaae+cfNmQRcgmRhnDtt0J4K5sUbUJRuSEUje7LX/cZrKB7JyYzH+U9bXmLQ== tarball: file:projects/eventhubs-checkpointstore-blob.tgz version: 0.0.0 file:projects/identity.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 - '@azure/msal-node': 1.0.0-beta.6 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/msal-browser': 2.9.0 + '@azure/msal-common': 4.0.3 + '@azure/msal-node': 1.0.2 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/express': 4.17.11 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/jws': 3.2.3 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/qs': 6.9.5 - '@types/sinon': 9.0.10 + '@types/qs': 6.9.6 + '@types/sinon': 9.0.11 + '@types/stoppable': 1.1.0 '@types/uuid': 8.3.0 assert: 1.5.0 - axios: 0.21.1 cross-env: 7.0.3 - eslint: 7.19.0 - events: 3.2.0 - express: 4.17.1 + dotenv: 8.2.0 + eslint: 7.23.0 + events: 3.3.0 inherits: 2.0.4 jws: 4.0.0 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 karma-env-preprocessor: 0.1.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 mock-fs: 4.13.0 - msal: 1.4.5 - open: 7.4.0 + open: 7.4.2 prettier: 1.19.1 puppeteer: 3.3.0 - qs: 6.9.6 + qs: 6.10.1 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + stoppable: 1.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 uuid: 8.3.2 dev: false name: '@rush-temp/identity' optionalDependencies: - keytar: 7.3.0 + keytar: 7.6.0 resolution: - integrity: sha512-RkgNLuiYgllsKZCWqAgG5YWRjgD/90RbafjKLQa/t0BYJLbvR3k/c9UVNGZDSh6ScpnSCmQ8eCr0+FGM3eB2yg== + integrity: sha512-TGmDn9FURoFYW60Z94hZ8+QRix4SX+A0jZGBJUZ4Xvo9IutZ81CVMxctI+TL8SgyWLzLWHkSEjsbB36WcVQM9w== tarball: file:projects/identity.tgz version: 0.0.0 + file:projects/iot-device-update.tgz: + dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 + '@microsoft/api-extractor': 7.7.11 + '@types/node': 8.10.66 + '@types/uuid': 8.3.0 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + mkdirp: 1.0.4 + prettier: 1.19.1 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-node-resolve: 3.4.0 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + source-map-support: 0.5.19 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + uglify-js: 3.13.3 + uuid: 8.3.2 + dev: false + name: '@rush-temp/iot-device-update' + resolution: + integrity: sha512-DuneImF4EvaxNJN8S5CocoKuUHCNqt/tuTYb+IHa6t1Sr+PaFyL2m1mQN1xD2WlDpgK5nf3arEXcdGPR0xVEeQ== + tarball: file:projects/iot-device-update.tgz + version: 0.0.0 file:projects/iot-modelsrepository-client.tgz: dependencies: - '@azure/core-client': 1.0.0-beta.1 - '@azure/core-rest-pipeline': 1.0.2 - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 - '@types/chai-as-promised': 7.1.3 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + '@types/sinon': 9.0.11 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - events: 3.2.0 + eslint: 7.23.0 + events: 3.3.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 nyc: 14.1.1 @@ -9371,41 +9579,41 @@ packages: rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/iot-modelsrepository-client' resolution: - integrity: sha512-96etcDKO1kZ2nOyI6vllxFET6KNL0bOjzurXuqPLiianpvTH/pZ/10WEt4hzWBKqOZGLbO5Bgn4KWRmgt8ejYA== + integrity: sha512-c58ubMYVMjjV9XLYln6CT37okLXyKBZZMoCg3Ofe/eHEKNtUEwdQudn/G1YCMuuopJnITeH+mkp7RH0aN4beFA== tarball: file:projects/iot-modelsrepository-client.tgz version: 0.0.0 file:projects/keyvault-admin.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 '@types/uuid': 8.3.0 assert: 1.5.0 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9416,52 +9624,52 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 source-map-support: 0.5.19 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 uuid: 8.3.2 dev: false name: '@rush-temp/keyvault-admin' resolution: - integrity: sha512-H3/yHvEC5jsPdl2owV1o0xpWmiVPs25gankrSY6FsSFLkdNduPCgQa5Z+4m6YWmFAIRwtN2kSKXrpiYdknKoOA== + integrity: sha512-oRwQPIUfeV8PrFW1HB06AWis2jNtWXz99fenuzpH0C+iVCmqDTU0zGFUBmVHW5qqjykEtoHCyyXp6L8WgIpZGw== tarball: file:projects/keyvault-admin.tgz version: 0.0.0 file:projects/keyvault-certificates.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/query-string': 6.2.0 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9474,69 +9682,68 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 source-map-support: 0.5.19 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 url: 0.11.0 dev: false name: '@rush-temp/keyvault-certificates' resolution: - integrity: sha512-o3ghASRcoAlfjxR42rXMha3bLnqgdSOukj7RyLp71C6+cK9do6laBaVHpqOT78xdOwjeTyG/6wb2Ra27XBWMxA== + integrity: sha512-geYalPzb+uX/KwZtzL95nr+8oUXOBVk85Z1435k32tkxHLyRFTmALCRWqUQ8667TnyWWh+9ckR62/aa7OIcFAQ== tarball: file:projects/keyvault-certificates.tgz version: 0.0.0 file:projects/keyvault-common.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 - '@opentelemetry/api': 0.10.2 - eslint: 7.19.0 + '@azure/core-tracing': 1.0.0-preview.11 + eslint: 7.23.0 prettier: 1.19.1 rimraf: 3.0.2 - tslib: 2.1.0 - typescript: 4.1.2 + tslib: 2.2.0 + typescript: 4.2.4 dev: false name: '@rush-temp/keyvault-common' resolution: - integrity: sha512-2zFAKDUWUYLbduUtaBOYxIq4aazqkzh3KfJF1MgY6fpYifMMRdaYHqUMng/IGu+MBZfJdzV+Upsi518u4Ldfsg== + integrity: sha512-VSCIHQwTUhJCJagknQ9tUvQB5OZfRd/HZnsTDgKfalxsLOS70wiBrSF59IgN3JcPNkIR+JqgRU5ueg91hzgc2w== tarball: file:projects/keyvault-common.tgz version: 0.0.0 file:projects/keyvault-keys.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/query-string': 6.2.0 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9549,52 +9756,52 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 source-map-support: 0.5.19 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 url: 0.11.0 dev: false name: '@rush-temp/keyvault-keys' resolution: - integrity: sha512-2T3z2w3gA8WLmpZNCAXxQPEkyE3yiO6cOBHKt/UEXwCris9pvqpkfbMcEmkaX+gWwiNt0ptXJlnysziiiB7Auw== + integrity: sha512-d5VpsD0EqzARzk9c9a6E+1sgIjAZYCObYjQCIbEZNCem4IB5CIYlm83c+/DRBKyH1fQEVsoHQgxTwbNyRkrxNA== tarball: file:projects/keyvault-keys.tgz version: 0.0.0 file:projects/keyvault-secrets.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/query-string': 6.2.0 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9607,17 +9814,17 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 source-map-support: 0.5.19 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 url: 0.11.0 dev: false name: '@rush-temp/keyvault-secrets' resolution: - integrity: sha512-0YATav4fEaDDSzFb+Lj0o3/NuqOIyTTCyK6sdJ7kpBQOEOh/o8oI+uRRlF+9h2Y3o3Fta6ZYThc7NUrdwRJAeA== + integrity: sha512-s0dLzF1S5wyX4UbfxHMkp3HH7E6vw3WyyBhvWiS59msK0yxQj2f/gsv+ZZ6+GWU15ALexiaSIQE7RrNRrVvAfg== tarball: file:projects/keyvault-secrets.tgz version: 0.0.0 file:projects/logger.tgz: @@ -9626,27 +9833,27 @@ packages: '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 - chai: 4.3.0 + chai: 4.3.4 cross-env: 7.0.3 delay: 4.4.1 dotenv: 8.2.0 - eslint: 7.19.0 - karma: 5.2.3 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9658,44 +9865,87 @@ packages: rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 sinon: 9.2.4 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/logger' resolution: - integrity: sha512-9C/8ICw825JPlQ6DGhRDKFWo2jO3CYzJYZeqqgg1qkdPIthab+aId/EnoW3oLeEUUwnEF3Gy8unrlFCIMCs5mA== + integrity: sha512-SkIJX0/3mm4KHuQhl6O7ObJfULCR2PjCtmGN1R4oJvs9plCVjK7szoqsldgM5CQSZwI94t5S/d+8ckDQxr/4WQ== tarball: file:projects/logger.tgz version: 0.0.0 + file:projects/mixedreality-authentication.tgz: + dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@microsoft/api-extractor': 7.7.11 + '@types/chai': 4.2.16 + '@types/chai-as-promised': 7.1.3 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + inherits: 2.0.4 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-sourcemap-loader: 0.3.8 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 1.19.1 + rimraf: 3.0.2 + rollup: 1.32.1 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + util: 0.12.3 + dev: false + name: '@rush-temp/mixedreality-authentication' + resolution: + integrity: sha512-MrlmEKGo7m8X7xGkzT1PE91eWkK1Ps4AU4nqug5I42Hyc9n6UpKEKUz04t7MDKedGXRXaCHwjwOFPKIwqSdi6w== + tarball: file:projects/mixedreality-authentication.tgz + version: 0.0.0 file:projects/mock-hub.tgz: dependencies: '@types/node': 8.10.66 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 prettier: 1.19.1 rhea: 1.0.24 rimraf: 3.0.2 - tslib: 2.1.0 - typescript: 4.1.2 + tslib: 2.2.0 + typescript: 4.2.4 dev: false name: '@rush-temp/mock-hub' resolution: - integrity: sha512-Lro7rFcnDNWYuWUIr9czVrfJjSIadiaDU6I945N80JjHUW4RnMZ2WZY9Dr8v+iA1jlMEF7p6Sw0pzIpllGzQqA== + integrity: sha512-RmnPgc2xuUNGzTIfYimSP2cNWao3z2oinTo5+yNQKnasBkRQbB+xcwD3+nTM/GclcS9M3ubf8/CKbfWg6J5NSg== tarball: file:projects/mock-hub.tgz version: 0.0.0 file:projects/monitor-opentelemetry-exporter.tgz: dependencies: '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.16.0 - '@opentelemetry/core': 0.16.0 - '@opentelemetry/resources': 0.16.0 - '@opentelemetry/semantic-conventions': 0.16.0 - '@opentelemetry/tracing': 0.16.0 + '@opentelemetry/api': 0.18.1 + '@opentelemetry/core': 0.18.2 + '@opentelemetry/resources': 0.18.2 + '@opentelemetry/semantic-conventions': 0.18.2 + '@opentelemetry/tracing': 0.18.2 '@types/mocha': 7.0.2 - '@types/node': 10.17.51 - eslint: 7.19.0 - eslint-plugin-node: 11.1.0_eslint@7.19.0 + '@types/node': 10.17.56 + eslint: 7.23.0 + eslint-plugin-node: 11.1.0_eslint@7.23.0 execa: 3.4.0 mocha: 7.2.0 nock: 12.0.3 @@ -9704,49 +9954,258 @@ packages: rimraf: 3.0.2 rollup: 1.32.1 sinon: 9.2.4 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/monitor-opentelemetry-exporter' resolution: - integrity: sha512-PQ9TYELaQ7eyzGfdPwoqAoUxEv9WH0sHPdwuXd7iyUXNRyqT5Hjg2a30zfOrd6QHB5IX4iQq6UtthzLKfCQwmA== + integrity: sha512-mFMTlDgHaSMFSu0BtZK22iSM6WKT1Gd4mqC5kk/nq9AtxfwUMysqoxqNuar9MzPmtQWD2vFVHCO7WgVFTW3KQQ== tarball: file:projects/monitor-opentelemetry-exporter.tgz version: 0.0.0 + file:projects/perf-ai-form-recognizer.tgz: + dependencies: + '@azure/identity': 1.3.0 + '@types/node': 8.10.66 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + dev: false + name: '@rush-temp/perf-ai-form-recognizer' + resolution: + integrity: sha512-gJ4nl8UAm254P0GWxcnaF5PpWatN2Ifio5wl3XfLknEEAYPDOYYxQcuXmCLE9oGdsb3SaujzdQnqHqetDfVHoA== + tarball: file:projects/perf-ai-form-recognizer.tgz + version: 0.0.0 + file:projects/perf-ai-metrics-advisor.tgz: + dependencies: + '@azure/ai-metrics-advisor': 1.0.0-beta.3 + '@types/node': 8.10.66 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + dev: false + name: '@rush-temp/perf-ai-metrics-advisor' + resolution: + integrity: sha512-XgAx/QS7WcKj+znrAzmKi9rxGLBhSBVkXUGdtFi9kBiaxhtraFAL6OETVC9khVm0nRBAxj1CzO2qu3mEQNAxLg== + tarball: file:projects/perf-ai-metrics-advisor.tgz + version: 0.0.0 + file:projects/perf-ai-text-analytics.tgz: + dependencies: + '@azure/identity': 1.3.0 + '@types/node': 8.10.66 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + dev: false + name: '@rush-temp/perf-ai-text-analytics' + resolution: + integrity: sha512-WRKlYq5E3/zAp5qMYA5yQagbJYlfuIUsxCBp+WSfENbW/m4WzpjkNC/01TLJ6tO2CEoLc+RRPXCDFpA30H432g== + tarball: file:projects/perf-ai-text-analytics.tgz + version: 0.0.0 + file:projects/perf-eventgrid.tgz: + dependencies: + '@types/node': 8.10.66 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + dev: false + name: '@rush-temp/perf-eventgrid' + resolution: + integrity: sha512-IQoql5tEhOX/8VOIA+TIl95RGaqZpGF73Xho9DxQuJjcv1vpVKYUFh4tnWlsrFP3P4E64MbDFsVvCPd27mw3dQ== + tarball: file:projects/perf-eventgrid.tgz + version: 0.0.0 + file:projects/perf-identity.tgz: + dependencies: + '@types/uuid': 8.3.0 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + dev: false + name: '@rush-temp/perf-identity' + resolution: + integrity: sha512-dGWFtEBT8TQxKH65+/OO266Cj2gcGgXT/bdyjq3MCENgBQ5MiD01quuKiPncS1BUA2iEieCvxlE5T5dJvgxWTw== + tarball: file:projects/perf-identity.tgz + version: 0.0.0 + file:projects/perf-keyvault-certificates.tgz: + dependencies: + '@azure/identity': 1.3.0 + '@types/uuid': 8.3.0 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + uuid: 8.3.2 + dev: false + name: '@rush-temp/perf-keyvault-certificates' + resolution: + integrity: sha512-8ZoWbt0i2I1ShnxusGsulAuKsliaJZa5a8PfI1la354d+C8iaNCCzZD+CNafCFaGK2CE0KUwy3pnVfOrnMJNhA== + tarball: file:projects/perf-keyvault-certificates.tgz + version: 0.0.0 + file:projects/perf-keyvault-keys.tgz: + dependencies: + '@azure/identity': 1.3.0 + '@types/uuid': 8.3.0 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + uuid: 8.3.2 + dev: false + name: '@rush-temp/perf-keyvault-keys' + resolution: + integrity: sha512-SH2hZ0zz7laglE5GD3oux2JLzq7/mE6s9MfwbtVeTNDxqsHnLwPlWdJV0wU+Zl5OMnM0oBVpwhqInAhM4cJdKg== + tarball: file:projects/perf-keyvault-keys.tgz + version: 0.0.0 + file:projects/perf-keyvault-secrets.tgz: + dependencies: + '@azure/identity': 1.3.0 + '@types/uuid': 8.3.0 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + uuid: 8.3.2 + dev: false + name: '@rush-temp/perf-keyvault-secrets' + resolution: + integrity: sha512-lCvynZ7C5J6guvAPecUQFD6j7qvFY4eu9Q2Fd1FjkBI+76Qc9HOG3QNRVb/OoR+rGmH4pDnaaj3Z0Lm7GfZbrw== + tarball: file:projects/perf-keyvault-secrets.tgz + version: 0.0.0 + file:projects/perf-search-documents.tgz: + dependencies: + '@azure/identity': 1.3.0 + '@types/node': 8.10.66 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + dev: false + name: '@rush-temp/perf-search-documents' + resolution: + integrity: sha512-UEZdA+EPRblJfIP8D38K716j/lO/TVT3FrYzEP96rZKMWFRuOt0BDvP1FerYtWE9hieotwR69wm7v5bPPpjuyg== + tarball: file:projects/perf-search-documents.tgz + version: 0.0.0 + file:projects/perf-storage-blob.tgz: + dependencies: + '@types/node': 8.10.66 + '@types/node-fetch': 2.5.10 + '@types/uuid': 8.3.0 + dotenv: 8.2.0 + eslint: 7.23.0 + node-fetch: 2.6.1 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + uuid: 8.3.2 + dev: false + name: '@rush-temp/perf-storage-blob' + resolution: + integrity: sha512-CQP5Lrw+CR+EpibLFTir3/fZn3oIwh0UG1C9JsKtKkzfGaw0BO2V8vV5FoKCp4RwiEhbkvkHnu89DuBZMxZH7A== + tarball: file:projects/perf-storage-blob.tgz + version: 0.0.0 + file:projects/perf-storage-file-datalake.tgz: + dependencies: + '@types/node': 8.10.66 + '@types/uuid': 8.3.0 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + uuid: 8.3.2 + dev: false + name: '@rush-temp/perf-storage-file-datalake' + resolution: + integrity: sha512-desRgzqog2aoFzH4xpp90a0NBZbUJ1eDUAgUQb3jaUiNOA3y0ER5mHOXFDQ8RuQ0Kjy6jbeNmZ8rcsmJ6OM1+w== + tarball: file:projects/perf-storage-file-datalake.tgz + version: 0.0.0 + file:projects/perf-storage-file-share.tgz: + dependencies: + '@types/node': 8.10.66 + '@types/uuid': 8.3.0 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + uuid: 8.3.2 + dev: false + name: '@rush-temp/perf-storage-file-share' + resolution: + integrity: sha512-mjYaV8s2WtZjhutOHaUUXmi2Ne5i+O/doHq+xoMo8aqmB50wVLSdyG52mRA3JITqy667rK95QQdjyzG6LflpOw== + tarball: file:projects/perf-storage-file-share.tgz + version: 0.0.0 file:projects/quantum-jobs.tgz: dependencies: - '@azure/storage-blob': 12.4.1 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 - chai: 4.3.0 + '@types/sinon': 9.0.11 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - esm: 3.2.25 - events: 3.2.0 + eslint: 7.23.0 + events: 3.3.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9757,52 +10216,52 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - uglify-js: 3.12.6 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/quantum-jobs' resolution: - integrity: sha512-JZ9vo+AtAREX5yO4s9Ax/h4yMA4R9dv3lnvM2o4y3zz0Ps1+hZHH2sXpF2po8T+CiAaoo73Xrjt8B2ut18/kGQ== + integrity: sha512-ZGwwkEsI5mFwQKjnxCWlrSWdanAQmBfWlH2GOQBaDY0Dr7+ttS6/UcgAEAUqRy5CKpwtzEOw7hCWw0328wgKvA== tarball: file:projects/quantum-jobs.tgz version: 0.0.0 file:projects/schema-registry-avro.tgz: dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-inject': 4.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - avsc: 5.5.3 + avsc: 5.6.1 buffer: 5.7.1 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - karma: 5.2.3 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9814,47 +10273,48 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.19 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/schema-registry-avro' resolution: - integrity: sha512-WIat3YB9zIgvgNyg7brxLCN7gCiDyhVx2iFgF5Is+4y/MNTOf1cDxmq2rAdJLVD+2+H3d0+S0XylwmSLykRBTg== + integrity: sha512-IkbCxJeQAMMEP5TNnCNwwoJpCwuxiVRh7mwTBSQF7wcsT+qQsThEG1sdGZJDN4USU47H+bOLTIn4i6HzpfAvaA== tarball: file:projects/schema-registry-avro.tgz version: 0.0.0 file:projects/schema-registry.tgz: dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - karma: 5.2.3 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9865,49 +10325,48 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.19 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 dev: false name: '@rush-temp/schema-registry' resolution: - integrity: sha512-yy0HVV9mYB8FxDTNrhQqeQcq6XifjUWKFMQfrA9KE/XP8IfVKdwjYV7mb9DcD6kmCkEpTRtlw/UZL4SiYnxBbA== + integrity: sha512-zfAsAov4Ijx3nUSubjGXdLh6gEH6KE29iuZTSVqfzfVdmofxIXJBde0qRGfhr+tExpuvOygoBKeCLrDYtNI6HQ== tarball: file:projects/schema-registry.tgz version: 0.0.0 file:projects/search-documents.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 - chai: 4.3.0 + '@types/sinon': 9.0.11 + chai: 4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - events: 3.2.0 + eslint: 7.23.0 + events: 3.3.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9918,31 +10377,31 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/search-documents' resolution: - integrity: sha512-Sv1bJ9QUvQOXGxMJ8m+HDJyF9iXIPwZHOBoMyhOoxRdHULtMqHxaWkIjCF5/pV1i0l7S+Ioq6V4RKRLGgGyB1w== + integrity: sha512-s6q1IeKDrBUoqLNZvkvQjEMH1O0SERMeTj6+UPYlWJ2zfCRW+Wnavp5jPIlrqa9qDyUQRr+7HR2PDHterw63eA== tarball: file:projects/search-documents.tgz version: 0.0.0 file:projects/service-bus.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0_debug@4.3.1 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-inject': 4.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/debug': 4.1.5 '@types/glob': 7.1.3 @@ -9950,35 +10409,35 @@ packages: '@types/long': 4.0.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 - '@types/ws': 7.4.0 + '@types/sinon': 9.0.11 + '@types/ws': 7.4.1 assert: 1.5.0 buffer: 5.7.1 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 - chai-exclude: 2.0.2_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 + chai-exclude: 2.0.3_chai@4.3.4 cross-env: 7.0.3 debug: 4.3.1 delay: 4.4.1 dotenv: 8.2.0 downlevel-dts: 0.4.0 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 - events: 3.2.0 + events: 3.3.0 glob: 7.1.6 https-proxy-agent: 5.0.0 is-buffer: 2.0.5 jssha: 3.2.0 - karma: 5.2.3_debug@4.3.1 + karma: 6.3.2_debug@4.3.1 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 long: 4.0.0 mocha: 7.2.0 @@ -9989,58 +10448,57 @@ packages: process: 0.11.10 promise: 8.1.0 puppeteer: 3.3.0 - rhea-promise: 1.1.0 + rhea-promise: 1.2.1 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 sinon: 9.2.4 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - ws: 7.4.3 + typescript: 4.2.4 + ws: 7.4.4 dev: false name: '@rush-temp/service-bus' resolution: - integrity: sha512-xphAdLxETXLn1dV6/vfN9k+nCEg/2CKvAgrbTdL6Sv0flF3eUBMPYPekGq5MXKe85Eb/UAO2ge8RZO7QPaCyhg== + integrity: sha512-wYyGEJH+Xk4XpboHfLFEgWMQdfUDhpdU3xcykhlEN4knMb9GIyaKbAttspaHPQ8+g4xB7Mjh5BneIhyZKkiFCA== tarball: file:projects/service-bus.tgz version: 0.0.0 file:projects/storage-blob-changefeed.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 - '@azure/storage-blob': 12.4.1 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.10 + '@types/sinon': 9.0.11 assert: 1.5.0 cross-env: 7.0.3 dotenv: 8.2.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 - events: 3.2.0 + events: 3.3.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -10052,55 +10510,54 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 source-map-support: 0.5.19 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/storage-blob-changefeed' resolution: - integrity: sha512-ykcO/ViVTF0Lfk2MHd+BG6eP0XFYsHuBRRaYAb5bEJiD+9uPPj0N4qcMUPjRciAJOlRV2A2G2+ThY/AsfHbvzg== + integrity: sha512-OM29tpLQJ1smYWCdSnex9QAE4eSXp35OI7eyuolxmlhbL4b2xmn9c4VMjIYVxqN/mD9LIk7mNiOb6KYI57EtQg== tarball: file:projects/storage-blob-changefeed.tgz version: 0.0.0 file:projects/storage-blob.tgz: dependencies: - '@azure/core-https': 1.0.0-beta.1 - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/node-fetch': 2.5.8 + '@types/node-fetch': 2.5.10 assert: 1.5.0 cross-env: 7.0.3 dotenv: 8.2.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 - events: 3.2.0 + events: 3.3.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -10113,29 +10570,29 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.19 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/storage-blob' resolution: - integrity: sha512-Y5eO2dJze6mrzpq31hgys53/C2KYe7JGGiiasluVq+gcoqLU6yBo/UE1ad6WgoK+I2Y7EzY2LjrO1kXE2O38yQ== + integrity: sha512-zjsBvTJeN5+OX5qmry75Z71EW/mgT8oSGLlNlvbvjsjF41/so6m4oNpwBpQIw6oOp5vpqtV5G07Sh8u1vEQmnw== tarball: file:projects/storage-blob.tgz version: 0.0.0 file:projects/storage-file-datalake.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/query-string': 6.2.0 @@ -10144,23 +10601,23 @@ packages: dotenv: 8.2.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 - events: 3.2.0 + events: 3.3.0 execa: 3.4.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -10173,28 +10630,27 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.19 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/storage-file-datalake' resolution: - integrity: sha512-W5quuvIxHZQWIevkfCqx/pZW2vPJJMqpwlyOdIvhv/u5dHWn6z9fteDBpaEHSfEFdRa++7VeV5EjRPNEo3ED0A== + integrity: sha512-ru/ZA4Wf0gfKw5rRPBaavkwJYFftxm6j+S7uBJ7LgIpZplMidq2munB47jFBgjf0uaxHJ1Q/y/ssDCTrxFafTg== tarball: file:projects/storage-file-datalake.tgz version: 0.0.0 file:projects/storage-file-share.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 assert: 1.5.0 @@ -10202,22 +10658,22 @@ packages: dotenv: 8.2.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 - events: 3.2.0 + events: 3.3.0 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -10229,17 +10685,17 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.19 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/storage-file-share' resolution: - integrity: sha512-+SBMefnTwMHofdiZzY9PmdLx4QD6iIwrMrhuJvVAqlh1hco8oz0GMmPUyBU2PnQP9ArKvhxyUEMmVb/5XvtqGA== + integrity: sha512-HnwNTQpFsXEE3w7eCUYxqg5tRdqns2sQubgoNZ11LOwaf7NG4fstMX9cQS9jrX3iFwugvzZRNLtFei1DVCTzqw== tarball: file:projects/storage-file-share.tgz version: 0.0.0 file:projects/storage-internal-avro.tgz: @@ -10248,28 +10704,28 @@ packages: '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 assert: 1.5.0 dotenv: 8.2.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -10281,27 +10737,27 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.19 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 - typescript: 4.1.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/storage-internal-avro' resolution: - integrity: sha512-2FmKCVHxTxcbDVDze9oTlqfAazzRaEEt+k9wz4JkNQfEp4sW1plxMmlPREGhl7kNGhbmFDkv2OHsXZrOCSxPmg== + integrity: sha512-ijXPcHXtVAlwAuCPxthRhKVGICg0JLUBgSJzIDx7/eLhKy6CyasHkiNqGoo7J5UlTqMvnppniwvcY7wekJC/gQ== tarball: file:projects/storage-internal-avro.tgz version: 0.0.0 file:projects/storage-queue.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 assert: 1.5.0 @@ -10309,21 +10765,21 @@ packages: dotenv: 8.2.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.19.0 + eslint: 7.23.0 esm: 3.2.25 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -10335,178 +10791,206 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.19 - ts-node: 8.10.2_typescript@4.1.2 - tslib: 2.1.0 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/storage-queue' resolution: - integrity: sha512-e9haFMlyQ2lf7I8Bu+8uS57lFO1VHgzJBYT/MxQfiA9ZcMkeepnQcayP2NwWtDs+xAtjkusmayO3BgOeFhfVmw== + integrity: sha512-l9pNcxy2+Bpg/EJCPWt4NE8fvBCNiQP2IpdP+DnaeEeLe0AzN0ndRzX6RvCAc37evuTFCpKCxYDrq1T4QHsF0w== tarball: file:projects/storage-queue.tgz version: 0.0.0 file:projects/synapse-access-control.tgz: dependencies: + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - eslint: 7.19.0 + eslint: 7.23.0 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-node-resolve: 3.4.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - uglify-js: 3.12.6 + typescript: 4.2.4 + uglify-js: 3.13.3 dev: false name: '@rush-temp/synapse-access-control' resolution: - integrity: sha512-4Th0EFnoEAOHo/X5z5tL8niFeXcQ56uKH6DI8lTXDgyeqMxZFyf0Wv1rdn4AY6UdXLFyU0sa3V2dSK28dItBvQ== + integrity: sha512-T5E1KPIS1wrAwNd51LyztwQHa6jLLYqIERLwyM/aTvVCblYde1XvPNzV0njZfZQAGetDxavqmi5mq2+RttqmOw== tarball: file:projects/synapse-access-control.tgz version: 0.0.0 file:projects/synapse-artifacts.tgz: dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - eslint: 7.19.0 + '@types/chai': 4.2.16 + '@types/chai-as-promised': 7.1.3 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + '@types/sinon': 9.0.11 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-source-map-support: 1.4.0 + karma-sourcemap-loader: 0.3.8 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 1.19.1 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-node-resolve: 3.4.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - tslib: 2.1.0 + sinon: 9.2.4 + source-map-support: 0.5.19 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - uglify-js: 3.12.6 + typescript: 4.2.4 + uglify-js: 3.13.3 dev: false name: '@rush-temp/synapse-artifacts' resolution: - integrity: sha512-Mp14e7mwk+ull6rZN8e6rL7hBgPQD3bjpv2qjqJDH1fjpHOZlHG/VgHaB85WvkMfiK/ScxxAl4RgkObEP+A60w== + integrity: sha512-Y9sYEN8tQuoziYkBrOTK+gAe4iXdFYr4/HCMPKLgqm1Q2qyh3KCpBjtse060cilZpi8mazJiQuRsN5dipDx2+Q== tarball: file:projects/synapse-artifacts.tgz version: 0.0.0 file:projects/synapse-managed-private-endpoints.tgz: dependencies: + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - eslint: 7.19.0 + eslint: 7.23.0 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-node-resolve: 3.4.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - uglify-js: 3.12.6 + typescript: 4.2.4 + uglify-js: 3.13.3 dev: false name: '@rush-temp/synapse-managed-private-endpoints' resolution: - integrity: sha512-g4RF+C2JIydR6SY/uBwjMQ7dShS4Eqr1tQq9q95tjM6tNuoqcDXDuwDJGwjsi0V274eR+pth4yfGoAy5+vViNg== + integrity: sha512-qAjDuKyzNuS6ij/KGxCgSJEtAtyV2W4S6mc/X9jHWgo2RedJZTF95kaU46NgJ0sA63ly4o+zbFUvU61Nor+HmQ== tarball: file:projects/synapse-managed-private-endpoints.tgz version: 0.0.0 file:projects/synapse-monitoring.tgz: dependencies: + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - eslint: 7.19.0 + eslint: 7.23.0 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-node-resolve: 3.4.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - uglify-js: 3.12.6 + typescript: 4.2.4 + uglify-js: 3.13.3 dev: false name: '@rush-temp/synapse-monitoring' resolution: - integrity: sha512-pUeYmOWIqpCoqjVH0Kexc1iMCiw/hYRgCN4uCjEAYv8NJZ0UHLPvSTzx10W8cEi0iKxyRHEhb5yqdcP+56oCDw== + integrity: sha512-0dRH/5HvmJtO/D2Vq/BFj2YOty4pmMrnzBW/h/8zb2i6dzTzHTTsDEqDNW7KJzz9HgBaxkdLXpWLMMbmtzo55A== tarball: file:projects/synapse-monitoring.tgz version: 0.0.0 file:projects/synapse-spark.tgz: dependencies: + '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - eslint: 7.19.0 + eslint: 7.23.0 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-node-resolve: 3.4.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - tslib: 2.1.0 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 - uglify-js: 3.12.6 + typescript: 4.2.4 + uglify-js: 3.13.3 dev: false name: '@rush-temp/synapse-spark' resolution: - integrity: sha512-JOgzMv87L7sBXVnIz6khT2nLTEs3XTTdvRvbikZ/35ksg+WgNt0Legi+60EPTao9bP29MQ1a1ONqa4Iv23ve4w== + integrity: sha512-kJPpjboRrH7k+1JR9JH5QeGO70jcp+GfyyD6JlQt2bOSanKRb+671YLjLMiMuFeyYymLtrqWwjmYnLB7+i8qXg== tarball: file:projects/synapse-spark.tgz version: 0.0.0 file:projects/template.tgz: dependencies: - '@azure/core-tracing': 1.0.0-preview.9 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@opentelemetry/api': 0.10.2 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@typescript-eslint/eslint-plugin': 4.13.0_85649cb1d193687858ee685cdd7abf38 - '@typescript-eslint/parser': 4.13.0_eslint@7.19.0+typescript@4.1.2 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 dotenv: 8.2.0 - eslint: 7.19.0 - eslint-config-prettier: 7.2.0_eslint@7.19.0 - eslint-plugin-no-null: 1.0.2_eslint@7.19.0 - eslint-plugin-no-only-tests: 2.4.0 - eslint-plugin-promise: 4.2.1 + downlevel-dts: 0.4.0 + eslint: 7.23.0 + esm: 3.2.25 inherits: 2.0.4 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 nyc: 14.1.1 prettier: 1.19.1 rimraf: 3.0.2 rollup: 1.32.1 - tslib: 2.1.0 + source-map-support: 0.5.19 + tslib: 2.2.0 typedoc: 0.15.2 - typescript: 4.1.2 + typescript: 4.2.4 util: 0.12.3 dev: false name: '@rush-temp/template' resolution: - integrity: sha512-la2ln03RxlmOcz2yifcBlrGPjfvOlBA62qyogBWfpA7kvmeyssMW73fKi4TWN+KQv/H0hJ8FgDJj081qRISSdA== + integrity: sha512-mwHFZ1xypf2mBlIcqY/yi+3JKpTC54l/ZdImtdQ0ioOPW8ia9HXOVdK5Gc0Kmk0Bhe4Wjw+K1cnBPSbB5WlFXA== tarball: file:projects/template.tgz version: 0.0.0 file:projects/test-utils-multi-version.tgz: dependencies: '@microsoft/api-extractor': 7.7.11 - '@types/chai': 4.2.14 + '@types/chai': 4.2.16 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - chai: 4.3.0 - chai-as-promised: 7.1.1_chai@4.3.0 - eslint: 7.19.0 - karma: 5.2.3 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 karma-env-preprocessor: 0.1.1 @@ -10514,22 +10998,21 @@ packages: prettier: 1.19.1 rimraf: 3.0.2 rollup: 1.32.1 - tslib: 2.1.0 - typescript: 4.1.2 + tslib: 2.2.0 + typescript: 4.2.4 dev: false name: '@rush-temp/test-utils-multi-version' resolution: - integrity: sha512-U0DDGv+oz4TBx12RGZuOsCVtW5RjjA34eFywEa71wxiRJrjWwcKWJutCLh6OlTAjVFWftdrlCwmtpnk4/7tAXg== + integrity: sha512-uNtK2ZrbsqB4kp9hgXR4A0DT561htuu0lvY0Y5OR4qn+1iTFPtqluk57cLJaiRUjqWP/7NzD8DuAk1/RqBskTA== tarball: file:projects/test-utils-multi-version.tgz version: 0.0.0 file:projects/test-utils-perfstress.tgz: dependencies: - '@opentelemetry/api': 0.10.2 '@types/minimist': 1.2.1 '@types/node': 8.10.66 - '@types/node-fetch': 2.5.8 - eslint: 7.19.0 - karma: 5.2.3 + '@types/node-fetch': 2.5.10 + eslint: 7.23.0 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 karma-env-preprocessor: 0.1.1 @@ -10537,52 +11020,52 @@ packages: node-fetch: 2.6.1 prettier: 1.19.1 rimraf: 3.0.2 - tslib: 2.1.0 - typescript: 4.1.2 + tslib: 2.2.0 + typescript: 4.2.4 dev: false name: '@rush-temp/test-utils-perfstress' resolution: - integrity: sha512-xO4V+yYsQ0PZejVwvZGFThwd2nQoGhovX4Vo7TlCyKJ/uHxSAjC0v972vzz7qpA9FTseiYshYUrKtSdoBqewPg== + integrity: sha512-geLp/JBJeW2giloLIcyydf9F4IRvX0gS80Kd808HRdLMr8YUnMeK97Ad3ks4WfPq14VWfGuQ5zpxWb2adWyxHg== tarball: file:projects/test-utils-perfstress.tgz version: 0.0.0 file:projects/test-utils-recorder.tgz: dependencies: - '@opentelemetry/api': 0.10.2 + '@azure/core-tracing': 1.0.0-preview.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.3.4_rollup@1.32.1 - '@types/chai': 4.2.14 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 '@types/fs-extra': 8.1.1 - '@types/md5': 2.2.1 + '@types/md5': 2.3.0 '@types/mocha': 7.0.2 '@types/mock-fs': 4.10.0 '@types/mock-require': 2.0.0 '@types/nise': 1.4.0 '@types/node': 8.10.66 - chai: 4.3.0 + chai: 4.3.4 dotenv: 8.2.0 - eslint: 7.19.0 + eslint: 7.23.0 fs-extra: 8.1.0 - karma: 5.2.3 + karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@5.2.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@5.2.3 - karma-json-preprocessor: 0.3.3_karma@5.2.3 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@5.2.3 + karma-junit-reporter: 2.0.1_karma@6.3.2 karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@5.2.3 + karma-mocha-reporter: 2.2.5_karma@6.3.2 karma-sourcemap-loader: 0.3.8 md5: 2.3.0 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 mock-fs: 4.13.0 mock-require: 3.0.3 - nise: 4.0.4 + nise: 4.1.0 nock: 12.0.3 npm-run-all: 4.1.5 nyc: 14.1.1 @@ -10592,62 +11075,44 @@ packages: rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.0_rollup@1.32.1 - tslib: 2.1.0 - typescript: 4.1.2 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + tslib: 2.2.0 + typescript: 4.2.4 xhr-mock: 2.5.1 dev: false name: '@rush-temp/test-utils-recorder' resolution: - integrity: sha512-HbbQjbq3UyuhaUzKIEPr0UVOijScGpUPbQ1shjONeT79MKd+AVFCKcZ60RBebj0XIO4Y/lNJ9hrVRyEuF3Nucg== + integrity: sha512-+z4Le1dPD7946nToxQrse/mrMXuoJDo2Cko9iUDRTFxF2+1vs9a2WEawBV2iW4KckezsAyswjjxTrWYFl5Vyyg== tarball: file:projects/test-utils-recorder.tgz version: 0.0.0 - file:projects/testhub.tgz: - dependencies: - '@azure/event-hubs': 2.1.4 - '@types/node': 8.10.66 - '@types/uuid': 8.3.0 - '@types/yargs': 15.0.13 - async-lock: 1.2.8 - death: 1.1.0 - debug: 4.3.1 - eslint: 7.19.0 - rhea: 1.0.24 - rimraf: 3.0.2 - tslib: 2.1.0 - typescript: 4.1.2 - uuid: 8.3.2 - yargs: 15.4.1 - dev: false - name: '@rush-temp/testhub' - resolution: - integrity: sha512-HdIdDAAHx0bZpTjzl4xH0KPQUYPdfcJgNiZpAQzbVrhePPH/giaWNW0OMrD4PkKdo9iCrbsA4EN3tTb4z4gavQ== - tarball: file:projects/testhub.tgz - version: 0.0.0 registry: '' specifiers: '@rush-temp/abort-controller': file:./projects/abort-controller.tgz '@rush-temp/ai-anomaly-detector': file:./projects/ai-anomaly-detector.tgz + '@rush-temp/ai-document-translator': file:./projects/ai-document-translator.tgz '@rush-temp/ai-form-recognizer': file:./projects/ai-form-recognizer.tgz '@rush-temp/ai-metrics-advisor': file:./projects/ai-metrics-advisor.tgz '@rush-temp/ai-text-analytics': file:./projects/ai-text-analytics.tgz '@rush-temp/app-configuration': file:./projects/app-configuration.tgz '@rush-temp/attestation': file:./projects/attestation.tgz - '@rush-temp/communication-administration': file:./projects/communication-administration.tgz '@rush-temp/communication-chat': file:./projects/communication-chat.tgz '@rush-temp/communication-common': file:./projects/communication-common.tgz '@rush-temp/communication-identity': file:./projects/communication-identity.tgz + '@rush-temp/communication-phone-numbers': file:./projects/communication-phone-numbers.tgz '@rush-temp/communication-sms': file:./projects/communication-sms.tgz + '@rush-temp/container-registry': file:./projects/container-registry.tgz '@rush-temp/core-amqp': file:./projects/core-amqp.tgz '@rush-temp/core-asynciterator-polyfill': file:./projects/core-asynciterator-polyfill.tgz '@rush-temp/core-auth': file:./projects/core-auth.tgz '@rush-temp/core-client': file:./projects/core-client.tgz + '@rush-temp/core-client-1': file:./projects/core-client-1.tgz '@rush-temp/core-crypto': file:./projects/core-crypto.tgz '@rush-temp/core-http': file:./projects/core-http.tgz - '@rush-temp/core-https': file:./projects/core-https.tgz '@rush-temp/core-lro': file:./projects/core-lro.tgz '@rush-temp/core-paging': file:./projects/core-paging.tgz + '@rush-temp/core-rest-pipeline': file:./projects/core-rest-pipeline.tgz '@rush-temp/core-tracing': file:./projects/core-tracing.tgz + '@rush-temp/core-util': file:./projects/core-util.tgz '@rush-temp/core-xml': file:./projects/core-xml.tgz '@rush-temp/cosmos': file:./projects/cosmos.tgz '@rush-temp/data-tables': file:./projects/data-tables.tgz @@ -10659,6 +11124,7 @@ specifiers: '@rush-temp/eventgrid': file:./projects/eventgrid.tgz '@rush-temp/eventhubs-checkpointstore-blob': file:./projects/eventhubs-checkpointstore-blob.tgz '@rush-temp/identity': file:./projects/identity.tgz + '@rush-temp/iot-device-update': file:./projects/iot-device-update.tgz '@rush-temp/iot-modelsrepository-client': file:./projects/iot-modelsrepository-client.tgz '@rush-temp/keyvault-admin': file:./projects/keyvault-admin.tgz '@rush-temp/keyvault-certificates': file:./projects/keyvault-certificates.tgz @@ -10666,8 +11132,21 @@ specifiers: '@rush-temp/keyvault-keys': file:./projects/keyvault-keys.tgz '@rush-temp/keyvault-secrets': file:./projects/keyvault-secrets.tgz '@rush-temp/logger': file:./projects/logger.tgz + '@rush-temp/mixedreality-authentication': file:./projects/mixedreality-authentication.tgz '@rush-temp/mock-hub': file:./projects/mock-hub.tgz '@rush-temp/monitor-opentelemetry-exporter': file:./projects/monitor-opentelemetry-exporter.tgz + '@rush-temp/perf-ai-form-recognizer': file:./projects/perf-ai-form-recognizer.tgz + '@rush-temp/perf-ai-metrics-advisor': file:./projects/perf-ai-metrics-advisor.tgz + '@rush-temp/perf-ai-text-analytics': file:./projects/perf-ai-text-analytics.tgz + '@rush-temp/perf-eventgrid': file:./projects/perf-eventgrid.tgz + '@rush-temp/perf-identity': file:./projects/perf-identity.tgz + '@rush-temp/perf-keyvault-certificates': file:./projects/perf-keyvault-certificates.tgz + '@rush-temp/perf-keyvault-keys': file:./projects/perf-keyvault-keys.tgz + '@rush-temp/perf-keyvault-secrets': file:./projects/perf-keyvault-secrets.tgz + '@rush-temp/perf-search-documents': file:./projects/perf-search-documents.tgz + '@rush-temp/perf-storage-blob': file:./projects/perf-storage-blob.tgz + '@rush-temp/perf-storage-file-datalake': file:./projects/perf-storage-file-datalake.tgz + '@rush-temp/perf-storage-file-share': file:./projects/perf-storage-file-share.tgz '@rush-temp/quantum-jobs': file:./projects/quantum-jobs.tgz '@rush-temp/schema-registry': file:./projects/schema-registry.tgz '@rush-temp/schema-registry-avro': file:./projects/schema-registry-avro.tgz @@ -10688,4 +11167,3 @@ specifiers: '@rush-temp/test-utils-multi-version': file:./projects/test-utils-multi-version.tgz '@rush-temp/test-utils-perfstress': file:./projects/test-utils-perfstress.tgz '@rush-temp/test-utils-recorder': file:./projects/test-utils-recorder.tgz - '@rush-temp/testhub': file:./projects/testhub.tgz diff --git a/rush.json b/rush.json index 49da795e8796..ceeb7465d2f9 100644 --- a/rush.json +++ b/rush.json @@ -650,7 +650,7 @@ { "packageName": "@azure/iot-modelsrepository-client", "projectFolder": "sdk/iot/modelsrepository", - "versionPolicyName": "core" + "versionPolicyName": "client" }, { "packageName": "@azure-tests/perf-ai-form-recognizer", diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index c276b6a1c81b..9b89481384e8 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -64,11 +64,10 @@ "sideEffects": false, "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", "dependencies": { - "@azure/core-client": "1.0.0-beta.1", - "@azure/core-rest-pipeline": "1.0.2", - "@azure/core-tracing": "1.0.0-preview.9", + "@azure/core-client": "^1.0.0", + "@azure/core-rest-pipeline": "^1.0.0", + "@azure/core-tracing": "1.0.0-preview.11", "@azure/logger": "^1.0.0", - "@opentelemetry/api": "^0.10.2", "events": "^3.0.0", "tslib": "^2.0.0" }, @@ -91,7 +90,7 @@ "dotenv": "^8.2.0", "eslint": "^7.15.0", "inherits": "^2.0.3", - "karma": "^5.1.0", + "karma": "^6.2.0", "karma-chrome-launcher": "^3.0.0", "karma-coverage": "^2.0.0", "karma-edge-launcher": "^0.4.2", @@ -113,9 +112,9 @@ "rollup-plugin-terser": "^5.1.1", "rollup-plugin-visualizer": "^4.0.4", "sinon": "^9.0.2", - "ts-node": "^8.3.0", + "ts-node": "^9.0.0", "typedoc": "0.15.2", - "typescript": "4.1.2", + "typescript": "~4.2.0", "util": "^0.12.1" }, "standard": { diff --git a/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md b/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md new file mode 100644 index 000000000000..a30ba7e29717 --- /dev/null +++ b/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md @@ -0,0 +1,43 @@ +## API Report File for "@azure/iot-modelsrepository-client" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { InternalClientPipelineOptions } from '@azure/core-client'; + +// @public +export class ModelsRepositoryClient { + constructor(options?: ModelsRepositoryClientOptions); + // (undocumented) + get apiVersion(): string; + // (undocumented) + client: any; + // Warning: (ae-forgotten-export) The symbol "getModelsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + getModels(dtmi: string, options?: getModelsOptions): Promise<{ + [dtmi: string]: any; + }>; + // (undocumented) + getModels(dtmis: string[], options?: getModelsOptions): Promise<{ + [dtmi: string]: any; + }>; + } + +// @public (undocumented) +export interface ModelsRepositoryClientOptions extends InternalClientPipelineOptions { + // (undocumented) + apiVersion?: string; + // Warning: (ae-forgotten-export) The symbol "dependencyResolutionType" needs to be exported by the entry point index.d.ts + // + // (undocumented) + dependencyResolution?: dependencyResolutionType; + // (undocumented) + repositoryLocation?: string; +} + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/iot/modelsrepository/samples/typescript/src/example.ts b/sdk/iot/modelsrepository/samples/typescript/src/example.ts index f8a2e1f200a9..db879553741f 100644 --- a/sdk/iot/modelsrepository/samples/typescript/src/example.ts +++ b/sdk/iot/modelsrepository/samples/typescript/src/example.ts @@ -5,7 +5,7 @@ * Demonstrates resolving/obtaining a particular model definition from a remote model repository */ -import * as resolver from "@azure/iot-modelsrepository-resolver"; +import {ModelsRepositoryClient} from "../../../src"; const repositoryEndpoint = "devicemodels.azure.com"; const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; @@ -13,7 +13,8 @@ const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1 console.log(repositoryEndpoint, dtmi); async function main() { - const result = await resolver.resolve(dtmi, repositoryEndpoint); + const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); + const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); console.log(result); } diff --git a/sdk/iot/modelsrepository/src/client.ts b/sdk/iot/modelsrepository/src/client.ts index 90afc5613e72..cbdcb16da2f5 100644 --- a/sdk/iot/modelsrepository/src/client.ts +++ b/sdk/iot/modelsrepository/src/client.ts @@ -3,7 +3,7 @@ import * as constants from "./constants"; -import { createClientPipeline, ClientPipelineOptions } from "@azure/core-client"; +import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; import { dependencyResolutionType } from "./dependencyResolutionType"; import { logger } from "./logger"; import { URL } from "url"; @@ -15,7 +15,59 @@ import * as path from "path"; import { PseudoParser } from "./psuedoParser"; import { MyServiceClient } from "./serviceClient"; -export interface ModelsRepositoryClientOptions extends ClientPipelineOptions { +/** + * This is the ModelsRepositoryClient Library for Javascript. + * + * @remarks + * This ModelsRepositoryClient is built around getting DTDL Models from a user-specified + * location. The two main variables are the repositoryLocation, which is a path or URI to either a remote + * or local repository where the models are located, and the dtmis, which can be one or more dtmis that + * will be mapped to specific models contained in the repository location that the user wishes to get. + * + * @example + * Inline code: + * ```typescript + * import lib + * import {ModelsRepositoryClient} from "../../../src"; + * + * const repositoryEndpoint = "devicemodels.azure.com"; + * const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; + * + * console.log(repositoryEndpoint, dtmi); + * + * async function main() { + * const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); + * const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); + * console.log(result); + * } + * + * main().catch((err) => { + * console.error("The sample encountered an error:", err); + * }); + * + * ``` + * + * @packageDocumentation + */ + +import * as resolver from "@azure/iot-modelsrepository-resolver"; + +const repositoryEndpoint = "devicemodels.azure.com"; +const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; + +console.log(repositoryEndpoint, dtmi); + +async function main() { + const result = await resolver.resolve(dtmi, repositoryEndpoint); + console.log(result); +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); + + +export interface ModelsRepositoryClientOptions extends InternalClientPipelineOptions { repositoryLocation?: string; apiVersion?: string; dependencyResolution?: dependencyResolutionType; @@ -72,7 +124,7 @@ export class ModelsRepositoryClient { pipelineOptions.userAgentOptions.userAgentPrefix = constants.DEFAULT_USER_AGENT; } - const internalPipelineOptions: ClientPipelineOptions = { + const internalPipelineOptions: InternalClientPipelineOptions = { ...pipelineOptions, ...{ loggingOptions: { From 04077876d8c5ff7c8451b1f0736e48018fc150e6 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 22 Apr 2021 09:14:55 -0700 Subject: [PATCH 17/81] update documentation --- .../review/iot-modelsrepository-client.api.md | 28 ++-- .../samples/typescript/tsconfig.json | 13 +- sdk/iot/modelsrepository/src/client.ts | 134 ++++++++---------- .../src/dependencyResolutionType.ts | 9 ++ sdk/iot/modelsrepository/src/index.ts | 44 +++++- .../src/interfaces/getModelsOptions.ts | 16 +++ .../modelsRepositoryClientOptions.ts | 30 ++++ sdk/iot/modelsrepository/src/internal.ts | 15 ++ ...ts => iotModelsRepositoryServiceClient.ts} | 8 +- 9 files changed, 193 insertions(+), 104 deletions(-) create mode 100644 sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts create mode 100644 sdk/iot/modelsrepository/src/interfaces/modelsRepositoryClientOptions.ts create mode 100644 sdk/iot/modelsrepository/src/internal.ts rename sdk/iot/modelsrepository/src/{serviceClient.ts => iotModelsRepositoryServiceClient.ts} (70%) diff --git a/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md b/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md index a30ba7e29717..3b859bdc6768 100644 --- a/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md +++ b/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md @@ -6,38 +6,32 @@ import { InternalClientPipelineOptions } from '@azure/core-client'; +// @public +export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded" | undefined; + +// @public +export interface GetModelsOptions { + dependencyResolution: dependencyResolutionType; +} + // @public export class ModelsRepositoryClient { constructor(options?: ModelsRepositoryClientOptions); - // (undocumented) get apiVersion(): string; - // (undocumented) - client: any; - // Warning: (ae-forgotten-export) The symbol "getModelsOptions" needs to be exported by the entry point index.d.ts - // - // (undocumented) - getModels(dtmi: string, options?: getModelsOptions): Promise<{ + getModels(dtmis: string, options?: GetModelsOptions): Promise<{ [dtmi: string]: any; }>; - // (undocumented) - getModels(dtmis: string[], options?: getModelsOptions): Promise<{ + getModels(dtmis: string[], options?: GetModelsOptions): Promise<{ [dtmi: string]: any; }>; } -// @public (undocumented) +// @public export interface ModelsRepositoryClientOptions extends InternalClientPipelineOptions { - // (undocumented) apiVersion?: string; - // Warning: (ae-forgotten-export) The symbol "dependencyResolutionType" needs to be exported by the entry point index.d.ts - // - // (undocumented) dependencyResolution?: dependencyResolutionType; - // (undocumented) repositoryLocation?: string; } -// (No @packageDocumentation comment for this package) - ``` diff --git a/sdk/iot/modelsrepository/samples/typescript/tsconfig.json b/sdk/iot/modelsrepository/samples/typescript/tsconfig.json index 3a37abdb0902..45ae4f140477 100644 --- a/sdk/iot/modelsrepository/samples/typescript/tsconfig.json +++ b/sdk/iot/modelsrepository/samples/typescript/tsconfig.json @@ -1,9 +1,16 @@ { - "extends": "../tsconfig.json", + "extends": "../../tsconfig.json", "compilerOptions": { "module": "commonjs", "outDir": "typescript/dist" }, - "include": ["typescript/src/**.ts"], - "exclude": ["typescript/*.json", "**/node_modules/", "../node_modules", "../typings"] + "include": [ + "typescript/src/**.ts" + ], + "exclude": [ + "typescript/*.json", + "**/node_modules/", + "../node_modules", + "../typings" + ] } diff --git a/sdk/iot/modelsrepository/src/client.ts b/sdk/iot/modelsrepository/src/client.ts index cbdcb16da2f5..7cf6eac5eaa2 100644 --- a/sdk/iot/modelsrepository/src/client.ts +++ b/sdk/iot/modelsrepository/src/client.ts @@ -3,78 +3,26 @@ import * as constants from "./constants"; +import { + GetModelsOptions, + IoTModelsRepositoryServiceClient, + ModelsRepositoryClientOptions, + dependencyResolutionType, + isLocalPath, + HttpFetcher, + FilesystemFetcher, + PseudoParser, + DtmiResolver, + ResolverError, + logger +} from "./internal"; import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; -import { dependencyResolutionType } from "./dependencyResolutionType"; -import { logger } from "./logger"; import { URL } from "url"; -import { DtmiResolver, ResolverError } from "./resolver"; -import { HttpFetcher } from "./httpModelFetcher"; -import { FilesystemFetcher } from "./filesystemModelFetcher"; -import { isLocalPath } from "./modelFetcherHelper"; import * as path from "path"; -import { PseudoParser } from "./psuedoParser"; -import { MyServiceClient } from "./serviceClient"; -/** - * This is the ModelsRepositoryClient Library for Javascript. - * - * @remarks - * This ModelsRepositoryClient is built around getting DTDL Models from a user-specified - * location. The two main variables are the repositoryLocation, which is a path or URI to either a remote - * or local repository where the models are located, and the dtmis, which can be one or more dtmis that - * will be mapped to specific models contained in the repository location that the user wishes to get. - * - * @example - * Inline code: - * ```typescript - * import lib - * import {ModelsRepositoryClient} from "../../../src"; - * - * const repositoryEndpoint = "devicemodels.azure.com"; - * const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; - * - * console.log(repositoryEndpoint, dtmi); - * - * async function main() { - * const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); - * const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); - * console.log(result); - * } - * - * main().catch((err) => { - * console.error("The sample encountered an error:", err); - * }); - * - * ``` - * - * @packageDocumentation - */ - -import * as resolver from "@azure/iot-modelsrepository-resolver"; - -const repositoryEndpoint = "devicemodels.azure.com"; -const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; - -console.log(repositoryEndpoint, dtmi); - -async function main() { - const result = await resolver.resolve(dtmi, repositoryEndpoint); - console.log(result); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - - -export interface ModelsRepositoryClientOptions extends InternalClientPipelineOptions { - repositoryLocation?: string; - apiVersion?: string; - dependencyResolution?: dependencyResolutionType; -} /** - * Client providing APIs for Models Repository Operations + * Initializes a new instance of the IoT Models Repository Client. */ export class ModelsRepositoryClient { private _repositoryLocation: string; @@ -83,8 +31,11 @@ export class ModelsRepositoryClient { private _fetcher: any; private _resolver: any; private _pseudoParser: any; - client: any; + /** + * The ModelsRepositoryClient constructor + * @param options - The models repository client options that govern the behavior of the client. + */ constructor(options?: ModelsRepositoryClientOptions) { this._repositoryLocation = options?.repositoryLocation || constants.DEFAULT_REPOSITORY_LOCATION; logger.info(`Client configured for repository location ${this._repositoryLocation}`); @@ -100,7 +51,12 @@ export class ModelsRepositoryClient { this._apiVersion = options?.apiVersion || constants.DEFAULT_API_VERSION; } - private _checkDefaultDependencyResolution(customRepository: boolean) { + + /** + * improves the readability of the constructor. + * based on a boolean returns the proper dependency resolution setting string. + */ + private _checkDefaultDependencyResolution(customRepository: boolean): dependencyResolutionType { if (customRepository) { return "enabled"; } else { @@ -108,10 +64,20 @@ export class ModelsRepositoryClient { } } + /** + * Though currently not relevant, can specify API Version for communicating with + * the service. + */ get apiVersion() { return this._apiVersion; } + /** + * Because of the local / remote optionality of this client, the service client + * must be dynamically generated based on the repository location. If the provided + * repository location is a remote location, then this private method will be used + * to create the IoT Models Repository Service Client. + */ private _createClient(options: any) { const { ...pipelineOptions } = options; @@ -134,12 +100,17 @@ export class ModelsRepositoryClient { }; const pipeline = createClientPipeline(internalPipelineOptions); - const client = new MyServiceClient(this._repositoryLocation, { pipeline }); + const client = new IoTModelsRepositoryServiceClient(this._repositoryLocation, { pipeline }); return client; } + /** + * The fetcher is an abstraction necessary since this client can communicate with remote or local + * Model Repositories based on the provided location. It will analyze the provided location based + * on that create either an HTTP Fetcher, which uses the IoT Models Repository Service Client, + * or a Filesystem Fetcher. + */ private _createFetcher(location: string, options: any) { - // Return a Fetcher based upon the type of location let locationURL; let fetcher; if (isLocalPath(location)) { @@ -165,7 +136,6 @@ export class ModelsRepositoryClient { const fLocation = "https://" + location; const client = this._createClient(options); fetcher = new HttpFetcher(fLocation, client); - // TODO: make the next line match a regex specified. } else { throw new EvalError(`Unable to identify location: ${location}`); } @@ -174,11 +144,23 @@ export class ModelsRepositoryClient { return fetcher; } - getModels(dtmi: string, options?: getModelsOptions): Promise<{ [dtmi: string]: any }>; - getModels(dtmis: string[], options?: getModelsOptions): Promise<{ [dtmi: string]: any }>; + /** + * Retrieve one or more models based upon on or more provided dtmis. + * @param {string} dtmis - one dtmi represented as a string + * @param {GetModelsOptions} options - options to govern behavior of model getter. + * @returns {Promise<{ [dtmi: string]: any}>} + */ + getModels(dtmis: string, options?: GetModelsOptions): Promise<{ [dtmi: string]: any }>; + /** + * Retrieve one or more models based upon on or more provided dtmis. + * @param {string[]} dtmis - dtmi strings in an array. + * @param {GetModelsOptions} options - options to govern behavior of model getter. + * @returns {Promise<{ [dtmi: string]: any}>} + */ + getModels(dtmis: string[], options?: GetModelsOptions): Promise<{ [dtmi: string]: any }>; getModels( dtmis: string | string[], - options?: getModelsOptions + options?: GetModelsOptions ): Promise<{ [dtmi: string]: any }> { let modelMap; if (!Array.isArray(dtmis)) { @@ -216,7 +198,3 @@ export class ModelsRepositoryClient { return modelMap; } } - -interface getModelsOptions { - dependencyResolution: dependencyResolutionType; -} diff --git a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts index b7e5f79a7b27..c19a92b4bd56 100644 --- a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts +++ b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts @@ -1,4 +1,13 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. +/** + * @name dependencyResolutionType + * + * @description + * either dependency resolution is disabled, and only the client will get only the model linked to the dtmi, + * it is enabled, and the client will resolve all dependency models linked to the dtmi within the endpoint, + * or it is set to tryFromExpanded, where the client will attempt to get the expanded JSON format from the endpoint, + * and in the event of failure will fallback on the standard enabled dependency resolution. + */ export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded" | undefined; diff --git a/sdk/iot/modelsrepository/src/index.ts b/sdk/iot/modelsrepository/src/index.ts index 6f6eede48edb..9c25b522ce02 100644 --- a/sdk/iot/modelsrepository/src/index.ts +++ b/sdk/iot/modelsrepository/src/index.ts @@ -1,5 +1,45 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -// exporting the resolver api -export * from "./client"; +/** + * This is the ModelsRepositoryClient Library for Javascript. + * Why Models and not Model? Because there's more than one Model. + * + * @remarks + * This ModelsRepositoryClient is built around getting DTDL Models from a user-specified + * location. The two main variables are the repositoryLocation, which is a path or URI to either a remote + * or local repository where the models are located, and the dtmis, which can be one or more dtmis that + * will be mapped to specific models contained in the repository location that the user wishes to get. + * + * @example + * Inline code: + * ```typescript + * import lib + * import {ModelsRepositoryClient} from "../../../src"; + * + * const repositoryEndpoint = "devicemodels.azure.com"; + * const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; + * + * console.log(repositoryEndpoint, dtmi); + * + * async function main() { + * const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); + * const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); + * console.log(result); + * } + * + * main().catch((err) => { + * console.error("The sample encountered an error:", err); + * }); + * + * ``` + * + * @packageDocumentation + */ + +export { + ModelsRepositoryClient, + ModelsRepositoryClientOptions, + GetModelsOptions, + dependencyResolutionType, +} from "./internal" diff --git a/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts b/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts new file mode 100644 index 000000000000..59adc286eec8 --- /dev/null +++ b/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +import { dependencyResolutionType } from "../internal"; + +/** + * Options for getting models. + */ +export interface GetModelsOptions { + /** + * This is the format of dependency resolution (no dependency resolution, standard dependency + * resolution, resolution using the expanded json format) that will be used when retrieving + * models. This overwrites the default dependencyResolution settings of the client. + */ + dependencyResolution: dependencyResolutionType; +} diff --git a/sdk/iot/modelsrepository/src/interfaces/modelsRepositoryClientOptions.ts b/sdk/iot/modelsrepository/src/interfaces/modelsRepositoryClientOptions.ts new file mode 100644 index 000000000000..3accf3d8ddaa --- /dev/null +++ b/sdk/iot/modelsrepository/src/interfaces/modelsRepositoryClientOptions.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +import { InternalClientPipelineOptions } from "@azure/core-client"; +import { dependencyResolutionType } from "../internal"; + + +/** + * Options for creating a Pipeline to use with ModelsRepositoryClient. + * It serves to configure the client itself, for instance by specifying + * the repository location to use on any getModels call. + */ +export interface ModelsRepositoryClientOptions extends InternalClientPipelineOptions { + /** + * This is the base location (URI or path) that requests will be made against for this client. + */ + repositoryLocation?: string; + /** + * Though currently not relevant, can be used in future iterations to specify the API Version + * of the service. + */ + apiVersion?: string; + + /** + * This is the format of dependency resolution (no dependency resolution, standard dependency + * resolution, resolution using the expanded json format) that will be used when retrieving + * models. + */ + dependencyResolution?: dependencyResolutionType; +} diff --git a/sdk/iot/modelsrepository/src/internal.ts b/sdk/iot/modelsrepository/src/internal.ts new file mode 100644 index 000000000000..e5e4256f47fb --- /dev/null +++ b/sdk/iot/modelsrepository/src/internal.ts @@ -0,0 +1,15 @@ +export * from './client'; +export * from './constants'; +export * from './dependencyResolutionType'; +export * from './dtmiConventions'; +export * from './fetcher'; +export * from './filesystemModelFetcher'; +export * from './httpModelFetcher'; +export * from './iotModelsRepositoryServiceClient'; +export * from './logger'; +export * from './modelFetcherHelper'; +export * from './psuedoParser'; +export * from './resolver'; + +export * from './interfaces/getModelsOptions'; +export * from './interfaces/modelsRepositoryClientOptions'; diff --git a/sdk/iot/modelsrepository/src/serviceClient.ts b/sdk/iot/modelsrepository/src/iotModelsRepositoryServiceClient.ts similarity index 70% rename from sdk/iot/modelsrepository/src/serviceClient.ts rename to sdk/iot/modelsrepository/src/iotModelsRepositoryServiceClient.ts index a42c440f2d6a..d8d6759a1f99 100644 --- a/sdk/iot/modelsrepository/src/serviceClient.ts +++ b/sdk/iot/modelsrepository/src/iotModelsRepositoryServiceClient.ts @@ -3,12 +3,12 @@ import { ServiceClientOptions, ServiceClient } from "@azure/core-client"; -interface MyServiceClientOptions extends ServiceClientOptions { +interface IoTModelsRepositoryServiceClientOptions extends ServiceClientOptions { version?: string; endpoint?: string; } -export class MyServiceClient extends ServiceClient { +export class IoTModelsRepositoryServiceClient extends ServiceClient { url: string; version: string; @@ -17,8 +17,8 @@ export class MyServiceClient extends ServiceClient { * @param url The URL of the service account or table that is the target of the desired operation. * @param options The parameter options */ - constructor(url: string, options: MyServiceClientOptions = {}) { - const defaults: MyServiceClientOptions = { + constructor(url: string, options: IoTModelsRepositoryServiceClientOptions = {}) { + const defaults: IoTModelsRepositoryServiceClientOptions = { baseUri: `${url}`, requestContentType: "application/json; charset=utf-8" }; From d20073c2b2adf071657f6c3be4cd3977f085518e Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Sat, 24 Apr 2021 14:15:18 -0700 Subject: [PATCH 18/81] example changes and bugfixes --- .../samples/javascript/remote_example.js | 10 ++- sdk/iot/modelsrepository/src/client.ts | 63 ++++++++++--------- .../modelsrepository/src/dtmiConventions.ts | 7 ++- .../modelsrepository/src/httpModelFetcher.ts | 9 ++- sdk/iot/modelsrepository/src/psuedoParser.ts | 19 +++--- sdk/iot/modelsrepository/src/resolver.ts | 8 +-- 6 files changed, 60 insertions(+), 56 deletions(-) diff --git a/sdk/iot/modelsrepository/samples/javascript/remote_example.js b/sdk/iot/modelsrepository/samples/javascript/remote_example.js index b4e4207ccc4a..6f0b36e6807a 100644 --- a/sdk/iot/modelsrepository/samples/javascript/remote_example.js +++ b/sdk/iot/modelsrepository/samples/javascript/remote_example.js @@ -5,7 +5,11 @@ * Demonstrates resolving/obtaining a particular model definition from a remote model repository */ -const DtmiResolver = require("../../dist-esm/src/client"); +const lib = require("../../dist/index.js"); + +const logger = require('@azure/logger'); +logger.setLogLevel('info'); + // You can change the endpoint and dtmi you'd like to access const repositoryLocation = "https://devicemodels.azure.com/"; @@ -15,8 +19,8 @@ console.log(repositoryLocation, dtmi); async function main() { // This is where you can change the options for how you want to resolve the dependencies. - const client = new DtmiResolver(repositoryLocation); - const result = await client.getmodels(dtmi); + const client = new lib.ModelsRepositoryClient(repositoryLocation); + const result = client.getModels(dtmi); console.log(result); Object.keys(result).forEach((fetchedDtmi) => { console.log(`DTMI is: ${fetchedDtmi}`); diff --git a/sdk/iot/modelsrepository/src/client.ts b/sdk/iot/modelsrepository/src/client.ts index 7cf6eac5eaa2..592d55c738ba 100644 --- a/sdk/iot/modelsrepository/src/client.ts +++ b/sdk/iot/modelsrepository/src/client.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import * as constants from "./constants"; - import { GetModelsOptions, IoTModelsRepositoryServiceClient, @@ -14,11 +12,13 @@ import { PseudoParser, DtmiResolver, ResolverError, - logger + logger, } from "./internal"; +import * as cnst from './constants'; import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; import { URL } from "url"; import * as path from "path"; +import { Fetcher } from "./fetcher"; /** @@ -28,27 +28,27 @@ export class ModelsRepositoryClient { private _repositoryLocation: string; private _dependencyResolution: dependencyResolutionType; private _apiVersion: string; - private _fetcher: any; - private _resolver: any; - private _pseudoParser: any; + private _fetcher: Fetcher; + private _resolver: DtmiResolver; + private _pseudoParser: PseudoParser; /** * The ModelsRepositoryClient constructor * @param options - The models repository client options that govern the behavior of the client. */ - constructor(options?: ModelsRepositoryClientOptions) { - this._repositoryLocation = options?.repositoryLocation || constants.DEFAULT_REPOSITORY_LOCATION; + constructor(options: ModelsRepositoryClientOptions = {}) { + this._repositoryLocation = options.repositoryLocation || cnst.DEFAULT_REPOSITORY_LOCATION; logger.info(`Client configured for repository location ${this._repositoryLocation}`); this._dependencyResolution = - options?.dependencyResolution || - this._checkDefaultDependencyResolution(!!options?.repositoryLocation); + options.dependencyResolution || + this._checkDefaultDependencyResolution(!!options.repositoryLocation); logger.info(`Client configured for dependency mode: ${this._dependencyResolution}`); this._fetcher = this._createFetcher(this._repositoryLocation, options); this._resolver = new DtmiResolver(this._fetcher); this._pseudoParser = new PseudoParser(this._resolver); // Store api version here (for now). Currently doesn't do anything - this._apiVersion = options?.apiVersion || constants.DEFAULT_API_VERSION; + this._apiVersion = options.apiVersion || cnst.DEFAULT_API_VERSION; } @@ -78,16 +78,16 @@ export class ModelsRepositoryClient { * repository location is a remote location, then this private method will be used * to create the IoT Models Repository Service Client. */ - private _createClient(options: any) { + private _createClient(options: ModelsRepositoryClientOptions): IoTModelsRepositoryServiceClient { const { ...pipelineOptions } = options; if (!pipelineOptions.userAgentOptions) { pipelineOptions.userAgentOptions = {}; } if (pipelineOptions.userAgentOptions.userAgentPrefix) { - pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${constants.DEFAULT_USER_AGENT}`; + pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${cnst.DEFAULT_USER_AGENT}`; } else { - pipelineOptions.userAgentOptions.userAgentPrefix = constants.DEFAULT_USER_AGENT; + pipelineOptions.userAgentOptions.userAgentPrefix = cnst.DEFAULT_USER_AGENT; } const internalPipelineOptions: InternalClientPipelineOptions = { @@ -110,7 +110,7 @@ export class ModelsRepositoryClient { * on that create either an HTTP Fetcher, which uses the IoT Models Repository Service Client, * or a Filesystem Fetcher. */ - private _createFetcher(location: string, options: any) { + private _createFetcher(location: string, options: ModelsRepositoryClientOptions): Fetcher { let locationURL; let fetcher; if (isLocalPath(location)) { @@ -119,16 +119,16 @@ export class ModelsRepositoryClient { fetcher = new FilesystemFetcher(path.normalize(location)); } else { locationURL = new URL(location); - if (locationURL.protocol in ["http", "https"]) { + const prot = locationURL.protocol; + if (prot.includes("http") || prot.includes("https")) { logger.info(`Repository location identified as HTTP/HTTPS endpoint - using HttpFetcher`); const client = this._createClient(options); fetcher = new HttpFetcher(location, client); - } else if (locationURL.protocol === "file") { + } else if (prot.includes("file")) { // filesystem URI logger.info("Repository Location identified as filesystem URI - using FilesystemFetcher"); fetcher = new FilesystemFetcher(location); - } else if (locationURL.protocol === "" && location.startsWith("/")) { - } else if (locationURL.protocol === "" && location.search(/\.[a-zA-Z]{2,63}$/)) { + } else if (prot === "" && location.search(/\.[a-zA-Z]{2,63}$/)) { // Web URL with protocol unspecified - default to HTTPS logger.info( "Repository Location identified as remote endpoint without protocol specified - using HttpFetcher" @@ -150,15 +150,15 @@ export class ModelsRepositoryClient { * @param {GetModelsOptions} options - options to govern behavior of model getter. * @returns {Promise<{ [dtmi: string]: any}>} */ - getModels(dtmis: string, options?: GetModelsOptions): Promise<{ [dtmi: string]: any }>; + async getModels(dtmis: string, options?: GetModelsOptions): Promise<{ [dtmi: string]: any }>; /** * Retrieve one or more models based upon on or more provided dtmis. * @param {string[]} dtmis - dtmi strings in an array. * @param {GetModelsOptions} options - options to govern behavior of model getter. * @returns {Promise<{ [dtmi: string]: any}>} */ - getModels(dtmis: string[], options?: GetModelsOptions): Promise<{ [dtmi: string]: any }>; - getModels( + async getModels(dtmis: string[], options?: GetModelsOptions): Promise<{ [dtmi: string]: any }>; + async getModels( dtmis: string | string[], options?: GetModelsOptions ): Promise<{ [dtmi: string]: any }> { @@ -169,30 +169,31 @@ export class ModelsRepositoryClient { const dependencyResolution = options?.dependencyResolution || this._dependencyResolution; - if (dependencyResolution === constants.DEPENDENCY_MODE_DISABLED) { + if (dependencyResolution === cnst.DEPENDENCY_MODE_DISABLED) { logger.info("Getting models w/ dependency resolution mode: disabled"); logger.info(`Retreiving model(s): ${dtmis}...`); - modelMap = this._resolver.resolve(dtmis); - } else if (dependencyResolution === constants.DEPENDENCY_MODE_ENABLED) { + modelMap = await this._resolver.resolve(dtmis); + } else if (dependencyResolution === cnst.DEPENDENCY_MODE_ENABLED) { logger.info(`Getting models w/ dependency resolution mode: enabled`); logger.info(`Retreiving model(s): ${dtmis}...`); - const baseModelMap = this._resolver.resolve(dtmis); + const baseModelMap = await this._resolver.resolve(dtmis); const baseModelList = [baseModelMap.values()]; logger.info(`Retreiving model dependencies for ${dtmis}...`); - modelMap = this._pseudoParser.expand(baseModelList); - } else if (dependencyResolution === constants.DEPENDENCY_MODE_TRY_FROM_EXPANDED) { + modelMap = await this._pseudoParser.expand(baseModelList); + } else if (dependencyResolution === cnst.DEPENDENCY_MODE_TRY_FROM_EXPANDED) { logger.info(`Getting models w/ dependency resolution mode: tryFromExpanded`); try { logger.info(`Retreiving expanded model(s): ${dtmis}...`); - modelMap = this._resolver.resolve(dtmis, { expandedModel: true }); + modelMap = await this._resolver.resolve(dtmis, true); } catch (e) { if (e instanceof ResolverError) { + // TODO: What do we do if it is a ResolverError? } else { - Promise.reject(e); + throw e; } } } else { - Promise.reject(EvalError(`Invalid dependency resolution mode: ${dependencyResolution}`)); + throw EvalError(`Invalid dependency resolution mode: ${dependencyResolution}`); } return modelMap; diff --git a/sdk/iot/modelsrepository/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts index 73097a0bba33..de8839dd1541 100644 --- a/sdk/iot/modelsrepository/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -export function isValidDtmi(dtmi: string) { +export function isValidDtmi(dtmi: string): boolean { if (dtmi) { const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/; return re.test(dtmi); // true if dtmi matches regular expression, false otherwise @@ -9,7 +9,7 @@ export function isValidDtmi(dtmi: string) { return false; // if not a string return false. } -export function getModelUri(dtmi: string, repositoryUri: string, expanded: boolean = false) { +export function getModelUri(dtmi: string, repositoryUri: string, expanded: boolean = false): string { if (!repositoryUri.endsWith("/")) { repositoryUri = repositoryUri.concat("/"); } @@ -17,7 +17,7 @@ export function getModelUri(dtmi: string, repositoryUri: string, expanded: boole return modelUri; } -export function convertDtmiToPath(dtmi: string, expanded: boolean) { +export function convertDtmiToPath(dtmi: string, expanded: boolean): string { // presently this dtmi to path function does not return the path with a // file format at the end, i.e. does not append .json or .expanded.json. // that happens in the dtmiToQualifiedPath function @@ -30,6 +30,7 @@ export function convertDtmiToPath(dtmi: string, expanded: boolean) { if (expanded) { thePath = thePath.replace(".json", ".expanded.json"); } + return thePath; } else { throw new Error("DTMI provided is invalid. Ensure it follows DTMI conventions."); } diff --git a/sdk/iot/modelsrepository/src/httpModelFetcher.ts b/sdk/iot/modelsrepository/src/httpModelFetcher.ts index c473f71e27fa..5d2a9075c3f5 100644 --- a/sdk/iot/modelsrepository/src/httpModelFetcher.ts +++ b/sdk/iot/modelsrepository/src/httpModelFetcher.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { ServiceClient } from "@azure/core-client"; -import { PipelineResponse, RestError } from "@azure/core-rest-pipeline"; +import { createPipelineRequest, PipelineRequest, PipelineResponse, RestError } from "@azure/core-rest-pipeline"; import { logger } from "./logger"; import { Fetcher } from "./fetcher"; @@ -18,12 +18,11 @@ export class HttpFetcher extends Fetcher { async fetch(path: string) { logger.info(`Fetching ${path} from remote endpoint`); - const myURL = this._baseURL + path; - - const request: any = { + const myURL = this._baseURL + '/' + path; + const request: PipelineRequest = createPipelineRequest({ url: myURL, method: "GET" - }; + }); const res: PipelineResponse = await this._client.sendRequest(request); if (res.status >= 200 && res.status < 400) { diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index f9471f940723..7fe14fc33845 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -6,24 +6,23 @@ import { logger } from "./logger"; import { DtmiResolver } from "./resolver"; export class PseudoParser { - private _resolver; + private _resolver: DtmiResolver; constructor(resolver: DtmiResolver) { this._resolver = resolver; } - expand(models: DTDL[]) { + async expand(models: DTDL[]) { let expandedMap: any = {}; - - models.forEach((model: DTDL) => { + for (let i=0; i { @@ -31,10 +30,10 @@ export class PseudoParser { }); if (dependenciesToResolve.length !== 0) { logger.info(`Outstanding dependencies found: ${dependenciesToResolve}`); - let resolvedDependenciesMap = this._resolver.resolve(dependenciesToResolve); + let resolvedDependenciesMap = await this._resolver.resolve(dependenciesToResolve); modelMap = { ...modelMap, ...resolvedDependenciesMap }; for (let dependencyModel of resolvedDependenciesMap.values()) { - this._expand(dependencyModel, modelMap); + await this._expand(dependencyModel, modelMap); } } } diff --git a/sdk/iot/modelsrepository/src/resolver.ts b/sdk/iot/modelsrepository/src/resolver.ts index 3504d2f8a22c..633880c97e95 100644 --- a/sdk/iot/modelsrepository/src/resolver.ts +++ b/sdk/iot/modelsrepository/src/resolver.ts @@ -28,7 +28,7 @@ export class DtmiResolver { this._fetcher = fetcher; } - resolve(dtmis: string[], expandedModel: boolean = false) { + async resolve(dtmis: string[], expandedModel: boolean = false) { let modelMap: any = {}; for (let dtmi of dtmis) { @@ -37,12 +37,12 @@ export class DtmiResolver { logger.info(`Model ${dtmi} located in repository at ${dtdlPath}`); try { - dtdl = this._fetcher.fetch(dtdlPath); + dtdl = await this._fetcher.fetch(dtdlPath); } catch (e) { if (e instanceof FetcherError) { - return Promise.reject(new ResolverError(`Failed to resolve dtmi: ${dtmi}`, e)); + throw new ResolverError(`Failed to resolve dtmi: ${dtmi}`, e); } else { - return Promise.reject(e); + throw e; } } From a9ee639b0d036664141f810ad8f97ea048cd5650 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Wed, 28 Apr 2021 08:28:08 -0700 Subject: [PATCH 19/81] refactor --- sdk/iot/modelsrepository/README.md | 16 +- .../modelsrepository/src/dtmiConventions.ts | 1 + .../src/{resolver.ts => dtmiResolver.ts} | 33 +- sdk/iot/modelsrepository/src/exceptions.ts | 8 + .../src/{fetcher.ts => fetcherAbstract.ts} | 0 .../modelsrepository/src/fetcherFilesystem.ts | 34 ++ sdk/iot/modelsrepository/src/fetcherHTTP.ts | 37 ++ .../src/filesystemModelFetcher.ts | 98 --- .../modelsrepository/src/httpModelFetcher.ts | 123 ---- sdk/iot/modelsrepository/src/internal.ts | 15 +- .../src/modelFetcherHelper.ts | 24 - .../{client.ts => modelsRepositoryClient.ts} | 13 +- ...nt.ts => modelsRepositoryServiceClient.ts} | 0 sdk/iot/modelsrepository/src/psuedoParser.ts | 2 +- .../modelsrepository/test/node/index.spec.ts | 574 ------------------ .../test/node/integration/index.spec.ts | 139 +++++ .../test/node/unit/dtmiConventions.spec.ts | 67 ++ .../DeviceManagement/deviceinformation-1.json | 0 .../deviceinformation-1.json | 0 .../temperaturecontroller-1.expanded.json | 0 .../temperaturecontroller-1.json | 0 .../temperaturecontroller-2.json | 0 .../thermostat-1.expanded.json | 0 .../FakeDeviceManagement/thermostat-1.json | 0 .../FakeDeviceManagement/thermostat-2.json | 0 25 files changed, 326 insertions(+), 858 deletions(-) rename sdk/iot/modelsrepository/src/{resolver.ts => dtmiResolver.ts} (59%) create mode 100644 sdk/iot/modelsrepository/src/exceptions.ts rename sdk/iot/modelsrepository/src/{fetcher.ts => fetcherAbstract.ts} (100%) create mode 100644 sdk/iot/modelsrepository/src/fetcherFilesystem.ts create mode 100644 sdk/iot/modelsrepository/src/fetcherHTTP.ts delete mode 100644 sdk/iot/modelsrepository/src/filesystemModelFetcher.ts delete mode 100644 sdk/iot/modelsrepository/src/httpModelFetcher.ts delete mode 100644 sdk/iot/modelsrepository/src/modelFetcherHelper.ts rename sdk/iot/modelsrepository/src/{client.ts => modelsRepositoryClient.ts} (94%) rename sdk/iot/modelsrepository/src/{iotModelsRepositoryServiceClient.ts => modelsRepositoryServiceClient.ts} (100%) delete mode 100644 sdk/iot/modelsrepository/test/node/index.spec.ts create mode 100644 sdk/iot/modelsrepository/test/node/integration/index.spec.ts create mode 100644 sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts rename sdk/iot/modelsrepository/test/node/{testModelRepository => unit/testRepository}/dtmi/azure/DeviceManagement/deviceinformation-1.json (100%) rename sdk/iot/modelsrepository/test/node/{testModelRepository => unit/testRepository}/dtmi/contoso/FakeDeviceManagement/deviceinformation-1.json (100%) rename sdk/iot/modelsrepository/test/node/{testModelRepository => unit/testRepository}/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json (100%) rename sdk/iot/modelsrepository/test/node/{testModelRepository => unit/testRepository}/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json (100%) rename sdk/iot/modelsrepository/test/node/{testModelRepository => unit/testRepository}/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json (100%) rename sdk/iot/modelsrepository/test/node/{testModelRepository => unit/testRepository}/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json (100%) rename sdk/iot/modelsrepository/test/node/{testModelRepository => unit/testRepository}/dtmi/contoso/FakeDeviceManagement/thermostat-1.json (100%) rename sdk/iot/modelsrepository/test/node/{testModelRepository => unit/testRepository}/dtmi/contoso/FakeDeviceManagement/thermostat-2.json (100%) diff --git a/sdk/iot/modelsrepository/README.md b/sdk/iot/modelsrepository/README.md index 23ee4853130d..7271d3ecf0f6 100644 --- a/sdk/iot/modelsrepository/README.md +++ b/sdk/iot/modelsrepository/README.md @@ -1,18 +1,26 @@ # Azure IoT Resolver library for Javascript -This package contains an isomorphic Client Library for Azure IoT Models Repository in Javascript. Use the Azure IoT Resolver library for Javascript to pull DTDL files from remote endpoints. +This package contains an isomorphic Client Library for Azure IoT Models Repository in Javascript. Use the Azure IoT Models Repository library for Javascript to pull DTDL files from remote endpoints. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository) | +[Package (npm)](https://www.npmjs.com/package/@azure/iot-modelsrepository-client/) | +[Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/iot-modelsrepository-client/samples) | + +------------------------------------- ## Key concepts -The Azure IoT Resolver library for Javascript is written to interact with the Azure IoT PlugAndPlay Models Repository, for those developers who wish to write applications in Javascript to do so. +The Azure IoT Models Repository library for Javascript is written to interact with the Azure IoT PlugAndPlay Models Repository, for those developers who wish to write applications in Javascript to do so. ### Currently supported environments -- Node.js version 10.x.x or higher +- Node.js version 8.x.x or higher - Browser JavaScript ### How to Install +The preferred way to install the Azure IoT Models Repository client library for JavaScript is to use the npm package manager. Type the following into a terminal window: + ``` npm install @azure/iot-modelsrepository-client ``` @@ -62,6 +70,8 @@ console.log(result); ``` +----------------------------------------- + ## Related projects - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/sdk/iot/modelsrepository/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts index de8839dd1541..1af2bd84b94b 100644 --- a/sdk/iot/modelsrepository/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -10,6 +10,7 @@ export function isValidDtmi(dtmi: string): boolean { } export function getModelUri(dtmi: string, repositoryUri: string, expanded: boolean = false): string { + // TODO: Make sure this works with Windows UNC Filesystem Path. if (!repositoryUri.endsWith("/")) { repositoryUri = repositoryUri.concat("/"); } diff --git a/sdk/iot/modelsrepository/src/resolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts similarity index 59% rename from sdk/iot/modelsrepository/src/resolver.ts rename to sdk/iot/modelsrepository/src/dtmiResolver.ts index 633880c97e95..0a05ac447868 100644 --- a/sdk/iot/modelsrepository/src/resolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -1,17 +1,7 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { convertDtmiToPath } from "./dtmiConventions"; -import { logger } from "./logger"; - -export class FetcherError extends Error { - cause: Error | undefined; - - constructor(message: string, cause?: Error) { - super(message); - this.cause = cause; - } -} +import { convertDtmiToPath, logger, ModelError } from "./internal"; export class ResolverError extends Error { cause: Error | undefined; @@ -35,27 +25,20 @@ export class DtmiResolver { let dtdl: any[] | any; let dtdlPath = convertDtmiToPath(dtmi, expandedModel); logger.info(`Model ${dtmi} located in repository at ${dtdlPath}`); + dtdl = await this._fetcher.fetch(dtdlPath); - try { - dtdl = await this._fetcher.fetch(dtdlPath); - } catch (e) { - if (e instanceof FetcherError) { - throw new ResolverError(`Failed to resolve dtmi: ${dtmi}`, e); - } else { - throw e; - } - } - + if (expandedModel) { + if (!((dtdl as any[]).includes((model: any) => model["id"] === dtmi))) { + throw new ModelError(`DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${dtdl.map((model:any) => model["id"])}`); + } for (let model of dtdl) { modelMap[model["@id"]] = model; } } else { let model = dtdl; if (model["@id"] != dtmi) { - return Promise.reject( - new ResolverError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`) - ); + new ModelError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`); } modelMap[`${dtmi}`] = dtdl; @@ -65,3 +48,5 @@ export class DtmiResolver { return modelMap; } } + +// TODO: diff --git a/sdk/iot/modelsrepository/src/exceptions.ts b/sdk/iot/modelsrepository/src/exceptions.ts new file mode 100644 index 000000000000..b435bce5cf0b --- /dev/null +++ b/sdk/iot/modelsrepository/src/exceptions.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +export class ModelError extends Error { + constructor(message: string) { + super(message); + } +} diff --git a/sdk/iot/modelsrepository/src/fetcher.ts b/sdk/iot/modelsrepository/src/fetcherAbstract.ts similarity index 100% rename from sdk/iot/modelsrepository/src/fetcher.ts rename to sdk/iot/modelsrepository/src/fetcherAbstract.ts diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts new file mode 100644 index 000000000000..819e926fc15d --- /dev/null +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +import fs from "fs"; +import * as path from "path"; +import { Fetcher, DTDL, logger } from "./internal"; +import {RestError, RestErrorOptions} from '@azure/core-rest-pipeline'; + +export class FilesystemFetcher extends Fetcher { + private _baseFilePath: string; + + constructor(baseFilePath: string) { + super(); + this._baseFilePath = baseFilePath; + } + + fetch(filePath: string) { + logger.info(`Fetching ${filePath} from local filesystem`); + const absolutePath = path.join(this._baseFilePath, filePath); + + try { + logger.info(`File open on ${absolutePath}`); + const dtdlFile = fs.readFileSync(absolutePath, "utf8"); + const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); + return parsedDtdl; + } catch (e) { + // TODO: Is there a ResourceNotFound Error for Filesystem + Http (Generic API for errors) + const options : RestErrorOptions = { + statusCode: e?.status + } + throw new RestError("Failed to fetch from Filesystem", options); + } + } +} diff --git a/sdk/iot/modelsrepository/src/fetcherHTTP.ts b/sdk/iot/modelsrepository/src/fetcherHTTP.ts new file mode 100644 index 000000000000..b7723ead05d1 --- /dev/null +++ b/sdk/iot/modelsrepository/src/fetcherHTTP.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +import { ServiceClient } from "@azure/core-client"; +import { createPipelineRequest, PipelineRequest, PipelineResponse, RestError } from "@azure/core-rest-pipeline"; +import { logger } from "./logger"; +import { Fetcher } from "./fetcherAbstract"; + +export class HttpFetcher extends Fetcher { + private _client: ServiceClient; + private _baseURL: string; + + constructor(baseURL: string, client: ServiceClient) { + super(); + this._client = client; + this._baseURL = baseURL; + } + + async fetch(path: string) { + logger.info(`Fetching ${path} from remote endpoint`); + const myURL = this._baseURL + '/' + path; + const request: PipelineRequest = createPipelineRequest({ + url: myURL, + method: "GET" + }); + const res: PipelineResponse = await this._client.sendRequest(request); + + if (res.status >= 200 && res.status < 400) { + const dtdlAsString = res.bodyAsText || ""; + const parsedDtdl = JSON.parse(dtdlAsString); + return parsedDtdl; + } else { + // TODO: Validate with API Review Board that this is an accurate way to raise an error. + throw new RestError("Error on HTTP Request in remote model fetcher", {statusCode: res.status, response: res, request: request}); + } + } +} diff --git a/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts b/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts deleted file mode 100644 index 43daf724515e..000000000000 --- a/sdk/iot/modelsrepository/src/filesystemModelFetcher.ts +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -import { DTDL } from "./DTDL"; -import fs from "fs"; -import * as path from "path"; -import { Fetcher } from "./fetcher"; -import { logger } from "./logger"; -import { FetcherError } from "./resolver"; - -export class FilesystemFetcher extends Fetcher { - private _baseFilePath: string; - - constructor(baseFilePath: string) { - super(); - this._baseFilePath = baseFilePath; - } - - fetch(filePath: string) { - logger.info(`Fetching ${filePath} from local filesystem`); - const absolutePath = path.join(this._baseFilePath, filePath); - - try { - logger.info(`File open on ${absolutePath}`); - const dtdlFile = fs.readFileSync(absolutePath, "utf8"); - const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); - return parsedDtdl; - } catch (e) { - throw new FetcherError("Failed to fetch from Filesystem", e); - } - } -} - -// async function recursiveFetcher( -// dtmi: string, -// directory: string, -// tryFromExpanded: boolean -// ): Promise<{ [x: string]: DTDL }> { -// let dependencyModels: { [x: string]: DTDL } = {}; -// let fetchedModels: { [x: string]: DTDL }; -// try { -// console.log(`Fetching: ${dtmi}`); -// fetchedModels = await fetcher(dtmi, directory, tryFromExpanded); -// } catch (error) { -// if (tryFromExpanded && error.code === 'ENOENT') { -// console.log('Fetching from expanded failed. Trying without.'); -// fetchedModels = await fetcher(dtmi, directory, false); -// } else { -// throw error; -// } -// } -// const dtmis = Object.keys(fetchedModels); -// for (let i = 0; i < dtmis.length; i++) { -// const currentDtdl = fetchedModels[dtmis[i]]; -// const metaModelData = modelMetadata.getModelMetadata(currentDtdl); -// const deps = metaModelData.componentSchemas.concat(metaModelData.extends); -// if (deps && deps.length > 0) { -// for (let j = 0; j < deps.length; j++) { -// if ( -// Object.keys(dependencyModels).includes(deps[j]) || -// Object.keys(fetchedModels).includes(deps[j]) -// ) { -// // do nothing -// } else { -// const fetchedDependencies = await recursiveFetcher(deps[j], directory, tryFromExpanded); -// dependencyModels = { ...dependencyModels, ...fetchedDependencies }; -// } -// } -// } -// } -// if (Object.keys(dependencyModels).length > 0) { -// fetchedModels = { ...fetchedModels, ...dependencyModels }; -// } -// return fetchedModels; -// } - -// async function fetcher( -// dtmi: string, -// directory: string, -// tryFromExpanded: boolean -// ): Promise<{ [dtmi: string]: DTDL }> { -// const dtmiPath = dtmiConventions.dtmiToPath(dtmi); -// const dtmiPathFormatted = tryFromExpanded -// ? dtmiPath.replace('.json', '.expanded.json') -// : dtmiPath; -// const targetPath = path.join(directory, dtmiPathFormatted); -// const dtdlFile = fs.readFileSync(targetPath, 'utf8'); -// const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); -// if (Array.isArray(parsedDtdl)) { -// const result = flattenDtdlResponse(parsedDtdl as DTDL[]); -// return result; -// } else { -// const result = { [dtmi]: parsedDtdl as DTDL }; -// return result; -// } -// } - -// export { fetcher, recursiveFetcher }; diff --git a/sdk/iot/modelsrepository/src/httpModelFetcher.ts b/sdk/iot/modelsrepository/src/httpModelFetcher.ts deleted file mode 100644 index 5d2a9075c3f5..000000000000 --- a/sdk/iot/modelsrepository/src/httpModelFetcher.ts +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -import { ServiceClient } from "@azure/core-client"; -import { createPipelineRequest, PipelineRequest, PipelineResponse, RestError } from "@azure/core-rest-pipeline"; -import { logger } from "./logger"; -import { Fetcher } from "./fetcher"; - -export class HttpFetcher extends Fetcher { - private _client: ServiceClient; - private _baseURL: string; - - constructor(baseURL: string, client: ServiceClient) { - super(); - this._client = client; - this._baseURL = baseURL; - } - - async fetch(path: string) { - logger.info(`Fetching ${path} from remote endpoint`); - const myURL = this._baseURL + '/' + path; - const request: PipelineRequest = createPipelineRequest({ - url: myURL, - method: "GET" - }); - const res: PipelineResponse = await this._client.sendRequest(request); - - if (res.status >= 200 && res.status < 400) { - const dtdlAsString = res.bodyAsText || ""; - const parsedDtdl = JSON.parse(dtdlAsString); - return parsedDtdl; - // if (Array.isArray(parsedDtdl)) { - // const result = flattenDtdlResponse(parsedDtdl as DTDL[]); - // return result; - // } else { - // const result = { [dtmi]: parsedDtdl as DTDL }; - // return result; - // } - } else { - throw new RestError("Error on HTTP Request in remote model fetcher"); - } - } -} - -// async function recursiveFetcher( -// dtmi: string, -// endpoint: string, -// tryFromExpanded: boolean -// ): Promise<{ [dtmi: string]: DTDL }> { -// let dependencyModels: { [x: string]: DTDL } = {}; -// let fetchedModels: { [x: string]: DTDL }; -// try { -// console.log(`Fetching: ${dtmi}`); -// fetchedModels = await fetcher(dtmi, endpoint, tryFromExpanded); -// } catch (error) { -// if ( -// tryFromExpanded && -// (error.code === 'ENOENT' || !(error.statusCode >= 200 && error.statusCode < 400)) -// ) { -// console.log('Fetching from expanded failed. Trying without.'); -// console.log(`Fetching: ${dtmi}`); -// fetchedModels = await fetcher(dtmi, endpoint, false); -// } else { -// throw error; -// } -// } -// const dtmis = Object.keys(fetchedModels); -// for (let i = 0; i < dtmis.length; i++) { -// const currentDtdl = fetchedModels[dtmis[i]]; -// const deps = modelMetadata.getModelMetadata(currentDtdl).componentSchemas; -// if (deps && deps.length > 0) { -// for (let j = 0; j < deps.length; j++) { -// if ( -// Object.keys(dependencyModels).includes(deps[j]) || -// Object.keys(fetchedModels).includes(deps[j]) -// ) { -// // do nothing -// } else { -// const fetchedDependencies = await recursiveFetcher(deps[j], endpoint, tryFromExpanded); -// dependencyModels = { ...dependencyModels, ...fetchedDependencies }; -// } -// } -// } -// } -// if (Object.keys(dependencyModels).length > 0) { -// fetchedModels = { ...fetchedModels, ...dependencyModels }; -// } -// return fetchedModels; -// } - -// async function fetcher( -// dtmi: string, -// endpoint: string, -// tryFromExpanded: boolean -// ): Promise<{ [dtmi: string]: any }> { -// const client = new coreHttp.ServiceClient(); -// const req: coreHttp.RequestPrepareOptions = { -// url: dtmiConventions.dtmiToQualifiedPath(dtmi, endpoint, tryFromExpanded), -// method: 'GET' -// }; -// const res: coreHttp.HttpOperationResponse = await client.sendRequest(req); -// if (res.status >= 200 && res.status < 400) { -// const dtdlAsString = res.bodyAsText || ''; -// const parsedDtdl = JSON.parse(dtdlAsString); -// if (Array.isArray(parsedDtdl)) { -// const result = flattenDtdlResponse(parsedDtdl as DTDL[]); -// return result; -// } else { -// const result = { [dtmi]: parsedDtdl as DTDL }; -// return result; -// } -// } else { -// throw new coreHttp.RestError( -// 'Error on HTTP Request in remote model fetcher', -// '404', -// 404, -// undefined, -// res -// ); -// } -// } -// -// export { fetcher, recursiveFetcher }; diff --git a/sdk/iot/modelsrepository/src/internal.ts b/sdk/iot/modelsrepository/src/internal.ts index e5e4256f47fb..bf0b66126c2d 100644 --- a/sdk/iot/modelsrepository/src/internal.ts +++ b/sdk/iot/modelsrepository/src/internal.ts @@ -1,15 +1,16 @@ -export * from './client'; +export * from './modelsRepositoryClient'; export * from './constants'; export * from './dependencyResolutionType'; export * from './dtmiConventions'; -export * from './fetcher'; -export * from './filesystemModelFetcher'; -export * from './httpModelFetcher'; -export * from './iotModelsRepositoryServiceClient'; +export * from './fetcherAbstract'; +export * from './fetcherFilesystem'; +export * from './fetcherHTTP'; +export * from './modelsRepositoryServiceClient'; export * from './logger'; -export * from './modelFetcherHelper'; export * from './psuedoParser'; -export * from './resolver'; +export * from './dtmiResolver'; export * from './interfaces/getModelsOptions'; export * from './interfaces/modelsRepositoryClientOptions'; +export * from './DTDL'; +export * from './exceptions'; diff --git a/sdk/iot/modelsrepository/src/modelFetcherHelper.ts b/sdk/iot/modelsrepository/src/modelFetcherHelper.ts deleted file mode 100644 index e82a631db035..000000000000 --- a/sdk/iot/modelsrepository/src/modelFetcherHelper.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -import { DTDL } from "./DTDL"; - -export function isLocalPath(p: string): boolean { - const myRegex = RegExp(/^(?:[a-zA-Z]\:|\\\\[\w\.]+\\[\w.$]+)\\(?:[\w]+\\)*\w([\w.])+$/g); - return !!p.match(myRegex); -} - -export function flattenDtdlResponse(input: DTDL[]) { - const newResult: { [x: string]: DTDL } = {}; - for (let i = 0; i++; i < input.length) { - const currentDtdl = input[i]; - if (!currentDtdl["@id"]) { - throw new Error("no @id element found in DTDL. Ensure DTDL contains @id element"); - } - newResult[currentDtdl["@id"]] = currentDtdl; - } - input.forEach((element: DTDL) => { - newResult[element["@id"]] = element; - }); - return newResult; -} diff --git a/sdk/iot/modelsrepository/src/client.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts similarity index 94% rename from sdk/iot/modelsrepository/src/client.ts rename to sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index 592d55c738ba..18f499aedf41 100644 --- a/sdk/iot/modelsrepository/src/client.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -6,20 +6,23 @@ import { IoTModelsRepositoryServiceClient, ModelsRepositoryClientOptions, dependencyResolutionType, - isLocalPath, HttpFetcher, FilesystemFetcher, PseudoParser, DtmiResolver, - ResolverError, logger, } from "./internal"; import * as cnst from './constants'; import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; import { URL } from "url"; import * as path from "path"; -import { Fetcher } from "./fetcher"; +import { Fetcher } from "./fetcherAbstract"; +import { RestError } from "@azure/core-rest-pipeline"; +function isLocalPath(p: string): boolean { + const myRegex = RegExp(/^(?:[a-zA-Z]\:|\\\\[\w\.]+\\[\w.$]+)\\(?:[\w]+\\)*\w([\w.])+$/g); + return !!p.match(myRegex); +} /** * Initializes a new instance of the IoT Models Repository Client. @@ -111,6 +114,7 @@ export class ModelsRepositoryClient { * or a Filesystem Fetcher. */ private _createFetcher(location: string, options: ModelsRepositoryClientOptions): Fetcher { + // TODO: Validate that this works with a Windows UNC Filesystem URI. let locationURL; let fetcher; if (isLocalPath(location)) { @@ -186,7 +190,8 @@ export class ModelsRepositoryClient { logger.info(`Retreiving expanded model(s): ${dtmis}...`); modelMap = await this._resolver.resolve(dtmis, true); } catch (e) { - if (e instanceof ResolverError) { + if (e instanceof RestError) { + logger.info("Could not retrieve model(s) from expanded model DTDL - ") // TODO: What do we do if it is a ResolverError? } else { throw e; diff --git a/sdk/iot/modelsrepository/src/iotModelsRepositoryServiceClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts similarity index 100% rename from sdk/iot/modelsrepository/src/iotModelsRepositoryServiceClient.ts rename to sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index 7fe14fc33845..c4d6b51849b9 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -3,7 +3,7 @@ import { DTDL } from "./DTDL"; import { logger } from "./logger"; -import { DtmiResolver } from "./resolver"; +import { DtmiResolver } from "./dtmiResolver"; export class PseudoParser { private _resolver: DtmiResolver; diff --git a/sdk/iot/modelsrepository/test/node/index.spec.ts b/sdk/iot/modelsrepository/test/node/index.spec.ts deleted file mode 100644 index f213044e7250..000000000000 --- a/sdk/iot/modelsrepository/test/node/index.spec.ts +++ /dev/null @@ -1,574 +0,0 @@ -/* eslint-disable no-undef */ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { ModelsRepositoryClient, ModelsRepositoryClientOptions } from "../../src"; -import * as coreClient from "@azure/core-client"; - -import { assert, expect } from "chai"; -import * as sinon from "sinon"; - -import { dependencyResolutionType } from "../../src/dependencyResolutionType"; - -interface remoteResolutionScenario { - name: string; - clientOptions: { - dependencyResolution: dependencyResolutionType; - repositoryLocation: string; - }; - getModelsOptions: any; - dtmis: { - dtmi: string; - expectedUri: string; - expectedOutputJson: { - fakeDtdl: string; - }; - }[]; -} - -const remoteResolutionScenarios: remoteResolutionScenario[] = [ - { - name: "dependencyResolution: disabled, single DTMI, no dependencies", - clientOptions: { - dependencyResolution: "disabled", - repositoryLocation: "devicemodels.contoso.com" - }, - getModelsOptions: {}, - dtmis: [ - { - dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", - expectedUri: - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", - expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } - } - ] - }, - { - name: "dependencyResolution: enabled, single DTMI, no dependencies", - clientOptions: { - dependencyResolution: "enabled", - repositoryLocation: "devicemodels.contoso.com" - }, - getModelsOptions: {}, - dtmis: [ - { - dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", - expectedUri: - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", - expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } - } - ] - }, - { - name: "dependencyResolution: tryFromExpanded, single DTMI, no dependencies", - clientOptions: { - dependencyResolution: "tryFromExpanded", - repositoryLocation: "devicemodels.contoso.com" - }, - getModelsOptions: {}, - dtmis: [ - { - dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", - expectedUri: - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", - expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } - } - ] - }, - { - name: "dependencyResolution: disabled, multiple DTMI, no dependencies", - clientOptions: { - dependencyResolution: "tryFromExpanded", - repositoryLocation: "devicemodels.contoso.com" - }, - getModelsOptions: {}, - dtmis: [ - { - dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", - expectedUri: - "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", - expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } - } - ] - } -]; - -describe("resolver - node", function() { - afterEach(function() { - sinon.restore(); - }); - - describe("remote URL resolution", function() { - remoteResolutionScenarios.forEach((scenario: remoteResolutionScenario) => { - it(scenario.name, function(done) { - let myStub = sinon.stub(coreClient, "ServiceClient"); - for (let i = 0; i < scenario.dtmis.length; i++) { - myStub.onCall(i).returns({ - sendRequest: function(req: any) { - assert.deepEqual( - req.url, - scenario.dtmis[i].expectedUri, - "URL not formatted for request correctly." - ); - return Promise.resolve({ - bodyAsText: JSON.stringify(scenario.dtmis[i].expectedOutputJson), - status: 200 - }); - } - }); - } - - const myOptions: ModelsRepositoryClientOptions = scenario.clientOptions; - const dtmiClient = new ModelsRepositoryClient(myOptions); - const listOfDtmis = scenario.dtmis.map((x) => x.dtmi); - const result = dtmiClient.getModels(listOfDtmis, scenario.getModelsOptions); - const expectedOutput: any = {}; - scenario.dtmis.forEach((element) => { - expectedOutput[element.dtmi] = element.expectedOutputJson; - }); - assert(result instanceof Promise, "resolve method did not return a promise"); - result - .then((actualOutput: any) => { - expect(actualOutput).to.deep.equal(expectedOutput); - done(); - }) - .catch((err: any) => done(err)); - }); - }); - - // describe("simple DTDL resolution", function() { - // it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - // const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; - // const fakeEndpoint = "devicemodels.contoso.com"; - // const expectedUri = - // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; - // const fakeData = JSON.stringify({ - // fakeDtdl: "fakeBodyAsText" - // }); - // sinon.stub(coreHttp, "ServiceClient").returns({ - // sendRequest: function(req: any) { - // assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); - // return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - // } - // }); - - // const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint); - // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - // resolveResult - // .then((actualOutput: any) => { - // assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); - // done(); - // }) - // .catch((err: any) => done(err)); - // }); - // }); - - // describe("depenency resolution (using pseudo-parsing)", function() { - // it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - // const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; - // const fakeEndpoint: string = "devicemodels.contoso.com"; - // const expectedUri = - // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json"; - // const fakeData = JSON.stringify({ - // fakeKey: "fakeValue" - // }); - // sinon.stub(coreHttp, "ServiceClient").returns({ - // sendRequest: function(req: any) { - // assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); - // return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - // } - // }); - - // const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { - // resolveDependencies: "enabled" - // }); - // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - // resolveResult - // .then((actualOutput: any) => { - // assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData) }, actualOutput); - // done(); - // }) - // .catch((err: any) => done(err)); - // }); - - // it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { - // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - // const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - // const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - // const fakeEndpoint: string = "devicemodels.contoso.com"; - // const expectedUri = - // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; - // const expectedUri2 = - // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; - // const expectedUri3 = - // "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; - // const localDirectory = path.resolve("./test/node/testModelRepository"); - // const pathToDtdl = path.join( - // localDirectory, - // "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - // ); - // const fakeData = fs.readFileSync(pathToDtdl).toString(); - // const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); - // const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); - // const expectedOutput = { - // [fakeDtmi1]: JSON.parse(fakeData), - // [fakeDtmi2]: JSON.parse(fakeData2), - // [fakeDtmi3]: JSON.parse(fakeData3) - // }; - // const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); - // serviceClientStub.onFirstCall().returns({ - // sendRequest: function(req: any) { - // assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); - // return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - // } - // }); - // serviceClientStub.onSecondCall().returns({ - // sendRequest: function(req: any) { - // assert.deepEqual(req.url, expectedUri2, "URL not formatted for request correctly."); - // return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); - // } - // }); - // serviceClientStub.onThirdCall().returns({ - // sendRequest: function(req: any) { - // assert.deepEqual(req.url, expectedUri3, "URL not formatted for request correctly."); - // return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); - // } - // }); - - // const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { - // resolveDependencies: "enabled" - // }); - // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - // resolveResult - // .then((actualOutput: any) => { - // assert.deepEqual( - // Object.keys(actualOutput), - // Object.keys(expectedOutput), - // "dtmis in actual output do not align with expected output" - // ); - // assert.deepStrictEqual(expectedOutput, actualOutput); - // done(); - // }) - // .catch((err: any) => done(err)); - // }); - // }); - - // describe("try from expanded (expanded.json)", function() { - // it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - // const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1"; - // const fakeEndpoint = "devicemodels.contoso.com"; - // const expectedUri = - // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json"; - // const fakeData = `[${JSON.stringify({ - // "@id": fakeDtmi, - // fakeDtdl: "fakeBodyAsText" - // })}]`; - // sinon.stub(coreHttp, "ServiceClient").returns({ - // sendRequest: function(req: any) { - // assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); - // return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - // } - // }); - - // const resolveResult = resolverTool.resolve(fakeDtmi, fakeEndpoint, { - // resolveDependencies: "tryFromExpanded" - // }); - // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - // resolveResult - // .then((actualOutput: any) => { - // assert.deepStrictEqual({ [fakeDtmi]: JSON.parse(fakeData)[0] }, actualOutput); - // done(); - // }) - // .catch((err: any) => done(err)); - // }); - - // it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { - // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - // const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - // const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - // const fakeEndpoint: string = "devicemodels.contoso.com"; - // const expectedUri = - // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/temperaturecontroller-1.json"; - // const expectedUri2 = - // "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/thermostat-1.json"; - // const expectedUri3 = - // "https://devicemodels.contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json"; - // const localDirectory = path.resolve("./test/node/testModelRepository"); - // const pathToDtdl = path.join( - // localDirectory, - // "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - // ); - // const fakeData = fs.readFileSync(pathToDtdl).toString(); - // const fakeData2 = JSON.stringify({ fakeKey: "fakeValue" }); - // const fakeData3 = JSON.stringify({ fakeKey2: "fakeValue2" }); - // const expectedOutput = { - // [fakeDtmi1]: JSON.parse(fakeData), - // [fakeDtmi2]: JSON.parse(fakeData2), - // [fakeDtmi3]: JSON.parse(fakeData3) - // }; - // const serviceClientStub = sinon.stub(coreHttp, "ServiceClient"); - // serviceClientStub.onCall(0).returns({ - // sendRequest: function(req: any) { - // assert.deepEqual( - // req.url, - // expectedUri.replace(".json", ".expanded.json"), - // "URL not formatted for request correctly." - // ); - // return Promise.resolve({ status: 404 }); - // } - // }); - // serviceClientStub.onCall(1).returns({ - // sendRequest: function(req: any) { - // assert.deepEqual(req.url, expectedUri, "URL not formatted for request correctly."); - // return Promise.resolve({ bodyAsText: fakeData, status: 200 }); - // } - // }); - // serviceClientStub.onCall(2).returns({ - // sendRequest: function(req: any) { - // assert.deepEqual( - // req.url, - // expectedUri2.replace(".json", ".expanded.json"), - // "URL not formatted for request correctly." - // ); - // return Promise.resolve({ status: 404 }); - // } - // }); - // serviceClientStub.onCall(3).returns({ - // sendRequest: function(req: any) { - // assert.deepEqual(req.url, expectedUri2, "URL not formatted for request correctly."); - // return Promise.resolve({ bodyAsText: fakeData2, status: 200 }); - // } - // }); - // serviceClientStub.onCall(4).returns({ - // sendRequest: function(req: any) { - // assert.deepEqual( - // req.url, - // expectedUri3.replace(".json", ".expanded.json"), - // "URL not formatted for request correctly." - // ); - // return Promise.resolve({ status: 404 }); - // } - // }); - // serviceClientStub.onCall(5).returns({ - // sendRequest: function(req: any) { - // assert.deepEqual(req.url, expectedUri3, "URL not formatted for request correctly."); - // return Promise.resolve({ bodyAsText: fakeData3, status: 200 }); - // } - // }); - - // const resolveResult = resolverTool.resolve(fakeDtmi1, fakeEndpoint, { - // resolveDependencies: "tryFromExpanded" - // }); - // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - // resolveResult - // .then((actualOutput: any) => { - // assert.deepEqual( - // Object.keys(actualOutput), - // Object.keys(expectedOutput), - // "dtmis in actual output do not align with expected output" - // ); - // assert.deepStrictEqual(expectedOutput, actualOutput); - // done(); - // }) - // .catch((err: any) => done(err)); - // }); - // }); - }); - - // describe("local file resolution", function() { - // describe("simple DTDL resolution", function() { - // it("should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - // const fakeDtmi: string = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; - // const localDirectory = path.resolve("./test/node/testModelRepository"); - // const pathToDtdl = path.join( - // localDirectory, - // "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - // ); - // const fakeDtdl = JSON.parse(fs.readFileSync(pathToDtdl, "utf-8")); - // const resolveResult = resolverTool.resolve(fakeDtmi, localDirectory); - // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - // resolveResult - // .then((actualOutput: any) => { - // assert.deepStrictEqual( - // { [fakeDtmi]: fakeDtdl }, - // actualOutput, - // "the expected dtmi mapping did not match the actual value." - // ); - // done(); - // }) - // .catch((err: any) => done(err)); - // }); - // }); - - // describe("dependency resolution (using pseudo-parsing)", function() { - // it("given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects", function(done) { - // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - // const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - // const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - // const localDirectory = path.resolve("./test/node/testModelRepository"); - // const pathToDtdl1 = path.join( - // localDirectory, - // "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - // ); - // const pathToDtdl2 = path.join( - // localDirectory, - // "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - // ); - // const pathToDtdl3 = path.join( - // localDirectory, - // "dtmi/azure/DeviceManagement/deviceinformation-1.json" - // ); - // const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - // const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); - // const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); - - // const expectedOutput = { - // [fakeDtmi1]: fakeDtdl1, - // [fakeDtmi2]: fakeDtdl2, - // [fakeDtmi3]: fakeDtdl3 - // }; - // const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { - // resolveDependencies: "enabled" - // }); - // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - // resolveResult - // .then((actualOutput: any) => { - // assert.deepStrictEqual( - // Object.keys(actualOutput), - // Object.keys(expectedOutput), - // "dtmis do not match" - // ); - // Object.keys(actualOutput).forEach((outputDtmi) => { - // assert.deepStrictEqual( - // actualOutput[outputDtmi], - // expectedOutput[outputDtmi], - // `dtdls for given dtmi (${outputDtmi}) did not line up.` - // ); - // }); - // assert.deepStrictEqual( - // actualOutput, - // expectedOutput, - // "the expected dtmi mapping did not match the actual value." - // ); - // done(); - // }) - // .catch((err: any) => done(err)); - // }); - - // it("given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object", function(done) { - // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:thermostat;1"; - // const localDirectory = path.resolve("./test/node/testModelRepository"); - // const pathToDtdl1 = path.join( - // localDirectory, - // "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - // ); - // const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - - // const expectedResult = { - // [fakeDtmi1]: fakeDtdl1 - // }; - // const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory); - // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - // resolveResult - // .then((actualOutput: any) => { - // assert.deepStrictEqual( - // expectedResult, - // actualOutput, - // "the expected dtmi mapping did not match the actual value." - // ); - // done(); - // }) - // .catch((err: any) => done(err)); - // }); - // }); - - // describe("try from expanded (expanded.json)", function() { - // it("should return a promise that resolves to a mapping from the DTMIs to the JSON objects", function(done) { - // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:TemperatureController;1"; - // const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - // const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - // const localDirectory = path.resolve("./test/node/testModelRepository"); - // const pathToDtdl1 = path.join( - // localDirectory, - // "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json" - // ); - // const pathToDtdl2 = path.join( - // localDirectory, - // "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - // ); - // const pathToDtdl3 = path.join( - // localDirectory, - // "dtmi/azure/DeviceManagement/deviceinformation-1.json" - // ); - // const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - // const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); - // const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); - - // const expectedResult = { - // [fakeDtmi1]: fakeDtdl1, - // [fakeDtmi2]: fakeDtdl2, - // [fakeDtmi3]: fakeDtdl3 - // }; - // const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { - // resolveDependencies: "tryFromExpanded" - // }); - // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - // resolveResult - // .then((actualOutput: any) => { - // assert.deepStrictEqual( - // expectedResult, - // actualOutput, - // "the expected dtmi mapping did not match the actual value." - // ); - // done(); - // }) - // .catch((err: any) => done(err)); - // }); - - // it("given no expanded format exists for the given DTMI, should fallback to resolution with dependencies", function(done) { - // const fakeDtmi1: string = "dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2"; - // const fakeDtmi2: string = "dtmi:contoso:FakeDeviceManagement:Thermostat;1"; - // const fakeDtmi3: string = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - // const localDirectory = path.resolve("./test/node/testModelRepository"); - // const pathToDtdl1 = path.join( - // localDirectory, - // "dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json" - // ); - // const pathToDtdl2 = path.join( - // localDirectory, - // "dtmi/contoso/FakeDeviceManagement/thermostat-1.json" - // ); - // const pathToDtdl3 = path.join( - // localDirectory, - // "dtmi/azure/DeviceManagement/deviceinformation-1.json" - // ); - // const fakeDtdl1 = JSON.parse(fs.readFileSync(pathToDtdl1, "utf-8")); - // const fakeDtdl2 = JSON.parse(fs.readFileSync(pathToDtdl2, "utf-8")); - // const fakeDtdl3 = JSON.parse(fs.readFileSync(pathToDtdl3, "utf-8")); - - // const expectedResult = { - // [fakeDtmi1]: fakeDtdl1, - // [fakeDtmi2]: fakeDtdl2, - // [fakeDtmi3]: fakeDtdl3 - // }; - // const resolveResult = resolverTool.resolve(fakeDtmi1, localDirectory, { - // resolveDependencies: "tryFromExpanded" - // }); - // assert(resolveResult instanceof Promise, "resolve method did not return a promise"); - // resolveResult - // .then((actualOutput: any) => { - // assert.deepEqual( - // Object.keys(expectedResult), - // Object.keys(actualOutput), - // "the expected dtmis do not match" - // ); - // Object.keys(expectedResult).forEach((dtmiKey) => { - // assert.deepEqual(expectedResult[dtmiKey], actualOutput[dtmiKey]); - // }); - // done(); - // }) - // .catch((err: any) => done(err)); - // }); - // }); - // }); -}); diff --git a/sdk/iot/modelsrepository/test/node/integration/index.spec.ts b/sdk/iot/modelsrepository/test/node/integration/index.spec.ts new file mode 100644 index 000000000000..1d3fe95d0427 --- /dev/null +++ b/sdk/iot/modelsrepository/test/node/integration/index.spec.ts @@ -0,0 +1,139 @@ +/* eslint-disable no-undef */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { ModelsRepositoryClient, ModelsRepositoryClientOptions } from "../../../src"; +import * as coreClient from "@azure/core-client"; + +import { assert, expect } from "chai"; +import * as sinon from "sinon"; + +import { dependencyResolutionType } from "../../../src/dependencyResolutionType"; + +interface remoteResolutionScenario { + name: string; + clientOptions: { + dependencyResolution: dependencyResolutionType; + repositoryLocation: string; + }; + getModelsOptions: any; + dtmis: { + dtmi: string; + expectedUri: string; + expectedOutputJson: { + fakeDtdl: string; + }; + }[]; +} + +const remoteResolutionScenarios: remoteResolutionScenario[] = [ + { + name: "dependencyResolution: disabled, single DTMI, no dependencies", + clientOptions: { + dependencyResolution: "disabled", + repositoryLocation: "devicemodels.contoso.com" + }, + getModelsOptions: {}, + dtmis: [ + { + dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + expectedUri: + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", + expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } + } + ] + }, + { + name: "dependencyResolution: enabled, single DTMI, no dependencies", + clientOptions: { + dependencyResolution: "enabled", + repositoryLocation: "devicemodels.contoso.com" + }, + getModelsOptions: {}, + dtmis: [ + { + dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + expectedUri: + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", + expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } + } + ] + }, + { + name: "dependencyResolution: tryFromExpanded, single DTMI, no dependencies", + clientOptions: { + dependencyResolution: "tryFromExpanded", + repositoryLocation: "devicemodels.contoso.com" + }, + getModelsOptions: {}, + dtmis: [ + { + dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + expectedUri: + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", + expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } + } + ] + }, + { + name: "dependencyResolution: disabled, multiple DTMI, no dependencies", + clientOptions: { + dependencyResolution: "tryFromExpanded", + repositoryLocation: "devicemodels.contoso.com" + }, + getModelsOptions: {}, + dtmis: [ + { + dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + expectedUri: + "https://devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", + expectedOutputJson: { fakeDtdl: "fakeBodyAsText" } + } + ] + } +]; + +describe("resolver - node", function() { + afterEach(function() { + sinon.restore(); + }); + + describe("remote URL resolution", function() { + remoteResolutionScenarios.forEach((scenario: remoteResolutionScenario) => { + it(scenario.name, function(done) { + let myStub = sinon.stub(coreClient, "ServiceClient"); + for (let i = 0; i < scenario.dtmis.length; i++) { + myStub.onCall(i).returns({ + sendRequest: function(req: any) { + assert.deepEqual( + req.url, + scenario.dtmis[i].expectedUri, + "URL not formatted for request correctly." + ); + return Promise.resolve({ + bodyAsText: JSON.stringify(scenario.dtmis[i].expectedOutputJson), + status: 200 + }); + } + }); + } + + const myOptions: ModelsRepositoryClientOptions = scenario.clientOptions; + const dtmiClient = new ModelsRepositoryClient(myOptions); + const listOfDtmis = scenario.dtmis.map((x) => x.dtmi); + const result = dtmiClient.getModels(listOfDtmis, scenario.getModelsOptions); + const expectedOutput: any = {}; + scenario.dtmis.forEach((element) => { + expectedOutput[element.dtmi] = element.expectedOutputJson; + }); + assert(result instanceof Promise, "resolve method did not return a promise"); + result + .then((actualOutput: any) => { + expect(actualOutput).to.deep.equal(expectedOutput); + done(); + }) + .catch((err: any) => done(err)); + }); + }); + }); +}); diff --git a/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts b/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts new file mode 100644 index 000000000000..549160970857 --- /dev/null +++ b/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import * as lib from '../../../src/dtmiConventions' + +import * as sinon from 'sinon' +import { assert, expect } from 'chai' + +describe('dtmiConventions', function () { + afterEach(() => { + sinon.restore() + }) + describe('isValidDtmi', function () { + // TODO: Will implement more rigorous testing of DTMI validation over multiple different valid DTMIs. + it('should validate a correctly formatted dtmi', function () { + const validDtmi = 'dtmi:azure:DeviceManagement:DeviceInformation;1' + const result = lib.isValidDtmi(validDtmi) + assert(result, 'valid dtmi not found as valid') + }) + + // TODO: Will implement more rigorous testing of DTMI validation over multiple different invalid DTMIs. + it('should invalidate an incorrectly formatted dtmi', function () { + const invalidDtmi = 'dtmiazure:DeviceManagement:DeviceInformation;1' + const result = lib.isValidDtmi(invalidDtmi) + assert(!result, 'invalid dtmi incorrectly labelled as valid') + }) + }) + + describe('convertDtmiToPath', function () { + it('should fail if the dtmi is not formatted correctly', function () { + expect(() => { + const invalidDtmi = 'dtmiazure:DeviceManagement:DeviceInformation;1' + lib.convertDtmiToPath(invalidDtmi, false) + }).to.throw('DTMI is incorrectly formatted. Ensure DTMI follows conventions.') + }) + + it('should reformat a DTMI to a generic path', function () { + const validDtmi = 'dtmi:azure:DeviceManagement:DeviceInformation;1' + const result = lib.convertDtmiToPath(validDtmi, false) + assert.deepEqual(result, '/dtmi/azure/devicemanagement/deviceinformation-1.json') + }) + }) + + describe('getModelUri', function () { + it('should fail if the dtmi is not formatted correctly', function () { + expect(() => { + const invalidDtmi = 'dtmiazure:DeviceManagement:DeviceInformation;1' + const fakeBasePath = 'https://contoso.com' + lib.getModelUri(invalidDtmi, fakeBasePath, false) + }).to.throw('DTMI is incorrectly formatted. Ensure DTMI follows conventions.') + }) + + it('should reformat a DTMI to a qualified URL path', function () { + const validDtmi = 'dtmi:foobar:DeviceInformation;1' + const fakeBasePath = 'https://contoso.com' + const result = lib.getModelUri(validDtmi, fakeBasePath, false) + assert.deepEqual(result, 'https://contoso.com/dtmi/foobar/deviceinformation-1.json') + }) + + it('should add expanded to the path if specified', function () { + const validDtmi = 'dtmi:foobar:DeviceInformation;1' + const fakeBasePath = 'https://contoso.com' + const result = lib.getModelUri(validDtmi, fakeBasePath, true) + assert.deepEqual(result, 'https://contoso.com/dtmi/foobar/deviceinformation-1.expanded.json') + }) + }) +}) diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json b/sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json similarity index 100% rename from sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json rename to sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/azure/DeviceManagement/deviceinformation-1.json diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/deviceinformation-1.json b/sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/deviceinformation-1.json similarity index 100% rename from sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/deviceinformation-1.json rename to sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/deviceinformation-1.json diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json b/sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json similarity index 100% rename from sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json rename to sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.expanded.json diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json b/sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json similarity index 100% rename from sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json rename to sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-1.json diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json b/sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json similarity index 100% rename from sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json rename to sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/temperaturecontroller-2.json diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json b/sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json similarity index 100% rename from sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json rename to sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.expanded.json diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json b/sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json similarity index 100% rename from sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json rename to sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/thermostat-1.json diff --git a/sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json b/sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json similarity index 100% rename from sdk/iot/modelsrepository/test/node/testModelRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json rename to sdk/iot/modelsrepository/test/node/unit/testRepository/dtmi/contoso/FakeDeviceManagement/thermostat-2.json From 84e25d94a94f17c476dee8d06bf2ae44bcb35c40 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 4 May 2021 09:19:55 -0700 Subject: [PATCH 20/81] bugfixes --- sdk/iot/modelsrepository/package.json | 6 +- .../samples/javascript/remote_example.js | 7 +- sdk/iot/modelsrepository/src/dtmiResolver.ts | 13 +- .../src/modelsRepositoryClient.ts | 2 +- sdk/iot/modelsrepository/src/psuedoParser.ts | 2 +- .../test/node/integration/index.spec.ts | 8 +- .../test/node/unit/dtmiConventions.spec.ts | 136 +++++++++++------- sdk/iot/modelsrepository/tsconfig.json | 5 +- 8 files changed, 108 insertions(+), 71 deletions(-) diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index 9b89481384e8..6ed3adc26bb9 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -9,7 +9,7 @@ "stream": "./node_modules/stream-browserify/index.js", "./dist-esm/src/print.js": "./dist-esm/src/print.browser.js" }, - "types": "types/template.d.ts", + "types": "types/iot-models-repository.d.ts", "scripts": { "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1", @@ -33,14 +33,14 @@ "test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node", "test": "npm run build:test && npm run unit-test && npm run integration-test", "unit-test:browser": "karma start --single-run", - "unit-test:node": "mocha --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/{,!(browser)/**/}/*.spec.ts\"", + "unit-test:node": "mocha --require esm --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"dist-esm/test/{,!(browser)/**/}/*.spec.js\"", "unit-test": "npm run unit-test:node && npm run unit-test:browser", "temp-unit-test": "mocha -r ts-node/register --timeout 1200000 test/node/*.spec.ts" }, "files": [ "dist/", "dist-esm/src/", - "types/template.d.ts", + "types/iot-models-repository.d.ts", "README.md", "LICENSE", "rollup.config.js", diff --git a/sdk/iot/modelsrepository/samples/javascript/remote_example.js b/sdk/iot/modelsrepository/samples/javascript/remote_example.js index 6f0b36e6807a..d542bc9c118d 100644 --- a/sdk/iot/modelsrepository/samples/javascript/remote_example.js +++ b/sdk/iot/modelsrepository/samples/javascript/remote_example.js @@ -13,16 +13,17 @@ logger.setLogLevel('info'); // You can change the endpoint and dtmi you'd like to access const repositoryLocation = "https://devicemodels.azure.com/"; -const dtmi = process.argv[2] || "dtmi:rigado:FlicButton;2"; +const dtmi = process.argv[2] || "dtmi:com:example:TemperatureController;1"; console.log(repositoryLocation, dtmi); async function main() { // This is where you can change the options for how you want to resolve the dependencies. - const client = new lib.ModelsRepositoryClient(repositoryLocation); - const result = client.getModels(dtmi); + const client = new lib.ModelsRepositoryClient({repositoryLocation: repositoryLocation, dependencyResolution: 'enabled'}); + const result = await client.getModels(dtmi); console.log(result); Object.keys(result).forEach((fetchedDtmi) => { + console.log("------------------------------------------------"); console.log(`DTMI is: ${fetchedDtmi}`); console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`); console.log(`DTDL Description is: ${result[fetchedDtmi].description}`); diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index 0a05ac447868..97d33479d932 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { convertDtmiToPath, logger, ModelError } from "./internal"; +import { convertDtmiToPath, DTDL, logger, ModelError } from "./internal"; export class ResolverError extends Error { cause: Error | undefined; @@ -18,7 +18,7 @@ export class DtmiResolver { this._fetcher = fetcher; } - async resolve(dtmis: string[], expandedModel: boolean = false) { + async resolve(dtmis: string[], expandedModel: boolean = false): Promise<{[dtmi: string]: DTDL}> { let modelMap: any = {}; for (let dtmi of dtmis) { @@ -29,8 +29,9 @@ export class DtmiResolver { if (expandedModel) { - if (!((dtdl as any[]).includes((model: any) => model["id"] === dtmi))) { - throw new ModelError(`DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${dtdl.map((model:any) => model["id"])}`); + const modelIds: string[] = (dtdl as any[]).map((model:any) => model["@id"]); + if (!modelIds.includes(dtmi)) { + throw new ModelError(`DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${modelIds}`); } for (let model of dtdl) { modelMap[model["@id"]] = model; @@ -47,6 +48,4 @@ export class DtmiResolver { return modelMap; } -} - -// TODO: +} \ No newline at end of file diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index 18f499aedf41..88c5f80ae693 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -181,7 +181,7 @@ export class ModelsRepositoryClient { logger.info(`Getting models w/ dependency resolution mode: enabled`); logger.info(`Retreiving model(s): ${dtmis}...`); const baseModelMap = await this._resolver.resolve(dtmis); - const baseModelList = [baseModelMap.values()]; + const baseModelList = Object.keys(baseModelMap).map((key) => baseModelMap[key]) logger.info(`Retreiving model dependencies for ${dtmis}...`); modelMap = await this._pseudoParser.expand(baseModelList); } else if (dependencyResolution === cnst.DEPENDENCY_MODE_TRY_FROM_EXPANDED) { diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index c4d6b51849b9..3f626bb43214 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -32,7 +32,7 @@ export class PseudoParser { logger.info(`Outstanding dependencies found: ${dependenciesToResolve}`); let resolvedDependenciesMap = await this._resolver.resolve(dependenciesToResolve); modelMap = { ...modelMap, ...resolvedDependenciesMap }; - for (let dependencyModel of resolvedDependenciesMap.values()) { + for (let dependencyModel of Object.values(resolvedDependenciesMap)) { await this._expand(dependencyModel, modelMap); } } diff --git a/sdk/iot/modelsrepository/test/node/integration/index.spec.ts b/sdk/iot/modelsrepository/test/node/integration/index.spec.ts index 1d3fe95d0427..767c47e9eb89 100644 --- a/sdk/iot/modelsrepository/test/node/integration/index.spec.ts +++ b/sdk/iot/modelsrepository/test/node/integration/index.spec.ts @@ -31,7 +31,7 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ name: "dependencyResolution: disabled, single DTMI, no dependencies", clientOptions: { dependencyResolution: "disabled", - repositoryLocation: "devicemodels.contoso.com" + repositoryLocation: "https://www.devicemodels.contoso.com" }, getModelsOptions: {}, dtmis: [ @@ -47,7 +47,7 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ name: "dependencyResolution: enabled, single DTMI, no dependencies", clientOptions: { dependencyResolution: "enabled", - repositoryLocation: "devicemodels.contoso.com" + repositoryLocation: "https://www.devicemodels.contoso.com" }, getModelsOptions: {}, dtmis: [ @@ -63,7 +63,7 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ name: "dependencyResolution: tryFromExpanded, single DTMI, no dependencies", clientOptions: { dependencyResolution: "tryFromExpanded", - repositoryLocation: "devicemodels.contoso.com" + repositoryLocation: "https://www.devicemodels.contoso.com" }, getModelsOptions: {}, dtmis: [ @@ -79,7 +79,7 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ name: "dependencyResolution: disabled, multiple DTMI, no dependencies", clientOptions: { dependencyResolution: "tryFromExpanded", - repositoryLocation: "devicemodels.contoso.com" + repositoryLocation: "https://www.devicemodels.contoso.com" }, getModelsOptions: {}, dtmis: [ diff --git a/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts b/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts index 549160970857..95c5d342c76f 100644 --- a/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts +++ b/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts @@ -3,65 +3,99 @@ import * as lib from '../../../src/dtmiConventions' -import * as sinon from 'sinon' import { assert, expect } from 'chai' +interface TestCase { + dtmi: string, + valid: boolean, + expectedPath?: string + expectedURL?: string +} + +const testCases: TestCase[] = [ + { + dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;1', + valid: true, + expectedPath: 'dtmi/azure/devicemanagement/deviceinformation-1.json', + expectedURL: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json' + }, + { + dtmi: 'dtmiazure:DeviceManagement:DeviceInformation;1', + valid: false, + }, + { + dtmi: 'dtmi:foobar:DeviceInformation;1', + valid: true, + expectedPath: 'dtmi/foobar/deviceinformation-1.json', + expectedURL: 'https://contoso.com/dtmi/foobar/deviceinformation-1.json' + } +] + +const fakeBasePath = 'https://contoso.com' + + describe('dtmiConventions', function () { - afterEach(() => { - sinon.restore() - }) - describe('isValidDtmi', function () { - // TODO: Will implement more rigorous testing of DTMI validation over multiple different valid DTMIs. - it('should validate a correctly formatted dtmi', function () { - const validDtmi = 'dtmi:azure:DeviceManagement:DeviceInformation;1' - const result = lib.isValidDtmi(validDtmi) - assert(result, 'valid dtmi not found as valid') - }) + testCases.forEach((testCase) => { + describe('isValidDtmi', function () { + if (testCase.valid) { + it(`valid dtmi - ${testCase.dtmi}`, function () { + const result = lib.isValidDtmi(testCase.dtmi); + assert(result, `${testCase.dtmi} was incorrectly labelled invalid.`) + }); + } else { + it(`invalid dtmi - ${testCase.dtmi}`, function () { + const result = lib.isValidDtmi(testCase.dtmi); + expect(result, `${testCase.dtmi} was incorrectly labelled as valid.`).to.be.false + }) + } + }); + }); - // TODO: Will implement more rigorous testing of DTMI validation over multiple different invalid DTMIs. - it('should invalidate an incorrectly formatted dtmi', function () { - const invalidDtmi = 'dtmiazure:DeviceManagement:DeviceInformation;1' - const result = lib.isValidDtmi(invalidDtmi) - assert(!result, 'invalid dtmi incorrectly labelled as valid') + testCases.forEach((testCase) => { + describe('convertDtmiToPath', function () { + if (testCase.valid) { + it(`converts dtmi to path - ${testCase.dtmi}`, function () { + const result = lib.convertDtmiToPath(testCase.dtmi, false) + expect(result).to.deep.equal(testCase.expectedPath); + }) + it(`converts dtmi to expanded path - ${testCase.dtmi}`, function () { + const result = lib.convertDtmiToPath(testCase.dtmi, true) + const expected = testCase.expectedPath?.replace('.json', '.expanded.json'); + expect(result).to.deep.equal(expected); + }) + } else { + it(`throw error on invalid dtmi - ${testCase.dtmi}`, function () { + expect(() => { + lib.convertDtmiToPath(testCase.dtmi, false) + }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.') + }) + } }) - }) + }); - describe('convertDtmiToPath', function () { - it('should fail if the dtmi is not formatted correctly', function () { - expect(() => { - const invalidDtmi = 'dtmiazure:DeviceManagement:DeviceInformation;1' - lib.convertDtmiToPath(invalidDtmi, false) - }).to.throw('DTMI is incorrectly formatted. Ensure DTMI follows conventions.') - }) + testCases.forEach((testCase) => { + describe('getModelUri', function () { + if (testCase.valid) { + it(`generates model uri - ${testCase.dtmi}`, function () { + const result = lib.getModelUri(testCase.dtmi, fakeBasePath, false); + expect(result).to.equal(testCase.expectedURL); + }) - it('should reformat a DTMI to a generic path', function () { - const validDtmi = 'dtmi:azure:DeviceManagement:DeviceInformation;1' - const result = lib.convertDtmiToPath(validDtmi, false) - assert.deepEqual(result, '/dtmi/azure/devicemanagement/deviceinformation-1.json') - }) - }) + it(`generates expanded model uri - ${testCase.dtmi}`, function () { + const result = lib.getModelUri(testCase.dtmi, fakeBasePath, true) + const expected = testCase.expectedURL?.replace('.json', '.expanded.json'); + expect(result).to.equal(expected); + }) + } else { + it('should fail if the dtmi is not formatted correctly', function () { + expect(() => { + lib.getModelUri(testCase.dtmi, fakeBasePath, false) + }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.') + }) + } - describe('getModelUri', function () { - it('should fail if the dtmi is not formatted correctly', function () { - expect(() => { - const invalidDtmi = 'dtmiazure:DeviceManagement:DeviceInformation;1' - const fakeBasePath = 'https://contoso.com' - lib.getModelUri(invalidDtmi, fakeBasePath, false) - }).to.throw('DTMI is incorrectly formatted. Ensure DTMI follows conventions.') - }) - it('should reformat a DTMI to a qualified URL path', function () { - const validDtmi = 'dtmi:foobar:DeviceInformation;1' - const fakeBasePath = 'https://contoso.com' - const result = lib.getModelUri(validDtmi, fakeBasePath, false) - assert.deepEqual(result, 'https://contoso.com/dtmi/foobar/deviceinformation-1.json') - }) - it('should add expanded to the path if specified', function () { - const validDtmi = 'dtmi:foobar:DeviceInformation;1' - const fakeBasePath = 'https://contoso.com' - const result = lib.getModelUri(validDtmi, fakeBasePath, true) - assert.deepEqual(result, 'https://contoso.com/dtmi/foobar/deviceinformation-1.expanded.json') - }) - }) + }) + }); }) diff --git a/sdk/iot/modelsrepository/tsconfig.json b/sdk/iot/modelsrepository/tsconfig.json index 2c46b7ce0a47..38b8848efa2c 100644 --- a/sdk/iot/modelsrepository/tsconfig.json +++ b/sdk/iot/modelsrepository/tsconfig.json @@ -5,5 +5,8 @@ "declarationDir": "./types", "lib": ["dom", "esnext"] }, - "exclude": ["node_modules", "types", "temp", "browser", "dist", "dist-esm", "./samples/**/*.ts"] + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ] } From 9686d193ed55e7012b1e71b5541ca56b06e84c2c Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 4 May 2021 10:04:04 -0700 Subject: [PATCH 21/81] bugfixes --- sdk/iot/modelsrepository/src/dtmiResolver.ts | 40 ++++++++++---------- sdk/iot/modelsrepository/src/psuedoParser.ts | 14 ++++--- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index 97d33479d932..5fb0774d9aa1 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -20,32 +20,32 @@ export class DtmiResolver { async resolve(dtmis: string[], expandedModel: boolean = false): Promise<{[dtmi: string]: DTDL}> { let modelMap: any = {}; - + let promiseList = []; for (let dtmi of dtmis) { - let dtdl: any[] | any; let dtdlPath = convertDtmiToPath(dtmi, expandedModel); logger.info(`Model ${dtmi} located in repository at ${dtdlPath}`); - dtdl = await this._fetcher.fetch(dtdlPath); - - - if (expandedModel) { - const modelIds: string[] = (dtdl as any[]).map((model:any) => model["@id"]); - if (!modelIds.includes(dtmi)) { - throw new ModelError(`DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${modelIds}`); - } - for (let model of dtdl) { - modelMap[model["@id"]] = model; + let mypromise = this._fetcher.fetch(dtdlPath).then((dtdl: any[] | any) => { + if (expandedModel) { + const modelIds: string[] = (dtdl as any[]).map((model:any) => model["@id"]); + if (!modelIds.includes(dtmi)) { + throw new ModelError(`DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${modelIds}`); + } + for (let model of dtdl) { + modelMap[model["@id"]] = model; + } + } else { + let model = dtdl; + if (model["@id"] != dtmi) { + new ModelError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`); + } + + modelMap[`${dtmi}`] = dtdl; } - } else { - let model = dtdl; - if (model["@id"] != dtmi) { - new ModelError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`); - } - - modelMap[`${dtmi}`] = dtdl; - } + }); + promiseList.push(mypromise); } + await Promise.all(promiseList); return modelMap; } } \ No newline at end of file diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index 3f626bb43214..aa448ffdb6dc 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -22,7 +22,7 @@ export class PseudoParser { return expandedMap; } - private async _expand(model: DTDL, modelMap: any) { + private async _expand(model: DTDL, modelMap: any): Promise { logger.info(`Expanding model: ${model["@id"]}`); let dependencies = this._getModelDependencies(model); let dependenciesToResolve = dependencies.filter((dependency: string) => { @@ -31,10 +31,14 @@ export class PseudoParser { if (dependenciesToResolve.length !== 0) { logger.info(`Outstanding dependencies found: ${dependenciesToResolve}`); let resolvedDependenciesMap = await this._resolver.resolve(dependenciesToResolve); - modelMap = { ...modelMap, ...resolvedDependenciesMap }; - for (let dependencyModel of Object.values(resolvedDependenciesMap)) { - await this._expand(dependencyModel, modelMap); - } + Object.keys(resolvedDependenciesMap).forEach((key) => { + modelMap[key] = resolvedDependenciesMap[key]; + }) + const promiseList: Promise[] = []; + Object.values(resolvedDependenciesMap).forEach((dependencyModel) => { + promiseList.push(this._expand(dependencyModel, modelMap)); + }); + await Promise.all(promiseList); } } From 9650a3e4670f1d91ab0128541382574b6232002a Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 4 May 2021 11:17:01 -0700 Subject: [PATCH 22/81] change readmes --- sdk/iot/modelsrepository/README.md | 2 +- .../review/iot-modelsrepository-client.api.md | 2 + ...te_example.js => modelResolutionSample.js} | 1 + .../samples/typescript/README.md | 144 ++++++++++++++---- .../samples/typescript/package.json | 10 +- .../samples/typescript/src/example.ts | 23 --- .../src/modelResolutionSample.ts} | 22 ++- .../samples/typescript/tsconfig.json | 6 - .../src/modelsRepositoryClient.ts | 14 ++ 9 files changed, 147 insertions(+), 77 deletions(-) rename sdk/iot/modelsrepository/samples/javascript/{remote_example.js => modelResolutionSample.js} (96%) delete mode 100644 sdk/iot/modelsrepository/samples/typescript/src/example.ts rename sdk/iot/modelsrepository/samples/{javascript/local_example.js => typescript/src/modelResolutionSample.ts} (50%) diff --git a/sdk/iot/modelsrepository/README.md b/sdk/iot/modelsrepository/README.md index 7271d3ecf0f6..b6c6fe119948 100644 --- a/sdk/iot/modelsrepository/README.md +++ b/sdk/iot/modelsrepository/README.md @@ -4,7 +4,7 @@ This package contains an isomorphic Client Library for Azure IoT Models Reposito [Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository) | [Package (npm)](https://www.npmjs.com/package/@azure/iot-modelsrepository-client/) | -[Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/iot-modelsrepository-client/samples) | +[Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/iot-modelsrepository-client/samples) ------------------------------------- diff --git a/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md b/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md index 3b859bdc6768..aee37934d292 100644 --- a/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md +++ b/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md @@ -18,12 +18,14 @@ export interface GetModelsOptions { export class ModelsRepositoryClient { constructor(options?: ModelsRepositoryClientOptions); get apiVersion(): string; + get dependencyResolution(): dependencyResolutionType; getModels(dtmis: string, options?: GetModelsOptions): Promise<{ [dtmi: string]: any; }>; getModels(dtmis: string[], options?: GetModelsOptions): Promise<{ [dtmi: string]: any; }>; + get repositoryLocation(): string; } // @public diff --git a/sdk/iot/modelsrepository/samples/javascript/remote_example.js b/sdk/iot/modelsrepository/samples/javascript/modelResolutionSample.js similarity index 96% rename from sdk/iot/modelsrepository/samples/javascript/remote_example.js rename to sdk/iot/modelsrepository/samples/javascript/modelResolutionSample.js index d542bc9c118d..2326292e44cc 100644 --- a/sdk/iot/modelsrepository/samples/javascript/remote_example.js +++ b/sdk/iot/modelsrepository/samples/javascript/modelResolutionSample.js @@ -13,6 +13,7 @@ logger.setLogLevel('info'); // You can change the endpoint and dtmi you'd like to access const repositoryLocation = "https://devicemodels.azure.com/"; +// const repositoryLocation = process.argv[2] || "C:/"; const dtmi = process.argv[2] || "dtmi:com:example:TemperatureController;1"; console.log(repositoryLocation, dtmi); diff --git a/sdk/iot/modelsrepository/samples/typescript/README.md b/sdk/iot/modelsrepository/samples/typescript/README.md index d5c888fa19c6..2f818e4aacee 100644 --- a/sdk/iot/modelsrepository/samples/typescript/README.md +++ b/sdk/iot/modelsrepository/samples/typescript/README.md @@ -10,64 +10,148 @@ products: urlFragment: template-typescript --- --> -# Azure Template client library samples for TypeScript +# Azure IoT Models Repository Samples + +The Azure IoT Models Repository enables builders to manage and share digital twin models for global consumption. The models are [JSON-LD](https://json-ld.org/) documents defined using the Digital Twins Definition Language [(DTDL)](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md). + +For more info about the Azure IoT Models Repository checkout the [docs](https://docs.microsoft.com/en-us/azure/iot-pnp/concepts-model-repository). -These sample programs show how to use the TypeScript client libraries for Azure Template in some common scenarios. | **File Name** | **Description** | | ----------------------------------- | --------------- | -| [sampleTemplate.ts][sampletemplate] | sample template | +| [remoteExample.ts][remoteexample] | sample template | + +## Introduction + +You can explore the models repository APIs with the client library using the samples project. + +The samples project demonstrates the following: + +- Instantiate the client +- Get models and their dependencies from either a remote endpoint or local repository. +- Integration with the Digital Twins Model Parser ## Prerequisites The samples are compatible with Node.js >= 8.0.0. -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. -```bash -npm install -g typescript +## Initializing the Models Repository Client + +```ts +// When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint +// https://devicemodels.azure.com/ is used and the model dependency resolution +// configuration is set to TryFromExpanded. +const client = new ModelsRepositoryClient(); +console.log(`Initialized client point to global endpoint: ${client.repositoryLocation}`); +``` +```ts +// The client will also work with a local filesystem URI. This example shows initalization +// with a local URI and disabling model dependency resolution. +const client = new ModelsRepositoryClient({repositoryLocation: 'file:///path/to/repository/', dependencyResolution: 'disabled'}); +console.log(`Initialized client pointing to local path: ${client.repositoryLocation}`); ``` -You need [an Azure subscription][freesub] to run these sample programs. Samples retrieve credentials to access the endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. +## Override options -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. +If you need to override pipeline behavior, such as provide your own HttpClient instance, you can do that via constructor that takes a ModelsRepositoryClientOptions parameter. It provides an opportunity to override default behavior including: + +- Overriding [transport](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Pipeline.md) +- Enabling [diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Pipeline.md) +- Controlling [retry strategy](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Pipeline.md) + +## Publish Models + +Publishing models to the models repository requires [exercising](https://docs.microsoft.com/en-us/azure/iot-pnp/concepts-model-repository#publish-a-model) common GitHub workflows. -## Setup +## Get Models -To run the samples using the published version of the package: +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. -1. Install the dependencies using `npm`: +```ts +// Global endpoint client +const client = new ModelsRepositoryClient(); -```bash -npm install +// The output of GetModelsAsync() will include at least the definition for the target dtmi. +// If the model dependency resolution configuration is not disabled, then models in which the +// target dtmi depends on will also be included in the returned IDictionary. +const dtmi = "dtmi:com:example:TemperatureController;1"; +const models = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); + +// In this case the above dtmi has 2 model dependencies. +// dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1 +console.log(`${dtmi} resolved in ${models.keys().length} interfaces.`); ``` -2. Compile the samples +GitHub pull-request workflows are a core aspect of the IoT Models Repository service. To submit models, the user is expected to fork and clone the global [models repository project](https://github.com/Azure/iot-plugandplay-models) then iterate against the local copy. Changes would then be pushed to the fork (ideally in a new branch) and a PR created against the global repository. + +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. + +```ts +// Local sample repository client +const client = new ModelsRepositoryClient(`file:///path/to/repository/`); + +// The output of GetModelsAsync() will include at least the definition for the target dtmi. +// If the model dependency resolution configuration is not disabled, then models in which the +// target dtmi depends on will also be included in the returned IDictionary. +const dtmi = "dtmi:com:example:TemperatureController;1"; +const models = await client.getModels(dtmi); -```bash -npm run build +// In this case the above dtmi has 2 model dependencies. +// dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1 +console.log(`${dtmi} resolved in ${models.keys().length} interfaces.`); ``` -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. +You are also able to get definitions for multiple root models at a time by leveraging the `GetModels` overload. -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): +```ts +// Global endpoint client +const client = new ModelsRepositoryClient(); -```bash -node dist/sampleTemplate.js +const dtmis = ["dtmi:com:example:TemperatureController;1", "dtmi:com:example:azuresphere:sampledevice;1"]; +const models = await client.getModels(dtmis); + +// In this case the dtmi "dtmi:com:example:TemperatureController;1" has 2 model dependencies +// and the dtmi "dtmi:com:example:azuresphere:sampledevice;1" has no additional dependencies. +// The returned IDictionary will include 4 models. +console.log(`${dtmis.toString()} resolved in ${models.keys().length} interfaces.`); ``` -Alternatively, run a single sample with the correct environment variables set (step 3 is not required if you do this), for example (cross-platform): +## Digital Twins Model Parser Integration + +*When the Digital Twins Model Parser is completed, we will update you with information on how to integrate this client.* + +## DtmiConventions utility functions -```bash -npx cross-env ENDPOINT="" API_KEY="" node dist/sampleTemplate.js +The IoT Models Repository applies a set of conventions for organizing digital twin models. This package exposes a class called `DtmiConventions` which exposes utility functions supporting these conventions. These same functions are used throughout the client. + +```ts +// This snippet shows how to validate a given DTMI string is well-formed. + +// Returns true +DtmiConventions.isValidDtmi("dtmi:com:example:Thermostat;1"); + +// Returns false +DtmiConventions.isValidDtmi("dtmi:com:example:Thermostat"); ``` -## Next Steps +```ts +// This snippet shows obtaining a fully qualified path to a model file. -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. +// Local repository example +const localRepositoryUri: string = "file:///path/to/repository/"; +const fullyQualifiedModelPath: string = + DtmiConventions.getModelUri("dtmi:com:example:Thermostat;1", localRepositoryUri); -[sampletemplate]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template/samples/typescript/src/sampleTemplate.ts -[apiref]: https://docs.microsoft.com/javascript/api -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html +// Prints '/path/to/repository/dtmi/com/example/thermostat-1.json' +console.log(fullyQualifiedModelPath); + +// Remote repository example +const remoteRepositoryUri: string = "https://contoso.com/models/"; +const fullyQualifiedModelPath: string = + DtmiConventions.GetModelUri("dtmi:com:example:Thermostat;1", remoteRepositoryUri); + +// Prints 'https://contoso.com/models/dtmi/com/example/thermostat-1.json' +console.log(fullyQualifiedModelPath); +``` diff --git a/sdk/iot/modelsrepository/samples/typescript/package.json b/sdk/iot/modelsrepository/samples/typescript/package.json index b0b033340d07..0ef4d6dd3688 100644 --- a/sdk/iot/modelsrepository/samples/typescript/package.json +++ b/sdk/iot/modelsrepository/samples/typescript/package.json @@ -1,8 +1,8 @@ { - "name": "azure-template-samples-ts", + "name": "azure-iot-modelsrepository-samples", "private": true, "version": "0.1.0", - "description": "Azure template client library samples for TypeScript", + "description": "Azure iot models repository client library samples for TypeScript", "engine": { "node": ">=8.0.0" }, @@ -13,7 +13,7 @@ "repository": { "type": "git", "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/template/template" + "directory": "sdk/iot/modelsrepository" }, "keywords": [ "Azure", @@ -25,10 +25,10 @@ "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template", + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository", "sideEffects": false, "dependencies": { - "@azure/template": "latest", + "@azure/iot-modelsrepository-client": "latest", "dotenv": "^8.2.0" }, "devDependencies": { diff --git a/sdk/iot/modelsrepository/samples/typescript/src/example.ts b/sdk/iot/modelsrepository/samples/typescript/src/example.ts deleted file mode 100644 index db879553741f..000000000000 --- a/sdk/iot/modelsrepository/samples/typescript/src/example.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -/** - * Demonstrates resolving/obtaining a particular model definition from a remote model repository - */ - -import {ModelsRepositoryClient} from "../../../src"; - -const repositoryEndpoint = "devicemodels.azure.com"; -const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; - -console.log(repositoryEndpoint, dtmi); - -async function main() { - const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); - const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); - console.log(result); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/iot/modelsrepository/samples/javascript/local_example.js b/sdk/iot/modelsrepository/samples/typescript/src/modelResolutionSample.ts similarity index 50% rename from sdk/iot/modelsrepository/samples/javascript/local_example.js rename to sdk/iot/modelsrepository/samples/typescript/src/modelResolutionSample.ts index b236c41b94b8..3d2040f85419 100644 --- a/sdk/iot/modelsrepository/samples/javascript/local_example.js +++ b/sdk/iot/modelsrepository/samples/typescript/src/modelResolutionSample.ts @@ -1,23 +1,21 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -/** - * Demonstrates resolving/obtaining a particular model definition from a remote model repository - */ +import {ModelsRepositoryClient} from "../../../src"; -const resolver = require("../../out/src/index.js"); +const repositoryEndpoint = "devicemodels.azure.com"; +const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; -// You can change the endpoint and dtmi you'd like to access -const directory = process.argv[2] || "C:/"; -const dtmi = "dtmi:com:example:TemperatureController;1"; - -console.log(directory, dtmi); +console.log(repositoryEndpoint, dtmi); async function main() { - // This is where you can change the options for how you want to resolve the dependencies. - const result = await resolver.resolve(dtmi, directory, { resolveDependencies: "enabled" }); - console.log(result); + // When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint + // https://devicemodels.azure.com/ is used and the model dependency resolution + // configuration is set to TryFromExpanded. + const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); + const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); Object.keys(result).forEach((fetchedDtmi) => { + console.log("------------------------------------------------"); console.log(`DTMI is: ${fetchedDtmi}`); console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`); console.log(`DTDL Description is: ${result[fetchedDtmi].description}`); diff --git a/sdk/iot/modelsrepository/samples/typescript/tsconfig.json b/sdk/iot/modelsrepository/samples/typescript/tsconfig.json index 45ae4f140477..51166aa39cf8 100644 --- a/sdk/iot/modelsrepository/samples/typescript/tsconfig.json +++ b/sdk/iot/modelsrepository/samples/typescript/tsconfig.json @@ -6,11 +6,5 @@ }, "include": [ "typescript/src/**.ts" - ], - "exclude": [ - "typescript/*.json", - "**/node_modules/", - "../node_modules", - "../typings" ] } diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index 88c5f80ae693..2c969dcbf173 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -75,6 +75,20 @@ export class ModelsRepositoryClient { return this._apiVersion; } + /** + * Configured repository location for this instance. Will be used as the endpoint to get the models from. + */ + get repositoryLocation() { + return this._repositoryLocation; + } + + /** + * Configured type of dependency resolution for this instance. Dictates how the client deals with model dependencies. + */ + get dependencyResolution() { + return this._dependencyResolution; + } + /** * Because of the local / remote optionality of this client, the service client * must be dynamically generated based on the repository location. If the provided From bd9e9c4522c3e24bf8b1daa9a29987fea4b6b657 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 4 May 2021 13:53:48 -0700 Subject: [PATCH 23/81] fix --- .../review/iot-modelsrepository-client.api.md | 6 +++++ .../samples/typescript/README.md | 10 +++---- .../typescript/src/dtmiConventionsSample.ts | 22 ++++++++++++++++ .../typescript/src/modelResolutionSample.ts | 4 +-- .../modelsrepository/src/dtmiConventions.ts | 26 +++++++++++++++++++ sdk/iot/modelsrepository/src/index.ts | 6 +++-- 6 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 sdk/iot/modelsrepository/samples/typescript/src/dtmiConventionsSample.ts diff --git a/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md b/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md index aee37934d292..dbcd0d3f29ff 100644 --- a/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md +++ b/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md @@ -14,6 +14,12 @@ export interface GetModelsOptions { dependencyResolution: dependencyResolutionType; } +// @public +export function getModelUri(dtmi: string, repositoryUri: string, expanded?: boolean): string; + +// @public +export function isValidDtmi(dtmi: string): boolean; + // @public export class ModelsRepositoryClient { constructor(options?: ModelsRepositoryClientOptions); diff --git a/sdk/iot/modelsrepository/samples/typescript/README.md b/sdk/iot/modelsrepository/samples/typescript/README.md index 2f818e4aacee..8d93f86f9c04 100644 --- a/sdk/iot/modelsrepository/samples/typescript/README.md +++ b/sdk/iot/modelsrepository/samples/typescript/README.md @@ -124,16 +124,16 @@ console.log(`${dtmis.toString()} resolved in ${models.keys().length} interfaces. ## DtmiConventions utility functions -The IoT Models Repository applies a set of conventions for organizing digital twin models. This package exposes a class called `DtmiConventions` which exposes utility functions supporting these conventions. These same functions are used throughout the client. +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. ```ts // This snippet shows how to validate a given DTMI string is well-formed. // Returns true -DtmiConventions.isValidDtmi("dtmi:com:example:Thermostat;1"); +isValidDtmi("dtmi:com:example:Thermostat;1"); // Returns false -DtmiConventions.isValidDtmi("dtmi:com:example:Thermostat"); +isValidDtmi("dtmi:com:example:Thermostat"); ``` ```ts @@ -142,7 +142,7 @@ DtmiConventions.isValidDtmi("dtmi:com:example:Thermostat"); // Local repository example const localRepositoryUri: string = "file:///path/to/repository/"; const fullyQualifiedModelPath: string = - DtmiConventions.getModelUri("dtmi:com:example:Thermostat;1", localRepositoryUri); + getModelUri("dtmi:com:example:Thermostat;1", localRepositoryUri); // Prints '/path/to/repository/dtmi/com/example/thermostat-1.json' console.log(fullyQualifiedModelPath); @@ -150,7 +150,7 @@ console.log(fullyQualifiedModelPath); // Remote repository example const remoteRepositoryUri: string = "https://contoso.com/models/"; const fullyQualifiedModelPath: string = - DtmiConventions.GetModelUri("dtmi:com:example:Thermostat;1", remoteRepositoryUri); + GetModelUri("dtmi:com:example:Thermostat;1", remoteRepositoryUri); // Prints 'https://contoso.com/models/dtmi/com/example/thermostat-1.json' console.log(fullyQualifiedModelPath); diff --git a/sdk/iot/modelsrepository/samples/typescript/src/dtmiConventionsSample.ts b/sdk/iot/modelsrepository/samples/typescript/src/dtmiConventionsSample.ts new file mode 100644 index 000000000000..cf8ab718cf41 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/typescript/src/dtmiConventionsSample.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +import {getModelUri, isValidDtmi} from "../../../src"; + +function main() { + + // returns true + isValidDtmi("dtmi:com:example:Thermostat;1"); + + // returns false + isValidDtmi("dtmi:com:example:Thermostat"); + + // local repository fully qualified path to a model file + const fullyQualifiedLocalPath = getModelUri("dtmi:com:example:Thermostat;1", "file:///path/to/repository/"); + console.log(fullyQualifiedLocalPath); + + const fullyQualifiedRemotePath = getModelUri("dtmi:com:example:Thermostat;1", "https://contoso.com/models"); + console.log(fullyQualifiedRemotePath); +} + +main(); \ No newline at end of file diff --git a/sdk/iot/modelsrepository/samples/typescript/src/modelResolutionSample.ts b/sdk/iot/modelsrepository/samples/typescript/src/modelResolutionSample.ts index 3d2040f85419..7aa82d5a82f8 100644 --- a/sdk/iot/modelsrepository/samples/typescript/src/modelResolutionSample.ts +++ b/sdk/iot/modelsrepository/samples/typescript/src/modelResolutionSample.ts @@ -1,5 +1,5 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Copyright (c) Microsoft. +// Licensed under the MIT license. import {ModelsRepositoryClient} from "../../../src"; diff --git a/sdk/iot/modelsrepository/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts index 1af2bd84b94b..c49c3b02f99b 100644 --- a/sdk/iot/modelsrepository/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -1,6 +1,14 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. + +/** + * isValidDtmi + * @description given a dtmi it will validate it matches the convention. + * + * @param dtmi + * @returns {boolean} + */ export function isValidDtmi(dtmi: string): boolean { if (dtmi) { const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/; @@ -9,6 +17,15 @@ export function isValidDtmi(dtmi: string): boolean { return false; // if not a string return false. } +/** + * getModelUri + * @description given the dtmi and repository uri, will get a fully qualified model uri. + * + * @param dtmi + * @param repositoryUri + * @param expanded + * @returns + */ export function getModelUri(dtmi: string, repositoryUri: string, expanded: boolean = false): string { // TODO: Make sure this works with Windows UNC Filesystem Path. if (!repositoryUri.endsWith("/")) { @@ -18,6 +35,15 @@ export function getModelUri(dtmi: string, repositoryUri: string, expanded: boole return modelUri; } + +/** + * convertDtmiToPath + * @description converts a dtmi into the model path format. + * + * @param dtmi + * @param expanded + * @returns + */ export function convertDtmiToPath(dtmi: string, expanded: boolean): string { // presently this dtmi to path function does not return the path with a // file format at the end, i.e. does not append .json or .expanded.json. diff --git a/sdk/iot/modelsrepository/src/index.ts b/sdk/iot/modelsrepository/src/index.ts index 9c25b522ce02..28e8b022c99e 100644 --- a/sdk/iot/modelsrepository/src/index.ts +++ b/sdk/iot/modelsrepository/src/index.ts @@ -41,5 +41,7 @@ export { ModelsRepositoryClient, ModelsRepositoryClientOptions, GetModelsOptions, - dependencyResolutionType, -} from "./internal" + dependencyResolutionType, + isValidDtmi, + getModelUri, +} from "./internal"; From d17b3a69e91bc466a1fa7949e321a66bafe41fa7 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 13 May 2021 15:19:25 -0700 Subject: [PATCH 24/81] update tests --- rush.json | 2 +- sdk/iot/modelsrepository/README.md | 12 +- sdk/iot/modelsrepository/package.json | 2 +- .../review/iot-modelsrepository-client.api.md | 2 +- .../review/iot-modelsrepository.api.md | 46 ++++++ .../samples/typescript/README.md | 6 +- .../samples/typescript/package.json | 8 +- sdk/iot/modelsrepository/src/dtmiResolver.ts | 23 +-- .../modelsrepository/src/fetcherAbstract.ts | 4 +- sdk/iot/modelsrepository/src/fetcherHTTP.ts | 53 ++++++- .../src/interfaces/getModelsOptions.ts | 3 +- .../modelsRepositoryClientOptions.ts | 4 +- .../src/modelsRepositoryClient.ts | 27 ++-- sdk/iot/modelsrepository/src/psuedoParser.ts | 26 +++- .../test/node/integration/index.spec.ts | 140 +++++++++--------- 15 files changed, 241 insertions(+), 117 deletions(-) create mode 100644 sdk/iot/modelsrepository/review/iot-modelsrepository.api.md diff --git a/rush.json b/rush.json index ceeb7465d2f9..2cce66e51933 100644 --- a/rush.json +++ b/rush.json @@ -648,7 +648,7 @@ "versionPolicyName": "client" }, { - "packageName": "@azure/iot-modelsrepository-client", + "packageName": "@azure/iot-modelsrepository", "projectFolder": "sdk/iot/modelsrepository", "versionPolicyName": "client" }, diff --git a/sdk/iot/modelsrepository/README.md b/sdk/iot/modelsrepository/README.md index b6c6fe119948..5e4df1127fbe 100644 --- a/sdk/iot/modelsrepository/README.md +++ b/sdk/iot/modelsrepository/README.md @@ -3,8 +3,8 @@ This package contains an isomorphic Client Library for Azure IoT Models Repository in Javascript. Use the Azure IoT Models Repository library for Javascript to pull DTDL files from remote endpoints. [Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository) | -[Package (npm)](https://www.npmjs.com/package/@azure/iot-modelsrepository-client/) | -[Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/iot-modelsrepository-client/samples) +[Package (npm)](https://www.npmjs.com/package/@azure/iot-modelsrepository/) | +[Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/iot-modelsrepository/samples) ------------------------------------- @@ -22,7 +22,7 @@ The Azure IoT Models Repository library for Javascript is written to interact wi The preferred way to install the Azure IoT Models Repository client library for JavaScript is to use the npm package manager. Type the following into a terminal window: ``` -npm install @azure/iot-modelsrepository-client +npm install @azure/iot-modelsrepository ``` ### How to use @@ -32,7 +32,7 @@ npm install @azure/iot-modelsrepository-client ##### Sample code ```ts -import { ModelsRepositoryClient } from "@azure/iot-modelsrepository-client"; +import { ModelsRepositoryClient } from "@azure/iot-modelsrepository"; const client = new ModelsRepositoryClient("https://devicemodels.azure.com"); const result = await client.getModels("dtmi:azure:DeviceManagement:DeviceInformation;1"); @@ -49,8 +49,8 @@ console.log(result); - @azure/iot-modelsrepository-client sample - + @azure/iot-modelsrepository sample + - - - - -``` - ----------------------------------------- # Troubleshooting @@ -86,7 +55,7 @@ console.log(result); # Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) # Contributing @@ -102,8 +71,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. - - -[azure_portal]: https://portal.azure.com -[npm]: https://www.npmjs.com/ -[iot_pnp_docs]: https://docs.microsoft.com/en-us/azure/iot-pnp/ diff --git a/sdk/iot/modelsrepository/samples/typescript/README.md b/sdk/iot/modelsrepository/samples/typescript/README.md index af5b8b8da0b0..64b0dc9506e3 100644 --- a/sdk/iot/modelsrepository/samples/typescript/README.md +++ b/sdk/iot/modelsrepository/samples/typescript/README.md @@ -14,7 +14,7 @@ urlFragment: template-typescript The Azure IoT Models Repository enables builders to manage and share digital twin models for global consumption. The models are [JSON-LD](https://json-ld.org/) documents defined using the Digital Twins Definition Language [(DTDL)](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md). -For more info about the Azure IoT Models Repository checkout the [docs](https://docs.microsoft.com/en-us/azure/iot-pnp/concepts-model-repository). +For more info about the Azure IoT Models Repository checkout the [docs](https://docs.microsoft.com/azure/iot-pnp/concepts-model-repository). | **File Name** | **Description** | @@ -63,7 +63,7 @@ If you need to override pipeline behavior, such as provide your own HttpClient i ## Publish Models -Publishing models to the models repository requires [exercising](https://docs.microsoft.com/en-us/azure/iot-pnp/concepts-model-repository#publish-a-model) common GitHub workflows. +Publishing models to the models repository requires [exercising](https://docs.microsoft.com/azure/iot-pnp/concepts-model-repository#publish-a-model) common GitHub workflows. ## Get Models From a393f91251598ad7f28cb57b845c03be52d4f9bc Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Mon, 17 May 2021 09:38:01 -0700 Subject: [PATCH 30/81] addressing comments --- sdk/iot/modelsrepository/src/fetcherAbstract.ts | 3 ++- .../modelsrepository/src/fetcherFilesystem.ts | 16 +++++++++++++--- .../src/modelsRepositoryServiceClient.ts | 3 ++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sdk/iot/modelsrepository/src/fetcherAbstract.ts b/sdk/iot/modelsrepository/src/fetcherAbstract.ts index f42e12698eee..ef0ba19cb473 100644 --- a/sdk/iot/modelsrepository/src/fetcherAbstract.ts +++ b/sdk/iot/modelsrepository/src/fetcherAbstract.ts @@ -2,7 +2,8 @@ // Licensed under the MIT license. import { OperationOptions } from "@azure/core-client"; +import { DTDL } from "./internal"; export abstract class Fetcher { - abstract fetch(path: string, options: OperationOptions): any; + abstract fetch(path: string, options: OperationOptions): Promise; } diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index 819e926fc15d..4b156561e24a 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -6,6 +6,15 @@ import * as path from "path"; import { Fetcher, DTDL, logger } from "./internal"; import {RestError, RestErrorOptions} from '@azure/core-rest-pipeline'; +function readFilePromise(path: string): Promise { + return new Promise((res, rej) => { + fs.readFile(path, "utf8", (err, data) => { + err ? rej(err) : res(data); + return 0; + }); + }); +} + export class FilesystemFetcher extends Fetcher { private _baseFilePath: string; @@ -14,14 +23,15 @@ export class FilesystemFetcher extends Fetcher { this._baseFilePath = baseFilePath; } - fetch(filePath: string) { + async fetch(filePath: string) { logger.info(`Fetching ${filePath} from local filesystem`); const absolutePath = path.join(this._baseFilePath, filePath); try { logger.info(`File open on ${absolutePath}`); - const dtdlFile = fs.readFileSync(absolutePath, "utf8"); - const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); + const parsedDtdl: DTDL | DTDL[] = await readFilePromise(absolutePath).then((dtdlFile) => { + return JSON.parse(dtdlFile); + }); return parsedDtdl; } catch (e) { // TODO: Is there a ResourceNotFound Error for Filesystem + Http (Generic API for errors) diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts index d8d6759a1f99..469f0716f436 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import { ServiceClientOptions, ServiceClient } from "@azure/core-client"; +import { DEFAULT_API_VERSION } from "./internal"; interface IoTModelsRepositoryServiceClientOptions extends ServiceClientOptions { version?: string; @@ -31,6 +32,6 @@ export class IoTModelsRepositoryServiceClient extends ServiceClient { super(optionsWithDefaults); this.url = url; - this.version = options.version || "2019-02-02"; + this.version = options.version || DEFAULT_API_VERSION; } } From 76ac761c6b633fc1352e6feb7dbe8b72529fdd0e Mon Sep 17 00:00:00 2001 From: Christopher Radek Date: Mon, 17 May 2021 14:02:13 -0700 Subject: [PATCH 31/81] split URL to node/browser versions and add brower mapping to package.json --- sdk/iot/modelsrepository/package.json | 3 +- .../src/modelsRepositoryClient.ts | 38 ++++++++++--------- .../modelsrepository/src/utils/url.browser.ts | 6 +++ sdk/iot/modelsrepository/src/utils/url.ts | 4 ++ 4 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 sdk/iot/modelsrepository/src/utils/url.browser.ts create mode 100644 sdk/iot/modelsrepository/src/utils/url.ts diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index f34c35b4872d..7ee1663b37e6 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -7,7 +7,8 @@ "module": "dist-esm/src/index.js", "browser": { "stream": "./node_modules/stream-browserify/index.js", - "./dist-esm/src/print.js": "./dist-esm/src/print.browser.js" + "./dist-esm/src/print.js": "./dist-esm/src/print.browser.js", + "./dist-esm/src/utils/url.js": "./dist-esm/src/utils/url.browser.js" }, "types": "types/iot-models-repository.d.ts", "scripts": { diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index 5c989bd5ca06..64796dc195e6 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { - GetModelsOptions, - IoTModelsRepositoryServiceClient, +import { + GetModelsOptions, + IoTModelsRepositoryServiceClient, ModelsRepositoryClientOptions, dependencyResolutionType, HttpFetcher, @@ -11,14 +11,14 @@ import { PseudoParser, DtmiResolver, logger, - DTDL, + DTDL } from "./internal"; -import * as cnst from './constants'; +import * as cnst from "./constants"; import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; -import { URL } from "url"; import * as path from "path"; import { Fetcher } from "./fetcherAbstract"; import { RestError } from "@azure/core-rest-pipeline"; +import { URL } from "./utils/url"; function isLocalPath(p: string): boolean { const myRegex = RegExp(/^(?:[a-zA-Z]\:|\\\\[\w\.]+\\[\w.$]+)\\(?:[\w]+\\)*\w([\w.])+$/g); @@ -55,7 +55,6 @@ export class ModelsRepositoryClient { this._apiVersion = options.apiVersion || cnst.DEFAULT_API_VERSION; } - /** * improves the readability of the constructor. * based on a boolean returns the proper dependency resolution setting string. @@ -69,7 +68,7 @@ export class ModelsRepositoryClient { } /** - * Though currently not relevant, can specify API Version for communicating with + * Though currently not relevant, can specify API Version for communicating with * the service. */ get apiVersion() { @@ -91,7 +90,7 @@ export class ModelsRepositoryClient { } /** - * Because of the local / remote optionality of this client, the service client + * Because of the local / remote optionality of this client, the service client * must be dynamically generated based on the repository location. If the provided * repository location is a remote location, then this private method will be used * to create the IoT Models Repository Service Client. @@ -167,21 +166,24 @@ export class ModelsRepositoryClient { * Retrieve one or more models based upon on or more provided dtmis. * @param {string} dtmis - one dtmi represented as a string * @param {GetModelsOptions} options - options to govern behavior of model getter. - * @returns {Promise<{ [dtmi: string]: unknown}>} + * @returns {Promise<{ [dtmi: string]: unknown}>} */ async getModels(dtmis: string, options?: GetModelsOptions): Promise<{ [dtmi: string]: unknown }>; - /** + /** * Retrieve one or more models based upon on or more provided dtmis. * @param {string[]} dtmis - dtmi strings in an array. * @param {GetModelsOptions} options - options to govern behavior of model getter. - * @returns {Promise<{ [dtmi: string]: unknown}>} + * @returns {Promise<{ [dtmi: string]: unknown}>} */ - async getModels(dtmis: string[], options?: GetModelsOptions): Promise<{ [dtmi: string]: unknown }>; + async getModels( + dtmis: string[], + options?: GetModelsOptions + ): Promise<{ [dtmi: string]: unknown }>; async getModels( dtmis: string | string[], options?: GetModelsOptions ): Promise<{ [dtmi: string]: unknown }> { - let modelMap: {[dtmi: string]: unknown}; + let modelMap: { [dtmi: string]: unknown }; if (!Array.isArray(dtmis)) { dtmis = [dtmis]; } @@ -196,7 +198,7 @@ export class ModelsRepositoryClient { logger.info(`Getting models w/ dependency resolution mode: enabled`); logger.info(`Retreiving model(s): ${dtmis}...`); const baseModelMap = await this._resolver.resolve(dtmis, false, options); - const baseModelList = Object.keys(baseModelMap).map((key) => baseModelMap[key]) + const baseModelList = Object.keys(baseModelMap).map((key) => baseModelMap[key]); logger.info(`Retreiving model dependencies for ${dtmis}...`); modelMap = await this._pseudoParser.expand(baseModelList, false); } else if (dependencyResolution === cnst.DEPENDENCY_MODE_TRY_FROM_EXPANDED) { @@ -206,10 +208,10 @@ export class ModelsRepositoryClient { modelMap = await this._resolver.resolve(dtmis, true, options); } catch (e) { if (e instanceof RestError) { - let baseModelMap: { [dtmi: string]: unknown; }; - logger.info("Could not retrieve model(s) from expanded model DTDL - ") + let baseModelMap: { [dtmi: string]: unknown }; + logger.info("Could not retrieve model(s) from expanded model DTDL - "); baseModelMap = await this._resolver.resolve(dtmis, false, options); - const baseModelList = Object.keys(baseModelMap).map((key) => baseModelMap[key]) + const baseModelList = Object.keys(baseModelMap).map((key) => baseModelMap[key]); logger.info(`Retreiving model dependencies for ${dtmis}...`); modelMap = await this._pseudoParser.expand(baseModelList as DTDL[], true); } else { diff --git a/sdk/iot/modelsrepository/src/utils/url.browser.ts b/sdk/iot/modelsrepository/src/utils/url.browser.ts new file mode 100644 index 000000000000..2b9e17d383bd --- /dev/null +++ b/sdk/iot/modelsrepository/src/utils/url.browser.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +const url = URL; + +export { url as URL }; diff --git a/sdk/iot/modelsrepository/src/utils/url.ts b/sdk/iot/modelsrepository/src/utils/url.ts new file mode 100644 index 000000000000..71fcc22b49c0 --- /dev/null +++ b/sdk/iot/modelsrepository/src/utils/url.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { URL } from "url"; From 513fb558771e6defb0b32e61d120dd8d94ae6e36 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Mon, 17 May 2021 14:18:44 -0700 Subject: [PATCH 32/81] fixes --- .../{src => }/CODE_STRUCTURE.md | 0 sdk/iot/modelsrepository/package.json | 33 +++++++++++++++--- sdk/iot/modelsrepository/sample.env | 6 ++++ .../samples-dev/dtmiConventionsSample.ts | 22 ++++++++++++ .../samples-dev/modelResolutionSample.ts | 34 +++++++++++++++++++ .../src/dependencyResolutionType.ts | 2 +- .../src/interfaces/getModelsOptions.ts | 2 +- sdk/iot/modelsrepository/tsconfig.json | 8 +++-- 8 files changed, 99 insertions(+), 8 deletions(-) rename sdk/iot/modelsrepository/{src => }/CODE_STRUCTURE.md (100%) create mode 100644 sdk/iot/modelsrepository/sample.env create mode 100644 sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts create mode 100644 sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts diff --git a/sdk/iot/modelsrepository/src/CODE_STRUCTURE.md b/sdk/iot/modelsrepository/CODE_STRUCTURE.md similarity index 100% rename from sdk/iot/modelsrepository/src/CODE_STRUCTURE.md rename to sdk/iot/modelsrepository/CODE_STRUCTURE.md diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index f34c35b4872d..f8824a7bd16e 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -14,14 +14,14 @@ "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1", "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", - "build:samples": "dev-tool samples prep && cd dist-samples && tsc -p .", + "build:samples": "echo Obsolete.", "build:test": "tsc -p . && rollup -c 2>&1", "build": "tsc -p . && rollup -c 2>&1 && api-extractor run --local", - "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", "clean": "rimraf dist dist-* test-dist temp types *.tgz *.log", - "execute:samples": "npm run build:samples && dev-tool samples run dist-samples/javascript dist-samples/typescript/dist/dist-samples/typescript/src/", + "execute:samples": "dev-tool samples run samples-dev", "extract-api": "tsc -p . && api-extractor run --local", - "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", "integration-test:browser": "karma start --single-run", "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}/*.spec.js\"", "integration-test": "npm run integration-test:node && npm run integration-test:browser", @@ -124,5 +124,30 @@ }, "//smokeTestConfiguration": { "skipFolder": true + }, + "//sampleConfiguration": { + // This should be the primary name of the Azure product, e.g. + // - Azure Text Analytics + // - Azure Storage Blob + // - Azure Key Vault + "productName": "Azure IoT Models Repository", + // These are the product slugs associated with your package in docs.microsoft.com + // Take these from the YAML frontmatter at the top of the existing sample READMEs + // for your package, from the `products` array. + // + // It is _very_ important that these product slugs are correct. Please check the + // documentation from docs.microsoft.com to ensure that they are. + "productSlugs": [ + "azure", + "azure-iot-modelsrepository" + ], + // These are the Azure resource instances that are required for a developer to run + // the sample programs. We express these as a map from resource name to a link that + // describes how to create the resource. The resource name is not necessarily the + // same as the product name. For example, Azure Text Analytics uses an "Azure + // Cognitive Services account". The resource name should be a noun (in other words, + // it should fit into the sentence "create a(n) ${resourceName}". + "requiredResources": { + } } } diff --git a/sdk/iot/modelsrepository/sample.env b/sdk/iot/modelsrepository/sample.env new file mode 100644 index 000000000000..a52d9eb45f3b --- /dev/null +++ b/sdk/iot/modelsrepository/sample.env @@ -0,0 +1,6 @@ +# Used in most samples. Retrieve these values from an instance in the Azure +# Portal. The APPCONFIG_TEST_SETTING_KEY value indicates which key to use +# when retrieving an example setting. + +APPCONFIG_ENDPOINT="https://.azconfig.io", +APPCONFIG_TEST_SETTING_KEY="" \ No newline at end of file diff --git a/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts b/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts new file mode 100644 index 000000000000..cf8ab718cf41 --- /dev/null +++ b/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +import {getModelUri, isValidDtmi} from "../../../src"; + +function main() { + + // returns true + isValidDtmi("dtmi:com:example:Thermostat;1"); + + // returns false + isValidDtmi("dtmi:com:example:Thermostat"); + + // local repository fully qualified path to a model file + const fullyQualifiedLocalPath = getModelUri("dtmi:com:example:Thermostat;1", "file:///path/to/repository/"); + console.log(fullyQualifiedLocalPath); + + const fullyQualifiedRemotePath = getModelUri("dtmi:com:example:Thermostat;1", "https://contoso.com/models"); + console.log(fullyQualifiedRemotePath); +} + +main(); \ No newline at end of file diff --git a/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts b/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts new file mode 100644 index 000000000000..aaaaacbb4ac9 --- /dev/null +++ b/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +/** + * @summary Demonstrates the use of a ConfigurationClient to retrieve a setting value. + */ + +import {ModelsRepositoryClient} from "../../../src"; + +const repositoryEndpoint = "devicemodels.azure.com"; +const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; + +console.log(repositoryEndpoint, dtmi); + +async function main() { + // When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint + // https://devicemodels.azure.com/ is used and the model dependency resolution + // configuration is set to TryFromExpanded. + const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); + const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); + Object.keys(result).forEach((fetchedDtmi) => { + console.log("------------------------------------------------"); + console.log(`DTMI is: ${fetchedDtmi}`); + console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`); + console.log(`DTDL Description is: ${result[fetchedDtmi].description}`); + console.log("------------------------------------------------"); + console.log(JSON.stringify(result[fetchedDtmi])); + console.log("------------------------------------------------"); + }); +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts index c19a92b4bd56..91e13228212e 100644 --- a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts +++ b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts @@ -10,4 +10,4 @@ * or it is set to tryFromExpanded, where the client will attempt to get the expanded JSON format from the endpoint, * and in the event of failure will fallback on the standard enabled dependency resolution. */ -export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded" | undefined; +export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded"; diff --git a/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts b/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts index d2e5cf47f57c..c2dafb639b4c 100644 --- a/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts +++ b/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts @@ -13,5 +13,5 @@ export interface GetModelsOptions extends OperationOptions { * resolution, resolution using the expanded json format) that will be used when retrieving * models. This overwrites the default dependencyResolution settings of the client. */ - dependencyResolution: dependencyResolutionType; + dependencyResolution?: dependencyResolutionType; } diff --git a/sdk/iot/modelsrepository/tsconfig.json b/sdk/iot/modelsrepository/tsconfig.json index 38b8848efa2c..1f094dd94651 100644 --- a/sdk/iot/modelsrepository/tsconfig.json +++ b/sdk/iot/modelsrepository/tsconfig.json @@ -3,10 +3,14 @@ "compilerOptions": { "outDir": "./dist-esm", "declarationDir": "./types", - "lib": ["dom", "esnext"] + "lib": ["dom", "esnext"], + "paths": { + "iot-modelsrepository": ["./src/index"] + } }, "include": [ "src/**/*.ts", - "test/**/*.ts" + "test/**/*.ts", + "samples-dev/**/*.ts" ] } From cc50153d2eed9205809d335058ba87d195de95dd Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 09:06:01 -0700 Subject: [PATCH 33/81] updating samples and tests --- .../typescript/README.md => HOW_TO_USE.md} | 3 +- sdk/iot/modelsrepository/package.json | 17 ----- .../review/iot-modelsrepository.api.md | 4 +- .../samples-dev/dtmiConventionsSample.ts | 15 +++- .../samples-dev/modelResolutionSample.ts | 13 ++-- .../javascript/modelResolutionSample.js | 39 ---------- .../samples/typescript/tsconfig.json | 10 --- .../samples/v0/javascript/README.md | 62 +++++++++++++++ .../v0/javascript/dtmiConventionsSample.js | 34 +++++++++ .../v0/javascript/modelResolutionSample.js | 35 +++++++++ .../samples/{ => v0}/javascript/package.json | 23 +++--- .../samples/v0/javascript/sample.env | 6 ++ .../samples/v0/typescript/README.md | 75 +++++++++++++++++++ .../samples/{ => v0}/typescript/package.json | 28 +++---- .../samples/v0/typescript/sample.env | 6 ++ .../typescript/src/dtmiConventionsSample.ts | 15 +++- .../typescript/src/modelResolutionSample.ts | 15 ++-- .../samples/v0/typescript/tsconfig.json | 17 +++++ .../src/modelsRepositoryServiceClient.ts | 4 +- sdk/iot/modelsrepository/tsconfig.json | 2 +- 20 files changed, 305 insertions(+), 118 deletions(-) rename sdk/iot/modelsrepository/{samples/typescript/README.md => HOW_TO_USE.md} (96%) delete mode 100644 sdk/iot/modelsrepository/samples/javascript/modelResolutionSample.js delete mode 100644 sdk/iot/modelsrepository/samples/typescript/tsconfig.json create mode 100644 sdk/iot/modelsrepository/samples/v0/javascript/README.md create mode 100644 sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js create mode 100644 sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js rename sdk/iot/modelsrepository/samples/{ => v0}/javascript/package.json (51%) create mode 100644 sdk/iot/modelsrepository/samples/v0/javascript/sample.env create mode 100644 sdk/iot/modelsrepository/samples/v0/typescript/README.md rename sdk/iot/modelsrepository/samples/{ => v0}/typescript/package.json (56%) create mode 100644 sdk/iot/modelsrepository/samples/v0/typescript/sample.env rename sdk/iot/modelsrepository/samples/{ => v0}/typescript/src/dtmiConventionsSample.ts (52%) rename sdk/iot/modelsrepository/samples/{ => v0}/typescript/src/modelResolutionSample.ts (66%) create mode 100644 sdk/iot/modelsrepository/samples/v0/typescript/tsconfig.json diff --git a/sdk/iot/modelsrepository/samples/typescript/README.md b/sdk/iot/modelsrepository/HOW_TO_USE.md similarity index 96% rename from sdk/iot/modelsrepository/samples/typescript/README.md rename to sdk/iot/modelsrepository/HOW_TO_USE.md index 64b0dc9506e3..62fb6c097a45 100644 --- a/sdk/iot/modelsrepository/samples/typescript/README.md +++ b/sdk/iot/modelsrepository/HOW_TO_USE.md @@ -19,7 +19,8 @@ For more info about the Azure IoT Models Repository checkout the [docs](https:// | **File Name** | **Description** | | ----------------------------------- | --------------- | -| [remoteExample.ts][remoteexample] | sample template | +| [modelResolutionSample.ts](./samples/v0/typescript/src/modelResolutionSample.ts) | sample model getting | +| [dtmiConventionsSample.ts](./samples/v0/typescript/src/dtmiConventionsSample.ts) | sample using dtmi conventions helpers | ## Introduction diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index c7dc04c5f8a5..3a6af18f4747 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -88,7 +88,6 @@ "@types/sinon": "^9.0.4", "chai": "^4.2.0", "cross-env": "^7.0.2", - "dotenv": "^8.2.0", "eslint": "^7.15.0", "inherits": "^2.0.3", "karma": "^6.2.0", @@ -127,27 +126,11 @@ "skipFolder": true }, "//sampleConfiguration": { - // This should be the primary name of the Azure product, e.g. - // - Azure Text Analytics - // - Azure Storage Blob - // - Azure Key Vault "productName": "Azure IoT Models Repository", - // These are the product slugs associated with your package in docs.microsoft.com - // Take these from the YAML frontmatter at the top of the existing sample READMEs - // for your package, from the `products` array. - // - // It is _very_ important that these product slugs are correct. Please check the - // documentation from docs.microsoft.com to ensure that they are. "productSlugs": [ "azure", "azure-iot-modelsrepository" ], - // These are the Azure resource instances that are required for a developer to run - // the sample programs. We express these as a map from resource name to a link that - // describes how to create the resource. The resource name is not necessarily the - // same as the product name. For example, Azure Text Analytics uses an "Azure - // Cognitive Services account". The resource name should be a noun (in other words, - // it should fit into the sentence "create a(n) ${resourceName}". "requiredResources": { } } diff --git a/sdk/iot/modelsrepository/review/iot-modelsrepository.api.md b/sdk/iot/modelsrepository/review/iot-modelsrepository.api.md index 7bcc5b33fce3..606cdb4383eb 100644 --- a/sdk/iot/modelsrepository/review/iot-modelsrepository.api.md +++ b/sdk/iot/modelsrepository/review/iot-modelsrepository.api.md @@ -8,11 +8,11 @@ import { CommonClientOptions } from '@azure/core-client'; import { OperationOptions } from '@azure/core-client'; // @public -export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded" | undefined; +export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded"; // @public export interface GetModelsOptions extends OperationOptions { - dependencyResolution: dependencyResolutionType; + dependencyResolution?: dependencyResolutionType; } // @public diff --git a/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts b/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts index cf8ab718cf41..eb8f758f70c5 100644 --- a/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts +++ b/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts @@ -1,16 +1,23 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import {getModelUri, isValidDtmi} from "../../../src"; +/** + * @summary Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. + */ + +import {getModelUri, isValidDtmi} from "@azure/iot-modelsrepository"; function main() { + const dtmi1 = "dtmi:com:example:Thermostat;1"; + const dtmi2 = "dtmi:com:example:Thermostat" // returns true - isValidDtmi("dtmi:com:example:Thermostat;1"); + const result1 = isValidDtmi(dtmi1); + console.log(`${dtmi1} is valid? ${result1}`); // returns false - isValidDtmi("dtmi:com:example:Thermostat"); - + const result2 = isValidDtmi(dtmi2); + console.log(`${dtmi2} is valid? ${result2}`); // local repository fully qualified path to a model file const fullyQualifiedLocalPath = getModelUri("dtmi:com:example:Thermostat;1", "file:///path/to/repository/"); console.log(fullyQualifiedLocalPath); diff --git a/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts b/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts index aaaaacbb4ac9..cfd211aebcba 100644 --- a/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts +++ b/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts @@ -2,13 +2,13 @@ // Licensed under the MIT license. /** - * @summary Demonstrates the use of a ConfigurationClient to retrieve a setting value. + * @summary Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. */ -import {ModelsRepositoryClient} from "../../../src"; +import {ModelsRepositoryClient} from "@azure/iot-modelsrepository"; -const repositoryEndpoint = "devicemodels.azure.com"; -const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; +const repositoryEndpoint = "http://www.devicemodels.azure.com"; +const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; console.log(repositoryEndpoint, dtmi); @@ -19,10 +19,11 @@ async function main() { const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); Object.keys(result).forEach((fetchedDtmi) => { + const currentDtdl = result[fetchedDtmi] as any; console.log("------------------------------------------------"); console.log(`DTMI is: ${fetchedDtmi}`); - console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`); - console.log(`DTDL Description is: ${result[fetchedDtmi].description}`); + console.log(`DTDL Display Name is: ${currentDtdl.displayName}`); + console.log(`DTDL Description is: ${currentDtdl.description}`); console.log("------------------------------------------------"); console.log(JSON.stringify(result[fetchedDtmi])); console.log("------------------------------------------------"); diff --git a/sdk/iot/modelsrepository/samples/javascript/modelResolutionSample.js b/sdk/iot/modelsrepository/samples/javascript/modelResolutionSample.js deleted file mode 100644 index 2326292e44cc..000000000000 --- a/sdk/iot/modelsrepository/samples/javascript/modelResolutionSample.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -/** - * Demonstrates resolving/obtaining a particular model definition from a remote model repository - */ - -const lib = require("../../dist/index.js"); - -const logger = require('@azure/logger'); -logger.setLogLevel('info'); - - -// You can change the endpoint and dtmi you'd like to access -const repositoryLocation = "https://devicemodels.azure.com/"; -// const repositoryLocation = process.argv[2] || "C:/"; -const dtmi = process.argv[2] || "dtmi:com:example:TemperatureController;1"; - -console.log(repositoryLocation, dtmi); - -async function main() { - // This is where you can change the options for how you want to resolve the dependencies. - const client = new lib.ModelsRepositoryClient({repositoryLocation: repositoryLocation, dependencyResolution: 'enabled'}); - const result = await client.getModels(dtmi); - console.log(result); - Object.keys(result).forEach((fetchedDtmi) => { - console.log("------------------------------------------------"); - console.log(`DTMI is: ${fetchedDtmi}`); - console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`); - console.log(`DTDL Description is: ${result[fetchedDtmi].description}`); - console.log("------------------------------------------------"); - console.log(JSON.stringify(result[fetchedDtmi])); - console.log("------------------------------------------------"); - }); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/iot/modelsrepository/samples/typescript/tsconfig.json b/sdk/iot/modelsrepository/samples/typescript/tsconfig.json deleted file mode 100644 index 51166aa39cf8..000000000000 --- a/sdk/iot/modelsrepository/samples/typescript/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "module": "commonjs", - "outDir": "typescript/dist" - }, - "include": [ - "typescript/src/**.ts" - ] -} diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/README.md b/sdk/iot/modelsrepository/samples/v0/javascript/README.md new file mode 100644 index 000000000000..f0bb1f5fd5bf --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v0/javascript/README.md @@ -0,0 +1,62 @@ +--- +page_type: sample +languages: + - javascript +products: + - azure + - azure-iot-modelsrepository +urlFragment: iot-modelsrepository-javascript +--- + +# Azure IoT Models Repository client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for Azure IoT Models Repository in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| [dtmiConventionsSample.js][dtmiconventionssample] | Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. | +| [modelResolutionSample.js][modelresolutionsample] | Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. | + +## Prerequisites + +The sample programs are compatible with Node.js >=12.0.0. + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dtmiConventionsSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dtmiConventionsSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[dtmiconventionssample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js +[modelresolutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/iot-modelsrepository +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository/README.md diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js b/sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js new file mode 100644 index 000000000000..55a3042a9411 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +/** + * @summary Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. + */ + +const { getModelUri, isValidDtmi } = require("@azure/iot-modelsrepository"); + +function main() { + const dtmi1 = "dtmi:com:example:Thermostat;1"; + const dtmi2 = "dtmi:com:example:Thermostat"; + // returns true + const result1 = isValidDtmi(dtmi1); + console.log(`${dtmi1} is valid? ${result1}`); + + // returns false + const result2 = isValidDtmi(dtmi2); + console.log(`${dtmi2} is valid? ${result2}`); + // local repository fully qualified path to a model file + const fullyQualifiedLocalPath = getModelUri( + "dtmi:com:example:Thermostat;1", + "file:///path/to/repository/" + ); + console.log(fullyQualifiedLocalPath); + + const fullyQualifiedRemotePath = getModelUri( + "dtmi:com:example:Thermostat;1", + "https://contoso.com/models" + ); + console.log(fullyQualifiedRemotePath); +} + +main(); diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js b/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js new file mode 100644 index 000000000000..6d85e8e79039 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +/** + * @summary Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. + */ + +const { ModelsRepositoryClient } = require("@azure/iot-modelsrepository"); + +const repositoryEndpoint = "http://www.devicemodels.azure.com"; +const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + +console.log(repositoryEndpoint, dtmi); + +async function main() { + // When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint + // https://devicemodels.azure.com/ is used and the model dependency resolution + // configuration is set to TryFromExpanded. + const client = new ModelsRepositoryClient({ repositoryLocation: repositoryEndpoint }); + const result = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" }); + Object.keys(result).forEach((fetchedDtmi) => { + const currentDtdl = result[fetchedDtmi]; + console.log("------------------------------------------------"); + console.log(`DTMI is: ${fetchedDtmi}`); + console.log(`DTDL Display Name is: ${currentDtdl.displayName}`); + console.log(`DTDL Description is: ${currentDtdl.description}`); + console.log("------------------------------------------------"); + console.log(JSON.stringify(result[fetchedDtmi])); + console.log("------------------------------------------------"); + }); +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/iot/modelsrepository/samples/javascript/package.json b/sdk/iot/modelsrepository/samples/v0/javascript/package.json similarity index 51% rename from sdk/iot/modelsrepository/samples/javascript/package.json rename to sdk/iot/modelsrepository/samples/v0/javascript/package.json index 606ae70d2a9e..67d9a8f24ade 100644 --- a/sdk/iot/modelsrepository/samples/javascript/package.json +++ b/sdk/iot/modelsrepository/samples/v0/javascript/package.json @@ -1,30 +1,29 @@ { - "name": "azure-modelsrepository-samples-js", + "name": "azure-iot-modelsrepository-samples-js", "private": true, - "version": "0.1.0", - "description": "Azure models repository client library samples for JavaScript", + "version": "1.0.0", + "description": "Azure IoT Models Repository client library samples for JavaScript", "engine": { - "node": ">=8.0.0" + "node": ">=12.0.0" }, "repository": { "type": "git", "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/template/template" + "directory": "sdk/iot/modelsrepository" }, "keywords": [ - "Azure", - "Node.js", - "JavaScript" + "azure", + "cloud", + "typescript" ], "author": "Microsoft Corporation", "license": "MIT", "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/template/template", - "sideEffects": false, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository", "dependencies": { - "@azure/template": "latest", - "dotenv": "^8.2.0" + "@azure/iot-modelsrepository": "latest", + "dotenv": "latest" } } diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/sample.env b/sdk/iot/modelsrepository/samples/v0/javascript/sample.env new file mode 100644 index 000000000000..a52d9eb45f3b --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v0/javascript/sample.env @@ -0,0 +1,6 @@ +# Used in most samples. Retrieve these values from an instance in the Azure +# Portal. The APPCONFIG_TEST_SETTING_KEY value indicates which key to use +# when retrieving an example setting. + +APPCONFIG_ENDPOINT="https://.azconfig.io", +APPCONFIG_TEST_SETTING_KEY="" \ No newline at end of file diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/README.md b/sdk/iot/modelsrepository/samples/v0/typescript/README.md new file mode 100644 index 000000000000..33e98ae2ddff --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v0/typescript/README.md @@ -0,0 +1,75 @@ +--- +page_type: sample +languages: + - typescript +products: + - azure + - azure-iot-modelsrepository +urlFragment: iot-modelsrepository-typescript +--- + +# Azure IoT Models Repository client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for Azure IoT Models Repository in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| [dtmiConventionsSample.ts][dtmiconventionssample] | Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. | +| [modelResolutionSample.ts][modelresolutionsample] | Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. | + +## Prerequisites + +The sample programs are compatible with Node.js >=12.0.0. + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/dtmiConventionsSample.ts +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/dtmiConventionsSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[dtmiconventionssample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts +[modelresolutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/iot-modelsrepository +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/iot/modelsrepository/samples/typescript/package.json b/sdk/iot/modelsrepository/samples/v0/typescript/package.json similarity index 56% rename from sdk/iot/modelsrepository/samples/typescript/package.json rename to sdk/iot/modelsrepository/samples/v0/typescript/package.json index a9637aca7df5..e417a9dca48f 100644 --- a/sdk/iot/modelsrepository/samples/typescript/package.json +++ b/sdk/iot/modelsrepository/samples/v0/typescript/package.json @@ -1,10 +1,10 @@ { - "name": "azure-iot-modelsrepository-samples", + "name": "azure-iot-modelsrepository-samples-ts", "private": true, - "version": "0.1.0", - "description": "Azure iot models repository client library samples for TypeScript", + "version": "1.0.0", + "description": "Azure IoT Models Repository client library samples for TypeScript", "engine": { - "node": ">=8.0.0" + "node": ">=12.0.0" }, "scripts": { "build": "tsc", @@ -16,9 +16,9 @@ "directory": "sdk/iot/modelsrepository" }, "keywords": [ - "Azure", - "Node.js", - "TypeScript" + "azure", + "cloud", + "typescript" ], "author": "Microsoft Corporation", "license": "MIT", @@ -26,16 +26,12 @@ "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository", - "sideEffects": false, - "peerDependencies": { - "@azure/iot-modelsrepository": "latest" + "dependencies": { + "@azure/iot-modelsrepository": "latest", + "dotenv": "latest" }, "devDependencies": { - "@types/node": "^14.0.0", - "rimraf": "^3.0.0", - "typescript": "~3.6.4" - }, - "dependencies": { - "@azure/iot-modelsrepository": "file:azure-iot-modelsrepository-0.0.1.tgz" + "typescript": "~4.2.0", + "rimraf": "latest" } } diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/sample.env b/sdk/iot/modelsrepository/samples/v0/typescript/sample.env new file mode 100644 index 000000000000..a52d9eb45f3b --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v0/typescript/sample.env @@ -0,0 +1,6 @@ +# Used in most samples. Retrieve these values from an instance in the Azure +# Portal. The APPCONFIG_TEST_SETTING_KEY value indicates which key to use +# when retrieving an example setting. + +APPCONFIG_ENDPOINT="https://.azconfig.io", +APPCONFIG_TEST_SETTING_KEY="" \ No newline at end of file diff --git a/sdk/iot/modelsrepository/samples/typescript/src/dtmiConventionsSample.ts b/sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts similarity index 52% rename from sdk/iot/modelsrepository/samples/typescript/src/dtmiConventionsSample.ts rename to sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts index cf8ab718cf41..eb8f758f70c5 100644 --- a/sdk/iot/modelsrepository/samples/typescript/src/dtmiConventionsSample.ts +++ b/sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts @@ -1,16 +1,23 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import {getModelUri, isValidDtmi} from "../../../src"; +/** + * @summary Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. + */ + +import {getModelUri, isValidDtmi} from "@azure/iot-modelsrepository"; function main() { + const dtmi1 = "dtmi:com:example:Thermostat;1"; + const dtmi2 = "dtmi:com:example:Thermostat" // returns true - isValidDtmi("dtmi:com:example:Thermostat;1"); + const result1 = isValidDtmi(dtmi1); + console.log(`${dtmi1} is valid? ${result1}`); // returns false - isValidDtmi("dtmi:com:example:Thermostat"); - + const result2 = isValidDtmi(dtmi2); + console.log(`${dtmi2} is valid? ${result2}`); // local repository fully qualified path to a model file const fullyQualifiedLocalPath = getModelUri("dtmi:com:example:Thermostat;1", "file:///path/to/repository/"); console.log(fullyQualifiedLocalPath); diff --git a/sdk/iot/modelsrepository/samples/typescript/src/modelResolutionSample.ts b/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts similarity index 66% rename from sdk/iot/modelsrepository/samples/typescript/src/modelResolutionSample.ts rename to sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts index 7aa82d5a82f8..cfd211aebcba 100644 --- a/sdk/iot/modelsrepository/samples/typescript/src/modelResolutionSample.ts +++ b/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts @@ -1,10 +1,14 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import {ModelsRepositoryClient} from "../../../src"; +/** + * @summary Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. + */ -const repositoryEndpoint = "devicemodels.azure.com"; -const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; +import {ModelsRepositoryClient} from "@azure/iot-modelsrepository"; + +const repositoryEndpoint = "http://www.devicemodels.azure.com"; +const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; console.log(repositoryEndpoint, dtmi); @@ -15,10 +19,11 @@ async function main() { const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); Object.keys(result).forEach((fetchedDtmi) => { + const currentDtdl = result[fetchedDtmi] as any; console.log("------------------------------------------------"); console.log(`DTMI is: ${fetchedDtmi}`); - console.log(`DTDL Display Name is: ${result[fetchedDtmi].displayName}`); - console.log(`DTDL Description is: ${result[fetchedDtmi].description}`); + console.log(`DTDL Display Name is: ${currentDtdl.displayName}`); + console.log(`DTDL Description is: ${currentDtdl.description}`); console.log("------------------------------------------------"); console.log(JSON.stringify(result[fetchedDtmi])); console.log("------------------------------------------------"); diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/tsconfig.json b/sdk/iot/modelsrepository/samples/v0/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v0/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts index 469f0716f436..07e9104d1965 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts @@ -7,6 +7,7 @@ import { DEFAULT_API_VERSION } from "./internal"; interface IoTModelsRepositoryServiceClientOptions extends ServiceClientOptions { version?: string; endpoint?: string; + allowInsecureConnection?: boolean } export class IoTModelsRepositoryServiceClient extends ServiceClient { @@ -21,7 +22,8 @@ export class IoTModelsRepositoryServiceClient extends ServiceClient { constructor(url: string, options: IoTModelsRepositoryServiceClientOptions = {}) { const defaults: IoTModelsRepositoryServiceClientOptions = { baseUri: `${url}`, - requestContentType: "application/json; charset=utf-8" + requestContentType: "application/json; charset=utf-8", + allowInsecureConnection: true }; const optionsWithDefaults = { diff --git a/sdk/iot/modelsrepository/tsconfig.json b/sdk/iot/modelsrepository/tsconfig.json index 1f094dd94651..ac55095a4d66 100644 --- a/sdk/iot/modelsrepository/tsconfig.json +++ b/sdk/iot/modelsrepository/tsconfig.json @@ -5,7 +5,7 @@ "declarationDir": "./types", "lib": ["dom", "esnext"], "paths": { - "iot-modelsrepository": ["./src/index"] + "@azure/iot-modelsrepository": ["./src/index"] } }, "include": [ From aa8f0cd9c23dbd483043af3c3f7b7d68663023dc Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 09:38:35 -0700 Subject: [PATCH 34/81] update pnpm --- common/config/rush/pnpm-lock.yaml | 562 +++++++++++++++++++++++++----- 1 file changed, 482 insertions(+), 80 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 659fdc4e31a2..fbbcee2c0b8f 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -12,6 +12,7 @@ dependencies: '@rush-temp/communication-identity': file:projects/communication-identity.tgz '@rush-temp/communication-phone-numbers': file:projects/communication-phone-numbers.tgz '@rush-temp/communication-sms': file:projects/communication-sms.tgz + '@rush-temp/confidential-ledger': file:projects/confidential-ledger.tgz '@rush-temp/container-registry': file:projects/container-registry.tgz '@rush-temp/core-amqp': file:projects/core-amqp.tgz '@rush-temp/core-asynciterator-polyfill': file:projects/core-asynciterator-polyfill.tgz @@ -50,6 +51,7 @@ dependencies: '@rush-temp/perf-ai-form-recognizer': file:projects/perf-ai-form-recognizer.tgz '@rush-temp/perf-ai-metrics-advisor': file:projects/perf-ai-metrics-advisor.tgz '@rush-temp/perf-ai-text-analytics': file:projects/perf-ai-text-analytics.tgz + '@rush-temp/perf-core-rest-pipeline': file:projects/perf-core-rest-pipeline.tgz '@rush-temp/perf-eventgrid': file:projects/perf-eventgrid.tgz '@rush-temp/perf-identity': file:projects/perf-identity.tgz '@rush-temp/perf-keyvault-certificates': file:projects/perf-keyvault-certificates.tgz @@ -59,6 +61,8 @@ dependencies: '@rush-temp/perf-storage-blob': file:projects/perf-storage-blob.tgz '@rush-temp/perf-storage-file-datalake': file:projects/perf-storage-file-datalake.tgz '@rush-temp/perf-storage-file-share': file:projects/perf-storage-file-share.tgz + '@rush-temp/purview-catalog': file:projects/purview-catalog.tgz + '@rush-temp/purview-scanning': file:projects/purview-scanning.tgz '@rush-temp/quantum-jobs': file:projects/quantum-jobs.tgz '@rush-temp/schema-registry': file:projects/schema-registry.tgz '@rush-temp/schema-registry-avro': file:projects/schema-registry-avro.tgz @@ -76,9 +80,11 @@ dependencies: '@rush-temp/synapse-monitoring': file:projects/synapse-monitoring.tgz '@rush-temp/synapse-spark': file:projects/synapse-spark.tgz '@rush-temp/template': file:projects/template.tgz - '@rush-temp/test-utils-multi-version': file:projects/test-utils-multi-version.tgz + '@rush-temp/test-utils': file:projects/test-utils.tgz '@rush-temp/test-utils-perfstress': file:projects/test-utils-perfstress.tgz '@rush-temp/test-utils-recorder': file:projects/test-utils-recorder.tgz + '@rush-temp/web-pubsub': file:projects/web-pubsub.tgz + '@rush-temp/web-pubsub-express': file:projects/web-pubsub-express.tgz lockfileVersion: 5.2 packages: /@azure/abort-controller/1.0.4: @@ -89,6 +95,20 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-lNUmDRVGpanCsiUN3NWxFTdwmdFI53xwhkTFfHDGTYk46ca7Ind3nanJc+U6Zj9Tv+9nTCWRBscWEW1DyKOpTw== + /@azure/ai-form-recognizer/3.1.0-beta.3: + dependencies: + '@azure/core-auth': 1.3.0 + '@azure/core-http': 1.2.4 + '@azure/core-lro': 1.0.4 + '@azure/core-paging': 1.1.3 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/logger': 1.0.2 + tslib: 2.2.0 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-+4QtFKNyxAmdqpcYjuAtmWKm/MuOe9kZsbpS9jA9h0YHzngNj5gc67AA4egV9BXOq9x+1phjYTNC/rxiOUr1uQ== /@azure/ai-metrics-advisor/1.0.0-beta.3: dependencies: '@azure/core-auth': 1.3.0 @@ -133,7 +153,7 @@ packages: dev: false resolution: integrity: sha512-8v+3YtATbaFv5qMGvhFVR+qx1QPc1+NBy2MWWoJ69SmEE1X91ySvXDbEa0Pr7znm/bqbBYWOLJN5L3Aa7Q0fpg== - /@azure/communication-signaling/1.0.0-beta.3: + /@azure/communication-signaling/1.0.0-beta.5: dependencies: '@azure/core-http': 1.2.4 '@azure/core-tracing': 1.0.0-preview.9 @@ -145,7 +165,7 @@ packages: engines: node: '>=8.0.0' resolution: - integrity: sha512-WargzA8PMc9SEvQpjhM0vVq/HB0wGUScplW8Us9nEFLHy/ZvgVjbRHlCALCa/tlU/Pv3RgZhk7XuPfwip17MCQ== + integrity: sha512-pGXI4F5OVzdM9Omg5fiflA/Vvs88qqER/ZxNj3PoWAdaYIPkWGb86OClbB0VsHi6gZ4ZDzyTP/l9hrREBuBYRA== /@azure/core-amqp/2.2.0: dependencies: '@azure/abort-controller': 1.0.4 @@ -222,6 +242,48 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-his7Ah40ThEYORSpIAwuh6B8wkGwO/zG7gqVtmSE4WAJ46e36zUDXTKReUCLBDc6HmjjApQQxxcRFy5FruG79A== + /@azure/core-rest-pipeline/1.0.3: + dependencies: + '@azure/abort-controller': 1.0.4 + '@azure/core-auth': 1.3.0 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/logger': 1.0.2 + form-data: 3.0.1 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.0 + tslib: 2.2.0 + uuid: 8.3.2 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-GbfBQHF83RQI+LVISh8RLKpPeyufFsu6FhwB0U1inN7BWo8GuE23s0vc/D4gd5AWww7orQ20Q3zMzW5FKFs4MQ== + /@azure/core-rest-pipeline/1.1.0-beta.1: + dependencies: + '@azure/abort-controller': 1.0.4 + '@azure/core-auth': 1.3.0 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/logger': 1.0.2 + form-data: 3.0.1 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.0 + tslib: 2.2.0 + uuid: 8.3.2 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-yHRf2h6n6pPidMOdFOdmm2a2O+xRCk9inEtx21+78tSNyVhc1C83seT7WpuE1J6YDmN3MDklAJtA/4n9WvB4Lw== + /@azure/core-tracing/1.0.0-preview.10: + dependencies: + '@opencensus/web-types': 0.0.7 + '@opentelemetry/api': 0.10.2 + tslib: 2.2.0 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-iIwjtMwQnsxB7cYkugMx+s4W1nfy3+pT/ceo+uW1fv4YDgYe84nh+QP0fEC9IH/3UATLSWbIBemdMHzk2APUrw== /@azure/core-tracing/1.0.0-preview.11: dependencies: '@opencensus/web-types': 0.0.7 @@ -313,6 +375,28 @@ packages: debug: '*' resolution: integrity: sha512-qYTaWA+5ir4+/iEry7n3l1TyeNhTHP8IRpjsbNv8ur8W/QjqZmCz1H2naebRp5tQmehXfo1pUrp2ew+qGhTh0g== + /@azure/identity/2.0.0-beta.3: + dependencies: + '@azure/abort-controller': 1.0.4 + '@azure/core-http': 1.2.4 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/logger': 1.0.2 + '@azure/msal-browser': 2.9.0 + '@azure/msal-common': 4.0.3 + '@azure/msal-node': 1.0.2 + '@types/stoppable': 1.1.0 + events: 3.3.0 + jws: 4.0.0 + open: 7.4.2 + qs: 6.10.1 + stoppable: 1.1.0 + tslib: 2.2.0 + uuid: 8.3.2 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-eOHstXRBRntoqBLi3bugYBEHpYkm0JiET6y5+P1fz7dqYRFN6hJW8qMJQtYIzIbpXJfRJTJdoiOS5fDQhsez0A== /@azure/logger-js/1.3.2: dependencies: tslib: 1.14.1 @@ -502,6 +586,22 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-x3VgZFLsmhnTka6IpKePHcibm3znMhcrSsVoVlMOCQSgoJrTSTuczRh4S9/c55pj8M+EQ6FdPweQY6Ld+g/qiQ== + /@azure/storage-blob/12.5.0: + dependencies: + '@azure/abort-controller': 1.0.4 + '@azure/core-http': 1.2.4 + '@azure/core-lro': 1.0.4 + '@azure/core-paging': 1.1.3 + '@azure/core-tracing': 1.0.0-preview.10 + '@azure/logger': 1.0.2 + '@opentelemetry/api': 0.10.2 + events: 3.3.0 + tslib: 2.2.0 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-DgoefgODst2IPkkQsNdhtYdyJgSsAZC1pEujO6aD5y7uFy5GnzhYliobSrp204jYRyK5XeJ9iiePmy/SPtTbLA== /@babel/code-frame/7.12.11: dependencies: '@babel/highlight': 7.13.10 @@ -1173,6 +1273,12 @@ packages: dev: false resolution: integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + /@types/jsonwebtoken/8.5.1: + dependencies: + '@types/node': 14.14.37 + dev: false + resolution: + integrity: sha512-rNAPdomlIUX0i0cg2+I+Q1wOUr531zHBQ+cV/28PJ39bSPKjahatZZ2LMuhiguETkCgLVzfruw/ZvNMNkKoSzw== /@types/jsrsasign/8.0.10: dev: false resolution: @@ -2051,16 +2157,16 @@ packages: node: '>=4' resolution: integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - /chalk/3.0.0: + /chalk/4.1.0: dependencies: ansi-styles: 4.3.0 supports-color: 7.2.0 dev: false engines: - node: '>=8' + node: '>=10' resolution: - integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== - /chalk/4.1.0: + integrity: sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + /chalk/4.1.1: dependencies: ansi-styles: 4.3.0 supports-color: 7.2.0 @@ -2068,7 +2174,7 @@ packages: engines: node: '>=10' resolution: - integrity: sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + integrity: sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg== /charenc/0.0.2: dev: false resolution: @@ -2139,6 +2245,13 @@ packages: dev: false resolution: integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + /cloudevents/4.0.2: + dependencies: + ajv: 6.12.6 + uuid: 8.3.2 + dev: false + resolution: + integrity: sha512-tIgdbZApPVT81PAOhmUcq8INkppmWeAsMAjp2EFmMoYc7Uez1B62m6AddxG9oVIUXyALWdATtzEeaSMhC83c/g== /code-point-at/1.1.0: dev: false engines: @@ -2919,7 +3032,7 @@ packages: '@babel/code-frame': 7.12.11 '@eslint/eslintrc': 0.4.0 ajv: 6.12.6 - chalk: 4.1.0 + chalk: 4.1.1 cross-spawn: 7.0.3 debug: 4.3.1 doctrine: 3.0.0 @@ -7814,6 +7927,7 @@ packages: version: 0.0.0 file:projects/ai-document-translator.tgz: dependencies: + '@azure/core-rest-pipeline': 1.0.3 '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.13.2 '@types/chai': 4.2.16 @@ -7850,13 +7964,13 @@ packages: dev: false name: '@rush-temp/ai-document-translator' resolution: - integrity: sha512-dKk6kAyDxOTFMIn74Biij9flT5ae7+6AWKzuI9N5yJNEPWzXGHUndSYjFSt7O5/UsLClgfelyiqY0dAKxOiDLw== + integrity: sha512-BX8NAVVWDeaidRCJbHcifDv0wPRGf8OQQyLPS2yxm0Aak6Yo8ipYqKCwoKZNJm1b4e6JAyIcmNDb5hpMyW+hHQ== tarball: file:projects/ai-document-translator.tgz version: 0.0.0 file:projects/ai-form-recognizer.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 - '@azure/identity': 1.3.0 + '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 '@types/chai': 4.2.16 '@types/mocha': 7.0.2 @@ -7894,7 +8008,7 @@ packages: dev: false name: '@rush-temp/ai-form-recognizer' resolution: - integrity: sha512-HUMGckigflkhjr74AUhw1mA05fWVbje5nS218AdXl0wrFsvMURVAAWba/igZx+9FJWQHDTrvnXOpljDPv1YRiQ== + integrity: sha512-looft5FGsQiK0892Vx8UL7/g5Qzp46c+fKAMoa5LzQzYElo+PcdLrLmOd2H6a12Rsf9O21pnr42V0/wDfuNf2Q== tarball: file:projects/ai-form-recognizer.tgz version: 0.0.0 file:projects/ai-metrics-advisor.tgz: @@ -7944,8 +8058,9 @@ packages: version: 0.0.0 file:projects/ai-text-analytics.tgz: dependencies: + '@azure/core-rest-pipeline': 1.0.3 '@azure/core-tracing': 1.0.0-preview.11 - '@azure/identity': 1.3.0 + '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 '@types/chai': 4.2.16 '@types/chai-as-promised': 7.1.3 @@ -7986,13 +8101,13 @@ packages: dev: false name: '@rush-temp/ai-text-analytics' resolution: - integrity: sha512-99pEvJ4z5j42gxikMrqfl5owp5uDGFuNT9v5oVg2snIYHdmSNeYAawsMU4+WZD39+/c+EnInUT8fAn8mc5NvsA== + integrity: sha512-KZ9I7xHh8VE63VnB8xCmrSF40tju1frLQ1BGyT/YM2w0M+q2475W9tHCRLeUl6FmAiQXLv+6aqw8FTzP5j776A== tarball: file:projects/ai-text-analytics.tgz version: 0.0.0 file:projects/app-configuration.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 - '@azure/identity': 1.3.0 + '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-inject': 4.0.2_rollup@1.32.1 @@ -8040,7 +8155,7 @@ packages: dev: false name: '@rush-temp/app-configuration' resolution: - integrity: sha512-iItMzob++ct7sGjHGLQKISCJK+oW9NwDIucpCrPpEMt2MH2TyBaSHv4DOuDa2Y/jBtO9W4Hj0Fbt/aKXewREYw== + integrity: sha512-4AGlm2vHpELq0J6UowxwuKKEQk6JO6jv2Vp1/aMUoVZh15O6YMoH7XwKxbKcj661lKWAe/Jc7M4zRLpLfKKupw== tarball: file:projects/app-configuration.tgz version: 0.0.0 file:projects/attestation.tgz: @@ -8093,7 +8208,7 @@ packages: version: 0.0.0 file:projects/communication-chat.tgz: dependencies: - '@azure/communication-signaling': 1.0.0-beta.3 + '@azure/communication-signaling': 1.0.0-beta.5 '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 @@ -8143,7 +8258,7 @@ packages: dev: false name: '@rush-temp/communication-chat' resolution: - integrity: sha512-msX+ilu4T1qt+42YXKajobqKgqDulCHJhnPH4qRjnQNzWmFUsXjLPp2Zef9QluTUP/i1h4kmBtxQGdjpFE60qA== + integrity: sha512-mIhPKfBG7zkiDNgm9pK3S1QefIz47oyQWoBEF4gCWCsH53eV2p5e+xD+/Vfenj9BAn2rx41TzYUiorYbQgFidg== tarball: file:projects/communication-chat.tgz version: 0.0.0 file:projects/communication-common.tgz: @@ -8251,7 +8366,7 @@ packages: dev: false name: '@rush-temp/communication-identity' resolution: - integrity: sha512-0QvoVTuWaVxaNqcm9kuUiJODW2qUB4uKPrHA8Pv3FGQQ7Y74P6Q9NaN2F9CP1TyXHQZlrD37p9LJnTQgbwXFqg== + integrity: sha512-U4Bjk3YtMSeoDLSHDDnd2W6f7UQB0krAu5glaQ6UuG3mzFrfKVB9iyyLiz9yXV45lG349GkQUCfgQbubujckIw== tarball: file:projects/communication-identity.tgz version: 0.0.0 file:projects/communication-phone-numbers.tgz: @@ -8305,7 +8420,7 @@ packages: dev: false name: '@rush-temp/communication-phone-numbers' resolution: - integrity: sha512-ZxxqkvDAbF3E1MKUdq9dO3+d/Rzf81GValySfhgqqkq9GYmRIViBGzOJKPGs3cpM38w5ek5gd/bk8xzvEwWWAw== + integrity: sha512-h1caa+CGX7Hqtbo6Jz99z2Y3VSN4+G81SBkwkEiSYPeluok+sthLCt1C7M//8SUeCcjT+nLu+nBi4VDZnJw01w== tarball: file:projects/communication-phone-numbers.tgz version: 0.0.0 file:projects/communication-sms.tgz: @@ -8358,12 +8473,55 @@ packages: dev: false name: '@rush-temp/communication-sms' resolution: - integrity: sha512-iUDYbSKEqU9Onayru0k/Lzkp/tGDk5SuzxrcExxfXqhbCI0jIsL49TI9iEvPKvIZBwmauMnTTWG2dq6HG5c5dg== + integrity: sha512-G+1GE15e+ZEYE+icwuu1bJLWI/p5DoSJeImPFlisTesCKFdoERT2Awcf/FofNuAm20Z19+IdulY+GOvFLWlj1Q== tarball: file:projects/communication-sms.tgz version: 0.0.0 + file:projects/confidential-ledger.tgz: + dependencies: + '@azure/core-rest-pipeline': 1.1.0-beta.1 + '@azure/identity': 1.3.0 + '@microsoft/api-extractor': 7.13.2 + '@types/chai': 4.2.16 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + chai: 4.3.4 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-source-map-support: 1.4.0 + karma-sourcemap-loader: 0.3.8 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 2.2.1 + rimraf: 3.0.2 + rollup: 1.32.1 + source-map-support: 0.5.19 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + dev: false + name: '@rush-temp/confidential-ledger' + resolution: + integrity: sha512-akY+Jx2/F3f/NqLl3NXBnJnE/a/ESHgG8jUnJ2aqqbRhDznym3G1+6RZdfqYjPDKVY3kBeLv+bKgKiJPBm46IA== + tarball: file:projects/confidential-ledger.tgz + version: 0.0.0 file:projects/container-registry.tgz: dependencies: '@azure/arm-containerregistry': 8.0.0 + '@azure/core-rest-pipeline': 1.1.0-beta.1 '@azure/core-tracing': 1.0.0-preview.11 '@azure/identity': 1.3.0 '@azure/ms-rest-nodeauth': 3.0.9 @@ -8404,7 +8562,7 @@ packages: dev: false name: '@rush-temp/container-registry' resolution: - integrity: sha512-SsPsb2h7leU8zPAUjD+0e1wte3wUfwm+C8Hph+HIElBIROIv0pJsZGtM6pQIw2Bza3r39oegtO3TY3fAxJR8/g== + integrity: sha512-DmUQXJ3nifpciCZKMVXUm40WJyiZ4SbM5Kv9ln5Hgki0svYqtN8fDTYbIAA2gCmy/ZaRyeusFe/3mg+ewjZnbg== tarball: file:projects/container-registry.tgz version: 0.0.0 file:projects/core-amqp.tgz: @@ -8515,6 +8673,7 @@ packages: version: 0.0.0 file:projects/core-client-1.tgz: dependencies: + '@azure/core-rest-pipeline': 1.0.3 '@azure/core-tracing': 1.0.0-preview.11 '@azure/core-xml': 1.0.0-beta.1 '@microsoft/api-extractor': 7.7.11 @@ -8559,11 +8718,12 @@ packages: dev: false name: '@rush-temp/core-client-1' resolution: - integrity: sha512-21H/GvL5vjCaXYQD8ETNkbn4a2s35EY9ohVTqK7bR996ytd0gTX1XCcwlbLrnPFJpJD22X2oCZBmwx3tUDsJag== + integrity: sha512-5Yty3M7abL/LT12Huh21EOQUOR941Dw7IKn61TSC/wZ8YFRofUFshxtzw2Xmy2a7n9Z48uhhmA5tF62T9jQivg== tarball: file:projects/core-client-1.tgz version: 0.0.0 file:projects/core-client.tgz: dependencies: + '@azure/core-rest-pipeline': 1.1.0-beta.1 '@azure/core-tracing': 1.0.0-preview.11 '@azure/core-xml': 1.0.0-beta.1 '@microsoft/api-extractor': 7.13.2 @@ -8608,7 +8768,7 @@ packages: dev: false name: '@rush-temp/core-client' resolution: - integrity: sha512-ysfQQBePlUwpeDJmTUCRqYxf/zHdH+UTQ+EAByVTDOvM/2ekmsXjwhJIBwp78vBnQURbtNjIuSFYKk2od3amBg== + integrity: sha512-hOktk+qS8E/H1HrpUGbrQYLvGl5IP0H/iGWOz+YHTaJh3FAjovl7NGeRKEdMlPYoyWkU53NKNXuNiiibOlIx6g== tarball: file:projects/core-client.tgz version: 0.0.0 file:projects/core-crypto.tgz: @@ -8665,6 +8825,7 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/chai': 4.2.16 '@types/express': 4.17.11 '@types/glob': 7.1.3 @@ -8721,7 +8882,7 @@ packages: dev: false name: '@rush-temp/core-http' resolution: - integrity: sha512-eMAAgtKqqU7D05NWN5bHakktFTX6jz0KHj/Rkn3xbT/zmJ/WUZzz1poNZz75cA0GWvMFt2MFr5K/yd5dnEwsvA== + integrity: sha512-YFvwMJDL9Pya78VAH07hLmZ1DVHukjjIeOaNKvShcV2EodrYLNqRqjQN+LuDDI5K7B+OJGRVGWOeCZ/dJJWDVQ== tarball: file:projects/core-http.tgz version: 0.0.0 file:projects/core-lro.tgz: @@ -8975,6 +9136,7 @@ packages: version: 0.0.0 file:projects/cosmos.tgz: dependencies: + '@azure/core-rest-pipeline': 1.0.3 '@azure/identity': 1.3.0_debug@4.3.1 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 @@ -9023,11 +9185,12 @@ packages: dev: false name: '@rush-temp/cosmos' resolution: - integrity: sha512-/8qOC/V8y69zIekhbyW9qcgapO8Gr4csxVV9jeRJ3bqGevunFJ2wr9DaVxx34ztDmQqvQE5I6L0/lSopgQpMuA== + integrity: sha512-wCMZgt5C551rCi6HXgvD/EZVo6sl3llky3jsRCVQBcamdjmNF0qphRBDyYLlAn1cysnA7eG4clCBGzqT5wsAIg== tarball: file:projects/cosmos.tgz version: 0.0.0 file:projects/data-tables.tgz: dependencies: + '@azure/core-rest-pipeline': 1.0.3 '@azure/core-tracing': 1.0.0-preview.11 '@azure/core-xml': 1.0.0-beta.1 '@microsoft/api-extractor': 7.7.11 @@ -9079,7 +9242,7 @@ packages: dev: false name: '@rush-temp/data-tables' resolution: - integrity: sha512-9hK/ry3jr4Vfm2IUotAKYubi8mN1LaPqz//ggrWAyc1rSyMjOjNAkDnoCFWZkL99NdYXrM8wxcXlOOmuRlynmw== + integrity: sha512-IDeu2YShGePIGGHY6J4UBw930fwmpgbV/fhZylLZnt9FApLDhQLX5FCWaTOWj0EuncfwstJAYQCKzlxaXigl9w== tarball: file:projects/data-tables.tgz version: 0.0.0 file:projects/dev-tool.tgz: @@ -9099,7 +9262,7 @@ packages: builtin-modules: 3.1.0 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 - chalk: 3.0.0 + chalk: 4.1.1 dotenv: 8.2.0 eslint: 7.23.0 fs-extra: 8.1.0 @@ -9118,7 +9281,7 @@ packages: dev: false name: '@rush-temp/dev-tool' resolution: - integrity: sha512-rGtMfFPo8M7iE/unoqu6pixlEPyvRqJvFT7CE8yAnJR0MzVLOv+joUAkAuzH+iAP86N20cqLtR0Cax0fqjzFhw== + integrity: sha512-M9EDZ1Fo6PUH5m0H3fuCE/y5N0X/1tvuqeZ0hdjQk39CbL3x+BjCrtaBrgixxgN6SM8a8O8yFDeH56Dax3pHaA== tarball: file:projects/dev-tool.tgz version: 0.0.0 file:projects/digital-twins-core.tgz: @@ -9282,7 +9445,7 @@ packages: dev: false name: '@rush-temp/event-hubs' resolution: - integrity: sha512-8kvTC/cK5o9v8o0ZupbFtRjjOGERHFFr3srAOwWo+27nBCMo8F5hw9o9oHBMghESkh0uZFaiAzZG79/g7pFNxg== + integrity: sha512-7VxEPA1R44PvmiFSo7e0HzqO96D8jAdWLr5N5RjCspCTPnp9gnkhg/QmYlOIY+n2iZ1jzbgtJrwubncFEQbyuA== tarball: file:projects/event-hubs.tgz version: 0.0.0 file:projects/event-processor-host.tgz: @@ -9337,6 +9500,7 @@ packages: version: 0.0.0 file:projects/eventgrid.tgz: dependencies: + '@azure/core-rest-pipeline': 1.0.3 '@azure/core-tracing': 1.0.0-preview.11 '@azure/service-bus': 7.0.5 '@microsoft/api-extractor': 7.7.11 @@ -9389,11 +9553,12 @@ packages: dev: false name: '@rush-temp/eventgrid' resolution: - integrity: sha512-xh6kgtOlv01x9G/APg7o96Or8mejiJNCTIzIPGfOhGuQ3cJdkgmDt4BIRvcwNHlaLarZ4v+ytKhAw0JCj122cQ== + integrity: sha512-TrRicEN8OEh7DFa/GvPh/oxfL821p9Yb/WQM79S5WjPuJwXCyWYemMDTqn17up550TkO98CxvBQBpzVNNFXdNA== tarball: file:projects/eventgrid.tgz version: 0.0.0 file:projects/eventhubs-checkpointstore-blob.tgz: dependencies: + '@azure/storage-blob': 12.5.0 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-inject': 4.0.2_rollup@1.32.1 @@ -9448,7 +9613,7 @@ packages: dev: false name: '@rush-temp/eventhubs-checkpointstore-blob' resolution: - integrity: sha512-HVGnI1U0A0SyBMpjRlQDZINX71Kaae+cfNmQRcgmRhnDtt0J4K5sUbUJRuSEUje7LX/cZrKB7JyYzH+U9bXmLQ== + integrity: sha512-+IkU2ATSSMXaGRwCmLYsC6zjHzXJdbyPHp2Hj9r90C/odBUHvsffC0Pr0Z6VKqb9V1DZfFDoLlQTUdjwkS2NHg== tarball: file:projects/eventhubs-checkpointstore-blob.tgz version: 0.0.0 file:projects/identity.tgz: @@ -9509,7 +9674,7 @@ packages: optionalDependencies: keytar: 7.6.0 resolution: - integrity: sha512-TGmDn9FURoFYW60Z94hZ8+QRix4SX+A0jZGBJUZ4Xvo9IutZ81CVMxctI+TL8SgyWLzLWHkSEjsbB36WcVQM9w== + integrity: sha512-sEvBei3gVktijypQM6FLi74OeRLYeUlJMgmHXoAyYOaJDE+SbowgsRYQeEwhvloeNACGBX6ERgp6GmeEG/UEcg== tarball: file:projects/identity.tgz version: 0.0.0 file:projects/iot-device-update.tgz: @@ -9542,6 +9707,7 @@ packages: version: 0.0.0 file:projects/iot-modelsrepository.tgz: dependencies: + '@azure/core-rest-pipeline': 1.0.3 '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 @@ -9589,13 +9755,13 @@ packages: dev: false name: '@rush-temp/iot-modelsrepository' resolution: - integrity: sha512-850amf7zrHmFM6pV24CunLO8eiQx0sbvc/VV6gCuMqHtjtZUSMow71Mdmp0YdomCZInF2eBCJVOy18kdO5gEzQ== + integrity: sha512-n7pbT9gQay0Bf0fLiJb3fhhHoIAoVkLx1WGvDulWyzgNKXrjxPgjPD8W8uVf4kpxbs3RZJ0w7ciFp8AFGUvAbQ== tarball: file:projects/iot-modelsrepository.tgz version: 0.0.0 file:projects/keyvault-admin.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 - '@azure/identity': 1.3.0 + '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 @@ -9634,13 +9800,13 @@ packages: dev: false name: '@rush-temp/keyvault-admin' resolution: - integrity: sha512-oRwQPIUfeV8PrFW1HB06AWis2jNtWXz99fenuzpH0C+iVCmqDTU0zGFUBmVHW5qqjykEtoHCyyXp6L8WgIpZGw== + integrity: sha512-+MFekhKrrrkjT4Ph+37w1ESnWEvVuLwvkNhQQzgiz2xJMZ3Aoqa7VMDNtyRLR/TqOLYMoFVGfyWcKk/1E9cJhQ== tarball: file:projects/keyvault-admin.tgz version: 0.0.0 file:projects/keyvault-certificates.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 - '@azure/identity': 1.3.0 + '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 @@ -9692,7 +9858,7 @@ packages: dev: false name: '@rush-temp/keyvault-certificates' resolution: - integrity: sha512-geYalPzb+uX/KwZtzL95nr+8oUXOBVk85Z1435k32tkxHLyRFTmALCRWqUQ8667TnyWWh+9ckR62/aa7OIcFAQ== + integrity: sha512-H+yRlTDehFWOV/kIz1yG9T53oExG16IF0Go4sdg+o+rG1z4bd7EXUhl2iEvBuKaYBZeE7XbxqZ+zz980HekBsA== tarball: file:projects/keyvault-certificates.tgz version: 0.0.0 file:projects/keyvault-common.tgz: @@ -9712,7 +9878,7 @@ packages: file:projects/keyvault-keys.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 - '@azure/identity': 1.3.0 + '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 @@ -9766,7 +9932,7 @@ packages: dev: false name: '@rush-temp/keyvault-keys' resolution: - integrity: sha512-d5VpsD0EqzARzk9c9a6E+1sgIjAZYCObYjQCIbEZNCem4IB5CIYlm83c+/DRBKyH1fQEVsoHQgxTwbNyRkrxNA== + integrity: sha512-EUf3DDQqrZU78QdlP7o20gzQ08LLWv7UlpMQm6fOTZXSm1PLwWB+r0TffxtY85b67uncEyeafULnGBjy0guFrA== tarball: file:projects/keyvault-keys.tgz version: 0.0.0 file:projects/keyvault-secrets.tgz: @@ -9966,6 +10132,7 @@ packages: version: 0.0.0 file:projects/perf-ai-form-recognizer.tgz: dependencies: + '@azure/ai-form-recognizer': 3.1.0-beta.3 '@azure/identity': 1.3.0 '@types/node': 8.10.66 dotenv: 8.2.0 @@ -9978,7 +10145,7 @@ packages: dev: false name: '@rush-temp/perf-ai-form-recognizer' resolution: - integrity: sha512-gJ4nl8UAm254P0GWxcnaF5PpWatN2Ifio5wl3XfLknEEAYPDOYYxQcuXmCLE9oGdsb3SaujzdQnqHqetDfVHoA== + integrity: sha512-DbYouo02NhUJlb+MAgEjJc8+WswySuI84wMBVtyR2rlRj5gniVw/tUss2s32IBcvYp7t+cG8Qqf0Lq9714NFlg== tarball: file:projects/perf-ai-form-recognizer.tgz version: 0.0.0 file:projects/perf-ai-metrics-advisor.tgz: @@ -10015,6 +10182,23 @@ packages: integrity: sha512-WRKlYq5E3/zAp5qMYA5yQagbJYlfuIUsxCBp+WSfENbW/m4WzpjkNC/01TLJ6tO2CEoLc+RRPXCDFpA30H432g== tarball: file:projects/perf-ai-text-analytics.tgz version: 0.0.0 + file:projects/perf-core-rest-pipeline.tgz: + dependencies: + '@azure/core-rest-pipeline': 1.1.0-beta.1 + '@types/uuid': 8.3.0 + dotenv: 8.2.0 + eslint: 7.23.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + dev: false + name: '@rush-temp/perf-core-rest-pipeline' + resolution: + integrity: sha512-BNAP4/2YeHNhrMbvl9A1B+YX+W9MDW8PqA2WipfM5nExM9ywsJEdX7JUv69gul01revGkFoSY1Ukwhe0pSNpNQ== + tarball: file:projects/perf-core-rest-pipeline.tgz + version: 0.0.0 file:projects/perf-eventgrid.tgz: dependencies: '@types/node': 8.10.66 @@ -10033,6 +10217,7 @@ packages: version: 0.0.0 file:projects/perf-identity.tgz: dependencies: + '@azure/identity': 2.0.0-beta.3 '@types/uuid': 8.3.0 dotenv: 8.2.0 eslint: 7.23.0 @@ -10044,7 +10229,7 @@ packages: dev: false name: '@rush-temp/perf-identity' resolution: - integrity: sha512-dGWFtEBT8TQxKH65+/OO266Cj2gcGgXT/bdyjq3MCENgBQ5MiD01quuKiPncS1BUA2iEieCvxlE5T5dJvgxWTw== + integrity: sha512-LBd+IU7qdFN4SS3+SWXe40vKOxJjWCWmGrBcCmJFtpWvHaYBngjcIfshuf1Alw7pa7KgFrY2McXAl4acHrbZdw== tarball: file:projects/perf-identity.tgz version: 0.0.0 file:projects/perf-keyvault-certificates.tgz: @@ -10115,11 +10300,12 @@ packages: dev: false name: '@rush-temp/perf-search-documents' resolution: - integrity: sha512-UEZdA+EPRblJfIP8D38K716j/lO/TVT3FrYzEP96rZKMWFRuOt0BDvP1FerYtWE9hieotwR69wm7v5bPPpjuyg== + integrity: sha512-8Vow24y5DwbPb4BS7uf+qZQgMEMYdToxQxfMsvKcw1pueM1d39F+ezpNsHbaBY6VoKhdrFVGb/03IY5MDb3+4A== tarball: file:projects/perf-search-documents.tgz version: 0.0.0 file:projects/perf-storage-blob.tgz: dependencies: + '@azure/core-rest-pipeline': 1.0.3 '@types/node': 8.10.66 '@types/node-fetch': 2.5.10 '@types/uuid': 8.3.0 @@ -10135,7 +10321,7 @@ packages: dev: false name: '@rush-temp/perf-storage-blob' resolution: - integrity: sha512-CQP5Lrw+CR+EpibLFTir3/fZn3oIwh0UG1C9JsKtKkzfGaw0BO2V8vV5FoKCp4RwiEhbkvkHnu89DuBZMxZH7A== + integrity: sha512-rqK+gX9tyH33hp2qGxsPiokHaeml96R7BTSt+g4pE4L25DXz6piSCdAvQoqQFgddUiOpJLxobsgLMUS2yL3R3Q== tarball: file:projects/perf-storage-blob.tgz version: 0.0.0 file:projects/perf-storage-file-datalake.tgz: @@ -10153,7 +10339,7 @@ packages: dev: false name: '@rush-temp/perf-storage-file-datalake' resolution: - integrity: sha512-desRgzqog2aoFzH4xpp90a0NBZbUJ1eDUAgUQb3jaUiNOA3y0ER5mHOXFDQ8RuQ0Kjy6jbeNmZ8rcsmJ6OM1+w== + integrity: sha512-O0FTUPGwumYO9IpJpN+SBuP09701A+vg+ipKCPZL0j2JrBiV3EvIj4GNtR9n6RLXwweJ872+TLBz9xUCXehuoA== tarball: file:projects/perf-storage-file-datalake.tgz version: 0.0.0 file:projects/perf-storage-file-share.tgz: @@ -10174,6 +10360,92 @@ packages: integrity: sha512-mjYaV8s2WtZjhutOHaUUXmi2Ne5i+O/doHq+xoMo8aqmB50wVLSdyG52mRA3JITqy667rK95QQdjyzG6LflpOw== tarball: file:projects/perf-storage-file-share.tgz version: 0.0.0 + file:projects/purview-catalog.tgz: + dependencies: + '@azure/core-rest-pipeline': 1.0.3 + '@azure/identity': 1.3.0 + '@microsoft/api-extractor': 7.13.2 + '@types/chai': 4.2.16 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + chai: 4.3.4 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-source-map-support: 1.4.0 + karma-sourcemap-loader: 0.3.8 + mkdirp: 1.0.4 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 2.2.1 + rimraf: 3.0.2 + rollup: 1.32.1 + source-map-support: 0.5.19 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + dev: false + name: '@rush-temp/purview-catalog' + resolution: + integrity: sha512-eBVNFGBBOpPmvwlw/pbKgUUYZ/m61XBMuVJ75zJV9W4xJDaGaP++iOZpmexXVEQnTdbjIRgt5h0/yGxAheu5Kw== + tarball: file:projects/purview-catalog.tgz + version: 0.0.0 + file:projects/purview-scanning.tgz: + dependencies: + '@azure/core-rest-pipeline': 1.0.3 + '@azure/identity': 1.3.0 + '@microsoft/api-extractor': 7.13.2 + '@types/chai': 4.2.16 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + chai: 4.3.4 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-source-map-support: 1.4.0 + karma-sourcemap-loader: 0.3.8 + mkdirp: 1.0.4 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 2.2.1 + rimraf: 3.0.2 + rollup: 1.32.1 + source-map-support: 0.5.19 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + dev: false + name: '@rush-temp/purview-scanning' + resolution: + integrity: sha512-tmoBhJSqMTMl7QlwQ0+Nmck7qhKtNN7pNEFqgz+zWIXsT2mOIKlczw6elNEJvQ/DjryF2/at4YAbQ+GFXe2F+g== + tarball: file:projects/purview-scanning.tgz + version: 0.0.0 file:projects/quantum-jobs.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 @@ -10225,7 +10497,7 @@ packages: dev: false name: '@rush-temp/quantum-jobs' resolution: - integrity: sha512-ZGwwkEsI5mFwQKjnxCWlrSWdanAQmBfWlH2GOQBaDY0Dr7+ttS6/UcgAEAUqRy5CKpwtzEOw7hCWw0328wgKvA== + integrity: sha512-kzJpXVVf10ntnC6noDSEQStda/tSWMUvKkc8AshCltzwKgksLfq9/2PDybVlc7oIb/xIIr/6zXu/O4ZWUrNG2A== tarball: file:projects/quantum-jobs.tgz version: 0.0.0 file:projects/schema-registry-avro.tgz: @@ -10287,7 +10559,7 @@ packages: file:projects/schema-registry.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 - '@azure/identity': 1.3.0 + '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 @@ -10333,7 +10605,7 @@ packages: dev: false name: '@rush-temp/schema-registry' resolution: - integrity: sha512-zfAsAov4Ijx3nUSubjGXdLh6gEH6KE29iuZTSVqfzfVdmofxIXJBde0qRGfhr+tExpuvOygoBKeCLrDYtNI6HQ== + integrity: sha512-4IqfyLiheTDNMF2jiJlK9vgjwsbBWe6OvAu5ZYs8BbnF9/OixJGuYm42xhduZ7zbujDMeidEF/BQuYB0a5zilQ== tarball: file:projects/schema-registry.tgz version: 0.0.0 file:projects/search-documents.tgz: @@ -10463,7 +10735,7 @@ packages: dev: false name: '@rush-temp/service-bus' resolution: - integrity: sha512-wYyGEJH+Xk4XpboHfLFEgWMQdfUDhpdU3xcykhlEN4knMb9GIyaKbAttspaHPQ8+g4xB7Mjh5BneIhyZKkiFCA== + integrity: sha512-L88QmVwasxTuDCx0680kE/wVLfgvKpRpOGsI5rIxYRJRFVwzMzeHqzr8MMFgKs4ZLrAj9HJ7NobCYOEW1DxleQ== tarball: file:projects/service-bus.tgz version: 0.0.0 file:projects/storage-blob-changefeed.tgz: @@ -10521,13 +10793,14 @@ packages: dev: false name: '@rush-temp/storage-blob-changefeed' resolution: - integrity: sha512-OM29tpLQJ1smYWCdSnex9QAE4eSXp35OI7eyuolxmlhbL4b2xmn9c4VMjIYVxqN/mD9LIk7mNiOb6KYI57EtQg== + integrity: sha512-9P9QjSXeSJRC+jAtLZt9zTtQ6jXvzp5qoylpuTeN7H39CQqOf6i/wtaD+UT4Q1hDeQG68uof21dSg4HW/Z8wPQ== tarball: file:projects/storage-blob-changefeed.tgz version: 0.0.0 file:projects/storage-blob.tgz: dependencies: + '@azure/core-rest-pipeline': 1.0.3 '@azure/core-tracing': 1.0.0-preview.11 - '@azure/identity': 1.3.0 + '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 @@ -10580,13 +10853,13 @@ packages: dev: false name: '@rush-temp/storage-blob' resolution: - integrity: sha512-zjsBvTJeN5+OX5qmry75Z71EW/mgT8oSGLlNlvbvjsjF41/so6m4oNpwBpQIw6oOp5vpqtV5G07Sh8u1vEQmnw== + integrity: sha512-Fue4hXzVsT+u7nXMd5nZvTEa5AjyhfiJ8vex1XiBzyJnWN7KO+ah6HY7JapUGt0sMRbflRQNdR4bT3lG4QiS5Q== tarball: file:projects/storage-blob.tgz version: 0.0.0 file:projects/storage-file-datalake.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 - '@azure/identity': 1.3.0 + '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 @@ -10640,7 +10913,7 @@ packages: dev: false name: '@rush-temp/storage-file-datalake' resolution: - integrity: sha512-ru/ZA4Wf0gfKw5rRPBaavkwJYFftxm6j+S7uBJ7LgIpZplMidq2munB47jFBgjf0uaxHJ1Q/y/ssDCTrxFafTg== + integrity: sha512-Joib7h54rfGe/6C5CP7QgL0cPF6NGzYvvqwW9Y2pip/gaTK8wIb7L372Rl3fuuSJv0u4CxjmhqXlVGLGoxOR+A== tarball: file:projects/storage-file-datalake.tgz version: 0.0.0 file:projects/storage-file-share.tgz: @@ -10981,31 +11254,6 @@ packages: integrity: sha512-mwHFZ1xypf2mBlIcqY/yi+3JKpTC54l/ZdImtdQ0ioOPW8ia9HXOVdK5Gc0Kmk0Bhe4Wjw+K1cnBPSbB5WlFXA== tarball: file:projects/template.tgz version: 0.0.0 - file:projects/test-utils-multi-version.tgz: - dependencies: - '@microsoft/api-extractor': 7.7.11 - '@types/chai': 4.2.16 - '@types/mocha': 7.0.2 - '@types/node': 8.10.66 - chai: 4.3.4 - chai-as-promised: 7.1.1_chai@4.3.4 - eslint: 7.23.0 - karma: 6.3.2 - karma-chrome-launcher: 3.1.0 - karma-coverage: 2.0.3 - karma-env-preprocessor: 0.1.1 - mocha: 7.2.0 - prettier: 1.19.1 - rimraf: 3.0.2 - rollup: 1.32.1 - tslib: 2.2.0 - typescript: 4.2.4 - dev: false - name: '@rush-temp/test-utils-multi-version' - resolution: - integrity: sha512-uNtK2ZrbsqB4kp9hgXR4A0DT561htuu0lvY0Y5OR4qn+1iTFPtqluk57cLJaiRUjqWP/7NzD8DuAk1/RqBskTA== - tarball: file:projects/test-utils-multi-version.tgz - version: 0.0.0 file:projects/test-utils-perfstress.tgz: dependencies: '@types/minimist': 1.2.1 @@ -11085,6 +11333,154 @@ packages: integrity: sha512-+z4Le1dPD7946nToxQrse/mrMXuoJDo2Cko9iUDRTFxF2+1vs9a2WEawBV2iW4KckezsAyswjjxTrWYFl5Vyyg== tarball: file:projects/test-utils-recorder.tgz version: 0.0.0 + file:projects/test-utils.tgz: + dependencies: + '@microsoft/api-extractor': 7.7.11 + '@types/chai': 4.2.16 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + '@types/sinon': 9.0.11 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 + eslint: 7.23.0 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-env-preprocessor: 0.1.1 + mocha: 7.2.0 + prettier: 1.19.1 + rimraf: 3.0.2 + rollup: 1.32.1 + sinon: 9.2.4 + tslib: 2.2.0 + typescript: 4.2.4 + dev: false + name: '@rush-temp/test-utils' + resolution: + integrity: sha512-h7eNMFY99Tt6JxkzrO2RY30U4hccSzEQBiWTvyk5u/OZZu4Tzi/fUDfgBF6gMx9Y0PrhYtjQp2QTCfZoHqKZtg== + tarball: file:projects/test-utils.tgz + version: 0.0.0 + file:projects/web-pubsub-express.tgz: + dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 + '@microsoft/api-extractor': 7.7.11 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.16 + '@types/express': 4.17.11 + '@types/express-serve-static-core': 4.17.19 + '@types/jsonwebtoken': 8.5.1 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + '@types/query-string': 6.2.0 + '@types/sinon': 9.0.11 + assert: 1.5.0 + chai: 4.3.4 + cloudevents: 4.0.2 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + esm: 3.2.25 + jsonwebtoken: 8.5.1 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-sourcemap-loader: 0.3.8 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 1.19.1 + puppeteer: 3.3.0 + query-string: 5.1.1 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-shim: 1.0.0 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup-plugin-terser: 5.3.1_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + sinon: 9.2.4 + source-map-support: 0.5.19 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + dev: false + name: '@rush-temp/web-pubsub-express' + resolution: + integrity: sha512-X1/olijTQ0DqPM4c8OBL6JzZ3Nc86uzmqxrUSBxpysxc7cHGkVN22rVls+SUPdoqsMDSBYZO1RnCn3W1/iIDUQ== + tarball: file:projects/web-pubsub-express.tgz + version: 0.0.0 + file:projects/web-pubsub.tgz: + dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/identity': 1.3.0 + '@microsoft/api-extractor': 7.7.11 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/jsonwebtoken': 8.5.1 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + '@types/query-string': 6.2.0 + '@types/sinon': 9.0.11 + assert: 1.5.0 + chai: 4.3.4 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + esm: 3.2.25 + jsonwebtoken: 8.5.1 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-sourcemap-loader: 0.3.8 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 1.19.1 + puppeteer: 3.3.0 + query-string: 5.1.1 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-shim: 1.0.0 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup-plugin-terser: 5.3.1_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + sinon: 9.2.4 + source-map-support: 0.5.19 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + url: 0.11.0 + dev: false + name: '@rush-temp/web-pubsub' + resolution: + integrity: sha512-/NyPXluzbX/KnFWCkerIeKhrpi85AR9nTnG4sjGyyKbxwWSzJYmrUTXUuRltnhFBA2wbaw6RQmmmukjCN8kDmQ== + tarball: file:projects/web-pubsub.tgz + version: 0.0.0 registry: '' specifiers: '@rush-temp/abort-controller': file:./projects/abort-controller.tgz @@ -11100,6 +11496,7 @@ specifiers: '@rush-temp/communication-identity': file:./projects/communication-identity.tgz '@rush-temp/communication-phone-numbers': file:./projects/communication-phone-numbers.tgz '@rush-temp/communication-sms': file:./projects/communication-sms.tgz + '@rush-temp/confidential-ledger': file:./projects/confidential-ledger.tgz '@rush-temp/container-registry': file:./projects/container-registry.tgz '@rush-temp/core-amqp': file:./projects/core-amqp.tgz '@rush-temp/core-asynciterator-polyfill': file:./projects/core-asynciterator-polyfill.tgz @@ -11138,6 +11535,7 @@ specifiers: '@rush-temp/perf-ai-form-recognizer': file:./projects/perf-ai-form-recognizer.tgz '@rush-temp/perf-ai-metrics-advisor': file:./projects/perf-ai-metrics-advisor.tgz '@rush-temp/perf-ai-text-analytics': file:./projects/perf-ai-text-analytics.tgz + '@rush-temp/perf-core-rest-pipeline': file:./projects/perf-core-rest-pipeline.tgz '@rush-temp/perf-eventgrid': file:./projects/perf-eventgrid.tgz '@rush-temp/perf-identity': file:./projects/perf-identity.tgz '@rush-temp/perf-keyvault-certificates': file:./projects/perf-keyvault-certificates.tgz @@ -11147,6 +11545,8 @@ specifiers: '@rush-temp/perf-storage-blob': file:./projects/perf-storage-blob.tgz '@rush-temp/perf-storage-file-datalake': file:./projects/perf-storage-file-datalake.tgz '@rush-temp/perf-storage-file-share': file:./projects/perf-storage-file-share.tgz + '@rush-temp/purview-catalog': file:./projects/purview-catalog.tgz + '@rush-temp/purview-scanning': file:./projects/purview-scanning.tgz '@rush-temp/quantum-jobs': file:./projects/quantum-jobs.tgz '@rush-temp/schema-registry': file:./projects/schema-registry.tgz '@rush-temp/schema-registry-avro': file:./projects/schema-registry-avro.tgz @@ -11164,6 +11564,8 @@ specifiers: '@rush-temp/synapse-monitoring': file:./projects/synapse-monitoring.tgz '@rush-temp/synapse-spark': file:./projects/synapse-spark.tgz '@rush-temp/template': file:./projects/template.tgz - '@rush-temp/test-utils-multi-version': file:./projects/test-utils-multi-version.tgz + '@rush-temp/test-utils': file:./projects/test-utils.tgz '@rush-temp/test-utils-perfstress': file:./projects/test-utils-perfstress.tgz '@rush-temp/test-utils-recorder': file:./projects/test-utils-recorder.tgz + '@rush-temp/web-pubsub': file:./projects/web-pubsub.tgz + '@rush-temp/web-pubsub-express': file:./projects/web-pubsub-express.tgz From 684f9540e80434b331f602554b969492dddd3c57 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 09:47:57 -0700 Subject: [PATCH 35/81] allowinsecureConnection --- sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts | 2 +- sdk/iot/modelsrepository/src/fetcherHTTP.ts | 1 + sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts | 4 +--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts b/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts index cfd211aebcba..56f271d997e8 100644 --- a/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts +++ b/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts @@ -7,7 +7,7 @@ import {ModelsRepositoryClient} from "@azure/iot-modelsrepository"; -const repositoryEndpoint = "http://www.devicemodels.azure.com"; +const repositoryEndpoint = "https://devicemodels.azure.com"; const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; console.log(repositoryEndpoint, dtmi); diff --git a/sdk/iot/modelsrepository/src/fetcherHTTP.ts b/sdk/iot/modelsrepository/src/fetcherHTTP.ts index 303ecf90088b..64e08865dbaf 100644 --- a/sdk/iot/modelsrepository/src/fetcherHTTP.ts +++ b/sdk/iot/modelsrepository/src/fetcherHTTP.ts @@ -28,6 +28,7 @@ export class HttpFetcher extends Fetcher { timeout: options.requestOptions?.timeout, abortSignal: options.abortSignal, tracingOptions: options.tracingOptions, + allowInsecureConnection: true } const request: PipelineRequest = createPipelineRequest(requestOptions); const res: PipelineResponse = await this._client.sendRequest(request); diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts index 07e9104d1965..469f0716f436 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts @@ -7,7 +7,6 @@ import { DEFAULT_API_VERSION } from "./internal"; interface IoTModelsRepositoryServiceClientOptions extends ServiceClientOptions { version?: string; endpoint?: string; - allowInsecureConnection?: boolean } export class IoTModelsRepositoryServiceClient extends ServiceClient { @@ -22,8 +21,7 @@ export class IoTModelsRepositoryServiceClient extends ServiceClient { constructor(url: string, options: IoTModelsRepositoryServiceClientOptions = {}) { const defaults: IoTModelsRepositoryServiceClientOptions = { baseUri: `${url}`, - requestContentType: "application/json; charset=utf-8", - allowInsecureConnection: true + requestContentType: "application/json; charset=utf-8" }; const optionsWithDefaults = { From 83446b2d14d15652d866aeeb0681c6916cd0aeef Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 09:52:50 -0700 Subject: [PATCH 36/81] remove unnecessary env --- sdk/iot/modelsrepository/karma.conf.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sdk/iot/modelsrepository/karma.conf.js b/sdk/iot/modelsrepository/karma.conf.js index 9bca108da550..e5f34e48f25e 100644 --- a/sdk/iot/modelsrepository/karma.conf.js +++ b/sdk/iot/modelsrepository/karma.conf.js @@ -54,13 +54,6 @@ module.exports = function(config) { }, envPreprocessor: [ - "TEST_MODE", - "APPCONFIG_ENDPOINT", - "APPCONFIG_TEST_SETTING_KEY", - "APPCONFIG_TEST_SETTING_EXPECTED_VALUE", - "AZURE_CLIENT_ID", - "AZURE_CLIENT_SECRET", - "AZURE_TENANT_ID" ], // test results reporter to use From cf9c75ae1d7d6703c165860f12d5f423e1bda8a8 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 09:53:42 -0700 Subject: [PATCH 37/81] point to package --- sdk/iot/modelsrepository/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index 3a6af18f4747..3a543e7f70da 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -6,7 +6,7 @@ "main": "dist/index.js", "module": "dist-esm/src/index.js", "browser": { - "stream": "./node_modules/stream-browserify/index.js", + "stream": "stream-browserify", "./dist-esm/src/print.js": "./dist-esm/src/print.browser.js", "./dist-esm/src/utils/url.js": "./dist-esm/src/utils/url.browser.js" }, From 8326da7c1ae9e5e25443469757d3594197db5fe3 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 09:55:16 -0700 Subject: [PATCH 38/81] readability --- sdk/iot/modelsrepository/src/dtmiConventions.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sdk/iot/modelsrepository/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts index c49c3b02f99b..c91f2605f521 100644 --- a/sdk/iot/modelsrepository/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -10,11 +10,9 @@ * @returns {boolean} */ export function isValidDtmi(dtmi: string): boolean { - if (dtmi) { - const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/; - return re.test(dtmi); // true if dtmi matches regular expression, false otherwise - } - return false; // if not a string return false. + if (typeof dtmi !== "string") return false; + const re = /^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$/; + return re.test(dtmi); // true if dtmi matches regular expression, false otherwise } /** From 63828a07f8758fb62e74bdd992c7a5a42b99ee44 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 09:56:14 -0700 Subject: [PATCH 39/81] remove old api --- .../review/iot-modelsrepository-client.api.md | 45 ------------------- 1 file changed, 45 deletions(-) delete mode 100644 sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md diff --git a/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md b/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md deleted file mode 100644 index e940384fc86b..000000000000 --- a/sdk/iot/modelsrepository/review/iot-modelsrepository-client.api.md +++ /dev/null @@ -1,45 +0,0 @@ -## API Report File for "@azure/iot-modelsrepository" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { InternalClientPipelineOptions } from '@azure/core-client'; - -// @public -export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded" | undefined; - -// @public -export interface GetModelsOptions { - dependencyResolution: dependencyResolutionType; -} - -// @public -export function getModelUri(dtmi: string, repositoryUri: string, expanded?: boolean): string; - -// @public -export function isValidDtmi(dtmi: string): boolean; - -// @public -export class ModelsRepositoryClient { - constructor(options?: ModelsRepositoryClientOptions); - get apiVersion(): string; - get dependencyResolution(): dependencyResolutionType; - getModels(dtmis: string, options?: GetModelsOptions): Promise<{ - [dtmi: string]: any; - }>; - getModels(dtmis: string[], options?: GetModelsOptions): Promise<{ - [dtmi: string]: any; - }>; - get repositoryLocation(): string; - } - -// @public -export interface ModelsRepositoryClientOptions extends InternalClientPipelineOptions { - apiVersion?: string; - dependencyResolution?: dependencyResolutionType; - repositoryLocation?: string; -} - - -``` From 99a5ed5a0c05e444da02555ba831dc3b5b05373f Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 10:09:00 -0700 Subject: [PATCH 40/81] comments --- sdk/iot/modelsrepository/src/DTDL.ts | 2 +- sdk/iot/modelsrepository/src/dtmiResolver.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sdk/iot/modelsrepository/src/DTDL.ts b/sdk/iot/modelsrepository/src/DTDL.ts index 4e23d72128bc..8bb04d186b6d 100644 --- a/sdk/iot/modelsrepository/src/DTDL.ts +++ b/sdk/iot/modelsrepository/src/DTDL.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. interface Contents { - "@type"?: string; + "@type": string; name: string; schema: string; } diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index ffd2c2d54fc5..65bb8aea8565 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import { OperationOptions } from "@azure/core-client"; +import { Fetcher } from "./fetcherAbstract"; import { convertDtmiToPath, DTDL, logger, ModelError } from "./internal"; export class ResolverError extends Error { @@ -14,8 +15,8 @@ export class ResolverError extends Error { } export class DtmiResolver { - private _fetcher; - constructor(fetcher: any) { + private _fetcher: Fetcher; + constructor(fetcher: Fetcher) { this._fetcher = fetcher; } From dd617134ec9472bf1a6b6b7d1e54765cf4b72bfe Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 10:25:01 -0700 Subject: [PATCH 41/81] tweaks --- sdk/iot/modelsrepository/src/dtmiResolver.ts | 14 +++++++------- sdk/iot/modelsrepository/src/fetcherAbstract.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index 65bb8aea8565..8cf6abdd4c63 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -21,26 +21,26 @@ export class DtmiResolver { } async resolve(dtmis: string[], expandedModel: boolean, options?: OperationOptions): Promise<{[dtmi: string]: DTDL}> { - let modelMap: any = {}; - let promiseList = []; - for (let dtmi of dtmis) { - let dtdlPath = convertDtmiToPath(dtmi, expandedModel); + const modelMap: any = {}; + const promiseList = []; + for (const dtmi of dtmis) { + const dtdlPath = convertDtmiToPath(dtmi, expandedModel); logger.info(`Model ${dtmi} located in repository at ${dtdlPath}`); - let mypromise = this._fetcher.fetch(dtdlPath, options).then((dtdl: any[] | any) => { + const mypromise = this._fetcher.fetch(dtdlPath, options).then((dtdl: any[] | any) => { if (expandedModel) { if (Array.isArray(dtdl)) { const modelIds: string[] = (dtdl as any[]).map((model:any) => model["@id"]); if (!modelIds.includes(dtmi)) { throw new ModelError(`DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${modelIds}`); } - for (let model of dtdl) { + for (const model of dtdl) { modelMap[model["@id"]] = model; } } else { throw new ModelError('Expanded format should always return an array of models.'); } } else { - let model = dtdl; + const model = dtdl; if (model["@id"] != dtmi) { new ModelError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`); } diff --git a/sdk/iot/modelsrepository/src/fetcherAbstract.ts b/sdk/iot/modelsrepository/src/fetcherAbstract.ts index ef0ba19cb473..c3e469376337 100644 --- a/sdk/iot/modelsrepository/src/fetcherAbstract.ts +++ b/sdk/iot/modelsrepository/src/fetcherAbstract.ts @@ -5,5 +5,5 @@ import { OperationOptions } from "@azure/core-client"; import { DTDL } from "./internal"; export abstract class Fetcher { - abstract fetch(path: string, options: OperationOptions): Promise; + abstract fetch(path: string, options?: OperationOptions): Promise; } From f8daa06844c4e928dc5f045bd134c738576e5ae3 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 10:27:50 -0700 Subject: [PATCH 42/81] remove resolverError --- sdk/iot/modelsrepository/src/dtmiResolver.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index 8cf6abdd4c63..8a0bc42b2334 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -5,15 +5,9 @@ import { OperationOptions } from "@azure/core-client"; import { Fetcher } from "./fetcherAbstract"; import { convertDtmiToPath, DTDL, logger, ModelError } from "./internal"; -export class ResolverError extends Error { - cause: Error | undefined; - - constructor(message: string, cause?: Error) { - super(message); - this.cause = cause; - } -} - +/** + * DtmiResolver handles reformatting the DTMIs to paths and passing options down to the configured fetcher. + */ export class DtmiResolver { private _fetcher: Fetcher; constructor(fetcher: Fetcher) { From bcfc92f3fa9ee5c2b5bfb7293fed6fddff9a1786 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 14:00:46 -0700 Subject: [PATCH 43/81] update resolver code --- sdk/iot/modelsrepository/src/dtmiResolver.ts | 45 +++++++++----------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index 8a0bc42b2334..4e4208b54b92 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -16,36 +16,33 @@ export class DtmiResolver { async resolve(dtmis: string[], expandedModel: boolean, options?: OperationOptions): Promise<{[dtmi: string]: DTDL}> { const modelMap: any = {}; - const promiseList = []; - for (const dtmi of dtmis) { + const dtdlPromises = dtmis.map(async (dtmi) => { const dtdlPath = convertDtmiToPath(dtmi, expandedModel); logger.info(`Model ${dtmi} located in repository at ${dtdlPath}`); - const mypromise = this._fetcher.fetch(dtdlPath, options).then((dtdl: any[] | any) => { - if (expandedModel) { - if (Array.isArray(dtdl)) { - const modelIds: string[] = (dtdl as any[]).map((model:any) => model["@id"]); - if (!modelIds.includes(dtmi)) { - throw new ModelError(`DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${modelIds}`); - } - for (const model of dtdl) { - modelMap[model["@id"]] = model; - } - } else { - throw new ModelError('Expanded format should always return an array of models.'); + const dtdl = await this._fetcher.fetch(dtdlPath, options) + if (expandedModel) { + if (Array.isArray(dtdl)) { + const modelIds: string[] = (dtdl as any[]).map((model:any) => model["@id"]); + if (!modelIds.includes(dtmi)) { + throw new ModelError(`DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${modelIds}`); } - } else { - const model = dtdl; - if (model["@id"] != dtmi) { - new ModelError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`); + for (const model of dtdl) { + modelMap[model["@id"]] = model; } - - modelMap[`${dtmi}`] = dtdl; + } else { + throw new ModelError('Expanded format should always return an array of models.'); } - }); - promiseList.push(mypromise); - } + } else { + const model = dtdl as DTDL; + if (model["@id"] != dtmi) { + throw new ModelError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`); + } + + modelMap[`${dtmi}`] = dtdl; + } + }); - await Promise.all(promiseList); + await Promise.all(dtdlPromises); return modelMap; } } From a6fab6247a6674560b8ac1fcbb55377e1dfcacb6 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 14:02:43 -0700 Subject: [PATCH 44/81] remove then --- sdk/iot/modelsrepository/src/fetcherFilesystem.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index 4b156561e24a..b91bf86c75b7 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -29,9 +29,8 @@ export class FilesystemFetcher extends Fetcher { try { logger.info(`File open on ${absolutePath}`); - const parsedDtdl: DTDL | DTDL[] = await readFilePromise(absolutePath).then((dtdlFile) => { - return JSON.parse(dtdlFile); - }); + const dtdlFile = await readFilePromise(absolutePath); + const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); return parsedDtdl; } catch (e) { // TODO: Is there a ResourceNotFound Error for Filesystem + Http (Generic API for errors) From e34ed32cfbcacc7da9bc164e8a233175c7ec7851 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 14:04:38 -0700 Subject: [PATCH 45/81] add link --- sdk/iot/modelsrepository/src/dtmiConventions.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/iot/modelsrepository/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts index c91f2605f521..3193fcfe81ff 100644 --- a/sdk/iot/modelsrepository/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -5,6 +5,8 @@ /** * isValidDtmi * @description given a dtmi it will validate it matches the convention. + * This is based on the DTMI spec: + * https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md#digital-twin-model-identifier * * @param dtmi * @returns {boolean} From 7d06b30943c328f71fad2e87a6537e6f041601b2 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 14:06:43 -0700 Subject: [PATCH 46/81] fetcher changes --- sdk/iot/modelsrepository/src/fetcherAbstract.ts | 4 ++-- sdk/iot/modelsrepository/src/fetcherFilesystem.ts | 3 +-- sdk/iot/modelsrepository/src/fetcherHTTP.ts | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sdk/iot/modelsrepository/src/fetcherAbstract.ts b/sdk/iot/modelsrepository/src/fetcherAbstract.ts index c3e469376337..28113715af6c 100644 --- a/sdk/iot/modelsrepository/src/fetcherAbstract.ts +++ b/sdk/iot/modelsrepository/src/fetcherAbstract.ts @@ -4,6 +4,6 @@ import { OperationOptions } from "@azure/core-client"; import { DTDL } from "./internal"; -export abstract class Fetcher { - abstract fetch(path: string, options?: OperationOptions): Promise; +export interface Fetcher { + fetch(path: string, options?: OperationOptions): Promise; } diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index b91bf86c75b7..54ddd4746d2c 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -15,11 +15,10 @@ function readFilePromise(path: string): Promise { }); } -export class FilesystemFetcher extends Fetcher { +export class FilesystemFetcher implements Fetcher { private _baseFilePath: string; constructor(baseFilePath: string) { - super(); this._baseFilePath = baseFilePath; } diff --git a/sdk/iot/modelsrepository/src/fetcherHTTP.ts b/sdk/iot/modelsrepository/src/fetcherHTTP.ts index 64e08865dbaf..b8bd33e8b793 100644 --- a/sdk/iot/modelsrepository/src/fetcherHTTP.ts +++ b/sdk/iot/modelsrepository/src/fetcherHTTP.ts @@ -6,12 +6,11 @@ import { createHttpHeaders, createPipelineRequest, HttpHeaders, HttpMethods, Pip import { logger } from "./logger"; import { Fetcher } from "./fetcherAbstract"; -export class HttpFetcher extends Fetcher { +export class HttpFetcher implements Fetcher { private _client: ServiceClient; private _baseURL: string; constructor(baseURL: string, client: ServiceClient) { - super(); this._client = client; this._baseURL = baseURL; } From 88dc5804d4e50d268730fbef3ee6ea8db429f9e8 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 14:45:31 -0700 Subject: [PATCH 47/81] update code --- sdk/iot/modelsrepository/package.json | 5 +++-- sdk/iot/modelsrepository/src/constants.ts | 2 +- .../modelsrepository/src/fetcherFilesystem.ts | 1 + sdk/iot/modelsrepository/src/fetcherHTTP.ts | 18 ++++-------------- sdk/iot/modelsrepository/src/index.ts | 1 + .../src/modelsRepositoryClient.ts | 9 ++------- .../src/modelsRepositoryServiceClient.ts | 3 +++ sdk/iot/modelsrepository/src/psuedoParser.ts | 3 +++ .../src/utils/aboslutePath.browser.ts | 5 +++++ .../modelsrepository/src/utils/absolutePath.ts | 5 +++++ .../src/utils/fetcherFilesystem.browser.ts | 5 +++++ 11 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts create mode 100644 sdk/iot/modelsrepository/src/utils/absolutePath.ts create mode 100644 sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index 3a543e7f70da..d81652fb4cbb 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -6,9 +6,10 @@ "main": "dist/index.js", "module": "dist-esm/src/index.js", "browser": { - "stream": "stream-browserify", "./dist-esm/src/print.js": "./dist-esm/src/print.browser.js", - "./dist-esm/src/utils/url.js": "./dist-esm/src/utils/url.browser.js" + "./dist-esm/src/utils/url.js": "./dist-esm/src/utils/url.browser.js", + "./dist-esm/src/utils/absolutePath.js": "./dist-esm/src/utils/absolutePath.browser.js", + "./dist-esm/src/fetcherFilesystem.js": "./dist-esm/src/utils/fetcherFilesystem.browser.js" }, "types": "types/iot-models-repository.d.ts", "scripts": { diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts index b0ee839f1845..3cff837f8b40 100644 --- a/sdk/iot/modelsrepository/src/constants.ts +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -const isBrowser = new Function("try {return this===window;}catch(e){ return false;}"); +const isBrowser = new Function("try {return this===self;}catch(e){ return false;}"); const isNode = new Function("try {return this===global;}catch(e){return false;}"); const currentPlatform = isBrowser ? "browser" : isNode ? "node" : "undefined"; diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index 54ddd4746d2c..5d034d1db3b4 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -34,6 +34,7 @@ export class FilesystemFetcher implements Fetcher { } catch (e) { // TODO: Is there a ResourceNotFound Error for Filesystem + Http (Generic API for errors) const options : RestErrorOptions = { + code: 'ResourceNotFound', statusCode: e?.status } throw new RestError("Failed to fetch from Filesystem", options); diff --git a/sdk/iot/modelsrepository/src/fetcherHTTP.ts b/sdk/iot/modelsrepository/src/fetcherHTTP.ts index b8bd33e8b793..a307a5cd474e 100644 --- a/sdk/iot/modelsrepository/src/fetcherHTTP.ts +++ b/sdk/iot/modelsrepository/src/fetcherHTTP.ts @@ -6,6 +6,9 @@ import { createHttpHeaders, createPipelineRequest, HttpHeaders, HttpMethods, Pip import { logger } from "./logger"; import { Fetcher } from "./fetcherAbstract"; +/** + * @internal + */ export class HttpFetcher implements Fetcher { private _client: ServiceClient; private _baseURL: string; @@ -37,24 +40,11 @@ export class HttpFetcher implements Fetcher { const parsedDtdl = JSON.parse(dtdlAsString); return parsedDtdl; } else { - // TODO: Validate with API Review Board that this is an accurate way to raise an error. - throw new RestError("Error on HTTP Request in remote model fetcher", {statusCode: res.status, response: res, request: request}); + throw new RestError("Error on HTTP Request in remote model fetcher", {code: 'ResourceNotFound',statusCode: res.status, response: res, request: request}); } } } -// Argument of type ' -// { -// url: string; -// method: string; -// headers: { [key: string]: string; } | undefined; -// timeout: number | undefined; -// abortSignal: AbortSignalLike | undefined; -// tracingOptions: OperationTracingOptions | undefined; -// } -// ' is not assignable to parameter of type 'PipelineRequestOptions'. -// Types of property 'method' are incompatible. - // options for PipelineRequestOptions as of 5/13/2021 // { // url: string; diff --git a/sdk/iot/modelsrepository/src/index.ts b/sdk/iot/modelsrepository/src/index.ts index 28e8b022c99e..a647cc446a2a 100644 --- a/sdk/iot/modelsrepository/src/index.ts +++ b/sdk/iot/modelsrepository/src/index.ts @@ -44,4 +44,5 @@ export { dependencyResolutionType, isValidDtmi, getModelUri, + ModelError } from "./internal"; diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index 64796dc195e6..174e7b87126e 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -17,13 +17,8 @@ import * as cnst from "./constants"; import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; import * as path from "path"; import { Fetcher } from "./fetcherAbstract"; -import { RestError } from "@azure/core-rest-pipeline"; import { URL } from "./utils/url"; - -function isLocalPath(p: string): boolean { - const myRegex = RegExp(/^(?:[a-zA-Z]\:|\\\\[\w\.]+\\[\w.$]+)\\(?:[\w]+\\)*\w([\w.])+$/g); - return !!p.match(myRegex); -} +import { isLocalPath } from "./utils/absolutePath"; /** * Initializes a new instance of the IoT Models Repository Client. @@ -207,7 +202,7 @@ export class ModelsRepositoryClient { logger.info(`Retreiving expanded model(s): ${dtmis}...`); modelMap = await this._resolver.resolve(dtmis, true, options); } catch (e) { - if (e instanceof RestError) { + if (e.name === "RestError" && e.code === "ResouceNotFound") { let baseModelMap: { [dtmi: string]: unknown }; logger.info("Could not retrieve model(s) from expanded model DTDL - "); baseModelMap = await this._resolver.resolve(dtmis, false, options); diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts index 469f0716f436..22d8e8947cb4 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts @@ -9,6 +9,9 @@ interface IoTModelsRepositoryServiceClientOptions extends ServiceClientOptions { endpoint?: string; } +/** + * @internal + */ export class IoTModelsRepositoryServiceClient extends ServiceClient { url: string; version: string; diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index 378402dc716e..20787d0b3efd 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -6,6 +6,9 @@ import { logger } from "./logger"; import { DtmiResolver } from "./dtmiResolver"; import { RestError } from "@azure/core-rest-pipeline"; +/** + * @internal + */ export class PseudoParser { private _resolver: DtmiResolver; diff --git a/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts b/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts new file mode 100644 index 000000000000..3a9592d2667a --- /dev/null +++ b/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts @@ -0,0 +1,5 @@ + + +export function isLocalPath() { + return false; +} \ No newline at end of file diff --git a/sdk/iot/modelsrepository/src/utils/absolutePath.ts b/sdk/iot/modelsrepository/src/utils/absolutePath.ts new file mode 100644 index 000000000000..38eb9edb7133 --- /dev/null +++ b/sdk/iot/modelsrepository/src/utils/absolutePath.ts @@ -0,0 +1,5 @@ +import {isAbsolute} from "path"; + +export function isLocalPath(p: string): boolean { + return isAbsolute(p); +} diff --git a/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts b/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts new file mode 100644 index 000000000000..0fe0fce0061e --- /dev/null +++ b/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts @@ -0,0 +1,5 @@ +export class FilesystemFetcher { + constructor() { + throw new Error("FilesystemFetcher is not supported in browser"); + } +} \ No newline at end of file From a2804b4691b3b603005d34a92bfa7eb08fe6608e Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Tue, 18 May 2021 15:44:08 -0700 Subject: [PATCH 48/81] changes --- sdk/iot/modelsrepository/src/DTDL.ts | 3 +++ .../src/dependencyResolutionType.ts | 1 + .../modelsrepository/src/dtmiConventions.ts | 4 ++-- sdk/iot/modelsrepository/src/dtmiResolver.ts | 3 ++- .../modelsrepository/src/fetcherAbstract.ts | 3 +++ .../modelsrepository/src/fetcherFilesystem.ts | 3 +++ sdk/iot/modelsrepository/src/fetcherHTTP.ts | 22 ------------------- 7 files changed, 14 insertions(+), 25 deletions(-) diff --git a/sdk/iot/modelsrepository/src/DTDL.ts b/sdk/iot/modelsrepository/src/DTDL.ts index 8bb04d186b6d..c022a5423224 100644 --- a/sdk/iot/modelsrepository/src/DTDL.ts +++ b/sdk/iot/modelsrepository/src/DTDL.ts @@ -7,6 +7,9 @@ interface Contents { schema: string; } +/** + * @internal + */ export interface DTDL extends JSON { "@context": any[]; "@id": string; diff --git a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts index 91e13228212e..29646559ff63 100644 --- a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts +++ b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts @@ -9,5 +9,6 @@ * it is enabled, and the client will resolve all dependency models linked to the dtmi within the endpoint, * or it is set to tryFromExpanded, where the client will attempt to get the expanded JSON format from the endpoint, * and in the event of failure will fallback on the standard enabled dependency resolution. + * */ export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded"; diff --git a/sdk/iot/modelsrepository/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts index 3193fcfe81ff..5e8125ad5fe8 100644 --- a/sdk/iot/modelsrepository/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -24,7 +24,7 @@ export function isValidDtmi(dtmi: string): boolean { * @param dtmi * @param repositoryUri * @param expanded - * @returns + * @returns {string} */ export function getModelUri(dtmi: string, repositoryUri: string, expanded: boolean = false): string { // TODO: Make sure this works with Windows UNC Filesystem Path. @@ -42,7 +42,7 @@ export function getModelUri(dtmi: string, repositoryUri: string, expanded: boole * * @param dtmi * @param expanded - * @returns + * @internal */ export function convertDtmiToPath(dtmi: string, expanded: boolean): string { // presently this dtmi to path function does not return the path with a diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index 4e4208b54b92..16440b26cc00 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -7,7 +7,8 @@ import { convertDtmiToPath, DTDL, logger, ModelError } from "./internal"; /** * DtmiResolver handles reformatting the DTMIs to paths and passing options down to the configured fetcher. - */ + * @internal +*/ export class DtmiResolver { private _fetcher: Fetcher; constructor(fetcher: Fetcher) { diff --git a/sdk/iot/modelsrepository/src/fetcherAbstract.ts b/sdk/iot/modelsrepository/src/fetcherAbstract.ts index 28113715af6c..ed95a5942e08 100644 --- a/sdk/iot/modelsrepository/src/fetcherAbstract.ts +++ b/sdk/iot/modelsrepository/src/fetcherAbstract.ts @@ -4,6 +4,9 @@ import { OperationOptions } from "@azure/core-client"; import { DTDL } from "./internal"; +/** + * @internal + */ export interface Fetcher { fetch(path: string, options?: OperationOptions): Promise; } diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index 5d034d1db3b4..996ace7418b5 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -15,6 +15,9 @@ function readFilePromise(path: string): Promise { }); } +/** + * @internal + */ export class FilesystemFetcher implements Fetcher { private _baseFilePath: string; diff --git a/sdk/iot/modelsrepository/src/fetcherHTTP.ts b/sdk/iot/modelsrepository/src/fetcherHTTP.ts index a307a5cd474e..d78eb98b408e 100644 --- a/sdk/iot/modelsrepository/src/fetcherHTTP.ts +++ b/sdk/iot/modelsrepository/src/fetcherHTTP.ts @@ -44,25 +44,3 @@ export class HttpFetcher implements Fetcher { } } } - -// options for PipelineRequestOptions as of 5/13/2021 -// { -// url: string; -// method?: HttpMethods; -// headers?: HttpHeaders; -// timeout?: number; -// withCredentials?: boolean; -// requestId?: string; -// body?: RequestBodyType; -// formData?: FormDataMap; -// streamResponseStatusCodes?: Set; -// proxySettings?: ProxySettings; -// disableKeepAlive?: boolean; -// abortSignal?: AbortSignalLike; -// tracingOptions?: OperationTracingOptions; -// onUploadProgress?: (progress: TransferProgressEvent) => void; -// /** Callback which fires upon download progress. */ -// onDownloadProgress?: (progress: TransferProgressEvent) => void; -// /** Set to true if the request is sent over HTTP instead of HTTPS */ -// allowInsecureConnection?: boolean; -// } From e9ac5235b3cb04c79d3e9485d990937e9bf3b0c6 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Wed, 19 May 2021 09:08:28 -0700 Subject: [PATCH 49/81] fix api --- sdk/iot/modelsrepository/review/iot-modelsrepository.api.md | 5 +++++ sdk/iot/modelsrepository/src/exceptions.ts | 3 +++ 2 files changed, 8 insertions(+) diff --git a/sdk/iot/modelsrepository/review/iot-modelsrepository.api.md b/sdk/iot/modelsrepository/review/iot-modelsrepository.api.md index 606cdb4383eb..1052c854ce8e 100644 --- a/sdk/iot/modelsrepository/review/iot-modelsrepository.api.md +++ b/sdk/iot/modelsrepository/review/iot-modelsrepository.api.md @@ -21,6 +21,11 @@ export function getModelUri(dtmi: string, repositoryUri: string, expanded?: bool // @public export function isValidDtmi(dtmi: string): boolean; +// @public +export class ModelError extends Error { + constructor(message: string); +} + // @public export class ModelsRepositoryClient { constructor(options?: ModelsRepositoryClientOptions); diff --git a/sdk/iot/modelsrepository/src/exceptions.ts b/sdk/iot/modelsrepository/src/exceptions.ts index b435bce5cf0b..cd588f1ae262 100644 --- a/sdk/iot/modelsrepository/src/exceptions.ts +++ b/sdk/iot/modelsrepository/src/exceptions.ts @@ -1,6 +1,9 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. +/** + * A ModelError will be thrown in the even the Model in the repo is malformed in some standard way. + */ export class ModelError extends Error { constructor(message: string) { super(message); From 33932080490dba2a3cd1f9854f781cdf3a98cc5a Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Wed, 19 May 2021 09:24:23 -0700 Subject: [PATCH 50/81] remove en --- sdk/iot/modelsrepository/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/iot/modelsrepository/README.md b/sdk/iot/modelsrepository/README.md index ac631186e567..88f9937a3b76 100644 --- a/sdk/iot/modelsrepository/README.md +++ b/sdk/iot/modelsrepository/README.md @@ -49,7 +49,7 @@ console.log(result); # Next steps -- Review the [DTDL Spec](https://docs.microsoft.com/en-us/azure/iot-pnp/concepts-model-parser). +- Review the [DTDL Spec](https://docs.microsoft.com/azure/iot-pnp/concepts-model-parser). - Understand the [Device Models Repository](https://devicemodels.azure.com/). - Code a IoT Plug and Play 'Device' using the [Azure IoT SDK for Node](https://github.com/Azure/azure-iot-sdk-node/tree/master/device/samples/pnp/readme.md). From 18ff9587c383090ec9421ffcd952e851f368b938 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Wed, 19 May 2021 09:57:13 -0700 Subject: [PATCH 51/81] normalize --- sdk/iot/modelsrepository/src/modelsRepositoryClient.ts | 4 ++-- sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts | 3 ++- sdk/iot/modelsrepository/src/utils/absolutePath.ts | 3 +++ .../modelsrepository/src/utils/fetcherFilesystem.browser.ts | 3 +++ sdk/iot/modelsrepository/src/utils/normalize.browser.ts | 6 ++++++ sdk/iot/modelsrepository/src/utils/normalize.ts | 4 ++++ 6 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 sdk/iot/modelsrepository/src/utils/normalize.browser.ts create mode 100644 sdk/iot/modelsrepository/src/utils/normalize.ts diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index 174e7b87126e..afd5ce8031e3 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -15,10 +15,10 @@ import { } from "./internal"; import * as cnst from "./constants"; import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; -import * as path from "path"; import { Fetcher } from "./fetcherAbstract"; import { URL } from "./utils/url"; import { isLocalPath } from "./utils/absolutePath"; +import { normalize } from "./utils/normalize"; /** * Initializes a new instance of the IoT Models Repository Client. @@ -129,7 +129,7 @@ export class ModelsRepositoryClient { if (isLocalPath(location)) { // POSIX Filesystem Path or Windows Filesystem Path logger.info(`Repository location identified as filesystem path - using FilesystemFetcher`); - fetcher = new FilesystemFetcher(path.normalize(location)); + fetcher = new FilesystemFetcher(normalize(location)); } else { locationURL = new URL(location); const prot = locationURL.protocol; diff --git a/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts b/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts index 3a9592d2667a..79bec47376fd 100644 --- a/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts +++ b/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts @@ -1,4 +1,5 @@ - +// Copyright (c) Microsoft. +// Licensed under the MIT license. export function isLocalPath() { return false; diff --git a/sdk/iot/modelsrepository/src/utils/absolutePath.ts b/sdk/iot/modelsrepository/src/utils/absolutePath.ts index 38eb9edb7133..6a11161348d6 100644 --- a/sdk/iot/modelsrepository/src/utils/absolutePath.ts +++ b/sdk/iot/modelsrepository/src/utils/absolutePath.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + import {isAbsolute} from "path"; export function isLocalPath(p: string): boolean { diff --git a/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts b/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts index 0fe0fce0061e..283d7b727fed 100644 --- a/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts +++ b/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + export class FilesystemFetcher { constructor() { throw new Error("FilesystemFetcher is not supported in browser"); diff --git a/sdk/iot/modelsrepository/src/utils/normalize.browser.ts b/sdk/iot/modelsrepository/src/utils/normalize.browser.ts new file mode 100644 index 000000000000..eef26b31a8c1 --- /dev/null +++ b/sdk/iot/modelsrepository/src/utils/normalize.browser.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +export function normalize(text: string) { + return text; +} \ No newline at end of file diff --git a/sdk/iot/modelsrepository/src/utils/normalize.ts b/sdk/iot/modelsrepository/src/utils/normalize.ts new file mode 100644 index 000000000000..66fee02c9d68 --- /dev/null +++ b/sdk/iot/modelsrepository/src/utils/normalize.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +export { normalize as normalize } from "path"; From b006c907bb989fa13f13c86f5a68fcab83d828ba Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Wed, 19 May 2021 10:00:48 -0700 Subject: [PATCH 52/81] fix --- sdk/iot/modelsrepository/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index d81652fb4cbb..60904864a187 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -9,7 +9,8 @@ "./dist-esm/src/print.js": "./dist-esm/src/print.browser.js", "./dist-esm/src/utils/url.js": "./dist-esm/src/utils/url.browser.js", "./dist-esm/src/utils/absolutePath.js": "./dist-esm/src/utils/absolutePath.browser.js", - "./dist-esm/src/fetcherFilesystem.js": "./dist-esm/src/utils/fetcherFilesystem.browser.js" + "./dist-esm/src/fetcherFilesystem.js": "./dist-esm/src/utils/fetcherFilesystem.browser.js", + "./dist-esm/src/normalize.js": "./dist-esm/src/utils/normalize.browser.js" }, "types": "types/iot-models-repository.d.ts", "scripts": { From 5d836c382606d1d79646bc6c45cc46cc7d851262 Mon Sep 17 00:00:00 2001 From: Christopher Radek Date: Wed, 19 May 2021 11:35:20 -0700 Subject: [PATCH 53/81] remove circular dependencies and fix mappings --- sdk/iot/modelsrepository/package.json | 5 ++-- sdk/iot/modelsrepository/src/dtmiResolver.ts | 25 +++++++++++----- .../modelsrepository/src/fetcherAbstract.ts | 2 +- .../modelsrepository/src/fetcherFilesystem.ts | 12 ++++---- sdk/iot/modelsrepository/src/index.ts | 29 +++++++++---------- .../src/interfaces/getModelsOptions.ts | 6 ++-- .../modelsRepositoryClientOptions.ts | 5 ++-- sdk/iot/modelsrepository/src/internal.ts | 16 ---------- .../src/modelsRepositoryClient.ts | 22 +++++++------- .../src/modelsRepositoryServiceClient.ts | 2 +- ...ath.browser.ts => absolutePath.browser.ts} | 0 11 files changed, 56 insertions(+), 68 deletions(-) rename sdk/iot/modelsrepository/src/utils/{aboslutePath.browser.ts => absolutePath.browser.ts} (100%) diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index 60904864a187..a654b896df84 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -10,7 +10,7 @@ "./dist-esm/src/utils/url.js": "./dist-esm/src/utils/url.browser.js", "./dist-esm/src/utils/absolutePath.js": "./dist-esm/src/utils/absolutePath.browser.js", "./dist-esm/src/fetcherFilesystem.js": "./dist-esm/src/utils/fetcherFilesystem.browser.js", - "./dist-esm/src/normalize.js": "./dist-esm/src/utils/normalize.browser.js" + "./dist-esm/src/utils/normalize.js": "./dist-esm/src/utils/normalize.browser.js" }, "types": "types/iot-models-repository.d.ts", "scripts": { @@ -133,7 +133,6 @@ "azure", "azure-iot-modelsrepository" ], - "requiredResources": { - } + "requiredResources": {} } } diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index 16440b26cc00..93f5da6f26ec 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -2,36 +2,45 @@ // Licensed under the MIT license. import { OperationOptions } from "@azure/core-client"; +import { DTDL } from "./DTDL"; +import { convertDtmiToPath } from "./dtmiConventions"; +import { ModelError } from "./exceptions"; import { Fetcher } from "./fetcherAbstract"; -import { convertDtmiToPath, DTDL, logger, ModelError } from "./internal"; +import { logger } from "./logger"; /** * DtmiResolver handles reformatting the DTMIs to paths and passing options down to the configured fetcher. - * @internal -*/ + * @internal + */ export class DtmiResolver { private _fetcher: Fetcher; constructor(fetcher: Fetcher) { this._fetcher = fetcher; } - async resolve(dtmis: string[], expandedModel: boolean, options?: OperationOptions): Promise<{[dtmi: string]: DTDL}> { + async resolve( + dtmis: string[], + expandedModel: boolean, + options?: OperationOptions + ): Promise<{ [dtmi: string]: DTDL }> { const modelMap: any = {}; const dtdlPromises = dtmis.map(async (dtmi) => { const dtdlPath = convertDtmiToPath(dtmi, expandedModel); logger.info(`Model ${dtmi} located in repository at ${dtdlPath}`); - const dtdl = await this._fetcher.fetch(dtdlPath, options) + const dtdl = await this._fetcher.fetch(dtdlPath, options); if (expandedModel) { if (Array.isArray(dtdl)) { - const modelIds: string[] = (dtdl as any[]).map((model:any) => model["@id"]); + const modelIds: string[] = (dtdl as any[]).map((model: any) => model["@id"]); if (!modelIds.includes(dtmi)) { - throw new ModelError(`DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${modelIds}`); + throw new ModelError( + `DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${modelIds}` + ); } for (const model of dtdl) { modelMap[model["@id"]] = model; } } else { - throw new ModelError('Expanded format should always return an array of models.'); + throw new ModelError("Expanded format should always return an array of models."); } } else { const model = dtdl as DTDL; diff --git a/sdk/iot/modelsrepository/src/fetcherAbstract.ts b/sdk/iot/modelsrepository/src/fetcherAbstract.ts index ed95a5942e08..d954da29c9bd 100644 --- a/sdk/iot/modelsrepository/src/fetcherAbstract.ts +++ b/sdk/iot/modelsrepository/src/fetcherAbstract.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { OperationOptions } from "@azure/core-client"; -import { DTDL } from "./internal"; +import { DTDL } from "./DTDL"; /** * @internal diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index 996ace7418b5..f4313d2e35fc 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -3,8 +3,10 @@ import fs from "fs"; import * as path from "path"; -import { Fetcher, DTDL, logger } from "./internal"; -import {RestError, RestErrorOptions} from '@azure/core-rest-pipeline'; +import { RestError, RestErrorOptions } from "@azure/core-rest-pipeline"; +import { Fetcher } from "./fetcherAbstract"; +import { logger } from "./logger"; +import { DTDL } from "./DTDL"; function readFilePromise(path: string): Promise { return new Promise((res, rej) => { @@ -36,10 +38,10 @@ export class FilesystemFetcher implements Fetcher { return parsedDtdl; } catch (e) { // TODO: Is there a ResourceNotFound Error for Filesystem + Http (Generic API for errors) - const options : RestErrorOptions = { - code: 'ResourceNotFound', + const options: RestErrorOptions = { + code: "ResourceNotFound", statusCode: e?.status - } + }; throw new RestError("Failed to fetch from Filesystem", options); } } diff --git a/sdk/iot/modelsrepository/src/index.ts b/sdk/iot/modelsrepository/src/index.ts index a647cc446a2a..2e931dbe3514 100644 --- a/sdk/iot/modelsrepository/src/index.ts +++ b/sdk/iot/modelsrepository/src/index.ts @@ -4,13 +4,13 @@ /** * This is the ModelsRepositoryClient Library for Javascript. * Why Models and not Model? Because there's more than one Model. - * + * * @remarks * This ModelsRepositoryClient is built around getting DTDL Models from a user-specified * location. The two main variables are the repositoryLocation, which is a path or URI to either a remote - * or local repository where the models are located, and the dtmis, which can be one or more dtmis that + * or local repository where the models are located, and the dtmis, which can be one or more dtmis that * will be mapped to specific models contained in the repository location that the user wishes to get. - * + * * @example * Inline code: * ```typescript @@ -19,30 +19,27 @@ * * const repositoryEndpoint = "devicemodels.azure.com"; * const dtmi = process.argv[2] || "dtmi:azure:DeviceManagement:DeviceInformation;1"; - * + * * console.log(repositoryEndpoint, dtmi); - * + * * async function main() { * const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); * const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); * console.log(result); * } - * + * * main().catch((err) => { * console.error("The sample encountered an error:", err); * }); * * ``` - * + * * @packageDocumentation */ -export { - ModelsRepositoryClient, - ModelsRepositoryClientOptions, - GetModelsOptions, - dependencyResolutionType, - isValidDtmi, - getModelUri, - ModelError -} from "./internal"; +export { ModelsRepositoryClient } from "./modelsRepositoryClient"; +export { GetModelsOptions } from "./interfaces/getModelsOptions"; +export { ModelsRepositoryClientOptions } from "./interfaces/modelsRepositoryClientOptions"; +export { dependencyResolutionType } from "./dependencyResolutionType"; +export { ModelError } from "./exceptions"; +export { getModelUri, isValidDtmi } from "./dtmiConventions"; diff --git a/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts b/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts index c2dafb639b4c..949ffed8fd48 100644 --- a/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts +++ b/sdk/iot/modelsrepository/src/interfaces/getModelsOptions.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { OperationOptions } from "@azure/core-client"; -import { dependencyResolutionType } from "../internal"; +import { dependencyResolutionType } from "../dependencyResolutionType"; /** * Options for getting models. @@ -10,8 +10,8 @@ import { dependencyResolutionType } from "../internal"; export interface GetModelsOptions extends OperationOptions { /** * This is the format of dependency resolution (no dependency resolution, standard dependency - * resolution, resolution using the expanded json format) that will be used when retrieving - * models. This overwrites the default dependencyResolution settings of the client. + * resolution, resolution using the expanded json format) that will be used when retrieving + * models. This overwrites the default dependencyResolution settings of the client. */ dependencyResolution?: dependencyResolutionType; } diff --git a/sdk/iot/modelsrepository/src/interfaces/modelsRepositoryClientOptions.ts b/sdk/iot/modelsrepository/src/interfaces/modelsRepositoryClientOptions.ts index 5d679993df77..2a0204945679 100644 --- a/sdk/iot/modelsrepository/src/interfaces/modelsRepositoryClientOptions.ts +++ b/sdk/iot/modelsrepository/src/interfaces/modelsRepositoryClientOptions.ts @@ -2,8 +2,7 @@ // Licensed under the MIT license. import { CommonClientOptions } from "@azure/core-client"; -import { dependencyResolutionType } from "../internal"; - +import { dependencyResolutionType } from "../dependencyResolutionType"; /** * Options for creating a Pipeline to use with ModelsRepositoryClient. @@ -23,7 +22,7 @@ export interface ModelsRepositoryClientOptions extends CommonClientOptions { /** * This is the format of dependency resolution (no dependency resolution, standard dependency - * resolution, resolution using the expanded json format) that will be used when retrieving + * resolution, resolution using the expanded json format) that will be used when retrieving * models. */ dependencyResolution?: dependencyResolutionType; diff --git a/sdk/iot/modelsrepository/src/internal.ts b/sdk/iot/modelsrepository/src/internal.ts index bf0b66126c2d..e69de29bb2d1 100644 --- a/sdk/iot/modelsrepository/src/internal.ts +++ b/sdk/iot/modelsrepository/src/internal.ts @@ -1,16 +0,0 @@ -export * from './modelsRepositoryClient'; -export * from './constants'; -export * from './dependencyResolutionType'; -export * from './dtmiConventions'; -export * from './fetcherAbstract'; -export * from './fetcherFilesystem'; -export * from './fetcherHTTP'; -export * from './modelsRepositoryServiceClient'; -export * from './logger'; -export * from './psuedoParser'; -export * from './dtmiResolver'; - -export * from './interfaces/getModelsOptions'; -export * from './interfaces/modelsRepositoryClientOptions'; -export * from './DTDL'; -export * from './exceptions'; diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index afd5ce8031e3..f092eb93bd7c 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -1,24 +1,22 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { - GetModelsOptions, - IoTModelsRepositoryServiceClient, - ModelsRepositoryClientOptions, - dependencyResolutionType, - HttpFetcher, - FilesystemFetcher, - PseudoParser, - DtmiResolver, - logger, - DTDL -} from "./internal"; import * as cnst from "./constants"; import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; import { Fetcher } from "./fetcherAbstract"; import { URL } from "./utils/url"; import { isLocalPath } from "./utils/absolutePath"; import { normalize } from "./utils/normalize"; +import { FilesystemFetcher } from "./fetcherFilesystem"; +import { dependencyResolutionType } from "./dependencyResolutionType"; +import { DtmiResolver } from "./dtmiResolver"; +import { PseudoParser } from "./psuedoParser"; +import { ModelsRepositoryClientOptions } from "./interfaces/modelsRepositoryClientOptions"; +import { logger } from "./logger"; +import { IoTModelsRepositoryServiceClient } from "./modelsRepositoryServiceClient"; +import { HttpFetcher } from "./fetcherHTTP"; +import { GetModelsOptions } from "./interfaces/getModelsOptions"; +import { DTDL } from "./DTDL"; /** * Initializes a new instance of the IoT Models Repository Client. diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts index 22d8e8947cb4..fe0c57430fc8 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { ServiceClientOptions, ServiceClient } from "@azure/core-client"; -import { DEFAULT_API_VERSION } from "./internal"; +import { DEFAULT_API_VERSION } from "./constants"; interface IoTModelsRepositoryServiceClientOptions extends ServiceClientOptions { version?: string; diff --git a/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts b/sdk/iot/modelsrepository/src/utils/absolutePath.browser.ts similarity index 100% rename from sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts rename to sdk/iot/modelsrepository/src/utils/absolutePath.browser.ts From 92f6998840e9c9b0f6965e0427c4c37ae6271f09 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Wed, 19 May 2021 11:46:54 -0700 Subject: [PATCH 54/81] fix dependency --- sdk/iot/modelsrepository/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index a654b896df84..452c4098a1e2 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -68,7 +68,7 @@ "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", "dependencies": { "@azure/core-client": "^1.0.0", - "@azure/core-rest-pipeline": "^1.0.0", + "@azure/core-rest-pipeline": "^1.0.3", "@azure/core-tracing": "1.0.0-preview.11", "@azure/logger": "^1.0.0", "events": "^3.0.0", From 1702077928121ff3328ce567829f2825733607cf Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Wed, 19 May 2021 13:52:10 -0700 Subject: [PATCH 55/81] fix browser tst --- sdk/iot/modelsrepository/test/browser/browserTest.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts b/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts index 289d2d8e86ab..1a3817756b64 100644 --- a/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts +++ b/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts @@ -13,7 +13,8 @@ describe("resolver - browser", () => { const result = client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" }); result .then((actualOutput: any) => { - expect(actualOutput).to.equal("test"); + expect(actualOutput["dtmi:azure:DeviceManagement:DeviceInformation;1"]).to.exist; + expect(actualOutput["dtmi:azure:DeviceManagement:DeviceInformation;1"]["@id"]).to.equal("dtmi:azure:DeviceManagement:DeviceInformation;1"); done(); }) .catch((err: any) => done(err)); From c9300eb875fdd7a37ef59841460b7164de9a6b1b Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 06:52:17 -0700 Subject: [PATCH 56/81] fix links --- sdk/iot/modelsrepository/HOW_TO_USE.md | 4 ++-- sdk/iot/modelsrepository/README.md | 2 +- sdk/iot/modelsrepository/samples/v0/javascript/README.md | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sdk/iot/modelsrepository/HOW_TO_USE.md b/sdk/iot/modelsrepository/HOW_TO_USE.md index 62fb6c097a45..09886136c4f9 100644 --- a/sdk/iot/modelsrepository/HOW_TO_USE.md +++ b/sdk/iot/modelsrepository/HOW_TO_USE.md @@ -19,8 +19,8 @@ For more info about the Azure IoT Models Repository checkout the [docs](https:// | **File Name** | **Description** | | ----------------------------------- | --------------- | -| [modelResolutionSample.ts](./samples/v0/typescript/src/modelResolutionSample.ts) | sample model getting | -| [dtmiConventionsSample.ts](./samples/v0/typescript/src/dtmiConventionsSample.ts) | sample using dtmi conventions helpers | +| modelResolutionSample.ts | sample model getting | +| dtmiConventionsSample.ts | sample using dtmi conventions helpers | ## Introduction diff --git a/sdk/iot/modelsrepository/README.md b/sdk/iot/modelsrepository/README.md index 88f9937a3b76..b3fa42391624 100644 --- a/sdk/iot/modelsrepository/README.md +++ b/sdk/iot/modelsrepository/README.md @@ -4,7 +4,7 @@ This package contains an isomorphic Client Library for Azure IoT Models Reposito [Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository) | [Package (npm)](https://www.npmjs.com/package/@azure/iot-modelsrepository/) | -[Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/iot-modelsrepository/samples) +Samples ------------------------------------- diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/README.md b/sdk/iot/modelsrepository/samples/v0/javascript/README.md index f0bb1f5fd5bf..8e3d97460919 100644 --- a/sdk/iot/modelsrepository/samples/v0/javascript/README.md +++ b/sdk/iot/modelsrepository/samples/v0/javascript/README.md @@ -53,10 +53,9 @@ npx cross-env node dtmiConventionsSample.js ## Next Steps -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. +Take a look at our API Documentation for more information about the APIs that are available in the clients. [dtmiconventionssample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js [modelresolutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js -[apiref]: https://docs.microsoft.com/javascript/api/@azure/iot-modelsrepository [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository/README.md From 1a16b3bf46f2779f6266882b5ac9408a9054c3b0 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 07:07:51 -0700 Subject: [PATCH 57/81] remove env --- sdk/iot/modelsrepository/samples/v0/javascript/sample.env | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 sdk/iot/modelsrepository/samples/v0/javascript/sample.env diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/sample.env b/sdk/iot/modelsrepository/samples/v0/javascript/sample.env deleted file mode 100644 index a52d9eb45f3b..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/javascript/sample.env +++ /dev/null @@ -1,6 +0,0 @@ -# Used in most samples. Retrieve these values from an instance in the Azure -# Portal. The APPCONFIG_TEST_SETTING_KEY value indicates which key to use -# when retrieving an example setting. - -APPCONFIG_ENDPOINT="https://.azconfig.io", -APPCONFIG_TEST_SETTING_KEY="" \ No newline at end of file From c8d840a1f363159e0eae0a8f4ecc70cc2de44a31 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 07:09:22 -0700 Subject: [PATCH 58/81] fix api ref link --- sdk/iot/modelsrepository/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index 452c4098a1e2..70b7844ebd37 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -133,6 +133,7 @@ "azure", "azure-iot-modelsrepository" ], - "requiredResources": {} + "requiredResources": {}, + "apiRefLink": "https://docs.microsoft.com/javascript/api/" } } From ed45199374977f6b745602efda88e5bb5400b93a Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 07:23:37 -0700 Subject: [PATCH 59/81] remove bad link --- sdk/iot/modelsrepository/samples/v0/typescript/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/README.md b/sdk/iot/modelsrepository/samples/v0/typescript/README.md index 33e98ae2ddff..99a9cc377250 100644 --- a/sdk/iot/modelsrepository/samples/v0/typescript/README.md +++ b/sdk/iot/modelsrepository/samples/v0/typescript/README.md @@ -65,11 +65,10 @@ npx cross-env node dist/dtmiConventionsSample.js ## Next Steps -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. +Take a look at our API Documentation for more information about the APIs that are available in the clients. [dtmiconventionssample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts [modelresolutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts -[apiref]: https://docs.microsoft.com/javascript/api/@azure/iot-modelsrepository [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository/README.md [typescript]: https://www.typescriptlang.org/docs/home.html From c61bdd5f7d0acda4d416dbe32b26d1e926aaefdd Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 08:57:35 -0700 Subject: [PATCH 60/81] fix --- sdk/iot/modelsrepository/.vscode/launch.json | 45 ------------------- sdk/iot/modelsrepository/CHANGELOG.md | 6 ++- sdk/iot/modelsrepository/package.json | 6 +-- .../samples/v0/javascript/README.md | 3 +- .../v0/javascript/modelResolutionSample.js | 2 +- .../{ => samples/v0/javascript}/sample.env | 0 .../samples/v0/typescript/README.md | 5 ++- .../typescript/src/modelResolutionSample.ts | 2 +- sdk/iot/modelsrepository/src/constants.ts | 6 ++- sdk/iot/modelsrepository/src/internal.ts | 0 10 files changed, 19 insertions(+), 56 deletions(-) delete mode 100644 sdk/iot/modelsrepository/.vscode/launch.json rename sdk/iot/modelsrepository/{ => samples/v0/javascript}/sample.env (100%) delete mode 100644 sdk/iot/modelsrepository/src/internal.ts diff --git a/sdk/iot/modelsrepository/.vscode/launch.json b/sdk/iot/modelsrepository/.vscode/launch.json deleted file mode 100644 index 0fdeded9567c..000000000000 --- a/sdk/iot/modelsrepository/.vscode/launch.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch Program", - "program": "${workspaceFolder}/samples/javascript/example.js", - "request": "launch", - "skipFiles": ["/**"], - "console": "integratedTerminal", - "type": "pwa-node" - }, - { - "name": "temp-unit-test", - "request": "launch", - "runtimeArgs": ["run", "temp-unit-test"], - "runtimeExecutable": "npm", - "skipFiles": ["/**"], - "console": "externalTerminal", - "type": "pwa-node" - }, - { - "type": "chrome", - "request": "attach", - "name": "Attach Karma Chrome", - "address": "localhost", - "port": 9876, - "pathMapping": { - "/": "${workspaceRoot}/", - "/base/": "${workspaceRoot}/" - } - }, - { - "type": "pwa-node", - "request": "launch", - "name": "Launch Test", - "skipFiles": ["/**"], - "program": "${workspaceFolder}\\test\\node\\index.spec.ts", - "preLaunchTask": "tsc: build - tsconfig.json", - "outFiles": ["${workspaceFolder}/out/**/*.js"] - } - ] -} diff --git a/sdk/iot/modelsrepository/CHANGELOG.md b/sdk/iot/modelsrepository/CHANGELOG.md index d1770ea08556..be614a1e3cd0 100644 --- a/sdk/iot/modelsrepository/CHANGELOG.md +++ b/sdk/iot/modelsrepository/CHANGELOG.md @@ -1,3 +1,7 @@ # Release History -CURRENTLY NO RELEASE HISTORY. TO BE FILLED IN AFTER FIRST RELEASE. +## 1.0.0-beta.1 (Unreleased) + +With [#14863](https://github.com/Azure/azure-sdk-for-js/pull/14863), this is the first release of the @azure/iot-modelsrepository package. + +This package contains the `ModelsRepositoryClient` to talk to the Azure Models Repository service, with initial support for getting models. Additionally, helper functions for working with DTMIs are provided. diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index 70b7844ebd37..a231a05f6a40 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -1,6 +1,6 @@ { "name": "@azure/iot-modelsrepository", - "version": "0.0.1", + "version": "1.0.0-beta.1", "description": "Device Model Repository Library with typescript type definitions for node.js and browser.", "sdk-type": "client", "main": "dist/index.js", @@ -45,9 +45,7 @@ "dist-esm/src/", "types/iot-models-repository.d.ts", "README.md", - "LICENSE", - "rollup.config.js", - "tsconfig.json" + "LICENSE" ], "repository": "github:Azure/azure-sdk-for-js", "engines": { diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/README.md b/sdk/iot/modelsrepository/samples/v0/javascript/README.md index 8e3d97460919..e1b3f7f35fd0 100644 --- a/sdk/iot/modelsrepository/samples/v0/javascript/README.md +++ b/sdk/iot/modelsrepository/samples/v0/javascript/README.md @@ -53,9 +53,10 @@ npx cross-env node dtmiConventionsSample.js ## Next Steps -Take a look at our API Documentation for more information about the APIs that are available in the clients. +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. [dtmiconventionssample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js [modelresolutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js +[apiref]: https://docs.microsoft.com/javascript/api/ [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository/README.md diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js b/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js index 6d85e8e79039..7077dff696f0 100644 --- a/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js +++ b/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js @@ -7,7 +7,7 @@ const { ModelsRepositoryClient } = require("@azure/iot-modelsrepository"); -const repositoryEndpoint = "http://www.devicemodels.azure.com"; +const repositoryEndpoint = "https://devicemodels.azure.com"; const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; console.log(repositoryEndpoint, dtmi); diff --git a/sdk/iot/modelsrepository/sample.env b/sdk/iot/modelsrepository/samples/v0/javascript/sample.env similarity index 100% rename from sdk/iot/modelsrepository/sample.env rename to sdk/iot/modelsrepository/samples/v0/javascript/sample.env diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/README.md b/sdk/iot/modelsrepository/samples/v0/typescript/README.md index 99a9cc377250..42ee5eafaea9 100644 --- a/sdk/iot/modelsrepository/samples/v0/typescript/README.md +++ b/sdk/iot/modelsrepository/samples/v0/typescript/README.md @@ -54,7 +54,7 @@ npm run build 4. Run whichever samples you like (note that some samples may require additional setup, see the table above): ```bash -node dist/dtmiConventionsSample.ts +node dist/dtmiConventionsSample.js ``` Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): @@ -65,10 +65,11 @@ npx cross-env node dist/dtmiConventionsSample.js ## Next Steps -Take a look at our API Documentation for more information about the APIs that are available in the clients. +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. [dtmiconventionssample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts [modelresolutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/ [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository/README.md [typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts b/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts index cfd211aebcba..56f271d997e8 100644 --- a/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts +++ b/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts @@ -7,7 +7,7 @@ import {ModelsRepositoryClient} from "@azure/iot-modelsrepository"; -const repositoryEndpoint = "http://www.devicemodels.azure.com"; +const repositoryEndpoint = "https://devicemodels.azure.com"; const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; console.log(repositoryEndpoint, dtmi); diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts index 3cff837f8b40..1d7037a6f383 100644 --- a/sdk/iot/modelsrepository/src/constants.ts +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -1,12 +1,16 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. +const fs = require('fs'); + +const pkg = fs.readFileSync('./databases.json', 'utf8'); + const isBrowser = new Function("try {return this===self;}catch(e){ return false;}"); const isNode = new Function("try {return this===global;}catch(e){return false;}"); const currentPlatform = isBrowser ? "browser" : isNode ? "node" : "undefined"; -export const SDK_VERSION = "0.0.0-preview"; +export const SDK_VERSION = pkg.version; export const DEFAULT_USER_AGENT = `azsdk-node-modelsrepository/${SDK_VERSION} (${currentPlatform})`; export const DEFAULT_REPOSITORY_LOCATION = "https://devicemodels.azure.com"; export const DEFAULT_API_VERSION = "2021-02-11"; diff --git a/sdk/iot/modelsrepository/src/internal.ts b/sdk/iot/modelsrepository/src/internal.ts deleted file mode 100644 index e69de29bb2d1..000000000000 From b3a9d2e4f367966470dd1d2adeb3da1931978249 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 09:00:02 -0700 Subject: [PATCH 61/81] samples --- sdk/iot/modelsrepository/sample.env | 0 .../samples/v1/javascript/README.md | 62 +++++++++++++++ .../v1/javascript/dtmiConventionsSample.js | 34 +++++++++ .../v1/javascript/modelResolutionSample.js | 35 +++++++++ .../samples/v1/javascript/package.json | 29 +++++++ .../samples/v1/javascript/sample.env | 0 .../samples/v1/typescript/README.md | 75 +++++++++++++++++++ .../samples/v1/typescript/package.json | 37 +++++++++ .../samples/v1/typescript/sample.env | 0 .../typescript/src/dtmiConventionsSample.ts | 29 +++++++ .../typescript/src/modelResolutionSample.ts | 35 +++++++++ .../samples/v1/typescript/tsconfig.json | 17 +++++ 12 files changed, 353 insertions(+) create mode 100644 sdk/iot/modelsrepository/sample.env create mode 100644 sdk/iot/modelsrepository/samples/v1/javascript/README.md create mode 100644 sdk/iot/modelsrepository/samples/v1/javascript/dtmiConventionsSample.js create mode 100644 sdk/iot/modelsrepository/samples/v1/javascript/modelResolutionSample.js create mode 100644 sdk/iot/modelsrepository/samples/v1/javascript/package.json create mode 100644 sdk/iot/modelsrepository/samples/v1/javascript/sample.env create mode 100644 sdk/iot/modelsrepository/samples/v1/typescript/README.md create mode 100644 sdk/iot/modelsrepository/samples/v1/typescript/package.json create mode 100644 sdk/iot/modelsrepository/samples/v1/typescript/sample.env create mode 100644 sdk/iot/modelsrepository/samples/v1/typescript/src/dtmiConventionsSample.ts create mode 100644 sdk/iot/modelsrepository/samples/v1/typescript/src/modelResolutionSample.ts create mode 100644 sdk/iot/modelsrepository/samples/v1/typescript/tsconfig.json diff --git a/sdk/iot/modelsrepository/sample.env b/sdk/iot/modelsrepository/sample.env new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sdk/iot/modelsrepository/samples/v1/javascript/README.md b/sdk/iot/modelsrepository/samples/v1/javascript/README.md new file mode 100644 index 000000000000..1ae1ada683ce --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v1/javascript/README.md @@ -0,0 +1,62 @@ +--- +page_type: sample +languages: + - javascript +products: + - azure + - azure-iot-modelsrepository +urlFragment: iot-modelsrepository-javascript +--- + +# Azure IoT Models Repository client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for Azure IoT Models Repository in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| [dtmiConventionsSample.js][dtmiconventionssample] | Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. | +| [modelResolutionSample.js][modelresolutionsample] | Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. | + +## Prerequisites + +The sample programs are compatible with Node.js >=12.0.0. + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dtmiConventionsSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dtmiConventionsSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[dtmiconventionssample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v1/javascript/dtmiConventionsSample.js +[modelresolutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v1/javascript/modelResolutionSample.js +[apiref]: https://docs.microsoft.com/javascript/api/ +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository/README.md diff --git a/sdk/iot/modelsrepository/samples/v1/javascript/dtmiConventionsSample.js b/sdk/iot/modelsrepository/samples/v1/javascript/dtmiConventionsSample.js new file mode 100644 index 000000000000..55a3042a9411 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v1/javascript/dtmiConventionsSample.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +/** + * @summary Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. + */ + +const { getModelUri, isValidDtmi } = require("@azure/iot-modelsrepository"); + +function main() { + const dtmi1 = "dtmi:com:example:Thermostat;1"; + const dtmi2 = "dtmi:com:example:Thermostat"; + // returns true + const result1 = isValidDtmi(dtmi1); + console.log(`${dtmi1} is valid? ${result1}`); + + // returns false + const result2 = isValidDtmi(dtmi2); + console.log(`${dtmi2} is valid? ${result2}`); + // local repository fully qualified path to a model file + const fullyQualifiedLocalPath = getModelUri( + "dtmi:com:example:Thermostat;1", + "file:///path/to/repository/" + ); + console.log(fullyQualifiedLocalPath); + + const fullyQualifiedRemotePath = getModelUri( + "dtmi:com:example:Thermostat;1", + "https://contoso.com/models" + ); + console.log(fullyQualifiedRemotePath); +} + +main(); diff --git a/sdk/iot/modelsrepository/samples/v1/javascript/modelResolutionSample.js b/sdk/iot/modelsrepository/samples/v1/javascript/modelResolutionSample.js new file mode 100644 index 000000000000..7077dff696f0 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v1/javascript/modelResolutionSample.js @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +/** + * @summary Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. + */ + +const { ModelsRepositoryClient } = require("@azure/iot-modelsrepository"); + +const repositoryEndpoint = "https://devicemodels.azure.com"; +const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + +console.log(repositoryEndpoint, dtmi); + +async function main() { + // When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint + // https://devicemodels.azure.com/ is used and the model dependency resolution + // configuration is set to TryFromExpanded. + const client = new ModelsRepositoryClient({ repositoryLocation: repositoryEndpoint }); + const result = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" }); + Object.keys(result).forEach((fetchedDtmi) => { + const currentDtdl = result[fetchedDtmi]; + console.log("------------------------------------------------"); + console.log(`DTMI is: ${fetchedDtmi}`); + console.log(`DTDL Display Name is: ${currentDtdl.displayName}`); + console.log(`DTDL Description is: ${currentDtdl.description}`); + console.log("------------------------------------------------"); + console.log(JSON.stringify(result[fetchedDtmi])); + console.log("------------------------------------------------"); + }); +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/iot/modelsrepository/samples/v1/javascript/package.json b/sdk/iot/modelsrepository/samples/v1/javascript/package.json new file mode 100644 index 000000000000..a7c75abd7f30 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v1/javascript/package.json @@ -0,0 +1,29 @@ +{ + "name": "azure-iot-modelsrepository-samples-js", + "private": true, + "version": "1.0.0", + "description": "Azure IoT Models Repository client library samples for JavaScript", + "engine": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/iot/modelsrepository" + }, + "keywords": [ + "azure", + "cloud", + "typescript" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository", + "dependencies": { + "@azure/iot-modelsrepository": "next", + "dotenv": "latest" + } +} diff --git a/sdk/iot/modelsrepository/samples/v1/javascript/sample.env b/sdk/iot/modelsrepository/samples/v1/javascript/sample.env new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sdk/iot/modelsrepository/samples/v1/typescript/README.md b/sdk/iot/modelsrepository/samples/v1/typescript/README.md new file mode 100644 index 000000000000..fa00798356d4 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v1/typescript/README.md @@ -0,0 +1,75 @@ +--- +page_type: sample +languages: + - typescript +products: + - azure + - azure-iot-modelsrepository +urlFragment: iot-modelsrepository-typescript +--- + +# Azure IoT Models Repository client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for Azure IoT Models Repository in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| [dtmiConventionsSample.ts][dtmiconventionssample] | Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. | +| [modelResolutionSample.ts][modelresolutionsample] | Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. | + +## Prerequisites + +The sample programs are compatible with Node.js >=12.0.0. + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/dtmiConventionsSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/dtmiConventionsSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[dtmiconventionssample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v1/typescript/src/dtmiConventionsSample.ts +[modelresolutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v1/typescript/src/modelResolutionSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/ +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/iot/modelsrepository/samples/v1/typescript/package.json b/sdk/iot/modelsrepository/samples/v1/typescript/package.json new file mode 100644 index 000000000000..4ff9960d1be1 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v1/typescript/package.json @@ -0,0 +1,37 @@ +{ + "name": "azure-iot-modelsrepository-samples-ts", + "private": true, + "version": "1.0.0", + "description": "Azure IoT Models Repository client library samples for TypeScript", + "engine": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/iot/modelsrepository" + }, + "keywords": [ + "azure", + "cloud", + "typescript" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository", + "dependencies": { + "@azure/iot-modelsrepository": "next", + "dotenv": "latest" + }, + "devDependencies": { + "typescript": "~4.2.0", + "rimraf": "latest" + } +} diff --git a/sdk/iot/modelsrepository/samples/v1/typescript/sample.env b/sdk/iot/modelsrepository/samples/v1/typescript/sample.env new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sdk/iot/modelsrepository/samples/v1/typescript/src/dtmiConventionsSample.ts b/sdk/iot/modelsrepository/samples/v1/typescript/src/dtmiConventionsSample.ts new file mode 100644 index 000000000000..eb8f758f70c5 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v1/typescript/src/dtmiConventionsSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +/** + * @summary Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. + */ + +import {getModelUri, isValidDtmi} from "@azure/iot-modelsrepository"; + +function main() { + + const dtmi1 = "dtmi:com:example:Thermostat;1"; + const dtmi2 = "dtmi:com:example:Thermostat" + // returns true + const result1 = isValidDtmi(dtmi1); + console.log(`${dtmi1} is valid? ${result1}`); + + // returns false + const result2 = isValidDtmi(dtmi2); + console.log(`${dtmi2} is valid? ${result2}`); + // local repository fully qualified path to a model file + const fullyQualifiedLocalPath = getModelUri("dtmi:com:example:Thermostat;1", "file:///path/to/repository/"); + console.log(fullyQualifiedLocalPath); + + const fullyQualifiedRemotePath = getModelUri("dtmi:com:example:Thermostat;1", "https://contoso.com/models"); + console.log(fullyQualifiedRemotePath); +} + +main(); \ No newline at end of file diff --git a/sdk/iot/modelsrepository/samples/v1/typescript/src/modelResolutionSample.ts b/sdk/iot/modelsrepository/samples/v1/typescript/src/modelResolutionSample.ts new file mode 100644 index 000000000000..56f271d997e8 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v1/typescript/src/modelResolutionSample.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +/** + * @summary Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. + */ + +import {ModelsRepositoryClient} from "@azure/iot-modelsrepository"; + +const repositoryEndpoint = "https://devicemodels.azure.com"; +const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; + +console.log(repositoryEndpoint, dtmi); + +async function main() { + // When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint + // https://devicemodels.azure.com/ is used and the model dependency resolution + // configuration is set to TryFromExpanded. + const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); + const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); + Object.keys(result).forEach((fetchedDtmi) => { + const currentDtdl = result[fetchedDtmi] as any; + console.log("------------------------------------------------"); + console.log(`DTMI is: ${fetchedDtmi}`); + console.log(`DTDL Display Name is: ${currentDtdl.displayName}`); + console.log(`DTDL Description is: ${currentDtdl.description}`); + console.log("------------------------------------------------"); + console.log(JSON.stringify(result[fetchedDtmi])); + console.log("------------------------------------------------"); + }); +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/iot/modelsrepository/samples/v1/typescript/tsconfig.json b/sdk/iot/modelsrepository/samples/v1/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/iot/modelsrepository/samples/v1/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} From 3bc841a3d0d8f906196736ed968345597c7f4641 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 09:12:41 -0700 Subject: [PATCH 62/81] remove v0 samples --- .../samples/v0/javascript/README.md | 62 --------------- .../v0/javascript/dtmiConventionsSample.js | 34 --------- .../v0/javascript/modelResolutionSample.js | 35 --------- .../samples/v0/javascript/package.json | 29 ------- .../samples/v0/javascript/sample.env | 6 -- .../samples/v0/typescript/README.md | 75 ------------------- .../samples/v0/typescript/package.json | 37 --------- .../samples/v0/typescript/sample.env | 6 -- .../typescript/src/dtmiConventionsSample.ts | 29 ------- .../typescript/src/modelResolutionSample.ts | 35 --------- .../samples/v0/typescript/tsconfig.json | 17 ----- 11 files changed, 365 deletions(-) delete mode 100644 sdk/iot/modelsrepository/samples/v0/javascript/README.md delete mode 100644 sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js delete mode 100644 sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js delete mode 100644 sdk/iot/modelsrepository/samples/v0/javascript/package.json delete mode 100644 sdk/iot/modelsrepository/samples/v0/javascript/sample.env delete mode 100644 sdk/iot/modelsrepository/samples/v0/typescript/README.md delete mode 100644 sdk/iot/modelsrepository/samples/v0/typescript/package.json delete mode 100644 sdk/iot/modelsrepository/samples/v0/typescript/sample.env delete mode 100644 sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts delete mode 100644 sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts delete mode 100644 sdk/iot/modelsrepository/samples/v0/typescript/tsconfig.json diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/README.md b/sdk/iot/modelsrepository/samples/v0/javascript/README.md deleted file mode 100644 index e1b3f7f35fd0..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/javascript/README.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -page_type: sample -languages: - - javascript -products: - - azure - - azure-iot-modelsrepository -urlFragment: iot-modelsrepository-javascript ---- - -# Azure IoT Models Repository client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for Azure IoT Models Repository in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| [dtmiConventionsSample.js][dtmiconventionssample] | Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. | -| [modelResolutionSample.js][modelresolutionsample] | Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. | - -## Prerequisites - -The sample programs are compatible with Node.js >=12.0.0. - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dtmiConventionsSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx cross-env node dtmiConventionsSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[dtmiconventionssample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js -[modelresolutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js -[apiref]: https://docs.microsoft.com/javascript/api/ -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository/README.md diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js b/sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js deleted file mode 100644 index 55a3042a9411..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/javascript/dtmiConventionsSample.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -/** - * @summary Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. - */ - -const { getModelUri, isValidDtmi } = require("@azure/iot-modelsrepository"); - -function main() { - const dtmi1 = "dtmi:com:example:Thermostat;1"; - const dtmi2 = "dtmi:com:example:Thermostat"; - // returns true - const result1 = isValidDtmi(dtmi1); - console.log(`${dtmi1} is valid? ${result1}`); - - // returns false - const result2 = isValidDtmi(dtmi2); - console.log(`${dtmi2} is valid? ${result2}`); - // local repository fully qualified path to a model file - const fullyQualifiedLocalPath = getModelUri( - "dtmi:com:example:Thermostat;1", - "file:///path/to/repository/" - ); - console.log(fullyQualifiedLocalPath); - - const fullyQualifiedRemotePath = getModelUri( - "dtmi:com:example:Thermostat;1", - "https://contoso.com/models" - ); - console.log(fullyQualifiedRemotePath); -} - -main(); diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js b/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js deleted file mode 100644 index 7077dff696f0..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/javascript/modelResolutionSample.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -/** - * @summary Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. - */ - -const { ModelsRepositoryClient } = require("@azure/iot-modelsrepository"); - -const repositoryEndpoint = "https://devicemodels.azure.com"; -const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - -console.log(repositoryEndpoint, dtmi); - -async function main() { - // When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint - // https://devicemodels.azure.com/ is used and the model dependency resolution - // configuration is set to TryFromExpanded. - const client = new ModelsRepositoryClient({ repositoryLocation: repositoryEndpoint }); - const result = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" }); - Object.keys(result).forEach((fetchedDtmi) => { - const currentDtdl = result[fetchedDtmi]; - console.log("------------------------------------------------"); - console.log(`DTMI is: ${fetchedDtmi}`); - console.log(`DTDL Display Name is: ${currentDtdl.displayName}`); - console.log(`DTDL Description is: ${currentDtdl.description}`); - console.log("------------------------------------------------"); - console.log(JSON.stringify(result[fetchedDtmi])); - console.log("------------------------------------------------"); - }); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/package.json b/sdk/iot/modelsrepository/samples/v0/javascript/package.json deleted file mode 100644 index 67d9a8f24ade..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/javascript/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "azure-iot-modelsrepository-samples-js", - "private": true, - "version": "1.0.0", - "description": "Azure IoT Models Repository client library samples for JavaScript", - "engine": { - "node": ">=12.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/iot/modelsrepository" - }, - "keywords": [ - "azure", - "cloud", - "typescript" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository", - "dependencies": { - "@azure/iot-modelsrepository": "latest", - "dotenv": "latest" - } -} diff --git a/sdk/iot/modelsrepository/samples/v0/javascript/sample.env b/sdk/iot/modelsrepository/samples/v0/javascript/sample.env deleted file mode 100644 index a52d9eb45f3b..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/javascript/sample.env +++ /dev/null @@ -1,6 +0,0 @@ -# Used in most samples. Retrieve these values from an instance in the Azure -# Portal. The APPCONFIG_TEST_SETTING_KEY value indicates which key to use -# when retrieving an example setting. - -APPCONFIG_ENDPOINT="https://.azconfig.io", -APPCONFIG_TEST_SETTING_KEY="" \ No newline at end of file diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/README.md b/sdk/iot/modelsrepository/samples/v0/typescript/README.md deleted file mode 100644 index 42ee5eafaea9..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/typescript/README.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -page_type: sample -languages: - - typescript -products: - - azure - - azure-iot-modelsrepository -urlFragment: iot-modelsrepository-typescript ---- - -# Azure IoT Models Repository client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for Azure IoT Models Repository in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| [dtmiConventionsSample.ts][dtmiconventionssample] | Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. | -| [modelResolutionSample.ts][modelresolutionsample] | Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. | - -## Prerequisites - -The sample programs are compatible with Node.js >=12.0.0. - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/dtmiConventionsSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx cross-env node dist/dtmiConventionsSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[dtmiconventionssample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts -[modelresolutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts -[apiref]: https://docs.microsoft.com/javascript/api/ -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/package.json b/sdk/iot/modelsrepository/samples/v0/typescript/package.json deleted file mode 100644 index e417a9dca48f..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/typescript/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "azure-iot-modelsrepository-samples-ts", - "private": true, - "version": "1.0.0", - "description": "Azure IoT Models Repository client library samples for TypeScript", - "engine": { - "node": ">=12.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/iot/modelsrepository" - }, - "keywords": [ - "azure", - "cloud", - "typescript" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iot/modelsrepository", - "dependencies": { - "@azure/iot-modelsrepository": "latest", - "dotenv": "latest" - }, - "devDependencies": { - "typescript": "~4.2.0", - "rimraf": "latest" - } -} diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/sample.env b/sdk/iot/modelsrepository/samples/v0/typescript/sample.env deleted file mode 100644 index a52d9eb45f3b..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/typescript/sample.env +++ /dev/null @@ -1,6 +0,0 @@ -# Used in most samples. Retrieve these values from an instance in the Azure -# Portal. The APPCONFIG_TEST_SETTING_KEY value indicates which key to use -# when retrieving an example setting. - -APPCONFIG_ENDPOINT="https://.azconfig.io", -APPCONFIG_TEST_SETTING_KEY="" \ No newline at end of file diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts b/sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts deleted file mode 100644 index eb8f758f70c5..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/typescript/src/dtmiConventionsSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -/** - * @summary Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. - */ - -import {getModelUri, isValidDtmi} from "@azure/iot-modelsrepository"; - -function main() { - - const dtmi1 = "dtmi:com:example:Thermostat;1"; - const dtmi2 = "dtmi:com:example:Thermostat" - // returns true - const result1 = isValidDtmi(dtmi1); - console.log(`${dtmi1} is valid? ${result1}`); - - // returns false - const result2 = isValidDtmi(dtmi2); - console.log(`${dtmi2} is valid? ${result2}`); - // local repository fully qualified path to a model file - const fullyQualifiedLocalPath = getModelUri("dtmi:com:example:Thermostat;1", "file:///path/to/repository/"); - console.log(fullyQualifiedLocalPath); - - const fullyQualifiedRemotePath = getModelUri("dtmi:com:example:Thermostat;1", "https://contoso.com/models"); - console.log(fullyQualifiedRemotePath); -} - -main(); \ No newline at end of file diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts b/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts deleted file mode 100644 index 56f271d997e8..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/typescript/src/modelResolutionSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -/** - * @summary Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. - */ - -import {ModelsRepositoryClient} from "@azure/iot-modelsrepository"; - -const repositoryEndpoint = "https://devicemodels.azure.com"; -const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; - -console.log(repositoryEndpoint, dtmi); - -async function main() { - // When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint - // https://devicemodels.azure.com/ is used and the model dependency resolution - // configuration is set to TryFromExpanded. - const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); - const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); - Object.keys(result).forEach((fetchedDtmi) => { - const currentDtdl = result[fetchedDtmi] as any; - console.log("------------------------------------------------"); - console.log(`DTMI is: ${fetchedDtmi}`); - console.log(`DTDL Display Name is: ${currentDtdl.displayName}`); - console.log(`DTDL Description is: ${currentDtdl.description}`); - console.log("------------------------------------------------"); - console.log(JSON.stringify(result[fetchedDtmi])); - console.log("------------------------------------------------"); - }); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/iot/modelsrepository/samples/v0/typescript/tsconfig.json b/sdk/iot/modelsrepository/samples/v0/typescript/tsconfig.json deleted file mode 100644 index 416c2dd82e00..000000000000 --- a/sdk/iot/modelsrepository/samples/v0/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2018", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**.ts" - ] -} From 9cd6f42c1107dbd8a530b14464ea20f30ac92a58 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 09:25:14 -0700 Subject: [PATCH 63/81] change constant --- sdk/iot/modelsrepository/src/constants.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts index 1d7037a6f383..cbe35f178476 100644 --- a/sdk/iot/modelsrepository/src/constants.ts +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -1,16 +1,12 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -const fs = require('fs'); - -const pkg = fs.readFileSync('./databases.json', 'utf8'); - const isBrowser = new Function("try {return this===self;}catch(e){ return false;}"); const isNode = new Function("try {return this===global;}catch(e){return false;}"); const currentPlatform = isBrowser ? "browser" : isNode ? "node" : "undefined"; -export const SDK_VERSION = pkg.version; +export const SDK_VERSION = "1.0.0-beta.1"; export const DEFAULT_USER_AGENT = `azsdk-node-modelsrepository/${SDK_VERSION} (${currentPlatform})`; export const DEFAULT_REPOSITORY_LOCATION = "https://devicemodels.azure.com"; export const DEFAULT_API_VERSION = "2021-02-11"; From c2a5da14d662b0f8bf25931bfdcfed9fcce21011 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 09:28:34 -0700 Subject: [PATCH 64/81] add const unit test --- .../test/node/unit/constants.spec.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 sdk/iot/modelsrepository/test/node/unit/constants.spec.ts diff --git a/sdk/iot/modelsrepository/test/node/unit/constants.spec.ts b/sdk/iot/modelsrepository/test/node/unit/constants.spec.ts new file mode 100644 index 000000000000..a60d3886fa2f --- /dev/null +++ b/sdk/iot/modelsrepository/test/node/unit/constants.spec.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import * as cnst from "../../../src/constants"; +import { readFileSync } from "fs"; +import { expect } from "chai"; +describe("constants", function () { + it("uses same version as package.json", function () { + const pkgjson = readFileSync("./package.json", "utf-8"); + const pkgjsonVersion = JSON.parse(pkgjson).version; + expect(cnst.SDK_VERSION).to.equal(pkgjsonVersion); + }) +}) \ No newline at end of file From 734bda02c5e59ef09d5a62ef78b16e8da69baa55 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 16:53:33 -0700 Subject: [PATCH 65/81] address comments --- sdk/iot/modelsrepository/CODE_STRUCTURE.md | 71 ------------------- sdk/iot/modelsrepository/HOW_TO_USE.md | 20 ------ sdk/iot/modelsrepository/README.md | 3 +- sdk/iot/modelsrepository/package.json | 5 +- sdk/iot/modelsrepository/src/constants.ts | 6 +- sdk/iot/modelsrepository/src/dtmiResolver.ts | 8 +-- sdk/iot/modelsrepository/src/exceptions.ts | 2 + .../modelsrepository/src/fetcherAbstract.ts | 2 +- .../modelsrepository/src/fetcherFilesystem.ts | 7 +- sdk/iot/modelsrepository/src/index.ts | 3 +- .../src/modelsRepositoryClient.ts | 21 +++--- sdk/iot/modelsrepository/src/psuedoParser.ts | 2 +- .../src/utils/absolutePath.browser.ts | 6 -- .../src/utils/absolutePath.ts | 8 --- .../modelsrepository/src/utils/normalize.ts | 4 -- .../{normalize.browser.ts => path.browser.ts} | 6 +- sdk/iot/modelsrepository/src/utils/path.ts | 10 +++ sdk/iot/modelsrepository/tsconfig.json | 2 +- 18 files changed, 46 insertions(+), 140 deletions(-) delete mode 100644 sdk/iot/modelsrepository/CODE_STRUCTURE.md delete mode 100644 sdk/iot/modelsrepository/src/utils/absolutePath.browser.ts delete mode 100644 sdk/iot/modelsrepository/src/utils/absolutePath.ts delete mode 100644 sdk/iot/modelsrepository/src/utils/normalize.ts rename sdk/iot/modelsrepository/src/utils/{normalize.browser.ts => path.browser.ts} (69%) create mode 100644 sdk/iot/modelsrepository/src/utils/path.ts diff --git a/sdk/iot/modelsrepository/CODE_STRUCTURE.md b/sdk/iot/modelsrepository/CODE_STRUCTURE.md deleted file mode 100644 index f9b2c45ed453..000000000000 --- a/sdk/iot/modelsrepository/CODE_STRUCTURE.md +++ /dev/null @@ -1,71 +0,0 @@ -## index.ts - -For all typescript files there should be an entrance point. That is `index.ts`. This file serves as a translation point per-se, since it should not have any 'logic' code in it. What is exported through this file defines the API of the resolver library. - -Though this is in a client folder, this is not really a client. It is a helper library. Because of the idiosynicatic differences between js, python, and C# (the currently implemented model repo 'clients'), C# is more like a client in that it has instantiation and a slightly different API. - -For js (aka Node), instantiation is not common unless for larger libraries, or where it makes sense to have instances. In this case, there's not strong motivation for instantiation. So the API is simple: - -```js -library.resolve(...) -``` - -This makes the use of our js library more convenient for users. - -## resolver.ts - -Contains the logic for defining the api for the `resolve` method. The implementation logic is not contained in this file. - -The `resolve` method takes two main arguments: - -- `dtmi (type: string)` - This is a user dtmi used for the dtdl the user intends to resolve. dtmi is a standard format, and if the dtmi provided does not follow the format it will be rejected. -- `endpoint (type:string)` - Can be a URL to a server endpoint, local or remote. Alternatively can be an _absolute_ file path, if the dtdl is stored locally. In most cases you will be interacting with the device models repository, so the endpoint will be `https://devicemodels.azure.com`, however we do not set defaults so there's no question about behavior. Simple is easier to understand! - -The `resolve` method has optional parameters provided as a single object. You would use it as such: - -```js -resolve(myDtmi, myEndpoint, { resolveDependencies: "disabled" }); -``` - -Currently there is only one parameter in the optional object: - -- `resolveDependencies (type: string)` - This is a useful way to get dependencies in one network call, and is recommended if you want to resolve the full dependency tree of a dtdl stored in the device model repository. These are the three options: - - `disabled` - - `enabled` - - `tryFroExpanded` - -## dtmiConventions.ts - -Contains methods for checking that the DTMI is valid, and to convert the DTMI to a string. This is currently private, however there are discussions around making these helper functions public parts of the API. - -#### `isValidDtmi` - -Validates if the provided dtmi matches the rules for a user dtmi. - -#### `dtmiToPath` - -Validates then converts the dtmi to a generic path. - -#### `dtmiToQualifiedPath` - -Validates the dtmi then converts the endpoint and dtmi to a fully qualified path. To get the `extended.json` version of a dtdl, there is a boolean parameter required. - -## DTDL.ts - -This is used to define an interface uesd in `dtmiConventions.ts`. Though it is an incomplete interface, it is just used to define the psuedo-parsing requirements. - -## modelFetcherHandler.ts - -This handles figuring out which fetcher to use based on the type of endpoint and the options given. It will check the endpoint to see if it is a remote URL or a local file. Then, it will pass the parameters either to the remote fetcher or the local fetcher. - -## localModelFetchers.ts - -This contains the local `fetcher()` method and the `recursiveFetcher()` method. The regular `fetcher()` method is called when resolverOptions are set to `disabled`, and also used as the basic unit of fetching from a directory for the `recursiveFetcher()`. The `localModelFetchers.ts` and `remoteModelFetchers.ts` are fairly similar, except for handling the formatting of the endpoint/directory, and the use of `filesystem` in the case of the `localModelFetchers`. - -## remoteModelFetchers.ts - -This contains the `fetcher()` method and the `recursiveFetcher()` method for fetching DTDLs from remote endpoints. It is similarly structured to `localModelFetchers.ts`. In order to perform the HTTP requests it uses the Azure `coreHttp` implementation. - -## modelMetadata.ts - -Performs a psuedo-parsing of a given DTDL and gives back information primarily relevant for fetching dependencies. diff --git a/sdk/iot/modelsrepository/HOW_TO_USE.md b/sdk/iot/modelsrepository/HOW_TO_USE.md index 09886136c4f9..7d0e780ee5eb 100644 --- a/sdk/iot/modelsrepository/HOW_TO_USE.md +++ b/sdk/iot/modelsrepository/HOW_TO_USE.md @@ -1,15 +1,3 @@ - - - - # Azure IoT Models Repository Samples The Azure IoT Models Repository enables builders to manage and share digital twin models for global consumption. The models are [JSON-LD](https://json-ld.org/) documents defined using the Digital Twins Definition Language [(DTDL)](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md). @@ -54,14 +42,6 @@ const client = new ModelsRepositoryClient({repositoryLocation: 'file:///path/to/ console.log(`Initialized client pointing to local path: ${client.repositoryLocation}`); ``` -## Override options - -If you need to override pipeline behavior, such as provide your own HttpClient instance, you can do that via constructor that takes a ModelsRepositoryClientOptions parameter. It provides an opportunity to override default behavior including: - -- Overriding [transport](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Pipeline.md) -- Enabling [diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Pipeline.md) -- Controlling [retry strategy](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Pipeline.md) - ## Publish Models Publishing models to the models repository requires [exercising](https://docs.microsoft.com/azure/iot-pnp/concepts-model-repository#publish-a-model) common GitHub workflows. diff --git a/sdk/iot/modelsrepository/README.md b/sdk/iot/modelsrepository/README.md index b3fa42391624..6dda1c3876c7 100644 --- a/sdk/iot/modelsrepository/README.md +++ b/sdk/iot/modelsrepository/README.md @@ -12,7 +12,7 @@ Samples ## Key concepts -The Azure IoT Models Repository library for JavaScript is written to interact with the Azure IoT PlugAndPlay Models Repository, for those developers who wish to write applications in JavaScript to do so. +The Azure IoT Models Repository library for JavaScript provides functionality for working with the [Azure IoT PlugAndPlay Models Repository](https://devicemodels.azure.com/). It does not provide full CRUD operations, simply the ability to get models from the Models Repository or any other URL endpoints. It does not require any authentication. ### Currently supported environments @@ -70,4 +70,3 @@ provided by the bot. You will only need to do this once across all repos using o This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. - diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index a231a05f6a40..ad241b2f3c9d 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -8,9 +8,8 @@ "browser": { "./dist-esm/src/print.js": "./dist-esm/src/print.browser.js", "./dist-esm/src/utils/url.js": "./dist-esm/src/utils/url.browser.js", - "./dist-esm/src/utils/absolutePath.js": "./dist-esm/src/utils/absolutePath.browser.js", - "./dist-esm/src/fetcherFilesystem.js": "./dist-esm/src/utils/fetcherFilesystem.browser.js", - "./dist-esm/src/utils/normalize.js": "./dist-esm/src/utils/normalize.browser.js" + "./dist-esm/src/utils/path.js": "./dist-esm/src/utils/path.browser.js", + "./dist-esm/src/fetcherFilesystem.js": "./dist-esm/src/utils/fetcherFilesystem.browser.js" }, "types": "types/iot-models-repository.d.ts", "scripts": { diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts index cbe35f178476..6c6775e42136 100644 --- a/sdk/iot/modelsrepository/src/constants.ts +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -const isBrowser = new Function("try {return this===self;}catch(e){ return false;}"); -const isNode = new Function("try {return this===global;}catch(e){return false;}"); +const isBrowser = () => { try {return this===self;}catch(e){ return false;}}; +const isNode = () => {try {return this===global;}catch(e){return false;}}; -const currentPlatform = isBrowser ? "browser" : isNode ? "node" : "undefined"; +const currentPlatform = isBrowser() ? "browser" : isNode() ? "node" : "undefined"; export const SDK_VERSION = "1.0.0-beta.1"; export const DEFAULT_USER_AGENT = `azsdk-node-modelsrepository/${SDK_VERSION} (${currentPlatform})`; diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index 93f5da6f26ec..d2d48864a90f 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { OperationOptions } from "@azure/core-client"; -import { DTDL } from "./DTDL"; +import { DTDL } from "./dtdl"; import { convertDtmiToPath } from "./dtmiConventions"; import { ModelError } from "./exceptions"; import { Fetcher } from "./fetcherAbstract"; @@ -23,14 +23,14 @@ export class DtmiResolver { expandedModel: boolean, options?: OperationOptions ): Promise<{ [dtmi: string]: DTDL }> { - const modelMap: any = {}; + const modelMap: { [dtmi: string]: DTDL } = {}; const dtdlPromises = dtmis.map(async (dtmi) => { const dtdlPath = convertDtmiToPath(dtmi, expandedModel); logger.info(`Model ${dtmi} located in repository at ${dtdlPath}`); const dtdl = await this._fetcher.fetch(dtdlPath, options); if (expandedModel) { if (Array.isArray(dtdl)) { - const modelIds: string[] = (dtdl as any[]).map((model: any) => model["@id"]); + const modelIds: string[] = (dtdl as DTDL[]).map((model: DTDL) => model["@id"]); if (!modelIds.includes(dtmi)) { throw new ModelError( `DTMI mismatch on expanded DTDL - Request: ${dtmi}, Response: ${modelIds}` @@ -48,7 +48,7 @@ export class DtmiResolver { throw new ModelError(`DTMI mismatch - Request: ${dtmi}, Response ${model["@id"]}`); } - modelMap[`${dtmi}`] = dtdl; + modelMap[`${dtmi}`] = model; } }); diff --git a/sdk/iot/modelsrepository/src/exceptions.ts b/sdk/iot/modelsrepository/src/exceptions.ts index cd588f1ae262..5e9b3b880aca 100644 --- a/sdk/iot/modelsrepository/src/exceptions.ts +++ b/sdk/iot/modelsrepository/src/exceptions.ts @@ -7,5 +7,7 @@ export class ModelError extends Error { constructor(message: string) { super(message); + + this.name = "ModelError"; } } diff --git a/sdk/iot/modelsrepository/src/fetcherAbstract.ts b/sdk/iot/modelsrepository/src/fetcherAbstract.ts index d954da29c9bd..f2f74641b99e 100644 --- a/sdk/iot/modelsrepository/src/fetcherAbstract.ts +++ b/sdk/iot/modelsrepository/src/fetcherAbstract.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { OperationOptions } from "@azure/core-client"; -import { DTDL } from "./DTDL"; +import { DTDL } from "./dtdl"; /** * @internal diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index f4313d2e35fc..dccc540df1e8 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -6,7 +6,7 @@ import * as path from "path"; import { RestError, RestErrorOptions } from "@azure/core-rest-pipeline"; import { Fetcher } from "./fetcherAbstract"; import { logger } from "./logger"; -import { DTDL } from "./DTDL"; +import { DTDL } from "./dtdl"; function readFilePromise(path: string): Promise { return new Promise((res, rej) => { @@ -30,7 +30,10 @@ export class FilesystemFetcher implements Fetcher { async fetch(filePath: string) { logger.info(`Fetching ${filePath} from local filesystem`); const absolutePath = path.join(this._baseFilePath, filePath); - + if (absolutePath.indexOf(this._baseFilePath) !== 0) { + throw new Error("Attempted to escape base file path"); + } + try { logger.info(`File open on ${absolutePath}`); const dtdlFile = await readFilePromise(absolutePath); diff --git a/sdk/iot/modelsrepository/src/index.ts b/sdk/iot/modelsrepository/src/index.ts index 2e931dbe3514..f4f8258b1334 100644 --- a/sdk/iot/modelsrepository/src/index.ts +++ b/sdk/iot/modelsrepository/src/index.ts @@ -2,8 +2,7 @@ // Licensed under the MIT license. /** - * This is the ModelsRepositoryClient Library for Javascript. - * Why Models and not Model? Because there's more than one Model. + * This is the ModelsRepositoryClient Library for JavaScript. * * @remarks * This ModelsRepositoryClient is built around getting DTDL Models from a user-specified diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index f092eb93bd7c..6d8514a2cb16 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -1,12 +1,11 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import * as cnst from "./constants"; +import { DEFAULT_API_VERSION, DEFAULT_REPOSITORY_LOCATION, DEFAULT_USER_AGENT, DEPENDENCY_MODE_DISABLED, DEPENDENCY_MODE_ENABLED, DEPENDENCY_MODE_TRY_FROM_EXPANDED} from "./constants"; import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; import { Fetcher } from "./fetcherAbstract"; import { URL } from "./utils/url"; -import { isLocalPath } from "./utils/absolutePath"; -import { normalize } from "./utils/normalize"; +import { isLocalPath, normalize } from "./utils/path"; import { FilesystemFetcher } from "./fetcherFilesystem"; import { dependencyResolutionType } from "./dependencyResolutionType"; import { DtmiResolver } from "./dtmiResolver"; @@ -16,7 +15,7 @@ import { logger } from "./logger"; import { IoTModelsRepositoryServiceClient } from "./modelsRepositoryServiceClient"; import { HttpFetcher } from "./fetcherHTTP"; import { GetModelsOptions } from "./interfaces/getModelsOptions"; -import { DTDL } from "./DTDL"; +import { DTDL } from "./dtdl"; /** * Initializes a new instance of the IoT Models Repository Client. @@ -34,7 +33,7 @@ export class ModelsRepositoryClient { * @param options - The models repository client options that govern the behavior of the client. */ constructor(options: ModelsRepositoryClientOptions = {}) { - this._repositoryLocation = options.repositoryLocation || cnst.DEFAULT_REPOSITORY_LOCATION; + this._repositoryLocation = options.repositoryLocation || DEFAULT_REPOSITORY_LOCATION; logger.info(`Client configured for repository location ${this._repositoryLocation}`); this._dependencyResolution = options.dependencyResolution || @@ -45,7 +44,7 @@ export class ModelsRepositoryClient { this._pseudoParser = new PseudoParser(this._resolver); // Store api version here (for now). Currently doesn't do anything - this._apiVersion = options.apiVersion || cnst.DEFAULT_API_VERSION; + this._apiVersion = options.apiVersion || DEFAULT_API_VERSION; } /** @@ -95,9 +94,9 @@ export class ModelsRepositoryClient { pipelineOptions.userAgentOptions = {}; } if (pipelineOptions.userAgentOptions.userAgentPrefix) { - pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${cnst.DEFAULT_USER_AGENT}`; + pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${DEFAULT_USER_AGENT}`; } else { - pipelineOptions.userAgentOptions.userAgentPrefix = cnst.DEFAULT_USER_AGENT; + pipelineOptions.userAgentOptions.userAgentPrefix = DEFAULT_USER_AGENT; } const internalPipelineOptions: InternalClientPipelineOptions = { @@ -183,18 +182,18 @@ export class ModelsRepositoryClient { const dependencyResolution = options?.dependencyResolution || this._dependencyResolution; - if (dependencyResolution === cnst.DEPENDENCY_MODE_DISABLED) { + if (dependencyResolution === DEPENDENCY_MODE_DISABLED) { logger.info("Getting models w/ dependency resolution mode: disabled"); logger.info(`Retreiving model(s): ${dtmis}...`); modelMap = await this._resolver.resolve(dtmis, false, options); - } else if (dependencyResolution === cnst.DEPENDENCY_MODE_ENABLED) { + } else if (dependencyResolution === DEPENDENCY_MODE_ENABLED) { logger.info(`Getting models w/ dependency resolution mode: enabled`); logger.info(`Retreiving model(s): ${dtmis}...`); const baseModelMap = await this._resolver.resolve(dtmis, false, options); const baseModelList = Object.keys(baseModelMap).map((key) => baseModelMap[key]); logger.info(`Retreiving model dependencies for ${dtmis}...`); modelMap = await this._pseudoParser.expand(baseModelList, false); - } else if (dependencyResolution === cnst.DEPENDENCY_MODE_TRY_FROM_EXPANDED) { + } else if (dependencyResolution === DEPENDENCY_MODE_TRY_FROM_EXPANDED) { logger.info(`Getting models w/ dependency resolution mode: tryFromExpanded`); try { logger.info(`Retreiving expanded model(s): ${dtmis}...`); diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index 20787d0b3efd..75fb86d64b7f 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { DTDL } from "./DTDL"; +import { DTDL } from "./dtdl"; import { logger } from "./logger"; import { DtmiResolver } from "./dtmiResolver"; import { RestError } from "@azure/core-rest-pipeline"; diff --git a/sdk/iot/modelsrepository/src/utils/absolutePath.browser.ts b/sdk/iot/modelsrepository/src/utils/absolutePath.browser.ts deleted file mode 100644 index 79bec47376fd..000000000000 --- a/sdk/iot/modelsrepository/src/utils/absolutePath.browser.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -export function isLocalPath() { - return false; -} \ No newline at end of file diff --git a/sdk/iot/modelsrepository/src/utils/absolutePath.ts b/sdk/iot/modelsrepository/src/utils/absolutePath.ts deleted file mode 100644 index 6a11161348d6..000000000000 --- a/sdk/iot/modelsrepository/src/utils/absolutePath.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -import {isAbsolute} from "path"; - -export function isLocalPath(p: string): boolean { - return isAbsolute(p); -} diff --git a/sdk/iot/modelsrepository/src/utils/normalize.ts b/sdk/iot/modelsrepository/src/utils/normalize.ts deleted file mode 100644 index 66fee02c9d68..000000000000 --- a/sdk/iot/modelsrepository/src/utils/normalize.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft. -// Licensed under the MIT license. - -export { normalize as normalize } from "path"; diff --git a/sdk/iot/modelsrepository/src/utils/normalize.browser.ts b/sdk/iot/modelsrepository/src/utils/path.browser.ts similarity index 69% rename from sdk/iot/modelsrepository/src/utils/normalize.browser.ts rename to sdk/iot/modelsrepository/src/utils/path.browser.ts index eef26b31a8c1..af78e8b444e4 100644 --- a/sdk/iot/modelsrepository/src/utils/normalize.browser.ts +++ b/sdk/iot/modelsrepository/src/utils/path.browser.ts @@ -1,6 +1,10 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. +export function isLocalPath() { + return false; +} + export function normalize(text: string) { return text; -} \ No newline at end of file +} diff --git a/sdk/iot/modelsrepository/src/utils/path.ts b/sdk/iot/modelsrepository/src/utils/path.ts new file mode 100644 index 000000000000..35c27f853229 --- /dev/null +++ b/sdk/iot/modelsrepository/src/utils/path.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +import {isAbsolute, normalize} from "path"; + +function isLocalPath(p: string): boolean { + return isAbsolute(p); +} + +export { normalize, isLocalPath } diff --git a/sdk/iot/modelsrepository/tsconfig.json b/sdk/iot/modelsrepository/tsconfig.json index ac55095a4d66..93e65b17a3da 100644 --- a/sdk/iot/modelsrepository/tsconfig.json +++ b/sdk/iot/modelsrepository/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "./dist-esm", "declarationDir": "./types", - "lib": ["dom", "esnext"], + "lib": ["dom"], "paths": { "@azure/iot-modelsrepository": ["./src/index"] } From 14a186102780a5993d86226e9871a2196c720c24 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 16:54:59 -0700 Subject: [PATCH 66/81] remove todos --- sdk/iot/modelsrepository/src/dtmiConventions.ts | 1 - sdk/iot/modelsrepository/src/fetcherFilesystem.ts | 1 - sdk/iot/modelsrepository/src/modelsRepositoryClient.ts | 1 - 3 files changed, 3 deletions(-) diff --git a/sdk/iot/modelsrepository/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts index 5e8125ad5fe8..0f18dc240c99 100644 --- a/sdk/iot/modelsrepository/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -27,7 +27,6 @@ export function isValidDtmi(dtmi: string): boolean { * @returns {string} */ export function getModelUri(dtmi: string, repositoryUri: string, expanded: boolean = false): string { - // TODO: Make sure this works with Windows UNC Filesystem Path. if (!repositoryUri.endsWith("/")) { repositoryUri = repositoryUri.concat("/"); } diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index dccc540df1e8..f81c61a342bc 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -40,7 +40,6 @@ export class FilesystemFetcher implements Fetcher { const parsedDtdl: DTDL | DTDL[] = JSON.parse(dtdlFile); return parsedDtdl; } catch (e) { - // TODO: Is there a ResourceNotFound Error for Filesystem + Http (Generic API for errors) const options: RestErrorOptions = { code: "ResourceNotFound", statusCode: e?.status diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index 6d8514a2cb16..2b7f7072af88 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -120,7 +120,6 @@ export class ModelsRepositoryClient { * or a Filesystem Fetcher. */ private _createFetcher(location: string, options: ModelsRepositoryClientOptions): Fetcher { - // TODO: Validate that this works with a Windows UNC Filesystem URI. let locationURL; let fetcher; if (isLocalPath(location)) { From c6b2e0ead6cc8ff64892f33f24c816a2f2cc7e02 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 16:55:58 -0700 Subject: [PATCH 67/81] remove extend --- sdk/iot/modelsrepository/src/DTDL.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/iot/modelsrepository/src/DTDL.ts b/sdk/iot/modelsrepository/src/DTDL.ts index c022a5423224..7c3426f6a81b 100644 --- a/sdk/iot/modelsrepository/src/DTDL.ts +++ b/sdk/iot/modelsrepository/src/DTDL.ts @@ -10,7 +10,7 @@ interface Contents { /** * @internal */ -export interface DTDL extends JSON { +export interface DTDL { "@context": any[]; "@id": string; extends: string | Array; From 8a8360d2bcf2fe5b87c0e1e1aa9a7b6a839348c1 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 17:00:19 -0700 Subject: [PATCH 68/81] remove how to use --- sdk/iot/modelsrepository/HOW_TO_USE.md | 138 ------------------------- sdk/iot/modelsrepository/README.md | 112 ++++++++++++++++++-- 2 files changed, 106 insertions(+), 144 deletions(-) delete mode 100644 sdk/iot/modelsrepository/HOW_TO_USE.md diff --git a/sdk/iot/modelsrepository/HOW_TO_USE.md b/sdk/iot/modelsrepository/HOW_TO_USE.md deleted file mode 100644 index 7d0e780ee5eb..000000000000 --- a/sdk/iot/modelsrepository/HOW_TO_USE.md +++ /dev/null @@ -1,138 +0,0 @@ -# Azure IoT Models Repository Samples - -The Azure IoT Models Repository enables builders to manage and share digital twin models for global consumption. The models are [JSON-LD](https://json-ld.org/) documents defined using the Digital Twins Definition Language [(DTDL)](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md). - -For more info about the Azure IoT Models Repository checkout the [docs](https://docs.microsoft.com/azure/iot-pnp/concepts-model-repository). - - -| **File Name** | **Description** | -| ----------------------------------- | --------------- | -| modelResolutionSample.ts | sample model getting | -| dtmiConventionsSample.ts | sample using dtmi conventions helpers | - -## Introduction - -You can explore the models repository APIs with the client library using the samples project. - -The samples project demonstrates the following: - -- Instantiate the client -- Get models and their dependencies from either a remote endpoint or local repository. -- Integration with the Digital Twins Model Parser - -## Prerequisites - -The samples are compatible with Node.js >= 8.0.0. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Initializing the Models Repository Client - -```ts -// When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint -// https://devicemodels.azure.com/ is used and the model dependency resolution -// configuration is set to TryFromExpanded. -const client = new ModelsRepositoryClient(); -console.log(`Initialized client point to global endpoint: ${client.repositoryLocation}`); -``` -```ts -// The client will also work with a local filesystem URI. This example shows initalization -// with a local URI and disabling model dependency resolution. -const client = new ModelsRepositoryClient({repositoryLocation: 'file:///path/to/repository/', dependencyResolution: 'disabled'}); -console.log(`Initialized client pointing to local path: ${client.repositoryLocation}`); -``` - -## Publish Models - -Publishing models to the models repository requires [exercising](https://docs.microsoft.com/azure/iot-pnp/concepts-model-repository#publish-a-model) common GitHub workflows. - -## Get Models - -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. - -```ts -// Global endpoint client -const client = new ModelsRepositoryClient(); - -// The output of getModels() will include at least the definition for the target dtmi. -// If the model dependency resolution configuration is not disabled, then models in which the -// target dtmi depends on will also be included in the returned object (mapping dtmis to model objects). -const dtmi = "dtmi:com:example:TemperatureController;1"; -const models = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); - -// In this case the above dtmi has 2 model dependencies. -// dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1 -console.log(`${dtmi} resolved in ${models.keys().length} interfaces.`); -``` - -GitHub pull-request workflows are a core aspect of the IoT Models Repository service. To submit models, the user is expected to fork and clone the global [models repository project](https://github.com/Azure/iot-plugandplay-models) then iterate against the local copy. Changes would then be pushed to the fork (ideally in a new branch) and a PR created against the global repository. - -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. - -```ts -// Local sample repository client -const client = new ModelsRepositoryClient(`file:///path/to/repository/`); - -// The output of getModels() will include at least the definition for the target dtmi. -// If the model dependency resolution configuration is not disabled, then models in which the -// target dtmi depends on will also be included in the returned IDictionary. -const dtmi = "dtmi:com:example:TemperatureController;1"; -const models = await client.getModels(dtmi); - -// In this case the above dtmi has 2 model dependencies. -// dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1 -console.log(`${dtmi} resolved in ${models.keys().length} interfaces.`); -``` - -You are also able to get definitions for multiple root models at a time by leveraging the `GetModels` overload. - -```ts -// Global endpoint client -const client = new ModelsRepositoryClient(); - -const dtmis = ["dtmi:com:example:TemperatureController;1", "dtmi:com:example:azuresphere:sampledevice;1"]; -const models = await client.getModels(dtmis); - -// In this case the dtmi "dtmi:com:example:TemperatureController;1" has 2 model dependencies -// and the dtmi "dtmi:com:example:azuresphere:sampledevice;1" has no additional dependencies. -// The returned IDictionary will include 4 models. -console.log(`${dtmis.toString()} resolved in ${models.keys().length} interfaces.`); -``` - -## Digital Twins Model Parser Integration - -*When the Digital Twins Model Parser is completed, we will update you with information on how to integrate this client.* - -## DtmiConventions utility functions - -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. - -```ts -// This snippet shows how to validate a given DTMI string is well-formed. - -// Returns true -isValidDtmi("dtmi:com:example:Thermostat;1"); - -// Returns false -isValidDtmi("dtmi:com:example:Thermostat"); -``` - -```ts -// This snippet shows obtaining a fully qualified path to a model file. - -// Local repository example -const localRepositoryUri: string = "file:///path/to/repository/"; -const fullyQualifiedModelPath: string = - getModelUri("dtmi:com:example:Thermostat;1", localRepositoryUri); - -// Prints '/path/to/repository/dtmi/com/example/thermostat-1.json' -console.log(fullyQualifiedModelPath); - -// Remote repository example -const remoteRepositoryUri: string = "https://contoso.com/models/"; -const fullyQualifiedModelPath: string = - GetModelUri("dtmi:com:example:Thermostat;1", remoteRepositoryUri); - -// Prints 'https://contoso.com/models/dtmi/com/example/thermostat-1.json' -console.log(fullyQualifiedModelPath); -``` diff --git a/sdk/iot/modelsrepository/README.md b/sdk/iot/modelsrepository/README.md index 6dda1c3876c7..1275dda09a8f 100644 --- a/sdk/iot/modelsrepository/README.md +++ b/sdk/iot/modelsrepository/README.md @@ -29,16 +29,116 @@ npm install @azure/iot-modelsrepository # Examples -## nodejs - Authentication, client creation and get ioTSpaces as an example written in TypeScript. -### Sample code +## Initializing the Models Repository Client ```ts -import { ModelsRepositoryClient } from "@azure/iot-modelsrepository"; +// When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint +// https://devicemodels.azure.com/ is used and the model dependency resolution +// configuration is set to TryFromExpanded. +const client = new ModelsRepositoryClient(); +console.log(`Initialized client point to global endpoint: ${client.repositoryLocation}`); +``` +```ts +// The client will also work with a local filesystem URI. This example shows initalization +// with a local URI and disabling model dependency resolution. +const client = new ModelsRepositoryClient({repositoryLocation: 'file:///path/to/repository/', dependencyResolution: 'disabled'}); +console.log(`Initialized client pointing to local path: ${client.repositoryLocation}`); +``` + +## Publish Models + +Publishing models to the models repository requires [exercising](https://docs.microsoft.com/azure/iot-pnp/concepts-model-repository#publish-a-model) common GitHub workflows. + +## Get Models + +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. + +```ts +// Global endpoint client +const client = new ModelsRepositoryClient(); + +// The output of getModels() will include at least the definition for the target dtmi. +// If the model dependency resolution configuration is not disabled, then models in which the +// target dtmi depends on will also be included in the returned object (mapping dtmis to model objects). +const dtmi = "dtmi:com:example:TemperatureController;1"; +const models = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); + +// In this case the above dtmi has 2 model dependencies. +// dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1 +console.log(`${dtmi} resolved in ${models.keys().length} interfaces.`); +``` + +GitHub pull-request workflows are a core aspect of the IoT Models Repository service. To submit models, the user is expected to fork and clone the global [models repository project](https://github.com/Azure/iot-plugandplay-models) then iterate against the local copy. Changes would then be pushed to the fork (ideally in a new branch) and a PR created against the global repository. + +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. + +```ts +// Local sample repository client +const client = new ModelsRepositoryClient(`file:///path/to/repository/`); + +// The output of getModels() will include at least the definition for the target dtmi. +// If the model dependency resolution configuration is not disabled, then models in which the +// target dtmi depends on will also be included in the returned IDictionary. +const dtmi = "dtmi:com:example:TemperatureController;1"; +const models = await client.getModels(dtmi); + +// In this case the above dtmi has 2 model dependencies. +// dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1 +console.log(`${dtmi} resolved in ${models.keys().length} interfaces.`); +``` + +You are also able to get definitions for multiple root models at a time by leveraging the `GetModels` overload. + +```ts +// Global endpoint client +const client = new ModelsRepositoryClient(); + +const dtmis = ["dtmi:com:example:TemperatureController;1", "dtmi:com:example:azuresphere:sampledevice;1"]; +const models = await client.getModels(dtmis); + +// In this case the dtmi "dtmi:com:example:TemperatureController;1" has 2 model dependencies +// and the dtmi "dtmi:com:example:azuresphere:sampledevice;1" has no additional dependencies. +// The returned IDictionary will include 4 models. +console.log(`${dtmis.toString()} resolved in ${models.keys().length} interfaces.`); +``` + +## Digital Twins Model Parser Integration + +*When the Digital Twins Model Parser is completed, we will update you with information on how to integrate this client.* + +## DtmiConventions utility functions + +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. + +```ts +// This snippet shows how to validate a given DTMI string is well-formed. + +// Returns true +isValidDtmi("dtmi:com:example:Thermostat;1"); + +// Returns false +isValidDtmi("dtmi:com:example:Thermostat"); +``` + +```ts +// This snippet shows obtaining a fully qualified path to a model file. + +// Local repository example +const localRepositoryUri: string = "file:///path/to/repository/"; +const fullyQualifiedModelPath: string = + getModelUri("dtmi:com:example:Thermostat;1", localRepositoryUri); + +// Prints '/path/to/repository/dtmi/com/example/thermostat-1.json' +console.log(fullyQualifiedModelPath); + +// Remote repository example +const remoteRepositoryUri: string = "https://contoso.com/models/"; +const fullyQualifiedModelPath: string = + GetModelUri("dtmi:com:example:Thermostat;1", remoteRepositoryUri); -const client = new ModelsRepositoryClient("https://devicemodels.azure.com"); -const result = await client.getModels("dtmi:azure:DeviceManagement:DeviceInformation;1"); -console.log(result); +// Prints 'https://contoso.com/models/dtmi/com/example/thermostat-1.json' +console.log(fullyQualifiedModelPath); ``` ----------------------------------------- From 1e3e54c0eeda57cfc58f1a7868bdbd0e633ef1e1 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 17:08:38 -0700 Subject: [PATCH 69/81] formattign --- sdk/iot/modelsrepository/karma.conf.js | 3 +- .../samples-dev/dtmiConventionsSample.ts | 19 ++-- .../samples-dev/modelResolutionSample.ts | 8 +- sdk/iot/modelsrepository/src/constants.ts | 16 ++- .../src/dependencyResolutionType.ts | 4 +- .../modelsrepository/src/dtmiConventions.ts | 28 ++--- .../modelsrepository/src/fetcherFilesystem.ts | 2 +- sdk/iot/modelsrepository/src/fetcherHTTP.ts | 23 +++- .../src/modelsRepositoryClient.ts | 9 +- sdk/iot/modelsrepository/src/psuedoParser.ts | 11 +- .../src/utils/fetcherFilesystem.browser.ts | 2 +- sdk/iot/modelsrepository/src/utils/path.ts | 4 +- .../test/browser/browserTest.spec.ts | 4 +- .../test/node/integration/index.spec.ts | 62 +++++++--- .../test/node/unit/constants.spec.ts | 8 +- .../test/node/unit/dtmiConventions.spec.ts | 106 +++++++++--------- sdk/iot/modelsrepository/tsconfig.json | 6 +- 17 files changed, 189 insertions(+), 126 deletions(-) diff --git a/sdk/iot/modelsrepository/karma.conf.js b/sdk/iot/modelsrepository/karma.conf.js index e5f34e48f25e..11ba2e7e033c 100644 --- a/sdk/iot/modelsrepository/karma.conf.js +++ b/sdk/iot/modelsrepository/karma.conf.js @@ -53,8 +53,7 @@ module.exports = function(config) { "test-browser/index.js": ["coverage"] }, - envPreprocessor: [ - ], + envPreprocessor: [], // test results reporter to use // possible values: 'dots', 'progress' diff --git a/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts b/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts index eb8f758f70c5..a28b1d1ccf9d 100644 --- a/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts +++ b/sdk/iot/modelsrepository/samples-dev/dtmiConventionsSample.ts @@ -1,16 +1,15 @@ -// Copyright (c) Microsoft. +// Copyright (c) Microsoft. // Licensed under the MIT license. /** * @summary Demonstrates the use of a getModelUri and isValidDtmi, helper functions for interacting with DTMIs. */ -import {getModelUri, isValidDtmi} from "@azure/iot-modelsrepository"; +import { getModelUri, isValidDtmi } from "@azure/iot-modelsrepository"; function main() { - const dtmi1 = "dtmi:com:example:Thermostat;1"; - const dtmi2 = "dtmi:com:example:Thermostat" + const dtmi2 = "dtmi:com:example:Thermostat"; // returns true const result1 = isValidDtmi(dtmi1); console.log(`${dtmi1} is valid? ${result1}`); @@ -19,11 +18,17 @@ function main() { const result2 = isValidDtmi(dtmi2); console.log(`${dtmi2} is valid? ${result2}`); // local repository fully qualified path to a model file - const fullyQualifiedLocalPath = getModelUri("dtmi:com:example:Thermostat;1", "file:///path/to/repository/"); + const fullyQualifiedLocalPath = getModelUri( + "dtmi:com:example:Thermostat;1", + "file:///path/to/repository/" + ); console.log(fullyQualifiedLocalPath); - const fullyQualifiedRemotePath = getModelUri("dtmi:com:example:Thermostat;1", "https://contoso.com/models"); + const fullyQualifiedRemotePath = getModelUri( + "dtmi:com:example:Thermostat;1", + "https://contoso.com/models" + ); console.log(fullyQualifiedRemotePath); } -main(); \ No newline at end of file +main(); diff --git a/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts b/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts index 56f271d997e8..bccb5c13452d 100644 --- a/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts +++ b/sdk/iot/modelsrepository/samples-dev/modelResolutionSample.ts @@ -1,11 +1,11 @@ -// Copyright (c) Microsoft. +// Copyright (c) Microsoft. // Licensed under the MIT license. /** * @summary Demonstrates the use of ModelsRepositoryClient to get models from an endpoint. */ -import {ModelsRepositoryClient} from "@azure/iot-modelsrepository"; +import { ModelsRepositoryClient } from "@azure/iot-modelsrepository"; const repositoryEndpoint = "https://devicemodels.azure.com"; const dtmi = "dtmi:azure:DeviceManagement:DeviceInformation;1"; @@ -16,8 +16,8 @@ async function main() { // When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint // https://devicemodels.azure.com/ is used and the model dependency resolution // configuration is set to TryFromExpanded. - const client = new ModelsRepositoryClient({repositoryLocation: repositoryEndpoint}); - const result = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'}); + const client = new ModelsRepositoryClient({ repositoryLocation: repositoryEndpoint }); + const result = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" }); Object.keys(result).forEach((fetchedDtmi) => { const currentDtdl = result[fetchedDtmi] as any; console.log("------------------------------------------------"); diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts index 6c6775e42136..e01279d83aec 100644 --- a/sdk/iot/modelsrepository/src/constants.ts +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -1,8 +1,20 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -const isBrowser = () => { try {return this===self;}catch(e){ return false;}}; -const isNode = () => {try {return this===global;}catch(e){return false;}}; +const isBrowser = () => { + try { + return this === self; + } catch (e) { + return false; + } +}; +const isNode = () => { + try { + return this === global; + } catch (e) { + return false; + } +}; const currentPlatform = isBrowser() ? "browser" : isNode() ? "node" : "undefined"; diff --git a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts index 29646559ff63..6280b4a55ce8 100644 --- a/sdk/iot/modelsrepository/src/dependencyResolutionType.ts +++ b/sdk/iot/modelsrepository/src/dependencyResolutionType.ts @@ -3,12 +3,12 @@ /** * @name dependencyResolutionType - * + * * @description * either dependency resolution is disabled, and only the client will get only the model linked to the dtmi, * it is enabled, and the client will resolve all dependency models linked to the dtmi within the endpoint, * or it is set to tryFromExpanded, where the client will attempt to get the expanded JSON format from the endpoint, * and in the event of failure will fallback on the standard enabled dependency resolution. - * + * */ export type dependencyResolutionType = "disabled" | "enabled" | "tryFromExpanded"; diff --git a/sdk/iot/modelsrepository/src/dtmiConventions.ts b/sdk/iot/modelsrepository/src/dtmiConventions.ts index 0f18dc240c99..9d83fd98cc61 100644 --- a/sdk/iot/modelsrepository/src/dtmiConventions.ts +++ b/sdk/iot/modelsrepository/src/dtmiConventions.ts @@ -1,14 +1,13 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. - /** * isValidDtmi * @description given a dtmi it will validate it matches the convention. * This is based on the DTMI spec: * https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md#digital-twin-model-identifier - * - * @param dtmi + * + * @param dtmi * @returns {boolean} */ export function isValidDtmi(dtmi: string): boolean { @@ -20,13 +19,17 @@ export function isValidDtmi(dtmi: string): boolean { /** * getModelUri * @description given the dtmi and repository uri, will get a fully qualified model uri. - * - * @param dtmi - * @param repositoryUri - * @param expanded + * + * @param dtmi + * @param repositoryUri + * @param expanded * @returns {string} */ -export function getModelUri(dtmi: string, repositoryUri: string, expanded: boolean = false): string { +export function getModelUri( + dtmi: string, + repositoryUri: string, + expanded: boolean = false +): string { if (!repositoryUri.endsWith("/")) { repositoryUri = repositoryUri.concat("/"); } @@ -34,14 +37,13 @@ export function getModelUri(dtmi: string, repositoryUri: string, expanded: boole return modelUri; } - /** * convertDtmiToPath * @description converts a dtmi into the model path format. - * - * @param dtmi - * @param expanded - * @internal + * + * @param dtmi + * @param expanded + * @internal */ export function convertDtmiToPath(dtmi: string, expanded: boolean): string { // presently this dtmi to path function does not return the path with a diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index f81c61a342bc..64619bede91d 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -33,7 +33,7 @@ export class FilesystemFetcher implements Fetcher { if (absolutePath.indexOf(this._baseFilePath) !== 0) { throw new Error("Attempted to escape base file path"); } - + try { logger.info(`File open on ${absolutePath}`); const dtdlFile = await readFilePromise(absolutePath); diff --git a/sdk/iot/modelsrepository/src/fetcherHTTP.ts b/sdk/iot/modelsrepository/src/fetcherHTTP.ts index d78eb98b408e..a4c66cd0ce2f 100644 --- a/sdk/iot/modelsrepository/src/fetcherHTTP.ts +++ b/sdk/iot/modelsrepository/src/fetcherHTTP.ts @@ -2,7 +2,15 @@ // Licensed under the MIT license. import { OperationOptions, ServiceClient } from "@azure/core-client"; -import { createHttpHeaders, createPipelineRequest, HttpHeaders, HttpMethods, PipelineRequest, PipelineResponse, RestError } from "@azure/core-rest-pipeline"; +import { + createHttpHeaders, + createPipelineRequest, + HttpHeaders, + HttpMethods, + PipelineRequest, + PipelineResponse, + RestError +} from "@azure/core-rest-pipeline"; import { logger } from "./logger"; import { Fetcher } from "./fetcherAbstract"; @@ -20,18 +28,18 @@ export class HttpFetcher implements Fetcher { async fetch(path: string, options: OperationOptions) { logger.info(`Fetching ${path} from remote endpoint`); - const myURL = this._baseURL + '/' + path; + const myURL = this._baseURL + "/" + path; const requestMethod: HttpMethods = "GET"; const requestHeader: HttpHeaders = createHttpHeaders(options.requestOptions?.customHeaders); const requestOptions = { url: myURL, method: requestMethod, - headers: requestHeader, + headers: requestHeader, timeout: options.requestOptions?.timeout, abortSignal: options.abortSignal, tracingOptions: options.tracingOptions, allowInsecureConnection: true - } + }; const request: PipelineRequest = createPipelineRequest(requestOptions); const res: PipelineResponse = await this._client.sendRequest(request); @@ -40,7 +48,12 @@ export class HttpFetcher implements Fetcher { const parsedDtdl = JSON.parse(dtdlAsString); return parsedDtdl; } else { - throw new RestError("Error on HTTP Request in remote model fetcher", {code: 'ResourceNotFound',statusCode: res.status, response: res, request: request}); + throw new RestError("Error on HTTP Request in remote model fetcher", { + code: "ResourceNotFound", + statusCode: res.status, + response: res, + request: request + }); } } } diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index 2b7f7072af88..8f820492f15f 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -1,7 +1,14 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { DEFAULT_API_VERSION, DEFAULT_REPOSITORY_LOCATION, DEFAULT_USER_AGENT, DEPENDENCY_MODE_DISABLED, DEPENDENCY_MODE_ENABLED, DEPENDENCY_MODE_TRY_FROM_EXPANDED} from "./constants"; +import { + DEFAULT_API_VERSION, + DEFAULT_REPOSITORY_LOCATION, + DEFAULT_USER_AGENT, + DEPENDENCY_MODE_DISABLED, + DEPENDENCY_MODE_ENABLED, + DEPENDENCY_MODE_TRY_FROM_EXPANDED +} from "./constants"; import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; import { Fetcher } from "./fetcherAbstract"; import { URL } from "./utils/url"; diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index 75fb86d64b7f..b446c29b552d 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -18,7 +18,7 @@ export class PseudoParser { async expand(models: DTDL[], tryFromExpanded: boolean) { let expandedMap: any = {}; - for (let i=0; i { modelMap[key] = resolvedDependenciesMap[key]; - }) + }); const promiseList: Promise[] = []; Object.values(resolvedDependenciesMap).forEach((dependencyModel) => { promiseList.push(this._expand(dependencyModel as DTDL, modelMap, tryFromExpanded)); diff --git a/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts b/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts index 283d7b727fed..a3976e6451e4 100644 --- a/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts +++ b/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts @@ -5,4 +5,4 @@ export class FilesystemFetcher { constructor() { throw new Error("FilesystemFetcher is not supported in browser"); } -} \ No newline at end of file +} diff --git a/sdk/iot/modelsrepository/src/utils/path.ts b/sdk/iot/modelsrepository/src/utils/path.ts index 35c27f853229..7e1fc058461b 100644 --- a/sdk/iot/modelsrepository/src/utils/path.ts +++ b/sdk/iot/modelsrepository/src/utils/path.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import {isAbsolute, normalize} from "path"; +import { isAbsolute, normalize } from "path"; function isLocalPath(p: string): boolean { return isAbsolute(p); } -export { normalize, isLocalPath } +export { normalize, isLocalPath }; diff --git a/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts b/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts index 1a3817756b64..d23c445ee185 100644 --- a/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts +++ b/sdk/iot/modelsrepository/test/browser/browserTest.spec.ts @@ -14,7 +14,9 @@ describe("resolver - browser", () => { result .then((actualOutput: any) => { expect(actualOutput["dtmi:azure:DeviceManagement:DeviceInformation;1"]).to.exist; - expect(actualOutput["dtmi:azure:DeviceManagement:DeviceInformation;1"]["@id"]).to.equal("dtmi:azure:DeviceManagement:DeviceInformation;1"); + expect(actualOutput["dtmi:azure:DeviceManagement:DeviceInformation;1"]["@id"]).to.equal( + "dtmi:azure:DeviceManagement:DeviceInformation;1" + ); done(); }) .catch((err: any) => done(err)); diff --git a/sdk/iot/modelsrepository/test/node/integration/index.spec.ts b/sdk/iot/modelsrepository/test/node/integration/index.spec.ts index 5de396470042..b28f5e2b6dcb 100644 --- a/sdk/iot/modelsrepository/test/node/integration/index.spec.ts +++ b/sdk/iot/modelsrepository/test/node/integration/index.spec.ts @@ -4,7 +4,6 @@ import { ModelsRepositoryClient, ModelsRepositoryClientOptions } from "../../../src"; - import { assert, expect } from "chai"; import * as sinon from "sinon"; @@ -22,8 +21,8 @@ interface remoteResolutionScenario { dtmis: { dtmi: string; expectedUri: string; - mockedResponse: unknown - expectedOutputJson: unknown + mockedResponse: unknown; + expectedOutputJson: unknown; }[]; } @@ -40,8 +39,14 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", expectedUri: "https://www.devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", - mockedResponse: { "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", fakeDtdl: "fakeBodyAsText" }, - expectedOutputJson: { "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", fakeDtdl: "fakeBodyAsText" } + mockedResponse: { + "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + fakeDtdl: "fakeBodyAsText" + }, + expectedOutputJson: { + "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + fakeDtdl: "fakeBodyAsText" + } } ] }, @@ -57,8 +62,14 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", expectedUri: "https://www.devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.json", - mockedResponse: { "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", fakeDtdl: "fakeBodyAsText" }, - expectedOutputJson: { "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", fakeDtdl: "fakeBodyAsText" } + mockedResponse: { + "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + fakeDtdl: "fakeBodyAsText" + }, + expectedOutputJson: { + "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + fakeDtdl: "fakeBodyAsText" + } } ] }, @@ -74,8 +85,16 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", expectedUri: "https://www.devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json", - mockedResponse: [{ "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", fakeDtdl: "fakeBodyAsText" }], - expectedOutputJson: { "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", fakeDtdl: "fakeBodyAsText" } + mockedResponse: [ + { + "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + fakeDtdl: "fakeBodyAsText" + } + ], + expectedOutputJson: { + "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + fakeDtdl: "fakeBodyAsText" + } } ] }, @@ -91,13 +110,20 @@ const remoteResolutionScenarios: remoteResolutionScenario[] = [ dtmi: "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", expectedUri: "https://www.devicemodels.contoso.com/dtmi/contoso/fakedevicemanagement/deviceinformation-1.expanded.json", - mockedResponse: [{ "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", fakeDtdl: "fakeBodyAsText" }], - expectedOutputJson: { "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", fakeDtdl: "fakeBodyAsText" } + mockedResponse: [ + { + "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + fakeDtdl: "fakeBodyAsText" + } + ], + expectedOutputJson: { + "@id": "dtmi:contoso:FakeDeviceManagement:DeviceInformation;1", + fakeDtdl: "fakeBodyAsText" + } }, - { + { dtmi: "dtmi:com:FooFooFoo;4", - expectedUri: - "https://www.devicemodels.contoso.com/dtmi/com/foofoofoo-4.expanded.json", + expectedUri: "https://www.devicemodels.contoso.com/dtmi/com/foofoofoo-4.expanded.json", mockedResponse: [{ "@id": "dtmi:com:FooFooFoo;4", fakeDtdl: "fakeBodyAsText" }], expectedOutputJson: { "@id": "dtmi:com:FooFooFoo;4", fakeDtdl: "fakeBodyAsText" } } @@ -117,14 +143,16 @@ describe("resolver - node", function() { let myStub = sinon.stub(ServiceClient.prototype, "sendRequest"); for (let i = 0; i < scenario.dtmis.length; i++) { myStub.onCall(i).callsFake((request: PipelineRequest) => { - expect(request.url, "URL not formatted for request correctly.").to.deep.equal(scenario.dtmis[i].expectedUri); + expect(request.url, "URL not formatted for request correctly.").to.deep.equal( + scenario.dtmis[i].expectedUri + ); const pipelineResponse: any = { request: request, bodyAsText: JSON.stringify(scenario.dtmis[i].mockedResponse), status: 200, headers: undefined - } - return Promise.resolve(pipelineResponse) + }; + return Promise.resolve(pipelineResponse); }); } diff --git a/sdk/iot/modelsrepository/test/node/unit/constants.spec.ts b/sdk/iot/modelsrepository/test/node/unit/constants.spec.ts index a60d3886fa2f..0c450eaaf7c3 100644 --- a/sdk/iot/modelsrepository/test/node/unit/constants.spec.ts +++ b/sdk/iot/modelsrepository/test/node/unit/constants.spec.ts @@ -4,10 +4,10 @@ import * as cnst from "../../../src/constants"; import { readFileSync } from "fs"; import { expect } from "chai"; -describe("constants", function () { - it("uses same version as package.json", function () { +describe("constants", function() { + it("uses same version as package.json", function() { const pkgjson = readFileSync("./package.json", "utf-8"); const pkgjsonVersion = JSON.parse(pkgjson).version; expect(cnst.SDK_VERSION).to.equal(pkgjsonVersion); - }) -}) \ No newline at end of file + }); +}); diff --git a/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts b/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts index 95c5d342c76f..34af79b412fa 100644 --- a/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts +++ b/sdk/iot/modelsrepository/test/node/unit/dtmiConventions.spec.ts @@ -1,101 +1,97 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import * as lib from '../../../src/dtmiConventions' +import * as lib from "../../../src/dtmiConventions"; -import { assert, expect } from 'chai' +import { assert, expect } from "chai"; interface TestCase { - dtmi: string, - valid: boolean, - expectedPath?: string - expectedURL?: string + dtmi: string; + valid: boolean; + expectedPath?: string; + expectedURL?: string; } const testCases: TestCase[] = [ { - dtmi: 'dtmi:azure:DeviceManagement:DeviceInformation;1', + dtmi: "dtmi:azure:DeviceManagement:DeviceInformation;1", valid: true, - expectedPath: 'dtmi/azure/devicemanagement/deviceinformation-1.json', - expectedURL: 'https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json' + expectedPath: "dtmi/azure/devicemanagement/deviceinformation-1.json", + expectedURL: "https://contoso.com/dtmi/azure/devicemanagement/deviceinformation-1.json" }, - { - dtmi: 'dtmiazure:DeviceManagement:DeviceInformation;1', - valid: false, + { + dtmi: "dtmiazure:DeviceManagement:DeviceInformation;1", + valid: false }, - { - dtmi: 'dtmi:foobar:DeviceInformation;1', + { + dtmi: "dtmi:foobar:DeviceInformation;1", valid: true, - expectedPath: 'dtmi/foobar/deviceinformation-1.json', - expectedURL: 'https://contoso.com/dtmi/foobar/deviceinformation-1.json' + expectedPath: "dtmi/foobar/deviceinformation-1.json", + expectedURL: "https://contoso.com/dtmi/foobar/deviceinformation-1.json" } -] +]; -const fakeBasePath = 'https://contoso.com' +const fakeBasePath = "https://contoso.com"; - -describe('dtmiConventions', function () { +describe("dtmiConventions", function() { testCases.forEach((testCase) => { - describe('isValidDtmi', function () { + describe("isValidDtmi", function() { if (testCase.valid) { - it(`valid dtmi - ${testCase.dtmi}`, function () { + it(`valid dtmi - ${testCase.dtmi}`, function() { const result = lib.isValidDtmi(testCase.dtmi); - assert(result, `${testCase.dtmi} was incorrectly labelled invalid.`) + assert(result, `${testCase.dtmi} was incorrectly labelled invalid.`); }); } else { - it(`invalid dtmi - ${testCase.dtmi}`, function () { + it(`invalid dtmi - ${testCase.dtmi}`, function() { const result = lib.isValidDtmi(testCase.dtmi); - expect(result, `${testCase.dtmi} was incorrectly labelled as valid.`).to.be.false - }) + expect(result, `${testCase.dtmi} was incorrectly labelled as valid.`).to.be.false; + }); } }); }); testCases.forEach((testCase) => { - describe('convertDtmiToPath', function () { + describe("convertDtmiToPath", function() { if (testCase.valid) { - it(`converts dtmi to path - ${testCase.dtmi}`, function () { - const result = lib.convertDtmiToPath(testCase.dtmi, false) + it(`converts dtmi to path - ${testCase.dtmi}`, function() { + const result = lib.convertDtmiToPath(testCase.dtmi, false); expect(result).to.deep.equal(testCase.expectedPath); - }) - it(`converts dtmi to expanded path - ${testCase.dtmi}`, function () { - const result = lib.convertDtmiToPath(testCase.dtmi, true) - const expected = testCase.expectedPath?.replace('.json', '.expanded.json'); + }); + it(`converts dtmi to expanded path - ${testCase.dtmi}`, function() { + const result = lib.convertDtmiToPath(testCase.dtmi, true); + const expected = testCase.expectedPath?.replace(".json", ".expanded.json"); expect(result).to.deep.equal(expected); - }) + }); } else { - it(`throw error on invalid dtmi - ${testCase.dtmi}`, function () { + it(`throw error on invalid dtmi - ${testCase.dtmi}`, function() { expect(() => { - lib.convertDtmiToPath(testCase.dtmi, false) - }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.') - }) + lib.convertDtmiToPath(testCase.dtmi, false); + }).to.throw("DTMI provided is invalid. Ensure it follows DTMI conventions."); + }); } - }) + }); }); testCases.forEach((testCase) => { - describe('getModelUri', function () { + describe("getModelUri", function() { if (testCase.valid) { - it(`generates model uri - ${testCase.dtmi}`, function () { + it(`generates model uri - ${testCase.dtmi}`, function() { const result = lib.getModelUri(testCase.dtmi, fakeBasePath, false); expect(result).to.equal(testCase.expectedURL); - }) + }); - it(`generates expanded model uri - ${testCase.dtmi}`, function () { - const result = lib.getModelUri(testCase.dtmi, fakeBasePath, true) - const expected = testCase.expectedURL?.replace('.json', '.expanded.json'); + it(`generates expanded model uri - ${testCase.dtmi}`, function() { + const result = lib.getModelUri(testCase.dtmi, fakeBasePath, true); + const expected = testCase.expectedURL?.replace(".json", ".expanded.json"); expect(result).to.equal(expected); - }) + }); } else { - it('should fail if the dtmi is not formatted correctly', function () { + it("should fail if the dtmi is not formatted correctly", function() { expect(() => { - lib.getModelUri(testCase.dtmi, fakeBasePath, false) - }).to.throw('DTMI provided is invalid. Ensure it follows DTMI conventions.') - }) + lib.getModelUri(testCase.dtmi, fakeBasePath, false); + }).to.throw("DTMI provided is invalid. Ensure it follows DTMI conventions."); + }); } - - - - }) + }); }); -}) +}); diff --git a/sdk/iot/modelsrepository/tsconfig.json b/sdk/iot/modelsrepository/tsconfig.json index 93e65b17a3da..4d42c181c40b 100644 --- a/sdk/iot/modelsrepository/tsconfig.json +++ b/sdk/iot/modelsrepository/tsconfig.json @@ -8,9 +8,5 @@ "@azure/iot-modelsrepository": ["./src/index"] } }, - "include": [ - "src/**/*.ts", - "test/**/*.ts", - "samples-dev/**/*.ts" - ] + "include": ["src/**/*.ts", "test/**/*.ts", "samples-dev/**/*.ts"] } From fd2866246df5c13f92b3ee34bb0f1cc0a2134784 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 17:14:32 -0700 Subject: [PATCH 70/81] adjust --- sdk/iot/modelsrepository/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index ad241b2f3c9d..5e2cfea53c0c 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -65,7 +65,7 @@ "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", "dependencies": { "@azure/core-client": "^1.0.0", - "@azure/core-rest-pipeline": "^1.0.3", + "@azure/core-rest-pipeline": "^1.0.0", "@azure/core-tracing": "1.0.0-preview.11", "@azure/logger": "^1.0.0", "events": "^3.0.0", From e4e0aadc090382a0d2a25777e1bbf6d555a941fa Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 17:29:43 -0700 Subject: [PATCH 71/81] date --- sdk/iot/modelsrepository/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index 5e2cfea53c0c..ad241b2f3c9d 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -65,7 +65,7 @@ "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", "dependencies": { "@azure/core-client": "^1.0.0", - "@azure/core-rest-pipeline": "^1.0.0", + "@azure/core-rest-pipeline": "^1.0.3", "@azure/core-tracing": "1.0.0-preview.11", "@azure/logger": "^1.0.0", "events": "^3.0.0", From cd321181815da2d22c4d57565888420c8ace1dc7 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 18:10:04 -0700 Subject: [PATCH 72/81] update lockfile --- common/config/rush/pnpm-lock.yaml | 1675 +++++++++++++++-------------- 1 file changed, 842 insertions(+), 833 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index fbbcee2c0b8f..de5736193ca1 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -38,7 +38,6 @@ dependencies: '@rush-temp/eventhubs-checkpointstore-blob': file:projects/eventhubs-checkpointstore-blob.tgz '@rush-temp/identity': file:projects/identity.tgz '@rush-temp/iot-device-update': file:projects/iot-device-update.tgz - '@rush-temp/iot-modelsrepository': file:projects/iot-modelsrepository.tgz '@rush-temp/keyvault-admin': file:projects/keyvault-admin.tgz '@rush-temp/keyvault-certificates': file:projects/keyvault-certificates.tgz '@rush-temp/keyvault-common': file:projects/keyvault-common.tgz @@ -83,6 +82,7 @@ dependencies: '@rush-temp/test-utils': file:projects/test-utils.tgz '@rush-temp/test-utils-perfstress': file:projects/test-utils-perfstress.tgz '@rush-temp/test-utils-recorder': file:projects/test-utils-recorder.tgz + '@rush-temp/video-analyzer-edge': file:projects/video-analyzer-edge.tgz '@rush-temp/web-pubsub': file:projects/web-pubsub.tgz '@rush-temp/web-pubsub-express': file:projects/web-pubsub-express.tgz lockfileVersion: 5.2 @@ -99,7 +99,7 @@ packages: dependencies: '@azure/core-auth': 1.3.0 '@azure/core-http': 1.2.4 - '@azure/core-lro': 1.0.4 + '@azure/core-lro': 1.0.5 '@azure/core-paging': 1.1.3 '@azure/core-tracing': 1.0.0-preview.11 '@azure/logger': 1.0.2 @@ -113,7 +113,7 @@ packages: dependencies: '@azure/core-auth': 1.3.0 '@azure/core-http': 1.2.4 - '@azure/core-lro': 1.0.4 + '@azure/core-lro': 1.0.5 '@azure/core-paging': 1.1.3 '@azure/core-tracing': 1.0.0-preview.9 '@azure/logger': 1.0.2 @@ -129,7 +129,7 @@ packages: '@azure/ms-rest-nodeauth': 0.9.3_debug@3.2.7 '@types/async-lock': 1.1.2 '@types/is-buffer': 2.0.0 - async-lock: 1.2.8 + async-lock: 1.3.0 buffer: 5.7.1 debug: 3.2.7 events: 3.3.0 @@ -145,14 +145,6 @@ packages: dev: false resolution: integrity: sha512-RVG1Ad3Afv9gwFFmpeCXQAm+Sa0L8KEZRJJAAZEGoYDb6EoO1iQDVmoBz720h8mdrGpi0D60xNU/KhriIwuZfQ== - /@azure/arm-containerregistry/8.0.0: - dependencies: - '@azure/ms-rest-azure-js': 2.1.0 - '@azure/ms-rest-js': 2.3.0 - tslib: 1.14.1 - dev: false - resolution: - integrity: sha512-8v+3YtATbaFv5qMGvhFVR+qx1QPc1+NBy2MWWoJ69SmEE1X91ySvXDbEa0Pr7znm/bqbBYWOLJN5L3Aa7Q0fpg== /@azure/communication-signaling/1.0.0-beta.5: dependencies: '@azure/core-http': 1.2.4 @@ -166,13 +158,13 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-pGXI4F5OVzdM9Omg5fiflA/Vvs88qqER/ZxNj3PoWAdaYIPkWGb86OClbB0VsHi6gZ4ZDzyTP/l9hrREBuBYRA== - /@azure/core-amqp/2.2.0: + /@azure/core-amqp/2.3.0: dependencies: '@azure/abort-controller': 1.0.4 '@azure/core-auth': 1.3.0 '@azure/logger': 1.0.2 '@types/async-lock': 1.1.2 - async-lock: 1.2.8 + async-lock: 1.3.0 buffer: 5.7.1 events: 3.3.0 jssha: 3.2.0 @@ -186,7 +178,7 @@ packages: engines: node: '>=8.0.0' resolution: - integrity: sha512-Nt81a8097+ofBAQfnil5UWw0o5/D3bYfqyJY7e1wrP2RlR/6Fig9zSj4tLe/oiMmE4gvDoK5X8kGIbhswne0Yw== + integrity: sha512-zjzQGZIQ9ei9aIcqdFVNmfSAKdg5N9aCa+ff93VOte5vOuc/8w+Fd/PJ+ZT3m5Z6jeC+yiiwwSQ9KYqNa5XMlw== /@azure/core-asynciterator-polyfill/1.0.0: dev: false resolution: @@ -222,7 +214,7 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-cNumz3ckyFZY5zWOgcTHSO7AKRVwxbodG8WfcEGcdH+ZJL3KvJEI/vN58H6xk5v3ijulU2x/WPGJqrMVvcI79A== - /@azure/core-lro/1.0.4: + /@azure/core-lro/1.0.5: dependencies: '@azure/abort-controller': 1.0.4 '@azure/core-http': 1.2.4 @@ -233,7 +225,7 @@ packages: engines: node: '>=8.0.0' resolution: - integrity: sha512-4IVqLl6NIqxVzL+zMdf9Nwa1ZUPuoG/IAMoWQIA6qgpKuAiPy/KiH4Q5j0Zn0q20GFiymQeLcCIH82LSlbQBTQ== + integrity: sha512-0EFCFZxARrIoLWMIRt4vuqconRVIO2Iin7nFBfJiYCCbKp5eEmxutNk8uqudPmG0XFl5YqlVh68/al/vbE5OOg== /@azure/core-paging/1.1.3: dependencies: '@azure/core-asynciterator-polyfill': 1.0.0 @@ -258,22 +250,6 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-GbfBQHF83RQI+LVISh8RLKpPeyufFsu6FhwB0U1inN7BWo8GuE23s0vc/D4gd5AWww7orQ20Q3zMzW5FKFs4MQ== - /@azure/core-rest-pipeline/1.1.0-beta.1: - dependencies: - '@azure/abort-controller': 1.0.4 - '@azure/core-auth': 1.3.0 - '@azure/core-tracing': 1.0.0-preview.11 - '@azure/logger': 1.0.2 - form-data: 3.0.1 - http-proxy-agent: 4.0.1 - https-proxy-agent: 5.0.0 - tslib: 2.2.0 - uuid: 8.3.2 - dev: false - engines: - node: '>=8.0.0' - resolution: - integrity: sha512-yHRf2h6n6pPidMOdFOdmm2a2O+xRCk9inEtx21+78tSNyVhc1C83seT7WpuE1J6YDmN3MDklAJtA/4n9WvB4Lw== /@azure/core-tracing/1.0.0-preview.10: dependencies: '@opencensus/web-types': 0.0.7 @@ -317,7 +293,7 @@ packages: dependencies: '@azure/amqp-common': 1.0.0-preview.9 '@azure/ms-rest-nodeauth': 0.9.3_debug@3.2.7 - async-lock: 1.2.8 + async-lock: 1.3.0 debug: 3.2.7 is-buffer: 2.0.5 jssha: 2.4.2 @@ -337,7 +313,7 @@ packages: axios: 0.21.1 events: 3.3.0 jws: 4.0.0 - msal: 1.4.9 + msal: 1.4.11 open: 7.4.2 qs: 6.10.1 stoppable: 1.1.0 @@ -347,7 +323,7 @@ packages: engines: node: '>=8.0.0' optionalDependencies: - keytar: 7.6.0 + keytar: 7.7.0 resolution: integrity: sha512-qYTaWA+5ir4+/iEry7n3l1TyeNhTHP8IRpjsbNv8ur8W/QjqZmCz1H2naebRp5tQmehXfo1pUrp2ew+qGhTh0g== /@azure/identity/1.3.0_debug@4.3.1: @@ -360,7 +336,7 @@ packages: axios: 0.21.1_debug@4.3.1 events: 3.3.0 jws: 4.0.0 - msal: 1.4.9 + msal: 1.4.11 open: 7.4.2 qs: 6.10.1 stoppable: 1.1.0 @@ -370,7 +346,7 @@ packages: engines: node: '>=8.0.0' optionalDependencies: - keytar: 7.6.0 + keytar: 7.7.0 peerDependencies: debug: '*' resolution: @@ -383,7 +359,7 @@ packages: '@azure/logger': 1.0.2 '@azure/msal-browser': 2.9.0 '@azure/msal-common': 4.0.3 - '@azure/msal-node': 1.0.2 + '@azure/msal-node': 1.1.0 '@types/stoppable': 1.1.0 events: 3.3.0 jws: 4.0.0 @@ -397,6 +373,21 @@ packages: node: '>=8.0.0' resolution: integrity: sha512-eOHstXRBRntoqBLi3bugYBEHpYkm0JiET6y5+P1fz7dqYRFN6hJW8qMJQtYIzIbpXJfRJTJdoiOS5fDQhsez0A== + /@azure/keyvault-secrets/4.1.0: + dependencies: + '@azure/abort-controller': 1.0.4 + '@azure/core-http': 1.2.4 + '@azure/core-lro': 1.0.5 + '@azure/core-paging': 1.1.3 + '@azure/core-tracing': 1.0.0-preview.9 + '@azure/logger': 1.0.2 + '@opentelemetry/api': 0.10.2 + tslib: 2.2.0 + dev: false + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-26ARU97svPkv8q6QbIdwdky8ntn+Q5mxTTCjpp9FUIyA2LTXmEL0wZDPBeM3mxZLHKnMEXQxEo+KYutrJW5xPQ== /@azure/logger-js/1.3.2: dependencies: tslib: 1.14.1 @@ -419,14 +410,6 @@ packages: dev: false resolution: integrity: sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw== - /@azure/ms-rest-azure-js/2.1.0: - dependencies: - '@azure/core-auth': 1.3.0 - '@azure/ms-rest-js': 2.3.0 - tslib: 1.14.1 - dev: false - resolution: - integrity: sha512-CjZjB8apvXl5h97Ck6SbeeCmU0sk56YPozPtTyGudPp1RGoHXNjFNtoOvwOG76EdpmMpxbK10DqcygI16Lu60Q== /@azure/ms-rest-js/1.11.2_debug@3.2.7: dependencies: '@azure/core-auth': 1.3.0 @@ -457,7 +440,7 @@ packages: debug: '*' resolution: integrity: sha512-2AyQ1IKmLGKW7DU3/x3TsTBzZLcbC9YRI+yuDPuXAQrv3zar340K9wsxU413kHFIDjkWNCo9T0w5VtwcyWxhbQ== - /@azure/ms-rest-js/2.3.0: + /@azure/ms-rest-js/2.5.0: dependencies: '@azure/core-auth': 1.3.0 abort-controller: 3.0.0 @@ -470,7 +453,7 @@ packages: xml2js: 0.4.23 dev: false resolution: - integrity: sha512-8NOnHgovi61NpcUld53zRkY/IcQJBBO48VeMntNTUtaPo8yYYTnu1hWRvp6b6vpBnur7HGmuj692J9li5Kx6/Q== + integrity: sha512-mXezdECH1Vjr+7FkH5+LlL85/YEHOrXHYqd9qh8b6dgvvE7sVvUk3qrtRGk3WZr4TLrZvRLE7NbFU7RgHHg45Q== /@azure/ms-rest-nodeauth/0.9.3_debug@3.2.7: dependencies: '@azure/ms-rest-azure-env': 1.1.2 @@ -491,14 +474,22 @@ packages: debug: '*' resolution: integrity: sha512-aFHRw/IHhg3I9ZJW+Va4L+sCirFHMVIu6B7lFdL5mGLfG3xC5vDIdd957LRXFgy2OiKFRUC0QaKknd0YCsQIqA== - /@azure/ms-rest-nodeauth/3.0.9: + /@azure/ms-rest-nodeauth/3.0.10: dependencies: '@azure/ms-rest-azure-env': 2.0.0 - '@azure/ms-rest-js': 2.3.0 - adal-node: 0.1.28 + '@azure/ms-rest-js': 2.5.0 + adal-node: 0.2.2 + dev: false + resolution: + integrity: sha512-oel7ibYlredh2wo7XwNYMx4jWlbMkIzCC8t8VpdhsAWDJVNSSce+DYj5jjZn1oED+QsCytVM2B7/QTuLN1/yDw== + /@azure/msal-browser/2.14.2: + dependencies: + '@azure/msal-common': 4.3.0 dev: false + engines: + node: '>=0.8.0' resolution: - integrity: sha512-+GdDHUJlWtIDanRZemFooLy68NsBDhN/Oni9DSFeoXIFNGlSe1IOes8/IRkQdrNXyUvBanuzzR7I5WYYzYQsmA== + integrity: sha512-JKHE9Rer41CI8tweiyE91M8ZbGvQV9P+jOPB4ZtPxyxCi2f7ED3jNfdzyUJ1eGB+hCRnvO56M1Xc61T1R+JfYg== /@azure/msal-browser/2.9.0: dependencies: '@azure/msal-common': 2.1.0 @@ -523,17 +514,17 @@ packages: node: '>=0.8.0' resolution: integrity: sha512-EihnqHh2EE6xcB0Dh2LF30jE1Ga9cgh9PyRkX4fj+KpvYfL4ae57hvQwJGkynUgpf3V1xQxU5yaJVXOElfXiGw== - /@azure/msal-common/4.2.0: + /@azure/msal-common/4.3.0: dependencies: debug: 4.3.1 dev: false engines: node: '>=0.8.0' resolution: - integrity: sha512-dOImswKoo0E0t/j6ePcWYBZ2oPrt9I7LeuXfW9zxbPBRwfqpd0MBHjTXkCFZinn0xW8UbzCnWT7DxP/4UsOQLA== + integrity: sha512-jFqUWe83wVb6O8cNGGBFg2QlKvqM1ezUgJTEV7kIsAPX0RXhGFE4B1DLNt6hCnkTXDbw+KGW0zgxOEr4MJQwLw== /@azure/msal-node/1.0.0-beta.6: dependencies: - '@azure/msal-common': 4.2.0 + '@azure/msal-common': 4.3.0 axios: 0.21.1 jsonwebtoken: 8.5.1 uuid: 8.3.2 @@ -542,7 +533,7 @@ packages: integrity: sha512-ZQI11Uz1j0HJohb9JZLRD8z0moVcPks1AFW4Q/Gcl67+QvH4aKEJti7fjCcipEEZYb/qzLSO8U6IZgPYytsiJQ== /@azure/msal-node/1.0.0-beta.6_debug@4.3.1: dependencies: - '@azure/msal-common': 4.2.0 + '@azure/msal-common': 4.3.0 axios: 0.21.1_debug@4.3.1 jsonwebtoken: 8.5.1 uuid: 8.3.2 @@ -551,21 +542,21 @@ packages: debug: '*' resolution: integrity: sha512-ZQI11Uz1j0HJohb9JZLRD8z0moVcPks1AFW4Q/Gcl67+QvH4aKEJti7fjCcipEEZYb/qzLSO8U6IZgPYytsiJQ== - /@azure/msal-node/1.0.2: + /@azure/msal-node/1.1.0: dependencies: - '@azure/msal-common': 4.2.0 + '@azure/msal-common': 4.3.0 axios: 0.21.1 jsonwebtoken: 8.5.1 uuid: 8.3.2 dev: false engines: - node: 10 || 12 || 14 + node: 10 || 12 || 14 || 16 resolution: - integrity: sha512-ZOHmoImpePXWTUS+78jzMgbhyTzeW0ydI3dJ9DupZZBxImV+Bqz5wfth0yKdNGV65rKWYuUIQtBVjnGwSqmpTQ== - /@azure/service-bus/7.0.5: + integrity: sha512-gMO9aZdWOzufp1PcdD5ID25DdS9eInxgeCqx4Tk8PVU6Z7RxJQhoMzS64cJhGdpYgeIQwKljtF0CLCcPFxew/w== + /@azure/service-bus/7.1.0: dependencies: '@azure/abort-controller': 1.0.4 - '@azure/core-amqp': 2.2.0 + '@azure/core-amqp': 2.3.0 '@azure/core-asynciterator-polyfill': 1.0.0 '@azure/core-auth': 1.3.0 '@azure/core-http': 1.2.4 @@ -585,12 +576,12 @@ packages: engines: node: '>=8.0.0' resolution: - integrity: sha512-x3VgZFLsmhnTka6IpKePHcibm3znMhcrSsVoVlMOCQSgoJrTSTuczRh4S9/c55pj8M+EQ6FdPweQY6Ld+g/qiQ== + integrity: sha512-INOR23hOISEe2OgwlNhM/BA5+uJmLfx5jqE21wLkQBHNzusdn7P65LT3Zu/AX84ofJO0Z0q+QjY6XOhpFLW90w== /@azure/storage-blob/12.5.0: dependencies: '@azure/abort-controller': 1.0.4 '@azure/core-http': 1.2.4 - '@azure/core-lro': 1.0.4 + '@azure/core-lro': 1.0.5 '@azure/core-paging': 1.1.3 '@azure/core-tracing': 1.0.0-preview.10 '@azure/logger': 1.0.2 @@ -604,31 +595,31 @@ packages: integrity: sha512-DgoefgODst2IPkkQsNdhtYdyJgSsAZC1pEujO6aD5y7uFy5GnzhYliobSrp204jYRyK5XeJ9iiePmy/SPtTbLA== /@babel/code-frame/7.12.11: dependencies: - '@babel/highlight': 7.13.10 + '@babel/highlight': 7.14.0 dev: false resolution: integrity: sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== /@babel/code-frame/7.12.13: dependencies: - '@babel/highlight': 7.13.10 + '@babel/highlight': 7.14.0 dev: false resolution: integrity: sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g== - /@babel/compat-data/7.13.12: + /@babel/compat-data/7.14.0: dev: false resolution: - integrity: sha512-3eJJ841uKxeV8dcN/2yGEUy+RfgQspPEgQat85umsE1rotuquQ2AbIub4S6j7c50a2d+4myc+zSlnXeIHrOnhQ== - /@babel/core/7.13.14: + integrity: sha512-vu9V3uMM/1o5Hl5OekMUowo3FqXLJSw+s+66nt0fSWVWTtmosdzn45JHOB3cPtZoe6CTBDzvSw0RdOY85Q37+Q== + /@babel/core/7.14.3: dependencies: '@babel/code-frame': 7.12.13 - '@babel/generator': 7.13.9 - '@babel/helper-compilation-targets': 7.13.13_@babel+core@7.13.14 - '@babel/helper-module-transforms': 7.13.14 - '@babel/helpers': 7.13.10 - '@babel/parser': 7.13.13 + '@babel/generator': 7.14.3 + '@babel/helper-compilation-targets': 7.13.16_@babel+core@7.14.3 + '@babel/helper-module-transforms': 7.14.2 + '@babel/helpers': 7.14.0 + '@babel/parser': 7.14.3 '@babel/template': 7.12.13 - '@babel/traverse': 7.13.13 - '@babel/types': 7.13.14 + '@babel/traverse': 7.14.2 + '@babel/types': 7.14.2 convert-source-map: 1.7.0 debug: 4.3.1 gensync: 1.0.0-beta.2 @@ -639,159 +630,158 @@ packages: engines: node: '>=6.9.0' resolution: - integrity: sha512-wZso/vyF4ki0l0znlgM4inxbdrUvCb+cVz8grxDq+6C9k6qbqoIJteQOKicaKjCipU3ISV+XedCqpL2RJJVehA== - /@babel/generator/7.13.9: + integrity: sha512-jB5AmTKOCSJIZ72sd78ECEhuPiDMKlQdDI/4QRI6lzYATx5SSogS1oQA2AoPecRCknm30gHi2l+QVvNUu3wZAg== + /@babel/generator/7.14.3: dependencies: - '@babel/types': 7.13.14 + '@babel/types': 7.14.2 jsesc: 2.5.2 source-map: 0.5.7 dev: false resolution: - integrity: sha512-mHOOmY0Axl/JCTkxTU6Lf5sWOg/v8nUa+Xkt4zMTftX0wqmb6Sh7J8gvcehBw7q0AhrhAR+FDacKjCZ2X8K+Sw== - /@babel/helper-compilation-targets/7.13.13_@babel+core@7.13.14: + integrity: sha512-bn0S6flG/j0xtQdz3hsjJ624h3W0r3llttBMfyHX3YrZ/KtLYr15bjA0FXkgW7FpvrDuTuElXeVjiKlYRpnOFA== + /@babel/helper-compilation-targets/7.13.16_@babel+core@7.14.3: dependencies: - '@babel/compat-data': 7.13.12 - '@babel/core': 7.13.14 + '@babel/compat-data': 7.14.0 + '@babel/core': 7.14.3 '@babel/helper-validator-option': 7.12.17 - browserslist: 4.16.3 + browserslist: 4.16.6 semver: 6.3.0 dev: false peerDependencies: '@babel/core': ^7.0.0 resolution: - integrity: sha512-q1kcdHNZehBwD9jYPh3WyXcsFERi39X4I59I3NadciWtNDyZ6x+GboOxncFK0kXlKIv6BJm5acncehXWUjWQMQ== - /@babel/helper-function-name/7.12.13: + integrity: sha512-3gmkYIrpqsLlieFwjkGgLaSHmhnvlAYzZLlYVjlW+QwI+1zE17kGxuJGmIqDQdYp56XdmGeD+Bswx0UTyG18xA== + /@babel/helper-function-name/7.14.2: dependencies: '@babel/helper-get-function-arity': 7.12.13 '@babel/template': 7.12.13 - '@babel/types': 7.13.14 + '@babel/types': 7.14.2 dev: false resolution: - integrity: sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA== + integrity: sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ== /@babel/helper-get-function-arity/7.12.13: dependencies: - '@babel/types': 7.13.14 + '@babel/types': 7.14.2 dev: false resolution: integrity: sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg== /@babel/helper-member-expression-to-functions/7.13.12: dependencies: - '@babel/types': 7.13.14 + '@babel/types': 7.14.2 dev: false resolution: integrity: sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw== /@babel/helper-module-imports/7.13.12: dependencies: - '@babel/types': 7.13.14 + '@babel/types': 7.14.2 dev: false resolution: integrity: sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA== - /@babel/helper-module-transforms/7.13.14: + /@babel/helper-module-transforms/7.14.2: dependencies: '@babel/helper-module-imports': 7.13.12 - '@babel/helper-replace-supers': 7.13.12 + '@babel/helper-replace-supers': 7.14.3 '@babel/helper-simple-access': 7.13.12 '@babel/helper-split-export-declaration': 7.12.13 - '@babel/helper-validator-identifier': 7.12.11 + '@babel/helper-validator-identifier': 7.14.0 '@babel/template': 7.12.13 - '@babel/traverse': 7.13.13 - '@babel/types': 7.13.14 + '@babel/traverse': 7.14.2 + '@babel/types': 7.14.2 dev: false resolution: - integrity: sha512-QuU/OJ0iAOSIatyVZmfqB0lbkVP0kDRiKj34xy+QNsnVZi/PA6BoSoreeqnxxa9EHFAIL0R9XOaAR/G9WlIy5g== + integrity: sha512-OznJUda/soKXv0XhpvzGWDnml4Qnwp16GN+D/kZIdLsWoHj05kyu8Rm5kXmMef+rVJZ0+4pSGLkeixdqNUATDA== /@babel/helper-optimise-call-expression/7.12.13: dependencies: - '@babel/types': 7.13.14 + '@babel/types': 7.14.2 dev: false resolution: integrity: sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA== - /@babel/helper-replace-supers/7.13.12: + /@babel/helper-replace-supers/7.14.3: dependencies: '@babel/helper-member-expression-to-functions': 7.13.12 '@babel/helper-optimise-call-expression': 7.12.13 - '@babel/traverse': 7.13.13 - '@babel/types': 7.13.14 + '@babel/traverse': 7.14.2 + '@babel/types': 7.14.2 dev: false resolution: - integrity: sha512-Gz1eiX+4yDO8mT+heB94aLVNCL+rbuT2xy4YfyNqu8F+OI6vMvJK891qGBTqL9Uc8wxEvRW92Id6G7sDen3fFw== + integrity: sha512-Rlh8qEWZSTfdz+tgNV/N4gz1a0TMNwCUcENhMjHTHKp3LseYH5Jha0NSlyTQWMnjbYcwFt+bqAMqSLHVXkQ6UA== /@babel/helper-simple-access/7.13.12: dependencies: - '@babel/types': 7.13.14 + '@babel/types': 7.14.2 dev: false resolution: integrity: sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA== /@babel/helper-split-export-declaration/7.12.13: dependencies: - '@babel/types': 7.13.14 + '@babel/types': 7.14.2 dev: false resolution: integrity: sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg== - /@babel/helper-validator-identifier/7.12.11: + /@babel/helper-validator-identifier/7.14.0: dev: false resolution: - integrity: sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== + integrity: sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A== /@babel/helper-validator-option/7.12.17: dev: false resolution: integrity: sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw== - /@babel/helpers/7.13.10: + /@babel/helpers/7.14.0: dependencies: '@babel/template': 7.12.13 - '@babel/traverse': 7.13.13 - '@babel/types': 7.13.14 + '@babel/traverse': 7.14.2 + '@babel/types': 7.14.2 dev: false resolution: - integrity: sha512-4VO883+MWPDUVRF3PhiLBUFHoX/bsLTGFpFK/HqvvfBZz2D57u9XzPVNFVBTc0PW/CWR9BXTOKt8NF4DInUHcQ== - /@babel/highlight/7.13.10: + integrity: sha512-+ufuXprtQ1D1iZTO/K9+EBRn+qPWMJjZSw/S0KlFrxCw4tkrzv9grgpDHkY9MeQTjTY8i2sp7Jep8DfU6tN9Mg== + /@babel/highlight/7.14.0: dependencies: - '@babel/helper-validator-identifier': 7.12.11 + '@babel/helper-validator-identifier': 7.14.0 chalk: 2.4.2 js-tokens: 4.0.0 dev: false resolution: - integrity: sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg== - /@babel/parser/7.13.13: + integrity: sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg== + /@babel/parser/7.14.3: dev: false engines: node: '>=6.0.0' hasBin: true resolution: - integrity: sha512-OhsyMrqygfk5v8HmWwOzlYjJrtLaFhF34MrfG/Z73DgYCI6ojNUTUp2TYbtnjo8PegeJp12eamsNettCQjKjVw== - /@babel/runtime/7.13.10: + integrity: sha512-7MpZDIfI7sUC5zWo2+foJ50CSI5lcqDehZ0lVgIhSi4bFEk94fLAKlF3Q0nzSQQ+ca0lm+O6G9ztKVBeu8PMRQ== + /@babel/runtime/7.14.0: dependencies: regenerator-runtime: 0.13.7 dev: false resolution: - integrity: sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw== + integrity: sha512-JELkvo/DlpNdJ7dlyw/eY7E0suy5i5GQH+Vlxaq1nsNJ+H7f4Vtv3jMeCEgRhZZQFXTjldYfQgv2qmM6M1v5wA== /@babel/template/7.12.13: dependencies: '@babel/code-frame': 7.12.13 - '@babel/parser': 7.13.13 - '@babel/types': 7.13.14 + '@babel/parser': 7.14.3 + '@babel/types': 7.14.2 dev: false resolution: integrity: sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA== - /@babel/traverse/7.13.13: + /@babel/traverse/7.14.2: dependencies: '@babel/code-frame': 7.12.13 - '@babel/generator': 7.13.9 - '@babel/helper-function-name': 7.12.13 + '@babel/generator': 7.14.3 + '@babel/helper-function-name': 7.14.2 '@babel/helper-split-export-declaration': 7.12.13 - '@babel/parser': 7.13.13 - '@babel/types': 7.13.14 + '@babel/parser': 7.14.3 + '@babel/types': 7.14.2 debug: 4.3.1 globals: 11.12.0 dev: false resolution: - integrity: sha512-CblEcwmXKR6eP43oQGG++0QMTtCjAsa3frUuzHoiIJWpaIIi8dwMyEFUJoXRLxagGqCK+jALRwIO+o3R9p/uUg== - /@babel/types/7.13.14: + integrity: sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA== + /@babel/types/7.14.2: dependencies: - '@babel/helper-validator-identifier': 7.12.11 - lodash: 4.17.21 + '@babel/helper-validator-identifier': 7.14.0 to-fast-properties: 2.0.0 dev: false resolution: - integrity: sha512-A2aa3QTkWoyqsZZFl56MLUsfmh7O0gN41IPvXAE/++8ojpbz12SszD7JEGYVdn4f9Kt4amIei07swF1h4AqmmQ== + integrity: sha512-SdjAG/3DikRHpUOjxZgnkbR11xUlyDMUFJdvnIgZEE16mqmY0BINMmc4//JMJglEmn6i7sq6p+mGrFWyZ98EEw== /@bahmutov/data-driven/1.0.0: dependencies: check-more-types: 2.24.0 @@ -801,7 +791,7 @@ packages: node: '>=6' resolution: integrity: sha512-YqW3hPS0RXriqjcCrLOTJj+LWe3c8JpwlL83k1ka1Q8U05ZjAKbGQZYeTzUd0NFEnnfPtsUiKGpFEBJG6kFuvg== - /@eslint/eslintrc/0.4.0: + /@eslint/eslintrc/0.4.1: dependencies: ajv: 6.12.6 debug: 4.3.1 @@ -816,7 +806,7 @@ packages: engines: node: ^10.12.0 || >=12.0.0 resolution: - integrity: sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog== + integrity: sha512-5v7TDE9plVhvxQeWLXDTvFvJBdH6pEsdnl2g/dAptmuFEPedQ4Erq5rsDsX+mvAM610IhNaO2W5V1dOOnDKxkQ== /@istanbuljs/schema/0.1.3: dev: false engines: @@ -869,15 +859,15 @@ packages: hasBin: true resolution: integrity: sha512-kd2kakdDoRgI54J5H11a76hyYZBMhtp4piwWAy4bYTwlQT0v/tp+G/UMMgjUL4vKf0kTNhitEUX/0LfQb1AHzQ== - /@microsoft/tsdoc-config/0.14.0: + /@microsoft/tsdoc-config/0.15.2: dependencies: - '@microsoft/tsdoc': 0.13.0 + '@microsoft/tsdoc': 0.13.2 ajv: 6.12.6 jju: 1.4.0 resolve: 1.19.0 dev: false resolution: - integrity: sha512-KSj15FwyaxMCGJkC320rvNXxuJNCOVO02pNqIEdf5cbLakvHK8afoHTmcjdBEWl0cfBFZlMu/1DhL4VCzZq0rQ== + integrity: sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA== /@microsoft/tsdoc/0.12.19: dev: false resolution: @@ -886,10 +876,10 @@ packages: dev: false resolution: integrity: sha512-Mfmij13RUTmHEMi9vRUhMXD7rnGR2VvxeNYtaGtaJ4redwwjT4UXYJ+nzmVJF7hhd4pn/Fx5sncDKxMVFJSWPg== - /@microsoft/tsdoc/0.13.0: + /@microsoft/tsdoc/0.13.2: dev: false resolution: - integrity: sha512-/8J+4DdvexBH1Qh1yR8VZ6bPay2DL/TDdmSIypAa3dAghJzsdaiZG8COvzpYIML6HV2UVN0g4qbuqzjG4YKgWg== + integrity: sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg== /@nodelib/fs.scandir/2.1.4: dependencies: '@nodelib/fs.stat': 2.0.4 @@ -1057,7 +1047,7 @@ packages: dependencies: '@types/estree': 0.0.39 estree-walker: 1.0.1 - picomatch: 2.2.2 + picomatch: 2.2.3 rollup: 1.32.1 dev: false engines: @@ -1116,21 +1106,21 @@ packages: dev: false resolution: integrity: sha512-8ghIWhkph7NnLCMDJtthpsb7TMOsVGXVDvmxjE/CeklTqjbbUFBjGXizJfpbEkRQTELuZQ2+vGn7sGwIWKN2uA== - /@sinonjs/commons/1.8.2: + /@sinonjs/commons/1.8.3: dependencies: type-detect: 4.0.8 dev: false resolution: - integrity: sha512-sruwd86RJHdsVf/AtBoijDmUqJp3B6hF/DGC23C+JaegnDHaZyewCjoVGTdg3J0uz3Zs7NnIT05OBOmML72lQw== + integrity: sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ== /@sinonjs/fake-timers/6.0.1: dependencies: - '@sinonjs/commons': 1.8.2 + '@sinonjs/commons': 1.8.3 dev: false resolution: integrity: sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA== /@sinonjs/samsam/5.3.1: dependencies: - '@sinonjs/commons': 1.8.2 + '@sinonjs/commons': 1.8.3 lodash.get: 4.4.2 type-detect: 4.0.8 dev: false @@ -1161,40 +1151,33 @@ packages: /@types/body-parser/1.19.0: dependencies: '@types/connect': 3.4.34 - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ== - /@types/chai-as-promised/7.1.3: + /@types/chai-as-promised/7.1.4: dependencies: - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 dev: false resolution: - integrity: sha512-FQnh1ohPXJELpKhzjuDkPLR2BZCAqed+a6xV4MI/T3XzHfd2FlarfUGUdZYgqYe8oxkYn0fchHEeHfHqdZ96sg== + integrity: sha512-1y3L1cHePcIm5vXkh1DSGf/zQq5n5xDKG1fpCvf18+uOkpce0Z1ozNFPkyWsVswK7ntN1sZBw3oU6gmN+pDUcA== /@types/chai-string/1.4.2: dependencies: - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 dev: false resolution: integrity: sha512-ld/1hV5qcPRGuwlPdvRfvM3Ka/iofOk2pH4VkasK4b1JJP1LjNmWWn0LsISf6RRzyhVOvs93rb9tM09e+UuF8Q== - /@types/chai/4.2.16: + /@types/chai/4.2.18: dev: false resolution: - integrity: sha512-vI5iOAsez9+roLS3M3+Xx7w+WRuDtSmF8bQkrbcIJ2sC1PcDgVoA0WGpa+bIrJ+y8zqY2oi//fUctkxtIcXJCw== - /@types/chalk/2.2.0: - dependencies: - chalk: 4.1.0 - deprecated: This is a stub types definition for chalk (https://github.com/chalk/chalk). chalk provides its own type definitions, so you don't need @types/chalk installed! - dev: false - resolution: - integrity: sha512-1zzPV9FDe1I/WHhRkf9SNgqtRJWZqrBWgu7JGveuHmmyR9CnAPCie2N/x+iHrgnpYBIcCJWHBoMRv2TRWktsvw== + integrity: sha512-rS27+EkB/RE1Iz3u0XtVL5q36MGDWbgYe7zWiodyKNUnthxY0rukK5V36eiUCtCisB7NN8zKYH6DO2M37qxFEQ== /@types/component-emitter/1.2.10: dev: false resolution: integrity: sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg== /@types/connect/3.4.34: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-ePPA/JuI+X0vb+gSWlPKOY0NdNAie/rPUqX2GUPpbZwiKTkSPhjXWuee47E4MtE54QVzGCQMQkAL6JhV2E1+cQ== @@ -1210,13 +1193,13 @@ packages: dev: false resolution: integrity: sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== - /@types/eslint/7.2.8: + /@types/eslint/7.2.10: dependencies: '@types/estree': 0.0.47 '@types/json-schema': 7.0.7 dev: false resolution: - integrity: sha512-RTKvBsfz0T8CKOGZMfuluDNyMFHnu5lvNr4hWEsQeHXH6FcmIDIozOyWMh36nLGMwVd5UFNXC2xztA8lln22MQ== + integrity: sha512-kUEPnMKrqbtpCq/KTaGFFKAcz6Ethm2EjCoKIDaCmfRBWLbFuTcOJfTlorwbnboXBzahqWLgUp1BQeKHiJzPUQ== /@types/estree/0.0.39: dev: false resolution: @@ -1227,7 +1210,7 @@ packages: integrity: sha512-c5ciR06jK8u9BstrmJyO97m+klJrrhCf9u3rLu3DEAJBirxRqSCvDQoYKmxuYwQI5SZChAWu+tq9oVlGRuzPAg== /@types/express-serve-static-core/4.17.19: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 '@types/qs': 6.9.6 '@types/range-parser': 1.2.3 dev: false @@ -1242,26 +1225,29 @@ packages: dev: false resolution: integrity: sha512-no+R6rW60JEc59977wIxreQVsIEOAYwgCqldrA/vkpCnbD7MqTefO97lmoBe4WE0F156bC4uLSP1XHDOySnChg== - /@types/fast-json-stable-stringify/2.0.0: + /@types/fast-json-stable-stringify/2.1.0: + dependencies: + fast-json-stable-stringify: 2.1.0 + deprecated: This is a stub types definition. fast-json-stable-stringify provides its own type definitions, so you do not need this installed. dev: false resolution: - integrity: sha512-mky/O83TXmGY39P1H9YbUpjV6l6voRYlufqfFCvel8l1phuy8HRjdWc1rrPuN53ITBJlbyMSV6z3niOySO5pgQ== + integrity: sha512-IyNhGHu71jH1jCXTHmafuoAAdsbBON3kDh7u/UUhLmjYgN5TYB54e1R8ckTCiIevl2UuZaCsi9XRxineY5yUjw== /@types/fs-extra/8.1.1: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w== /@types/glob/7.1.3: dependencies: '@types/minimatch': 3.0.4 - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w== /@types/is-buffer/2.0.0: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw== @@ -1275,17 +1261,17 @@ packages: integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4= /@types/jsonwebtoken/8.5.1: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-rNAPdomlIUX0i0cg2+I+Q1wOUr531zHBQ+cV/28PJ39bSPKjahatZZ2LMuhiguETkCgLVzfruw/ZvNMNkKoSzw== - /@types/jsrsasign/8.0.10: + /@types/jsrsasign/8.0.12: dev: false resolution: - integrity: sha512-TtLis3HRTt7wLfdpkDBem6vs+MbEGMsC7ob5gNYsJV40tHNAFxw00HMMsEHsg9FWduD38NtACWuSqQpXbFulUg== + integrity: sha512-FLXKbwbB+4fsJECYOpIiYX2GSqSHYnkO/UnrFqlZn6crpyyOtk4LRab+G1HC7dTbT1NB7spkHecZRQGXoCWiJQ== /@types/jws/3.2.3: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-g54CHxwvaHvyJyeuZqe7VQujV9SfCXwEkboJp355INPL+kjlS3Aq153EHptaeO/Cch/NPJ1i2sHz0sDDizn7LQ== @@ -1299,7 +1285,7 @@ packages: integrity: sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== /@types/md5/2.3.0: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-556YJ7ejzxIqSSxzyGGpctuZOarNZJt/zlEkhmmDc1f/slOEANHuwu2ZX7YaZ40rMiWoxt8GvAhoDpW1cmSy6A== @@ -1325,13 +1311,13 @@ packages: integrity: sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w== /@types/mock-fs/4.10.0: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-FQ5alSzmHMmliqcL36JqIA4Yyn9jyJKvRSGV3mvPh108VFatX7naJDzSG4fnFQNZFq9dIx0Dzoe6ddflMB2Xkg== /@types/mock-require/2.0.0: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-nOgjoE5bBiDeiA+z41i95makyHUSMWQMOPocP+J67Pqx/68HAXaeWN1NFtrAYYV6LrISIZZ8vKHm/a50k0f6Sg== @@ -1341,7 +1327,7 @@ packages: integrity: sha512-DPxmjiDwubsNmguG5X4fEJ+XCyzWM3GXWsqQlvUcjJKa91IOoJUy51meDr0GkzK64qqNcq85ymLlyjoct9tInw== /@types/node-fetch/2.5.10: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 form-data: 3.0.1 dev: false resolution: @@ -1350,14 +1336,10 @@ packages: dev: false resolution: integrity: sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== - /@types/node/10.17.56: + /@types/node/10.17.60: dev: false resolution: - integrity: sha512-LuAa6t1t0Bfw4CuSR0UITsm1hP17YL+u82kfHGrHUWdhlBtH7sa7jGY5z7glGaIj/WDYDkRtgGd+KCjCzxBW1w== - /@types/node/14.14.37: - dev: false - resolution: - integrity: sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw== + integrity: sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw== /@types/node/8.10.66: dev: false resolution: @@ -1384,7 +1366,7 @@ packages: integrity: sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA== /@types/resolve/1.17.1: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw== @@ -1395,7 +1377,7 @@ packages: /@types/serve-static/1.13.9: dependencies: '@types/mime': 1.3.2 - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-ZFqF6qa48XsPdjXV5Gsz0Zqmux2PerNd3a/ktL45mHpa19cuMi/cL8tcxdAx497yRh+QtYPuofjT9oWw9P7nkA== @@ -1411,7 +1393,7 @@ packages: integrity: sha512-dIPoZ3g5gcx9zZEszaxLSVTvMReD3xxyyDnQUjA6IYDG9Ba2AV0otMPs+77sG9ojB4Qr2N2Vk5RnKeuA0X/0bg== /@types/stoppable/1.1.0: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-BRR23Q9CJduH7AM6mk4JRttd8XyFkb4qIPZu4mdLF+VoP+wcjIxIWIKiBbN78NBbEuynrAyMPtzOHnIp2B/JPQ== @@ -1421,44 +1403,44 @@ packages: integrity: sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A== /@types/tunnel/0.0.1: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A== - /@types/underscore/1.11.1: + /@types/underscore/1.11.2: dev: false resolution: - integrity: sha512-mW23Xkp9HYgdMV7gnwuzqnPx6aG0J7xg/b7erQszOcyOizWylwCr9cgYM/BVVJHezUDxwyigG6+wCFQwCvyMBw== + integrity: sha512-Ls2ylbo7++ITrWk2Yc3G/jijwSq5V3GT0tlgVXEl2kKYXY3ImrtmTCoE2uyTWFRI5owMBriloZFWbE1SXOsE7w== /@types/uuid/8.3.0: dev: false resolution: integrity: sha512-eQ9qFW/fhfGJF8WKHGEHZEyVWfZxrT+6CLIJGBcZPfxUh/+BnEj+UCGYMlr9qZuX/2AltsvwrGqp0LhEW8D0zQ== - /@types/ws/7.4.1: + /@types/ws/7.4.4: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: - integrity: sha512-ISCK1iFnR+jYv7+jLNX0wDqesZ/5RAeY3wUx6QaphmocphU61h+b+PHjS18TF4WIPTu/MMzxIq2PHr32o2TS5Q== + integrity: sha512-d/7W23JAXPodQNbOZNXvl2K+bqAQrCMwlh/nuQsPSQk6Fq0opHoPrUw43aHsvSbIiQPr8Of2hkFbnz1XBFVyZQ== /@types/xml2js/0.4.8: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false resolution: integrity: sha512-EyvT83ezOdec7BhDaEcsklWy7RSIdi6CNe95tmOAK0yx/Lm30C9K75snT3fYayK59ApC2oyW+rcHErdG05FHJA== /@types/yauzl/2.9.1: dependencies: - '@types/node': 14.14.37 + '@types/node': 8.10.66 dev: false optional: true resolution: integrity: sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA== - /@typescript-eslint/eslint-plugin/4.19.0_1a11d0673659f3a5e0fd221432005aeb: + /@typescript-eslint/eslint-plugin/4.19.0_fddb9afe5c37d14de2fdf5d52845d82d: dependencies: - '@typescript-eslint/experimental-utils': 4.19.0_eslint@7.23.0+typescript@4.2.4 - '@typescript-eslint/parser': 4.19.0_eslint@7.23.0+typescript@4.2.4 + '@typescript-eslint/experimental-utils': 4.19.0_eslint@7.26.0+typescript@4.2.4 + '@typescript-eslint/parser': 4.19.0_eslint@7.26.0+typescript@4.2.4 '@typescript-eslint/scope-manager': 4.19.0 debug: 4.3.1 - eslint: 7.23.0 + eslint: 7.26.0 functional-red-black-tree: 1.0.1 lodash: 4.17.21 regexpp: 3.1.0 @@ -1477,13 +1459,13 @@ packages: optional: true resolution: integrity: sha512-CRQNQ0mC2Pa7VLwKFbrGVTArfdVDdefS+gTw0oC98vSI98IX5A8EVH4BzJ2FOB0YlCmm8Im36Elad/Jgtvveaw== - /@typescript-eslint/experimental-utils/4.19.0_eslint@7.23.0+typescript@4.2.4: + /@typescript-eslint/experimental-utils/4.19.0_eslint@7.26.0+typescript@4.2.4: dependencies: '@types/json-schema': 7.0.7 '@typescript-eslint/scope-manager': 4.19.0 '@typescript-eslint/types': 4.19.0 '@typescript-eslint/typescript-estree': 4.19.0_typescript@4.2.4 - eslint: 7.23.0 + eslint: 7.26.0 eslint-scope: 5.1.1 eslint-utils: 2.1.0 dev: false @@ -1494,13 +1476,13 @@ packages: typescript: '*' resolution: integrity: sha512-9/23F1nnyzbHKuoTqFN1iXwN3bvOm/PRIXSBR3qFAYotK/0LveEOHr5JT1WZSzcD6BESl8kPOG3OoDRKO84bHA== - /@typescript-eslint/parser/4.19.0_eslint@7.23.0+typescript@4.2.4: + /@typescript-eslint/parser/4.19.0_eslint@7.26.0+typescript@4.2.4: dependencies: '@typescript-eslint/scope-manager': 4.19.0 '@typescript-eslint/types': 4.19.0 '@typescript-eslint/typescript-estree': 4.19.0_typescript@4.2.4 debug: 4.3.1 - eslint: 7.23.0 + eslint: 7.26.0 typescript: 4.2.4 dev: false engines: @@ -1551,7 +1533,7 @@ packages: /@typescript-eslint/visitor-keys/4.19.0: dependencies: '@typescript-eslint/types': 4.19.0 - eslint-visitor-keys: 2.0.0 + eslint-visitor-keys: 2.1.0 dev: false engines: node: ^8.10.0 || ^10.13.0 || >=11.10.1 @@ -1596,15 +1578,31 @@ packages: date-utils: 1.2.21 jws: 3.2.2 request: 2.88.2 - underscore: 1.12.1 + underscore: 1.13.1 uuid: 3.4.0 - xmldom: 0.5.0 + xmldom: 0.6.0 xpath.js: 1.1.0 dev: false engines: node: '>= 0.6.15' resolution: integrity: sha1-RoxLs+u9lrEnBmn0ucuk4AZepIU= + /adal-node/0.2.2: + dependencies: + '@types/node': 8.10.66 + async: 2.6.3 + axios: 0.21.1 + date-utils: 1.2.21 + jws: 3.2.2 + underscore: 1.13.1 + uuid: 3.4.0 + xmldom: 0.6.0 + xpath.js: 1.1.0 + dev: false + engines: + node: '>= 0.6.15' + resolution: + integrity: sha512-luzQ9cXOjUlZoCiWeYbyR+nHwScSrPTDTbOInFphQs/PnwNz6wAIVkbsHEXtvYBnjLctByTTI8ccfpGX100oRQ== /agent-base/5.1.1: dev: false engines: @@ -1628,7 +1626,7 @@ packages: dev: false resolution: integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== - /ajv/8.0.5: + /ajv/8.5.0: dependencies: fast-deep-equal: 3.1.3 json-schema-traverse: 1.0.0 @@ -1636,7 +1634,7 @@ packages: uri-js: 4.4.1 dev: false resolution: - integrity: sha512-RkiLa/AeJx7+9OvniQ/qeWu0w74A8DiPPBclQ6ji3ZQkv5KamO+QGpqmi7O4JIw3rHGUXZ6CoP9tsAkn3gyazg== + integrity: sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ== /ansi-colors/3.2.3: dev: false engines: @@ -1698,7 +1696,7 @@ packages: /anymatch/3.1.2: dependencies: normalize-path: 3.0.0 - picomatch: 2.2.2 + picomatch: 2.2.3 dev: false engines: node: '>= 8' @@ -1745,10 +1743,6 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= - /array-filter/1.0.0: - dev: false - resolution: - integrity: sha1-uveeYubvTCpMC4MSMtr/7CUfnYM= /array-flatten/1.1.1: dev: false resolution: @@ -1759,7 +1753,7 @@ packages: define-properties: 1.1.3 es-abstract: 1.18.0 get-intrinsic: 1.1.1 - is-string: 1.0.5 + is-string: 1.0.6 dev: false engines: node: '>= 0.4' @@ -1771,6 +1765,18 @@ packages: node: '>=8' resolution: integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + /array.prototype.filter/1.0.0: + dependencies: + call-bind: 1.0.2 + define-properties: 1.1.3 + es-abstract: 1.18.0 + es-array-method-boxes-properly: 1.0.0 + is-string: 1.0.6 + dev: false + engines: + node: '>= 0.4' + resolution: + integrity: sha512-TfO1gz+tLm+Bswq0FBOXPqAchtCr2Rn48T8dLJoRFl8NoEosjZmzptmuo1X8aZBzZcqsR1W8U761tjACJtngTQ== /array.prototype.flat/1.2.4: dependencies: call-bind: 1.0.2 @@ -1828,10 +1834,20 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-yL4BCitc0A3qlsgRFgNGk9/dgtE= + /async-limiter/1.0.1: + dev: false + resolution: + integrity: sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== /async-lock/1.2.8: dev: false resolution: integrity: sha512-G+26B2jc0Gw0EG/WN2M6IczuGepBsfR1+DtqLnyFSH4p2C668qkOCtEkGNVEaaNAVlYwEMazy1+/jnLxltBkIQ== + /async/2.6.3: + dependencies: + lodash: 4.17.21 + dev: false + resolution: + integrity: sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== /async/3.2.0: dev: false resolution: @@ -1847,20 +1863,20 @@ packages: hasBin: true resolution: integrity: sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== - /available-typed-arrays/1.0.2: + /available-typed-arrays/1.0.3: dependencies: - array-filter: 1.0.0 + array.prototype.filter: 1.0.0 dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ== - /avsc/5.6.1: + integrity: sha512-CuPhFULixV/d89POo1UG4GqGbR7dmrefY2ZdmsYakeR4gOSJXoF7tfeaiqMHGOMrlTiJoeEs87fpLsBYmE2BMw== + /avsc/5.7.0: dev: false engines: node: '>=0.11' resolution: - integrity: sha512-Ro3/+ElCgfTgz6ZoVpdLvCV4TrcjKYKHJjyMp5dzuTczTEEHNCKV2vvJ5EORa4ofkB+nU5/UVM6NBP/+bFLAiw== + integrity: sha512-oP3jgI9SaZnwLwkRx7sHDPctXCUGGp+X4FsCgzHpMTNhYhGhXAFinptdGpWid2GTXAkhNp8ksAjqyqQBhoQ7BQ== /aws-sign2/0.7.0: dev: false resolution: @@ -1871,13 +1887,13 @@ packages: integrity: sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== /axios/0.21.1: dependencies: - follow-redirects: 1.13.3 + follow-redirects: 1.14.1 dev: false resolution: integrity: sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== /axios/0.21.1_debug@3.2.7: dependencies: - follow-redirects: 1.13.3_debug@3.2.7 + follow-redirects: 1.14.1_debug@3.2.7 dev: false peerDependencies: debug: '*' @@ -1885,12 +1901,63 @@ packages: integrity: sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== /axios/0.21.1_debug@4.3.1: dependencies: - follow-redirects: 1.13.3_debug@4.3.1 + follow-redirects: 1.14.1_debug@4.3.1 dev: false peerDependencies: debug: '*' resolution: integrity: sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== + /azure-iot-amqp-base/2.4.7: + dependencies: + async: 2.6.3 + azure-iot-common: 1.12.7 + debug: 4.3.1 + lodash.merge: 4.6.2 + machina: 4.0.2 + rhea: 1.0.24 + uuid: 3.4.0 + ws: 6.2.1 + dev: false + engines: + node: '>= 10.0.0' + resolution: + integrity: sha512-IDeoB33aHAcq71YAYsLQJNHp5f6CoFXU9nrwjNyL1bwZIbWGFtKJAr5qOEZFmdQTqeQmr2zZzeUrlTN6T7otkg== + /azure-iot-common/1.12.7: + dependencies: + debug: 4.3.1 + getos: 3.2.1 + dev: false + engines: + node: '>= 10.0.0' + resolution: + integrity: sha512-YDskP5GkhQw1VDtcQFfWAVcclNCi8/iWUS784lgwgNOQpr8RKHW1fC9o8lVt56TXssq0rrYcl9v2mosSD8WPnw== + /azure-iot-http-base/1.11.7: + dependencies: + azure-iot-common: 1.12.7 + debug: 4.3.1 + uuid: 3.4.0 + dev: false + engines: + node: '>= 10.0.0' + resolution: + integrity: sha512-Xt2wLtiblGSag/zJe6vJVkgjlj+jo2C5exuaSGHuMtvkuD/MB74xyGDdgflXcOiTVzS1rXx02I02jgKHTW5BDA== + /azure-iothub/1.13.1: + dependencies: + '@azure/ms-rest-js': 2.3.0 + async: 2.6.3 + azure-iot-amqp-base: 2.4.7 + azure-iot-common: 1.12.7 + azure-iot-http-base: 1.11.7 + debug: 4.3.1 + lodash: 4.17.21 + machina: 4.0.2 + rhea: 1.0.24 + tslib: 1.14.1 + dev: false + engines: + node: '>= 10.0.0' + resolution: + integrity: sha512-aJX3Hmym7+7stCJbaYH34eJh4rQ0j7/eO6hoZeG9sgYs86+4KKqjjhJlS8AoAUe3CpepfHqUee8xk3VScvHhsQ== /azure-storage/2.10.3: dependencies: browserify-mime: 1.2.9 @@ -1899,7 +1966,7 @@ packages: md5.js: 1.3.4 readable-stream: 2.0.6 request: 2.88.2 - underscore: 1.8.3 + underscore: 1.13.1 uuid: 3.4.0 validator: 9.4.1 xml2js: 0.2.8 @@ -1908,7 +1975,7 @@ packages: engines: node: '>= 0.8.26' resolution: - integrity: sha512-IGLs5Xj6kO8Ii90KerQrrwuJKexLgSwYC4oLWmc11mzKe7Jt2E5IVg+ZQ8K53YWZACtVTMBNO3iGuA+4ipjJxQ== + integrity: sha512-zlfRPl4js92JC6+79C2EUmNGYjSknRl8pOiHQF78zy+pbOFOHtlBF6BU/OxPeHQX3gaa6NdEZnVydFxhhndkEw== /babel-runtime/6.26.0: dependencies: core-js: 2.6.12 @@ -1918,7 +1985,7 @@ packages: integrity: sha1-llxwWGaOgrVde/4E/yM3vItWR/4= /backbone/1.4.0: dependencies: - underscore: 1.12.1 + underscore: 1.13.1 dev: false resolution: integrity: sha512-RLmDrRXkVdouTg38jcgHhyQ/2zjg7a8E6sz2zxfz21Hh17xDJYUHBZimVIt5fUyS8vbfpeSmTL3gUjTEvUV3qQ== @@ -2002,19 +2069,19 @@ packages: dev: false resolution: integrity: sha1-rrGvKN5sDXpqLOQK22j/GEIq8x8= - /browserslist/4.16.3: + /browserslist/4.16.6: dependencies: - caniuse-lite: 1.0.30001207 + caniuse-lite: 1.0.30001228 colorette: 1.2.2 - electron-to-chromium: 1.3.710 + electron-to-chromium: 1.3.734 escalade: 3.1.1 - node-releases: 1.1.71 + node-releases: 1.1.72 dev: false engines: node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7 hasBin: true resolution: - integrity: sha512-vIyhWmIkULaq04Gt93txdh+j02yX/JzlyhLYbV3YQCn/zvES3JnY7TifHHvvr1w5hTDluNKMkV05cs4vy8Q7sw== + integrity: sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ== /buffer-crc32/0.2.13: dev: false resolution: @@ -2088,10 +2155,10 @@ packages: node: '>=6' resolution: integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - /caniuse-lite/1.0.30001207: + /caniuse-lite/1.0.30001228: dev: false resolution: - integrity: sha512-UPQZdmAsyp2qfCTiMU/zqGSWOYaY9F9LL61V8f+8MrubsaDGpaHD9HRV/EWZGULZn0Hxu48SKzI5DgFwTvHuYw== + integrity: sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A== /caseless/0.12.0: dev: false resolution: @@ -2157,15 +2224,6 @@ packages: node: '>=4' resolution: integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - /chalk/4.1.0: - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - dev: false - engines: - node: '>=10' - resolution: - integrity: sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== /chalk/4.1.1: dependencies: ansi-styles: 4.3.0 @@ -2343,12 +2401,15 @@ packages: optional: true resolution: integrity: sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= - /contains-path/0.1.0: + /contains-path/1.0.0: + dependencies: + normalize-path: 2.1.1 + path-starts-with: 1.0.0 dev: false engines: node: '>=0.10.0' resolution: - integrity: sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= + integrity: sha1-NFizMhhWA+ju0Y9RjUoQiIo6vJE= /content-disposition/0.5.3: dependencies: safe-buffer: 5.1.2 @@ -2391,11 +2452,11 @@ packages: requiresBuild: true resolution: integrity: sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== - /core-js/3.10.1: + /core-js/3.12.1: dev: false requiresBuild: true resolution: - integrity: sha512-pwCxEXnj27XG47mu7SXAwhLP3L5CrlvCB91ANUkIz40P27kUcvNfSdvyZJ9CLHiVoKSp+TTChMQMSKQEH/IQxA== + integrity: sha512-Ne9DKPHTObRuB09Dru5AjwKjY4cJHVGu+y5f7coGn1E9Grkc3p2iBwE9AI/nJzsE29mQF7oq+mhYYRqOMFN1Bw== /core-util-is/1.0.2: dev: false resolution: @@ -2469,10 +2530,10 @@ packages: dev: false resolution: integrity: sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs= - /csv-parse/4.15.3: + /csv-parse/4.15.4: dev: false resolution: - integrity: sha512-jlTqDvLdHnYMSr08ynNfk4IAUSJgJjTKy2U5CQBSu4cN9vQOJonLVZP4Qo4gKKrIgIQ5dr07UwOJdi+lRqT12w== + integrity: sha512-OdBbFc0yZhOm17lSxqkirrHlFFVpKRT0wp4DAGoJelsP3LbGzV9LNr7XmM/lrr0uGkCtaqac9UhP8PDHXOAbMg== /custom-event/1.0.1: dev: false resolution: @@ -2521,7 +2582,7 @@ packages: integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== /debug/3.2.6: dependencies: - ms: 2.1.3 + ms: 2.1.1 deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dev: false resolution: @@ -2697,15 +2758,14 @@ packages: hasBin: true resolution: integrity: sha512-n94Rzbv2ambRaFzrnBf34IEiyOdIci7maRpMkoQWB6xFYGA7Nbs0Z5YQzMfTeyQeelv23nayqOcssBoc6rKrgw== - /doctrine/1.5.0: + /doctrine/2.1.0: dependencies: esutils: 2.0.3 - isarray: 1.0.0 dev: false engines: node: '>=0.10.0' resolution: - integrity: sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= + integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== /doctrine/3.0.0: dependencies: esutils: 2.0.3 @@ -2727,12 +2787,12 @@ packages: dev: false resolution: integrity: sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== - /dotenv/8.2.0: + /dotenv/8.6.0: dev: false engines: - node: '>=8' + node: '>=10' resolution: - integrity: sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw== + integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g== /downlevel-dts/0.4.0: dependencies: shelljs: 0.8.4 @@ -2762,10 +2822,10 @@ packages: dev: false resolution: integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= - /electron-to-chromium/1.3.710: + /electron-to-chromium/1.3.734: dev: false resolution: - integrity: sha512-b3r0E2o4yc7mNmBeJviejF1rEx49PUBi+2NPa7jHEX3arkAXnVgLhR0YmV8oi6/Qf3HH2a8xzQmCjHNH0IpXWQ== + integrity: sha512-iQF2mjPZ6zNNq45kbJ6MYZYCBNdv2JpGiJC/lVx4tGJWi9MNg73KkL9sWGN4X4I/CP2SBLWsT8nPADZZpAHIyw== /emoji-regex/7.0.3: dev: false resolution: @@ -2802,7 +2862,7 @@ packages: cors: 2.8.5 debug: 4.3.1 engine.io-parser: 4.0.2 - ws: 7.4.4 + ws: 7.4.5 dev: false engines: node: '>=10.0.0' @@ -2836,9 +2896,9 @@ packages: has-symbols: 1.0.2 is-callable: 1.2.3 is-negative-zero: 2.0.1 - is-regex: 1.1.2 - is-string: 1.0.5 - object-inspect: 1.9.0 + is-regex: 1.1.3 + is-string: 1.0.6 + object-inspect: 1.10.3 object-keys: 1.1.1 object.assign: 4.1.2 string.prototype.trimend: 1.0.4 @@ -2849,11 +2909,15 @@ packages: node: '>= 0.4' resolution: integrity: sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw== + /es-array-method-boxes-properly/1.0.0: + dev: false + resolution: + integrity: sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA== /es-to-primitive/1.2.1: dependencies: is-callable: 1.2.3 - is-date-object: 1.0.2 - is-symbol: 1.0.3 + is-date-object: 1.0.4 + is-symbol: 1.0.4 dev: false engines: node: '>= 0.4' @@ -2903,9 +2967,9 @@ packages: source-map: 0.6.1 resolution: integrity: sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw== - /eslint-config-prettier/7.2.0_eslint@7.23.0: + /eslint-config-prettier/7.2.0_eslint@7.26.0: dependencies: - eslint: 7.23.0 + eslint: 7.26.0 dev: false hasBin: true peerDependencies: @@ -2919,18 +2983,18 @@ packages: dev: false resolution: integrity: sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA== - /eslint-module-utils/2.6.0: + /eslint-module-utils/2.6.1: dependencies: - debug: 2.6.9 + debug: 3.2.7 pkg-dir: 2.0.0 dev: false engines: node: '>=4' resolution: - integrity: sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA== - /eslint-plugin-es/3.0.1_eslint@7.23.0: + integrity: sha512-ZXI9B8cxAJIH4nfkhTwcRTEAnrVfobYqwjWy/QMCZ8rHkZHFjf9yO4BzpiF9kCSfNlMG54eKigISHpX0+AaT4A== + /eslint-plugin-es/3.0.1_eslint@7.26.0: dependencies: - eslint: 7.23.0 + eslint: 7.26.0 eslint-utils: 2.1.0 regexpp: 3.1.0 dev: false @@ -2940,20 +3004,23 @@ packages: eslint: '>=4.19.1' resolution: integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ== - /eslint-plugin-import/2.22.1_eslint@7.23.0: + /eslint-plugin-import/2.23.2_eslint@7.26.0: dependencies: array-includes: 3.1.3 array.prototype.flat: 1.2.4 - contains-path: 0.1.0 + contains-path: 1.0.0 debug: 2.6.9 - doctrine: 1.5.0 - eslint: 7.23.0 + doctrine: 2.1.0 + eslint: 7.26.0 eslint-import-resolver-node: 0.3.4 - eslint-module-utils: 2.6.0 + eslint-module-utils: 2.6.1 + find-up: 2.1.0 has: 1.0.3 + is-core-module: 2.4.0 minimatch: 3.0.4 object.values: 1.1.3 - read-pkg-up: 2.0.0 + pkg-up: 2.0.0 + read-pkg-up: 3.0.0 resolve: 1.20.0 tsconfig-paths: 3.9.0 dev: false @@ -2962,17 +3029,17 @@ packages: peerDependencies: eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 resolution: - integrity: sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw== - /eslint-plugin-no-only-tests/2.4.0: + integrity: sha512-LmNoRptHBxOP+nb0PIKz1y6OSzCJlB+0g0IGS3XV4KaKk2q4szqQ6s6F1utVf5ZRkxk/QOTjdxe7v4VjS99Bsg== + /eslint-plugin-no-only-tests/2.6.0: dev: false engines: node: '>=4.0.0' resolution: - integrity: sha512-azP9PwQYfGtXJjW273nIxQH9Ygr+5/UyeW2wEjYoDtVYPI+WPKwbj0+qcAKYUXFZLRumq4HKkFaoDBAwBoXImQ== - /eslint-plugin-node/11.1.0_eslint@7.23.0: + integrity: sha512-T9SmE/g6UV1uZo1oHAqOvL86XWl7Pl2EpRpnLI8g/bkJu+h7XBCB+1LnubRZ2CUQXj805vh4/CYZdnqtVaEo2Q== + /eslint-plugin-node/11.1.0_eslint@7.26.0: dependencies: - eslint: 7.23.0 - eslint-plugin-es: 3.0.1_eslint@7.23.0 + eslint: 7.26.0 + eslint-plugin-es: 3.0.1_eslint@7.26.0 eslint-utils: 2.1.0 ignore: 5.1.8 minimatch: 3.0.4 @@ -2991,13 +3058,13 @@ packages: node: '>=6' resolution: integrity: sha512-bY2sGqyptzFBDLh/GMbAxfdJC+b0f23ME63FOE4+Jao0oZ3E1LEwFtWJX/1pGMJLiTtrSSern2CRM/g+dfc0eQ== - /eslint-plugin-tsdoc/0.2.11: + /eslint-plugin-tsdoc/0.2.14: dependencies: - '@microsoft/tsdoc': 0.13.0 - '@microsoft/tsdoc-config': 0.14.0 + '@microsoft/tsdoc': 0.13.2 + '@microsoft/tsdoc-config': 0.15.2 dev: false resolution: - integrity: sha512-vEjGANpmBfrvpKj9rwePGhA+gIe1mp+dhDZsrkxlHqPVOZvzVdFSV9fxu/o3eppmxhybI8brD88jOrLEAIB9Gw== + integrity: sha512-fJ3fnZRsdIoBZgzkQjv8vAj6NeeOoFkTfgosj6mKsFjX70QV256sA/wq+y/R2+OL4L8E79VVaVWrPeZnKNe8Ng== /eslint-scope/5.1.1: dependencies: esrecurse: 4.3.0 @@ -3021,16 +3088,16 @@ packages: node: '>=4' resolution: integrity: sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== - /eslint-visitor-keys/2.0.0: + /eslint-visitor-keys/2.1.0: dev: false engines: node: '>=10' resolution: - integrity: sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== - /eslint/7.23.0: + integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== + /eslint/7.26.0: dependencies: '@babel/code-frame': 7.12.11 - '@eslint/eslintrc': 0.4.0 + '@eslint/eslintrc': 0.4.1 ajv: 6.12.6 chalk: 4.1.1 cross-spawn: 7.0.3 @@ -3039,14 +3106,14 @@ packages: enquirer: 2.3.6 eslint-scope: 5.1.1 eslint-utils: 2.1.0 - eslint-visitor-keys: 2.0.0 + eslint-visitor-keys: 2.1.0 espree: 7.3.1 esquery: 1.4.0 esutils: 2.0.3 file-entry-cache: 6.0.1 functional-red-black-tree: 1.0.1 glob-parent: 5.1.2 - globals: 13.7.0 + globals: 13.8.0 ignore: 4.0.6 import-fresh: 3.3.0 imurmurhash: 0.1.4 @@ -3063,7 +3130,7 @@ packages: semver: 7.3.5 strip-ansi: 6.0.0 strip-json-comments: 3.1.1 - table: 6.0.9 + table: 6.7.1 text-table: 0.2.0 v8-compile-cache: 2.3.0 dev: false @@ -3071,7 +3138,7 @@ packages: node: ^10.12.0 || >=12.0.0 hasBin: true resolution: - integrity: sha512-kqvNVbdkjzpFy0XOszNwjkKzZ+6TcwCQ/h+ozlcIWwaimBBuhlQ4nN6kbiM2L+OjDcznkTJxzYfRFH92sx4a0Q== + integrity: sha512-4R1ieRf52/izcZE7AlLy56uIHHDLT74Yzz2Iv2l6kDaYvEu9x+wMB5dZArVL8SYGXSYV2YAg70FcW5Y5nGGNIg== /esm/3.2.25: dev: false engines: @@ -3261,8 +3328,8 @@ packages: '@nodelib/fs.walk': 1.2.6 glob-parent: 5.1.2 merge2: 1.4.1 - micromatch: 4.0.2 - picomatch: 2.2.2 + micromatch: 4.0.4 + picomatch: 2.2.3 dev: false engines: node: '>=8' @@ -3294,9 +3361,9 @@ packages: integrity: sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4= /fetch-mock/9.11.0_node-fetch@2.6.1: dependencies: - '@babel/core': 7.13.14 - '@babel/runtime': 7.13.10 - core-js: 3.10.1 + '@babel/core': 7.14.3 + '@babel/runtime': 7.14.0 + core-js: 3.12.1 debug: 4.3.1 glob-to-regexp: 0.4.1 is-subset: 0.1.1 @@ -3405,7 +3472,7 @@ packages: dev: false resolution: integrity: sha512-+8GbtQBwEqutP0v3uajDDoN64K2ehmHd0cjlghhxh0WpcfPzAIjPA03e1VvHlxL02FVGR0A6lwXsNQKn3H1RNQ== - /follow-redirects/1.13.3: + /follow-redirects/1.14.1: dev: false engines: node: '>=4.0' @@ -3415,8 +3482,8 @@ packages: debug: optional: true resolution: - integrity: sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA== - /follow-redirects/1.13.3_debug@3.2.7: + integrity: sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg== + /follow-redirects/1.14.1_debug@3.2.7: dependencies: debug: 3.2.7 dev: false @@ -3428,8 +3495,8 @@ packages: debug: optional: true resolution: - integrity: sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA== - /follow-redirects/1.13.3_debug@4.3.1: + integrity: sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg== + /follow-redirects/1.14.1_debug@4.3.1: dependencies: debug: 4.3.1 dev: false @@ -3441,7 +3508,7 @@ packages: debug: optional: true resolution: - integrity: sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA== + integrity: sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg== /foreach/2.0.5: dev: false resolution: @@ -3626,6 +3693,12 @@ packages: node: '>= 6' resolution: integrity: sha512-+5s0SJbGoyiJTZZ2JTpFPLMPSch72KEqGOTvQsBqg0RBWvwhWUSYZFAtz3TPW0GXJuLBJPts1E241iHg+VRfhg== + /getos/3.2.1: + dependencies: + async: 3.2.0 + dev: false + resolution: + integrity: sha512-U56CfOK17OKgTVqozZjUKNdkfEv6jk5WISBJ8SHoagjE6L69zOwl3Z+O8myjY9MEW3i2HPWQBt/LTbCgcC973Q== /getpass/0.1.7: dependencies: assert-plus: 1.0.0 @@ -3660,7 +3733,7 @@ packages: dev: false resolution: integrity: sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== - /glob/7.1.6: + /glob/7.1.7: dependencies: fs.realpath: 1.0.0 inflight: 1.0.6 @@ -3670,7 +3743,7 @@ packages: path-is-absolute: 1.0.1 dev: false resolution: - integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== /global-modules/1.0.0: dependencies: global-prefix: 1.0.2 @@ -3714,14 +3787,14 @@ packages: node: '>=8' resolution: integrity: sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== - /globals/13.7.0: + /globals/13.8.0: dependencies: type-fest: 0.20.2 dev: false engines: node: '>=8' resolution: - integrity: sha512-Aipsz6ZKRxa/xQkZhNg0qIWXT6x6rD46f6x/PCnBomlttdIyAPak4YD9jTmKpZ72uROSMU87qJtcgpgHaVchiA== + integrity: sha512-rHtdA6+PDBIjeEvA91rpqzEvk/k3/i7EeNQiryiWuJH0Hw9cpyJMAt2jtbAwUaRdhD+573X4vWw6IcjKPasi9Q== /globby/11.0.3: dependencies: array-union: 2.1.0 @@ -3760,7 +3833,7 @@ packages: node: '>=0.4.7' hasBin: true optionalDependencies: - uglify-js: 3.13.3 + uglify-js: 3.13.7 resolution: integrity: sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== /har-schema/2.0.0: @@ -3918,7 +3991,7 @@ packages: /http-proxy/1.18.1: dependencies: eventemitter3: 4.0.7 - follow-redirects: 1.13.3 + follow-redirects: 1.14.1 requires-port: 1.0.0 dev: false engines: @@ -3928,7 +4001,7 @@ packages: /http-proxy/1.18.1_debug@4.3.1: dependencies: eventemitter3: 4.0.7 - follow-redirects: 1.13.3_debug@4.3.1 + follow-redirects: 1.14.1_debug@4.3.1 requires-port: 1.0.0 dev: false engines: @@ -4074,10 +4147,10 @@ packages: dev: false resolution: integrity: sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= - /is-bigint/1.0.1: + /is-bigint/1.0.2: dev: false resolution: - integrity: sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg== + integrity: sha512-0JV5+SOCQkIdzjBK9buARcV804Ddu7A0Qet6sHi3FimE9ne6m4BGQZfRn+NZiXbBk4F4XmHfDZIipLj9pX8dSA== /is-binary-path/2.1.0: dependencies: binary-extensions: 2.2.0 @@ -4086,14 +4159,14 @@ packages: node: '>=8' resolution: integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - /is-boolean-object/1.1.0: + /is-boolean-object/1.1.1: dependencies: call-bind: 1.0.2 dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA== + integrity: sha512-bXdQWkECBUIAcCkeH1unwJLIpZYaa5VvuygSyS/c2lf719mTKZDU5UdDRlpd01UjADgmW8RfqaP+mRaVPdr/Ng== /is-buffer/1.1.6: dev: false resolution: @@ -4117,25 +4190,25 @@ packages: hasBin: true resolution: integrity: sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== - /is-core-module/2.2.0: + /is-core-module/2.4.0: dependencies: has: 1.0.3 dev: false resolution: - integrity: sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ== - /is-date-object/1.0.2: + integrity: sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A== + /is-date-object/1.0.4: dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== - /is-docker/2.2.0: + integrity: sha512-/b4ZVsG7Z5XVtIxs/h9W8nvfLgSAyKYdtGWQLbqy6jA1icmgjf8WCoTKgeS4wy5tYaPePouzFMANbnj94c2Z+A== + /is-docker/2.2.1: dev: false engines: node: '>=8' hasBin: true resolution: - integrity: sha512-K4GwB4i/HzhAzwP/XSlspzRdFTI9N8OxJOyOU7Y5Rz+p+WBokXWVWblaJeBkggthmoSV0OoGTH5thJNvplpkvQ== + integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== /is-extglob/2.1.1: dev: false engines: @@ -4163,12 +4236,12 @@ packages: node: '>=8' resolution: integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - /is-generator-function/1.0.8: + /is-generator-function/1.0.9: dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-2Omr/twNtufVZFr1GhxjOMFPAj2sjc/dKaIqBhvo4qciXfJmITGH6ZGd8eZYNHza8t1y0e01AuqRhJwfWp26WQ== + integrity: sha512-ZJ34p1uvIfptHCN7sFTjGibB9/oBg17sHqzDLfuwhvmN/qLVvIQXRQ8licZQ35WJ8KuEQt/etnnzQFI9C9Ue/A== /is-glob/3.1.0: dependencies: is-extglob: 2.1.1 @@ -4195,12 +4268,12 @@ packages: node: '>= 0.4' resolution: integrity: sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== - /is-number-object/1.0.4: + /is-number-object/1.0.5: dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw== + integrity: sha512-RU0lI/n95pMoUKu9v1BZP5MBcZuNSVJkMkAG2dJqC4z2GlkGUNeH68SuHuBKBD/XFe+LHZ+f9BKkLET60Niedw== /is-number/7.0.0: dev: false engines: @@ -4213,7 +4286,7 @@ packages: dev: false resolution: integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== - /is-regex/1.1.2: + /is-regex/1.1.3: dependencies: call-bind: 1.0.2 has-symbols: 1.0.2 @@ -4221,7 +4294,7 @@ packages: engines: node: '>= 0.4' resolution: - integrity: sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg== + integrity: sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ== /is-stream/1.1.0: dev: false engines: @@ -4234,27 +4307,27 @@ packages: node: '>=8' resolution: integrity: sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== - /is-string/1.0.5: + /is-string/1.0.6: dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== + integrity: sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w== /is-subset/0.1.1: dev: false resolution: integrity: sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY= - /is-symbol/1.0.3: + /is-symbol/1.0.4: dependencies: has-symbols: 1.0.2 dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== + integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== /is-typed-array/1.1.5: dependencies: - available-typed-arrays: 1.0.2 + available-typed-arrays: 1.0.3 call-bind: 1.0.2 es-abstract: 1.18.0 foreach: 2.0.5 @@ -4282,7 +4355,7 @@ packages: integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== /is-wsl/2.2.0: dependencies: - is-docker: 2.2.0 + is-docker: 2.2.1 dev: false engines: node: '>=8' @@ -4296,12 +4369,12 @@ packages: dev: false resolution: integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= - /isbinaryfile/4.0.6: + /isbinaryfile/4.0.8: dev: false engines: node: '>= 8.0.0' resolution: - integrity: sha512-ORrEy+SNVqUhrCaal4hA4fBzhggQQ+BaLntyPOdoEiwlKZW9BZiJXjg3RMiruE4tPEI3pyVPpySHQF/dKWperg== + integrity: sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w== /isexe/2.0.0: dev: false resolution: @@ -4332,11 +4405,11 @@ packages: integrity: sha512-vrRztU9VRRFDyC+aklfLoeXyNdTfga2EI3udDGn4cZ6fpSXpHLV9X6CHvfoMCPtggg8zvDDmC4b9xfu0z6/llA== /istanbul-lib-instrument/3.3.0: dependencies: - '@babel/generator': 7.13.9 - '@babel/parser': 7.13.13 + '@babel/generator': 7.14.3 + '@babel/parser': 7.14.3 '@babel/template': 7.12.13 - '@babel/traverse': 7.13.13 - '@babel/types': 7.13.14 + '@babel/traverse': 7.14.2 + '@babel/types': 7.14.2 istanbul-lib-coverage: 2.0.5 semver: 6.3.0 dev: false @@ -4346,7 +4419,7 @@ packages: integrity: sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA== /istanbul-lib-instrument/4.0.3: dependencies: - '@babel/core': 7.13.14 + '@babel/core': 7.14.3 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.0.0 semver: 6.3.0 @@ -4749,10 +4822,10 @@ packages: connect: 3.7.0 di: 0.0.1 dom-serialize: 2.2.1 - glob: 7.1.6 + glob: 7.1.7 graceful-fs: 4.2.6 http-proxy: 1.18.1 - isbinaryfile: 4.0.6 + isbinaryfile: 4.0.8 lodash: 4.17.21 log4js: 6.3.0 mime: 2.5.2 @@ -4763,7 +4836,7 @@ packages: socket.io: 3.1.2 source-map: 0.6.1 tmp: 0.2.1 - ua-parser-js: 0.7.27 + ua-parser-js: 0.7.28 yargs: 16.2.0 dev: false engines: @@ -4780,10 +4853,10 @@ packages: connect: 3.7.0 di: 0.0.1 dom-serialize: 2.2.1 - glob: 7.1.6 + glob: 7.1.7 graceful-fs: 4.2.6 http-proxy: 1.18.1_debug@4.3.1 - isbinaryfile: 4.0.6 + isbinaryfile: 4.0.8 lodash: 4.17.21 log4js: 6.3.0 mime: 2.5.2 @@ -4794,7 +4867,7 @@ packages: socket.io: 3.1.2 source-map: 0.6.1 tmp: 0.2.1 - ua-parser-js: 0.7.27 + ua-parser-js: 0.7.28 yargs: 16.2.0 dev: false engines: @@ -4804,15 +4877,15 @@ packages: debug: '*' resolution: integrity: sha512-fo4Wt0S99/8vylZMxNj4cBFyOBBnC1bewZ0QOlePij/2SZVWxqbyLeIddY13q6URa2EpLRW8ixvFRUMjkmo1bw== - /keytar/7.6.0: + /keytar/7.7.0: dependencies: - node-addon-api: 3.1.0 - prebuild-install: 6.1.1 + node-addon-api: 3.2.0 + prebuild-install: 6.1.2 dev: false optional: true requiresBuild: true resolution: - integrity: sha512-H3cvrTzWb11+iv0NOAnoNAPgEapVZnYLVHZQyxmh7jdmVfR/c0jNNFEZ6AI38W/4DeTGTaY66ZX4Z1SbfKPvCQ== + integrity: sha512-YEY9HWqThQc5q5xbXbRwsZTh2PJ36OSYRjSv3NN2xf5s5dpLTjEZnC2YikR29OaVybf9nQ0dJ/80i40RS97t/A== /lazy-ass/1.6.0: dev: false engines: @@ -4837,17 +4910,6 @@ packages: node: '>= 0.8.0' resolution: integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== - /load-json-file/2.0.0: - dependencies: - graceful-fs: 4.2.6 - parse-json: 2.2.0 - pify: 2.3.0 - strip-bom: 3.0.0 - dev: false - engines: - node: '>=4' - resolution: - integrity: sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= /load-json-file/4.0.0: dependencies: graceful-fs: 4.2.6 @@ -4881,10 +4943,6 @@ packages: dev: false resolution: integrity: sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= - /lodash.flatten/4.4.0: - dev: false - resolution: - integrity: sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= /lodash.flattendeep/4.4.0: dev: false resolution: @@ -4998,6 +5056,14 @@ packages: dev: false resolution: integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== + /machina/4.0.2: + dependencies: + lodash: 4.17.21 + dev: false + engines: + node: '>=0.4.0' + resolution: + integrity: sha512-OOlFrW1rd783S6tF36v5Ie/TM64gfvSl9kYLWL2cPA31J71HHWW3XrgSe1BZSFAPkh8532CMJMLv/s9L2aopiA== /magic-string/0.25.7: dependencies: sourcemap-codec: 1.4.8 @@ -5036,7 +5102,7 @@ packages: dependencies: arr-union: 3.1.0 async-array-reduce: 0.2.1 - glob: 7.1.6 + glob: 7.1.7 has-glob: 1.0.0 is-valid-glob: 1.0.0 resolve-dir: 1.0.1 @@ -5098,15 +5164,15 @@ packages: node: '>= 0.6' resolution: integrity: sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= - /micromatch/4.0.2: + /micromatch/4.0.4: dependencies: braces: 3.0.2 - picomatch: 2.2.2 + picomatch: 2.2.3 dev: false engines: - node: '>=8' + node: '>=8.6' resolution: - integrity: sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== + integrity: sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== /mime-db/1.47.0: dev: false engines: @@ -5227,10 +5293,10 @@ packages: hasBin: true resolution: integrity: sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ== - /mock-fs/4.13.0: + /mock-fs/4.14.0: dev: false resolution: - integrity: sha512-DD0vOdofJdoaRNtnWcrXe6RQbpHkPPmtqGq14uRX0F8ZKJ5nv89CVTYl/BZdppDxBDaV0hl75htg3abpEWlPZA== + integrity: sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw== /mock-require/3.0.3: dependencies: get-caller-file: 1.0.3 @@ -5260,21 +5326,21 @@ packages: dev: false resolution: integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - /msal/1.4.9: + /msal/1.4.11: dependencies: tslib: 1.14.1 dev: false engines: node: '>=0.8.0' resolution: - integrity: sha512-UPNG8AgGAWJbW6JbY2K8EYrrAbSmFrXicdk6Klpfy7u6Lszhop+5vi2eWGmM39ul7DQfq5p2qUlehAMF5yb2Vg== - /nanoid/3.1.22: + integrity: sha512-8vW5/+irlcQQk87r8Qp3/kQEc552hr7FQLJ6GF5LLkqnwJDDxrswz6RYPiQhmiampymIs0PbHVZrNf8m+6DmgQ== + /nanoid/3.1.23: dev: false engines: node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1 hasBin: true resolution: - integrity: sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ== + integrity: sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw== /napi-build-utils/1.0.2: dev: false optional: true @@ -5310,7 +5376,7 @@ packages: integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== /nise/4.1.0: dependencies: - '@sinonjs/commons': 1.8.2 + '@sinonjs/commons': 1.8.3 '@sinonjs/fake-timers': 6.0.1 '@sinonjs/text-encoding': 0.7.1 just-extend: 4.2.1 @@ -5329,22 +5395,22 @@ packages: node: '>= 10.13' resolution: integrity: sha512-QNb/j8kbFnKCiyqi9C5DD0jH/FubFGj5rt9NQFONXwQm3IPB0CULECg/eS3AU1KgZb/6SwUa4/DTRKhVxkGABw== - /node-abi/2.21.0: + /node-abi/2.26.0: dependencies: semver: 5.7.1 dev: false optional: true resolution: - integrity: sha512-smhrivuPqEM3H5LmnY3KU6HfYv0u4QklgAxfFyRNujKUzbUcYZ+Jc2EhukB9SRcD2VpqhxM7n/MIcp1Ua1/JMg== + integrity: sha512-ag/Vos/mXXpWLLAYWsAoQdgS+gW7IwvgMLOgqopm/DbzAjazLltzgzpVMsFlgmo9TzG5hGXeaBZx2AI731RIsQ== /node-abort-controller/1.2.1: dev: false resolution: integrity: sha512-79PYeJuj6S9+yOHirR0JBLFOgjB6sQCir10uN6xRx25iD+ZD4ULqgRn3MwWBRaQGB0vEgReJzWwJo42T1R6YbQ== - /node-addon-api/3.1.0: + /node-addon-api/3.2.0: dev: false optional: true resolution: - integrity: sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw== + integrity: sha512-kcwSAWhPi4+QzAtsL2+2s/awvDo2GKLsvMCwNRxb5BUshteXU8U97NCyvQDsGKs/m0He9WcG4YWew/BnuLx++w== /node-environment-flags/1.0.6: dependencies: object.getownpropertydescriptors: 2.1.2 @@ -5358,10 +5424,10 @@ packages: node: 4.x || >=6.0.0 resolution: integrity: sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== - /node-releases/1.1.71: + /node-releases/1.1.72: dev: false resolution: - integrity: sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg== + integrity: sha512-LLUo+PpH3dU6XizX3iVoubUNheF/owjXCZZ5yACDxNnPtgFuludV1ZL3ayK1kVep42Rmm0+R9/Y60NQbZ2bifw== /noop-logger/0.1.1: dev: false optional: true @@ -5441,7 +5507,7 @@ packages: find-cache-dir: 2.1.0 find-up: 3.0.0 foreground-child: 1.5.6 - glob: 7.1.6 + glob: 7.1.7 istanbul-lib-coverage: 2.0.5 istanbul-lib-hook: 2.0.7 istanbul-lib-instrument: 3.3.0 @@ -5475,10 +5541,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - /object-inspect/1.9.0: + /object-inspect/1.10.3: dev: false resolution: - integrity: sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw== + integrity: sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw== /object-keys/1.1.1: dev: false engines: @@ -5552,7 +5618,7 @@ packages: integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== /open/7.4.2: dependencies: - is-docker: 2.2.0 + is-docker: 2.2.1 is-wsl: 2.2.0 dev: false engines: @@ -5686,14 +5752,6 @@ packages: node: '>=6' resolution: integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== - /parse-json/2.2.0: - dependencies: - error-ex: 1.3.2 - dev: false - engines: - node: '>=0.10.0' - resolution: - integrity: sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= /parse-json/4.0.0: dependencies: error-ex: 1.3.2 @@ -5747,6 +5805,14 @@ packages: dev: false resolution: integrity: sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + /path-starts-with/1.0.0: + dependencies: + normalize-path: 2.1.1 + dev: false + engines: + node: '>=4' + resolution: + integrity: sha1-soJDAV6LE43lcmgqxS2kLmRq2E4= /path-to-regexp/0.1.7: dev: false resolution: @@ -5761,14 +5827,6 @@ packages: dev: false resolution: integrity: sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w== - /path-type/2.0.0: - dependencies: - pify: 2.3.0 - dev: false - engines: - node: '>=4' - resolution: - integrity: sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= /path-type/3.0.0: dependencies: pify: 3.0.0 @@ -5795,12 +5853,12 @@ packages: dev: false resolution: integrity: sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= - /picomatch/2.2.2: + /picomatch/2.2.3: dev: false engines: node: '>=8.6' resolution: - integrity: sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== + integrity: sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg== /pidtree/0.3.1: dev: false engines: @@ -5808,12 +5866,6 @@ packages: hasBin: true resolution: integrity: sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA== - /pify/2.3.0: - dev: false - engines: - node: '>=0.10.0' - resolution: - integrity: sha1-7RQaasBDqEnqWISY59yosVMw6Qw= /pify/3.0.0: dev: false engines: @@ -5842,13 +5894,21 @@ packages: node: '>=6' resolution: integrity: sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== + /pkg-up/2.0.0: + dependencies: + find-up: 2.1.0 + dev: false + engines: + node: '>=4' + resolution: + integrity: sha1-yBmscoBZpGHKscOImivjxJoATX8= /pluralize/8.0.0: dev: false engines: node: '>=4' resolution: integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== - /prebuild-install/6.1.1: + /prebuild-install/6.1.2: dependencies: detect-libc: 1.0.3 expand-template: 2.0.3 @@ -5856,7 +5916,7 @@ packages: minimist: 1.2.5 mkdirp-classic: 0.5.3 napi-build-utils: 1.0.2 - node-abi: 2.21.0 + node-abi: 2.26.0 noop-logger: 0.1.1 npmlog: 4.1.2 pump: 3.0.0 @@ -5870,7 +5930,7 @@ packages: hasBin: true optional: true resolution: - integrity: sha512-M+cKwofFlHa5VpTWub7GLg5RLcunYIcLqtY5pKcls/u7xaAb8FrXZ520qY8rkpYy5xw90tYCyMO0MP5ggzR3Sw== + integrity: sha512-PzYWIKZeP+967WuKYXlTOhYBgGOvTRSfaKI89XnfJ0ansRAH7hDU45X+K+FZeI1Wb/7p/NnuctPH3g0IqKUuSQ== /prelude-ls/1.1.2: dev: false engines: @@ -5997,7 +6057,7 @@ packages: rimraf: 3.0.2 tar-fs: 2.1.1 unbzip2-stream: 1.4.3 - ws: 7.4.4 + ws: 7.4.5 dev: false engines: node: '>=10.18.1' @@ -6109,15 +6169,15 @@ packages: optional: true resolution: integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - /read-pkg-up/2.0.0: + /read-pkg-up/3.0.0: dependencies: find-up: 2.1.0 - read-pkg: 2.0.0 + read-pkg: 3.0.0 dev: false engines: node: '>=4' resolution: - integrity: sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= + integrity: sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc= /read-pkg-up/4.0.0: dependencies: find-up: 3.0.0 @@ -6127,16 +6187,6 @@ packages: node: '>=6' resolution: integrity: sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA== - /read-pkg/2.0.0: - dependencies: - load-json-file: 2.0.0 - normalize-package-data: 2.5.0 - path-type: 2.0.0 - dev: false - engines: - node: '>=4' - resolution: - integrity: sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= /read-pkg/3.0.0: dependencies: load-json-file: 4.0.0 @@ -6191,7 +6241,7 @@ packages: integrity: sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== /readdirp/3.2.0: dependencies: - picomatch: 2.2.2 + picomatch: 2.2.3 dev: false engines: node: '>= 8' @@ -6199,7 +6249,7 @@ packages: integrity: sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ== /readdirp/3.5.0: dependencies: - picomatch: 2.2.2 + picomatch: 2.2.3 dev: false engines: node: '>=8.10.0' @@ -6322,14 +6372,14 @@ packages: integrity: sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== /resolve/1.19.0: dependencies: - is-core-module: 2.2.0 + is-core-module: 2.4.0 path-parse: 1.0.6 dev: false resolution: integrity: sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== /resolve/1.20.0: dependencies: - is-core-module: 2.2.0 + is-core-module: 2.4.0 path-parse: 1.0.6 dev: false resolution: @@ -6375,14 +6425,14 @@ packages: integrity: sha512-PEl62U2EhxCO5wMUZ2/bCBcXAVKN9AdMSNQOrp3+R5b77TEaOSiy16MQ0sIOmzj/iqsgIAgPs1mt3FYfu1vIXA== /rimraf/2.7.1: dependencies: - glob: 7.1.6 + glob: 7.1.7 dev: false hasBin: true resolution: integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== /rimraf/3.0.2: dependencies: - glob: 7.1.6 + glob: 7.1.7 dev: false hasBin: true resolution: @@ -6432,7 +6482,7 @@ packages: integrity: sha512-1pkwkervMJQGFYvM9nscrUoncPwiKR/K+bHdjv6PFgRo3cgPHoRT83y2Aa3GvINj4539S15t/tpFPb775TDs6w== /rollup-plugin-visualizer/4.2.2_rollup@1.32.1: dependencies: - nanoid: 3.1.22 + nanoid: 3.1.23 open: 7.4.2 rollup: 1.32.1 source-map: 0.7.3 @@ -6454,7 +6504,7 @@ packages: /rollup/1.32.1: dependencies: '@types/estree': 0.0.47 - '@types/node': 14.14.37 + '@types/node': 8.10.66 acorn: 7.4.1 dev: false hasBin: true @@ -6595,7 +6645,7 @@ packages: integrity: sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== /shelljs/0.8.4: dependencies: - glob: 7.1.6 + glob: 7.1.7 interpret: 1.4.0 rechoir: 0.6.2 dev: false @@ -6618,7 +6668,7 @@ packages: dependencies: call-bind: 1.0.2 get-intrinsic: 1.1.1 - object-inspect: 1.9.0 + object-inspect: 1.10.3 dev: false resolution: integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== @@ -6642,7 +6692,7 @@ packages: integrity: sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA== /sinon/9.2.4: dependencies: - '@sinonjs/commons': 1.8.2 + '@sinonjs/commons': 1.8.3 '@sinonjs/fake-timers': 6.0.1 '@sinonjs/samsam': 5.3.1 diff: 4.0.2 @@ -6745,7 +6795,7 @@ packages: dependencies: '@types/cookie': 0.4.0 '@types/cors': 2.8.10 - '@types/node': 14.14.37 + '@types/node': 10.17.13 accepts: 1.3.7 base64id: 2.0.0 debug: 4.3.1 @@ -6761,13 +6811,13 @@ packages: dependencies: agent-base: 6.0.2 debug: 4.3.1 - socks: 2.6.0 + socks: 2.6.1 dev: false engines: node: '>= 6' resolution: integrity: sha512-lEpa1zsWCChxiynk+lCycKuC502RxDWLKJZoIhnxrWNjLSDGYRFflHA1/228VkRcnv9TIb8w98derGbpKxJRgA== - /socks/2.6.0: + /socks/2.6.1: dependencies: ip: 1.1.5 smart-buffer: 4.1.0 @@ -6776,7 +6826,7 @@ packages: node: '>= 10.13.0' npm: '>= 3.0.0' resolution: - integrity: sha512-mNmr9owlinMplev0Wd7UHFlqI4ofnBnNzFuzrm63PPaHgbkqCFe4T5LzwKmtQ/f2tX0NTpcdVLyD/FHxFBstYw== + integrity: sha512-kLQ9N5ucj8uIcxrDwjm0Jsqk06xdpBjGNQtpXy4Q8/QY2k+fY7nZH8CARy+hkbG+SGAovmzzuauCpBlb8FrnBA== /source-map-resolve/0.5.3: dependencies: atob: 2.1.2 @@ -6834,7 +6884,7 @@ packages: /spdx-correct/3.1.1: dependencies: spdx-expression-parse: 3.0.1 - spdx-license-ids: 3.0.7 + spdx-license-ids: 3.0.8 dev: false resolution: integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== @@ -6845,14 +6895,14 @@ packages: /spdx-expression-parse/3.0.1: dependencies: spdx-exceptions: 2.3.0 - spdx-license-ids: 3.0.7 + spdx-license-ids: 3.0.8 dev: false resolution: integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== - /spdx-license-ids/3.0.7: + /spdx-license-ids/3.0.8: dev: false resolution: - integrity: sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ== + integrity: sha512-NDgA96EnaLSvtbM7trJj+t1LUR3pirkDCcz9nOUlPb5DMBGsH7oES6C3hs3j7R9oHEa1EMvReS/BUAIT5Tcr0g== /sprintf-js/1.0.3: dev: false resolution: @@ -7090,22 +7140,19 @@ packages: node: '>=8' resolution: integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - /table/6.0.9: + /table/6.7.1: dependencies: - ajv: 8.0.5 - is-boolean-object: 1.1.0 - is-number-object: 1.0.4 - is-string: 1.0.5 + ajv: 8.5.0 lodash.clonedeep: 4.5.0 - lodash.flatten: 4.4.0 lodash.truncate: 4.4.2 slice-ansi: 4.0.0 string-width: 4.2.2 + strip-ansi: 6.0.0 dev: false engines: node: '>=10.0.0' resolution: - integrity: sha512-F3cLs9a3hL1Z7N4+EkSscsel3z55XT950AvB05bwayrNg5T1/gykXtigioTAjbltvbMSJvvhFCbnf6mX+ntnJQ== + integrity: sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg== /tar-fs/2.1.1: dependencies: chownr: 1.1.4 @@ -7140,7 +7187,7 @@ packages: integrity: sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw== /test-exclude/5.2.3: dependencies: - glob: 7.1.6 + glob: 7.1.7 minimatch: 3.0.4 read-pkg-up: 4.0.0 require-main-filename: 2.0.0 @@ -7333,7 +7380,7 @@ packages: backbone: 1.4.0 jquery: 3.6.0 lunr: 2.3.9 - underscore: 1.12.1 + underscore: 1.13.1 dev: false engines: node: '>= 8' @@ -7386,17 +7433,17 @@ packages: hasBin: true resolution: integrity: sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg== - /ua-parser-js/0.7.27: + /ua-parser-js/0.7.28: dev: false resolution: - integrity: sha512-eXMaRYK2skomGocoX0x9sBXzx5A1ZVQgXfrW4mTc8dT0zS7olEcyfudAzRC5tIIRgLxQ69B6jut3DI+n5hslPA== - /uglify-js/3.13.3: + integrity: sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g== + /uglify-js/3.13.7: dev: false engines: node: '>=0.8.0' hasBin: true resolution: - integrity: sha512-otIc7O9LyxpUcQoXzj2hL4LPWKklO6LJWoJUzNa8A17Xgi4fOeDC8FBDOLHnC/Slo1CQgsZMcM6as0M76BZaig== + integrity: sha512-1Psi2MmnZJbnEsgJJIlfnd7tFlJfitusmR7zDI8lXlFI0ACD4/Rm/xdrU8bh6zF0i74aiVoBtkRiFulkrmh3AA== /unbox-primitive/1.0.1: dependencies: function-bind: 1.1.1 @@ -7413,14 +7460,10 @@ packages: dev: false resolution: integrity: sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg== - /underscore/1.12.1: + /underscore/1.13.1: dev: false resolution: - integrity: sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw== - /underscore/1.8.3: - dev: false - resolution: - integrity: sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI= + integrity: sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g== /universal-user-agent/6.0.0: dev: false resolution: @@ -7475,7 +7518,7 @@ packages: dependencies: inherits: 2.0.4 is-arguments: 1.1.0 - is-generator-function: 1.0.8 + is-generator-function: 1.0.9 is-typed-array: 1.1.5 safe-buffer: 5.2.1 which-typed-array: 1.1.4 @@ -7564,11 +7607,11 @@ packages: integrity: sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== /which-boxed-primitive/1.0.2: dependencies: - is-bigint: 1.0.1 - is-boolean-object: 1.1.0 - is-number-object: 1.0.4 - is-string: 1.0.5 - is-symbol: 1.0.3 + is-bigint: 1.0.2 + is-boolean-object: 1.1.1 + is-number-object: 1.0.5 + is-string: 1.0.6 + is-symbol: 1.0.4 dev: false resolution: integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== @@ -7578,7 +7621,7 @@ packages: integrity: sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= /which-typed-array/1.1.4: dependencies: - available-typed-arrays: 1.0.2 + available-typed-arrays: 1.0.3 call-bind: 1.0.2 es-abstract: 1.18.0 foreach: 2.0.5 @@ -7654,6 +7697,12 @@ packages: dev: false resolution: integrity: sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== + /ws/6.2.1: + dependencies: + async-limiter: 1.0.1 + dev: false + resolution: + integrity: sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== /ws/7.4.4: dev: false engines: @@ -7667,7 +7716,7 @@ packages: utf-8-validate: optional: true resolution: - integrity: sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw== + integrity: sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g== /xhr-mock/2.5.1: dependencies: global: 4.4.0 @@ -7712,12 +7761,12 @@ packages: node: '>=4.0' resolution: integrity: sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0= - /xmldom/0.5.0: + /xmldom/0.6.0: dev: false engines: node: '>=10.0.0' resolution: - integrity: sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA== + integrity: sha512-iAcin401y58LckRZ0TkI4k0VSM1Qg0KGSc3i8rU+xrxe19A/BN1zHyVSJY7uoutVlaTSzYyk/v5AmkewAP7jtg== /xpath.js/1.1.0: dev: false engines: @@ -7845,7 +7894,7 @@ packages: cross-env: 7.0.3 delay: 4.4.1 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -7885,14 +7934,14 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 chai: 4.3.4 cross-env: 7.0.3 - csv-parse: 4.15.3 - dotenv: 8.2.0 - eslint: 7.23.0 + csv-parse: 4.15.4 + dotenv: 8.6.0 + eslint: 7.26.0 inherits: 2.0.4 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -7930,13 +7979,13 @@ packages: '@azure/core-rest-pipeline': 1.0.3 '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.13.2 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -7964,7 +8013,7 @@ packages: dev: false name: '@rush-temp/ai-document-translator' resolution: - integrity: sha512-BX8NAVVWDeaidRCJbHcifDv0wPRGf8OQQyLPS2yxm0Aak6Yo8ipYqKCwoKZNJm1b4e6JAyIcmNDb5hpMyW+hHQ== + integrity: sha512-/ZLItN+R/uK7id66DcOEFECbIUxVsE8COBFWrZzWsqtxKXRi3XemH5Ul4+3smC81QVEW5n9oNoWLqkhJx6Tl/g== tarball: file:projects/ai-document-translator.tgz version: 0.0.0 file:projects/ai-form-recognizer.tgz: @@ -7972,15 +8021,15 @@ packages: '@azure/core-tracing': 1.0.0-preview.11 '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -8016,15 +8065,15 @@ packages: '@azure/core-tracing': 1.0.0-preview.11 '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -8062,16 +8111,16 @@ packages: '@azure/core-tracing': 1.0.0-preview.11 '@azure/identity': 2.0.0-beta.3 '@microsoft/api-extractor': 7.7.11 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -8101,13 +8150,14 @@ packages: dev: false name: '@rush-temp/ai-text-analytics' resolution: - integrity: sha512-KZ9I7xHh8VE63VnB8xCmrSF40tju1frLQ1BGyT/YM2w0M+q2475W9tHCRLeUl6FmAiQXLv+6aqw8FTzP5j776A== + integrity: sha512-FY0mVa1OEYmdy+sKK4aWOmEWKJY8gFA0BeXjAT2G5cKcADP872nek628lIzl93Vb6chnwk29PJtKzOodP/7JkQ== tarball: file:projects/ai-text-analytics.tgz version: 0.0.0 file:projects/app-configuration.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 '@azure/identity': 2.0.0-beta.3 + '@azure/keyvault-secrets': 4.1.0 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-inject': 4.0.2_rollup@1.32.1 @@ -8115,15 +8165,15 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 assert: 1.5.0 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 esm: 3.2.25 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -8151,11 +8201,11 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - uglify-js: 3.13.3 + uglify-js: 3.13.7 dev: false name: '@rush-temp/app-configuration' resolution: - integrity: sha512-4AGlm2vHpELq0J6UowxwuKKEQk6JO6jv2Vp1/aMUoVZh15O6YMoH7XwKxbKcj661lKWAe/Jc7M4zRLpLfKKupw== + integrity: sha512-OXADNxZbTyMJ2W/cUJWnj6NdpxdvLYbOXQR+0v1TKxFdj0lPKm2F47GhOvknGVYqDravkOV0gfsQBc4cTrFcEw== tarball: file:projects/app-configuration.tgz version: 0.0.0 file:projects/attestation.tgz: @@ -8163,16 +8213,16 @@ packages: '@azure/core-tracing': 1.0.0-preview.11 '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 - '@types/jsrsasign': 8.0.10 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 + '@types/jsrsasign': 8.0.12 '@types/mocha': 7.0.2 '@types/node': 8.10.66 buffer: 5.7.1 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 jsrsasign: 10.2.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -8216,15 +8266,15 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 assert: 1.5.0 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 events: 3.3.0 inherits: 2.0.4 karma: 6.3.2 @@ -8270,8 +8320,8 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/jwt-decode': 2.2.1 '@types/mocha': 7.0.2 '@types/node': 8.10.66 @@ -8280,7 +8330,7 @@ packages: chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - eslint: 7.23.0 + eslint: 7.26.0 events: 3.3.0 inherits: 2.0.4 jwt-decode: 2.2.0 @@ -8325,15 +8375,15 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 assert: 1.5.0 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 events: 3.3.0 inherits: 2.0.4 karma: 6.3.2 @@ -8379,15 +8429,15 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 assert: 1.5.0 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 events: 3.3.0 inherits: 2.0.4 karma: 6.3.2 @@ -8433,15 +8483,15 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 assert: 1.5.0 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 events: 3.3.0 inherits: 2.0.4 karma: 6.3.2 @@ -8478,16 +8528,15 @@ packages: version: 0.0.0 file:projects/confidential-ledger.tgz: dependencies: - '@azure/core-rest-pipeline': 1.1.0-beta.1 '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.13.2 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -8515,26 +8564,24 @@ packages: dev: false name: '@rush-temp/confidential-ledger' resolution: - integrity: sha512-akY+Jx2/F3f/NqLl3NXBnJnE/a/ESHgG8jUnJ2aqqbRhDznym3G1+6RZdfqYjPDKVY3kBeLv+bKgKiJPBm46IA== + integrity: sha512-377JfE4l6ZZHgPwOzPns5aQGfcsKqoHZcSXstcyG7B6iaQF9ldkSysCxADvWg6hBa3+A7rU0ACX4zawFrJsEWQ== tarball: file:projects/confidential-ledger.tgz version: 0.0.0 file:projects/container-registry.tgz: dependencies: - '@azure/arm-containerregistry': 8.0.0 - '@azure/core-rest-pipeline': 1.1.0-beta.1 '@azure/core-tracing': 1.0.0-preview.11 '@azure/identity': 1.3.0 - '@azure/ms-rest-nodeauth': 3.0.9 + '@azure/ms-rest-nodeauth': 3.0.10 '@microsoft/api-extractor': 7.7.11 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 inherits: 2.0.4 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -8562,7 +8609,7 @@ packages: dev: false name: '@rush-temp/container-registry' resolution: - integrity: sha512-DmUQXJ3nifpciCZKMVXUm40WJyiZ4SbM5Kv9ln5Hgki0svYqtN8fDTYbIAA2gCmy/ZaRyeusFe/3mg+ewjZnbg== + integrity: sha512-/kcEjsKonclJO6dZqUz95tUkXgO6rkNgS2WqBDNiq8Zmd1icNHd0czcgDj4Yg9FsrmtrNUIv3vx+PVYPYM+NUA== tarball: file:projects/container-registry.tgz version: 0.0.0 file:projects/core-amqp.tgz: @@ -8576,23 +8623,23 @@ packages: '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/async-lock': 1.1.2 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/debug': 4.1.5 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 - '@types/ws': 7.4.1 + '@types/ws': 7.4.4 assert: 1.5.0 - async-lock: 1.2.8 + async-lock: 1.3.0 buffer: 5.7.1 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 debug: 4.3.1 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 events: 3.3.0 jssha: 3.2.0 karma: 6.3.2_debug@4.3.1 @@ -8618,7 +8665,7 @@ packages: typescript: 4.2.4 url: 0.11.0 util: 0.12.3 - ws: 7.4.4 + ws: 7.4.5 dev: false name: '@rush-temp/core-amqp' resolution: @@ -8628,7 +8675,7 @@ packages: file:projects/core-asynciterator-polyfill.tgz: dependencies: '@types/node': 8.10.66 - eslint: 7.23.0 + eslint: 7.26.0 prettier: 1.19.1 typedoc: 0.15.2 typescript: 4.2.4 @@ -8651,7 +8698,7 @@ packages: assert: 1.5.0 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 inherits: 2.0.4 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -8682,14 +8729,14 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 chai: 4.3.4 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 inherits: 2.0.4 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -8718,28 +8765,18 @@ packages: dev: false name: '@rush-temp/core-client-1' resolution: - integrity: sha512-5Yty3M7abL/LT12Huh21EOQUOR941Dw7IKn61TSC/wZ8YFRofUFshxtzw2Xmy2a7n9Z48uhhmA5tF62T9jQivg== + integrity: sha512-MtwDEoS29kQ1NLBo75C9CS9dpH8zBekhn3rKb7xcO5KP/UvmxKG1NoEFRLuNueVLcy2nWG8kQ/uU0TLRnvQbkg== tarball: file:projects/core-client-1.tgz version: 0.0.0 file:projects/core-client.tgz: dependencies: - '@azure/core-rest-pipeline': 1.1.0-beta.1 - '@azure/core-tracing': 1.0.0-preview.11 - '@azure/core-xml': 1.0.0-beta.1 '@microsoft/api-extractor': 7.13.2 - '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - '@rollup/plugin-json': 4.1.0_rollup@1.32.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/sinon': 9.0.11 chai: 4.3.4 cross-env: 7.0.3 - downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 inherits: 2.0.4 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -8757,9 +8794,6 @@ packages: prettier: 2.2.1 rimraf: 3.0.2 rollup: 1.32.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 tslib: 2.2.0 typedoc: 0.15.2 @@ -8768,7 +8802,7 @@ packages: dev: false name: '@rush-temp/core-client' resolution: - integrity: sha512-hOktk+qS8E/H1HrpUGbrQYLvGl5IP0H/iGWOz+YHTaJh3FAjovl7NGeRKEdMlPYoyWkU53NKNXuNiiibOlIx6g== + integrity: sha512-21I9CaM3FoglMQizn8osGqwXz4Tw6yk1Y8ST7G75QA99FXpZAYkV5BpkvX1HZcyvFYqgJDXPpgUujV1KgZURJg== tarball: file:projects/core-client.tgz version: 0.0.0 file:projects/core-crypto.tgz: @@ -8779,7 +8813,7 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 @@ -8787,7 +8821,7 @@ packages: chai: 4.3.4 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -8826,7 +8860,7 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/express': 4.17.11 '@types/glob': 7.1.3 '@types/mocha': 7.0.2 @@ -8841,11 +8875,11 @@ packages: chai: 4.3.4 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 express: 4.17.1 fetch-mock: 9.11.0_node-fetch@2.6.1 form-data: 3.0.1 - glob: 7.1.6 + glob: 7.1.7 karma: 6.3.2 karma-chai: 0.1.0_chai@4.3.4+karma@6.3.2 karma-chrome-launcher: 3.1.0 @@ -8875,7 +8909,7 @@ packages: tunnel: 0.0.6 typedoc: 0.15.2 typescript: 4.2.4 - uglify-js: 3.13.3 + uglify-js: 3.13.7 uuid: 8.3.2 xhr-mock: 2.5.1 xml2js: 0.4.23 @@ -8893,13 +8927,13 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 assert: 1.5.0 chai: 4.3.4 cross-env: 7.0.3 - eslint: 7.23.0 + eslint: 7.26.0 events: 3.3.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -8927,7 +8961,7 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - uglify-js: 3.13.3 + uglify-js: 3.13.7 dev: false name: '@rush-temp/core-lro' resolution: @@ -8937,7 +8971,7 @@ packages: file:projects/core-paging.tgz: dependencies: '@types/node': 8.10.66 - eslint: 7.23.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 typedoc: 0.15.2 @@ -8957,7 +8991,7 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 @@ -8965,7 +8999,7 @@ packages: chai: 4.3.4 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 form-data: 3.0.1 http-proxy-agent: 4.0.1 https-proxy-agent: 5.0.0 @@ -9017,7 +9051,7 @@ packages: '@types/sinon': 9.0.11 assert: 1.5.0 cross-env: 7.0.3 - eslint: 7.23.0 + eslint: 7.26.0 inherits: 2.0.4 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9046,14 +9080,14 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 chai: 4.3.4 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 inherits: 2.0.4 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -9093,7 +9127,7 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 @@ -9101,7 +9135,7 @@ packages: chai: 4.3.4 cross-env: 7.0.3 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 inherits: 2.0.4 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -9142,21 +9176,20 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@types/debug': 4.1.5 - '@types/fast-json-stable-stringify': 2.0.0 + '@types/fast-json-stable-stringify': 2.1.0 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - '@types/node-fetch': 2.5.10 '@types/priorityqueuejs': 1.0.1 '@types/semaphore': 1.1.1 '@types/sinon': 9.0.11 '@types/tunnel': 0.0.1 - '@types/underscore': 1.11.1 + '@types/underscore': 1.11.2 '@types/uuid': 8.3.0 cross-env: 7.0.3 debug: 4.3.1 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 esm: 3.2.25 execa: 3.4.0 fast-json-stable-stringify: 2.1.0 @@ -9164,7 +9197,6 @@ packages: mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 node-abort-controller: 1.2.1 - node-fetch: 2.6.1 prettier: 1.19.1 priorityqueuejs: 1.0.0 proxy-agent: 4.0.1 @@ -9185,7 +9217,7 @@ packages: dev: false name: '@rush-temp/cosmos' resolution: - integrity: sha512-wCMZgt5C551rCi6HXgvD/EZVo6sl3llky3jsRCVQBcamdjmNF0qphRBDyYLlAn1cysnA7eG4clCBGzqT5wsAIg== + integrity: sha512-hmCf21wliEDYweLvsgf2SA0t/dRt4HJf9+30VAfPRrTF7dMIlWOawNPEn4IDtjux39Gv7g2H8RLvAOE7tYzQuA== tarball: file:projects/cosmos.tgz version: 0.0.0 file:projects/data-tables.tgz: @@ -9200,16 +9232,16 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 '@types/uuid': 8.3.0 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 inherits: 2.0.4 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -9242,7 +9274,7 @@ packages: dev: false name: '@rush-temp/data-tables' resolution: - integrity: sha512-IDeu2YShGePIGGHY6J4UBw930fwmpgbV/fhZylLZnt9FApLDhQLX5FCWaTOWj0EuncfwstJAYQCKzlxaXigl9w== + integrity: sha512-ZXPV9NiS8N/zpxKgkPZeZG/vVAbdr/JhtucYUkONi0tTz8x0Q3vgmbRK6Jsmoam0BK4XEboGUzDJS1w8kn3gIQ== tarball: file:projects/data-tables.tgz version: 0.0.0 file:projects/dev-tool.tgz: @@ -9251,9 +9283,8 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 - '@types/chalk': 2.2.0 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/fs-extra': 8.1.1 '@types/minimist': 1.2.1 '@types/mocha': 7.0.2 @@ -9263,8 +9294,8 @@ packages: chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 chalk: 4.1.1 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 fs-extra: 8.1.0 minimist: 1.2.5 mocha: 7.2.0 @@ -9294,15 +9325,15 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 '@types/uuid': 8.3.0 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 inherits: 2.0.4 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -9341,25 +9372,25 @@ packages: version: 0.0.0 file:projects/eslint-plugin-azure-sdk.tgz: dependencies: - '@types/chai': 4.2.16 - '@types/eslint': 7.2.8 + '@types/chai': 4.2.18 + '@types/eslint': 7.2.10 '@types/estree': 0.0.47 '@types/glob': 7.1.3 '@types/json-schema': 7.0.7 '@types/mocha': 7.0.2 - '@types/node': 10.17.56 - '@typescript-eslint/eslint-plugin': 4.19.0_1a11d0673659f3a5e0fd221432005aeb - '@typescript-eslint/experimental-utils': 4.19.0_eslint@7.23.0+typescript@4.2.4 - '@typescript-eslint/parser': 4.19.0_eslint@7.23.0+typescript@4.2.4 + '@types/node': 10.17.60 + '@typescript-eslint/eslint-plugin': 4.19.0_fddb9afe5c37d14de2fdf5d52845d82d + '@typescript-eslint/experimental-utils': 4.19.0_eslint@7.26.0+typescript@4.2.4 + '@typescript-eslint/parser': 4.19.0_eslint@7.26.0+typescript@4.2.4 '@typescript-eslint/typescript-estree': 4.19.0_typescript@4.2.4 chai: 4.3.4 - eslint: 7.23.0 - eslint-config-prettier: 7.2.0_eslint@7.23.0 - eslint-plugin-import: 2.22.1_eslint@7.23.0 - eslint-plugin-no-only-tests: 2.4.0 + eslint: 7.26.0 + eslint-config-prettier: 7.2.0_eslint@7.26.0 + eslint-plugin-import: 2.23.2_eslint@7.26.0 + eslint-plugin-no-only-tests: 2.6.0 eslint-plugin-promise: 4.3.1 - eslint-plugin-tsdoc: 0.2.11 - glob: 7.1.6 + eslint-plugin-tsdoc: 0.2.14 + glob: 7.1.7 json-schema: 0.3.0 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9387,8 +9418,8 @@ packages: '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/async-lock': 1.1.2 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/chai-string': 1.4.2 '@types/debug': 4.1.5 '@types/long': 4.0.1 @@ -9396,7 +9427,7 @@ packages: '@types/node': 8.10.66 '@types/sinon': 9.0.11 '@types/uuid': 8.3.0 - '@types/ws': 7.4.1 + '@types/ws': 7.4.4 assert: 1.5.0 buffer: 5.7.1 chai: 4.3.4 @@ -9404,9 +9435,9 @@ packages: chai-string: 1.5.0_chai@4.3.4 cross-env: 7.0.3 debug: 4.3.1 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 esm: 3.2.25 https-proxy-agent: 5.0.0 is-buffer: 2.0.5 @@ -9441,7 +9472,7 @@ packages: typedoc: 0.15.2 typescript: 4.2.4 uuid: 8.3.2 - ws: 7.4.4 + ws: 7.4.5 dev: false name: '@rush-temp/event-hubs' resolution: @@ -9459,23 +9490,23 @@ packages: '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/async-lock': 1.1.2 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/chai-string': 1.4.2 '@types/debug': 4.1.5 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/uuid': 8.3.0 - '@types/ws': 7.4.1 - async-lock: 1.2.8 - azure-storage: 2.10.3 + '@types/ws': 7.4.4 + async-lock: 1.3.0 + azure-storage: 2.10.4 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 chai-string: 1.5.0_chai@4.3.4 cross-env: 7.0.3 debug: 4.3.1 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 esm: 3.2.25 https-proxy-agent: 5.0.0 mocha: 7.2.0 @@ -9491,7 +9522,7 @@ packages: typedoc: 0.15.2 typescript: 4.2.4 uuid: 8.3.2 - ws: 7.4.4 + ws: 7.4.5 dev: false name: '@rush-temp/event-processor-host' resolution: @@ -9502,15 +9533,15 @@ packages: dependencies: '@azure/core-rest-pipeline': 1.0.3 '@azure/core-tracing': 1.0.0-preview.11 - '@azure/service-bus': 7.0.5 + '@azure/service-bus': 7.1.0 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 @@ -9518,8 +9549,8 @@ packages: chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -9566,8 +9597,8 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/chai-string': 1.4.2 '@types/debug': 4.1.5 '@types/mocha': 7.0.2 @@ -9578,8 +9609,8 @@ packages: chai-string: 1.5.0_chai@4.3.4 cross-env: 7.0.3 debug: 4.3.1 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 esm: 3.2.25 events: 3.3.0 guid-typescript: 1.0.9 @@ -9619,15 +9650,10 @@ packages: file:projects/identity.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 - '@azure/msal-browser': 2.9.0 - '@azure/msal-common': 4.0.3 - '@azure/msal-node': 1.0.2 + '@azure/msal-browser': 2.14.2 + '@azure/msal-common': 4.3.0 + '@azure/msal-node': 1.1.0 '@microsoft/api-extractor': 7.7.11 - '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - '@rollup/plugin-json': 4.1.0_rollup@1.32.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 '@types/jws': 3.2.3 '@types/mocha': 7.0.2 '@types/node': 8.10.66 @@ -9637,8 +9663,8 @@ packages: '@types/uuid': 8.3.0 assert: 1.5.0 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 events: 3.3.0 inherits: 2.0.4 jws: 4.0.0 @@ -9652,16 +9678,13 @@ packages: karma-sourcemap-loader: 0.3.8 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 - mock-fs: 4.13.0 + mock-fs: 4.14.0 open: 7.4.2 prettier: 1.19.1 puppeteer: 3.3.0 qs: 6.10.1 rimraf: 3.0.2 rollup: 1.32.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 stoppable: 1.1.0 tslib: 2.2.0 @@ -9671,10 +9694,8 @@ packages: uuid: 8.3.2 dev: false name: '@rush-temp/identity' - optionalDependencies: - keytar: 7.6.0 resolution: - integrity: sha512-sEvBei3gVktijypQM6FLi74OeRLYeUlJMgmHXoAyYOaJDE+SbowgsRYQeEwhvloeNACGBX6ERgp6GmeEG/UEcg== + integrity: sha512-WBDiw99pS183MgGmJf7Ety38qx9pB8H8lJ+bcOhgLCD0EQsG+yPKjUIuQjicVG8XIpEWCcb6NjftPkfjLCkVkw== tarball: file:projects/identity.tgz version: 0.0.0 file:projects/iot-device-update.tgz: @@ -9685,8 +9706,8 @@ packages: '@types/node': 8.10.66 '@types/uuid': 8.3.0 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 mkdirp: 1.0.4 prettier: 1.19.1 rimraf: 3.0.2 @@ -9697,7 +9718,7 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - uglify-js: 3.13.3 + uglify-js: 3.13.7 uuid: 8.3.2 dev: false name: '@rush-temp/iot-device-update' @@ -9705,59 +9726,6 @@ packages: integrity: sha512-DuneImF4EvaxNJN8S5CocoKuUHCNqt/tuTYb+IHa6t1Sr+PaFyL2m1mQN1xD2WlDpgK5nf3arEXcdGPR0xVEeQ== tarball: file:projects/iot-device-update.tgz version: 0.0.0 - file:projects/iot-modelsrepository.tgz: - dependencies: - '@azure/core-rest-pipeline': 1.0.3 - '@azure/core-tracing': 1.0.0-preview.11 - '@microsoft/api-extractor': 7.7.11 - '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - '@rollup/plugin-json': 4.1.0_rollup@1.32.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 - '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/mocha': 7.0.2 - '@types/node': 8.10.66 - '@types/sinon': 9.0.11 - chai: 4.3.4 - cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 - events: 3.3.0 - inherits: 2.0.4 - karma: 6.3.2 - karma-chrome-launcher: 3.1.0 - karma-coverage: 2.0.3 - karma-edge-launcher: 0.4.2_karma@6.3.2 - karma-env-preprocessor: 0.1.1 - karma-firefox-launcher: 1.3.0 - karma-ie-launcher: 1.0.0_karma@6.3.2 - karma-json-preprocessor: 0.3.3_karma@6.3.2 - karma-json-to-file-reporter: 1.0.1 - karma-junit-reporter: 2.0.1_karma@6.3.2 - karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@6.3.2 - mocha: 7.2.0 - mocha-junit-reporter: 1.23.3_mocha@7.2.0 - nyc: 14.1.1 - prettier: 1.19.1 - rimraf: 3.0.2 - rollup: 1.32.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 - rollup-plugin-terser: 5.3.1_rollup@1.32.1 - rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 - sinon: 9.2.4 - ts-node: 9.1.1_typescript@4.2.4 - tslib: 2.2.0 - typedoc: 0.15.2 - typescript: 4.2.4 - util: 0.12.3 - dev: false - name: '@rush-temp/iot-modelsrepository' - resolution: - integrity: sha512-n7pbT9gQay0Bf0fLiJb3fhhHoIAoVkLx1WGvDulWyzgNKXrjxPgjPD8W8uVf4kpxbs3RZJ0w7ciFp8AFGUvAbQ== - tarball: file:projects/iot-modelsrepository.tgz - version: 0.0.0 file:projects/keyvault-admin.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 @@ -9768,8 +9736,8 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 @@ -9778,8 +9746,8 @@ packages: chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 esm: 3.2.25 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 @@ -9813,7 +9781,7 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/query-string': 6.2.0 @@ -9821,8 +9789,8 @@ packages: assert: 1.5.0 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 esm: 3.2.25 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -9864,7 +9832,7 @@ packages: file:projects/keyvault-common.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 - eslint: 7.23.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 tslib: 2.2.0 @@ -9885,8 +9853,8 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/query-string': 6.2.0 @@ -9895,8 +9863,8 @@ packages: chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 esm: 3.2.25 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -9945,7 +9913,7 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/query-string': 6.2.0 @@ -9953,8 +9921,8 @@ packages: assert: 1.5.0 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 esm: 3.2.25 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -10000,7 +9968,7 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 @@ -10008,8 +9976,8 @@ packages: chai: 4.3.4 cross-env: 7.0.3 delay: 4.4.1 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -10045,15 +10013,15 @@ packages: dependencies: '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 inherits: 2.0.4 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -10087,8 +10055,8 @@ packages: file:projects/mock-hub.tgz: dependencies: '@types/node': 8.10.66 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rhea: 1.0.24 rimraf: 3.0.2 @@ -10109,9 +10077,9 @@ packages: '@opentelemetry/semantic-conventions': 0.18.2 '@opentelemetry/tracing': 0.18.2 '@types/mocha': 7.0.2 - '@types/node': 10.17.56 - eslint: 7.23.0 - eslint-plugin-node: 11.1.0_eslint@7.23.0 + '@types/node': 10.17.60 + eslint: 7.26.0 + eslint-plugin-node: 11.1.0_eslint@7.26.0 execa: 3.4.0 mocha: 7.2.0 nock: 12.0.3 @@ -10135,8 +10103,8 @@ packages: '@azure/ai-form-recognizer': 3.1.0-beta.3 '@azure/identity': 1.3.0 '@types/node': 8.10.66 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10152,8 +10120,8 @@ packages: dependencies: '@azure/ai-metrics-advisor': 1.0.0-beta.3 '@types/node': 8.10.66 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10169,8 +10137,8 @@ packages: dependencies: '@azure/identity': 1.3.0 '@types/node': 8.10.66 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10184,10 +10152,9 @@ packages: version: 0.0.0 file:projects/perf-core-rest-pipeline.tgz: dependencies: - '@azure/core-rest-pipeline': 1.1.0-beta.1 '@types/uuid': 8.3.0 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10196,14 +10163,14 @@ packages: dev: false name: '@rush-temp/perf-core-rest-pipeline' resolution: - integrity: sha512-BNAP4/2YeHNhrMbvl9A1B+YX+W9MDW8PqA2WipfM5nExM9ywsJEdX7JUv69gul01revGkFoSY1Ukwhe0pSNpNQ== + integrity: sha512-zhk0kCQ0xrV5TUeFa+4yKFMQCIAZyy5P0nSlfEDhL7xMsJSFTptYrw+bf1XCpujcSBV2T++I8qYip5qtMZdE3A== tarball: file:projects/perf-core-rest-pipeline.tgz version: 0.0.0 file:projects/perf-eventgrid.tgz: dependencies: '@types/node': 8.10.66 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10219,8 +10186,8 @@ packages: dependencies: '@azure/identity': 2.0.0-beta.3 '@types/uuid': 8.3.0 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10236,8 +10203,8 @@ packages: dependencies: '@azure/identity': 1.3.0 '@types/uuid': 8.3.0 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10254,8 +10221,8 @@ packages: dependencies: '@azure/identity': 1.3.0 '@types/uuid': 8.3.0 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10272,8 +10239,8 @@ packages: dependencies: '@azure/identity': 1.3.0 '@types/uuid': 8.3.0 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10290,8 +10257,8 @@ packages: dependencies: '@azure/identity': 1.3.0 '@types/node': 8.10.66 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10309,8 +10276,8 @@ packages: '@types/node': 8.10.66 '@types/node-fetch': 2.5.10 '@types/uuid': 8.3.0 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 node-fetch: 2.6.1 prettier: 1.19.1 rimraf: 3.0.2 @@ -10321,15 +10288,15 @@ packages: dev: false name: '@rush-temp/perf-storage-blob' resolution: - integrity: sha512-rqK+gX9tyH33hp2qGxsPiokHaeml96R7BTSt+g4pE4L25DXz6piSCdAvQoqQFgddUiOpJLxobsgLMUS2yL3R3Q== + integrity: sha512-P4LhI9+Yj8e3NAQrWVtykCHFm+TqTRyUqZJl1ByArq0iUBmMwKrSf28qas15IkBwuG/XxYhXvFPvscOOm9nyYQ== tarball: file:projects/perf-storage-blob.tgz version: 0.0.0 file:projects/perf-storage-file-datalake.tgz: dependencies: '@types/node': 8.10.66 '@types/uuid': 8.3.0 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10346,8 +10313,8 @@ packages: dependencies: '@types/node': 8.10.66 '@types/uuid': 8.3.0 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 prettier: 1.19.1 rimraf: 3.0.2 ts-node: 9.1.1_typescript@4.2.4 @@ -10365,13 +10332,13 @@ packages: '@azure/core-rest-pipeline': 1.0.3 '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.13.2 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -10400,7 +10367,7 @@ packages: dev: false name: '@rush-temp/purview-catalog' resolution: - integrity: sha512-eBVNFGBBOpPmvwlw/pbKgUUYZ/m61XBMuVJ75zJV9W4xJDaGaP++iOZpmexXVEQnTdbjIRgt5h0/yGxAheu5Kw== + integrity: sha512-icJAilE/Kfkt+xTFf39DqOUKxdWhU4bHzvsMZtfihXTyYK7gFY1efS/6FgROOd7GvCOyBi/KAehjcpJfNZ3pvg== tarball: file:projects/purview-catalog.tgz version: 0.0.0 file:projects/purview-scanning.tgz: @@ -10408,13 +10375,13 @@ packages: '@azure/core-rest-pipeline': 1.0.3 '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.13.2 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -10443,7 +10410,7 @@ packages: dev: false name: '@rush-temp/purview-scanning' resolution: - integrity: sha512-tmoBhJSqMTMl7QlwQ0+Nmck7qhKtNN7pNEFqgz+zWIXsT2mOIKlczw6elNEJvQ/DjryF2/at4YAbQ+GFXe2F+g== + integrity: sha512-eVzYQbjln0PommSq7DDncO0SvDDX2i8EGQ4wl62Fm6pxG2yJ5vgrp1AuXxI1MzKGn/WZzxGAk9uSDOPGb8UQlQ== tarball: file:projects/purview-scanning.tgz version: 0.0.0 file:projects/quantum-jobs.tgz: @@ -10456,14 +10423,14 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 events: 3.3.0 inherits: 2.0.4 karma: 6.3.2 @@ -10511,17 +10478,17 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 - avsc: 5.6.1 + avsc: 5.7.0 buffer: 5.7.1 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -10566,15 +10533,15 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -10617,14 +10584,14 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 events: 3.3.0 inherits: 2.0.4 karma: 6.3.2 @@ -10673,8 +10640,8 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/debug': 4.1.5 '@types/glob': 7.1.3 '@types/is-buffer': 2.0.0 @@ -10682,7 +10649,7 @@ packages: '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 - '@types/ws': 7.4.1 + '@types/ws': 7.4.4 assert: 1.5.0 buffer: 5.7.1 chai: 4.3.4 @@ -10691,12 +10658,12 @@ packages: cross-env: 7.0.3 debug: 4.3.1 delay: 4.4.1 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 esm: 3.2.25 events: 3.3.0 - glob: 7.1.6 + glob: 7.1.7 https-proxy-agent: 5.0.0 is-buffer: 2.0.5 jssha: 3.2.0 @@ -10731,7 +10698,7 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - ws: 7.4.4 + ws: 7.4.5 dev: false name: '@rush-temp/service-bus' resolution: @@ -10752,10 +10719,10 @@ packages: '@types/sinon': 9.0.11 assert: 1.5.0 cross-env: 7.0.3 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.23.0 + eslint: 7.26.0 esm: 3.2.25 events: 3.3.0 inherits: 2.0.4 @@ -10812,10 +10779,10 @@ packages: '@types/node-fetch': 2.5.10 assert: 1.5.0 cross-env: 7.0.3 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.23.0 + eslint: 7.26.0 esm: 3.2.25 events: 3.3.0 inherits: 2.0.4 @@ -10853,7 +10820,7 @@ packages: dev: false name: '@rush-temp/storage-blob' resolution: - integrity: sha512-Fue4hXzVsT+u7nXMd5nZvTEa5AjyhfiJ8vex1XiBzyJnWN7KO+ah6HY7JapUGt0sMRbflRQNdR4bT3lG4QiS5Q== + integrity: sha512-XfwGJuuweV0lPcyK1Ol1RCSZWo7zXXm6+aOS764Jppp+Mpyc3m/HUdXpwidV/9Qu+KAcOB228CSFVYFzjLbjVA== tarball: file:projects/storage-blob.tgz version: 0.0.0 file:projects/storage-file-datalake.tgz: @@ -10871,10 +10838,10 @@ packages: '@types/query-string': 6.2.0 assert: 1.5.0 cross-env: 7.0.3 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.23.0 + eslint: 7.26.0 esm: 3.2.25 events: 3.3.0 execa: 3.4.0 @@ -10928,10 +10895,10 @@ packages: '@types/node': 8.10.66 assert: 1.5.0 cross-env: 7.0.3 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.23.0 + eslint: 7.26.0 esm: 3.2.25 events: 3.3.0 inherits: 2.0.4 @@ -10981,10 +10948,10 @@ packages: '@types/mocha': 7.0.2 '@types/node': 8.10.66 assert: 1.5.0 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.23.0 + eslint: 7.26.0 esm: 3.2.25 inherits: 2.0.4 karma: 6.3.2 @@ -11035,10 +11002,10 @@ packages: '@types/node': 8.10.66 assert: 1.5.0 cross-env: 7.0.3 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 es6-promise: 4.2.8 - eslint: 7.23.0 + eslint: 7.26.0 esm: 3.2.25 inherits: 2.0.4 karma: 6.3.2 @@ -11082,7 +11049,7 @@ packages: '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - eslint: 7.23.0 + eslint: 7.26.0 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-node-resolve: 3.4.0 @@ -11090,7 +11057,7 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - uglify-js: 3.13.3 + uglify-js: 3.13.7 dev: false name: '@rush-temp/synapse-access-control' resolution: @@ -11103,16 +11070,16 @@ packages: '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -11141,7 +11108,7 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - uglify-js: 3.13.3 + uglify-js: 3.13.7 dev: false name: '@rush-temp/synapse-artifacts' resolution: @@ -11153,7 +11120,7 @@ packages: '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - eslint: 7.23.0 + eslint: 7.26.0 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-node-resolve: 3.4.0 @@ -11161,7 +11128,7 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - uglify-js: 3.13.3 + uglify-js: 3.13.7 dev: false name: '@rush-temp/synapse-managed-private-endpoints' resolution: @@ -11173,7 +11140,7 @@ packages: '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - eslint: 7.23.0 + eslint: 7.26.0 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-node-resolve: 3.4.0 @@ -11181,7 +11148,7 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - uglify-js: 3.13.3 + uglify-js: 3.13.7 dev: false name: '@rush-temp/synapse-monitoring' resolution: @@ -11193,7 +11160,7 @@ packages: '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - eslint: 7.23.0 + eslint: 7.26.0 rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-node-resolve: 3.4.0 @@ -11201,7 +11168,7 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - uglify-js: 3.13.3 + uglify-js: 3.13.7 dev: false name: '@rush-temp/synapse-spark' resolution: @@ -11213,16 +11180,16 @@ packages: '@azure/core-tracing': 1.0.0-preview.11 '@azure/identity': 1.3.0 '@microsoft/api-extractor': 7.7.11 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 + dotenv: 8.6.0 downlevel-dts: 0.4.0 - eslint: 7.23.0 + eslint: 7.26.0 esm: 3.2.25 inherits: 2.0.4 karma: 6.3.2 @@ -11259,7 +11226,7 @@ packages: '@types/minimist': 1.2.1 '@types/node': 8.10.66 '@types/node-fetch': 2.5.10 - eslint: 7.23.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -11283,7 +11250,7 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/fs-extra': 8.1.1 '@types/md5': 2.3.0 '@types/mocha': 7.0.2 @@ -11292,8 +11259,8 @@ packages: '@types/nise': 1.4.0 '@types/node': 8.10.66 chai: 4.3.4 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 fs-extra: 8.1.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 @@ -11311,7 +11278,7 @@ packages: md5: 2.3.0 mocha: 7.2.0 mocha-junit-reporter: 1.23.3_mocha@7.2.0 - mock-fs: 4.13.0 + mock-fs: 4.14.0 mock-require: 3.0.3 nise: 4.1.0 nock: 12.0.3 @@ -11336,13 +11303,13 @@ packages: file:projects/test-utils.tgz: dependencies: '@microsoft/api-extractor': 7.7.11 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/mocha': 7.0.2 '@types/node': 8.10.66 '@types/sinon': 9.0.11 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 - eslint: 7.23.0 + eslint: 7.26.0 karma: 6.3.2 karma-chrome-launcher: 3.1.0 karma-coverage: 2.0.3 @@ -11360,6 +11327,50 @@ packages: integrity: sha512-h7eNMFY99Tt6JxkzrO2RY30U4hccSzEQBiWTvyk5u/OZZu4Tzi/fUDfgBF6gMx9Y0PrhYtjQp2QTCfZoHqKZtg== tarball: file:projects/test-utils.tgz version: 0.0.0 + file:projects/video-analyzer-edge.tgz: + dependencies: + '@azure/core-tracing': 1.0.0-preview.11 + '@microsoft/api-extractor': 7.7.11 + '@opentelemetry/api': 1.0.0-rc.0 + '@types/chai': 4.2.16 + '@types/chai-as-promised': 7.1.3 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + azure-iothub: 1.13.1 + chai: 4.3.4 + chai-as-promised: 7.1.1_chai@4.3.4 + cross-env: 7.0.3 + dotenv: 8.2.0 + eslint: 7.23.0 + events: 3.3.0 + inherits: 2.0.4 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + karma-sourcemap-loader: 0.3.8 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 1.19.1 + rimraf: 3.0.2 + rollup: 1.32.1 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + util: 0.12.3 + dev: false + name: '@rush-temp/video-analyzer-edge' + resolution: + integrity: sha512-xlSQc7FUX52PPOtM3sfN8/VNejc9tx1VtsgYq0o/TcTxqPCZOMO0l5bOsz/UUruxXlZgDNxbxkh9VUpoCIHskQ== + tarball: file:projects/video-analyzer-edge.tgz + version: 0.0.0 file:projects/web-pubsub-express.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 @@ -11370,7 +11381,7 @@ packages: '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 - '@types/chai': 4.2.16 + '@types/chai': 4.2.18 '@types/express': 4.17.11 '@types/express-serve-static-core': 4.17.19 '@types/jsonwebtoken': 8.5.1 @@ -11382,8 +11393,8 @@ packages: chai: 4.3.4 cloudevents: 4.0.2 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 esm: 3.2.25 jsonwebtoken: 8.5.1 karma: 6.3.2 @@ -11440,8 +11451,8 @@ packages: assert: 1.5.0 chai: 4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 esm: 3.2.25 jsonwebtoken: 8.5.1 karma: 6.3.2 @@ -11474,14 +11485,12 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - url: 0.11.0 dev: false name: '@rush-temp/web-pubsub' resolution: - integrity: sha512-/NyPXluzbX/KnFWCkerIeKhrpi85AR9nTnG4sjGyyKbxwWSzJYmrUTXUuRltnhFBA2wbaw6RQmmmukjCN8kDmQ== + integrity: sha512-7DeCXxoad4VAGDhNwiYkzn7cUqIkaxlapdj5YnYiE2yVb059BjmVJ5+7Yy3SK5a9fT/rhXiidEuz7GpFF/J67w== tarball: file:projects/web-pubsub.tgz version: 0.0.0 -registry: '' specifiers: '@rush-temp/abort-controller': file:./projects/abort-controller.tgz '@rush-temp/ai-anomaly-detector': file:./projects/ai-anomaly-detector.tgz @@ -11522,7 +11531,6 @@ specifiers: '@rush-temp/eventhubs-checkpointstore-blob': file:./projects/eventhubs-checkpointstore-blob.tgz '@rush-temp/identity': file:./projects/identity.tgz '@rush-temp/iot-device-update': file:./projects/iot-device-update.tgz - '@rush-temp/iot-modelsrepository': file:./projects/iot-modelsrepository.tgz '@rush-temp/keyvault-admin': file:./projects/keyvault-admin.tgz '@rush-temp/keyvault-certificates': file:./projects/keyvault-certificates.tgz '@rush-temp/keyvault-common': file:./projects/keyvault-common.tgz @@ -11567,5 +11575,6 @@ specifiers: '@rush-temp/test-utils': file:./projects/test-utils.tgz '@rush-temp/test-utils-perfstress': file:./projects/test-utils-perfstress.tgz '@rush-temp/test-utils-recorder': file:./projects/test-utils-recorder.tgz + '@rush-temp/video-analyzer-edge': file:./projects/video-analyzer-edge.tgz '@rush-temp/web-pubsub': file:./projects/web-pubsub.tgz '@rush-temp/web-pubsub-express': file:./projects/web-pubsub-express.tgz From 09500de316bf46bffee0d312d1de1e59d0b7a60c Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 18:20:47 -0700 Subject: [PATCH 73/81] fix --- common/config/rush/pnpm-lock.yaml | 153 +++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 47 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index de5736193ca1..9102c815c2c3 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -38,6 +38,7 @@ dependencies: '@rush-temp/eventhubs-checkpointstore-blob': file:projects/eventhubs-checkpointstore-blob.tgz '@rush-temp/identity': file:projects/identity.tgz '@rush-temp/iot-device-update': file:projects/iot-device-update.tgz + '@rush-temp/iot-modelsrepository': file:projects/iot-modelsrepository.tgz '@rush-temp/keyvault-admin': file:projects/keyvault-admin.tgz '@rush-temp/keyvault-certificates': file:projects/keyvault-certificates.tgz '@rush-temp/keyvault-common': file:projects/keyvault-common.tgz @@ -129,7 +130,7 @@ packages: '@azure/ms-rest-nodeauth': 0.9.3_debug@3.2.7 '@types/async-lock': 1.1.2 '@types/is-buffer': 2.0.0 - async-lock: 1.3.0 + async-lock: 1.2.8 buffer: 5.7.1 debug: 3.2.7 events: 3.3.0 @@ -164,7 +165,7 @@ packages: '@azure/core-auth': 1.3.0 '@azure/logger': 1.0.2 '@types/async-lock': 1.1.2 - async-lock: 1.3.0 + async-lock: 1.2.8 buffer: 5.7.1 events: 3.3.0 jssha: 3.2.0 @@ -293,7 +294,7 @@ packages: dependencies: '@azure/amqp-common': 1.0.0-preview.9 '@azure/ms-rest-nodeauth': 0.9.3_debug@3.2.7 - async-lock: 1.3.0 + async-lock: 1.2.8 debug: 3.2.7 is-buffer: 2.0.5 jssha: 2.4.2 @@ -1151,7 +1152,7 @@ packages: /@types/body-parser/1.19.0: dependencies: '@types/connect': 3.4.34 - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ== @@ -1177,7 +1178,7 @@ packages: integrity: sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg== /@types/connect/3.4.34: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-ePPA/JuI+X0vb+gSWlPKOY0NdNAie/rPUqX2GUPpbZwiKTkSPhjXWuee47E4MtE54QVzGCQMQkAL6JhV2E1+cQ== @@ -1210,7 +1211,7 @@ packages: integrity: sha512-c5ciR06jK8u9BstrmJyO97m+klJrrhCf9u3rLu3DEAJBirxRqSCvDQoYKmxuYwQI5SZChAWu+tq9oVlGRuzPAg== /@types/express-serve-static-core/4.17.19: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 '@types/qs': 6.9.6 '@types/range-parser': 1.2.3 dev: false @@ -1234,20 +1235,20 @@ packages: integrity: sha512-IyNhGHu71jH1jCXTHmafuoAAdsbBON3kDh7u/UUhLmjYgN5TYB54e1R8ckTCiIevl2UuZaCsi9XRxineY5yUjw== /@types/fs-extra/8.1.1: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w== /@types/glob/7.1.3: dependencies: '@types/minimatch': 3.0.4 - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w== /@types/is-buffer/2.0.0: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw== @@ -1261,7 +1262,7 @@ packages: integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4= /@types/jsonwebtoken/8.5.1: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-rNAPdomlIUX0i0cg2+I+Q1wOUr531zHBQ+cV/28PJ39bSPKjahatZZ2LMuhiguETkCgLVzfruw/ZvNMNkKoSzw== @@ -1271,7 +1272,7 @@ packages: integrity: sha512-FLXKbwbB+4fsJECYOpIiYX2GSqSHYnkO/UnrFqlZn6crpyyOtk4LRab+G1HC7dTbT1NB7spkHecZRQGXoCWiJQ== /@types/jws/3.2.3: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-g54CHxwvaHvyJyeuZqe7VQujV9SfCXwEkboJp355INPL+kjlS3Aq153EHptaeO/Cch/NPJ1i2sHz0sDDizn7LQ== @@ -1285,7 +1286,7 @@ packages: integrity: sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== /@types/md5/2.3.0: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-556YJ7ejzxIqSSxzyGGpctuZOarNZJt/zlEkhmmDc1f/slOEANHuwu2ZX7YaZ40rMiWoxt8GvAhoDpW1cmSy6A== @@ -1311,13 +1312,13 @@ packages: integrity: sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w== /@types/mock-fs/4.10.0: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-FQ5alSzmHMmliqcL36JqIA4Yyn9jyJKvRSGV3mvPh108VFatX7naJDzSG4fnFQNZFq9dIx0Dzoe6ddflMB2Xkg== /@types/mock-require/2.0.0: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-nOgjoE5bBiDeiA+z41i95makyHUSMWQMOPocP+J67Pqx/68HAXaeWN1NFtrAYYV6LrISIZZ8vKHm/a50k0f6Sg== @@ -1327,7 +1328,7 @@ packages: integrity: sha512-DPxmjiDwubsNmguG5X4fEJ+XCyzWM3GXWsqQlvUcjJKa91IOoJUy51meDr0GkzK64qqNcq85ymLlyjoct9tInw== /@types/node-fetch/2.5.10: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 form-data: 3.0.1 dev: false resolution: @@ -1366,7 +1367,7 @@ packages: integrity: sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA== /@types/resolve/1.17.1: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw== @@ -1377,7 +1378,7 @@ packages: /@types/serve-static/1.13.9: dependencies: '@types/mime': 1.3.2 - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-ZFqF6qa48XsPdjXV5Gsz0Zqmux2PerNd3a/ktL45mHpa19cuMi/cL8tcxdAx497yRh+QtYPuofjT9oWw9P7nkA== @@ -1393,7 +1394,7 @@ packages: integrity: sha512-dIPoZ3g5gcx9zZEszaxLSVTvMReD3xxyyDnQUjA6IYDG9Ba2AV0otMPs+77sG9ojB4Qr2N2Vk5RnKeuA0X/0bg== /@types/stoppable/1.1.0: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-BRR23Q9CJduH7AM6mk4JRttd8XyFkb4qIPZu4mdLF+VoP+wcjIxIWIKiBbN78NBbEuynrAyMPtzOHnIp2B/JPQ== @@ -1403,7 +1404,7 @@ packages: integrity: sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A== /@types/tunnel/0.0.1: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A== @@ -1417,19 +1418,19 @@ packages: integrity: sha512-eQ9qFW/fhfGJF8WKHGEHZEyVWfZxrT+6CLIJGBcZPfxUh/+BnEj+UCGYMlr9qZuX/2AltsvwrGqp0LhEW8D0zQ== /@types/ws/7.4.4: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-d/7W23JAXPodQNbOZNXvl2K+bqAQrCMwlh/nuQsPSQk6Fq0opHoPrUw43aHsvSbIiQPr8Of2hkFbnz1XBFVyZQ== /@types/xml2js/0.4.8: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false resolution: integrity: sha512-EyvT83ezOdec7BhDaEcsklWy7RSIdi6CNe95tmOAK0yx/Lm30C9K75snT3fYayK59ApC2oyW+rcHErdG05FHJA== /@types/yauzl/2.9.1: dependencies: - '@types/node': 8.10.66 + '@types/node': 10.17.60 dev: false optional: true resolution: @@ -1943,7 +1944,7 @@ packages: integrity: sha512-Xt2wLtiblGSag/zJe6vJVkgjlj+jo2C5exuaSGHuMtvkuD/MB74xyGDdgflXcOiTVzS1rXx02I02jgKHTW5BDA== /azure-iothub/1.13.1: dependencies: - '@azure/ms-rest-js': 2.3.0 + '@azure/ms-rest-js': 2.5.0 async: 2.6.3 azure-iot-amqp-base: 2.4.7 azure-iot-common: 1.12.7 @@ -1966,7 +1967,7 @@ packages: md5.js: 1.3.4 readable-stream: 2.0.6 request: 2.88.2 - underscore: 1.13.1 + underscore: 1.8.3 uuid: 3.4.0 validator: 9.4.1 xml2js: 0.2.8 @@ -1975,7 +1976,7 @@ packages: engines: node: '>= 0.8.26' resolution: - integrity: sha512-zlfRPl4js92JC6+79C2EUmNGYjSknRl8pOiHQF78zy+pbOFOHtlBF6BU/OxPeHQX3gaa6NdEZnVydFxhhndkEw== + integrity: sha512-IGLs5Xj6kO8Ii90KerQrrwuJKexLgSwYC4oLWmc11mzKe7Jt2E5IVg+ZQ8K53YWZACtVTMBNO3iGuA+4ipjJxQ== /babel-runtime/6.26.0: dependencies: core-js: 2.6.12 @@ -2582,7 +2583,7 @@ packages: integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== /debug/3.2.6: dependencies: - ms: 2.1.1 + ms: 2.1.3 deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dev: false resolution: @@ -2862,7 +2863,7 @@ packages: cors: 2.8.5 debug: 4.3.1 engine.io-parser: 4.0.2 - ws: 7.4.5 + ws: 7.4.4 dev: false engines: node: '>=10.0.0' @@ -6057,7 +6058,7 @@ packages: rimraf: 3.0.2 tar-fs: 2.1.1 unbzip2-stream: 1.4.3 - ws: 7.4.5 + ws: 7.4.4 dev: false engines: node: '>=10.18.1' @@ -6504,7 +6505,7 @@ packages: /rollup/1.32.1: dependencies: '@types/estree': 0.0.47 - '@types/node': 8.10.66 + '@types/node': 10.17.60 acorn: 7.4.1 dev: false hasBin: true @@ -6795,7 +6796,7 @@ packages: dependencies: '@types/cookie': 0.4.0 '@types/cors': 2.8.10 - '@types/node': 10.17.13 + '@types/node': 10.17.60 accepts: 1.3.7 base64id: 2.0.0 debug: 4.3.1 @@ -7464,6 +7465,10 @@ packages: dev: false resolution: integrity: sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g== + /underscore/1.8.3: + dev: false + resolution: + integrity: sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI= /universal-user-agent/6.0.0: dev: false resolution: @@ -7716,7 +7721,7 @@ packages: utf-8-validate: optional: true resolution: - integrity: sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g== + integrity: sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw== /xhr-mock/2.5.1: dependencies: global: 4.4.0 @@ -8564,7 +8569,7 @@ packages: dev: false name: '@rush-temp/confidential-ledger' resolution: - integrity: sha512-377JfE4l6ZZHgPwOzPns5aQGfcsKqoHZcSXstcyG7B6iaQF9ldkSysCxADvWg6hBa3+A7rU0ACX4zawFrJsEWQ== + integrity: sha512-/mC7zzANKf0SEh/GZYNSpyXtyk0GPdfVd80/Shbrb2su7IrqTKPjcYqbfSspN7+pSp4+BYtRwBH3gwXhTGSQnw== tarball: file:projects/confidential-ledger.tgz version: 0.0.0 file:projects/container-registry.tgz: @@ -8609,7 +8614,7 @@ packages: dev: false name: '@rush-temp/container-registry' resolution: - integrity: sha512-/kcEjsKonclJO6dZqUz95tUkXgO6rkNgS2WqBDNiq8Zmd1icNHd0czcgDj4Yg9FsrmtrNUIv3vx+PVYPYM+NUA== + integrity: sha512-p4mX6xzBEEIe41EWy81HV6pIu2ydk+5nJj+d6GAaBR7H1IGPdSl2uLjaYlWtJ9TxoYU/ASVIGHR6bNJIF02eLw== tarball: file:projects/container-registry.tgz version: 0.0.0 file:projects/core-amqp.tgz: @@ -8631,7 +8636,7 @@ packages: '@types/sinon': 9.0.11 '@types/ws': 7.4.4 assert: 1.5.0 - async-lock: 1.3.0 + async-lock: 1.2.8 buffer: 5.7.1 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 @@ -8665,7 +8670,7 @@ packages: typescript: 4.2.4 url: 0.11.0 util: 0.12.3 - ws: 7.4.5 + ws: 7.4.4 dev: false name: '@rush-temp/core-amqp' resolution: @@ -8802,7 +8807,7 @@ packages: dev: false name: '@rush-temp/core-client' resolution: - integrity: sha512-21I9CaM3FoglMQizn8osGqwXz4Tw6yk1Y8ST7G75QA99FXpZAYkV5BpkvX1HZcyvFYqgJDXPpgUujV1KgZURJg== + integrity: sha512-wbjmwbFMeFO+pBiAdWh8oVFwrb/HgRVQ9eOceMhlRWFJ6ud9wcz637OsuwZ18AOI/C9r19ZwaLP0YF7r8BpAXQ== tarball: file:projects/core-client.tgz version: 0.0.0 file:projects/core-crypto.tgz: @@ -9472,7 +9477,7 @@ packages: typedoc: 0.15.2 typescript: 4.2.4 uuid: 8.3.2 - ws: 7.4.5 + ws: 7.4.4 dev: false name: '@rush-temp/event-hubs' resolution: @@ -9498,8 +9503,8 @@ packages: '@types/node': 8.10.66 '@types/uuid': 8.3.0 '@types/ws': 7.4.4 - async-lock: 1.3.0 - azure-storage: 2.10.4 + async-lock: 1.2.8 + azure-storage: 2.10.3 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 chai-string: 1.5.0_chai@4.3.4 @@ -9522,7 +9527,7 @@ packages: typedoc: 0.15.2 typescript: 4.2.4 uuid: 8.3.2 - ws: 7.4.5 + ws: 7.4.4 dev: false name: '@rush-temp/event-processor-host' resolution: @@ -9584,7 +9589,7 @@ packages: dev: false name: '@rush-temp/eventgrid' resolution: - integrity: sha512-TrRicEN8OEh7DFa/GvPh/oxfL821p9Yb/WQM79S5WjPuJwXCyWYemMDTqn17up550TkO98CxvBQBpzVNNFXdNA== + integrity: sha512-uPwpxSWuymminStHgz0LNgqfYlykhomLYp0UyhHB85Kg2tCibv0WGFjgSkZGZ96dOJvW8p/Gp9HsH3LVsep+RA== tarball: file:projects/eventgrid.tgz version: 0.0.0 file:projects/eventhubs-checkpointstore-blob.tgz: @@ -9726,6 +9731,58 @@ packages: integrity: sha512-DuneImF4EvaxNJN8S5CocoKuUHCNqt/tuTYb+IHa6t1Sr+PaFyL2m1mQN1xD2WlDpgK5nf3arEXcdGPR0xVEeQ== tarball: file:projects/iot-device-update.tgz version: 0.0.0 + file:projects/iot-modelsrepository.tgz: + dependencies: + '@azure/core-rest-pipeline': 1.0.3 + '@azure/core-tracing': 1.0.0-preview.11 + '@microsoft/api-extractor': 7.7.11 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-replace': 2.4.2_rollup@1.32.1 + '@types/chai': 4.2.18 + '@types/mocha': 7.0.2 + '@types/node': 8.10.66 + '@types/sinon': 9.0.11 + chai: 4.3.4 + cross-env: 7.0.3 + eslint: 7.26.0 + events: 3.3.0 + inherits: 2.0.4 + karma: 6.3.2 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.3 + karma-edge-launcher: 0.4.2_karma@6.3.2 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@6.3.2 + karma-json-preprocessor: 0.3.3_karma@6.3.2 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@6.3.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.3.2 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 1.19.1 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup-plugin-terser: 5.3.1_rollup@1.32.1 + rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 + sinon: 9.2.4 + ts-node: 9.1.1_typescript@4.2.4 + tslib: 2.2.0 + typedoc: 0.15.2 + typescript: 4.2.4 + util: 0.12.3 + dev: false + name: '@rush-temp/iot-modelsrepository' + resolution: + integrity: sha512-zfDbETZZ9e9rmZgLSHNBmToZ+6TwgKL+6LehqplCIT55R03tcce9p1L0vvkvtdZCKlQaTWp8RmXak9xzOd7QFg== + tarball: file:projects/iot-modelsrepository.tgz + version: 0.0.0 file:projects/keyvault-admin.tgz: dependencies: '@azure/core-tracing': 1.0.0-preview.11 @@ -10163,7 +10220,7 @@ packages: dev: false name: '@rush-temp/perf-core-rest-pipeline' resolution: - integrity: sha512-zhk0kCQ0xrV5TUeFa+4yKFMQCIAZyy5P0nSlfEDhL7xMsJSFTptYrw+bf1XCpujcSBV2T++I8qYip5qtMZdE3A== + integrity: sha512-KGbqhqsPgPr22oqNu65R+L8VwqyHcc2busi/fV3YZcxr8/RZnTNQDFaFycuwjgauipLSIYzBT0cRDLTgHQlNFw== tarball: file:projects/perf-core-rest-pipeline.tgz version: 0.0.0 file:projects/perf-eventgrid.tgz: @@ -10698,7 +10755,7 @@ packages: tslib: 2.2.0 typedoc: 0.15.2 typescript: 4.2.4 - ws: 7.4.5 + ws: 7.4.4 dev: false name: '@rush-temp/service-bus' resolution: @@ -11332,16 +11389,16 @@ packages: '@azure/core-tracing': 1.0.0-preview.11 '@microsoft/api-extractor': 7.7.11 '@opentelemetry/api': 1.0.0-rc.0 - '@types/chai': 4.2.16 - '@types/chai-as-promised': 7.1.3 + '@types/chai': 4.2.18 + '@types/chai-as-promised': 7.1.4 '@types/mocha': 7.0.2 '@types/node': 8.10.66 azure-iothub: 1.13.1 chai: 4.3.4 chai-as-promised: 7.1.1_chai@4.3.4 cross-env: 7.0.3 - dotenv: 8.2.0 - eslint: 7.23.0 + dotenv: 8.6.0 + eslint: 7.26.0 events: 3.3.0 inherits: 2.0.4 karma: 6.3.2 @@ -11491,6 +11548,7 @@ packages: integrity: sha512-7DeCXxoad4VAGDhNwiYkzn7cUqIkaxlapdj5YnYiE2yVb059BjmVJ5+7Yy3SK5a9fT/rhXiidEuz7GpFF/J67w== tarball: file:projects/web-pubsub.tgz version: 0.0.0 +registry: '' specifiers: '@rush-temp/abort-controller': file:./projects/abort-controller.tgz '@rush-temp/ai-anomaly-detector': file:./projects/ai-anomaly-detector.tgz @@ -11531,6 +11589,7 @@ specifiers: '@rush-temp/eventhubs-checkpointstore-blob': file:./projects/eventhubs-checkpointstore-blob.tgz '@rush-temp/identity': file:./projects/identity.tgz '@rush-temp/iot-device-update': file:./projects/iot-device-update.tgz + '@rush-temp/iot-modelsrepository': file:./projects/iot-modelsrepository.tgz '@rush-temp/keyvault-admin': file:./projects/keyvault-admin.tgz '@rush-temp/keyvault-certificates': file:./projects/keyvault-certificates.tgz '@rush-temp/keyvault-common': file:./projects/keyvault-common.tgz From 3479f5f0b0693b0723c890aa8c95af8417960365 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 18:42:13 -0700 Subject: [PATCH 74/81] fix stuff --- sdk/iot/modelsrepository/src/dtmiResolver.ts | 2 +- sdk/iot/modelsrepository/src/fetcherAbstract.ts | 2 +- sdk/iot/modelsrepository/src/fetcherFilesystem.ts | 2 +- sdk/iot/modelsrepository/src/{DTDL.ts => psuedoDtdl.ts} | 0 sdk/iot/modelsrepository/src/psuedoParser.ts | 8 ++++---- 5 files changed, 7 insertions(+), 7 deletions(-) rename sdk/iot/modelsrepository/src/{DTDL.ts => psuedoDtdl.ts} (100%) diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index d2d48864a90f..97611116f7ea 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { OperationOptions } from "@azure/core-client"; -import { DTDL } from "./dtdl"; +import { DTDL } from "./psuedoDtdl"; import { convertDtmiToPath } from "./dtmiConventions"; import { ModelError } from "./exceptions"; import { Fetcher } from "./fetcherAbstract"; diff --git a/sdk/iot/modelsrepository/src/fetcherAbstract.ts b/sdk/iot/modelsrepository/src/fetcherAbstract.ts index f2f74641b99e..e2dc794074bb 100644 --- a/sdk/iot/modelsrepository/src/fetcherAbstract.ts +++ b/sdk/iot/modelsrepository/src/fetcherAbstract.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { OperationOptions } from "@azure/core-client"; -import { DTDL } from "./dtdl"; +import { DTDL } from "./psuedoDtdl"; /** * @internal diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index 64619bede91d..c932a4e69a8a 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -6,7 +6,7 @@ import * as path from "path"; import { RestError, RestErrorOptions } from "@azure/core-rest-pipeline"; import { Fetcher } from "./fetcherAbstract"; import { logger } from "./logger"; -import { DTDL } from "./dtdl"; +import { DTDL } from "./psuedoDtdl"; function readFilePromise(path: string): Promise { return new Promise((res, rej) => { diff --git a/sdk/iot/modelsrepository/src/DTDL.ts b/sdk/iot/modelsrepository/src/psuedoDtdl.ts similarity index 100% rename from sdk/iot/modelsrepository/src/DTDL.ts rename to sdk/iot/modelsrepository/src/psuedoDtdl.ts diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index b446c29b552d..3fc7d971145f 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -import { DTDL } from "./dtdl"; +import { DTDL } from "./psuedoDtdl"; import { logger } from "./logger"; import { DtmiResolver } from "./dtmiResolver"; import { RestError } from "@azure/core-rest-pipeline"; @@ -17,7 +17,7 @@ export class PseudoParser { } async expand(models: DTDL[], tryFromExpanded: boolean) { - let expandedMap: any = {}; + let expandedMap: { [dtmi: string]: DTDL } = {}; for (let i = 0; i < models.length; i++) { const model: DTDL = models[i]; if (model["@id"] !== undefined) { @@ -30,7 +30,7 @@ export class PseudoParser { return expandedMap; } - private async _expand(model: DTDL, modelMap: any, tryFromExpanded: boolean): Promise { + private async _expand(model: DTDL, modelMap: { [dtmi: string]: DTDL }, tryFromExpanded: boolean): Promise { logger.info(`Expanding model: ${model["@id"]}`); let dependencies = this._getModelDependencies(model); let dependenciesToResolve = dependencies.filter((dependency: string) => { @@ -52,7 +52,7 @@ export class PseudoParser { } } Object.keys(resolvedDependenciesMap).forEach((key) => { - modelMap[key] = resolvedDependenciesMap[key]; + modelMap[key] = resolvedDependenciesMap[key] as DTDL; }); const promiseList: Promise[] = []; Object.values(resolvedDependenciesMap).forEach((dependencyModel) => { From 7558cd8c95749b5c91a764e33fd72a5fad3f06cc Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Thu, 20 May 2021 18:42:49 -0700 Subject: [PATCH 75/81] first --- sdk/iot/modelsrepository/src/modelsRepositoryClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index 8f820492f15f..29a86ee11abf 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -22,7 +22,7 @@ import { logger } from "./logger"; import { IoTModelsRepositoryServiceClient } from "./modelsRepositoryServiceClient"; import { HttpFetcher } from "./fetcherHTTP"; import { GetModelsOptions } from "./interfaces/getModelsOptions"; -import { DTDL } from "./dtdl"; +import { DTDL } from "./psuedoDtdl"; /** * Initializes a new instance of the IoT Models Repository Client. From 626fccdb8ad39dedcdd5f8aec94f6e6a8d13d0fe Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Fri, 21 May 2021 10:30:20 -0700 Subject: [PATCH 76/81] remove gitignore changes --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1303b9d49d94..15a62ca450a4 100644 --- a/.gitignore +++ b/.gitignore @@ -88,7 +88,6 @@ examples/bin .vs TestResults/* .vscode/* -**/.vscode/* ./**/.vscode/* @@ -154,4 +153,4 @@ tsdoc-metadata.json swagger/*.json #autorest artifacts -code-model-* \ No newline at end of file +code-model-* From 96505bee03572b3c9e35e449e1baba82d7be71a8 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Fri, 21 May 2021 10:47:17 -0700 Subject: [PATCH 77/81] remove dom --- sdk/iot/modelsrepository/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/iot/modelsrepository/tsconfig.json b/sdk/iot/modelsrepository/tsconfig.json index 4d42c181c40b..1483294dd54b 100644 --- a/sdk/iot/modelsrepository/tsconfig.json +++ b/sdk/iot/modelsrepository/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "outDir": "./dist-esm", "declarationDir": "./types", - "lib": ["dom"], "paths": { "@azure/iot-modelsrepository": ["./src/index"] } From 471acf57780fbef591d0c7f631512a4a04687f33 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Fri, 21 May 2021 11:03:06 -0700 Subject: [PATCH 78/81] add documentation --- sdk/iot/modelsrepository/src/dtmiResolver.ts | 7 ++++++- sdk/iot/modelsrepository/src/fetcherAbstract.ts | 2 ++ sdk/iot/modelsrepository/src/fetcherFilesystem.ts | 3 +++ sdk/iot/modelsrepository/src/fetcherHTTP.ts | 3 +++ .../modelsrepository/src/modelsRepositoryServiceClient.ts | 4 +++- sdk/iot/modelsrepository/src/psuedoParser.ts | 8 ++++++++ 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/sdk/iot/modelsrepository/src/dtmiResolver.ts b/sdk/iot/modelsrepository/src/dtmiResolver.ts index 97611116f7ea..ba3920c3d137 100644 --- a/sdk/iot/modelsrepository/src/dtmiResolver.ts +++ b/sdk/iot/modelsrepository/src/dtmiResolver.ts @@ -9,7 +9,12 @@ import { Fetcher } from "./fetcherAbstract"; import { logger } from "./logger"; /** - * DtmiResolver handles reformatting the DTMIs to paths and passing options down to the configured fetcher. + * DtmiResolver handles reformatting the DTMIs to paths and passing options + * down to the configured fetcher. It is almost like a middle man between the + * user-facing API and the PsuedoParser (which identifies if there are sub-dependencies + * to resolve), and the configured fetcher, which will go out to the endpoint, + * either in the filesystem or through a URI, and actually get the model we want. + * * @internal */ export class DtmiResolver { diff --git a/sdk/iot/modelsrepository/src/fetcherAbstract.ts b/sdk/iot/modelsrepository/src/fetcherAbstract.ts index e2dc794074bb..b0bccf40e210 100644 --- a/sdk/iot/modelsrepository/src/fetcherAbstract.ts +++ b/sdk/iot/modelsrepository/src/fetcherAbstract.ts @@ -5,6 +5,8 @@ import { OperationOptions } from "@azure/core-client"; import { DTDL } from "./psuedoDtdl"; /** + * Base Interface for Fetchers, which fetch models from endpoints. + * * @internal */ export interface Fetcher { diff --git a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts index c932a4e69a8a..e72e5e55f12f 100644 --- a/sdk/iot/modelsrepository/src/fetcherFilesystem.ts +++ b/sdk/iot/modelsrepository/src/fetcherFilesystem.ts @@ -18,6 +18,9 @@ function readFilePromise(path: string): Promise { } /** + * The Filesystem Fetcher implements the generic Fetcher interface + * so that models are fetched from a filesystem endpoint. + * * @internal */ export class FilesystemFetcher implements Fetcher { diff --git a/sdk/iot/modelsrepository/src/fetcherHTTP.ts b/sdk/iot/modelsrepository/src/fetcherHTTP.ts index a4c66cd0ce2f..19f324d589c1 100644 --- a/sdk/iot/modelsrepository/src/fetcherHTTP.ts +++ b/sdk/iot/modelsrepository/src/fetcherHTTP.ts @@ -15,6 +15,9 @@ import { logger } from "./logger"; import { Fetcher } from "./fetcherAbstract"; /** + * The HTTP Fetcher implements the Fetcher interface to + * retrieve models through HTTP calls. + * * @internal */ export class HttpFetcher implements Fetcher { diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts index fe0c57430fc8..7b374e673f92 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryServiceClient.ts @@ -5,7 +5,9 @@ import { ServiceClientOptions, ServiceClient } from "@azure/core-client"; import { DEFAULT_API_VERSION } from "./constants"; interface IoTModelsRepositoryServiceClientOptions extends ServiceClientOptions { + // API Version to be used during HTTP Calls. version?: string; + // Endpoint that will be base of URLs for HTTP calls. endpoint?: string; } @@ -17,7 +19,7 @@ export class IoTModelsRepositoryServiceClient extends ServiceClient { version: string; /** - * Initializes a new instance of the GeneratedClient class. + * Initializes a new instance of the IoTModelsRepositoryServiceClient class. * @param url The URL of the service account or table that is the target of the desired operation. * @param options The parameter options */ diff --git a/sdk/iot/modelsrepository/src/psuedoParser.ts b/sdk/iot/modelsrepository/src/psuedoParser.ts index 3fc7d971145f..8cd32c691906 100644 --- a/sdk/iot/modelsrepository/src/psuedoParser.ts +++ b/sdk/iot/modelsrepository/src/psuedoParser.ts @@ -7,6 +7,14 @@ import { DtmiResolver } from "./dtmiResolver"; import { RestError } from "@azure/core-rest-pipeline"; /** + * The PsuedoParser is an interesting implementation. Essentially, this + * codebase works in tandem with a Digital Twins Parser, which simultaneously + * defines the DTDL structure and validates models match the correct DTDL format. + * In lieu of using that Parser as a dependency (for a complex network of reasons), + * we implement this class, which kind of parses. Because it uses the resovler too, + * we can, during psuedo-parsing, identify any times we should resolve a dependency, + * and then resolve the dependencies until the dependency tree is fully resolved. + * * @internal */ export class PseudoParser { From 897c8994c2d40a4da3b7f229cb2ca50d9ec4b736 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Fri, 21 May 2021 11:32:28 -0700 Subject: [PATCH 79/81] change constants --- sdk/iot/modelsrepository/package.json | 1 + sdk/iot/modelsrepository/src/constants.ts | 17 ++--------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/sdk/iot/modelsrepository/package.json b/sdk/iot/modelsrepository/package.json index ad241b2f3c9d..b1d3d0e6d10d 100644 --- a/sdk/iot/modelsrepository/package.json +++ b/sdk/iot/modelsrepository/package.json @@ -65,6 +65,7 @@ "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", "dependencies": { "@azure/core-client": "^1.0.0", + "@azure/core-util": "^1.0.0-beta.1", "@azure/core-rest-pipeline": "^1.0.3", "@azure/core-tracing": "1.0.0-preview.11", "@azure/logger": "^1.0.0", diff --git a/sdk/iot/modelsrepository/src/constants.ts b/sdk/iot/modelsrepository/src/constants.ts index e01279d83aec..f70837abf8b7 100644 --- a/sdk/iot/modelsrepository/src/constants.ts +++ b/sdk/iot/modelsrepository/src/constants.ts @@ -1,22 +1,9 @@ // Copyright (c) Microsoft. // Licensed under the MIT license. -const isBrowser = () => { - try { - return this === self; - } catch (e) { - return false; - } -}; -const isNode = () => { - try { - return this === global; - } catch (e) { - return false; - } -}; +import {isNode} from "@azure/core-util"; -const currentPlatform = isBrowser() ? "browser" : isNode() ? "node" : "undefined"; +const currentPlatform = isNode ? "node" : "browser"; export const SDK_VERSION = "1.0.0-beta.1"; export const DEFAULT_USER_AGENT = `azsdk-node-modelsrepository/${SDK_VERSION} (${currentPlatform})`; From 20a7b3c0814ab0735ac74bfb9e8a28d659b9e02b Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Fri, 21 May 2021 11:40:07 -0700 Subject: [PATCH 80/81] add dom --- sdk/iot/modelsrepository/src/dom.d.ts | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 sdk/iot/modelsrepository/src/dom.d.ts diff --git a/sdk/iot/modelsrepository/src/dom.d.ts b/sdk/iot/modelsrepository/src/dom.d.ts new file mode 100644 index 000000000000..88bcf1442b2f --- /dev/null +++ b/sdk/iot/modelsrepository/src/dom.d.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/// From a80e4a1dbc803da4e7309a43fb501bf6d9a6df2c Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Fri, 21 May 2021 11:44:13 -0700 Subject: [PATCH 81/81] add comments for dom --- sdk/iot/modelsrepository/src/dom.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk/iot/modelsrepository/src/dom.d.ts b/sdk/iot/modelsrepository/src/dom.d.ts index 88bcf1442b2f..e95d8823722e 100644 --- a/sdk/iot/modelsrepository/src/dom.d.ts +++ b/sdk/iot/modelsrepository/src/dom.d.ts @@ -1,4 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +// This file avoids adding dom to the tsconfig. +// We still need to reference the dom for ts compiliation, since +// in the browser url shim it references the URL dom. ///