@azure-rest/maps-geolocation 1.0.0-beta.4 → 1.0.0-beta.5
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/LICENSE +4 -4
- package/README.md +33 -24
- package/dist/browser/MapsGeolocation.d.ts +53 -0
- package/dist/browser/MapsGeolocation.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/MapsGeolocation.js +1 -1
- package/dist/browser/MapsGeolocation.js.map +1 -0
- package/dist/browser/generated/clientDefinitions.d.ts +18 -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 +9 -0
- package/dist/browser/generated/index.d.ts.map +1 -0
- package/dist/browser/generated/index.js +11 -0
- package/dist/browser/generated/index.js.map +1 -0
- package/dist/browser/generated/isUnexpected.d.ts +3 -0
- package/dist/browser/generated/isUnexpected.d.ts.map +1 -0
- package/dist/browser/generated/isUnexpected.js +71 -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 +5 -0
- package/dist/browser/generated/logger.js.map +1 -0
- package/dist/browser/generated/mapsGeolocationClient.d.ts +15 -0
- package/dist/browser/generated/mapsGeolocationClient.d.ts.map +1 -0
- package/dist/browser/generated/mapsGeolocationClient.js +42 -0
- package/dist/browser/generated/mapsGeolocationClient.js.map +1 -0
- package/dist/browser/generated/outputModels.d.ts +38 -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 +10 -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 +19 -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/package.json +3 -0
- package/dist/commonjs/MapsGeolocation.d.ts +53 -0
- package/dist/commonjs/MapsGeolocation.d.ts.map +1 -0
- package/dist/commonjs/MapsGeolocation.js +44 -0
- package/dist/commonjs/MapsGeolocation.js.map +1 -0
- package/dist/commonjs/generated/clientDefinitions.d.ts +18 -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 +9 -0
- package/dist/commonjs/generated/index.d.ts.map +1 -0
- package/dist/commonjs/generated/index.js +14 -0
- package/dist/commonjs/generated/index.js.map +1 -0
- package/dist/commonjs/generated/isUnexpected.d.ts +3 -0
- package/dist/commonjs/generated/isUnexpected.d.ts.map +1 -0
- package/dist/commonjs/generated/isUnexpected.js +74 -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/mapsGeolocationClient.d.ts +15 -0
- package/dist/commonjs/generated/mapsGeolocationClient.d.ts.map +1 -0
- package/dist/commonjs/generated/mapsGeolocationClient.js +45 -0
- package/dist/commonjs/generated/mapsGeolocationClient.js.map +1 -0
- package/dist/commonjs/generated/outputModels.d.ts +38 -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 +10 -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 +19 -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/package.json +3 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/esm/MapsGeolocation.d.ts +53 -0
- package/dist/esm/MapsGeolocation.d.ts.map +1 -0
- package/dist/esm/MapsGeolocation.js +40 -0
- package/dist/esm/MapsGeolocation.js.map +1 -0
- package/dist/esm/generated/clientDefinitions.d.ts +18 -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 +9 -0
- package/dist/esm/generated/index.d.ts.map +1 -0
- package/dist/esm/generated/index.js +11 -0
- package/dist/esm/generated/index.js.map +1 -0
- package/dist/esm/generated/isUnexpected.d.ts +3 -0
- package/dist/esm/generated/isUnexpected.d.ts.map +1 -0
- package/dist/esm/generated/isUnexpected.js +71 -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/mapsGeolocationClient.d.ts +15 -0
- package/dist/esm/generated/mapsGeolocationClient.d.ts.map +1 -0
- package/dist/esm/generated/mapsGeolocationClient.js +42 -0
- package/dist/esm/generated/mapsGeolocationClient.js.map +1 -0
- package/dist/esm/generated/outputModels.d.ts +38 -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 +10 -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 +19 -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/package.json +3 -0
- package/dist/react-native/MapsGeolocation.d.ts +53 -0
- package/dist/react-native/MapsGeolocation.d.ts.map +1 -0
- package/dist/react-native/MapsGeolocation.js +40 -0
- package/dist/react-native/MapsGeolocation.js.map +1 -0
- package/dist/react-native/generated/clientDefinitions.d.ts +18 -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 +9 -0
- package/dist/react-native/generated/index.d.ts.map +1 -0
- package/dist/react-native/generated/index.js +11 -0
- package/dist/react-native/generated/index.js.map +1 -0
- package/dist/react-native/generated/isUnexpected.d.ts +3 -0
- package/dist/react-native/generated/isUnexpected.d.ts.map +1 -0
- package/dist/react-native/generated/isUnexpected.js +71 -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/mapsGeolocationClient.d.ts +15 -0
- package/dist/react-native/generated/mapsGeolocationClient.d.ts.map +1 -0
- package/dist/react-native/generated/mapsGeolocationClient.js +42 -0
- package/dist/react-native/generated/mapsGeolocationClient.js.map +1 -0
- package/dist/react-native/generated/outputModels.d.ts +38 -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 +10 -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 +19 -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/package.json +3 -0
- package/package.json +70 -52
- package/dist/index.js +0 -167
- package/dist/index.js.map +0 -1
- package/dist-esm/src/MapsGeolocation.js.map +0 -1
- package/dist-esm/src/index.js +0 -6
- package/dist-esm/src/index.js.map +0 -1
- package/review/maps-geolocation.api.md +0 -112
- package/types/maps-geolocation-rest.d.ts +0 -159
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.5",
|
|
6
6
|
"description": "A generated SDK for MapsGeolocationClient.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
@@ -13,40 +13,34 @@
|
|
|
13
13
|
"isomorphic"
|
|
14
14
|
],
|
|
15
15
|
"license": "MIT",
|
|
16
|
-
"main": "dist/index.js",
|
|
17
|
-
"module": "./dist
|
|
18
|
-
"types": "./
|
|
16
|
+
"main": "./dist/commonjs/index.js",
|
|
17
|
+
"module": "./dist/esm/index.js",
|
|
18
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
19
19
|
"repository": "github:Azure/azure-sdk-for-js",
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"dist/",
|
|
25
|
-
"dist-esm/src/",
|
|
26
|
-
"types/maps-geolocation-rest.d.ts",
|
|
27
25
|
"README.md",
|
|
28
|
-
"LICENSE"
|
|
29
|
-
"review/*"
|
|
26
|
+
"LICENSE"
|
|
30
27
|
],
|
|
31
28
|
"engines": {
|
|
32
29
|
"node": ">=18.0.0"
|
|
33
30
|
},
|
|
34
31
|
"scripts": {
|
|
35
|
-
"build": "npm run clean &&
|
|
36
|
-
"build:browser": "tsc -p . && dev-tool run bundle",
|
|
37
|
-
"build:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api",
|
|
38
|
-
"build:node": "tsc -p . && dev-tool run bundle --browser-test false",
|
|
32
|
+
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
|
39
33
|
"build:samples": "dev-tool samples publish --force",
|
|
40
|
-
"build:test": "
|
|
34
|
+
"build:test": "echo skipped",
|
|
41
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}\"",
|
|
42
36
|
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
|
43
37
|
"execute:samples": "dev-tool samples run samples-dev",
|
|
44
|
-
"extract-api": "dev-tool run vendored rimraf review && dev-tool run
|
|
38
|
+
"extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api",
|
|
45
39
|
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
46
40
|
"generate:client": "autorest --typescript swagger/README.md && npm run format",
|
|
47
41
|
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|
|
48
|
-
"integration-test:browser": "dev-tool run test:browser",
|
|
49
|
-
"integration-test:node": "dev-tool run test:
|
|
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",
|
|
50
44
|
"lint": "eslint package.json api-extractor.json src test",
|
|
51
45
|
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
|
|
52
46
|
"pack": "npm pack 2>&1",
|
|
@@ -54,50 +48,37 @@
|
|
|
54
48
|
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
|
|
55
49
|
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
|
|
56
50
|
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
57
|
-
"unit-test:browser": "dev-tool run test:browser",
|
|
58
|
-
"unit-test:node": "dev-tool run test:
|
|
59
|
-
"update-snippets": "
|
|
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"
|
|
60
54
|
},
|
|
61
55
|
"sideEffects": false,
|
|
62
56
|
"autoPublish": false,
|
|
63
57
|
"dependencies": {
|
|
64
|
-
"@azure-rest/core-client": "^
|
|
65
|
-
"@azure/core-auth": "^1.
|
|
66
|
-
"@azure/core-rest-pipeline": "^1.
|
|
58
|
+
"@azure-rest/core-client": "^2.3.3",
|
|
59
|
+
"@azure/core-auth": "^1.9.0",
|
|
60
|
+
"@azure/core-rest-pipeline": "^1.19.0",
|
|
61
|
+
"@azure/logger": "^1.1.4",
|
|
67
62
|
"@azure/maps-common": "1.0.0-beta.2",
|
|
68
|
-
"
|
|
69
|
-
"tslib": "^2.2.0"
|
|
63
|
+
"tslib": "^2.8.1"
|
|
70
64
|
},
|
|
71
65
|
"devDependencies": {
|
|
72
|
-
"@azure-tools/test-credential": "^
|
|
73
|
-
"@azure-tools/test-recorder": "^
|
|
74
|
-
"@azure-tools/test-utils": "
|
|
75
|
-
"@azure/core-util": "^1.
|
|
66
|
+
"@azure-tools/test-credential": "^2.0.0",
|
|
67
|
+
"@azure-tools/test-recorder": "^4.1.0",
|
|
68
|
+
"@azure-tools/test-utils-vitest": "^1.0.0",
|
|
69
|
+
"@azure/core-util": "^1.11.0",
|
|
76
70
|
"@azure/dev-tool": "^1.0.0",
|
|
77
71
|
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
78
|
-
"@azure/identity": "^4.0
|
|
79
|
-
"@types/chai": "^4.2.8",
|
|
80
|
-
"@types/mocha": "^10.0.0",
|
|
72
|
+
"@azure/identity": "^4.6.0",
|
|
81
73
|
"@types/node": "^18.0.0",
|
|
74
|
+
"@vitest/browser": "^3.0.5",
|
|
75
|
+
"@vitest/coverage-istanbul": "^3.0.5",
|
|
82
76
|
"autorest": "latest",
|
|
83
|
-
"chai": "^4.2.0",
|
|
84
77
|
"dotenv": "^16.0.0",
|
|
85
78
|
"eslint": "^9.9.0",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"karma-env-preprocessor": "^0.1.1",
|
|
90
|
-
"karma-firefox-launcher": "^1.1.0",
|
|
91
|
-
"karma-junit-reporter": "^2.0.1",
|
|
92
|
-
"karma-mocha": "^2.0.1",
|
|
93
|
-
"karma-mocha-reporter": "^2.2.5",
|
|
94
|
-
"karma-source-map-support": "~1.4.0",
|
|
95
|
-
"karma-sourcemap-loader": "^0.3.8",
|
|
96
|
-
"mocha": "^10.0.0",
|
|
97
|
-
"nyc": "^17.0.0",
|
|
98
|
-
"source-map-support": "^0.5.9",
|
|
99
|
-
"ts-node": "^10.0.0",
|
|
100
|
-
"typescript": "~5.6.2"
|
|
79
|
+
"playwright": "^1.50.1",
|
|
80
|
+
"typescript": "~5.7.2",
|
|
81
|
+
"vitest": "^3.0.5"
|
|
101
82
|
},
|
|
102
83
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-geolocation-rest/README.md",
|
|
103
84
|
"//metadata": {
|
|
@@ -108,9 +89,7 @@
|
|
|
108
89
|
}
|
|
109
90
|
]
|
|
110
91
|
},
|
|
111
|
-
"browser":
|
|
112
|
-
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
|
|
113
|
-
},
|
|
92
|
+
"browser": "./dist/browser/index.js",
|
|
114
93
|
"//sampleConfiguration": {
|
|
115
94
|
"productName": "MapsGeolocationClient",
|
|
116
95
|
"productSlugs": [
|
|
@@ -118,8 +97,47 @@
|
|
|
118
97
|
"azure-maps"
|
|
119
98
|
],
|
|
120
99
|
"requiredResources": {
|
|
121
|
-
"Azure Maps Resource": "https://
|
|
100
|
+
"Azure Maps Resource": "https://learn.microsoft.com/azure/azure-maps/how-to-create-template"
|
|
122
101
|
},
|
|
123
102
|
"disableDocsMs": true
|
|
124
|
-
}
|
|
103
|
+
},
|
|
104
|
+
"type": "module",
|
|
105
|
+
"tshy": {
|
|
106
|
+
"project": "./tsconfig.src.json",
|
|
107
|
+
"exports": {
|
|
108
|
+
"./package.json": "./package.json",
|
|
109
|
+
".": "./src/index.ts"
|
|
110
|
+
},
|
|
111
|
+
"dialects": [
|
|
112
|
+
"esm",
|
|
113
|
+
"commonjs"
|
|
114
|
+
],
|
|
115
|
+
"esmDialects": [
|
|
116
|
+
"browser",
|
|
117
|
+
"react-native"
|
|
118
|
+
],
|
|
119
|
+
"selfLink": false
|
|
120
|
+
},
|
|
121
|
+
"exports": {
|
|
122
|
+
"./package.json": "./package.json",
|
|
123
|
+
".": {
|
|
124
|
+
"browser": {
|
|
125
|
+
"types": "./dist/browser/index.d.ts",
|
|
126
|
+
"default": "./dist/browser/index.js"
|
|
127
|
+
},
|
|
128
|
+
"react-native": {
|
|
129
|
+
"types": "./dist/react-native/index.d.ts",
|
|
130
|
+
"default": "./dist/react-native/index.js"
|
|
131
|
+
},
|
|
132
|
+
"import": {
|
|
133
|
+
"types": "./dist/esm/index.d.ts",
|
|
134
|
+
"default": "./dist/esm/index.js"
|
|
135
|
+
},
|
|
136
|
+
"require": {
|
|
137
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
138
|
+
"default": "./dist/commonjs/index.js"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"react-native": "./dist/react-native/index.js"
|
|
125
143
|
}
|
package/dist/index.js
DELETED
|
@@ -1,167 +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-geolocation");
|
|
15
|
-
|
|
16
|
-
// Copyright (c) Microsoft Corporation.
|
|
17
|
-
// Licensed under the MIT License.
|
|
18
|
-
/**
|
|
19
|
-
* Initialize a new instance of `MapsGeolocationClient`
|
|
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 = "1.0" } = _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-geolocation-rest/1.0.0-beta.4`;
|
|
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 /geolocation/ip/{format}": ["200"],
|
|
59
|
-
};
|
|
60
|
-
function isUnexpected(response) {
|
|
61
|
-
const lroOriginal = response.headers["x-ms-original-url"];
|
|
62
|
-
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
|
|
63
|
-
const method = response.request.method;
|
|
64
|
-
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
65
|
-
if (!pathDetails) {
|
|
66
|
-
pathDetails = getParametrizedPathSuccess(method, url.pathname);
|
|
67
|
-
}
|
|
68
|
-
return !pathDetails.includes(response.status);
|
|
69
|
-
}
|
|
70
|
-
function getParametrizedPathSuccess(method, path) {
|
|
71
|
-
var _a, _b, _c, _d;
|
|
72
|
-
const pathParts = path.split("/");
|
|
73
|
-
// Traverse list to match the longest candidate
|
|
74
|
-
// matchedLen: the length of candidate path
|
|
75
|
-
// matchedValue: the matched status code array
|
|
76
|
-
let matchedLen = -1, matchedValue = [];
|
|
77
|
-
// Iterate the responseMap to find a match
|
|
78
|
-
for (const [key, value] of Object.entries(responseMap)) {
|
|
79
|
-
// Extracting the path from the map key which is in format
|
|
80
|
-
// GET /path/foo
|
|
81
|
-
if (!key.startsWith(method)) {
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
const candidatePath = getPathFromMapKey(key);
|
|
85
|
-
// Get each part of the url path
|
|
86
|
-
const candidateParts = candidatePath.split("/");
|
|
87
|
-
// track if we have found a match to return the values found.
|
|
88
|
-
let found = true;
|
|
89
|
-
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
90
|
-
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) &&
|
|
91
|
-
((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
|
|
92
|
-
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
|
|
93
|
-
// If the current part of the candidate is a "template" part
|
|
94
|
-
// Try to use the suffix of pattern to match the path
|
|
95
|
-
// {guid} ==> $
|
|
96
|
-
// {guid}:export ==> :export$
|
|
97
|
-
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
|
|
98
|
-
if (!isMatched) {
|
|
99
|
-
found = false;
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
// If the candidate part is not a template and
|
|
105
|
-
// the parts don't match mark the candidate as not found
|
|
106
|
-
// to move on with the next candidate path.
|
|
107
|
-
if (candidateParts[i] !== pathParts[j]) {
|
|
108
|
-
found = false;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// We finished evaluating the current candidate parts
|
|
113
|
-
// Update the matched value if and only if we found the longer pattern
|
|
114
|
-
if (found && candidatePath.length > matchedLen) {
|
|
115
|
-
matchedLen = candidatePath.length;
|
|
116
|
-
matchedValue = value;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return matchedValue;
|
|
120
|
-
}
|
|
121
|
-
function getPathFromMapKey(mapKey) {
|
|
122
|
-
const pathStart = mapKey.indexOf("/");
|
|
123
|
-
return mapKey.slice(pathStart);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Copyright (c) Microsoft Corporation.
|
|
127
|
-
// Licensed under the MIT License.
|
|
128
|
-
function MapsGeolocation(credential, clientIdOrOptions = {}, maybeOptions = {}) {
|
|
129
|
-
const options = typeof clientIdOrOptions === "string" ? maybeOptions : clientIdOrOptions;
|
|
130
|
-
/**
|
|
131
|
-
* maps service requires a header "ms-x-client-id", which is different from the standard Microsoft Entra ID.
|
|
132
|
-
* So we need to do our own implementation.
|
|
133
|
-
* This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication
|
|
134
|
-
*/
|
|
135
|
-
if (coreAuth.isTokenCredential(credential)) {
|
|
136
|
-
const clientId = typeof clientIdOrOptions === "string" ? clientIdOrOptions : "";
|
|
137
|
-
if (!clientId) {
|
|
138
|
-
throw Error("Client id is needed for TokenCredential");
|
|
139
|
-
}
|
|
140
|
-
const client = createClient(undefined, options);
|
|
141
|
-
client.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
142
|
-
credential,
|
|
143
|
-
scopes: "https://atlas.microsoft.com/.default",
|
|
144
|
-
}));
|
|
145
|
-
client.pipeline.addPolicy(mapsCommon.createMapsClientIdPolicy(clientId));
|
|
146
|
-
return client;
|
|
147
|
-
}
|
|
148
|
-
if (coreAuth.isSASCredential(credential)) {
|
|
149
|
-
const client = createClient(undefined, options);
|
|
150
|
-
client.pipeline.addPolicy({
|
|
151
|
-
name: "mapsSASCredentialPolicy",
|
|
152
|
-
async sendRequest(request, next) {
|
|
153
|
-
request.headers.set("Authorization", `jwt-sas ${credential.signature}`);
|
|
154
|
-
return next(request);
|
|
155
|
-
},
|
|
156
|
-
});
|
|
157
|
-
return client;
|
|
158
|
-
}
|
|
159
|
-
return createClient(credential, options);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Copyright (c) Microsoft Corporation.
|
|
163
|
-
// Licensed under the MIT License.
|
|
164
|
-
|
|
165
|
-
exports.default = MapsGeolocation;
|
|
166
|
-
exports.isUnexpected = isUnexpected;
|
|
167
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../generated/logger.ts","../generated/mapsGeolocationClient.ts","../generated/isUnexpected.ts","../src/MapsGeolocation.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-geolocation\");\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 { MapsGeolocationClient } from \"./clientDefinitions\";\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","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n GeolocationGetLocation200Response,\n GeolocationGetLocationDefaultResponse,\n} from \"./responses\";\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","// 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 { MapsGeolocationClient } from \"../generated\";\nimport createClient from \"../generated\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsGeolocationClient from a subscription key.\n *\n * @example\n * ```ts\n * import MapsGeolocation from \"@azure-rest/maps-geolocation\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsGeolocation(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Geolocation Client\n */\nexport default function MapsGeolocation(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsGeolocationClient;\n/**\n * Creates an instance of MapsGeolocation from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts\n * import MapsGeolocation from \"@azure-rest/maps-geo-location\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsGeolocation(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 Route Client\n */\nexport default function MapsGeolocation(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsGeolocationClient;\n/**\n * Creates an instance of MapsGeolocation from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts\n * import MapsGeolocation from \"@azure-rest/maps-geo-location\";\n * import { AzureSASCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsGeolocation(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Geolocation Client\n */\nexport default function MapsGeolocation(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsGeolocationClient;\nexport default function MapsGeolocation(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsGeolocationClient {\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.\n\nimport MapsGeolocation from \"./MapsGeolocation\";\n\nexport * from \"../generated\";\nexport default MapsGeolocation;\n"],"names":["createClientLogger","__rest","getClient","isTokenCredential","bearerTokenAuthenticationPolicy","createMapsClientIdPolicy","isSASCredential"],"mappings":";;;;;;;;;;;AAAA;AACA;AAGO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,kBAAkB,CAAC;;ACJ5D;AACA;AAaA;;;;AAIG;AACqB,SAAA,YAAY,CAClC,WAA0B,EAC1B,KAAmE,EAAE,EAAA;;QAArE,EAAE,UAAU,GAAG,KAAK,EAAA,GAAA,EAAiD,EAA5C,OAAO,GAAAC,YAAA,CAAA,EAAA,EAAhC,cAAkC,CAAF;AAEhC,IAAA,MAAM,WAAW,GACf,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,OAAO,CAAC,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,OAAO,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,6BAA6B;IACtE,MAAM,aAAa,GAAG,CAAA,2CAAA,CAA6C;IACnE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC;UACjD,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAI,CAAA,EAAA,aAAa,CAAE;AAChE,UAAE,CAAA,EAAG,aAAa,CAAA,CAAE;AACxB,IAAA,OAAO,GACF,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,OAAO,CACV,EAAA,EAAA,gBAAgB,EAAE;YAChB,eAAe;AAChB,SAAA,EACD,cAAc,EAAE;YACd,MAAM,EAAE,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,OAAO,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,MAAM,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,MAAM,CAAC,IAAI;AACtD,SA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AC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsGeolocationClient } from \"../generated\";\nimport createClient from \"../generated\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsGeolocationClient from a subscription key.\n *\n * @example\n * ```ts\n * import MapsGeolocation from \"@azure-rest/maps-geolocation\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsGeolocation(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Geolocation Client\n */\nexport default function MapsGeolocation(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsGeolocationClient;\n/**\n * Creates an instance of MapsGeolocation from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts\n * import MapsGeolocation from \"@azure-rest/maps-geo-location\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsGeolocation(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 Route Client\n */\nexport default function MapsGeolocation(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsGeolocationClient;\n/**\n * Creates an instance of MapsGeolocation from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts\n * import MapsGeolocation from \"@azure-rest/maps-geo-location\";\n * import { AzureSASCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsGeolocation(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Geolocation Client\n */\nexport default function MapsGeolocation(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsGeolocationClient;\nexport default function MapsGeolocation(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsGeolocationClient {\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;AAElC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,cAAc,cAAc,CAAC;AAC7B,eAAe,eAAe,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport MapsGeolocation from \"./MapsGeolocation\";\n\nexport * from \"../generated\";\nexport default MapsGeolocation;\n"]}
|
|
@@ -1,112 +0,0 @@
|
|
|
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
|
-
```
|