@azure-rest/maps-render 2.0.0-beta.1 → 2.0.0-beta.3

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.
Files changed (243) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/LICENSE +4 -4
  3. package/README.md +48 -34
  4. package/dist/browser/createMultiCollection.d.ts +7 -0
  5. package/dist/browser/createMultiCollection.d.ts.map +1 -0
  6. package/dist/browser/createPathQuery.d.ts +117 -0
  7. package/dist/browser/createPathQuery.d.ts.map +1 -0
  8. package/{dist-esm/src → dist/browser}/createPathQuery.js +42 -25
  9. package/dist/browser/createPathQuery.js.map +1 -0
  10. package/dist/browser/createPinsQuery.d.ts +102 -0
  11. package/dist/browser/createPinsQuery.d.ts.map +1 -0
  12. package/{dist-esm/src → dist/browser}/createPinsQuery.js +44 -25
  13. package/dist/browser/createPinsQuery.js.map +1 -0
  14. package/dist/browser/generated/clientDefinitions.d.ts +131 -0
  15. package/dist/browser/generated/clientDefinitions.d.ts.map +1 -0
  16. package/dist/browser/generated/clientDefinitions.js +4 -0
  17. package/dist/browser/generated/clientDefinitions.js.map +1 -0
  18. package/dist/browser/generated/index.d.ts +9 -0
  19. package/dist/browser/generated/index.d.ts.map +1 -0
  20. package/dist/browser/generated/index.js +11 -0
  21. package/dist/browser/generated/index.js.map +1 -0
  22. package/dist/browser/generated/isUnexpected.d.ts +11 -0
  23. package/dist/browser/generated/isUnexpected.d.ts.map +1 -0
  24. package/dist/browser/generated/isUnexpected.js +78 -0
  25. package/dist/browser/generated/isUnexpected.js.map +1 -0
  26. package/dist/browser/generated/logger.d.ts +2 -0
  27. package/dist/browser/generated/logger.d.ts.map +1 -0
  28. package/dist/browser/generated/logger.js +5 -0
  29. package/dist/browser/generated/logger.js.map +1 -0
  30. package/dist/browser/generated/mapsRenderClient.d.ts +15 -0
  31. package/dist/browser/generated/mapsRenderClient.d.ts.map +1 -0
  32. package/dist/browser/generated/mapsRenderClient.js +44 -0
  33. package/dist/browser/generated/mapsRenderClient.js.map +1 -0
  34. package/dist/browser/generated/outputModels.d.ts +93 -0
  35. package/dist/browser/generated/outputModels.d.ts.map +1 -0
  36. package/dist/browser/generated/outputModels.js +4 -0
  37. package/dist/browser/generated/outputModels.js.map +1 -0
  38. package/dist/browser/generated/parameters.d.ts +384 -0
  39. package/dist/browser/generated/parameters.d.ts.map +1 -0
  40. package/dist/browser/generated/parameters.js +4 -0
  41. package/dist/browser/generated/parameters.js.map +1 -0
  42. package/dist/browser/generated/responses.d.ts +248 -0
  43. package/dist/browser/generated/responses.d.ts.map +1 -0
  44. package/dist/browser/generated/responses.js +4 -0
  45. package/dist/browser/generated/responses.js.map +1 -0
  46. package/dist/browser/index.d.ts +7 -0
  47. package/dist/browser/index.d.ts.map +1 -0
  48. package/dist/browser/index.js +9 -0
  49. package/dist/browser/index.js.map +1 -0
  50. package/dist/browser/mapsRender.d.ts +53 -0
  51. package/dist/browser/mapsRender.d.ts.map +1 -0
  52. package/{dist-esm/src → dist/browser}/mapsRender.js +1 -1
  53. package/dist/browser/mapsRender.js.map +1 -0
  54. package/dist/browser/package.json +3 -0
  55. package/dist/browser/positionToTileXY.d.ts +47 -0
  56. package/dist/browser/positionToTileXY.d.ts.map +1 -0
  57. package/{dist-esm/src → dist/browser}/positionToTileXY.js +24 -3
  58. package/dist/browser/positionToTileXY.js.map +1 -0
  59. package/dist/commonjs/createMultiCollection.d.ts +7 -0
  60. package/dist/commonjs/createMultiCollection.d.ts.map +1 -0
  61. package/dist/commonjs/createMultiCollection.js +16 -0
  62. package/dist/commonjs/createMultiCollection.js.map +1 -0
  63. package/dist/commonjs/createPathQuery.d.ts +117 -0
  64. package/dist/commonjs/createPathQuery.d.ts.map +1 -0
  65. package/dist/commonjs/createPathQuery.js +117 -0
  66. package/dist/commonjs/createPathQuery.js.map +1 -0
  67. package/dist/commonjs/createPinsQuery.d.ts +102 -0
  68. package/dist/commonjs/createPinsQuery.d.ts.map +1 -0
  69. package/dist/commonjs/createPinsQuery.js +96 -0
  70. package/dist/commonjs/createPinsQuery.js.map +1 -0
  71. package/dist/commonjs/generated/clientDefinitions.d.ts +131 -0
  72. package/dist/commonjs/generated/clientDefinitions.d.ts.map +1 -0
  73. package/dist/commonjs/generated/clientDefinitions.js +5 -0
  74. package/dist/commonjs/generated/clientDefinitions.js.map +1 -0
  75. package/dist/commonjs/generated/index.d.ts +9 -0
  76. package/dist/commonjs/generated/index.d.ts.map +1 -0
  77. package/dist/commonjs/generated/index.js +14 -0
  78. package/dist/commonjs/generated/index.js.map +1 -0
  79. package/dist/commonjs/generated/isUnexpected.d.ts +11 -0
  80. package/dist/commonjs/generated/isUnexpected.d.ts.map +1 -0
  81. package/dist/commonjs/generated/isUnexpected.js +81 -0
  82. package/dist/commonjs/generated/isUnexpected.js.map +1 -0
  83. package/dist/commonjs/generated/logger.d.ts +2 -0
  84. package/dist/commonjs/generated/logger.d.ts.map +1 -0
  85. package/dist/commonjs/generated/logger.js +8 -0
  86. package/dist/commonjs/generated/logger.js.map +1 -0
  87. package/dist/commonjs/generated/mapsRenderClient.d.ts +15 -0
  88. package/dist/commonjs/generated/mapsRenderClient.d.ts.map +1 -0
  89. package/dist/commonjs/generated/mapsRenderClient.js +47 -0
  90. package/dist/commonjs/generated/mapsRenderClient.js.map +1 -0
  91. package/dist/commonjs/generated/outputModels.d.ts +93 -0
  92. package/dist/commonjs/generated/outputModels.d.ts.map +1 -0
  93. package/dist/commonjs/generated/outputModels.js +5 -0
  94. package/dist/commonjs/generated/outputModels.js.map +1 -0
  95. package/dist/commonjs/generated/parameters.d.ts +384 -0
  96. package/dist/commonjs/generated/parameters.d.ts.map +1 -0
  97. package/dist/commonjs/generated/parameters.js +5 -0
  98. package/dist/commonjs/generated/parameters.js.map +1 -0
  99. package/dist/commonjs/generated/responses.d.ts +248 -0
  100. package/dist/commonjs/generated/responses.d.ts.map +1 -0
  101. package/dist/commonjs/generated/responses.js +5 -0
  102. package/dist/commonjs/generated/responses.js.map +1 -0
  103. package/dist/commonjs/index.d.ts +7 -0
  104. package/dist/commonjs/index.d.ts.map +1 -0
  105. package/dist/commonjs/index.js +12 -0
  106. package/dist/commonjs/index.js.map +1 -0
  107. package/dist/commonjs/mapsRender.d.ts +53 -0
  108. package/dist/commonjs/mapsRender.d.ts.map +1 -0
  109. package/dist/commonjs/mapsRender.js +44 -0
  110. package/dist/commonjs/mapsRender.js.map +1 -0
  111. package/dist/commonjs/package.json +3 -0
  112. package/dist/commonjs/positionToTileXY.d.ts +47 -0
  113. package/dist/commonjs/positionToTileXY.d.ts.map +1 -0
  114. package/dist/commonjs/positionToTileXY.js +68 -0
  115. package/dist/commonjs/positionToTileXY.js.map +1 -0
  116. package/dist/commonjs/tsdoc-metadata.json +11 -0
  117. package/dist/esm/createMultiCollection.d.ts +7 -0
  118. package/dist/esm/createMultiCollection.d.ts.map +1 -0
  119. package/dist/esm/createMultiCollection.js +13 -0
  120. package/dist/esm/createMultiCollection.js.map +1 -0
  121. package/dist/esm/createPathQuery.d.ts +117 -0
  122. package/dist/esm/createPathQuery.d.ts.map +1 -0
  123. package/dist/esm/createPathQuery.js +114 -0
  124. package/dist/esm/createPathQuery.js.map +1 -0
  125. package/dist/esm/createPinsQuery.d.ts +102 -0
  126. package/dist/esm/createPinsQuery.d.ts.map +1 -0
  127. package/dist/esm/createPinsQuery.js +93 -0
  128. package/dist/esm/createPinsQuery.js.map +1 -0
  129. package/dist/esm/generated/clientDefinitions.d.ts +131 -0
  130. package/dist/esm/generated/clientDefinitions.d.ts.map +1 -0
  131. package/dist/esm/generated/clientDefinitions.js +4 -0
  132. package/dist/esm/generated/clientDefinitions.js.map +1 -0
  133. package/dist/esm/generated/index.d.ts +9 -0
  134. package/dist/esm/generated/index.d.ts.map +1 -0
  135. package/dist/esm/generated/index.js +11 -0
  136. package/dist/esm/generated/index.js.map +1 -0
  137. package/dist/esm/generated/isUnexpected.d.ts +11 -0
  138. package/dist/esm/generated/isUnexpected.d.ts.map +1 -0
  139. package/dist/esm/generated/isUnexpected.js +78 -0
  140. package/dist/esm/generated/isUnexpected.js.map +1 -0
  141. package/dist/esm/generated/logger.d.ts +2 -0
  142. package/dist/esm/generated/logger.d.ts.map +1 -0
  143. package/dist/esm/generated/logger.js +5 -0
  144. package/dist/esm/generated/logger.js.map +1 -0
  145. package/dist/esm/generated/mapsRenderClient.d.ts +15 -0
  146. package/dist/esm/generated/mapsRenderClient.d.ts.map +1 -0
  147. package/dist/esm/generated/mapsRenderClient.js +44 -0
  148. package/dist/esm/generated/mapsRenderClient.js.map +1 -0
  149. package/dist/esm/generated/outputModels.d.ts +93 -0
  150. package/dist/esm/generated/outputModels.d.ts.map +1 -0
  151. package/dist/esm/generated/outputModels.js +4 -0
  152. package/dist/esm/generated/outputModels.js.map +1 -0
  153. package/dist/esm/generated/parameters.d.ts +384 -0
  154. package/dist/esm/generated/parameters.d.ts.map +1 -0
  155. package/dist/esm/generated/parameters.js +4 -0
  156. package/dist/esm/generated/parameters.js.map +1 -0
  157. package/dist/esm/generated/responses.d.ts +248 -0
  158. package/dist/esm/generated/responses.d.ts.map +1 -0
  159. package/dist/esm/generated/responses.js +4 -0
  160. package/dist/esm/generated/responses.js.map +1 -0
  161. package/dist/esm/index.d.ts +7 -0
  162. package/dist/esm/index.d.ts.map +1 -0
  163. package/dist/esm/index.js +9 -0
  164. package/dist/esm/index.js.map +1 -0
  165. package/dist/esm/mapsRender.d.ts +53 -0
  166. package/dist/esm/mapsRender.d.ts.map +1 -0
  167. package/dist/esm/mapsRender.js +40 -0
  168. package/dist/esm/mapsRender.js.map +1 -0
  169. package/dist/esm/package.json +3 -0
  170. package/dist/esm/positionToTileXY.d.ts +47 -0
  171. package/dist/esm/positionToTileXY.d.ts.map +1 -0
  172. package/dist/esm/positionToTileXY.js +65 -0
  173. package/dist/esm/positionToTileXY.js.map +1 -0
  174. package/dist/react-native/createMultiCollection.d.ts +7 -0
  175. package/dist/react-native/createMultiCollection.d.ts.map +1 -0
  176. package/dist/react-native/createMultiCollection.js +13 -0
  177. package/dist/react-native/createMultiCollection.js.map +1 -0
  178. package/dist/react-native/createPathQuery.d.ts +117 -0
  179. package/dist/react-native/createPathQuery.d.ts.map +1 -0
  180. package/dist/react-native/createPathQuery.js +114 -0
  181. package/dist/react-native/createPathQuery.js.map +1 -0
  182. package/dist/react-native/createPinsQuery.d.ts +102 -0
  183. package/dist/react-native/createPinsQuery.d.ts.map +1 -0
  184. package/dist/react-native/createPinsQuery.js +93 -0
  185. package/dist/react-native/createPinsQuery.js.map +1 -0
  186. package/dist/react-native/generated/clientDefinitions.d.ts +131 -0
  187. package/dist/react-native/generated/clientDefinitions.d.ts.map +1 -0
  188. package/dist/react-native/generated/clientDefinitions.js +4 -0
  189. package/dist/react-native/generated/clientDefinitions.js.map +1 -0
  190. package/dist/react-native/generated/index.d.ts +9 -0
  191. package/dist/react-native/generated/index.d.ts.map +1 -0
  192. package/dist/react-native/generated/index.js +11 -0
  193. package/dist/react-native/generated/index.js.map +1 -0
  194. package/dist/react-native/generated/isUnexpected.d.ts +11 -0
  195. package/dist/react-native/generated/isUnexpected.d.ts.map +1 -0
  196. package/dist/react-native/generated/isUnexpected.js +78 -0
  197. package/dist/react-native/generated/isUnexpected.js.map +1 -0
  198. package/dist/react-native/generated/logger.d.ts +2 -0
  199. package/dist/react-native/generated/logger.d.ts.map +1 -0
  200. package/dist/react-native/generated/logger.js +5 -0
  201. package/dist/react-native/generated/logger.js.map +1 -0
  202. package/dist/react-native/generated/mapsRenderClient.d.ts +15 -0
  203. package/dist/react-native/generated/mapsRenderClient.d.ts.map +1 -0
  204. package/dist/react-native/generated/mapsRenderClient.js +44 -0
  205. package/dist/react-native/generated/mapsRenderClient.js.map +1 -0
  206. package/dist/react-native/generated/outputModels.d.ts +93 -0
  207. package/dist/react-native/generated/outputModels.d.ts.map +1 -0
  208. package/dist/react-native/generated/outputModels.js +4 -0
  209. package/dist/react-native/generated/outputModels.js.map +1 -0
  210. package/dist/react-native/generated/parameters.d.ts +384 -0
  211. package/dist/react-native/generated/parameters.d.ts.map +1 -0
  212. package/dist/react-native/generated/parameters.js +4 -0
  213. package/dist/react-native/generated/parameters.js.map +1 -0
  214. package/dist/react-native/generated/responses.d.ts +248 -0
  215. package/dist/react-native/generated/responses.d.ts.map +1 -0
  216. package/dist/react-native/generated/responses.js +4 -0
  217. package/dist/react-native/generated/responses.js.map +1 -0
  218. package/dist/react-native/index.d.ts +7 -0
  219. package/dist/react-native/index.d.ts.map +1 -0
  220. package/dist/react-native/index.js +9 -0
  221. package/dist/react-native/index.js.map +1 -0
  222. package/dist/react-native/mapsRender.d.ts +53 -0
  223. package/dist/react-native/mapsRender.d.ts.map +1 -0
  224. package/dist/react-native/mapsRender.js +40 -0
  225. package/dist/react-native/mapsRender.js.map +1 -0
  226. package/dist/react-native/package.json +3 -0
  227. package/dist/react-native/positionToTileXY.d.ts +47 -0
  228. package/dist/react-native/positionToTileXY.d.ts.map +1 -0
  229. package/dist/react-native/positionToTileXY.js +65 -0
  230. package/dist/react-native/positionToTileXY.js.map +1 -0
  231. package/package.json +86 -72
  232. package/dist/index.js +0 -404
  233. package/dist/index.js.map +0 -1
  234. package/dist-esm/src/createPathQuery.js.map +0 -1
  235. package/dist-esm/src/createPinsQuery.js.map +0 -1
  236. package/dist-esm/src/index.js +0 -9
  237. package/dist-esm/src/index.js.map +0 -1
  238. package/dist-esm/src/mapsRender.js.map +0 -1
  239. package/dist-esm/src/positionToTileXY.js.map +0 -1
  240. package/types/maps-render-rest.d.ts +0 -1212
  241. /package/{dist-esm/src → dist/browser}/createMultiCollection.js +0 -0
  242. /package/{dist-esm/src → dist/browser}/createMultiCollection.js.map +0 -0
  243. /package/review/{maps-render.api.md → maps-render-node.api.md} +0 -0
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../generated/logger.ts","../generated/mapsRenderClient.ts","../src/mapsRender.ts","../generated/isUnexpected.ts","../src/positionToTileXY.ts","../src/createMultiCollection.ts","../src/createPinsQuery.ts","../src/createPathQuery.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-render\");\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 { MapsRenderClient } from \"./clientDefinitions\";\n\n/** The optional parameters for the client */\nexport interface MapsRenderClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `MapsRenderClient`\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 = \"2024-04-01\", ...options }: MapsRenderClientOptions = {},\n): MapsRenderClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `https://atlas.microsoft.com`;\n const userAgentInfo = `azsdk-js-maps-render-rest/2.0.0-beta.1`;\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 MapsRenderClient;\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 type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsRenderClient } from \"../generated\";\nimport createClient from \"../generated/mapsRenderClient\";\n\n/**\n * Creates an instance of MapsRenderClient from a subscription key.\n *\n * @example\n * ```ts\n * import MapsRender from \"@azure-rest/maps-Render\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsRender(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Render Client\n */\nexport default function MapsRender(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsRenderClient;\n/**\n * Creates an instance of MapsRender from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts\n * import MapsRenderClient from \"@azure-rest/maps-render\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsRender(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 Render Client\n */\nexport default function MapsRender(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsRenderClient;\n/**\n * Creates an instance of MapsRender from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts\n * import MapsRender from \"@azure-rest/maps-render\";\n * import { AzureSASCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsRender(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Render Client\n */\nexport default function MapsRender(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsRenderClient;\nexport default function MapsRender(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsRenderClient {\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 {\n RenderGetMapTile200Response,\n RenderGetMapTileDefaultResponse,\n RenderGetMapTileset200Response,\n RenderGetMapTilesetDefaultResponse,\n RenderGetMapAttribution200Response,\n RenderGetMapAttributionDefaultResponse,\n RenderGetMapStateTile200Response,\n RenderGetMapStateTileDefaultResponse,\n RenderGetCopyrightCaption200Response,\n RenderGetCopyrightCaptionDefaultResponse,\n RenderGetMapStaticImage200Response,\n RenderGetMapStaticImageDefaultResponse,\n RenderGetCopyrightFromBoundingBox200Response,\n RenderGetCopyrightFromBoundingBoxDefaultResponse,\n RenderGetCopyrightForTile200Response,\n RenderGetCopyrightForTileDefaultResponse,\n RenderGetCopyrightForWorld200Response,\n RenderGetCopyrightForWorldDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /map/tile\": [\"200\"],\n \"GET /map/tileset\": [\"200\"],\n \"GET /map/attribution\": [\"200\"],\n \"GET /map/statetile\": [\"200\"],\n \"GET /map/copyright/caption/{format}\": [\"200\"],\n \"GET /map/static\": [\"200\"],\n \"GET /map/copyright/bounding/{format}\": [\"200\"],\n \"GET /map/copyright/tile/{format}\": [\"200\"],\n \"GET /map/copyright/world/{format}\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: RenderGetMapTile200Response | RenderGetMapTileDefaultResponse,\n): response is RenderGetMapTileDefaultResponse;\nexport function isUnexpected(\n response: RenderGetMapTileset200Response | RenderGetMapTilesetDefaultResponse,\n): response is RenderGetMapTilesetDefaultResponse;\nexport function isUnexpected(\n response:\n | RenderGetMapAttribution200Response\n | RenderGetMapAttributionDefaultResponse,\n): response is RenderGetMapAttributionDefaultResponse;\nexport function isUnexpected(\n response:\n | RenderGetMapStateTile200Response\n | RenderGetMapStateTileDefaultResponse,\n): response is RenderGetMapStateTileDefaultResponse;\nexport function isUnexpected(\n response:\n | RenderGetCopyrightCaption200Response\n | RenderGetCopyrightCaptionDefaultResponse,\n): response is RenderGetCopyrightCaptionDefaultResponse;\nexport function isUnexpected(\n response:\n | RenderGetMapStaticImage200Response\n | RenderGetMapStaticImageDefaultResponse,\n): response is RenderGetMapStaticImageDefaultResponse;\nexport function isUnexpected(\n response:\n | RenderGetCopyrightFromBoundingBox200Response\n | RenderGetCopyrightFromBoundingBoxDefaultResponse,\n): response is RenderGetCopyrightFromBoundingBoxDefaultResponse;\nexport function isUnexpected(\n response:\n | RenderGetCopyrightForTile200Response\n | RenderGetCopyrightForTileDefaultResponse,\n): response is RenderGetCopyrightForTileDefaultResponse;\nexport function isUnexpected(\n response:\n | RenderGetCopyrightForWorld200Response\n | RenderGetCopyrightForWorldDefaultResponse,\n): response is RenderGetCopyrightForWorldDefaultResponse;\nexport function isUnexpected(\n response:\n | RenderGetMapTile200Response\n | RenderGetMapTileDefaultResponse\n | RenderGetMapTileset200Response\n | RenderGetMapTilesetDefaultResponse\n | RenderGetMapAttribution200Response\n | RenderGetMapAttributionDefaultResponse\n | RenderGetMapStateTile200Response\n | RenderGetMapStateTileDefaultResponse\n | RenderGetCopyrightCaption200Response\n | RenderGetCopyrightCaptionDefaultResponse\n | RenderGetMapStaticImage200Response\n | RenderGetMapStaticImageDefaultResponse\n | RenderGetCopyrightFromBoundingBox200Response\n | RenderGetCopyrightFromBoundingBoxDefaultResponse\n | RenderGetCopyrightForTile200Response\n | RenderGetCopyrightForTileDefaultResponse\n | RenderGetCopyrightForWorld200Response\n | RenderGetCopyrightForWorldDefaultResponse,\n): response is\n | RenderGetMapTileDefaultResponse\n | RenderGetMapTilesetDefaultResponse\n | RenderGetMapAttributionDefaultResponse\n | RenderGetMapStateTileDefaultResponse\n | RenderGetCopyrightCaptionDefaultResponse\n | RenderGetMapStaticImageDefaultResponse\n | RenderGetCopyrightFromBoundingBoxDefaultResponse\n | RenderGetCopyrightForTileDefaultResponse\n | RenderGetCopyrightForWorldDefaultResponse {\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 { LatLon } from \"@azure/maps-common\";\n\nfunction clip(n: number, minValue: number, maxValue: number): number {\n return Math.min(Math.max(n, minValue), maxValue);\n}\n\nconst MIN_LATITUDE = -85.05112878;\nconst MAX_LATITUDE = 85.05112878;\nconst MIN_LONGITUDE = -180;\nconst MAX_LONGITUDE = 180;\n/**\n * Calculates the XY tile coordinates that a coordinate falls into for a specific zoom level.\n * Reference: https://learn.microsoft.com/en-us/azure/azure-maps/zoom-levels-and-tile-grid?tabs=typescript#tile-math-source-code\n *\n * @example\n * ```ts\n * const zoom = 6;\n * const { x, y } = positionToTileXY([47.61559, -122.33817], 6, \"256\");\n * const response = await client\n * .path(\"/map/tile\")\n * .get({\n * queryParameters: { tilesetId: \"microsoft.base.road\", zoom, x, y },\n * })\n * ```\n *\n * @param position - Position coordinate in the format [latitude, longitude].\n * @param zoom - Zoom level.\n * @param tileSize - The size of the tiles in the tile pyramid.\n * @returns Tile XY coordinates.\n */\nexport function positionToTileXY(\n position: LatLon,\n zoom: number,\n tileSize: \"512\" | \"256\",\n): { x: number; y: number } {\n const latitude = clip(position[0], MIN_LATITUDE, MAX_LATITUDE);\n const longitude = clip(position[1], MIN_LONGITUDE, MAX_LONGITUDE);\n\n const x = (longitude + 180) / 360;\n const sinLatitude = Math.sin((latitude * Math.PI) / 180);\n const y = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);\n\n const tileSizeInNum = parseInt(tileSize);\n // tileSize needed in calculations as in rare cases the multiplying/rounding/dividing can make the difference of a pixel which can result in a completely different tile.\n const mapSize = Math.ceil(tileSizeInNum * Math.pow(2, zoom));\n\n return {\n x: Math.floor(clip(x * mapSize + 0.5, 0, mapSize - 1) / tileSizeInNum),\n y: Math.floor(clip(y * mapSize + 0.5, 0, mapSize - 1) / tileSizeInNum),\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n * Workaround to create a path query string for [ collectionFormat: multi ](https://swagger.io/docs/specification/2-0/describing-parameters/#:~:text=csv%20(-,default,-)).\n * This should be removed once the core-client support collectionFormat: multi.\n */\nexport function createMultiCollection(key: string, values: string[]): string {\n return values.slice(1).reduce((acc, value) => {\n return `${acc}&${key}=${value}`;\n }, values[0] || \"\");\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { LatLon } from \"@azure/maps-common\";\nimport { createMultiCollection } from \"./createMultiCollection\";\n\n/**\n * Specify how the pin's position and label text.\n */\nexport interface Pin {\n /** The coordinate of the pin. */\n coordinate: LatLon;\n /** The label text for the pin. */\n label?: string;\n}\n\n/**\n * The pin options for default/none image style..\n */\nexport interface PinOptions {\n /** The opacity of the pin. Range from 0 to 1 */\n opacity?: number;\n /**\n * The labels are centered at the pushpin 'label anchor.' The anchor location is predefined for built-in pushpins and is at the top center of custom pushpins (see below).\n * To override the label anchor, using the _labelAnchor_ option and provide X and Y pixel coordinates for the anchor.\n * These coordinates are relative to the top left corner of the pushpin image. Positive X values move the anchor to the right, and positive Y values move the anchor down.\n * For example, to position the label anchor 10 pixels right and 4 pixels above the top left corner of the pushpin image, use \\{labelAnchor: [10, -4]\\}\n * */\n labelAnchor?: [number, number];\n /** Color of the label. Range from 000000 to FFFFFF */\n labelColor?: string;\n /** Size of the label in pixels. */\n labelSizeInPixels?: number;\n /**\n * By default, custom pushpin images are drawn centered at the pin coordinates. This usually isn't ideal as it obscures the location that you're trying to highlight.\n * To override the anchor location of the pin image, use the _pinAnchor_ option. This uses the same format as the _labelAnchor_ options.\n * For example, if your custom pin image has the tip of the pin at the top left corner of the image, you can set the anchor to that spot by using \\{pinAnchor: [0, 0]\\}\n */\n pinAnchor?: [number, number];\n /** The ration of the pin. Range from -360 to 360*/\n rotationInDegree?: number;\n /** The scale of the pin. Should be greater than 0. */\n scale?: number;\n /** Color of the pin. Range from 000000 to FFFFFF */\n pinColor?: string;\n}\n\nconst optionKeyMap: Record<keyof PinOptions, string> = {\n opacity: \"al\",\n labelAnchor: \"la\",\n labelColor: \"lc\",\n labelSizeInPixels: \"ls\",\n pinAnchor: \"an\",\n rotationInDegree: \"ro\",\n scale: \"sc\",\n pinColor: \"co\",\n};\n\nfunction isOptionKeyMap(key: any): key is keyof PinOptions {\n return key in optionKeyMap;\n}\n\nexport interface PinSet {\n pins: Pin[];\n pinImage?: \"default\" | \"none\" | string;\n options?: PinOptions;\n}\n/**\n * Create a pin query string for _get map static image_\n *\n * @example\n * ```ts\n *\n * const pins = {\n * pins: [\n * { coordinate: [52.577, 13.35], label: \"Label start\" },\n * { coordinate: [52.6, 13.2988], label: \"Label end\" },\n * ],\n * pinImage: \"<image source url || default || none>\"\n * options: {\n * scale: 0.9,\n * pinColor: \"FF0000\",\n * labelColor: \"0000FF\",\n * labelSizeInPixels: 18,\n * }\n * );\n * const res = await client\n * .path(\"/map/static/{format}\", \"png\")\n * .get({\n * queryParameters: {\n * bbox: [13.228, 52.4559, 13.5794, 52.62],\n * zoom: 10,\n * pins: pins,\n * },\n * skipUrlEncoding: true,\n * })\n * ```\n *\n * @param pins - An array of {@link Pin} that specify the positions and label text of each pin.\n * @param pinImage - Specify the image source for custom pin. Set this to \"none\" if you don't want to show a pin image.\n * @param options - The style options of the pins. See {@link PinOptions}\n * @returns - The composed query string.\n */\n\nexport function createPinsQuery(pinSets: PinSet[]): string {\n const pinsQueries = pinSets.map(({ pins, pinImage = \"default\", options = {} }) => {\n // compose the pins' position query string\n const pinsQueryStr = pins\n .map(({ coordinate: [lat, lon], label }) => `${label ? `'${label}'` : \"\"}${lon} ${lat}`)\n .join(\"|\");\n // compose the options query string\n const optionsQueryStr = Object.entries(options).reduce<string>((queryStr, [key, val]) => {\n if (!isOptionKeyMap(key)) throw Error(`Unexpected option: ${key}`);\n if (Array.isArray(val)) return (queryStr += `|${optionKeyMap[key]}${val[0]} ${val[1]}`);\n return (queryStr += `|${optionKeyMap[key]}${val}`);\n }, \"\");\n if (pinImage === \"none\" || pinImage === \"default\") {\n return `${pinImage}${optionsQueryStr}||${pinsQueryStr}`;\n }\n return `custom${optionsQueryStr}||${pinsQueryStr}||${pinImage}`;\n });\n return createMultiCollection(\"pins\", pinsQueries);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { LatLon } from \"@azure/maps-common\";\nimport { createMultiCollection } from \"./createMultiCollection\";\n\n/**\n * The options that modify the style of a circular path.\n */\nexport interface CircularPathOptions {\n /** The line color of the path. Range from 000000 to FFFFFF. */\n lineColor?: string;\n /** The line opacity of the path. Range from 0 to 1. */\n lineOpacity?: number;\n /** The line width of the line. Should be greater than 0. */\n lineWidthInPixels?: number;\n}\n\n/**\n * The options that modify the style of a polygonal path.\n */\nexport interface PolygonalPathOptions extends CircularPathOptions {\n /** The fill color of the path. This only works if the path is a closed shape like polygon or circle. Range from 000000 to FFFFFF.*/\n fillColor?: string;\n /** The fill color of the path. This only works if the path is a closed shape like polygon or circle. Range from 0 to 1.*/\n fillOpacity?: number;\n}\n\ninterface PathOptionsForRequest extends PolygonalPathOptions {\n radius?: number;\n}\n\n/**\n * Specify a circular path.\n */\nexport interface CircularPath {\n /** The center of the circular path. */\n center: LatLon;\n /** The radius of the circular path. */\n radiusInMeters: number;\n /** The options that modify the style of the circular path. */\n options?: CircularPathOptions;\n}\n\nfunction isCircularPath(path: PolygonalPath | CircularPath): path is CircularPath {\n return \"center\" in path;\n}\n/**\n * Specify a polygonal path.\n */\nexport interface PolygonalPath {\n /** The coordinates of the polygonal path. The identical coordinate in the first & last position construct a closed polygon.*/\n coordinates: LatLon[];\n /** The options that modify the style of the polygonal path. */\n options?: PolygonalPathOptions;\n}\n\nconst optionKeyMap: Record<keyof PathOptionsForRequest, string> = {\n lineColor: \"lc\",\n lineOpacity: \"la\",\n fillColor: \"fc\",\n fillOpacity: \"fa\",\n lineWidthInPixels: \"lw\",\n radius: \"ra\",\n};\n\nfunction isOptionKey(key: any): key is keyof PathOptionsForRequest {\n return key in optionKeyMap;\n}\n\nfunction comosePathVal(coordinates: LatLon[], options: PathOptionsForRequest): string {\n // compose the coordinates query string\n const coordinatesQueryStr = coordinates.map(([lat, lon]) => `${lon} ${lat}`).join(\"|\");\n // compose the options query string\n const optionsQueryStr = Object.entries(options).reduce<string>((queryStr, [key, val]) => {\n if (!isOptionKey(key)) throw Error(`Unknown key ${key}`);\n queryStr += `${queryStr ? \"|\" : \"\"}${optionKeyMap[key]}${val}`;\n return queryStr;\n }, \"\");\n return optionsQueryStr + \"||\" + coordinatesQueryStr;\n}\n\n/**\n * Create a path query string for _get map static image_ request.\n *\n * @example\n * ```ts\n * const circularPath = {\n * center: [52.4559, 13.228],\n * radiusInMeters: 10000,\n * options: {\n * lineColor: \"000000\",\n * lineOpacity: 0.9,\n * lineWidthInPixels: 2,\n * },\n * };\n *\n * const linearPath = {\n * coordinates: [\n * [52.577, 13.35],\n * [52.6, 13.2988],\n * [52.32, 13.2988],\n * ],\n * options: {\n * lineColor: \"000000\",\n * lineOpacity: 0.9,\n * lineWidthInPixels: 2,\n * },\n * };\n *\n * const polygonPath = {\n * coordinates: [\n * [52.577, 13.35],\n * [52.6, 13.2988],\n * [52.32, 13.2988],\n * [52.577, 13.35],\n * ],\n * options: {\n * lineColor: \"000000\",\n * lineOpacity: 0.9,\n * lineWidthInPixels: 2,\n * fillColor: \"FFFFFF\",\n * fillOpacity: 0.8,\n * },\n * };\n *\n * const path = createPathQuery([circularPath, linearPath, polygonPath]);\n * // Send the request\n * const response = await client.path(\"/map/static/{format}\", \"png\").get({\n * queryParameters: {\n * bbox: [13.228,52.4559,13.5794,52.629],\n * path: path\n * }\n * });\n * ```\n *\n * @param paths - A collection of {@link PolygonalPath} and {@link CircularPath} that you want to draw on the image.\n * @param options - The options for the style of the path. See the possible options in {@link PolygonalPathOptions} and {@link CircularPathOptions}.\n */\nexport function createPathQuery(paths: Array<PolygonalPath | CircularPath>): string {\n const pathQueries = paths.map((path) => {\n if (isCircularPath(path)) {\n const { center, radiusInMeters, options } = path;\n return comosePathVal([center], { ...options, radius: radiusInMeters });\n }\n return comosePathVal(path.coordinates, path.options || {});\n });\n return createMultiCollection(\"path\", pathQueries);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport MapsRender from \"./mapsRender\";\n\nexport * from \"../generated\";\nexport * from \"./positionToTileXY\";\nexport * from \"./createPinsQuery\";\nexport * from \"./createPathQuery\";\nexport default MapsRender;\n"],"names":["createClientLogger","__rest","getClient","isTokenCredential","bearerTokenAuthenticationPolicy","createMapsClientIdPolicy","isSASCredential","optionKeyMap"],"mappings":";;;;;;;;;;;AA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AE,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IACH,OAAO,qBAAqB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACpD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { LatLon } from \"@azure/maps-common\";\nimport { createMultiCollection } from \"./createMultiCollection\";\n\n/**\n * The options that modify the style of a circular path.\n */\nexport interface CircularPathOptions {\n /** The line color of the path. Range from 000000 to FFFFFF. */\n lineColor?: string;\n /** The line opacity of the path. Range from 0 to 1. */\n lineOpacity?: number;\n /** The line width of the line. Should be greater than 0. */\n lineWidthInPixels?: number;\n}\n\n/**\n * The options that modify the style of a polygonal path.\n */\nexport interface PolygonalPathOptions extends CircularPathOptions {\n /** The fill color of the path. This only works if the path is a closed shape like polygon or circle. Range from 000000 to FFFFFF.*/\n fillColor?: string;\n /** The fill color of the path. This only works if the path is a closed shape like polygon or circle. Range from 0 to 1.*/\n fillOpacity?: number;\n}\n\ninterface PathOptionsForRequest extends PolygonalPathOptions {\n radius?: number;\n}\n\n/**\n * Specify a circular path.\n */\nexport interface CircularPath {\n /** The center of the circular path. */\n center: LatLon;\n /** The radius of the circular path. */\n radiusInMeters: number;\n /** The options that modify the style of the circular path. */\n options?: CircularPathOptions;\n}\n\nfunction isCircularPath(path: PolygonalPath | CircularPath): path is CircularPath {\n return \"center\" in path;\n}\n/**\n * Specify a polygonal path.\n */\nexport interface PolygonalPath {\n /** The coordinates of the polygonal path. The identical coordinate in the first & last position construct a closed polygon.*/\n coordinates: LatLon[];\n /** The options that modify the style of the polygonal path. */\n options?: PolygonalPathOptions;\n}\n\nconst optionKeyMap: Record<keyof PathOptionsForRequest, string> = {\n lineColor: \"lc\",\n lineOpacity: \"la\",\n fillColor: \"fc\",\n fillOpacity: \"fa\",\n lineWidthInPixels: \"lw\",\n radius: \"ra\",\n};\n\nfunction isOptionKey(key: any): key is keyof PathOptionsForRequest {\n return key in optionKeyMap;\n}\n\nfunction comosePathVal(coordinates: LatLon[], options: PathOptionsForRequest): string {\n // compose the coordinates query string\n const coordinatesQueryStr = coordinates.map(([lat, lon]) => `${lon} ${lat}`).join(\"|\");\n // compose the options query string\n const optionsQueryStr = Object.entries(options).reduce<string>((queryStr, [key, val]) => {\n if (!isOptionKey(key)) throw Error(`Unknown key ${key}`);\n queryStr += `${queryStr ? \"|\" : \"\"}${optionKeyMap[key]}${val}`;\n return queryStr;\n }, \"\");\n return optionsQueryStr + \"||\" + coordinatesQueryStr;\n}\n\n/**\n * Create a path query string for _get map static image_ request.\n *\n * @example\n * ```ts\n * const circularPath = {\n * center: [52.4559, 13.228],\n * radiusInMeters: 10000,\n * options: {\n * lineColor: \"000000\",\n * lineOpacity: 0.9,\n * lineWidthInPixels: 2,\n * },\n * };\n *\n * const linearPath = {\n * coordinates: [\n * [52.577, 13.35],\n * [52.6, 13.2988],\n * [52.32, 13.2988],\n * ],\n * options: {\n * lineColor: \"000000\",\n * lineOpacity: 0.9,\n * lineWidthInPixels: 2,\n * },\n * };\n *\n * const polygonPath = {\n * coordinates: [\n * [52.577, 13.35],\n * [52.6, 13.2988],\n * [52.32, 13.2988],\n * [52.577, 13.35],\n * ],\n * options: {\n * lineColor: \"000000\",\n * lineOpacity: 0.9,\n * lineWidthInPixels: 2,\n * fillColor: \"FFFFFF\",\n * fillOpacity: 0.8,\n * },\n * };\n *\n * const path = createPathQuery([circularPath, linearPath, polygonPath]);\n * // Send the request\n * const response = await client.path(\"/map/static/{format}\", \"png\").get({\n * queryParameters: {\n * bbox: [13.228,52.4559,13.5794,52.629],\n * path: path\n * }\n * });\n * ```\n *\n * @param paths - A collection of {@link PolygonalPath} and {@link CircularPath} that you want to draw on the image.\n * @param options - The options for the style of the path. See the possible options in {@link PolygonalPathOptions} and {@link CircularPathOptions}.\n */\nexport function createPathQuery(paths: Array<PolygonalPath | CircularPath>): string {\n const pathQueries = paths.map((path) => {\n if (isCircularPath(path)) {\n const { center, radiusInMeters, options } = path;\n return comosePathVal([center], { ...options, radius: radiusInMeters });\n }\n return comosePathVal(path.coordinates, path.options || {});\n });\n return createMultiCollection(\"path\", pathQueries);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createPinsQuery.js","sourceRoot":"","sources":["../../src/createPinsQuery.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AA2ChE,MAAM,YAAY,GAAqC;IACrD,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;IAChB,iBAAiB,EAAE,IAAI;IACvB,SAAS,EAAE,IAAI;IACf,gBAAgB,EAAE,IAAI;IACtB,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF,SAAS,cAAc,CAAC,GAAQ;IAC9B,OAAO,GAAG,IAAI,YAAY,CAAC;AAC7B,CAAC;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,MAAM,UAAU,eAAe,CAAC,OAAiB;IAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE,EAAE;QAC/E,0CAA0C;QAC1C,MAAM,YAAY,GAAG,IAAI;aACtB,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;aACvF,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,mCAAmC;QACnC,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAS,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;YACtF,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC;gBAAE,MAAM,KAAK,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAC;YACnE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;gBAAE,OAAO,CAAC,QAAQ,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACxF,OAAO,CAAC,QAAQ,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;QACrD,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAClD,OAAO,GAAG,QAAQ,GAAG,eAAe,KAAK,YAAY,EAAE,CAAC;QAC1D,CAAC;QACD,OAAO,SAAS,eAAe,KAAK,YAAY,KAAK,QAAQ,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;IACH,OAAO,qBAAqB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACpD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { LatLon } from \"@azure/maps-common\";\nimport { createMultiCollection } from \"./createMultiCollection\";\n\n/**\n * Specify how the pin's position and label text.\n */\nexport interface Pin {\n /** The coordinate of the pin. */\n coordinate: LatLon;\n /** The label text for the pin. */\n label?: string;\n}\n\n/**\n * The pin options for default/none image style..\n */\nexport interface PinOptions {\n /** The opacity of the pin. Range from 0 to 1 */\n opacity?: number;\n /**\n * The labels are centered at the pushpin 'label anchor.' The anchor location is predefined for built-in pushpins and is at the top center of custom pushpins (see below).\n * To override the label anchor, using the _labelAnchor_ option and provide X and Y pixel coordinates for the anchor.\n * These coordinates are relative to the top left corner of the pushpin image. Positive X values move the anchor to the right, and positive Y values move the anchor down.\n * For example, to position the label anchor 10 pixels right and 4 pixels above the top left corner of the pushpin image, use \\{labelAnchor: [10, -4]\\}\n * */\n labelAnchor?: [number, number];\n /** Color of the label. Range from 000000 to FFFFFF */\n labelColor?: string;\n /** Size of the label in pixels. */\n labelSizeInPixels?: number;\n /**\n * By default, custom pushpin images are drawn centered at the pin coordinates. This usually isn't ideal as it obscures the location that you're trying to highlight.\n * To override the anchor location of the pin image, use the _pinAnchor_ option. This uses the same format as the _labelAnchor_ options.\n * For example, if your custom pin image has the tip of the pin at the top left corner of the image, you can set the anchor to that spot by using \\{pinAnchor: [0, 0]\\}\n */\n pinAnchor?: [number, number];\n /** The ration of the pin. Range from -360 to 360*/\n rotationInDegree?: number;\n /** The scale of the pin. Should be greater than 0. */\n scale?: number;\n /** Color of the pin. Range from 000000 to FFFFFF */\n pinColor?: string;\n}\n\nconst optionKeyMap: Record<keyof PinOptions, string> = {\n opacity: \"al\",\n labelAnchor: \"la\",\n labelColor: \"lc\",\n labelSizeInPixels: \"ls\",\n pinAnchor: \"an\",\n rotationInDegree: \"ro\",\n scale: \"sc\",\n pinColor: \"co\",\n};\n\nfunction isOptionKeyMap(key: any): key is keyof PinOptions {\n return key in optionKeyMap;\n}\n\nexport interface PinSet {\n pins: Pin[];\n pinImage?: \"default\" | \"none\" | string;\n options?: PinOptions;\n}\n/**\n * Create a pin query string for _get map static image_\n *\n * @example\n * ```ts\n *\n * const pins = {\n * pins: [\n * { coordinate: [52.577, 13.35], label: \"Label start\" },\n * { coordinate: [52.6, 13.2988], label: \"Label end\" },\n * ],\n * pinImage: \"<image source url || default || none>\"\n * options: {\n * scale: 0.9,\n * pinColor: \"FF0000\",\n * labelColor: \"0000FF\",\n * labelSizeInPixels: 18,\n * }\n * );\n * const res = await client\n * .path(\"/map/static/{format}\", \"png\")\n * .get({\n * queryParameters: {\n * bbox: [13.228, 52.4559, 13.5794, 52.62],\n * zoom: 10,\n * pins: pins,\n * },\n * skipUrlEncoding: true,\n * })\n * ```\n *\n * @param pins - An array of {@link Pin} that specify the positions and label text of each pin.\n * @param pinImage - Specify the image source for custom pin. Set this to \"none\" if you don't want to show a pin image.\n * @param options - The style options of the pins. See {@link PinOptions}\n * @returns - The composed query string.\n */\n\nexport function createPinsQuery(pinSets: PinSet[]): string {\n const pinsQueries = pinSets.map(({ pins, pinImage = \"default\", options = {} }) => {\n // compose the pins' position query string\n const pinsQueryStr = pins\n .map(({ coordinate: [lat, lon], label }) => `${label ? `'${label}'` : \"\"}${lon} ${lat}`)\n .join(\"|\");\n // compose the options query string\n const optionsQueryStr = Object.entries(options).reduce<string>((queryStr, [key, val]) => {\n if (!isOptionKeyMap(key)) throw Error(`Unexpected option: ${key}`);\n if (Array.isArray(val)) return (queryStr += `|${optionKeyMap[key]}${val[0]} ${val[1]}`);\n return (queryStr += `|${optionKeyMap[key]}${val}`);\n }, \"\");\n if (pinImage === \"none\" || pinImage === \"default\") {\n return `${pinImage}${optionsQueryStr}||${pinsQueryStr}`;\n }\n return `custom${optionsQueryStr}||${pinsQueryStr}||${pinImage}`;\n });\n return createMultiCollection(\"pins\", pinsQueries);\n}\n"]}
@@ -1,9 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import MapsRender from "./mapsRender";
4
- export * from "../generated";
5
- export * from "./positionToTileXY";
6
- export * from "./createPinsQuery";
7
- export * from "./createPathQuery";
8
- export default MapsRender;
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,eAAe,UAAU,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport MapsRender from \"./mapsRender\";\n\nexport * from \"../generated\";\nexport * from \"./positionToTileXY\";\nexport * from \"./createPinsQuery\";\nexport * from \"./createPathQuery\";\nexport default MapsRender;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapsRender.js","sourceRoot":"","sources":["../../src/mapsRender.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,YAAY,MAAM,+BAA+B,CAAC;AA4DzD,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAqE,EACrE,oBAA4C,EAAE,EAC9C,eAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CACvB,+BAA+B,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,sCAAsC;SAC/C,CAAC,CACH,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsRenderClient } from \"../generated\";\nimport createClient from \"../generated/mapsRenderClient\";\n\n/**\n * Creates an instance of MapsRenderClient from a subscription key.\n *\n * @example\n * ```ts\n * import MapsRender from \"@azure-rest/maps-Render\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsRender(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Render Client\n */\nexport default function MapsRender(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsRenderClient;\n/**\n * Creates an instance of MapsRender from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts\n * import MapsRenderClient from \"@azure-rest/maps-render\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsRender(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 Render Client\n */\nexport default function MapsRender(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsRenderClient;\n/**\n * Creates an instance of MapsRender from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts\n * import MapsRender from \"@azure-rest/maps-render\";\n * import { AzureSASCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsRender(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Render Client\n */\nexport default function MapsRender(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsRenderClient;\nexport default function MapsRender(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsRenderClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"positionToTileXY.js","sourceRoot":"","sources":["../../src/positionToTileXY.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,SAAS,IAAI,CAAC,CAAS,EAAE,QAAgB,EAAE,QAAgB;IACzD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,WAAW,CAAC;AAClC,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC;AAC3B,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAgB,EAChB,IAAY,EACZ,QAAuB;IAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IAElE,MAAM,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAClC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;IACzD,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;IAEhF,MAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzC,yKAAyK;IACzK,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAE7D,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,GAAG,GAAG,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,aAAa,CAAC;QACtE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,GAAG,GAAG,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,aAAa,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { LatLon } from \"@azure/maps-common\";\n\nfunction clip(n: number, minValue: number, maxValue: number): number {\n return Math.min(Math.max(n, minValue), maxValue);\n}\n\nconst MIN_LATITUDE = -85.05112878;\nconst MAX_LATITUDE = 85.05112878;\nconst MIN_LONGITUDE = -180;\nconst MAX_LONGITUDE = 180;\n/**\n * Calculates the XY tile coordinates that a coordinate falls into for a specific zoom level.\n * Reference: https://learn.microsoft.com/en-us/azure/azure-maps/zoom-levels-and-tile-grid?tabs=typescript#tile-math-source-code\n *\n * @example\n * ```ts\n * const zoom = 6;\n * const { x, y } = positionToTileXY([47.61559, -122.33817], 6, \"256\");\n * const response = await client\n * .path(\"/map/tile\")\n * .get({\n * queryParameters: { tilesetId: \"microsoft.base.road\", zoom, x, y },\n * })\n * ```\n *\n * @param position - Position coordinate in the format [latitude, longitude].\n * @param zoom - Zoom level.\n * @param tileSize - The size of the tiles in the tile pyramid.\n * @returns Tile XY coordinates.\n */\nexport function positionToTileXY(\n position: LatLon,\n zoom: number,\n tileSize: \"512\" | \"256\",\n): { x: number; y: number } {\n const latitude = clip(position[0], MIN_LATITUDE, MAX_LATITUDE);\n const longitude = clip(position[1], MIN_LONGITUDE, MAX_LONGITUDE);\n\n const x = (longitude + 180) / 360;\n const sinLatitude = Math.sin((latitude * Math.PI) / 180);\n const y = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);\n\n const tileSizeInNum = parseInt(tileSize);\n // tileSize needed in calculations as in rare cases the multiplying/rounding/dividing can make the difference of a pixel which can result in a completely different tile.\n const mapSize = Math.ceil(tileSizeInNum * Math.pow(2, zoom));\n\n return {\n x: Math.floor(clip(x * mapSize + 0.5, 0, mapSize - 1) / tileSizeInNum),\n y: Math.floor(clip(y * mapSize + 0.5, 0, mapSize - 1) / tileSizeInNum),\n };\n}\n"]}