Merge TFS repo code to github repo

This commit is contained in:
dilin-MS 2019-08-07 17:19:45 +08:00
Родитель 8a9facedbc 3efa93541f
Коммит e7fa9ed77e
19 изменённых файлов: 503 добавлений и 455 удалений

77
CHANGELOG-PNP.md Normal file
Просмотреть файл

@ -0,0 +1,77 @@
**## Version 0.10.10-rc**
\- Release date: August 1, 2019
**### Fixed**
\- Support the new model repository connection string.
\- Fix the command request payload format issue that aligned with IoT platform and Central.
\- Change the codegen flow: throw error if the company repository hasn't be set and interface can't be found in local folder and public repository, user need run ***\*IoT Plug and Play: Open Model Repository\**** command to connect to company repository then re-run the code generation command.
\- Fix the search function in Model Repository UI.
\- Change the naming 'Organization Reposition' to 'Company Repository'.
\- Invalid model repository connection string will not be saved.
\- The 'contents' property in Interface support both array and single value.
\- Fix the async command response payload issue of missing quotation marks on string value.
\- Add the input Interface / DCM name into the generated .json schema file.
\- Print out the name of unsupported complex object in the VS Code output window.
\- Ignore ***\*DigitalTwin\****, ***\*ModelInformation\**** and ***\*SDKInformation\**** these 3 default interfaces when generating device code.
\- Fix wording and typos.
**### Added**
\- Save the model repository connection string in VS Code security store instead of global settings.
\- Auto-fill in the DCM id in the generated DPS code.
\- Add the default ModelDefinition Interface into the generated .json schema file.
\- Replace the 'Interface.json' and 'CapabilityModel.json' with 'IoTModel.json' for '@context' property in the generated .json schema file.
**## Version 0.10.9**
\- Release date: July 25, 2019
**### Fixed**
\- User can submit interface/capabilityModel with a generic json file name (ending with **.json**).
***\*NOTE\****: We don't force interface/capabilityModel file name suffix to be **interface.json** / **capabilityModel.json** in submit operation, but the DTDL IntelliSense will not work if the model file nane is not ended with **interface.json** / **capabilityModel.json**.
\- Fix issues that IntelliSense doesn't work for Enum/Unit/Schemas authoring.
\- Fix naming conflict issue for InterfaceInstance in capabilityModel/implements.
**### Added**
\- Support generating PnP device code from DCM which is exported from IoT Central.
\- Support generating PnP device code for datetime/date/time/duration schema.
\- Adjust commamd payload processing to align with cloud side contract.
\- Codegen doesn't overwrite user source file (e.g. main.c, device_impl.c) when re-generate PnP device Code.
\- Refresh language server to support language features in [latest DTDL](http://aka.ms/dtdl):
\- Support unified context file (IoTModel.json) to align with IoT Central Model definition.
\- Support IntelliSense for localizable properties (e.g. comment, displayName, description).
**## Version 0.10.8**
\- Release date: July 18, 2019
**### Fixed**
\- Improved the experience for generating code from Plug & Play model files.

Просмотреть файл

@ -2,36 +2,13 @@
All notable changes to the "vscode-iot-workbench" extension will be documented in this file.
## Version 0.10.9
## Version 0.10.10
- Release date: July 25, 2019
### Fixed
- User can submit interface/capabilityModel with a generic json file name (ending with *.json*).
**NOTE**: We don't force interface/capabilityModel file name suffix to be *interface.json* / *capabilityModel.json* in submit operation, but the DTDL IntelliSense will not work if the model file nane is not ended with *interface.json* / *capabilityModel.json*.
- Fix issues that IntelliSense doesn't work for Enum/Unit/Schemas authoring.
- Fix naming conflict issue for InterfaceInstance in capabilityModel/implements.
- Release date: August 4, 2019
### Added
- Support generating PnP device code from DCM which is exported from IoT Central.
- Support generating PnP device code for datetime/date/time/duration schema.
- Adjust commamd payload processing to align with cloud side contract.
- Codegen doesn't overwrite user source file (e.g. main.c, device_impl.c) when re-generate PnP device Code.
- Refresh language server to support language features in [latest DTDL](http://aka.ms/dtdl):
- Support unified context file (IoTModel.json) to align with IoT Central Model definition.
- Support IntelliSense for localizable properties (e.g. comment, displayName, description).
## Version 0.10.8
- Release date: July 18, 2019
### Fixed
- Improved the experience for generating code from Plug & Play model files.
Something great is going to be happened, coming soon :)
## Version 0.3.1

402
package-lock.json сгенерированный
Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "vscode-iot-workbench",
"version": "1.0.0-rc",
"version": "0.10.10-rc",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -130,9 +130,9 @@
"dev": true
},
"@types/node": {
"version": "10.14.13",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.13.tgz",
"integrity": "sha512-yN/FNNW1UYsRR1wwAoyOwqvDuLDtVXnaJTZ898XIw/Q5cCaeVAlVwvsmXLX5PuiScBYwZsZU4JYSHB3TvfdwvQ==",
"version": "10.14.14",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.14.tgz",
"integrity": "sha512-xXD08vZsvpv4xptQXj1+ky22f7ZoKu5ZNI/4l+/BXG3X+XaeZsmaFbbTKuhSE3NjjvRuZFxFf9sQBMXIcZNFMQ==",
"dev": true
},
"@types/opn": {
@ -706,9 +706,9 @@
}
},
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
},
"async-listener": {
"version": "0.6.10",
@ -928,9 +928,9 @@
}
},
"base64-js": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
"integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw=="
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
},
"bcrypt-pbkdf": {
"version": "1.0.2",
@ -1198,9 +1198,9 @@
"dev": true
},
"cacache": {
"version": "11.3.3",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-11.3.3.tgz",
"integrity": "sha512-p8WcneCytvzPxhDvYp31PD039vi77I12W+/KfR9S8AZbaiARFBCpsPJS+9uhWfeBfeAtW7o/4vt3MUqLkbY6nA==",
"version": "12.0.2",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.2.tgz",
"integrity": "sha512-ifKgxH2CKhJEg6tNdAwziu6Q33EvuG26tYcda6PT3WKisZcYDXsnEdnRv67Po3yCzFfaSoMjGZzJyD2c3DT1dg==",
"dev": true,
"requires": {
"bluebird": "^3.5.5",
@ -1208,6 +1208,7 @@
"figgy-pudding": "^3.5.1",
"glob": "^7.1.4",
"graceful-fs": "^4.1.15",
"infer-owner": "^1.0.3",
"lru-cache": "^5.1.1",
"mississippi": "^3.0.0",
"mkdirp": "^0.5.1",
@ -1217,23 +1218,6 @@
"ssri": "^6.0.1",
"unique-filename": "^1.1.1",
"y18n": "^4.0.0"
},
"dependencies": {
"lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
"integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
"dev": true,
"requires": {
"yallist": "^3.0.2"
}
},
"yallist": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
"dev": true
}
}
},
"cache-base": {
@ -1678,6 +1662,24 @@
"lru-cache": "^4.0.1",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
},
"dependencies": {
"lru-cache": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
"integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
"dev": true,
"requires": {
"pseudomap": "^1.0.2",
"yallist": "^2.1.2"
}
},
"yallist": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
"dev": true
}
}
},
"crypto-browserify": {
@ -2105,9 +2107,9 @@
"dev": true
},
"esutils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true
},
"eventemitter2": {
@ -2576,8 +2578,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"aproba": {
"version": "1.2.0",
@ -2591,23 +2592,21 @@
"dev": true,
"optional": true,
"requires": {
"delegates": "1.0.0",
"readable-stream": "2.3.6"
"delegates": "^1.0.0",
"readable-stream": "^2.0.6"
}
},
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "1.0.0",
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
@ -2620,20 +2619,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@ -2647,7 +2643,7 @@
"dev": true,
"optional": true,
"requires": {
"ms": "2.1.1"
"ms": "^2.1.1"
}
},
"deep-extend": {
@ -2674,7 +2670,7 @@
"dev": true,
"optional": true,
"requires": {
"minipass": "2.3.5"
"minipass": "^2.2.1"
}
},
"fs.realpath": {
@ -2689,14 +2685,14 @@
"dev": true,
"optional": true,
"requires": {
"aproba": "1.2.0",
"console-control-strings": "1.1.0",
"has-unicode": "2.0.1",
"object-assign": "4.1.1",
"signal-exit": "3.0.2",
"string-width": "1.0.2",
"strip-ansi": "3.0.1",
"wide-align": "1.1.3"
"aproba": "^1.0.3",
"console-control-strings": "^1.0.0",
"has-unicode": "^2.0.0",
"object-assign": "^4.1.0",
"signal-exit": "^3.0.0",
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1",
"wide-align": "^1.1.0"
}
},
"glob": {
@ -2705,12 +2701,12 @@
"dev": true,
"optional": true,
"requires": {
"fs.realpath": "1.0.0",
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"has-unicode": {
@ -2725,7 +2721,7 @@
"dev": true,
"optional": true,
"requires": {
"safer-buffer": "2.1.2"
"safer-buffer": ">= 2.1.2 < 3"
}
},
"ignore-walk": {
@ -2734,7 +2730,7 @@
"dev": true,
"optional": true,
"requires": {
"minimatch": "3.0.4"
"minimatch": "^3.0.4"
}
},
"inflight": {
@ -2743,15 +2739,14 @@
"dev": true,
"optional": true,
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@ -2763,9 +2758,8 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "1.0.1"
"number-is-nan": "^1.0.0"
}
},
"isarray": {
@ -2778,25 +2772,22 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "1.1.11"
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "5.1.2",
"yallist": "3.0.3"
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
}
},
"minizlib": {
@ -2805,14 +2796,13 @@
"dev": true,
"optional": true,
"requires": {
"minipass": "2.3.5"
"minipass": "^2.2.1"
}
},
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -2829,9 +2819,9 @@
"dev": true,
"optional": true,
"requires": {
"debug": "4.1.1",
"iconv-lite": "0.4.24",
"sax": "1.2.4"
"debug": "^4.1.0",
"iconv-lite": "^0.4.4",
"sax": "^1.2.4"
}
},
"node-pre-gyp": {
@ -2840,16 +2830,16 @@
"dev": true,
"optional": true,
"requires": {
"detect-libc": "1.0.3",
"mkdirp": "0.5.1",
"needle": "2.3.0",
"nopt": "4.0.1",
"npm-packlist": "1.4.1",
"npmlog": "4.1.2",
"rc": "1.2.8",
"rimraf": "2.6.3",
"semver": "5.7.0",
"tar": "4.4.8"
"detect-libc": "^1.0.2",
"mkdirp": "^0.5.1",
"needle": "^2.2.1",
"nopt": "^4.0.1",
"npm-packlist": "^1.1.6",
"npmlog": "^4.0.2",
"rc": "^1.2.7",
"rimraf": "^2.6.1",
"semver": "^5.3.0",
"tar": "^4"
}
},
"nopt": {
@ -2858,8 +2848,8 @@
"dev": true,
"optional": true,
"requires": {
"abbrev": "1.1.1",
"osenv": "0.1.5"
"abbrev": "1",
"osenv": "^0.1.4"
}
},
"npm-bundled": {
@ -2874,8 +2864,8 @@
"dev": true,
"optional": true,
"requires": {
"ignore-walk": "3.0.1",
"npm-bundled": "1.0.6"
"ignore-walk": "^3.0.1",
"npm-bundled": "^1.0.1"
}
},
"npmlog": {
@ -2884,17 +2874,16 @@
"dev": true,
"optional": true,
"requires": {
"are-we-there-yet": "1.1.5",
"console-control-strings": "1.1.0",
"gauge": "2.7.4",
"set-blocking": "2.0.0"
"are-we-there-yet": "~1.1.2",
"console-control-strings": "~1.1.0",
"gauge": "~2.7.3",
"set-blocking": "~2.0.0"
}
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@ -2906,9 +2895,8 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1.0.2"
"wrappy": "1"
}
},
"os-homedir": {
@ -2929,8 +2917,8 @@
"dev": true,
"optional": true,
"requires": {
"os-homedir": "1.0.2",
"os-tmpdir": "1.0.2"
"os-homedir": "^1.0.0",
"os-tmpdir": "^1.0.0"
}
},
"path-is-absolute": {
@ -2951,10 +2939,10 @@
"dev": true,
"optional": true,
"requires": {
"deep-extend": "0.6.0",
"ini": "1.3.5",
"minimist": "1.2.0",
"strip-json-comments": "2.0.1"
"deep-extend": "^0.6.0",
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
},
"dependencies": {
"minimist": {
@ -2971,13 +2959,13 @@
"dev": true,
"optional": true,
"requires": {
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "1.0.0",
"process-nextick-args": "2.0.0",
"safe-buffer": "5.1.2",
"string_decoder": "1.1.1",
"util-deprecate": "1.0.2"
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"rimraf": {
@ -2986,14 +2974,13 @@
"dev": true,
"optional": true,
"requires": {
"glob": "7.1.3"
"glob": "^7.1.3"
}
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
@ -3029,11 +3016,10 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
"strip-ansi": "^3.0.0"
}
},
"string_decoder": {
@ -3042,16 +3028,15 @@
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "5.1.2"
"safe-buffer": "~5.1.0"
}
},
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "2.1.1"
"ansi-regex": "^2.0.0"
}
},
"strip-json-comments": {
@ -3066,13 +3051,13 @@
"dev": true,
"optional": true,
"requires": {
"chownr": "1.1.1",
"fs-minipass": "1.2.5",
"minipass": "2.3.5",
"minizlib": "1.2.1",
"mkdirp": "0.5.1",
"safe-buffer": "5.1.2",
"yallist": "3.0.3"
"chownr": "^1.1.1",
"fs-minipass": "^1.2.5",
"minipass": "^2.3.4",
"minizlib": "^1.1.1",
"mkdirp": "^0.5.0",
"safe-buffer": "^5.1.2",
"yallist": "^3.0.2"
}
},
"util-deprecate": {
@ -3087,20 +3072,18 @@
"dev": true,
"optional": true,
"requires": {
"string-width": "1.0.2"
"string-width": "^1.0.2 || 2"
}
},
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
}
}
},
@ -3275,9 +3258,9 @@
}
},
"graceful-fs": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz",
"integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==",
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.1.tgz",
"integrity": "sha512-b9usnbDGnD928gJB3LrCmxoibr3VE4U2SMo5PBuBnokWyDADTqDPXg4YpwKF1trpH+UbGp7QLicO3+aWEy0+mw==",
"dev": true
},
"growl": {
@ -3412,10 +3395,13 @@
}
},
"hosted-git-info": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz",
"integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==",
"dev": true
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.2.tgz",
"integrity": "sha512-CyjlXII6LMsPMyUzxpTt8fzh5QwzGqPmQXgY/Jyf4Zfp27t/FvfhwoE/8laaMUcMy816CkWF20I7NeQhwwY88w==",
"dev": true,
"requires": {
"lru-cache": "^5.1.1"
}
},
"http-proxy-agent": {
"version": "2.1.0",
@ -3533,6 +3519,12 @@
"integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=",
"dev": true
},
"infer-owner": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz",
"integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==",
"dev": true
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@ -3953,9 +3945,9 @@
}
},
"keytar": {
"version": "4.12.0",
"resolved": "https://registry.npmjs.org/keytar/-/keytar-4.12.0.tgz",
"integrity": "sha512-V+MY1cD/QheiAY+FZcnEzp1f6vVjOZAZ5kqosZYfe5upROlmY0iDXtTMsLrYiGo1CD8KMujoivai7eB+pK2wew==",
"version": "4.13.0",
"resolved": "https://registry.npmjs.org/keytar/-/keytar-4.13.0.tgz",
"integrity": "sha512-qdyZ3XDuv11ANDXJ+shsmc+j/h5BHPDSn33MwkUMDg2EA++xEBleNkghr3Jg95cqVx5WgDYD8V/m3Q0y7kwQ2w==",
"requires": {
"nan": "2.14.0",
"prebuild-install": "5.3.0"
@ -4071,13 +4063,12 @@
"dev": true
},
"lru-cache": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
"integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
"integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
"dev": true,
"requires": {
"pseudomap": "^1.0.2",
"yallist": "^2.1.2"
"yallist": "^3.0.2"
}
},
"machina": {
@ -4512,9 +4503,9 @@
"dev": true
},
"node-abi": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.9.0.tgz",
"integrity": "sha512-jmEOvv0eanWjhX8dX1pmjb7oJl1U1oR4FOh0b2GnvALwSYoOdU7sj+kLDSAyjo4pfC9aj/IxkloxdLJQhSSQBA==",
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.10.0.tgz",
"integrity": "sha512-OT0WepUvYHXdki6DU8LWhEkuo3M44i2paWBYtH9qXtPb9YiKlYEKa5WUII20XEcOv7UJPzfB0kZfPZdW46zdkw==",
"requires": {
"semver": "^5.4.1"
}
@ -5090,9 +5081,9 @@
"dev": true
},
"psl": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.2.0.tgz",
"integrity": "sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA=="
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.3.0.tgz",
"integrity": "sha512-avHdspHO+9rQTLbv1RO+MPYeP/SzsCoxofjVnHanETfQhTJrmB0HlDoW+EiN/R+C0BZ+gERab9NY0lPN2TxNag=="
},
"public-encrypt": {
"version": "4.0.3",
@ -5374,9 +5365,9 @@
"dev": true
},
"resolve": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz",
"integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==",
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
"integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
@ -5799,9 +5790,9 @@
}
},
"source-map-support": {
"version": "0.5.12",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz",
"integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==",
"version": "0.5.13",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz",
"integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
@ -6102,9 +6093,9 @@
}
},
"terser": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.1.2.tgz",
"integrity": "sha512-jvNoEQSPXJdssFwqPSgWjsOrb+ELoE+ILpHPKXC83tIxOlh2U75F1KuB2luLD/3a6/7K3Vw5pDn+hvu0C4AzSw==",
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.1.3.tgz",
"integrity": "sha512-on13d+cnpn5bMouZu+J8tPYQecsdRJCJuxFJ+FVoPBoLJgk5bCBkp+Uen2hWyi0KIUm6eDarnlAlH+KgIx/PuQ==",
"dev": true,
"requires": {
"commander": "^2.20.0",
@ -6113,20 +6104,19 @@
}
},
"terser-webpack-plugin": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.3.0.tgz",
"integrity": "sha512-W2YWmxPjjkUcOWa4pBEv4OP4er1aeQJlSo2UhtCFQCuRXEHjOFscO8VyWHj9JLlA0RzQb8Y2/Ta78XZvT54uGg==",
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz",
"integrity": "sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg==",
"dev": true,
"requires": {
"cacache": "^11.3.2",
"find-cache-dir": "^2.0.0",
"cacache": "^12.0.2",
"find-cache-dir": "^2.1.0",
"is-wsl": "^1.1.0",
"loader-utils": "^1.2.3",
"schema-utils": "^1.0.0",
"serialize-javascript": "^1.7.0",
"source-map": "^0.6.1",
"terser": "^4.0.0",
"webpack-sources": "^1.3.0",
"terser": "^4.1.2",
"webpack-sources": "^1.4.0",
"worker-farm": "^1.7.0"
}
},
@ -6562,9 +6552,9 @@
"dev": true
},
"vscode": {
"version": "1.1.35",
"resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.35.tgz",
"integrity": "sha512-xPnxzQU40LOS2yPyzWW+WKpTV6qA3z16TcgpZ9O38UWLA157Zz4GxUx5H7Gd07pxzw0GqvusbF4D+5GBgNxvEQ==",
"version": "1.1.36",
"resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.36.tgz",
"integrity": "sha512-cGFh9jmGLcTapCpPCKvn8aG/j9zVQ+0x5hzYJq5h5YyUXVGa1iamOaB2M2PZXoumQPES4qeAP1FwkI0b6tL4bQ==",
"dev": true,
"requires": {
"glob": "^7.1.2",
@ -6616,34 +6606,34 @@
}
},
"webpack": {
"version": "4.38.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.38.0.tgz",
"integrity": "sha512-lbuFsVOq8PZY+1Ytz/mYOvYOo+d4IJ31hHk/7iyoeWtwN33V+5HYotSH+UIb9tq914ey0Hot7z6HugD+je3sWw==",
"version": "4.39.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.39.1.tgz",
"integrity": "sha512-/LAb2TJ2z+eVwisldp3dqTEoNhzp/TLCZlmZm3GGGAlnfIWDgOEE758j/9atklNLfRyhKbZTCOIoPqLJXeBLbQ==",
"dev": true,
"requires": {
"@webassemblyjs/ast": "1.8.5",
"@webassemblyjs/helper-module-context": "1.8.5",
"@webassemblyjs/wasm-edit": "1.8.5",
"@webassemblyjs/wasm-parser": "1.8.5",
"acorn": "^6.2.0",
"ajv": "^6.1.0",
"ajv-keywords": "^3.1.0",
"chrome-trace-event": "^1.0.0",
"acorn": "^6.2.1",
"ajv": "^6.10.2",
"ajv-keywords": "^3.4.1",
"chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^4.1.0",
"eslint-scope": "^4.0.0",
"eslint-scope": "^4.0.3",
"json-parse-better-errors": "^1.0.2",
"loader-runner": "^2.3.0",
"loader-utils": "^1.1.0",
"memory-fs": "~0.4.1",
"micromatch": "^3.1.8",
"mkdirp": "~0.5.0",
"neo-async": "^2.5.0",
"node-libs-browser": "^2.0.0",
"loader-runner": "^2.4.0",
"loader-utils": "^1.2.3",
"memory-fs": "^0.4.1",
"micromatch": "^3.1.10",
"mkdirp": "^0.5.1",
"neo-async": "^2.6.1",
"node-libs-browser": "^2.2.1",
"schema-utils": "^1.0.0",
"tapable": "^1.1.0",
"terser-webpack-plugin": "^1.1.0",
"watchpack": "^1.5.0",
"webpack-sources": "^1.3.0"
"tapable": "^1.1.3",
"terser-webpack-plugin": "^1.4.1",
"watchpack": "^1.6.0",
"webpack-sources": "^1.4.1"
}
},
"webpack-cli": {
@ -6690,9 +6680,9 @@
}
},
"webpack-sources": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz",
"integrity": "sha512-OiVgSrbGu7NEnEvQJJgdSFPl2qWKkWq5lHMhgiToIiN9w34EBnjYzSYs+VbL5KoYiLNtFFa7BZIKxRED3I32pA==",
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz",
"integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==",
"dev": true,
"requires": {
"source-list-map": "^2.0.0",
@ -6880,9 +6870,9 @@
"dev": true
},
"yallist": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
"dev": true
},
"yargs": {

Просмотреть файл

@ -191,9 +191,9 @@
"IoTWorkbench.IoTPnPCodeGenVersion": {
"type": "string"
},
"IoTWorkbench.IoTPnPRepositoryUrl": {
"IoTWorkbench.IoTPnPPublicRepositoryUrl": {
"type": "string",
"default": "https://canary-repo.azureiotrepository.com"
"default": "https://repo.azureiotrepository.com"
}
}
}

