@azure-rest/maps-search 2.0.0-alpha.20250212.1 → 2.0.0-alpha.20250217.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -62,9 +62,9 @@ Set the values of the client ID, tenant ID, and client secret of the Microsoft E
62
62
  You will also need to specify the Azure Maps resource you intend to use by specifying the `clientId` in the client options.
63
63
  The Azure Maps resource client id can be found in the Authentication sections in the Azure Maps resource. Please refer to the [documentation](https://learn.microsoft.com/azure/azure-maps/how-to-manage-authentication#view-authentication-details) on how to find it.
64
64
 
65
- ```javascript
66
- const MapsSearch = require("@azure-rest/maps-search").default;
67
- const { DefaultAzureCredential } = require("@azure/identity");
65
+ ```ts snippet:ReadmeSampleCreateClient_TokenCredential
66
+ import { DefaultAzureCredential } from "@azure/identity";
67
+ import MapsSearch from "@azure-rest/maps-search";
68
68
 
69
69
  const credential = new DefaultAzureCredential();
70
70
  const client = MapsSearch(credential, "<maps-account-client-id>");
@@ -74,9 +74,9 @@ const client = MapsSearch(credential, "<maps-account-client-id>");
74
74
 
75
75
  You can authenticate with your Azure Maps Subscription Key.
76
76
 
77
- ```javascript
78
- const MapsSearch = require("@azure-rest/maps-search").default;
79
- const { AzureKeyCredential } = require("@azure/core-auth");
77
+ ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey
78
+ import { AzureKeyCredential } from "@azure/core-auth";
79
+ import MapsSearch from "@azure-rest/maps-search";
80
80
 
81
81
  const credential = new AzureKeyCredential("<subscription-key>");
82
82
  const client = MapsSearch(credential);
@@ -98,11 +98,11 @@ npm install @azure/core-auth
98
98
 
99
99
  Finally, you can use the SAS token to authenticate the client:
100
100
 
101
- ```javascript
102
- const MapsSearch = require("@azure-rest/maps-search").default;
103
- const { AzureSASCredential } = require("@azure/core-auth");
104
- const { DefaultAzureCredential } = require("@azure/identity");
105
- const { AzureMapsManagementClient } = require("@azure/arm-maps");
101
+ ```ts snippet:ReadmeSampleCreateClient_SAS
102
+ import { DefaultAzureCredential } from "@azure/identity";
103
+ import { AzureMapsManagementClient } from "@azure/arm-maps";
104
+ import { AzureSASCredential } from "@azure/core-auth";
105
+ import MapsSearch from "@azure-rest/maps-search";
106
106
 
107
107
  const subscriptionId = "<subscription ID of the map account>";
108
108
  const resourceGroupName = "<resource group name of the map account>";
@@ -114,6 +114,7 @@ const mapsAccountSasParameters = {
114
114
  principalId: "<principle ID (object ID) of the managed identity>",
115
115
  signingKey: "primaryKey",
116
116
  };
117
+
117
118
  const credential = new DefaultAzureCredential();
118
119
  const managementClient = new AzureMapsManagementClient(credential, subscriptionId);
119
120
  const { accountSasToken } = await managementClient.accounts.listSas(
@@ -121,9 +122,11 @@ const { accountSasToken } = await managementClient.accounts.listSas(
121
122
  accountName,
122
123
  mapsAccountSasParameters,
123
124
  );
125
+
124
126
  if (accountSasToken === undefined) {
125
127
  throw new Error("No accountSasToken was found for the Maps Account.");
126
128
  }
129
+
127
130
  const sasCredential = new AzureSASCredential(accountSasToken);
128
131
  const client = MapsSearch(sasCredential);
129
132
  ```
@@ -145,41 +148,36 @@ The following sections provide several code snippets covering some of the most c
145
148
 
146
149
  You can use an authenticated client to convert an address into latitude and longitude coordinates. This process is also called geocoding. In addition to returning the coordinates, the response will also return detailed address properties such as postal code, admin districts, and country/region information.
147
150
 
148
- ```javascript
149
- const MapsSearch = require("@azure-rest/maps-search").default;
150
- const { AzureKeyCredential } = require("@azure/core-auth");
151
- const { isUnexpected } = require("@azure-rest/maps-search");
151
+ ```ts snippet:ReadmeSampleGeocode
152
+ import { DefaultAzureCredential } from "@azure/identity";
153
+ import MapsSearch, { isUnexpected } from "@azure-rest/maps-search";
152
154
 
153
- /** Initialize the MapsSearchClient */
154
- const client = MapsSearch(new AzureKeyCredential("<subscription-key>"));
155
+ const credential = new DefaultAzureCredential();
156
+ const client = MapsSearch(credential, "<maps-account-client-id>");
155
157
 
156
- async function main() {
157
- /** Make a request to the geocoding API */
158
- const response = await client
159
- .path("/geocode")
160
- .get({ queryParameters: { query: "400 Broad, Seattle" } });
161
- /** Handle error response */
162
- if (isUnexpected(response)) {
163
- throw response.body.error;
164
- }
165
- /** Log the response body. */
166
- if (!response.body.features) {
167
- console.log(`No coordinates found for the address.`);
168
- } else {
169
- console.log(`The followings are the possible coordinates of the address:`);
170
- for (const result of response.body.features) {
171
- const [lon, lat] = result.geometry.coordinates;
172
- console.log(`Latitude: ${lat}, Longitude ${lon}`);
173
- console.log("Postal code: ", result.properties?.address?.postalCode);
174
- console.log("Admin districts: ", result.properties?.address?.adminDistricts?.join(", "));
175
- console.log("Country region: ", result.properties?.address?.countryRegion);
176
- }
177
- }
158
+ /** Make a request to the geocoding API */
159
+ const response = await client
160
+ .path("/geocode")
161
+ .get({ queryParameters: { query: "400 Broad, Seattle" } });
162
+ // @ts-preserve-whitespaces
163
+ /** Handle error response */
164
+ if (isUnexpected(response)) {
165
+ throw response.body.error;
178
166
  }
179
167
 
180
- main().catch((err) => {
181
- console.log(err);
182
- });
168
+ /** Log the response body. */
169
+ if (!response.body.features) {
170
+ console.log(`No coordinates found for the address.`);
171
+ } else {
172
+ console.log(`The followings are the possible coordinates of the address:`);
173
+ for (const result of response.body.features) {
174
+ const [lon, lat] = result.geometry.coordinates;
175
+ console.log(`Latitude: ${lat}, Longitude ${lon}`);
176
+ console.log("Postal code: ", result.properties?.address?.postalCode);
177
+ console.log("Admin districts: ", result.properties?.address?.adminDistricts?.join(", "));
178
+ console.log("Country region: ", result.properties?.address?.countryRegion);
179
+ }
180
+ }
183
181
  ```
184
182
 
185
183
  ### Make a Reverse Address Search to translate coordinate location to street address
@@ -187,40 +185,35 @@ main().catch((err) => {
187
185
  You can translate coordinates into human readable street addresses. This process is also called reverse geocoding.
188
186
  This is often used for applications that consume GPS feeds and want to discover addresses at specific coordinate points.
189
187
 
190
- ```javascript
191
- const MapsSearch = require("@azure-rest/maps-search").default;
192
- const { AzureKeyCredential } = require("@azure/core-auth");
193
- const { isUnexpected } = require("@azure-rest/maps-search");
188
+ ```ts snippet:ReadmeSampleReverseGeocode
189
+ import { DefaultAzureCredential } from "@azure/identity";
190
+ import MapsSearch, { isUnexpected } from "@azure-rest/maps-search";
194
191
 
195
- /** Initialize the MapsSearchClient */
196
- const client = MapsSearch(new AzureKeyCredential("<subscription-key>"));
192
+ const credential = new DefaultAzureCredential();
193
+ const client = MapsSearch(credential, "<maps-account-client-id>");
197
194
 
198
- async function main() {
199
- /** Make the request. */
200
- const response = await client.path("/reverseGeocode").get({
201
- queryParameters: { coordinates: [-121.89, 37.337] }, // [longitude, latitude],
202
- });
203
- /** Handle error response. */
204
- if (isUnexpected(response)) {
205
- throw response.body.error;
206
- }
207
- if (!response.body.features || response.body.features.length === 0) {
208
- console.log("No results found.");
209
- } else {
210
- /** Log the response body. */
211
- for (const feature of response.body.features) {
212
- if (feature.properties?.address?.formattedAddress) {
213
- console.log(feature.properties.address.formattedAddress);
214
- } else {
215
- console.log("No address found.");
216
- }
195
+ /** Make the request. */
196
+ const response = await client.path("/reverseGeocode").get({
197
+ queryParameters: { coordinates: [-121.89, 37.337] }, // [longitude, latitude],
198
+ });
199
+
200
+ /** Handle error response. */
201
+ if (isUnexpected(response)) {
202
+ throw response.body.error;
203
+ }
204
+
205
+ if (!response.body.features || response.body.features.length === 0) {
206
+ console.log("No results found.");
207
+ } else {
208
+ /** Log the response body. */
209
+ for (const feature of response.body.features) {
210
+ if (feature.properties?.address?.formattedAddress) {
211
+ console.log(feature.properties.address.formattedAddress);
212
+ } else {
213
+ console.log("No address found.");
217
214
  }
218
215
  }
219
216
  }
220
-
221
- main().catch((err) => {
222
- console.log(err);
223
- });
224
217
  ```
225
218
 
226
219
  ## Use V1 SDK
@@ -234,19 +227,17 @@ npm install @azure-rest/map-search-v2@npm:@azure-rest/map-search@^2.0.0
234
227
 
235
228
  Then, you can import the two packages:
236
229
 
237
- ```javascript
238
- const MapsSearchV1 = require("@azure-rest/map-search-v1").default;
239
- const MapsSearchV2 = require("@azure-rest/map-search-v2").default;
230
+ ```ts snippet:ignore
231
+ import MapsSearchV1 from "@azure-rest/map-search-v1";
232
+ import MapsSearchV2 from "@azure-rest/map-search-v2";
240
233
  ```
241
234
 
242
235
  In the following example, we want to accept an address and search POIs around it. We'll use V2 SDK to get the coordinate of the address(/geocode), and use V1 SDK to search POIs around it(/search/nearby).
243
236
 
244
- ```javascript
245
- const MapsSearchV1 = require("@azure-rest/map-search-v1").default;
246
- const MapsSearchV2 = require("@azure-rest/map-search-v2").default;
247
- const { AzureKeyCredential } = require("@azure/core-auth");
248
- const { isUnexpected: isUnexpectedV1 } = require("@azure-rest/maps-search-v1");
249
- const { isUnexpected: isUnexpectedV2 } = require("@azure-rest/maps-search-v2");
237
+ ```ts snippet:ignore
238
+ import MapsSearchV1, { isUnexpected: isUnexpectedV1 } from "@azure-rest/map-search-v1";
239
+ import MapsSearchV2, { isUnexpected: isUnexpectedV2 } from "@azure-rest/map-search-v2";
240
+ import { AzureKeyCredential } from "@azure/core-auth";
250
241
 
251
242
  /** Initialize the MapsSearchClient */
252
243
  const clientV1 = MapsSearchV1(new AzureKeyCredential("<subscription-key>"));
@@ -257,6 +248,7 @@ async function searchNearby(address) {
257
248
  const geocodeResponse = await clientV2
258
249
  .path("/geocode")
259
250
  .get({ queryParameters: { query: address } });
251
+
260
252
  /** Handle error response */
261
253
  if (isUnexpectedV2(geocodeResponse)) {
262
254
  throw geocodeResponse.body.error;
@@ -297,8 +289,8 @@ main().catch((err) => {
297
289
 
298
290
  Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
299
291
 
300
- ```javascript
301
- const { setLogLevel } = require("@azure/logger");
292
+ ```ts snippet:SetLogLevel
293
+ import { setLogLevel } from "@azure/logger";
302
294
 
303
295
  setLogLevel("info");
304
296
  ```
@@ -5,9 +5,9 @@ import type { MapsSearchClient } from "./generated/index.js";
5
5
  * Creates an instance of MapsSearchClient from a subscription key.
6
6
  *
7
7
  * @example
8
- * ```ts
9
- * import MapsSearch from "@azure-rest/maps-search";
8
+ * ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey
10
9
  * import { AzureKeyCredential } from "@azure/core-auth";
10
+ * import MapsSearch from "@azure-rest/maps-search";
11
11
  *
12
12
  * const credential = new AzureKeyCredential("<subscription-key>");
13
13
  * const client = MapsSearch(credential);
@@ -21,9 +21,9 @@ export default function MapsSearch(credential: AzureKeyCredential, options?: Cli
21
21
  * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.
22
22
  *
23
23
  * @example
24
- * ```ts
25
- * import MapsSearch from "@azure-rest/maps-search";
24
+ * ```ts snippet:ReadmeSampleCreateClient_TokenCredential
26
25
  * import { DefaultAzureCredential } from "@azure/identity";
26
+ * import MapsSearch from "@azure-rest/maps-search";
27
27
  *
28
28
  * const credential = new DefaultAzureCredential();
29
29
  * const client = MapsSearch(credential, "<maps-account-client-id>");
@@ -38,9 +38,9 @@ export default function MapsSearch(credential: TokenCredential, mapsAccountClien
38
38
  * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.
39
39
  *
40
40
  * @example
41
- * ```ts
42
- * import MapsSearch from "@azure-rest/maps-search";
41
+ * ```ts snippet:ReadmeSampleCreateClient_SASToken
43
42
  * import { AzureSASCredential } from "@azure/core-auth";
43
+ * import MapsSearch from "@azure-rest/maps-search";
44
44
  *
45
45
  * const credential = new AzureSASCredential("<SAS Token>");
46
46
  * const client = MapsSearch(credential);
@@ -1 +1 @@
1
- {"version":3,"file":"MapsSearch.js","sourceRoot":"","sources":["../../src/MapsSearch.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AA6D5E,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAqE,EACrE,oBAA4C,EAAE,EAC9C,eAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CACvB,+BAA+B,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,sCAAsC;SAC/C,CAAC,CACH,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsSearchClient } from \"./generated/index.js\";\nimport createClient from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsSearchClient from a subscription key.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsSearch(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsSearch(credential, \"<maps-account-client-id>\");\n *```\n *\n * @param credential - An TokenCredential instance used to authenticate requests to the service\n * @param mapsAccountClientId - The Azure Maps client id of a specific map resource\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { AzureSASCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsSearch(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsSearchClient;\nexport default function MapsSearch(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsSearchClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
1
+ {"version":3,"file":"MapsSearch.js","sourceRoot":"","sources":["../../src/MapsSearch.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AA6D5E,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAqE,EACrE,oBAA4C,EAAE,EAC9C,eAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CACvB,+BAA+B,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,sCAAsC;SAC/C,CAAC,CACH,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsSearchClient } from \"./generated/index.js\";\nimport createClient from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsSearchClient from a subscription key.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsSearch(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_TokenCredential\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsSearch(credential, \"<maps-account-client-id>\");\n *```\n *\n * @param credential - An TokenCredential instance used to authenticate requests to the service\n * @param mapsAccountClientId - The Azure Maps client id of a specific map resource\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SASToken\n * import { AzureSASCredential } from \"@azure/core-auth\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsSearch(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsSearchClient;\nexport default function MapsSearch(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsSearchClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
@@ -5,9 +5,9 @@ import type { MapsSearchClient } from "./generated/index.js";
5
5
  * Creates an instance of MapsSearchClient from a subscription key.
6
6
  *
7
7
  * @example
8
- * ```ts
9
- * import MapsSearch from "@azure-rest/maps-search";
8
+ * ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey
10
9
  * import { AzureKeyCredential } from "@azure/core-auth";
10
+ * import MapsSearch from "@azure-rest/maps-search";
11
11
  *
12
12
  * const credential = new AzureKeyCredential("<subscription-key>");
13
13
  * const client = MapsSearch(credential);
@@ -21,9 +21,9 @@ export default function MapsSearch(credential: AzureKeyCredential, options?: Cli
21
21
  * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.
22
22
  *
23
23
  * @example
24
- * ```ts
25
- * import MapsSearch from "@azure-rest/maps-search";
24
+ * ```ts snippet:ReadmeSampleCreateClient_TokenCredential
26
25
  * import { DefaultAzureCredential } from "@azure/identity";
26
+ * import MapsSearch from "@azure-rest/maps-search";
27
27
  *
28
28
  * const credential = new DefaultAzureCredential();
29
29
  * const client = MapsSearch(credential, "<maps-account-client-id>");
@@ -38,9 +38,9 @@ export default function MapsSearch(credential: TokenCredential, mapsAccountClien
38
38
  * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.
39
39
  *
40
40
  * @example
41
- * ```ts
42
- * import MapsSearch from "@azure-rest/maps-search";
41
+ * ```ts snippet:ReadmeSampleCreateClient_SASToken
43
42
  * import { AzureSASCredential } from "@azure/core-auth";
43
+ * import MapsSearch from "@azure-rest/maps-search";
44
44
  *
45
45
  * const credential = new AzureSASCredential("<SAS Token>");
46
46
  * const client = MapsSearch(credential);
@@ -1 +1 @@
1
- {"version":3,"file":"MapsSearch.js","sourceRoot":"","sources":["../../src/MapsSearch.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqElC,6BAyCC;;AA1GD,gDAAsE;AACtE,oDAA8D;AAE9D,4EAAgD;AAChD,kEAA4E;AA6D5E,SAAwB,UAAU,CAChC,UAAqE,EACrE,oBAA4C,EAAE,EAC9C,eAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF;;;;OAIG;IACH,IAAI,IAAA,6BAAiB,EAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,IAAA,kBAAY,EAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CACvB,IAAA,oDAA+B,EAAC;YAC9B,UAAU;YACV,MAAM,EAAE,sCAAsC;SAC/C,CAAC,CACH,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAA,sCAAwB,EAAC,QAAQ,CAAC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,IAAA,2BAAe,EAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,IAAA,kBAAY,EAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,IAAA,kBAAY,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsSearchClient } from \"./generated/index.js\";\nimport createClient from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsSearchClient from a subscription key.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsSearch(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsSearch(credential, \"<maps-account-client-id>\");\n *```\n *\n * @param credential - An TokenCredential instance used to authenticate requests to the service\n * @param mapsAccountClientId - The Azure Maps client id of a specific map resource\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { AzureSASCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsSearch(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsSearchClient;\nexport default function MapsSearch(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsSearchClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
1
+ {"version":3,"file":"MapsSearch.js","sourceRoot":"","sources":["../../src/MapsSearch.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqElC,6BAyCC;;AA1GD,gDAAsE;AACtE,oDAA8D;AAE9D,4EAAgD;AAChD,kEAA4E;AA6D5E,SAAwB,UAAU,CAChC,UAAqE,EACrE,oBAA4C,EAAE,EAC9C,eAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF;;;;OAIG;IACH,IAAI,IAAA,6BAAiB,EAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,IAAA,kBAAY,EAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CACvB,IAAA,oDAA+B,EAAC;YAC9B,UAAU;YACV,MAAM,EAAE,sCAAsC;SAC/C,CAAC,CACH,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAA,sCAAwB,EAAC,QAAQ,CAAC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,IAAA,2BAAe,EAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,IAAA,kBAAY,EAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,IAAA,kBAAY,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsSearchClient } from \"./generated/index.js\";\nimport createClient from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsSearchClient from a subscription key.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsSearch(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_TokenCredential\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsSearch(credential, \"<maps-account-client-id>\");\n *```\n *\n * @param credential - An TokenCredential instance used to authenticate requests to the service\n * @param mapsAccountClientId - The Azure Maps client id of a specific map resource\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SASToken\n * import { AzureSASCredential } from \"@azure/core-auth\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsSearch(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsSearchClient;\nexport default function MapsSearch(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsSearchClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
@@ -5,9 +5,9 @@ import type { MapsSearchClient } from "./generated/index.js";
5
5
  * Creates an instance of MapsSearchClient from a subscription key.
6
6
  *
7
7
  * @example
8
- * ```ts
9
- * import MapsSearch from "@azure-rest/maps-search";
8
+ * ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey
10
9
  * import { AzureKeyCredential } from "@azure/core-auth";
10
+ * import MapsSearch from "@azure-rest/maps-search";
11
11
  *
12
12
  * const credential = new AzureKeyCredential("<subscription-key>");
13
13
  * const client = MapsSearch(credential);
@@ -21,9 +21,9 @@ export default function MapsSearch(credential: AzureKeyCredential, options?: Cli
21
21
  * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.
22
22
  *
23
23
  * @example
24
- * ```ts
25
- * import MapsSearch from "@azure-rest/maps-search";
24
+ * ```ts snippet:ReadmeSampleCreateClient_TokenCredential
26
25
  * import { DefaultAzureCredential } from "@azure/identity";
26
+ * import MapsSearch from "@azure-rest/maps-search";
27
27
  *
28
28
  * const credential = new DefaultAzureCredential();
29
29
  * const client = MapsSearch(credential, "<maps-account-client-id>");
@@ -38,9 +38,9 @@ export default function MapsSearch(credential: TokenCredential, mapsAccountClien
38
38
  * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.
39
39
  *
40
40
  * @example
41
- * ```ts
42
- * import MapsSearch from "@azure-rest/maps-search";
41
+ * ```ts snippet:ReadmeSampleCreateClient_SASToken
43
42
  * import { AzureSASCredential } from "@azure/core-auth";
43
+ * import MapsSearch from "@azure-rest/maps-search";
44
44
  *
45
45
  * const credential = new AzureSASCredential("<SAS Token>");
46
46
  * const client = MapsSearch(credential);
@@ -1 +1 @@
1
- {"version":3,"file":"MapsSearch.js","sourceRoot":"","sources":["../../src/MapsSearch.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AA6D5E,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAqE,EACrE,oBAA4C,EAAE,EAC9C,eAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CACvB,+BAA+B,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,sCAAsC;SAC/C,CAAC,CACH,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsSearchClient } from \"./generated/index.js\";\nimport createClient from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsSearchClient from a subscription key.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsSearch(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsSearch(credential, \"<maps-account-client-id>\");\n *```\n *\n * @param credential - An TokenCredential instance used to authenticate requests to the service\n * @param mapsAccountClientId - The Azure Maps client id of a specific map resource\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { AzureSASCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsSearch(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsSearchClient;\nexport default function MapsSearch(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsSearchClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
1
+ {"version":3,"file":"MapsSearch.js","sourceRoot":"","sources":["../../src/MapsSearch.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AA6D5E,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAqE,EACrE,oBAA4C,EAAE,EAC9C,eAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CACvB,+BAA+B,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,sCAAsC;SAC/C,CAAC,CACH,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsSearchClient } from \"./generated/index.js\";\nimport createClient from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsSearchClient from a subscription key.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsSearch(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_TokenCredential\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsSearch(credential, \"<maps-account-client-id>\");\n *```\n *\n * @param credential - An TokenCredential instance used to authenticate requests to the service\n * @param mapsAccountClientId - The Azure Maps client id of a specific map resource\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SASToken\n * import { AzureSASCredential } from \"@azure/core-auth\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsSearch(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsSearchClient;\nexport default function MapsSearch(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsSearchClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
@@ -5,9 +5,9 @@ import type { MapsSearchClient } from "./generated/index.js";
5
5
  * Creates an instance of MapsSearchClient from a subscription key.
6
6
  *
7
7
  * @example
8
- * ```ts
9
- * import MapsSearch from "@azure-rest/maps-search";
8
+ * ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey
10
9
  * import { AzureKeyCredential } from "@azure/core-auth";
10
+ * import MapsSearch from "@azure-rest/maps-search";
11
11
  *
12
12
  * const credential = new AzureKeyCredential("<subscription-key>");
13
13
  * const client = MapsSearch(credential);
@@ -21,9 +21,9 @@ export default function MapsSearch(credential: AzureKeyCredential, options?: Cli
21
21
  * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.
22
22
  *
23
23
  * @example
24
- * ```ts
25
- * import MapsSearch from "@azure-rest/maps-search";
24
+ * ```ts snippet:ReadmeSampleCreateClient_TokenCredential
26
25
  * import { DefaultAzureCredential } from "@azure/identity";
26
+ * import MapsSearch from "@azure-rest/maps-search";
27
27
  *
28
28
  * const credential = new DefaultAzureCredential();
29
29
  * const client = MapsSearch(credential, "<maps-account-client-id>");
@@ -38,9 +38,9 @@ export default function MapsSearch(credential: TokenCredential, mapsAccountClien
38
38
  * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.
39
39
  *
40
40
  * @example
41
- * ```ts
42
- * import MapsSearch from "@azure-rest/maps-search";
41
+ * ```ts snippet:ReadmeSampleCreateClient_SASToken
43
42
  * import { AzureSASCredential } from "@azure/core-auth";
43
+ * import MapsSearch from "@azure-rest/maps-search";
44
44
  *
45
45
  * const credential = new AzureSASCredential("<SAS Token>");
46
46
  * const client = MapsSearch(credential);
@@ -1 +1 @@
1
- {"version":3,"file":"MapsSearch.js","sourceRoot":"","sources":["../../src/MapsSearch.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AA6D5E,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAqE,EACrE,oBAA4C,EAAE,EAC9C,eAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CACvB,+BAA+B,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,sCAAsC;SAC/C,CAAC,CACH,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsSearchClient } from \"./generated/index.js\";\nimport createClient from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsSearchClient from a subscription key.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsSearch(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsSearch(credential, \"<maps-account-client-id>\");\n *```\n *\n * @param credential - An TokenCredential instance used to authenticate requests to the service\n * @param mapsAccountClientId - The Azure Maps client id of a specific map resource\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts\n * import MapsSearch from \"@azure-rest/maps-search\";\n * import { AzureSASCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsSearch(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsSearchClient;\nexport default function MapsSearch(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsSearchClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
1
+ {"version":3,"file":"MapsSearch.js","sourceRoot":"","sources":["../../src/MapsSearch.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AA6D5E,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAqE,EACrE,oBAA4C,EAAE,EAC9C,eAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CACvB,+BAA+B,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,sCAAsC;SAC/C,CAAC,CACH,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsSearchClient } from \"./generated/index.js\";\nimport createClient from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsSearchClient from a subscription key.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsSearch(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_TokenCredential\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsSearch(credential, \"<maps-account-client-id>\");\n *```\n *\n * @param credential - An TokenCredential instance used to authenticate requests to the service\n * @param mapsAccountClientId - The Azure Maps client id of a specific map resource\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SASToken\n * import { AzureSASCredential } from \"@azure/core-auth\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsSearch(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsSearchClient;\nexport default function MapsSearch(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsSearchClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@azure-rest/maps-search",
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
- "version": "2.0.0-alpha.20250212.1",
5
+ "version": "2.0.0-alpha.20250217.1",
6
6
  "description": "A generated SDK for MapsSearchClient.",
7
7
  "keywords": [
8
8
  "node",
@@ -53,7 +53,7 @@
53
53
  "unit-test": "npm run unit-test:node && npm run unit-test:browser",
54
54
  "unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
55
55
  "unit-test:node": "dev-tool run test:vitest",
56
- "update-snippets": "echo skipped"
56
+ "update-snippets": "dev-tool run update-snippets"
57
57
  },
58
58
  "sideEffects": false,
59
59
  "autoPublish": false,
@@ -61,7 +61,7 @@
61
61
  "@azure-rest/core-client": "^2.3.1",
62
62
  "@azure/core-auth": "^1.9.0",
63
63
  "@azure/core-lro": "^2.7.2",
64
- "@azure/core-rest-pipeline": "^1.18.0",
64
+ "@azure/core-rest-pipeline": "^1.19.0",
65
65
  "@azure/logger": "^1.1.4",
66
66
  "@azure/maps-common": "1.0.0-beta.2",
67
67
  "tslib": "^2.8.1"
@@ -70,19 +70,19 @@
70
70
  "@azure-tools/test-credential": "^2.0.0",
71
71
  "@azure-tools/test-recorder": ">=4.1.0-alpha <4.1.0-alphb",
72
72
  "@azure-tools/test-utils-vitest": ">=1.0.0-alpha <1.0.0-alphb",
73
- "@azure/core-util": "^1.9.0",
73
+ "@azure/core-util": "^1.11.0",
74
74
  "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
75
75
  "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
76
- "@azure/identity": "^4.5.0",
76
+ "@azure/identity": "^4.6.0",
77
77
  "@types/node": "^18.0.0",
78
- "@vitest/browser": "^3.0.3",
79
- "@vitest/coverage-istanbul": "^3.0.3",
78
+ "@vitest/browser": "^3.0.5",
79
+ "@vitest/coverage-istanbul": "^3.0.5",
80
80
  "autorest": "latest",
81
81
  "dotenv": "^16.0.0",
82
82
  "eslint": "^9.9.0",
83
- "playwright": "^1.49.0",
83
+ "playwright": "^1.50.1",
84
84
  "typescript": "~5.7.2",
85
- "vitest": "^3.0.3"
85
+ "vitest": "^3.0.5"
86
86
  },
87
87
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-search-rest/README.md",
88
88
  "//metadata": {
@@ -108,6 +108,7 @@
108
108
  },
109
109
  "type": "module",
110
110
  "tshy": {
111
+ "project": "./tsconfig.src.json",
111
112
  "exports": {
112
113
  "./package.json": "./package.json",
113
114
  ".": "./src/index.ts"
@@ -120,8 +121,7 @@
120
121
  "browser",
121
122
  "react-native"
122
123
  ],
123
- "selfLink": false,
124
- "project": "./tsconfig.src.json"
124
+ "selfLink": false
125
125
  },
126
126
  "exports": {
127
127
  "./package.json": "./package.json",
@@ -143,5 +143,6 @@
143
143
  "default": "./dist/commonjs/index.js"
144
144
  }
145
145
  }
146
- }
146
+ },
147
+ "react-native": "./dist/react-native/index.js"
147
148
  }