@azure-rest/maps-geolocation 1.0.0-beta.5 → 1.0.0-beta.6
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 +45 -0
- package/dist/browser/generated/isUnexpected.js +5 -6
- package/dist/browser/generated/isUnexpected.js.map +1 -1
- package/dist/browser/generated/mapsGeolocationClient.js +13 -11
- package/dist/browser/generated/mapsGeolocationClient.js.map +1 -1
- package/dist/commonjs/generated/isUnexpected.js +5 -6
- package/dist/commonjs/generated/isUnexpected.js.map +1 -1
- package/dist/commonjs/generated/mapsGeolocationClient.js +13 -11
- package/dist/commonjs/generated/mapsGeolocationClient.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/esm/generated/isUnexpected.js +5 -6
- package/dist/esm/generated/isUnexpected.js.map +1 -1
- package/dist/esm/generated/mapsGeolocationClient.js +13 -11
- package/dist/esm/generated/mapsGeolocationClient.js.map +1 -1
- package/dist/react-native/generated/isUnexpected.js +5 -6
- package/dist/react-native/generated/isUnexpected.js.map +1 -1
- package/dist/react-native/generated/mapsGeolocationClient.js +13 -11
- package/dist/react-native/generated/mapsGeolocationClient.js.map +1 -1
- package/package.json +39 -43
- package/review/maps-geolocation-node.api.md +112 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Release History
|
|
2
|
+
|
|
3
|
+
## 1.0.0-beta.6 (Unreleased)
|
|
4
|
+
|
|
5
|
+
### Features Added
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
### Bugs Fixed
|
|
10
|
+
|
|
11
|
+
### Other Changes
|
|
12
|
+
|
|
13
|
+
## 1.0.0-beta.5 (2025-03-14)
|
|
14
|
+
|
|
15
|
+
### Bugs Fixed
|
|
16
|
+
|
|
17
|
+
- Fix ESM module file not found.
|
|
18
|
+
|
|
19
|
+
## 1.0.0-beta.4 (2024-12-10)
|
|
20
|
+
|
|
21
|
+
### Breaking Changes
|
|
22
|
+
|
|
23
|
+
- Marked fields in various interfaces as readonly, which may impact code that previously modified these properties.
|
|
24
|
+
|
|
25
|
+
### Bugs Fixed
|
|
26
|
+
|
|
27
|
+
- Fix the Microsoft Entra ID authentication when providing `baseUrl`.
|
|
28
|
+
|
|
29
|
+
## 1.0.0-beta.3 (2024-01-09)
|
|
30
|
+
|
|
31
|
+
### Features Added
|
|
32
|
+
|
|
33
|
+
- Support SAS token authentication.
|
|
34
|
+
|
|
35
|
+
## 1.0.0-beta.2 (2023-07-11)
|
|
36
|
+
|
|
37
|
+
### Other Changes
|
|
38
|
+
|
|
39
|
+
- Update README.
|
|
40
|
+
|
|
41
|
+
## 1.0.0-beta.1 (2023-01-10)
|
|
42
|
+
|
|
43
|
+
### Features Added
|
|
44
|
+
|
|
45
|
+
- Initial Release
|
|
@@ -5,7 +5,7 @@ const responseMap = {
|
|
|
5
5
|
};
|
|
6
6
|
export function isUnexpected(response) {
|
|
7
7
|
const lroOriginal = response.headers["x-ms-original-url"];
|
|
8
|
-
const url = new URL(lroOriginal
|
|
8
|
+
const url = new URL(lroOriginal ?? response.request.url);
|
|
9
9
|
const method = response.request.method;
|
|
10
10
|
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
11
11
|
if (!pathDetails) {
|
|
@@ -14,7 +14,6 @@ export function isUnexpected(response) {
|
|
|
14
14
|
return !pathDetails.includes(response.status);
|
|
15
15
|
}
|
|
16
16
|
function getParametrizedPathSuccess(method, path) {
|
|
17
|
-
var _a, _b, _c, _d;
|
|
18
17
|
const pathParts = path.split("/");
|
|
19
18
|
// Traverse list to match the longest candidate
|
|
20
19
|
// matchedLen: the length of candidate path
|
|
@@ -33,14 +32,14 @@ function getParametrizedPathSuccess(method, path) {
|
|
|
33
32
|
// track if we have found a match to return the values found.
|
|
34
33
|
let found = true;
|
|
35
34
|
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
const start = candidateParts[i].indexOf("}") + 1, end =
|
|
35
|
+
if (candidateParts[i]?.startsWith("{") &&
|
|
36
|
+
candidateParts[i]?.indexOf("}") !== -1) {
|
|
37
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
39
38
|
// If the current part of the candidate is a "template" part
|
|
40
39
|
// Try to use the suffix of pattern to match the path
|
|
41
40
|
// {guid} ==> $
|
|
42
41
|
// {guid}:export ==> :export$
|
|
43
|
-
const isMatched = new RegExp(`${
|
|
42
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
44
43
|
if (!isMatched) {
|
|
45
44
|
found = false;
|
|
46
45
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../src/generated/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,MAAM,WAAW,GAA6B;IAC5C,8BAA8B,EAAE,CAAC,KAAK,CAAC;CACxC,CAAC;AAOF,MAAM,UAAU,YAAY,CAC1B,QAEyC;IAEzC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../src/generated/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,MAAM,WAAW,GAA6B;IAC5C,8BAA8B,EAAE,CAAC,KAAK,CAAC;CACxC,CAAC;AAOF,MAAM,UAAU,YAAY,CAC1B,QAEyC;IAEzC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,IAAI,QAAQ,CAAC,OAAO,C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AAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n GeolocationGetLocation200Response,\n GeolocationGetLocationDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /geolocation/ip/{format}\": [\"200\"],\n};\n\nexport function isUnexpected(\n response:\n | GeolocationGetLocation200Response\n | GeolocationGetLocationDefaultResponse,\n): response is GeolocationGetLocationDefaultResponse;\nexport function isUnexpected(\n response:\n | GeolocationGetLocation200Response\n | GeolocationGetLocationDefaultResponse,\n): response is GeolocationGetLocationDefaultResponse {\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"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __rest } from "tslib";
|
|
4
3
|
import { getClient } from "@azure-rest/core-client";
|
|
5
4
|
import { logger } from "./logger.js";
|
|
6
5
|
/**
|
|
@@ -8,21 +7,24 @@ import { logger } from "./logger.js";
|
|
|
8
7
|
* @param credentials - uniquely identify client credential
|
|
9
8
|
* @param options - the parameter for all optional parameters
|
|
10
9
|
*/
|
|
11
|
-
export default function createClient(credentials,
|
|
12
|
-
|
|
13
|
-
var { apiVersion = "1.0" } = _a, options = __rest(_a, ["apiVersion"]);
|
|
14
|
-
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `https://atlas.microsoft.com`;
|
|
10
|
+
export default function createClient(credentials, { apiVersion = "1.0", ...options } = {}) {
|
|
11
|
+
const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://atlas.microsoft.com`;
|
|
15
12
|
const userAgentInfo = `azsdk-js-maps-geolocation-rest/1.0.0-beta.4`;
|
|
16
13
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
17
14
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
18
15
|
: `${userAgentInfo}`;
|
|
19
|
-
options =
|
|
16
|
+
options = {
|
|
17
|
+
...options,
|
|
18
|
+
userAgentOptions: {
|
|
20
19
|
userAgentPrefix,
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
},
|
|
21
|
+
loggingOptions: {
|
|
22
|
+
logger: options.loggingOptions?.logger ?? logger.info,
|
|
23
|
+
},
|
|
24
|
+
credentials: {
|
|
25
|
+
apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "subscription-key",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
26
28
|
const client = getClient(endpointUrl, credentials, options);
|
|
27
29
|
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
28
30
|
client.pipeline.addPolicy({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapsGeolocationClient.js","sourceRoot":"","sources":["../../../src/generated/mapsGeolocationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"mapsGeolocationClient.js","sourceRoot":"","sources":["../../../src/generated/mapsGeolocationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,WAA0B,EAC1B,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,OAAO,KAAmC,EAAE;IAErE,MAAM,WAAW,GACf,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,6BAA6B,CAAC;IACvE,MAAM,aAAa,GAAG,6CAA6C,CAAC;IACpE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,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\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { MapsGeolocationClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface MapsGeolocationClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `MapsGeolocationClient`\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 = \"1.0\", ...options }: MapsGeolocationClientOptions = {},\n): MapsGeolocationClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `https://atlas.microsoft.com`;\n const userAgentInfo = `azsdk-js-maps-geolocation-rest/1.0.0-beta.4`;\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 MapsGeolocationClient;\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"]}
|
|
@@ -8,7 +8,7 @@ const responseMap = {
|
|
|
8
8
|
};
|
|
9
9
|
function isUnexpected(response) {
|
|
10
10
|
const lroOriginal = response.headers["x-ms-original-url"];
|
|
11
|
-
const url = new URL(lroOriginal
|
|
11
|
+
const url = new URL(lroOriginal ?? response.request.url);
|
|
12
12
|
const method = response.request.method;
|
|
13
13
|
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
14
14
|
if (!pathDetails) {
|
|
@@ -17,7 +17,6 @@ function isUnexpected(response) {
|
|
|
17
17
|
return !pathDetails.includes(response.status);
|
|
18
18
|
}
|
|
19
19
|
function getParametrizedPathSuccess(method, path) {
|
|
20
|
-
var _a, _b, _c, _d;
|
|
21
20
|
const pathParts = path.split("/");
|
|
22
21
|
// Traverse list to match the longest candidate
|
|
23
22
|
// matchedLen: the length of candidate path
|
|
@@ -36,14 +35,14 @@ function getParametrizedPathSuccess(method, path) {
|
|
|
36
35
|
// track if we have found a match to return the values found.
|
|
37
36
|
let found = true;
|
|
38
37
|
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
const start = candidateParts[i].indexOf("}") + 1, end =
|
|
38
|
+
if (candidateParts[i]?.startsWith("{") &&
|
|
39
|
+
candidateParts[i]?.indexOf("}") !== -1) {
|
|
40
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
42
41
|
// If the current part of the candidate is a "template" part
|
|
43
42
|
// Try to use the suffix of pattern to match the path
|
|
44
43
|
// {guid} ==> $
|
|
45
44
|
// {guid}:export ==> :export$
|
|
46
|
-
const isMatched = new RegExp(`${
|
|
45
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
47
46
|
if (!isMatched) {
|
|
48
47
|
found = false;
|
|
49
48
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../src/generated/isUnexpected.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAgBlC,oCAaC;AAtB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;oBACf,KAAK,GAAG,KAAK,CAAC;oBACd,MAAM;gBACR,CAAC;gBACD,SAAS;YACX,CAAC;YAED,8CAA8C;YAC9C,wDAAwD;YACxD,2CAA2C;YAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n GeolocationGetLocation200Response,\n GeolocationGetLocationDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /geolocation/ip/{format}\": [\"200\"],\n};\n\nexport function isUnexpected(\n response:\n | GeolocationGetLocation200Response\n | GeolocationGetLocationDefaultResponse,\n): response is GeolocationGetLocationDefaultResponse;\nexport function isUnexpected(\n response:\n | GeolocationGetLocation200Response\n | GeolocationGetLocationDefaultResponse,\n): response is GeolocationGetLocationDefaultResponse {\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"]}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.default = createClient;
|
|
6
|
-
const tslib_1 = require("tslib");
|
|
7
6
|
const core_client_1 = require("@azure-rest/core-client");
|
|
8
7
|
const logger_js_1 = require("./logger.js");
|
|
9
8
|
/**
|
|
@@ -11,21 +10,24 @@ const logger_js_1 = require("./logger.js");
|
|
|
11
10
|
* @param credentials - uniquely identify client credential
|
|
12
11
|
* @param options - the parameter for all optional parameters
|
|
13
12
|
*/
|
|
14
|
-
function createClient(credentials,
|
|
15
|
-
|
|
16
|
-
var { apiVersion = "1.0" } = _a, options = tslib_1.__rest(_a, ["apiVersion"]);
|
|
17
|
-
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `https://atlas.microsoft.com`;
|
|
13
|
+
function createClient(credentials, { apiVersion = "1.0", ...options } = {}) {
|
|
14
|
+
const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://atlas.microsoft.com`;
|
|
18
15
|
const userAgentInfo = `azsdk-js-maps-geolocation-rest/1.0.0-beta.4`;
|
|
19
16
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
20
17
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
21
18
|
: `${userAgentInfo}`;
|
|
22
|
-
options =
|
|
19
|
+
options = {
|
|
20
|
+
...options,
|
|
21
|
+
userAgentOptions: {
|
|
23
22
|
userAgentPrefix,
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
},
|
|
24
|
+
loggingOptions: {
|
|
25
|
+
logger: options.loggingOptions?.logger ?? logger_js_1.logger.info,
|
|
26
|
+
},
|
|
27
|
+
credentials: {
|
|
28
|
+
apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "subscription-key",
|
|
29
|
+
},
|
|
30
|
+
};
|
|
29
31
|
const client = (0, core_client_1.getClient)(endpointUrl, credentials, options);
|
|
30
32
|
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
31
33
|
client.pipeline.addPolicy({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapsGeolocationClient.js","sourceRoot":"","sources":["../../../src/generated/mapsGeolocationClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAkBlC,+BAgDC
|
|
1
|
+
{"version":3,"file":"mapsGeolocationClient.js","sourceRoot":"","sources":["../../../src/generated/mapsGeolocationClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAkBlC,+BAgDC;AAhED,yDAAmE;AACnE,2CAAqC;AAUrC;;;;GAIG;AACH,SAAwB,YAAY,CAClC,WAA0B,EAC1B,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,OAAO,KAAmC,EAAE;IAErE,MAAM,WAAW,GACf,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,6BAA6B,CAAC;IACvE,MAAM,aAAa,GAAG,6CAA6C,CAAC;IACpE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,GAAG;QACR,GAAG,OAAO;QACV,gBAAgB,EAAE;YAChB,eAAe;SAChB;QACD,cAAc,EAAE;YACd,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,IAAI,kBAAM,CAAC,IAAI;SACtD;QACD,WAAW,EAAE;YACX,gBAAgB,EACd,OAAO,CAAC,WAAW,EAAE,gBAAgB,IAAI,kBAAkB;SAC9D;KACF,CAAC;IACF,MAAM,MAAM,GAAG,IAAA,uBAAS,EACtB,WAAW,EACX,WAAW,EACX,OAAO,CACiB,CAAC;IAE3B,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { MapsGeolocationClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface MapsGeolocationClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `MapsGeolocationClient`\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 = \"1.0\", ...options }: MapsGeolocationClientOptions = {},\n): MapsGeolocationClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `https://atlas.microsoft.com`;\n const userAgentInfo = `azsdk-js-maps-geolocation-rest/1.0.0-beta.4`;\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 MapsGeolocationClient;\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"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.52.10"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -5,7 +5,7 @@ const responseMap = {
|
|
|
5
5
|
};
|
|
6
6
|
export function isUnexpected(response) {
|
|
7
7
|
const lroOriginal = response.headers["x-ms-original-url"];
|
|
8
|
-
const url = new URL(lroOriginal
|
|
8
|
+
const url = new URL(lroOriginal ?? response.request.url);
|
|
9
9
|
const method = response.request.method;
|
|
10
10
|
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
11
11
|
if (!pathDetails) {
|
|
@@ -14,7 +14,6 @@ export function isUnexpected(response) {
|
|
|
14
14
|
return !pathDetails.includes(response.status);
|
|
15
15
|
}
|
|
16
16
|
function getParametrizedPathSuccess(method, path) {
|
|
17
|
-
var _a, _b, _c, _d;
|
|
18
17
|
const pathParts = path.split("/");
|
|
19
18
|
// Traverse list to match the longest candidate
|
|
20
19
|
// matchedLen: the length of candidate path
|
|
@@ -33,14 +32,14 @@ function getParametrizedPathSuccess(method, path) {
|
|
|
33
32
|
// track if we have found a match to return the values found.
|
|
34
33
|
let found = true;
|
|
35
34
|
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
const start = candidateParts[i].indexOf("}") + 1, end =
|
|
35
|
+
if (candidateParts[i]?.startsWith("{") &&
|
|
36
|
+
candidateParts[i]?.indexOf("}") !== -1) {
|
|
37
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
39
38
|
// If the current part of the candidate is a "template" part
|
|
40
39
|
// Try to use the suffix of pattern to match the path
|
|
41
40
|
// {guid} ==> $
|
|
42
41
|
// {guid}:export ==> :export$
|
|
43
|
-
const isMatched = new RegExp(`${
|
|
42
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
44
43
|
if (!isMatched) {
|
|
45
44
|
found = false;
|
|
46
45
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../src/generated/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,MAAM,WAAW,GAA6B;I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;oBACd,MAAM;gBACR,CAAC;gBACD,SAAS;YACX,CAAC;YAED,8CAA8C;YAC9C,wDAAwD;YACxD,2CAA2C;YAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n GeolocationGetLocation200Response,\n GeolocationGetLocationDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /geolocation/ip/{format}\": [\"200\"],\n};\n\nexport function isUnexpected(\n response:\n | GeolocationGetLocation200Response\n | GeolocationGetLocationDefaultResponse,\n): response is GeolocationGetLocationDefaultResponse;\nexport function isUnexpected(\n response:\n | GeolocationGetLocation200Response\n | GeolocationGetLocationDefaultResponse,\n): response is GeolocationGetLocationDefaultResponse {\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"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __rest } from "tslib";
|
|
4
3
|
import { getClient } from "@azure-rest/core-client";
|
|
5
4
|
import { logger } from "./logger.js";
|
|
6
5
|
/**
|
|
@@ -8,21 +7,24 @@ import { logger } from "./logger.js";
|
|
|
8
7
|
* @param credentials - uniquely identify client credential
|
|
9
8
|
* @param options - the parameter for all optional parameters
|
|
10
9
|
*/
|
|
11
|
-
export default function createClient(credentials,
|
|
12
|
-
|
|
13
|
-
var { apiVersion = "1.0" } = _a, options = __rest(_a, ["apiVersion"]);
|
|
14
|
-
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `https://atlas.microsoft.com`;
|
|
10
|
+
export default function createClient(credentials, { apiVersion = "1.0", ...options } = {}) {
|
|
11
|
+
const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://atlas.microsoft.com`;
|
|
15
12
|
const userAgentInfo = `azsdk-js-maps-geolocation-rest/1.0.0-beta.4`;
|
|
16
13
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
17
14
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
18
15
|
: `${userAgentInfo}`;
|
|
19
|
-
options =
|
|
16
|
+
options = {
|
|
17
|
+
...options,
|
|
18
|
+
userAgentOptions: {
|
|
20
19
|
userAgentPrefix,
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
},
|
|
21
|
+
loggingOptions: {
|
|
22
|
+
logger: options.loggingOptions?.logger ?? logger.info,
|
|
23
|
+
},
|
|
24
|
+
credentials: {
|
|
25
|
+
apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "subscription-key",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
26
28
|
const client = getClient(endpointUrl, credentials, options);
|
|
27
29
|
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
28
30
|
client.pipeline.addPolicy({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapsGeolocationClient.js","sourceRoot":"","sources":["../../../src/generated/mapsGeolocationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"mapsGeolocationClient.js","sourceRoot":"","sources":["../../../src/generated/mapsGeolocationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,WAA0B,EAC1B,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,OAAO,KAAmC,EAAE;IAErE,MAAM,WAAW,GACf,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,6BAA6B,CAAC;IACvE,MAAM,aAAa,GAAG,6CAA6C,CAAC;IACpE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,GAAG;QACR,GAAG,OAAO;QACV,gBAAgB,EAAE;YAChB,eAAe;SAChB;QACD,cAAc,EAAE;YACd,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,IAAI,MAAM,CAAC,IAAI;SACtD;QACD,WAAW,EAAE;YACX,gBAAgB,EACd,OAAO,CAAC,WAAW,EAAE,gBAAgB,IAAI,kBAAkB;SAC9D;KACF,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CACtB,WAAW,EACX,WAAW,EACX,OAAO,CACiB,CAAC;IAE3B,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { MapsGeolocationClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface MapsGeolocationClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `MapsGeolocationClient`\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 = \"1.0\", ...options }: MapsGeolocationClientOptions = {},\n): MapsGeolocationClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `https://atlas.microsoft.com`;\n const userAgentInfo = `azsdk-js-maps-geolocation-rest/1.0.0-beta.4`;\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 MapsGeolocationClient;\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"]}
|
|
@@ -5,7 +5,7 @@ const responseMap = {
|
|
|
5
5
|
};
|
|
6
6
|
export function isUnexpected(response) {
|
|
7
7
|
const lroOriginal = response.headers["x-ms-original-url"];
|
|
8
|
-
const url = new URL(lroOriginal
|
|
8
|
+
const url = new URL(lroOriginal ?? response.request.url);
|
|
9
9
|
const method = response.request.method;
|
|
10
10
|
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
11
11
|
if (!pathDetails) {
|
|
@@ -14,7 +14,6 @@ export function isUnexpected(response) {
|
|
|
14
14
|
return !pathDetails.includes(response.status);
|
|
15
15
|
}
|
|
16
16
|
function getParametrizedPathSuccess(method, path) {
|
|
17
|
-
var _a, _b, _c, _d;
|
|
18
17
|
const pathParts = path.split("/");
|
|
19
18
|
// Traverse list to match the longest candidate
|
|
20
19
|
// matchedLen: the length of candidate path
|
|
@@ -33,14 +32,14 @@ function getParametrizedPathSuccess(method, path) {
|
|
|
33
32
|
// track if we have found a match to return the values found.
|
|
34
33
|
let found = true;
|
|
35
34
|
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
const start = candidateParts[i].indexOf("}") + 1, end =
|
|
35
|
+
if (candidateParts[i]?.startsWith("{") &&
|
|
36
|
+
candidateParts[i]?.indexOf("}") !== -1) {
|
|
37
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
39
38
|
// If the current part of the candidate is a "template" part
|
|
40
39
|
// Try to use the suffix of pattern to match the path
|
|
41
40
|
// {guid} ==> $
|
|
42
41
|
// {guid}:export ==> :export$
|
|
43
|
-
const isMatched = new RegExp(`${
|
|
42
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
44
43
|
if (!isMatched) {
|
|
45
44
|
found = false;
|
|
46
45
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../src/generated/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,MAAM,WAAW,GAA6B;IAC5C,8BAA8B,EAAE,CAAC,KAAK,CAAC;CACxC,CAAC;AAOF,MAAM,UAAU,YAAY,CAC1B,QAEyC;IAEzC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../src/generated/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,MAAM,WAAW,GAA6B;IAC5C,8BAA8B,EAAE,CAAC,KAAK,CAAC;CACxC,CAAC;AAOF,MAAM,UAAU,YAAY,CAC1B,QAEyC;IAEzC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzD,MAAM,MAAM,GAA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// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n GeolocationGetLocation200Response,\n GeolocationGetLocationDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /geolocation/ip/{format}\": [\"200\"],\n};\n\nexport function isUnexpected(\n response:\n | GeolocationGetLocation200Response\n | GeolocationGetLocationDefaultResponse,\n): response is GeolocationGetLocationDefaultResponse;\nexport function isUnexpected(\n response:\n | GeolocationGetLocation200Response\n | GeolocationGetLocationDefaultResponse,\n): response is GeolocationGetLocationDefaultResponse {\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"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __rest } from "tslib";
|
|
4
3
|
import { getClient } from "@azure-rest/core-client";
|
|
5
4
|
import { logger } from "./logger.js";
|
|
6
5
|
/**
|
|
@@ -8,21 +7,24 @@ import { logger } from "./logger.js";
|
|
|
8
7
|
* @param credentials - uniquely identify client credential
|
|
9
8
|
* @param options - the parameter for all optional parameters
|
|
10
9
|
*/
|
|
11
|
-
export default function createClient(credentials,
|
|
12
|
-
|
|
13
|
-
var { apiVersion = "1.0" } = _a, options = __rest(_a, ["apiVersion"]);
|
|
14
|
-
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `https://atlas.microsoft.com`;
|
|
10
|
+
export default function createClient(credentials, { apiVersion = "1.0", ...options } = {}) {
|
|
11
|
+
const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://atlas.microsoft.com`;
|
|
15
12
|
const userAgentInfo = `azsdk-js-maps-geolocation-rest/1.0.0-beta.4`;
|
|
16
13
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
17
14
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
18
15
|
: `${userAgentInfo}`;
|
|
19
|
-
options =
|
|
16
|
+
options = {
|
|
17
|
+
...options,
|
|
18
|
+
userAgentOptions: {
|
|
20
19
|
userAgentPrefix,
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
},
|
|
21
|
+
loggingOptions: {
|
|
22
|
+
logger: options.loggingOptions?.logger ?? logger.info,
|
|
23
|
+
},
|
|
24
|
+
credentials: {
|
|
25
|
+
apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "subscription-key",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
26
28
|
const client = getClient(endpointUrl, credentials, options);
|
|
27
29
|
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
28
30
|
client.pipeline.addPolicy({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapsGeolocationClient.js","sourceRoot":"","sources":["../../../src/generated/mapsGeolocationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"mapsGeolocationClient.js","sourceRoot":"","sources":["../../../src/generated/mapsGeolocationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,WAA0B,EAC1B,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,OAAO,KAAmC,EAAE;IAErE,MAAM,WAAW,GACf,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,6BAA6B,CAAC;IACvE,MAAM,aAAa,GAAG,6CAA6C,CAAC;IACpE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,GAAG;QACR,GAAG,OAAO;QACV,gBAAgB,EAAE;YAChB,eAAe;SAChB;QACD,cAAc,EAAE;YACd,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,IAAI,MAAM,CAAC,IAAI;SACtD;QACD,WAAW,EAAE;YACX,gBAAgB,EACd,OAAO,CAAC,WAAW,EAAE,gBAAgB,IAAI,kBAAkB;SAC9D;KACF,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CACtB,WAAW,EACX,WAAW,EACX,OAAO,CACiB,CAAC;IAE3B,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { MapsGeolocationClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface MapsGeolocationClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `MapsGeolocationClient`\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 = \"1.0\", ...options }: MapsGeolocationClientOptions = {},\n): MapsGeolocationClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `https://atlas.microsoft.com`;\n const userAgentInfo = `azsdk-js-maps-geolocation-rest/1.0.0-beta.4`;\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 MapsGeolocationClient;\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"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@azure-rest/maps-geolocation",
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "1.0.0-beta.
|
|
5
|
+
"version": "1.0.0-beta.6",
|
|
6
6
|
"description": "A generated SDK for MapsGeolocationClient.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
@@ -23,34 +23,12 @@
|
|
|
23
23
|
"files": [
|
|
24
24
|
"dist/",
|
|
25
25
|
"README.md",
|
|
26
|
-
"LICENSE"
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"review/",
|
|
28
|
+
"CHANGELOG.md"
|
|
27
29
|
],
|
|
28
30
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
30
|
-
},
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
|
33
|
-
"build:samples": "dev-tool samples publish --force",
|
|
34
|
-
"build:test": "echo skipped",
|
|
35
|
-
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
36
|
-
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
|
37
|
-
"execute:samples": "dev-tool samples run samples-dev",
|
|
38
|
-
"extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api",
|
|
39
|
-
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
40
|
-
"generate:client": "autorest --typescript swagger/README.md && npm run format",
|
|
41
|
-
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|
|
42
|
-
"integration-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
|
43
|
-
"integration-test:node": "dev-tool run test:vitest --esm",
|
|
44
|
-
"lint": "eslint package.json api-extractor.json src test",
|
|
45
|
-
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
|
|
46
|
-
"pack": "npm pack 2>&1",
|
|
47
|
-
"test": "npm run clean && npm run build:test && npm run unit-test",
|
|
48
|
-
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
|
|
49
|
-
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
|
|
50
|
-
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
51
|
-
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
|
52
|
-
"unit-test:node": "dev-tool run test:vitest",
|
|
53
|
-
"update-snippets": "dev-tool run update-snippets"
|
|
31
|
+
"node": ">=20.0.0"
|
|
54
32
|
},
|
|
55
33
|
"sideEffects": false,
|
|
56
34
|
"autoPublish": false,
|
|
@@ -63,22 +41,22 @@
|
|
|
63
41
|
"tslib": "^2.8.1"
|
|
64
42
|
},
|
|
65
43
|
"devDependencies": {
|
|
66
|
-
"@azure
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"@azure/dev-tool": "^1.0.0",
|
|
71
|
-
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
72
|
-
"@azure/identity": "^4.6.0",
|
|
73
|
-
"@types/node": "^18.0.0",
|
|
74
|
-
"@vitest/browser": "^3.0.5",
|
|
75
|
-
"@vitest/coverage-istanbul": "^3.0.5",
|
|
44
|
+
"@azure/identity": "4.11.1",
|
|
45
|
+
"@types/node": "^20.19.0",
|
|
46
|
+
"@vitest/browser": "^3.2.3",
|
|
47
|
+
"@vitest/coverage-istanbul": "^3.2.3",
|
|
76
48
|
"autorest": "latest",
|
|
77
49
|
"dotenv": "^16.0.0",
|
|
78
|
-
"eslint": "^9.
|
|
50
|
+
"eslint": "^9.33.0",
|
|
79
51
|
"playwright": "^1.50.1",
|
|
80
|
-
"typescript": "~5.
|
|
81
|
-
"vitest": "^3.
|
|
52
|
+
"typescript": "~5.8.3",
|
|
53
|
+
"vitest": "^3.2.3",
|
|
54
|
+
"@azure-tools/test-credential": "^2.1.1",
|
|
55
|
+
"@azure-tools/test-recorder": "^4.1.0",
|
|
56
|
+
"@azure-tools/test-utils-vitest": "^1.0.0",
|
|
57
|
+
"@azure/core-util": "^1.13.1",
|
|
58
|
+
"@azure/dev-tool": "^1.0.0",
|
|
59
|
+
"@azure/eslint-plugin-azure-sdk": "^3.0.0"
|
|
82
60
|
},
|
|
83
61
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-geolocation-rest/README.md",
|
|
84
62
|
"//metadata": {
|
|
@@ -103,7 +81,7 @@
|
|
|
103
81
|
},
|
|
104
82
|
"type": "module",
|
|
105
83
|
"tshy": {
|
|
106
|
-
"project": "
|
|
84
|
+
"project": "../../../tsconfig.src.build.json",
|
|
107
85
|
"exports": {
|
|
108
86
|
"./package.json": "./package.json",
|
|
109
87
|
".": "./src/index.ts"
|
|
@@ -139,5 +117,23 @@
|
|
|
139
117
|
}
|
|
140
118
|
}
|
|
141
119
|
},
|
|
142
|
-
"react-native": "./dist/react-native/index.js"
|
|
143
|
-
|
|
120
|
+
"react-native": "./dist/react-native/index.js",
|
|
121
|
+
"scripts": {
|
|
122
|
+
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
|
123
|
+
"build:samples": "tsc -p tsconfig.samples.json",
|
|
124
|
+
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
125
|
+
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
|
126
|
+
"execute:samples": "dev-tool samples run samples-dev",
|
|
127
|
+
"extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api",
|
|
128
|
+
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
129
|
+
"generate:client": "autorest --typescript swagger/README.md && npm run format",
|
|
130
|
+
"lint": "eslint package.json src test",
|
|
131
|
+
"lint:fix": "eslint package.json src test --fix --fix-type [problem,suggestion]",
|
|
132
|
+
"pack": "pnpm pack 2>&1",
|
|
133
|
+
"test": "npm run test:node && npm run test:browser",
|
|
134
|
+
"test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
|
135
|
+
"test:node": "dev-tool run test:vitest",
|
|
136
|
+
"test:node:esm": "dev-tool run test:vitest --esm",
|
|
137
|
+
"update-snippets": "dev-tool run update-snippets"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
## API Report File for "@azure-rest/maps-geolocation"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import type { AzureKeyCredential } from '@azure/core-auth';
|
|
8
|
+
import type { AzureSASCredential } from '@azure/core-auth';
|
|
9
|
+
import { Client } from '@azure-rest/core-client';
|
|
10
|
+
import { ClientOptions } from '@azure-rest/core-client';
|
|
11
|
+
import { HttpResponse } from '@azure-rest/core-client';
|
|
12
|
+
import { RequestParameters } from '@azure-rest/core-client';
|
|
13
|
+
import { StreamableMethod } from '@azure-rest/core-client';
|
|
14
|
+
import type { TokenCredential } from '@azure/core-auth';
|
|
15
|
+
|
|
16
|
+
// @public
|
|
17
|
+
export interface CountryRegionOutput {
|
|
18
|
+
readonly isoCode?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// @public
|
|
22
|
+
export interface ErrorAdditionalInfoOutput {
|
|
23
|
+
readonly info?: Record<string, unknown>;
|
|
24
|
+
readonly type?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// @public
|
|
28
|
+
export interface ErrorDetailOutput {
|
|
29
|
+
readonly additionalInfo?: Array<ErrorAdditionalInfoOutput>;
|
|
30
|
+
readonly code?: string;
|
|
31
|
+
readonly details?: Array<ErrorDetailOutput>;
|
|
32
|
+
readonly message?: string;
|
|
33
|
+
readonly target?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// @public
|
|
37
|
+
export interface ErrorResponseOutput {
|
|
38
|
+
error?: ErrorDetailOutput;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// @public
|
|
42
|
+
export interface GeolocationGetLocation200Response extends HttpResponse {
|
|
43
|
+
// (undocumented)
|
|
44
|
+
body: IpAddressToLocationResultOutput;
|
|
45
|
+
// (undocumented)
|
|
46
|
+
status: "200";
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// @public
|
|
50
|
+
export interface GeolocationGetLocationDefaultResponse extends HttpResponse {
|
|
51
|
+
// (undocumented)
|
|
52
|
+
body: ErrorResponseOutput;
|
|
53
|
+
// (undocumented)
|
|
54
|
+
status: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// @public (undocumented)
|
|
58
|
+
export type GeolocationGetLocationParameters = GeolocationGetLocationQueryParam & RequestParameters;
|
|
59
|
+
|
|
60
|
+
// @public (undocumented)
|
|
61
|
+
export interface GeolocationGetLocationQueryParam {
|
|
62
|
+
// (undocumented)
|
|
63
|
+
queryParameters: GeolocationGetLocationQueryParamProperties;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// @public (undocumented)
|
|
67
|
+
export interface GeolocationGetLocationQueryParamProperties {
|
|
68
|
+
ip: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// @public (undocumented)
|
|
72
|
+
export interface GetLocation {
|
|
73
|
+
get(options: GeolocationGetLocationParameters): StreamableMethod<GeolocationGetLocation200Response | GeolocationGetLocationDefaultResponse>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// @public
|
|
77
|
+
export interface IpAddressToLocationResultOutput {
|
|
78
|
+
readonly countryRegion?: CountryRegionOutput;
|
|
79
|
+
readonly ipAddress?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// @public (undocumented)
|
|
83
|
+
export function isUnexpected(response: GeolocationGetLocation200Response | GeolocationGetLocationDefaultResponse): response is GeolocationGetLocationDefaultResponse;
|
|
84
|
+
|
|
85
|
+
// @public
|
|
86
|
+
function MapsGeolocation(credential: AzureKeyCredential, options?: ClientOptions): MapsGeolocationClient;
|
|
87
|
+
|
|
88
|
+
// @public
|
|
89
|
+
function MapsGeolocation(credential: TokenCredential, mapsAccountClientId: string, options?: ClientOptions): MapsGeolocationClient;
|
|
90
|
+
|
|
91
|
+
// @public
|
|
92
|
+
function MapsGeolocation(credential: AzureSASCredential, options?: ClientOptions): MapsGeolocationClient;
|
|
93
|
+
export default MapsGeolocation;
|
|
94
|
+
|
|
95
|
+
// @public (undocumented)
|
|
96
|
+
export type MapsGeolocationClient = Client & {
|
|
97
|
+
path: Routes;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// @public
|
|
101
|
+
export interface MapsGeolocationClientOptions extends ClientOptions {
|
|
102
|
+
apiVersion?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// @public (undocumented)
|
|
106
|
+
export interface Routes {
|
|
107
|
+
(path: "/geolocation/ip/{format}", format: "json"): GetLocation;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// (No @packageDocumentation comment for this package)
|
|
111
|
+
|
|
112
|
+
```
|