Просмотреть файл

@ -662,7 +662,7 @@
"Id": "4e0df0ab-27a9-49a4-bc31-2249d9e33927"
},
{
"Id": "urn:azureiot:v1:classes:Units:Humidity:gramsPerVolume:1"
"Id": "Units/Humidity/gramsPerVolume"
},
{
"Value": "g/m3",
@ -675,7 +675,7 @@
"Id": "d9a8e335-c100-455f-866e-e11624fba55d"
},
{
"Id": "urn:azureiot:v1:classes:Units:Humidity:percent:1"
"Id": "Units/Humidity/percent"
},
{
"Value": "%",
@ -688,7 +688,7 @@
"Id": "158f0782-ccd8-4e0d-bcf7-aa4495ab9c82"
},
{
"Id": "urn:azureiot:v1:classes:Units:Pressure:inchesOfMercury:1"
"Id": "Units/Pressure/inchesOfMercury"
},
{
"Value": "inHg",
@ -701,7 +701,7 @@
"Id": "4f5909fc-62c6-4ca0-b685-c4554af3ea93"
},
{
"Id": "urn:azureiot:v1:classes:Units:Pressure:inchesOfWater:1"
"Id": "Units/Pressure/inchesOfWater"
},
{
"Value": "inH₂O",
@ -714,7 +714,7 @@
"Id": "9fcf89b3-e324-47f4-884e-72620a0e71fb"
},
{
"Id": "urn:azureiot:v1:classes:Units:Pressure:kiloPascal:1"
"Id": "Units/Pressure/kiloPascal"
},
{
"Value": "kPa",
@ -727,7 +727,7 @@
"Id": "32978d16-fb4d-4290-837f-782add7cd5dd"
},
{
"Id": "urn:azureiot:v1:classes:Units:Pressure:poundsPerSquareInch:1"
"Id": "Units/Pressure/poundsPerSquareInch"
},
{
"Value": "psi",
@ -740,7 +740,7 @@
"Id": "75f213f6-7028-4220-9290-fb177418d059"
},
{
"Id": "urn:azureiot:v1:classes:Units:Temperature:celsius:1"
"Id": "Units/Temperature/celsius"
},
{
"Value": "°C",
@ -753,7 +753,7 @@
"Id": "4bccda25-0929-4b68-8d34-c475d6ab7625"
},
{
"Id": "urn:azureiot:v1:classes:Units:Temperature:fahrenheit:1"
"Id": "Units/Temperature/fahrenheit"
},
{
"Value": "°F",
@ -3233,7 +3233,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Humidity:gramsPerVolume:1"
"Id": "Units/Humidity/gramsPerVolume"
},
"TargetNode": {
"Id": "http://azureiot.com/v1/classes/Units/Humidity"
@ -3242,7 +3242,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Humidity:gramsPerVolume:1"
"Id": "Units/Humidity/gramsPerVolume"
},
"TargetNode": {
"Value": "g/m3",
@ -3253,7 +3253,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Humidity:gramsPerVolume:1"
"Id": "Units/Humidity/gramsPerVolume"
},
"TargetNode": {
"Value": "Grams per Volume",
@ -3264,7 +3264,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Humidity:percent:1"
"Id": "Units/Humidity/percent"
},
"TargetNode": {
"Id": "http://azureiot.com/v1/classes/Units/Humidity"
@ -3273,7 +3273,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Humidity:percent:1"
"Id": "Units/Humidity/percent"
},
"TargetNode": {
"Value": "%",
@ -3284,7 +3284,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Humidity:percent:1"
"Id": "Units/Humidity/percent"
},
"TargetNode": {
"Value": "Percent",
@ -3295,7 +3295,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:inchesOfMercury:1"
"Id": "Units/Pressure/inchesOfMercury"
},
"TargetNode": {
"Id": "http://azureiot.com/v1/classes/Units/Pressure"
@ -3304,7 +3304,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:inchesOfMercury:1"
"Id": "Units/Pressure/inchesOfMercury"
},
"TargetNode": {
"Value": "inHg",
@ -3315,7 +3315,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:inchesOfMercury:1"
"Id": "Units/Pressure/inchesOfMercury"
},
"TargetNode": {
"Value": "Inches of Mercury",
@ -3326,7 +3326,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:inchesOfWater:1"
"Id": "Units/Pressure/inchesOfWater"
},
"TargetNode": {
"Id": "http://azureiot.com/v1/classes/Units/Pressure"
@ -3335,7 +3335,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:inchesOfWater:1"
"Id": "Units/Pressure/inchesOfWater"
},
"TargetNode": {
"Value": "inH₂O",
@ -3346,7 +3346,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:inchesOfWater:1"
"Id": "Units/Pressure/inchesOfWater"
},
"TargetNode": {
"Value": "Inches of Water",
@ -3357,7 +3357,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:kiloPascal:1"
"Id": "Units/Pressure/kiloPascal"
},
"TargetNode": {
"Id": "http://azureiot.com/v1/classes/Units/Pressure"
@ -3366,7 +3366,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:kiloPascal:1"
"Id": "Units/Pressure/kiloPascal"
},
"TargetNode": {
"Value": "kPa",
@ -3377,7 +3377,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:kiloPascal:1"
"Id": "Units/Pressure/kiloPascal"
},
"TargetNode": {
"Value": "Kilo Pascal",
@ -3388,7 +3388,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:poundsPerSquareInch:1"
"Id": "Units/Pressure/poundsPerSquareInch"
},
"TargetNode": {
"Id": "http://azureiot.com/v1/classes/Units/Pressure"
@ -3397,7 +3397,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:poundsPerSquareInch:1"
"Id": "Units/Pressure/poundsPerSquareInch"
},
"TargetNode": {
"Value": "psi",
@ -3408,7 +3408,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Pressure:poundsPerSquareInch:1"
"Id": "Units/Pressure/poundsPerSquareInch"
},
"TargetNode": {
"Value": "Pounds per Square Inch",
@ -3419,7 +3419,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Temperature:celsius:1"
"Id": "Units/Temperature/celsius"
},
"TargetNode": {
"Id": "http://azureiot.com/v1/classes/Units/Temperature"
@ -3428,7 +3428,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Temperature:celsius:1"
"Id": "Units/Temperature/celsius"
},
"TargetNode": {
"Value": "°C",
@ -3439,7 +3439,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Temperature:celsius:1"
"Id": "Units/Temperature/celsius"
},
"TargetNode": {
"Value": "Celsius",
@ -3450,7 +3450,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Temperature:fahrenheit:1"
"Id": "Units/Temperature/fahrenheit"
},
"TargetNode": {
"Id": "http://azureiot.com/v1/classes/Units/Temperature"
@ -3459,7 +3459,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Temperature:fahrenheit:1"
"Id": "Units/Temperature/fahrenheit"
},
"TargetNode": {
"Value": "°F",
@ -3470,7 +3470,7 @@
},
{
"SourceNode": {
"Id": "urn:azureiot:v1:classes:Units:Temperature:fahrenheit:1"
"Id": "Units/Temperature/fahrenheit"
},
"TargetNode": {
"Value": "Fahrenheit",

Просмотреть файл

@ -4,19 +4,22 @@
"language": "ANSI C",
"type": "CMake",
"name": "CMake Project",
"detail": "Generate ANSI C code as CMake project."
"detail": "Generate ANSI C code as CMake project.",
"enabled" : true
},
{
"language": "ANSI C",
"type": "VisualStudio",
"name": "Visual Studio Project",
"detail": "Generate ANSI C code as Visual Studio (.vcxproj) project."
"detail": "Generate ANSI C code as Visual Studio (.vcxproj) project.",
"enabled" : false
},
{
"language": "ANSI C",
"type": "IoTDevKit",
"name": "MXChip IoT DevKit Project",
"detail": "Generate code for MXChip IoT DevKit as Arduino project."
"detail": "Generate code for MXChip IoT DevKit as Arduino project.",
"enabled" : true
}
]
}

