@azure-rest/maps-search 2.0.0-beta.2 → 2.0.0-beta.4
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/CHANGELOG.md +59 -0
- package/LICENSE +4 -4
- package/README.md +80 -90
- package/dist/browser/MapsSearch.d.ts +53 -0
- package/dist/browser/MapsSearch.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/MapsSearch.js +1 -1
- package/dist/browser/MapsSearch.js.map +1 -0
- package/dist/browser/generated/clientDefinitions.d.ts +137 -0
- package/dist/browser/generated/clientDefinitions.d.ts.map +1 -0
- package/dist/browser/generated/clientDefinitions.js +4 -0
- package/dist/browser/generated/clientDefinitions.js.map +1 -0
- package/dist/browser/generated/index.d.ts +10 -0
- package/dist/browser/generated/index.d.ts.map +1 -0
- package/dist/browser/generated/index.js +12 -0
- package/dist/browser/generated/index.js.map +1 -0
- package/dist/browser/generated/isUnexpected.d.ts +7 -0
- package/dist/browser/generated/isUnexpected.d.ts.map +1 -0
- package/dist/browser/generated/isUnexpected.js +74 -0
- package/dist/browser/generated/isUnexpected.js.map +1 -0
- package/dist/browser/generated/logger.d.ts +2 -0
- package/dist/browser/generated/logger.d.ts.map +1 -0
- package/dist/browser/generated/logger.js.map +1 -0
- package/dist/browser/generated/mapsSearchClient.d.ts +15 -0
- package/dist/browser/generated/mapsSearchClient.d.ts.map +1 -0
- package/dist/browser/generated/mapsSearchClient.js +44 -0
- package/dist/browser/generated/mapsSearchClient.js.map +1 -0
- package/dist/browser/generated/models.d.ts +97 -0
- package/dist/browser/generated/models.d.ts.map +1 -0
- package/dist/browser/generated/models.js +4 -0
- package/dist/browser/generated/models.js.map +1 -0
- package/dist/browser/generated/outputModels.d.ts +298 -0
- package/dist/browser/generated/outputModels.d.ts.map +1 -0
- package/dist/browser/generated/outputModels.js +4 -0
- package/dist/browser/generated/outputModels.js.map +1 -0
- package/dist/browser/generated/parameters.d.ts +135 -0
- package/dist/browser/generated/parameters.d.ts.map +1 -0
- package/dist/browser/generated/parameters.js +4 -0
- package/dist/browser/generated/parameters.js.map +1 -0
- package/dist/browser/generated/responses.d.ts +255 -0
- package/dist/browser/generated/responses.d.ts.map +1 -0
- package/dist/browser/generated/responses.js +4 -0
- package/dist/browser/generated/responses.js.map +1 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +6 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/logger.d.ts +2 -0
- package/dist/browser/logger.d.ts.map +1 -0
- package/dist/browser/logger.js +5 -0
- package/dist/browser/package.json +3 -0
- package/dist/commonjs/MapsSearch.d.ts +53 -0
- package/dist/commonjs/MapsSearch.d.ts.map +1 -0
- package/dist/commonjs/MapsSearch.js +44 -0
- package/dist/commonjs/MapsSearch.js.map +1 -0
- package/dist/commonjs/generated/clientDefinitions.d.ts +137 -0
- package/dist/commonjs/generated/clientDefinitions.d.ts.map +1 -0
- package/dist/commonjs/generated/clientDefinitions.js +5 -0
- package/dist/commonjs/generated/clientDefinitions.js.map +1 -0
- package/dist/commonjs/generated/index.d.ts +10 -0
- package/dist/commonjs/generated/index.d.ts.map +1 -0
- package/dist/commonjs/generated/index.js +15 -0
- package/dist/commonjs/generated/index.js.map +1 -0
- package/dist/commonjs/generated/isUnexpected.d.ts +7 -0
- package/dist/commonjs/generated/isUnexpected.d.ts.map +1 -0
- package/dist/commonjs/generated/isUnexpected.js +77 -0
- package/dist/commonjs/generated/isUnexpected.js.map +1 -0
- package/dist/commonjs/generated/logger.d.ts +2 -0
- package/dist/commonjs/generated/logger.d.ts.map +1 -0
- package/dist/commonjs/generated/logger.js +8 -0
- package/dist/commonjs/generated/logger.js.map +1 -0
- package/dist/commonjs/generated/mapsSearchClient.d.ts +15 -0
- package/dist/commonjs/generated/mapsSearchClient.d.ts.map +1 -0
- package/dist/commonjs/generated/mapsSearchClient.js +47 -0
- package/dist/commonjs/generated/mapsSearchClient.js.map +1 -0
- package/dist/commonjs/generated/models.d.ts +97 -0
- package/dist/commonjs/generated/models.d.ts.map +1 -0
- package/dist/commonjs/generated/models.js +5 -0
- package/dist/commonjs/generated/models.js.map +1 -0
- package/dist/commonjs/generated/outputModels.d.ts +298 -0
- package/dist/commonjs/generated/outputModels.d.ts.map +1 -0
- package/dist/commonjs/generated/outputModels.js +5 -0
- package/dist/commonjs/generated/outputModels.js.map +1 -0
- package/dist/commonjs/generated/parameters.d.ts +135 -0
- package/dist/commonjs/generated/parameters.d.ts.map +1 -0
- package/dist/commonjs/generated/parameters.js +5 -0
- package/dist/commonjs/generated/parameters.js.map +1 -0
- package/dist/commonjs/generated/responses.d.ts +255 -0
- package/dist/commonjs/generated/responses.d.ts.map +1 -0
- package/dist/commonjs/generated/responses.js +5 -0
- package/dist/commonjs/generated/responses.js.map +1 -0
- package/dist/commonjs/index.d.ts +4 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +9 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/logger.d.ts +2 -0
- package/dist/commonjs/logger.d.ts.map +1 -0
- package/dist/commonjs/logger.js +8 -0
- package/dist/commonjs/logger.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/esm/MapsSearch.d.ts +53 -0
- package/dist/esm/MapsSearch.d.ts.map +1 -0
- package/dist/esm/MapsSearch.js +40 -0
- package/dist/esm/MapsSearch.js.map +1 -0
- package/dist/esm/generated/clientDefinitions.d.ts +137 -0
- package/dist/esm/generated/clientDefinitions.d.ts.map +1 -0
- package/dist/esm/generated/clientDefinitions.js +4 -0
- package/dist/esm/generated/clientDefinitions.js.map +1 -0
- package/dist/esm/generated/index.d.ts +10 -0
- package/dist/esm/generated/index.d.ts.map +1 -0
- package/dist/esm/generated/index.js +12 -0
- package/dist/esm/generated/index.js.map +1 -0
- package/dist/esm/generated/isUnexpected.d.ts +7 -0
- package/dist/esm/generated/isUnexpected.d.ts.map +1 -0
- package/dist/esm/generated/isUnexpected.js +74 -0
- package/dist/esm/generated/isUnexpected.js.map +1 -0
- package/dist/esm/generated/logger.d.ts +2 -0
- package/dist/esm/generated/logger.d.ts.map +1 -0
- package/dist/esm/generated/logger.js +5 -0
- package/dist/esm/generated/logger.js.map +1 -0
- package/dist/esm/generated/mapsSearchClient.d.ts +15 -0
- package/dist/esm/generated/mapsSearchClient.d.ts.map +1 -0
- package/dist/esm/generated/mapsSearchClient.js +44 -0
- package/dist/esm/generated/mapsSearchClient.js.map +1 -0
- package/dist/esm/generated/models.d.ts +97 -0
- package/dist/esm/generated/models.d.ts.map +1 -0
- package/dist/esm/generated/models.js +4 -0
- package/dist/esm/generated/models.js.map +1 -0
- package/dist/esm/generated/outputModels.d.ts +298 -0
- package/dist/esm/generated/outputModels.d.ts.map +1 -0
- package/dist/esm/generated/outputModels.js +4 -0
- package/dist/esm/generated/outputModels.js.map +1 -0
- package/dist/esm/generated/parameters.d.ts +135 -0
- package/dist/esm/generated/parameters.d.ts.map +1 -0
- package/dist/esm/generated/parameters.js +4 -0
- package/dist/esm/generated/parameters.js.map +1 -0
- package/dist/esm/generated/responses.d.ts +255 -0
- package/dist/esm/generated/responses.d.ts.map +1 -0
- package/dist/esm/generated/responses.js +4 -0
- package/dist/esm/generated/responses.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.d.ts +2 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +5 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/react-native/MapsSearch.d.ts +53 -0
- package/dist/react-native/MapsSearch.d.ts.map +1 -0
- package/dist/react-native/MapsSearch.js +40 -0
- package/dist/react-native/MapsSearch.js.map +1 -0
- package/dist/react-native/generated/clientDefinitions.d.ts +137 -0
- package/dist/react-native/generated/clientDefinitions.d.ts.map +1 -0
- package/dist/react-native/generated/clientDefinitions.js +4 -0
- package/dist/react-native/generated/clientDefinitions.js.map +1 -0
- package/dist/react-native/generated/index.d.ts +10 -0
- package/dist/react-native/generated/index.d.ts.map +1 -0
- package/dist/react-native/generated/index.js +12 -0
- package/dist/react-native/generated/index.js.map +1 -0
- package/dist/react-native/generated/isUnexpected.d.ts +7 -0
- package/dist/react-native/generated/isUnexpected.d.ts.map +1 -0
- package/dist/react-native/generated/isUnexpected.js +74 -0
- package/dist/react-native/generated/isUnexpected.js.map +1 -0
- package/dist/react-native/generated/logger.d.ts +2 -0
- package/dist/react-native/generated/logger.d.ts.map +1 -0
- package/dist/react-native/generated/logger.js +5 -0
- package/dist/react-native/generated/logger.js.map +1 -0
- package/dist/react-native/generated/mapsSearchClient.d.ts +15 -0
- package/dist/react-native/generated/mapsSearchClient.d.ts.map +1 -0
- package/dist/react-native/generated/mapsSearchClient.js +44 -0
- package/dist/react-native/generated/mapsSearchClient.js.map +1 -0
- package/dist/react-native/generated/models.d.ts +97 -0
- package/dist/react-native/generated/models.d.ts.map +1 -0
- package/dist/react-native/generated/models.js +4 -0
- package/dist/react-native/generated/models.js.map +1 -0
- package/dist/react-native/generated/outputModels.d.ts +298 -0
- package/dist/react-native/generated/outputModels.d.ts.map +1 -0
- package/dist/react-native/generated/outputModels.js +4 -0
- package/dist/react-native/generated/outputModels.js.map +1 -0
- package/dist/react-native/generated/parameters.d.ts +135 -0
- package/dist/react-native/generated/parameters.d.ts.map +1 -0
- package/dist/react-native/generated/parameters.js +4 -0
- package/dist/react-native/generated/parameters.js.map +1 -0
- package/dist/react-native/generated/responses.d.ts +255 -0
- package/dist/react-native/generated/responses.d.ts.map +1 -0
- package/dist/react-native/generated/responses.js +4 -0
- package/dist/react-native/generated/responses.js.map +1 -0
- package/dist/react-native/index.d.ts +4 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +6 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/logger.d.ts +2 -0
- package/dist/react-native/logger.d.ts.map +1 -0
- package/dist/react-native/logger.js +5 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/package.json +88 -74
- package/dist/index.js +0 -171
- package/dist/index.js.map +0 -1
- package/dist-esm/src/MapsSearch.js.map +0 -1
- package/dist-esm/src/index.js +0 -6
- package/dist-esm/src/index.js.map +0 -1
- package/types/maps-search-rest.d.ts +0 -1066
- /package/{dist-esm/src → dist/browser/generated}/logger.js +0 -0
- /package/{dist-esm/src → dist/browser}/logger.js.map +0 -0
- /package/review/{maps-search.api.md → maps-search-node.api.md} +0 -0
package/dist/index.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var coreAuth = require('@azure/core-auth');
|
|
6
|
-
var mapsCommon = require('@azure/maps-common');
|
|
7
|
-
var tslib = require('tslib');
|
|
8
|
-
var coreClient = require('@azure-rest/core-client');
|
|
9
|
-
var logger$1 = require('@azure/logger');
|
|
10
|
-
var coreRestPipeline = require('@azure/core-rest-pipeline');
|
|
11
|
-
|
|
12
|
-
// Copyright (c) Microsoft Corporation.
|
|
13
|
-
// Licensed under the MIT License.
|
|
14
|
-
const logger = logger$1.createClientLogger("maps-search");
|
|
15
|
-
|
|
16
|
-
// Copyright (c) Microsoft Corporation.
|
|
17
|
-
// Licensed under the MIT License.
|
|
18
|
-
/**
|
|
19
|
-
* Initialize a new instance of `MapsSearchClient`
|
|
20
|
-
* @param credentials - uniquely identify client credential
|
|
21
|
-
* @param options - the parameter for all optional parameters
|
|
22
|
-
*/
|
|
23
|
-
function createClient(credentials, _a = {}) {
|
|
24
|
-
var _b, _c, _d, _e, _f, _g;
|
|
25
|
-
var { apiVersion = "2023-06-01" } = _a, options = tslib.__rest(_a, ["apiVersion"]);
|
|
26
|
-
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `https://atlas.microsoft.com`;
|
|
27
|
-
const userAgentInfo = `azsdk-js-maps-search-rest/2.0.0-beta.2`;
|
|
28
|
-
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
29
|
-
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
30
|
-
: `${userAgentInfo}`;
|
|
31
|
-
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
32
|
-
userAgentPrefix,
|
|
33
|
-
}, loggingOptions: {
|
|
34
|
-
logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info,
|
|
35
|
-
}, credentials: {
|
|
36
|
-
apiKeyHeaderName: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.apiKeyHeaderName) !== null && _g !== void 0 ? _g : "subscription-key",
|
|
37
|
-
} });
|
|
38
|
-
const client = coreClient.getClient(endpointUrl, credentials, options);
|
|
39
|
-
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
40
|
-
client.pipeline.addPolicy({
|
|
41
|
-
name: "ClientApiVersionPolicy",
|
|
42
|
-
sendRequest: (req, next) => {
|
|
43
|
-
// Use the apiVersion defined in request url directly
|
|
44
|
-
// Append one if there is no apiVersion and we have one at client options
|
|
45
|
-
const url = new URL(req.url);
|
|
46
|
-
if (!url.searchParams.get("api-version") && apiVersion) {
|
|
47
|
-
req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
|
|
48
|
-
}
|
|
49
|
-
return next(req);
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
return client;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Copyright (c) Microsoft Corporation.
|
|
56
|
-
// Licensed under the MIT License.
|
|
57
|
-
const responseMap = {
|
|
58
|
-
"GET /geocode": ["200"],
|
|
59
|
-
"POST /geocode:batch": ["200"],
|
|
60
|
-
"GET /search/polygon": ["200"],
|
|
61
|
-
"GET /reverseGeocode": ["200"],
|
|
62
|
-
"POST /reverseGeocode:batch": ["200"],
|
|
63
|
-
};
|
|
64
|
-
function isUnexpected(response) {
|
|
65
|
-
const lroOriginal = response.headers["x-ms-original-url"];
|
|
66
|
-
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
|
|
67
|
-
const method = response.request.method;
|
|
68
|
-
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
69
|
-
if (!pathDetails) {
|
|
70
|
-
pathDetails = getParametrizedPathSuccess(method, url.pathname);
|
|
71
|
-
}
|
|
72
|
-
return !pathDetails.includes(response.status);
|
|
73
|
-
}
|
|
74
|
-
function getParametrizedPathSuccess(method, path) {
|
|
75
|
-
var _a, _b, _c, _d;
|
|
76
|
-
const pathParts = path.split("/");
|
|
77
|
-
// Traverse list to match the longest candidate
|
|
78
|
-
// matchedLen: the length of candidate path
|
|
79
|
-
// matchedValue: the matched status code array
|
|
80
|
-
let matchedLen = -1, matchedValue = [];
|
|
81
|
-
// Iterate the responseMap to find a match
|
|
82
|
-
for (const [key, value] of Object.entries(responseMap)) {
|
|
83
|
-
// Extracting the path from the map key which is in format
|
|
84
|
-
// GET /path/foo
|
|
85
|
-
if (!key.startsWith(method)) {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
const candidatePath = getPathFromMapKey(key);
|
|
89
|
-
// Get each part of the url path
|
|
90
|
-
const candidateParts = candidatePath.split("/");
|
|
91
|
-
// track if we have found a match to return the values found.
|
|
92
|
-
let found = true;
|
|
93
|
-
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
94
|
-
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) &&
|
|
95
|
-
((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
|
|
96
|
-
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
|
|
97
|
-
// If the current part of the candidate is a "template" part
|
|
98
|
-
// Try to use the suffix of pattern to match the path
|
|
99
|
-
// {guid} ==> $
|
|
100
|
-
// {guid}:export ==> :export$
|
|
101
|
-
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
|
|
102
|
-
if (!isMatched) {
|
|
103
|
-
found = false;
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
// If the candidate part is not a template and
|
|
109
|
-
// the parts don't match mark the candidate as not found
|
|
110
|
-
// to move on with the next candidate path.
|
|
111
|
-
if (candidateParts[i] !== pathParts[j]) {
|
|
112
|
-
found = false;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
// We finished evaluating the current candidate parts
|
|
117
|
-
// Update the matched value if and only if we found the longer pattern
|
|
118
|
-
if (found && candidatePath.length > matchedLen) {
|
|
119
|
-
matchedLen = candidatePath.length;
|
|
120
|
-
matchedValue = value;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return matchedValue;
|
|
124
|
-
}
|
|
125
|
-
function getPathFromMapKey(mapKey) {
|
|
126
|
-
const pathStart = mapKey.indexOf("/");
|
|
127
|
-
return mapKey.slice(pathStart);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Copyright (c) Microsoft Corporation.
|
|
131
|
-
// Licensed under the MIT License.
|
|
132
|
-
function MapsSearch(credential, clientIdOrOptions = {}, maybeOptions = {}) {
|
|
133
|
-
const options = typeof clientIdOrOptions === "string" ? maybeOptions : clientIdOrOptions;
|
|
134
|
-
/**
|
|
135
|
-
* maps service requires a header "ms-x-client-id", which is different from the standard Microsoft Entra ID.
|
|
136
|
-
* So we need to do our own implementation.
|
|
137
|
-
* This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication
|
|
138
|
-
*/
|
|
139
|
-
if (coreAuth.isTokenCredential(credential)) {
|
|
140
|
-
const clientId = typeof clientIdOrOptions === "string" ? clientIdOrOptions : "";
|
|
141
|
-
if (!clientId) {
|
|
142
|
-
throw Error("Client id is needed for TokenCredential");
|
|
143
|
-
}
|
|
144
|
-
const client = createClient(undefined, options);
|
|
145
|
-
client.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
146
|
-
credential,
|
|
147
|
-
scopes: "https://atlas.microsoft.com/.default",
|
|
148
|
-
}));
|
|
149
|
-
client.pipeline.addPolicy(mapsCommon.createMapsClientIdPolicy(clientId));
|
|
150
|
-
return client;
|
|
151
|
-
}
|
|
152
|
-
if (coreAuth.isSASCredential(credential)) {
|
|
153
|
-
const client = createClient(undefined, options);
|
|
154
|
-
client.pipeline.addPolicy({
|
|
155
|
-
name: "mapsSASCredentialPolicy",
|
|
156
|
-
async sendRequest(request, next) {
|
|
157
|
-
request.headers.set("Authorization", `jwt-sas ${credential.signature}`);
|
|
158
|
-
return next(request);
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
return client;
|
|
162
|
-
}
|
|
163
|
-
return createClient(credential, options);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Copyright (c) Microsoft Corporation.
|
|
167
|
-
// Licensed under the MIT License.
|
|
168
|
-
|
|
169
|
-
exports.default = MapsSearch;
|
|
170
|
-
exports.isUnexpected = isUnexpected;
|
|
171
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../generated/logger.ts","../generated/mapsSearchClient.ts","../generated/isUnexpected.ts","../src/MapsSearch.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"maps-search\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { MapsSearchClient } from \"./clientDefinitions\";\n\n/** The optional parameters for the client */\nexport interface MapsSearchClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `MapsSearchClient`\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n credentials: KeyCredential,\n { apiVersion = \"2023-06-01\", ...options }: MapsSearchClientOptions = {},\n): MapsSearchClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `https://atlas.microsoft.com`;\n const userAgentInfo = `azsdk-js-maps-search-rest/2.0.0-beta.2`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n apiKeyHeaderName:\n options.credentials?.apiKeyHeaderName ?? \"subscription-key\",\n },\n };\n const client = getClient(\n endpointUrl,\n credentials,\n options,\n ) as MapsSearchClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n SearchGetGeocoding200Response,\n SearchGetGeocodingDefaultResponse,\n SearchGetGeocodingBatch200Response,\n SearchGetGeocodingBatchDefaultResponse,\n SearchGetPolygon200Response,\n SearchGetPolygonDefaultResponse,\n SearchGetReverseGeocoding200Response,\n SearchGetReverseGeocodingDefaultResponse,\n SearchGetReverseGeocodingBatch200Response,\n SearchGetReverseGeocodingBatchDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /geocode\": [\"200\"],\n \"POST /geocode:batch\": [\"200\"],\n \"GET /search/polygon\": [\"200\"],\n \"GET /reverseGeocode\": [\"200\"],\n \"POST /reverseGeocode:batch\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: SearchGetGeocoding200Response | SearchGetGeocodingDefaultResponse,\n): response is SearchGetGeocodingDefaultResponse;\nexport function isUnexpected(\n response:\n | SearchGetGeocodingBatch200Response\n | SearchGetGeocodingBatchDefaultResponse,\n): response is SearchGetGeocodingBatchDefaultResponse;\nexport function isUnexpected(\n response: SearchGetPolygon200Response | SearchGetPolygonDefaultResponse,\n): response is SearchGetPolygonDefaultResponse;\nexport function isUnexpected(\n response:\n | SearchGetReverseGeocoding200Response\n | SearchGetReverseGeocodingDefaultResponse,\n): response is SearchGetReverseGeocodingDefaultResponse;\nexport function isUnexpected(\n response:\n | SearchGetReverseGeocodingBatch200Response\n | SearchGetReverseGeocodingBatchDefaultResponse,\n): response is SearchGetReverseGeocodingBatchDefaultResponse;\nexport function isUnexpected(\n response:\n | SearchGetGeocoding200Response\n | SearchGetGeocodingDefaultResponse\n | SearchGetGeocodingBatch200Response\n | SearchGetGeocodingBatchDefaultResponse\n | SearchGetPolygon200Response\n | SearchGetPolygonDefaultResponse\n | SearchGetReverseGeocoding200Response\n | SearchGetReverseGeocodingDefaultResponse\n | SearchGetReverseGeocodingBatch200Response\n | SearchGetReverseGeocodingBatchDefaultResponse,\n): response is\n | SearchGetGeocodingDefaultResponse\n | SearchGetGeocodingBatchDefaultResponse\n | SearchGetPolygonDefaultResponse\n | SearchGetReverseGeocodingDefaultResponse\n | SearchGetReverseGeocodingBatchDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (\n let i = candidateParts.length - 1, j = pathParts.length - 1;\n i >= 1 && j >= 1;\n i--, j--\n ) {\n if (\n candidateParts[i]?.startsWith(\"{\") &&\n candidateParts[i]?.indexOf(\"}\") !== -1\n ) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(\n `${candidateParts[i]?.slice(start, end)}`,\n ).test(pathParts[j] || \"\");\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// 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\";\nimport createClient from \"../generated\";\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","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport MapsSearch from \"./MapsSearch\";\n\nexport * from \"../generated\";\nexport default MapsSearch;\n"],"names":["createClientLogger","__rest","getClient","isTokenCredential","bearerTokenAuthenticationPolicy","createMapsClientIdPolicy","isSASCredential"],"mappings":";;;;;;;;;;;AAAA;AACA;AAGO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,aAAa,CAAC;;ACJvD;AACA;AAaA;;;;AAIG;AACqB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,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\";\nimport createClient from \"../generated\";\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"]}
|
package/dist-esm/src/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,cAAc,cAAc,CAAC;AAC7B,eAAe,UAAU,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport MapsSearch from \"./MapsSearch\";\n\nexport * from \"../generated\";\nexport default MapsSearch;\n"]}
|