@azure-rest/maps-route 1.0.0-beta.1 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -24
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ You can authenticate with your Azure Maps Subscription Key.
|
|
|
66
66
|
|
|
67
67
|
```javascript
|
|
68
68
|
const MapsRoute = require("@azure-rest/maps-route").default;
|
|
69
|
-
const { AzureKeyCredential } = require("@azure
|
|
69
|
+
const { AzureKeyCredential } = require("@azure/core-auth");
|
|
70
70
|
|
|
71
71
|
const credential = new AzureKeyCredential("<subscription-key>");
|
|
72
72
|
const client = MapsRoute(credential);
|
|
@@ -117,15 +117,18 @@ if (isUnexpected(routeDirectionsResult)) {
|
|
|
117
117
|
throw routeDirectionsResult.body.error;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
console.log(
|
|
122
|
-
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
routeDirectionsResult.body.routes.forEach(({ summary, legs }) => {
|
|
121
|
+
console.log(
|
|
122
|
+
`The total distance is ${summary.lengthInMeters} meters, and it takes ${summary.travelTimeInSeconds} seconds.`
|
|
123
|
+
);
|
|
124
|
+
legs.forEach(({ summary, points }, idx) => {
|
|
125
|
+
console.log(
|
|
126
|
+
`The ${idx + 1}th leg's length is ${summary.lengthInMeters} meters, and it takes ${
|
|
127
|
+
summary.travelTimeInSeconds
|
|
128
|
+
} seconds. Followings are the first 10 points: `
|
|
129
|
+
);
|
|
130
|
+
console.table(points.slice(0, 10));
|
|
131
|
+
});
|
|
129
132
|
});
|
|
130
133
|
```
|
|
131
134
|
|
|
@@ -158,15 +161,18 @@ if (isUnexpected(routeDirectionsResult)) {
|
|
|
158
161
|
throw routeDirectionsResult.body.error;
|
|
159
162
|
}
|
|
160
163
|
|
|
161
|
-
|
|
162
|
-
console.log(
|
|
163
|
-
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
routeDirectionsResult.body.routes.forEach(({ summary, legs }) => {
|
|
165
|
+
console.log(
|
|
166
|
+
`The total distance is ${summary.lengthInMeters} meters, and it takes ${summary.travelTimeInSeconds} seconds.`
|
|
167
|
+
);
|
|
168
|
+
legs.forEach(({ summary, points }, idx) => {
|
|
169
|
+
console.log(
|
|
170
|
+
`The ${idx + 1}th leg's length is ${summary.lengthInMeters} meters, and it takes ${
|
|
171
|
+
summary.travelTimeInSeconds
|
|
172
|
+
} seconds. Followings are the first 10 points: `
|
|
173
|
+
);
|
|
174
|
+
console.table(points.slice(0, 10));
|
|
175
|
+
});
|
|
170
176
|
});
|
|
171
177
|
```
|
|
172
178
|
|
|
@@ -208,7 +214,7 @@ console.log(
|
|
|
208
214
|
`The optimized distance is ${summary.lengthInMeters} meters, and it takes ${summary.travelTimeInSeconds} seconds.`
|
|
209
215
|
);
|
|
210
216
|
console.log("The route is optimized by: ");
|
|
211
|
-
routeDirectionsResult.body.
|
|
217
|
+
routeDirectionsResult.body.optimizedWaypoints.forEach(
|
|
212
218
|
({ providedIndex, optimizedIndex }) => `Moving index ${providedIndex} to ${optimizedIndex}`
|
|
213
219
|
);
|
|
214
220
|
```
|
|
@@ -242,10 +248,8 @@ If you'd like to contribute to this library, please read the [contributing guide
|
|
|
242
248
|

|
|
243
249
|
|
|
244
250
|
[source_code]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-route-rest
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
<!-- [api_ref]: https://docs.microsoft.com/javascript/api/@azure-rest/maps-route?view=azure-node-preview -->
|
|
248
|
-
|
|
251
|
+
[npm_link]: https://www.npmjs.com/package/@azure-rest/maps-route
|
|
252
|
+
[api_ref]: https://docs.microsoft.com/javascript/api/@azure-rest/maps-route
|
|
249
253
|
[samples]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-route-rest/samples
|
|
250
254
|
[azure_cli]: https://docs.microsoft.com/cli/azure
|
|
251
255
|
[azure_sub]: https://azure.microsoft.com/free/
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@azure-rest/maps-route",
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "1.0.0-beta.
|
|
5
|
+
"version": "1.0.0-beta.2",
|
|
6
6
|
"description": "A client library for Azure Maps maps-route",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
],
|
|
40
40
|
"requiredResources": {
|
|
41
41
|
"Azure Maps Resource": "https://docs.microsoft.com/azure/azure-maps/how-to-create-template"
|
|
42
|
-
}
|
|
42
|
+
},
|
|
43
|
+
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure-rest/maps-route",
|
|
44
|
+
"disableDocsMs": true
|
|
43
45
|
},
|
|
44
46
|
"//metadata": {
|
|
45
47
|
"constantPaths": [
|
|
@@ -87,25 +89,25 @@
|
|
|
87
89
|
"@azure/core-rest-pipeline": "^1.8.0",
|
|
88
90
|
"@azure/logger": "^1.0.0",
|
|
89
91
|
"@azure/core-lro": "^2.2.0",
|
|
90
|
-
"@azure/maps-common": "
|
|
92
|
+
"@azure/maps-common": "1.0.0-beta.2",
|
|
91
93
|
"tslib": "^2.4.0"
|
|
92
94
|
},
|
|
93
95
|
"devDependencies": {
|
|
94
96
|
"@microsoft/api-extractor": "^7.31.1",
|
|
95
97
|
"autorest": "latest",
|
|
96
|
-
"@types/node": "^
|
|
97
|
-
"dotenv": "^
|
|
98
|
-
"eslint": "^
|
|
98
|
+
"@types/node": "^14.0.0",
|
|
99
|
+
"dotenv": "^16.0.0",
|
|
100
|
+
"eslint": "^8.0.0",
|
|
99
101
|
"mkdirp": "^1.0.4",
|
|
100
|
-
"prettier": "2.
|
|
102
|
+
"prettier": "^2.5.1",
|
|
101
103
|
"rimraf": "^3.0.0",
|
|
102
104
|
"source-map-support": "^0.5.9",
|
|
103
|
-
"typescript": "~
|
|
105
|
+
"typescript": "~5.0.0",
|
|
104
106
|
"@azure/dev-tool": "^1.0.0",
|
|
105
107
|
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
106
108
|
"@azure-tools/test-credential": "^1.0.0",
|
|
107
109
|
"@azure/identity": "^2.0.1",
|
|
108
|
-
"@azure-tools/test-recorder": "^
|
|
110
|
+
"@azure-tools/test-recorder": "^3.0.0",
|
|
109
111
|
"mocha": "^7.1.1",
|
|
110
112
|
"mocha-junit-reporter": "^1.18.0",
|
|
111
113
|
"cross-env": "^7.0.2",
|
|
@@ -113,17 +115,15 @@
|
|
|
113
115
|
"chai": "^4.2.0",
|
|
114
116
|
"karma-chrome-launcher": "^3.0.0",
|
|
115
117
|
"karma-coverage": "^2.0.0",
|
|
116
|
-
"karma-edge-launcher": "^0.4.2",
|
|
117
118
|
"karma-env-preprocessor": "^0.1.1",
|
|
118
119
|
"karma-firefox-launcher": "^1.1.0",
|
|
119
|
-
"karma-ie-launcher": "^1.0.0",
|
|
120
120
|
"karma-junit-reporter": "^2.0.1",
|
|
121
121
|
"karma-mocha-reporter": "^2.2.5",
|
|
122
122
|
"karma-mocha": "^2.0.1",
|
|
123
123
|
"karma-source-map-support": "~1.4.0",
|
|
124
124
|
"karma-sourcemap-loader": "^0.3.8",
|
|
125
125
|
"karma": "^6.2.0",
|
|
126
|
-
"nyc": "^
|
|
126
|
+
"nyc": "^15.0.0",
|
|
127
127
|
"@types/mocha": "^7.0.2"
|
|
128
128
|
},
|
|
129
129
|
"browser": {
|