Просмотреть файл

@ -1,12 +1,16 @@
{
"@id": "urn:vscsample:mycapabilitymodel:1",
"@id": "{DigitalTwinIdentifier}",
"@type": "CapabilityModel",
"displayName": "mycapabilitymodel",
"implements": [
{
"schema": "urn:azureiot:DeviceManagement:DeviceInformation:1",
"name": "deviceinfo"
"name": "deviceInfo"
},
{
"schema": "urn:azureiot:ModelDiscovery:ModelDefinition:1",
"name": "modelDefinition"
}
],
"@context": "http://azureiot.com/v1/contexts/CapabilityModel.json"
"@context": "http://azureiot.com/v1/contexts/IoTModel.json"
}

Просмотреть файл

@ -1,5 +1,5 @@
{
"@id": "urn:vscsample:myinterface:1",
"@id": "{DigitalTwinIdentifier}",
"@type": "Interface",
"displayName": "myinterface",
"contents": [
@ -70,5 +70,5 @@
}
}
],
"@context": "http://azureiot.com/v1/contexts/Interface.json"
"@context": "http://azureiot.com/v1/contexts/IoTModel.json"
}

Просмотреть файл

@ -285,7 +285,7 @@ export class CodeGeneratorCore {
continue;
}
// Unknow interface, throw error
throw Error(`Can't find the interface ${schema}.`);
throw new Error(`Can't find the interface ${schema}.`);
} else {
// Only can try public repo
if (await this.DownloadInterfaceFile(
@ -295,7 +295,7 @@ export class CodeGeneratorCore {
}
// Throw error and lead user to set the company model repo
// connection string
throw Error(`Can't find the interface: ${
throw new Error(`Can't find the interface: ${
schema} in local folder, use 'IoT Plug and Play: Open Model Repository' command to connect to the company repository, then try generating the device code again.`);
}
}
@ -395,29 +395,17 @@ export class CodeGeneratorCore {
}
async GetCodeGenProjectName(rootPath: string): Promise<string|undefined> {
let counter = 0;
const appName = constants.defaultAppName;
let candidateName = appName;
while (true) {
const appPath = path.join(rootPath, candidateName);
const appPathExists = fs.isDirectorySync(appPath);
if (!appPathExists) {
break;
}
counter++;
candidateName = `${appName}_${counter}`;
}
// select the application name for code gen
// select the project name for code gen
const codeGenProjectName = await vscode.window.showInputBox({
placeHolder: 'Project name?',
prompt: `Please specify the project name:`,
placeHolder: 'Please input the project name here.',
ignoreFocusOut: true,
validateInput: (applicationName: string) => {
if (!/^([a-z0-9_]|[a-z0-9_][-a-z0-9_.]*[a-z0-9_])(\.ino)?$/i.test(
applicationName)) {
return 'Project name can only contain letters, numbers, "-" and ".", and cannot start or end with "-" or ".".';
validateInput: (projectName: string) => {
if (!projectName || projectName.length === 0) {
return `The project name can't be empty.`;
}
if (!DigitalTwinConstants.codegenProjectNameRegex.test(projectName)) {
return `Project name can only contain ${
DigitalTwinConstants.codegenProjectNameRegexDescription}.`;
}
return;
}
@ -460,7 +448,7 @@ export class CodeGeneratorCore {
const result = projectTypeListJson.projectType.filter(
(projectType: PnpProjectTemplateType) => {
return projectType.language === language;
return (projectType.enabled && projectType.language === language);
});
const projectTypeList: vscode.QuickPickItem[] = [];

Просмотреть файл

@ -96,42 +96,34 @@ export class DeviceModelOperator {
}
const option: vscode.InputBoxOptions = {
value: DigitalTwinFileNames.defaultInterfaceName,
prompt: `Please input Interface name here.`,
placeHolder: `Please input Interface name here.`,
ignoreFocusOut: true,
validateInput: (interfaceName: string) => {
if (!interfaceName) {
return 'Please provide a valid Interface name.';
if (!interfaceName || interfaceName.length === 0) {
return `The Interface name can't be empty`;
}
if (!/\.interface\.json$/i.test(interfaceName)) {
interfaceName += DigitalTwinConstants.interfaceSuffix;
if (!DigitalTwinConstants.dtidSegmentRegex.test(interfaceName)) {
return `Interface name can only contain ${
DigitalTwinConstants.dtidSegmentRegexDescription}.`;
}
if (/^([a-z_]|[a-z_][-a-z0-9_.]*[a-z0-9_])(\.interface\.json)?$/i.test(
interfaceName)) {
const targetInterface = path.join(rootPath as string, interfaceName);
if (fs.existsSync(targetInterface)) {
return `The file with name ${
interfaceName} already exists in current folder.`;
}
return '';
const interfaceFilename = path.join(
rootPath as string,
interfaceName + DigitalTwinConstants.interfaceSuffix);
if (fs.existsSync(interfaceFilename)) {
return `The interface file already exists in current folder.`;
}
return 'interface name can only contain alphanumeric and cannot start with number.';
return;
}
};
let interfaceFileName = await vscode.window.showInputBox(option);
const interfaceName = await vscode.window.showInputBox(option);
if (interfaceFileName === undefined) {
if (interfaceName === undefined) {
return false;
} else {
interfaceFileName = interfaceFileName.trim();
if (!/\.interface\.json$/i.test(interfaceFileName)) {
interfaceFileName += DigitalTwinConstants.interfaceSuffix;
}
}
const targetInterface = path.join(rootPath, interfaceFileName);
const dtid = dtUtils.GenerateDigitalTwinIdentifier(interfaceName);
const targetInterface = path.join(
rootPath, interfaceName + DigitalTwinConstants.interfaceSuffix);
const interfaceTemplate = context.asAbsolutePath(path.join(
FileNames.resourcesFolderName, FileNames.templatesFolderName,
@ -139,7 +131,8 @@ export class DeviceModelOperator {
DigitalTwinFileNames.sampleInterfaceName));
try {
const content = fs.readFileSync(interfaceTemplate, 'utf8');
const content = fs.readFileSync(interfaceTemplate, 'utf8')
.replace(DigitalTwinConstants.dtidPlaceholder, dtid);
fs.writeFileSync(targetInterface, content);
} catch (error) {
throw new Error(
@ -152,8 +145,8 @@ export class DeviceModelOperator {
await vscode.window.showTextDocument(vscode.Uri.file(targetInterface));
vscode.window.showInformationMessage(
`New ${DigitalTwinConstants.productName} Interface ${
interfaceFileName} was created successfully.`);
`New ${DigitalTwinConstants.productName} Interface '${
dtid}' was created successfully.`);
return;
}
@ -167,42 +160,36 @@ export class DeviceModelOperator {
}
const option: vscode.InputBoxOptions = {
value: DigitalTwinFileNames.defaultCapabilityModelName,
prompt: `Please input Capability Model name here:`,
placeHolder: `Please input Capability Model name here.`,
ignoreFocusOut: true,
validateInput: (capabilityModelName: string) => {
if (!capabilityModelName) {
return 'Please provide a valid Capability Model name.';
if (!capabilityModelName || capabilityModelName.length === 0) {
return `The Capability Model name can't be empty`;
}
if (!/\.capabilitymodel\.json$/i.test(capabilityModelName)) {
capabilityModelName += DigitalTwinConstants.capabilityModelSuffix;
if (!DigitalTwinConstants.dtidSegmentRegex.test(capabilityModelName)) {
return `Capability Model name can only contain ${
DigitalTwinConstants.dtidSegmentRegexDescription}.`;
}
if (/^([a-z_]|[a-z_][-a-z0-9_.]*[a-z0-9_])(\.capabilitymodel\.json)?$/i
.test(capabilityModelName)) {
const targetCapabilityModel =
path.join(rootPath as string, capabilityModelName);
if (fs.existsSync(targetCapabilityModel)) {
return `The file with name ${
capabilityModelName} already exists in current folder.`;
}
return '';
const capabilityModelFilename = path.join(
rootPath as string,
capabilityModelName + DigitalTwinConstants.capabilityModelSuffix);
if (fs.existsSync(capabilityModelFilename)) {
return `The interface file already exists in current folder.`;
}
return 'Capability Model name can only contain alphanumeric and cannot start with number.';
return;
}
};
let capabilityModelFileName = await vscode.window.showInputBox(option);
const capabilityModelName = await vscode.window.showInputBox(option);
if (capabilityModelFileName === undefined) {
if (capabilityModelName === undefined) {
return false;
} else {
capabilityModelFileName = capabilityModelFileName.trim();
if (!/\.capabilitymodel\.json$/i.test(capabilityModelFileName)) {
capabilityModelFileName += DigitalTwinConstants.capabilityModelSuffix;
}
}
const targetCapabilityModel = path.join(rootPath, capabilityModelFileName);
const dtid = dtUtils.GenerateDigitalTwinIdentifier(capabilityModelName);
const targetCapabilityModel = path.join(
rootPath,
capabilityModelName + DigitalTwinConstants.capabilityModelSuffix);
const capabilityModel = context.asAbsolutePath(path.join(
FileNames.resourcesFolderName, FileNames.templatesFolderName,
@ -210,7 +197,8 @@ export class DeviceModelOperator {
DigitalTwinFileNames.sampleCapabilityModelName));
try {
const content = fs.readFileSync(capabilityModel, 'utf8');
const content = fs.readFileSync(capabilityModel, 'utf8')
.replace(DigitalTwinConstants.dtidPlaceholder, dtid);
fs.writeFileSync(targetCapabilityModel, content);
} catch (error) {
throw new Error(`Creating ${
@ -225,8 +213,8 @@ export class DeviceModelOperator {
vscode.Uri.file(targetCapabilityModel));
vscode.window.showInformationMessage(
`New ${DigitalTwinConstants.productName} Capability Model ${
capabilityModelFileName} created successfully.`);
`New ${DigitalTwinConstants.productName} Capability Model '${
dtid}' was created successfully.`);
return;
}
@ -260,29 +248,13 @@ export class DeviceModelOperator {
}
// Open Company repository
let connectionString =
await CredentialStore.getCredential(ConfigKey.modelRepositoryKeyName);
const connectionString = await this.RetrieveModelRepoConnectionString();
if (!connectionString) {
const option: vscode.InputBoxOptions = {
value: DigitalTwinConstants.repoConnectionStringTemplate,
prompt: `Please input the connection string to the ${
DigitalTwinConstants.productName} Model Repository:`,
ignoreFocusOut: true
};
const connStr = await vscode.window.showInputBox(option);
if (!connStr) {
return false;
} else {
connectionString = connStr as string;
}
return false;
}
const result =
await DigitalTwinConnector.ConnectMetamodelRepository(connectionString);
if (result) {
await CredentialStore.setCredential(
ConfigKey.modelRepositoryKeyName, connectionString);
@ -612,32 +584,18 @@ export class DeviceModelOperator {
}
}
let connectionString =
await CredentialStore.getCredential(ConfigKey.modelRepositoryKeyName);
const connectionString = await this.RetrieveModelRepoConnectionString();
if (!connectionString) {
const option: vscode.InputBoxOptions = {
value: DigitalTwinConstants.repoConnectionStringTemplate,
prompt: `Please input the connection string of your company's ${
DigitalTwinConstants.productName} Model Repository.`,
ignoreFocusOut: true
};
const connStr = await vscode.window.showInputBox(option);
if (!connStr) {
utils.channelShowAndAppendLine(
channel, `Company repository not specified, cancel submit.`);
return false;
} else {
connectionString = connStr as string;
const result =
await DigitalTwinConnector.ConnectMetamodelRepository(connStr);
if (!result) {
utils.channelShowAndAppendLine(
channel, `Company repository not specified, cancel submit.`);
return false;
}
}
utils.channelShowAndAppendLine(
channel, `Company repository not specified, cancel submit.`);
return false;
}
const result =
await DigitalTwinConnector.ConnectMetamodelRepository(connectionString);
if (!result) {
utils.channelShowAndAppendLine(
channel, `Failed to connect Company repository, cancel submit.`);
return false;
}
const dtMetamodelRepositoryClient =
@ -670,6 +628,30 @@ export class DeviceModelOperator {
return true;
}
private async RetrieveModelRepoConnectionString(): Promise<string|null> {
let connectionString =
await CredentialStore.getCredential(ConfigKey.modelRepositoryKeyName);
if (!connectionString) {
const option: vscode.InputBoxOptions = {
placeHolder: DigitalTwinConstants.repoConnectionStringTemplate,
prompt: `Please input your company repository connection string.`,
ignoreFocusOut: true,
validateInput: (connectionString: string) => {
if (!connectionString || connectionString.length === 0) {
return `The connection string can't be empty.`;
}
return;
}
};
const connStr = await vscode.window.showInputBox(option);
if (connStr) {
connectionString = connStr;
}
}
return connectionString;
}
private async SubmitInterface(
option: SubmitOptions,
dtMetamodelRepositoryClient: DigitalTwinMetamodelRepositoryClient,

Просмотреть файл

@ -59,7 +59,7 @@ export class DigitalTwinConnectionStringBuilder {
ValidateFormat(value: string, propertyName: string, regex: RegExp) {
if (value) {
if (!regex.test(value)) {
throw Error(
throw new Error(
`The connection string is invalid for property ${propertyName}`);
}
}
@ -68,7 +68,7 @@ export class DigitalTwinConnectionStringBuilder {
Parse(dtConnectionString: string): void {
if (!dtConnectionString) {
throw Error('The connection string should not be empty');
throw new Error('The connection string should not be empty');
}
const items: {[propertyName: string]: string;} = {};
@ -77,14 +77,14 @@ export class DigitalTwinConnectionStringBuilder {
pairs.forEach(value => {
const index = value.indexOf(constants.ValuePairSeparator);
if (index <= 0) {
throw Error(
throw new Error(
`The format of the connection string is not valid: ${value}`);
}
const propertyName = value.substr(0, index);
const propertyValue = value.substr(index + 1, value.length - index - 1);
if (!propertyName || !propertyValue) {
throw Error(
throw new Error(
`The format of the connection string is not valid: ${value}`);
}
items[propertyName] = propertyValue;
@ -103,9 +103,10 @@ export class DigitalTwinConnectionStringBuilder {
}
if (!this.hostName) {
throw Error('Unable to find the host name in the connection string.');
throw new Error('Unable to find the host name in the connection string.');
} else if (!this.repositoryId) {
throw Error('Unable to find the repositoryId in the connection string.');
throw new Error(
'Unable to find the repositoryId in the connection string.');
}
this.Validate();

Просмотреть файл

@ -3,7 +3,6 @@
'use strict';
import * as vscode from 'vscode';
import * as request from 'request-promise';
import {SearchResults} from './DataContracts/SearchResults';
import {MetaModelType, SearchOptions, MetaModelUpsertRequest} from './DataContracts/DigitalTwinContext';
@ -13,7 +12,7 @@ import {ConfigKey} from '../../constants';
import {GetModelResult} from './DataContracts/DigitalTwinModel';
import {ConfigHandler} from '../../configHandler';
import {DigitalTwinConstants} from '../DigitalTwinConstants';
import {CredentialStore} from '../../credentialStore';
import * as url from 'url';
const constants = {
mediaType: 'application/json',
@ -23,35 +22,36 @@ const constants = {
export class DigitalTwinMetamodelRepositoryClient {
private modelRepoSharedAccessKey: DigitalTwinSharedAccessKey|null = null;
private metaModelRepositoryHostName: vscode.Uri|null = null;
private modelPublicRepoUrl?: string;
constructor() {}
async initialize(connectionString: string|null) {
let modelRepoUrl = null;
if (!connectionString) {
// Connect to public repo
this.modelRepoSharedAccessKey = null;
const storedConnectionString =
await CredentialStore.getCredential(ConfigKey.modelRepositoryKeyName);
if (storedConnectionString !== null) {
const builder =
DigitalTwinConnectionStringBuilder.Create(storedConnectionString);
this.metaModelRepositoryHostName = vscode.Uri.parse(builder.HostName);
} else {
const dtRepositoryUrl =
ConfigHandler.get<string>(ConfigKey.iotPnPRepositoryUrl);
if (!dtRepositoryUrl) {
throw new Error(
'The IoT Plug and Play public repository URL is invalid. Please set IoTPnPRepositoryUrl in configuration.');
}
this.metaModelRepositoryHostName = vscode.Uri.parse(dtRepositoryUrl);
const dtRepositoryUrl =
ConfigHandler.get<string>(ConfigKey.iotPnPPublicRepositoryUrl);
if (!dtRepositoryUrl) {
throw new Error(
'The IoT Plug and Play public repository URL is invalid.');
}
modelRepoUrl = dtRepositoryUrl;
} else {
const builder =
DigitalTwinConnectionStringBuilder.Create(connectionString);
this.metaModelRepositoryHostName = vscode.Uri.parse(builder.HostName);
if (!builder.HostName.startsWith('http')) {
// The hostname from connections string doesn't contain the protocol
modelRepoUrl = 'https://' + builder.HostName;
} else {
modelRepoUrl = builder.HostName;
}
this.modelRepoSharedAccessKey = new DigitalTwinSharedAccessKey(builder);
}
const repoUrl = url.parse(modelRepoUrl);
repoUrl.protocol = 'https'; // force to https
this.modelPublicRepoUrl = repoUrl.href;
}
async GetInterfaceAsync(
@ -178,11 +178,10 @@ export class DigitalTwinMetamodelRepositoryClient {
metaModelType: MetaModelType, contents: string, modelId: string,
etag?: string, repositoryId?: string,
apiVersion = DigitalTwinConstants.apiVersion): Promise<string> {
if (!this.metaModelRepositoryHostName) {
throw new Error(
'The value of metaModelRepositoryHostName is not initialized');
if (!this.modelPublicRepoUrl) {
throw new Error('The value of modelPublicRepoUrl is not initialized');
}
let targetUri = this.metaModelRepositoryHostName.toString();
let targetUri = this.modelPublicRepoUrl;
if (repositoryId) {
targetUri +=
@ -273,11 +272,10 @@ export class DigitalTwinMetamodelRepositoryClient {
continuationToken,
pageSize
};
if (!this.metaModelRepositoryHostName) {
throw new Error(
'The value of metaModelRepositoryHostName is not initialized');
if (!this.modelPublicRepoUrl) {
throw new Error('The value of modelPublicRepoUrl is not initialized');
}
let queryString = this.metaModelRepositoryHostName.toString();
let queryString = this.modelPublicRepoUrl;
if (repositoryId) {
queryString += `${constants.modelSearch}?repositoryId=${
@ -325,15 +323,12 @@ export class DigitalTwinMetamodelRepositoryClient {
private async MakeDeleteRequestAsync(
metaModelType: MetaModelType, modelId: string, repositoryId?: string,
apiVersion = DigitalTwinConstants.apiVersion) {
if (!this.metaModelRepositoryHostName) {
throw new Error(
'The value of metaModelRepositoryHostName is not initialized');
if (!this.modelPublicRepoUrl) {
throw new Error('The value of modelPublicRepoUrl is not initialized');
}
const queryString = `?repositoryId=${repositoryId}`;
const resourceUrl =
`${this.metaModelRepositoryHostName.toString()}${constants.apiModel}/${
encodeURIComponent(
modelId)}${queryString}&api-version=${apiVersion}`;
const resourceUrl = `${this.modelPublicRepoUrl}${constants.apiModel}/${
encodeURIComponent(modelId)}${queryString}&api-version=${apiVersion}`;
let authenticationString = '';
@ -366,13 +361,11 @@ export class DigitalTwinMetamodelRepositoryClient {
private GenerateFetchModelUri(
modelId: string, apiVersion: string, repositoryId?: string,
expand = false) {
if (!this.metaModelRepositoryHostName) {
throw new Error(
'The value of metaModelRepositoryHostName is not initialized');
if (!this.modelPublicRepoUrl) {
throw new Error('The value of modelPublicRepoUrl is not initialized');
}
let result =
`${this.metaModelRepositoryHostName.toString()}${constants.apiModel}/${
encodeURIComponent(modelId)}?api-version=${apiVersion}`;
let result = `${this.modelPublicRepoUrl}${constants.apiModel}/${
encodeURIComponent(modelId)}?api-version=${apiVersion}`;
const expandString = expand ? `&expand=true` : '';
if (repositoryId) {
result += `${expandString}&repositoryId=${repositoryId}`;

Просмотреть файл

@ -36,7 +36,13 @@ export abstract class AnsiCCodeGeneratorBase implements CodeGenerator {
let message = `${DigitalTwinConstants.dtPrefix} Scaffold code stub.`;
utils.channelShowAndAppendLine(this.channel, message);
await utils.runCommand(command, [], cmdPath, this.channel);
try {
await utils.runCommand(command, [], cmdPath, this.channel);
} catch {
message = `${DigitalTwinConstants.dtPrefix} Scaffold code stub failed.`;
utils.channelShowAndAppendLine(this.channel, message);
return false;
}
message = `${DigitalTwinConstants.dtPrefix} Scaffold code stub completed.`;
utils.channelShowAndAppendLine(this.channel, message);
return true;

Просмотреть файл

@ -11,8 +11,6 @@ export class DigitalTwinFileNames {
static readonly sampleInterfaceName = 'sample.interface.json';
static readonly sampleCapabilityModelName = 'sample.capabilitymodel.json';
static readonly schemaFolderName = 'schemas';
static readonly defaultInterfaceName = 'myInterface';
static readonly defaultCapabilityModelName = 'myCapabilityModel';
static readonly etagCacheFileName = 'etagCache.json';
static readonly devicemodelTemplateFolderName = 'devicemodel';
static readonly projectTypeListFileName = 'projecttypelist.json';
@ -31,6 +29,17 @@ export class DigitalTwinConstants {
static readonly productName = 'IoT Plug and Play';
static readonly codeGenCli = 'IoT Plug and Play CodeGen Cli';
static readonly codeGenCliApp = 'DigitalTwinCodeGen';
static readonly dtidPlaceholder = '{DigitalTwinIdentifier}';
static readonly dtidSegmentRegex = new RegExp('^[a-zA-Z_][a-zA-Z0-9_]*$');
static readonly dtidSegmentRegexDescription =
'alphanumeric and underscore, and cannot start with number';
static readonly codegenProjectNameRegex =
new RegExp('^[a-zA-Z_][-a-zA-Z0-9_]*$');
static readonly codegenProjectNameRegexDescription =
'alphanumeric, underscore and dash character, and cannot start with number and dash character';
}
export class CodeGenConstants {
@ -41,4 +50,4 @@ export class DTDLKeywords {
static readonly typeValueInterface = 'Interface';
static readonly typeValueDCM = 'CapabilityModel';
static readonly inlineInterfaceKeyName = 'interfaceSchema';
}
}

Просмотреть файл

@ -426,7 +426,18 @@ export class DigitalTwinMetaModelParser {
}
}
return id.split('/').pop();
if (id.startsWith('http://www.w3.org')) {
// RDF schema
return id.split('/').pop();
}
const ct = dtContext['@context']['@vocab'];
if (id.startsWith(ct)) {
// Abosolut path
return id.substr(ct.length);
} else {
// Relative path
return id;
}
}
isInternationalizationFromId(

Просмотреть файл

@ -209,6 +209,10 @@ export async function SaveCompanyRepoConnectionString(
ConfigKey.modelRepositoryKeyName, connectionString);
}
export function GenerateDigitalTwinIdentifier(name: string): string {
return `urn:{your name}:${name}:1`;
}
/**
* An interface for an object that iterates through a sequence of values.
*/

Просмотреть файл

@ -39,4 +39,5 @@ export interface PnpProjectTemplateType {
name: string;
type: string;
detail: string;
enabled: boolean;
}

Просмотреть файл

@ -14,7 +14,7 @@ export class ConfigKey {
static readonly shownHelpPage = 'ShownHelpPage';
static readonly codeGeneratorVersion = 'IoTPnPCodeGenVersion';
static readonly modelRepositoryKeyName = 'IoTPnPModelRepositoryKey';
static readonly iotPnPRepositoryUrl = 'IoTPnPRepositoryUrl';
static readonly iotPnPPublicRepositoryUrl = 'IoTPnPPublicRepositoryUrl';
static readonly projectType = 'ProjectType';
}

Просмотреть файл

@ -715,8 +715,8 @@ export async function activate(context: vscode.ExtensionContext) {
return telemetryModule.callWithTelemetry(
EventNames.pnpGetInterfacesEvent, outputChannel, true, context,
deviceModelOperator.GetInterfaces, {}, publicRepository,
searchString, pageSize, continueToken);
deviceModelOperator.GetInterfaces.bind(deviceModelOperator), {},
publicRepository, searchString, pageSize, continueToken);
});
vscode.commands.registerCommand(
@ -732,8 +732,9 @@ export async function activate(context: vscode.ExtensionContext) {
return telemetryModule.callWithTelemetry(
EventNames.pnpGetCapabilityModelsEvent, outputChannel, true,
context, deviceModelOperator.GetCapabilityModels, {},
publicRepository, searchString, pageSize, continueToken);
context,
deviceModelOperator.GetCapabilityModels.bind(deviceModelOperator),
{}, publicRepository, searchString, pageSize, continueToken);
});
vscode.commands.registerCommand(
@ -747,8 +748,8 @@ export async function activate(context: vscode.ExtensionContext) {
telemetryModule.callWithTelemetry(
EventNames.pnpDeleteModelsEvent, outputChannel, true, context,
deviceModelOperator.DeleteMetamodelFiles, {}, interfaceIds,
metaModelValue);
deviceModelOperator.DeleteMetamodelFiles.bind(deviceModelOperator),
{}, interfaceIds, metaModelValue);
});
vscode.commands.registerCommand(
@ -779,7 +780,8 @@ export async function activate(context: vscode.ExtensionContext) {
}
telemetryModule.callWithTelemetry(
EventNames.pnpConnectModelRepoEvent, outputChannel, true, context,
deviceModelOperator.ConnectModelRepository);
deviceModelOperator.ConnectModelRepository.bind(
deviceModelOperator));
}));
context.subscriptions.push(vscode.commands.registerCommand(
@ -791,7 +793,7 @@ export async function activate(context: vscode.ExtensionContext) {
}
telemetryModule.callWithTelemetry(
EventNames.pnpConnectModelRepoEvent, outputChannel, true, context,
deviceModelOperator.Disconnect);
deviceModelOperator.Disconnect.bind(deviceModelOperator));
}));
context.subscriptions.push(vscode.commands.registerCommand(