@azure-rest/maps-timezone 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +247 -0
- package/dist/browser/MapsTimeZone.d.ts +52 -0
- package/dist/browser/MapsTimeZone.d.ts.map +1 -0
- package/dist/browser/MapsTimeZone.js +40 -0
- package/dist/browser/MapsTimeZone.js.map +1 -0
- package/dist/browser/generated/clientDefinitions.d.ts +63 -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 +8 -0
- package/dist/browser/generated/isUnexpected.d.ts.map +1 -0
- package/dist/browser/generated/isUnexpected.js +76 -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/mapsTimeZoneClient.d.ts +15 -0
- package/dist/browser/generated/mapsTimeZoneClient.d.ts.map +1 -0
- package/dist/browser/generated/mapsTimeZoneClient.js +42 -0
- package/dist/browser/generated/mapsTimeZoneClient.js.map +1 -0
- package/dist/browser/generated/outputModels.d.ts +134 -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 +62 -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 +99 -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/MapsTimeZone.d.ts +52 -0
- package/dist/commonjs/MapsTimeZone.d.ts.map +1 -0
- package/dist/commonjs/MapsTimeZone.js +44 -0
- package/dist/commonjs/MapsTimeZone.js.map +1 -0
- package/dist/commonjs/generated/clientDefinitions.d.ts +63 -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 +8 -0
- package/dist/commonjs/generated/isUnexpected.d.ts.map +1 -0
- package/dist/commonjs/generated/isUnexpected.js +79 -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/mapsTimeZoneClient.d.ts +15 -0
- package/dist/commonjs/generated/mapsTimeZoneClient.d.ts.map +1 -0
- package/dist/commonjs/generated/mapsTimeZoneClient.js +45 -0
- package/dist/commonjs/generated/mapsTimeZoneClient.js.map +1 -0
- package/dist/commonjs/generated/outputModels.d.ts +134 -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 +62 -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 +99 -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/MapsTimeZone.d.ts +52 -0
- package/dist/esm/MapsTimeZone.d.ts.map +1 -0
- package/dist/esm/MapsTimeZone.js +40 -0
- package/dist/esm/MapsTimeZone.js.map +1 -0
- package/dist/esm/generated/clientDefinitions.d.ts +63 -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 +8 -0
- package/dist/esm/generated/isUnexpected.d.ts.map +1 -0
- package/dist/esm/generated/isUnexpected.js +76 -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/mapsTimeZoneClient.d.ts +15 -0
- package/dist/esm/generated/mapsTimeZoneClient.d.ts.map +1 -0
- package/dist/esm/generated/mapsTimeZoneClient.js +42 -0
- package/dist/esm/generated/mapsTimeZoneClient.js.map +1 -0
- package/dist/esm/generated/outputModels.d.ts +134 -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 +62 -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 +99 -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/MapsTimeZone.d.ts +52 -0
- package/dist/react-native/MapsTimeZone.d.ts.map +1 -0
- package/dist/react-native/MapsTimeZone.js +40 -0
- package/dist/react-native/MapsTimeZone.js.map +1 -0
- package/dist/react-native/generated/clientDefinitions.d.ts +63 -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 +8 -0
- package/dist/react-native/generated/isUnexpected.d.ts.map +1 -0
- package/dist/react-native/generated/isUnexpected.js +76 -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/mapsTimeZoneClient.d.ts +15 -0
- package/dist/react-native/generated/mapsTimeZoneClient.d.ts.map +1 -0
- package/dist/react-native/generated/mapsTimeZoneClient.js +42 -0
- package/dist/react-native/generated/mapsTimeZoneClient.js.map +1 -0
- package/dist/react-native/generated/outputModels.d.ts +134 -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 +62 -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 +99 -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 +133 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Microsoft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Azure Maps Timezone REST client library for JavaScript
|
|
2
|
+
|
|
3
|
+
Azure Maps Timezone Client
|
|
4
|
+
|
|
5
|
+
**If you are not familiar with our REST client, please spend 5 minutes to take a look at our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library. The REST client provides a lightweight and developer-friendly way to call Azure REST APIs.
|
|
6
|
+
|
|
7
|
+
Key links:
|
|
8
|
+
|
|
9
|
+
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-timezone-rest)
|
|
10
|
+
- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/maps-timezone)
|
|
11
|
+
- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-timezone-rest/samples)
|
|
12
|
+
|
|
13
|
+
## Getting started
|
|
14
|
+
|
|
15
|
+
### Currently supported environments
|
|
16
|
+
|
|
17
|
+
- LTS versions of Node.js
|
|
18
|
+
|
|
19
|
+
### Prerequisites
|
|
20
|
+
|
|
21
|
+
- You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package.
|
|
22
|
+
|
|
23
|
+
### Install the `@azure-rest/maps-timezone` package
|
|
24
|
+
|
|
25
|
+
Install the Azure Maps Timezone REST client library for JavaScript with `npm`:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @azure-rest/maps-timezone
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Create and authenticate a `MapsTimeZone`
|
|
32
|
+
|
|
33
|
+
You'll need a `credential` instance for authentication when creating the `MapsTimeZone` instance used to access the Azure Maps timezone APIs. You can use a Microsoft Entra ID credential, an Azure subscription key, or a Shared Access Signature (SAS) Token to authenticate. For more information on authentication, see [Authentication with Azure Maps](https://learn.microsoft.com/azure/azure-maps/azure-maps-authentication).
|
|
34
|
+
|
|
35
|
+
#### Using an Microsoft Entra ID credential
|
|
36
|
+
|
|
37
|
+
To use an [Microsoft Entra ID token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token), provide an instance of the desired credential type obtained from the [@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
|
|
38
|
+
|
|
39
|
+
To authenticate with Microsoft Entra ID, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity).
|
|
40
|
+
|
|
41
|
+
After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use. As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential) can be used to authenticate the client.
|
|
42
|
+
|
|
43
|
+
Set the values of the client ID, tenant ID, and client secret of the Microsoft Entra ID application as environment variables:
|
|
44
|
+
`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
const MapsTimeZone = require("@azure-rest/maps-timezone").default;
|
|
48
|
+
const { DefaultAzureCredential } = require("@azure/identity");
|
|
49
|
+
|
|
50
|
+
const credential = new DefaultAzureCredential();
|
|
51
|
+
const client = MapsTimeZone(credential);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Using a Subscription Key Credential
|
|
55
|
+
|
|
56
|
+
You can authenticate with your Azure Maps Subscription Key. Please install the `@azure/core-auth` package:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install @azure/core-auth
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
const MapsTimeZone = require("@azure-rest/maps-timezone").default;
|
|
64
|
+
const { AzureKeyCredential } = require("@azure/core-auth");
|
|
65
|
+
|
|
66
|
+
const credential = new AzureKeyCredential("<subscription-key>");
|
|
67
|
+
const client = MapsTimeZone(credential);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### Using a Shared Access Signature (SAS) Token Credential
|
|
71
|
+
|
|
72
|
+
Shared access signature (SAS) tokens are authentication tokens created using the JSON Web token (JWT) format and are cryptographically signed to prove authentication for an application to the Azure Maps REST API.
|
|
73
|
+
|
|
74
|
+
You can get the SAS token using [`AzureMapsManagementClient.accounts.listSas`](https://learn.microsoft.com/javascript/api/%40azure/arm-maps/accounts?view=azure-node-latest#@azure-arm-maps-accounts-listsas) from the `@azure/arm-maps` package. Please follow the section [Create and authenticate an `AzureMapsManagementClient`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/arm-maps#create-and-authenticate-an-azuremapsmanagementclient) to set up first.
|
|
75
|
+
|
|
76
|
+
Second, follow [Managed identities for Azure Maps](https://techcommunity.microsoft.com/t5/azure-maps-blog/managed-identities-for-azure-maps/ba-p/3666312) to create a managed identity for your Azure Maps account. Copy the principal ID (object ID) of the managed identity.
|
|
77
|
+
|
|
78
|
+
Finally, you can use the SAS token to authenticate the client:
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
const MapsTimeZone = require("@azure-rest/maps-timezone").default;
|
|
82
|
+
const { AzureSASCredential } = require("@azure/core-auth");
|
|
83
|
+
const { DefaultAzureCredential } = require("@azure/identity");
|
|
84
|
+
const { AzureMapsManagementClient } = require("@azure/arm-maps");
|
|
85
|
+
|
|
86
|
+
const subscriptionId = "<subscription ID of the map account>";
|
|
87
|
+
const resourceGroupName = "<resource group name of the map account>";
|
|
88
|
+
const accountName = "<name of the map account>";
|
|
89
|
+
const mapsAccountSasParameters = {
|
|
90
|
+
start: "<start time in ISO format>", // e.g., "2023-11-24T03:51:53.161Z"
|
|
91
|
+
expiry: "<expiry time in ISO format>", // maximum value to start + 1 day
|
|
92
|
+
maxRatePerSecond: 500,
|
|
93
|
+
principalId: "<principal ID (object ID) of the managed identity>",
|
|
94
|
+
signingKey: "primaryKey",
|
|
95
|
+
};
|
|
96
|
+
const credential = new DefaultAzureCredential();
|
|
97
|
+
const managementClient = new AzureMapsManagementClient(credential, subscriptionId);
|
|
98
|
+
const { accountSasToken } = await managementClient.accounts.listSas(
|
|
99
|
+
resourceGroupName,
|
|
100
|
+
accountName,
|
|
101
|
+
mapsAccountSasParameters,
|
|
102
|
+
);
|
|
103
|
+
if (accountSasToken === undefined) {
|
|
104
|
+
throw new Error("No accountSasToken was found for the Maps Account.");
|
|
105
|
+
}
|
|
106
|
+
const sasCredential = new AzureSASCredential(accountSasToken);
|
|
107
|
+
const client = MapsTimeZone(sasCredential);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Key concepts
|
|
111
|
+
|
|
112
|
+
### MapsTimeZone
|
|
113
|
+
|
|
114
|
+
`MapsTimeZone` is the primary interface for developers using the Azure Maps Timezone client library. Explore the methods on this client object to understand the different features of the Azure Maps Timezone service that you can access.
|
|
115
|
+
|
|
116
|
+
## Examples
|
|
117
|
+
|
|
118
|
+
The following sections provide several code snippets covering some of the most common Azure Maps Timezone tasks, including:
|
|
119
|
+
|
|
120
|
+
- [Get timezone by ID](#get-timezone-by-id)
|
|
121
|
+
- [Get timezone by coordinates](#get-timezone-by-coordinates)
|
|
122
|
+
- [Get Windows timezone IDs](#get-windows-timezone-ids)
|
|
123
|
+
- [Get IANA timezone IDs](#get-iana-timezone-ids)
|
|
124
|
+
- [Get IANA version](#get-iana-version)
|
|
125
|
+
- [Convert Windows timezone to IANA](#convert-windows-timezone-to-iana)
|
|
126
|
+
|
|
127
|
+
### Get timezone by ID
|
|
128
|
+
|
|
129
|
+
You can get timezone information for a specific IANA time zone ID.
|
|
130
|
+
|
|
131
|
+
```javascript
|
|
132
|
+
const response = await client.path("/timezone/byId/{format}", "json").get({
|
|
133
|
+
queryParameters: {
|
|
134
|
+
query: "America/New_York"
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
if (isUnexpected(response)) {
|
|
139
|
+
throw response.body.error;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
console.log(response.body);
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Get timezone by coordinates
|
|
146
|
+
|
|
147
|
+
You can get timezone information for a specific latitude-longitude pair.
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
const response = await client.path("/timezone/byCoordinates/{format}", "json").get({
|
|
151
|
+
queryParameters: {
|
|
152
|
+
query: [40.7128, -74.0060]
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
if (isUnexpected(response)) {
|
|
157
|
+
throw response.body.error;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
console.log(response.body);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Get Windows timezone IDs
|
|
164
|
+
|
|
165
|
+
You can get a list of Windows timezone IDs.
|
|
166
|
+
|
|
167
|
+
```javascript
|
|
168
|
+
const response = await client.path("/timezone/enumWindows/{format}", "json").get();
|
|
169
|
+
|
|
170
|
+
if (isUnexpected(response)) {
|
|
171
|
+
throw response.body.error;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
console.log(response.body);
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Get IANA timezone IDs
|
|
178
|
+
|
|
179
|
+
You can get a list of IANA timezone IDs.
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
const response = await client.path("/timezone/enumIana/{format}", "json").get();
|
|
183
|
+
|
|
184
|
+
if (isUnexpected(response)) {
|
|
185
|
+
throw response.body.error;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
console.log(response.body);
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Get IANA version
|
|
192
|
+
|
|
193
|
+
You can get the current IANA version number.
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
const response = await client.path("/timezone/ianaVersion/{format}", "json").get();
|
|
197
|
+
|
|
198
|
+
if (isUnexpected(response)) {
|
|
199
|
+
throw response.body.error;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
console.log(response.body.Version);
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Convert Windows timezone to IANA
|
|
206
|
+
|
|
207
|
+
You can convert a Windows timezone ID to a corresponding IANA ID.
|
|
208
|
+
|
|
209
|
+
```javascript
|
|
210
|
+
const response = await client.path("/timezone/windowsToIana/{format}", "json").get({
|
|
211
|
+
queryParameters: { query: "Eastern Standard Time" },
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
if (isUnexpected(response)) {
|
|
215
|
+
throw response.body.error;
|
|
216
|
+
} else if (response.body) {
|
|
217
|
+
console.log(response.body.map((ianaId) => ianaId).join(", "));
|
|
218
|
+
} else {
|
|
219
|
+
console.error("No data returned");
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Troubleshooting
|
|
224
|
+
|
|
225
|
+
### Logging
|
|
226
|
+
|
|
227
|
+
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
|
228
|
+
|
|
229
|
+
```javascript
|
|
230
|
+
const { setLogLevel } = require("@azure/logger");
|
|
231
|
+
|
|
232
|
+
setLogLevel("info");
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
|
|
236
|
+
|
|
237
|
+
## Next steps
|
|
238
|
+
|
|
239
|
+
Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-timezone-rest/samples) directory for detailed examples on how to use this library.
|
|
240
|
+
|
|
241
|
+
## Contributing
|
|
242
|
+
|
|
243
|
+
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) to learn more about how to build and test the code.
|
|
244
|
+
|
|
245
|
+
## Related projects
|
|
246
|
+
|
|
247
|
+
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ClientOptions } from "@azure-rest/core-client";
|
|
2
|
+
import type { AzureKeyCredential, AzureSASCredential, TokenCredential } from "@azure/core-auth";
|
|
3
|
+
import type { MapsTimeZoneClient } from "./generated/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Creates an instance of MapsTimeZoneClient from a subscription key.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import MapsTimeZone from "@azure-rest/maps-timezone";
|
|
10
|
+
*
|
|
11
|
+
* const credential = new AzureKeyCredential("<subscription-key>");
|
|
12
|
+
* const client = MapsTimeZone(credential);
|
|
13
|
+
*```
|
|
14
|
+
*
|
|
15
|
+
* @param credential - An AzureKeyCredential instance used to authenticate requests to the service
|
|
16
|
+
* @param options - Options used to configure the TimeZone Client
|
|
17
|
+
*/
|
|
18
|
+
export default function MapsTimeZone(credential: AzureKeyCredential, options?: ClientOptions): MapsTimeZoneClient;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an instance of MapsTimeZone from an Azure Identity `TokenCredential`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import MapsTimeZoneClient from "@azure-rest/maps-timezone";
|
|
25
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
26
|
+
*
|
|
27
|
+
* const credential = new DefaultAzureCredential();
|
|
28
|
+
* const client = MapsTimeZone(credential, "<maps-account-client-id>");
|
|
29
|
+
*```
|
|
30
|
+
*
|
|
31
|
+
* @param credential - An TokenCredential instance used to authenticate requests to the service
|
|
32
|
+
* @param mapsAccountClientId - The Azure Maps client id of a specific map resource
|
|
33
|
+
* @param options - Options used to configure the TimeZone Client
|
|
34
|
+
*/
|
|
35
|
+
export default function MapsTimeZone(credential: TokenCredential, mapsAccountClientId: string, options?: ClientOptions): MapsTimeZoneClient;
|
|
36
|
+
/**
|
|
37
|
+
* Creates an instance of MapsTimeZone from an Azure Identity `AzureSASCredential`.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import MapsTimeZone from "@azure-rest/maps-timezone";
|
|
42
|
+
* import { AzureSASCredential } from "@azure/core-auth";
|
|
43
|
+
*
|
|
44
|
+
* const credential = new AzureSASCredential("<SAS Token>");
|
|
45
|
+
* const client = MapsTimeZone(credential);
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @param credential - An AzureSASCredential instance used to authenticate requests to the service
|
|
49
|
+
* @param options - Options used to configure the TimeZone Client
|
|
50
|
+
*/
|
|
51
|
+
export default function MapsTimeZone(credential: AzureSASCredential, options?: ClientOptions): MapsTimeZoneClient;
|
|
52
|
+
//# sourceMappingURL=MapsTimeZone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapsTimeZone.d.ts","sourceRoot":"","sources":["../../src/MapsTimeZone.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIhG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,CAAC,EAAE,aAAa,GACtB,kBAAkB,CAAC;AACtB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,UAAU,EAAE,eAAe,EAC3B,mBAAmB,EAAE,MAAM,EAC3B,OAAO,CAAC,EAAE,aAAa,GACtB,kBAAkB,CAAC;AACtB;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,CAAC,EAAE,aAAa,GACtB,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { isSASCredential, isTokenCredential } from "@azure/core-auth";
|
|
4
|
+
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
|
5
|
+
import { createMapsClientIdPolicy } from "@azure/maps-common";
|
|
6
|
+
import createClient from "./generated/mapsTimeZoneClient.js";
|
|
7
|
+
export default function MapsTimeZone(credential, clientIdOrOptions = {}, maybeOptions = {}) {
|
|
8
|
+
const options = typeof clientIdOrOptions === "string" ? maybeOptions : clientIdOrOptions;
|
|
9
|
+
/**
|
|
10
|
+
* maps service requires a header "ms-x-client-id", which is different from the standard Microsoft Entra ID.
|
|
11
|
+
* So we need to do our own implementation.
|
|
12
|
+
* This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication
|
|
13
|
+
*/
|
|
14
|
+
if (isTokenCredential(credential)) {
|
|
15
|
+
const clientId = typeof clientIdOrOptions === "string" ? clientIdOrOptions : "";
|
|
16
|
+
if (!clientId) {
|
|
17
|
+
throw Error("Client id is needed for TokenCredential");
|
|
18
|
+
}
|
|
19
|
+
const client = createClient(undefined, options);
|
|
20
|
+
client.pipeline.addPolicy(bearerTokenAuthenticationPolicy({
|
|
21
|
+
credential,
|
|
22
|
+
scopes: "https://atlas.microsoft.com/.default",
|
|
23
|
+
}));
|
|
24
|
+
client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));
|
|
25
|
+
return client;
|
|
26
|
+
}
|
|
27
|
+
if (isSASCredential(credential)) {
|
|
28
|
+
const client = createClient(undefined, options);
|
|
29
|
+
client.pipeline.addPolicy({
|
|
30
|
+
name: "mapsSASCredentialPolicy",
|
|
31
|
+
async sendRequest(request, next) {
|
|
32
|
+
request.headers.set("Authorization", `jwt-sas ${credential.signature}`);
|
|
33
|
+
return next(request);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
return client;
|
|
37
|
+
}
|
|
38
|
+
return createClient(credential, options);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=MapsTimeZone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapsTimeZone.js","sourceRoot":"","sources":["../../src/MapsTimeZone.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,mCAAmC,CAAC;AA4D7D,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,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 { MapsTimeZoneClient } from \"./generated/index.js\";\nimport createClient from \"./generated/mapsTimeZoneClient.js\";\n\n/**\n * Creates an instance of MapsTimeZoneClient from a subscription key.\n *\n * @example\n * ```ts\n * import MapsTimeZone from \"@azure-rest/maps-timezone\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsTimeZone(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the TimeZone Client\n */\nexport default function MapsTimeZone(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsTimeZoneClient;\n/**\n * Creates an instance of MapsTimeZone from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts\n * import MapsTimeZoneClient from \"@azure-rest/maps-timezone\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsTimeZone(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 TimeZone Client\n */\nexport default function MapsTimeZone(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsTimeZoneClient;\n/**\n * Creates an instance of MapsTimeZone from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts\n * import MapsTimeZone from \"@azure-rest/maps-timezone\";\n * import { AzureSASCredential } from \"@azure/core-auth\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsTimeZone(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the TimeZone Client\n */\nexport default function MapsTimeZone(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsTimeZoneClient;\nexport default function MapsTimeZone(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsTimeZoneClient {\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"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TimeZoneGetTimeZoneByIDParameters, TimeZoneGetTimeZoneByCoordinatesParameters, TimeZoneGetWindowsTimezoneIdsParameters, TimeZoneGetIanaTimezoneIdsParameters, TimeZoneGetIanaVersionParameters, TimeZoneConvertWindowsTimezoneToIanaParameters } from "./parameters.js";
|
|
2
|
+
import { TimeZoneGetTimeZoneByID200Response, TimeZoneGetTimeZoneByIDDefaultResponse, TimeZoneGetTimeZoneByCoordinates200Response, TimeZoneGetTimeZoneByCoordinatesDefaultResponse, TimeZoneGetWindowsTimezoneIds200Response, TimeZoneGetWindowsTimezoneIdsDefaultResponse, TimeZoneGetIanaTimezoneIds200Response, TimeZoneGetIanaTimezoneIdsDefaultResponse, TimeZoneGetIanaVersion200Response, TimeZoneGetIanaVersionDefaultResponse, TimeZoneConvertWindowsTimezoneToIana200Response, TimeZoneConvertWindowsTimezoneToIanaDefaultResponse } from "./responses.js";
|
|
3
|
+
import { Client, StreamableMethod } from "@azure-rest/core-client";
|
|
4
|
+
export interface GetTimeZoneByID {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* The `Get Timezone By ID` API is an HTTP `GET` request that returns current, historical, and future time zone information for the specified IANA time zone ID.
|
|
8
|
+
*/
|
|
9
|
+
get(options: TimeZoneGetTimeZoneByIDParameters): StreamableMethod<TimeZoneGetTimeZoneByID200Response | TimeZoneGetTimeZoneByIDDefaultResponse>;
|
|
10
|
+
}
|
|
11
|
+
export interface GetTimeZoneByCoordinates {
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* The `Get Timezone By Coordinates` API is an HTTP `GET` request that returns current, historical, and future time zone information for a specified latitude-longitude pair. In addition, the API provides sunset and sunrise times for a given location, with the exception of regions that observe solar days.
|
|
15
|
+
*/
|
|
16
|
+
get(options: TimeZoneGetTimeZoneByCoordinatesParameters): StreamableMethod<TimeZoneGetTimeZoneByCoordinates200Response | TimeZoneGetTimeZoneByCoordinatesDefaultResponse>;
|
|
17
|
+
}
|
|
18
|
+
export interface GetWindowsTimezoneIds {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* The `Get Windows Time Zones` API is an HTTP `GET` request that returns a full list of Windows Time Zone IDs.
|
|
22
|
+
*/
|
|
23
|
+
get(options?: TimeZoneGetWindowsTimezoneIdsParameters): StreamableMethod<TimeZoneGetWindowsTimezoneIds200Response | TimeZoneGetWindowsTimezoneIdsDefaultResponse>;
|
|
24
|
+
}
|
|
25
|
+
export interface GetIanaTimezoneIds {
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* The `Get IANA Time Zones` API is an HTTP `GET` request that returns a full list of Internet Assigned Numbers Authority (IANA) time zone IDs. Updates to the IANA service are reflected in the system within one day.
|
|
29
|
+
*/
|
|
30
|
+
get(options?: TimeZoneGetIanaTimezoneIdsParameters): StreamableMethod<TimeZoneGetIanaTimezoneIds200Response | TimeZoneGetIanaTimezoneIdsDefaultResponse>;
|
|
31
|
+
}
|
|
32
|
+
export interface GetIanaVersion {
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* The `Get Time Zone IANA Version` API is an HTTP `GET` request that returns the current Internet Assigned Numbers Authority (IANA) version number as Metadata.
|
|
36
|
+
*/
|
|
37
|
+
get(options?: TimeZoneGetIanaVersionParameters): StreamableMethod<TimeZoneGetIanaVersion200Response | TimeZoneGetIanaVersionDefaultResponse>;
|
|
38
|
+
}
|
|
39
|
+
export interface ConvertWindowsTimezoneToIana {
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* The `Get Windows to IANA Time Zone` API is an HTTP `GET` request that returns a corresponding Internet Assigned Numbers Authority (IANA) ID, given a valid Windows Time Zone ID. Multiple IANA IDs may be returned for a single Windows ID. It is possible to narrow these results by adding an optional territory parameter.
|
|
43
|
+
*/
|
|
44
|
+
get(options: TimeZoneConvertWindowsTimezoneToIanaParameters): StreamableMethod<TimeZoneConvertWindowsTimezoneToIana200Response | TimeZoneConvertWindowsTimezoneToIanaDefaultResponse>;
|
|
45
|
+
}
|
|
46
|
+
export interface Routes {
|
|
47
|
+
/** Resource for '/timezone/byId/\{format\}' has methods for the following verbs: get */
|
|
48
|
+
(path: "/timezone/byId/{format}", format: "json"): GetTimeZoneByID;
|
|
49
|
+
/** Resource for '/timezone/byCoordinates/\{format\}' has methods for the following verbs: get */
|
|
50
|
+
(path: "/timezone/byCoordinates/{format}", format: "json"): GetTimeZoneByCoordinates;
|
|
51
|
+
/** Resource for '/timezone/enumWindows/\{format\}' has methods for the following verbs: get */
|
|
52
|
+
(path: "/timezone/enumWindows/{format}", format: "json"): GetWindowsTimezoneIds;
|
|
53
|
+
/** Resource for '/timezone/enumIana/\{format\}' has methods for the following verbs: get */
|
|
54
|
+
(path: "/timezone/enumIana/{format}", format: "json"): GetIanaTimezoneIds;
|
|
55
|
+
/** Resource for '/timezone/ianaVersion/\{format\}' has methods for the following verbs: get */
|
|
56
|
+
(path: "/timezone/ianaVersion/{format}", format: "json"): GetIanaVersion;
|
|
57
|
+
/** Resource for '/timezone/windowsToIana/\{format\}' has methods for the following verbs: get */
|
|
58
|
+
(path: "/timezone/windowsToIana/{format}", format: "json"): ConvertWindowsTimezoneToIana;
|
|
59
|
+
}
|
|
60
|
+
export type MapsTimeZoneClient = Client & {
|
|
61
|
+
path: Routes;
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=clientDefinitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientDefinitions.d.ts","sourceRoot":"","sources":["../../../src/generated/clientDefinitions.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,iCAAiC,EACjC,0CAA0C,EAC1C,uCAAuC,EACvC,oCAAoC,EACpC,gCAAgC,EAChC,8CAA8C,EAC/C,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kCAAkC,EAClC,sCAAsC,EACtC,2CAA2C,EAC3C,+CAA+C,EAC/C,wCAAwC,EACxC,4CAA4C,EAC5C,qCAAqC,EACrC,yCAAyC,EACzC,iCAAiC,EACjC,qCAAqC,EACrC,+CAA+C,EAC/C,mDAAmD,EACpD,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,GAAG,CACD,OAAO,EAAE,iCAAiC,GACzC,gBAAgB,CACjB,kCAAkC,GAAG,sCAAsC,CAC5E,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,GAAG,CACD,OAAO,EAAE,0CAA0C,GAClD,gBAAgB,CACf,2CAA2C,GAC3C,+CAA+C,CAClD,CAAC;CACH;AAED,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,GAAG,CACD,OAAO,CAAC,EAAE,uCAAuC,GAChD,gBAAgB,CACf,wCAAwC,GACxC,4CAA4C,CAC/C,CAAC;CACH;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,CACD,OAAO,CAAC,EAAE,oCAAoC,GAC7C,gBAAgB,CACf,qCAAqC,GACrC,yCAAyC,CAC5C,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,GAAG,CACD,OAAO,CAAC,EAAE,gCAAgC,GACzC,gBAAgB,CACjB,iCAAiC,GAAG,qCAAqC,CAC1E,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,GAAG,CACD,OAAO,EAAE,8CAA8C,GACtD,gBAAgB,CACf,+CAA+C,GAC/C,mDAAmD,CACtD,CAAC;CACH;AAED,MAAM,WAAW,MAAM;IACrB,wFAAwF;IACxF,CAAC,IAAI,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC;IACnE,iGAAiG;IACjG,CACE,IAAI,EAAE,kCAAkC,EACxC,MAAM,EAAE,MAAM,GACb,wBAAwB,CAAC;IAC5B,+FAA+F;IAC/F,CACE,IAAI,EAAE,gCAAgC,EACtC,MAAM,EAAE,MAAM,GACb,qBAAqB,CAAC;IACzB,4FAA4F;IAC5F,CAAC,IAAI,EAAE,6BAA6B,EAAE,MAAM,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAC1E,+FAA+F;IAC/F,CAAC,IAAI,EAAE,gCAAgC,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC;IACzE,iGAAiG;IACjG,CACE,IAAI,EAAE,kCAAkC,EACxC,MAAM,EAAE,MAAM,GACb,4BAA4B,CAAC;CACjC;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../../src/generated/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n TimeZoneGetTimeZoneByIDParameters,\n TimeZoneGetTimeZoneByCoordinatesParameters,\n TimeZoneGetWindowsTimezoneIdsParameters,\n TimeZoneGetIanaTimezoneIdsParameters,\n TimeZoneGetIanaVersionParameters,\n TimeZoneConvertWindowsTimezoneToIanaParameters,\n} from \"./parameters.js\";\nimport {\n TimeZoneGetTimeZoneByID200Response,\n TimeZoneGetTimeZoneByIDDefaultResponse,\n TimeZoneGetTimeZoneByCoordinates200Response,\n TimeZoneGetTimeZoneByCoordinatesDefaultResponse,\n TimeZoneGetWindowsTimezoneIds200Response,\n TimeZoneGetWindowsTimezoneIdsDefaultResponse,\n TimeZoneGetIanaTimezoneIds200Response,\n TimeZoneGetIanaTimezoneIdsDefaultResponse,\n TimeZoneGetIanaVersion200Response,\n TimeZoneGetIanaVersionDefaultResponse,\n TimeZoneConvertWindowsTimezoneToIana200Response,\n TimeZoneConvertWindowsTimezoneToIanaDefaultResponse,\n} from \"./responses.js\";\nimport { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface GetTimeZoneByID {\n /**\n *\n * The `Get Timezone By ID` API is an HTTP `GET` request that returns current, historical, and future time zone information for the specified IANA time zone ID.\n */\n get(\n options: TimeZoneGetTimeZoneByIDParameters,\n ): StreamableMethod<\n TimeZoneGetTimeZoneByID200Response | TimeZoneGetTimeZoneByIDDefaultResponse\n >;\n}\n\nexport interface GetTimeZoneByCoordinates {\n /**\n *\n * The `Get Timezone By Coordinates` API is an HTTP `GET` request that returns current, historical, and future time zone information for a specified latitude-longitude pair. In addition, the API provides sunset and sunrise times for a given location, with the exception of regions that observe solar days.\n */\n get(\n options: TimeZoneGetTimeZoneByCoordinatesParameters,\n ): StreamableMethod<\n | TimeZoneGetTimeZoneByCoordinates200Response\n | TimeZoneGetTimeZoneByCoordinatesDefaultResponse\n >;\n}\n\nexport interface GetWindowsTimezoneIds {\n /**\n *\n * The `Get Windows Time Zones` API is an HTTP `GET` request that returns a full list of Windows Time Zone IDs.\n */\n get(\n options?: TimeZoneGetWindowsTimezoneIdsParameters,\n ): StreamableMethod<\n | TimeZoneGetWindowsTimezoneIds200Response\n | TimeZoneGetWindowsTimezoneIdsDefaultResponse\n >;\n}\n\nexport interface GetIanaTimezoneIds {\n /**\n *\n * The `Get IANA Time Zones` API is an HTTP `GET` request that returns a full list of Internet Assigned Numbers Authority (IANA) time zone IDs. Updates to the IANA service are reflected in the system within one day.\n */\n get(\n options?: TimeZoneGetIanaTimezoneIdsParameters,\n ): StreamableMethod<\n | TimeZoneGetIanaTimezoneIds200Response\n | TimeZoneGetIanaTimezoneIdsDefaultResponse\n >;\n}\n\nexport interface GetIanaVersion {\n /**\n *\n * The `Get Time Zone IANA Version` API is an HTTP `GET` request that returns the current Internet Assigned Numbers Authority (IANA) version number as Metadata.\n */\n get(\n options?: TimeZoneGetIanaVersionParameters,\n ): StreamableMethod<\n TimeZoneGetIanaVersion200Response | TimeZoneGetIanaVersionDefaultResponse\n >;\n}\n\nexport interface ConvertWindowsTimezoneToIana {\n /**\n *\n * The `Get Windows to IANA Time Zone` API is an HTTP `GET` request that returns a corresponding Internet Assigned Numbers Authority (IANA) ID, given a valid Windows Time Zone ID. Multiple IANA IDs may be returned for a single Windows ID. It is possible to narrow these results by adding an optional territory parameter.\n */\n get(\n options: TimeZoneConvertWindowsTimezoneToIanaParameters,\n ): StreamableMethod<\n | TimeZoneConvertWindowsTimezoneToIana200Response\n | TimeZoneConvertWindowsTimezoneToIanaDefaultResponse\n >;\n}\n\nexport interface Routes {\n /** Resource for '/timezone/byId/\\{format\\}' has methods for the following verbs: get */\n (path: \"/timezone/byId/{format}\", format: \"json\"): GetTimeZoneByID;\n /** Resource for '/timezone/byCoordinates/\\{format\\}' has methods for the following verbs: get */\n (\n path: \"/timezone/byCoordinates/{format}\",\n format: \"json\",\n ): GetTimeZoneByCoordinates;\n /** Resource for '/timezone/enumWindows/\\{format\\}' has methods for the following verbs: get */\n (\n path: \"/timezone/enumWindows/{format}\",\n format: \"json\",\n ): GetWindowsTimezoneIds;\n /** Resource for '/timezone/enumIana/\\{format\\}' has methods for the following verbs: get */\n (path: \"/timezone/enumIana/{format}\", format: \"json\"): GetIanaTimezoneIds;\n /** Resource for '/timezone/ianaVersion/\\{format\\}' has methods for the following verbs: get */\n (path: \"/timezone/ianaVersion/{format}\", format: \"json\"): GetIanaVersion;\n /** Resource for '/timezone/windowsToIana/\\{format\\}' has methods for the following verbs: get */\n (\n path: \"/timezone/windowsToIana/{format}\",\n format: \"json\",\n ): ConvertWindowsTimezoneToIana;\n}\n\nexport type MapsTimeZoneClient = Client & {\n path: Routes;\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import MapsTimeZoneClient from "./mapsTimeZoneClient.js";
|
|
2
|
+
export * from "./mapsTimeZoneClient.js";
|
|
3
|
+
export * from "./parameters.js";
|
|
4
|
+
export * from "./responses.js";
|
|
5
|
+
export * from "./clientDefinitions.js";
|
|
6
|
+
export * from "./isUnexpected.js";
|
|
7
|
+
export * from "./outputModels.js";
|
|
8
|
+
export default MapsTimeZoneClient;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/index.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAEzD,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAElC,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import MapsTimeZoneClient from "./mapsTimeZoneClient.js";
|
|
4
|
+
export * from "./mapsTimeZoneClient.js";
|
|
5
|
+
export * from "./parameters.js";
|
|
6
|
+
export * from "./responses.js";
|
|
7
|
+
export * from "./clientDefinitions.js";
|
|
8
|
+
export * from "./isUnexpected.js";
|
|
9
|
+
export * from "./outputModels.js";
|
|
10
|
+
export default MapsTimeZoneClient;
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/generated/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAEzD,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAElC,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport MapsTimeZoneClient from \"./mapsTimeZoneClient.js\";\n\nexport * from \"./mapsTimeZoneClient.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./outputModels.js\";\n\nexport default MapsTimeZoneClient;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TimeZoneGetTimeZoneByID200Response, TimeZoneGetTimeZoneByIDDefaultResponse, TimeZoneGetTimeZoneByCoordinates200Response, TimeZoneGetTimeZoneByCoordinatesDefaultResponse, TimeZoneGetWindowsTimezoneIds200Response, TimeZoneGetWindowsTimezoneIdsDefaultResponse, TimeZoneGetIanaTimezoneIds200Response, TimeZoneGetIanaTimezoneIdsDefaultResponse, TimeZoneGetIanaVersion200Response, TimeZoneGetIanaVersionDefaultResponse, TimeZoneConvertWindowsTimezoneToIana200Response, TimeZoneConvertWindowsTimezoneToIanaDefaultResponse } from "./responses.js";
|
|
2
|
+
export declare function isUnexpected(response: TimeZoneGetTimeZoneByID200Response | TimeZoneGetTimeZoneByIDDefaultResponse): response is TimeZoneGetTimeZoneByIDDefaultResponse;
|
|
3
|
+
export declare function isUnexpected(response: TimeZoneGetTimeZoneByCoordinates200Response | TimeZoneGetTimeZoneByCoordinatesDefaultResponse): response is TimeZoneGetTimeZoneByCoordinatesDefaultResponse;
|
|
4
|
+
export declare function isUnexpected(response: TimeZoneGetWindowsTimezoneIds200Response | TimeZoneGetWindowsTimezoneIdsDefaultResponse): response is TimeZoneGetWindowsTimezoneIdsDefaultResponse;
|
|
5
|
+
export declare function isUnexpected(response: TimeZoneGetIanaTimezoneIds200Response | TimeZoneGetIanaTimezoneIdsDefaultResponse): response is TimeZoneGetIanaTimezoneIdsDefaultResponse;
|
|
6
|
+
export declare function isUnexpected(response: TimeZoneGetIanaVersion200Response | TimeZoneGetIanaVersionDefaultResponse): response is TimeZoneGetIanaVersionDefaultResponse;
|
|
7
|
+
export declare function isUnexpected(response: TimeZoneConvertWindowsTimezoneToIana200Response | TimeZoneConvertWindowsTimezoneToIanaDefaultResponse): response is TimeZoneConvertWindowsTimezoneToIanaDefaultResponse;
|
|
8
|
+
//# sourceMappingURL=isUnexpected.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUnexpected.d.ts","sourceRoot":"","sources":["../../../src/generated/isUnexpected.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kCAAkC,EAClC,sCAAsC,EACtC,2CAA2C,EAC3C,+CAA+C,EAC/C,wCAAwC,EACxC,4CAA4C,EAC5C,qCAAqC,EACrC,yCAAyC,EACzC,iCAAiC,EACjC,qCAAqC,EACrC,+CAA+C,EAC/C,mDAAmD,EACpD,MAAM,gBAAgB,CAAC;AAWxB,wBAAgB,YAAY,CAC1B,QAAQ,EACJ,kCAAkC,GAClC,sCAAsC,GACzC,QAAQ,IAAI,sCAAsC,CAAC;AACtD,wBAAgB,YAAY,CAC1B,QAAQ,EACJ,2CAA2C,GAC3C,+CAA+C,GAClD,QAAQ,IAAI,+CAA+C,CAAC;AAC/D,wBAAgB,YAAY,CAC1B,QAAQ,EACJ,wCAAwC,GACxC,4CAA4C,GAC/C,QAAQ,IAAI,4CAA4C,CAAC;AAC5D,wBAAgB,YAAY,CAC1B,QAAQ,EACJ,qCAAqC,GACrC,yCAAyC,GAC5C,QAAQ,IAAI,yCAAyC,CAAC;AACzD,wBAAgB,YAAY,CAC1B,QAAQ,EACJ,iCAAiC,GACjC,qCAAqC,GACxC,QAAQ,IAAI,qCAAqC,CAAC;AACrD,wBAAgB,YAAY,CAC1B,QAAQ,EACJ,+CAA+C,GAC/C,mDAAmD,GACtD,QAAQ,IAAI,mDAAmD,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
const responseMap = {
|
|
4
|
+
"GET /timezone/byId/{format}": ["200"],
|
|
5
|
+
"GET /timezone/byCoordinates/{format}": ["200"],
|
|
6
|
+
"GET /timezone/enumWindows/{format}": ["200"],
|
|
7
|
+
"GET /timezone/enumIana/{format}": ["200"],
|
|
8
|
+
"GET /timezone/ianaVersion/{format}": ["200"],
|
|
9
|
+
"GET /timezone/windowsToIana/{format}": ["200"],
|
|
10
|
+
};
|
|
11
|
+
export function isUnexpected(response) {
|
|
12
|
+
const lroOriginal = response.headers["x-ms-original-url"];
|
|
13
|
+
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
|
|
14
|
+
const method = response.request.method;
|
|
15
|
+
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
16
|
+
if (!pathDetails) {
|
|
17
|
+
pathDetails = getParametrizedPathSuccess(method, url.pathname);
|
|
18
|
+
}
|
|
19
|
+
return !pathDetails.includes(response.status);
|
|
20
|
+
}
|
|
21
|
+
function getParametrizedPathSuccess(method, path) {
|
|
22
|
+
var _a, _b, _c, _d;
|
|
23
|
+
const pathParts = path.split("/");
|
|
24
|
+
// Traverse list to match the longest candidate
|
|
25
|
+
// matchedLen: the length of candidate path
|
|
26
|
+
// matchedValue: the matched status code array
|
|
27
|
+
let matchedLen = -1, matchedValue = [];
|
|
28
|
+
// Iterate the responseMap to find a match
|
|
29
|
+
for (const [key, value] of Object.entries(responseMap)) {
|
|
30
|
+
// Extracting the path from the map key which is in format
|
|
31
|
+
// GET /path/foo
|
|
32
|
+
if (!key.startsWith(method)) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const candidatePath = getPathFromMapKey(key);
|
|
36
|
+
// Get each part of the url path
|
|
37
|
+
const candidateParts = candidatePath.split("/");
|
|
38
|
+
// track if we have found a match to return the values found.
|
|
39
|
+
let found = true;
|
|
40
|
+
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
41
|
+
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) &&
|
|
42
|
+
((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
|
|
43
|
+
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
|
|
44
|
+
// If the current part of the candidate is a "template" part
|
|
45
|
+
// Try to use the suffix of pattern to match the path
|
|
46
|
+
// {guid} ==> $
|
|
47
|
+
// {guid}:export ==> :export$
|
|
48
|
+
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
|
|
49
|
+
if (!isMatched) {
|
|
50
|
+
found = false;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
// If the candidate part is not a template and
|
|
56
|
+
// the parts don't match mark the candidate as not found
|
|
57
|
+
// to move on with the next candidate path.
|
|
58
|
+
if (candidateParts[i] !== pathParts[j]) {
|
|
59
|
+
found = false;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// We finished evaluating the current candidate parts
|
|
64
|
+
// Update the matched value if and only if we found the longer pattern
|
|
65
|
+
if (found && candidatePath.length > matchedLen) {
|
|
66
|
+
matchedLen = candidatePath.length;
|
|
67
|
+
matchedValue = value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return matchedValue;
|
|
71
|
+
}
|
|
72
|
+
function getPathFromMapKey(mapKey) {
|
|
73
|
+
const pathStart = mapKey.indexOf("/");
|
|
74
|
+
return mapKey.slice(pathStart);
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=isUnexpected.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../src/generated/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAiBlC,MAAM,WAAW,GAA6B;IAC5C,6BAA6B,EAAE,CAAC,KAAK,CAAC;IACtC,sCAAsC,EAAE,CAAC,KAAK,CAAC;IAC/C,oCAAoC,EAAE,CAAC,KAAK,CAAC;IAC7C,iCAAiC,EAAE,CAAC,KAAK,CAAC;IAC1C,oCAAoC,EAAE,CAAC,KAAK,CAAC;IAC7C,sCAAsC,EAAE,CAAC,KAAK,CAAC;CAChD,CAAC;AAgCF,MAAM,UAAU,YAAY,CAC1B,QAYuD;IAQvD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;IACvC,IAAI,WAAW,GAAG,WAAW,CAAC,GAAG,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,0BAA0B,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,0BAA0B,CAAC,MAAc,EAAE,IAAY;;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,+CAA+C;IAC/C,2CAA2C;IAC3C,8CAA8C;IAC9C,IAAI,UAAU,GAAG,CAAC,CAAC,EACjB,YAAY,GAAa,EAAE,CAAC;IAE9B,0CAA0C;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACvD,0DAA0D;QAC1D,gBAAgB;QAChB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC5B,SAAS;QACX,CAAC;QACD,MAAM,aAAa,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAC7C,gCAAgC;QAChC,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEhD,6DAA6D;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC;QACjB,KACE,IAAI,CAAC,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,EAC3D,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAChB,CAAC,EAAE,EAAE,CAAC,EAAE,EACR,CAAC;YACD,IACE,CAAA,MAAA,cAAc,CAAC,CAAC,CAAC,0CAAE,UAAU,CAAC,GAAG,CAAC;gBAClC,CAAA,MAAA,cAAc,CAAC,CAAC,CAAC,0CAAE,OAAO,CAAC,GAAG,CAAC,MAAK,CAAC,CAAC,EACtC,CAAC;gBACD,MAAM,KAAK,GAAG,cAAc,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAC/C,GAAG,GAAG,MAAA,cAAc,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC;gBAClC,4DAA4D;gBAC5D,qDAAqD;gBACrD,eAAe;gBACf,6BAA6B;gBAC7B,MAAM,SAAS,GAAG,IAAI,MAAM,CAC1B,GAAG,MAAA,cAAc,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAC1C,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;gBAE3B,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,KAAK,GAAG,KAAK,CAAC;oBACd,MAAM;gBACR,CAAC;gBACD,SAAS;YACX,CAAC;YAED,8CAA8C;YAC9C,wDAAwD;YACxD,2CAA2C;YAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n TimeZoneGetTimeZoneByID200Response,\n TimeZoneGetTimeZoneByIDDefaultResponse,\n TimeZoneGetTimeZoneByCoordinates200Response,\n TimeZoneGetTimeZoneByCoordinatesDefaultResponse,\n TimeZoneGetWindowsTimezoneIds200Response,\n TimeZoneGetWindowsTimezoneIdsDefaultResponse,\n TimeZoneGetIanaTimezoneIds200Response,\n TimeZoneGetIanaTimezoneIdsDefaultResponse,\n TimeZoneGetIanaVersion200Response,\n TimeZoneGetIanaVersionDefaultResponse,\n TimeZoneConvertWindowsTimezoneToIana200Response,\n TimeZoneConvertWindowsTimezoneToIanaDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /timezone/byId/{format}\": [\"200\"],\n \"GET /timezone/byCoordinates/{format}\": [\"200\"],\n \"GET /timezone/enumWindows/{format}\": [\"200\"],\n \"GET /timezone/enumIana/{format}\": [\"200\"],\n \"GET /timezone/ianaVersion/{format}\": [\"200\"],\n \"GET /timezone/windowsToIana/{format}\": [\"200\"],\n};\n\nexport function isUnexpected(\n response:\n | TimeZoneGetTimeZoneByID200Response\n | TimeZoneGetTimeZoneByIDDefaultResponse,\n): response is TimeZoneGetTimeZoneByIDDefaultResponse;\nexport function isUnexpected(\n response:\n | TimeZoneGetTimeZoneByCoordinates200Response\n | TimeZoneGetTimeZoneByCoordinatesDefaultResponse,\n): response is TimeZoneGetTimeZoneByCoordinatesDefaultResponse;\nexport function isUnexpected(\n response:\n | TimeZoneGetWindowsTimezoneIds200Response\n | TimeZoneGetWindowsTimezoneIdsDefaultResponse,\n): response is TimeZoneGetWindowsTimezoneIdsDefaultResponse;\nexport function isUnexpected(\n response:\n | TimeZoneGetIanaTimezoneIds200Response\n | TimeZoneGetIanaTimezoneIdsDefaultResponse,\n): response is TimeZoneGetIanaTimezoneIdsDefaultResponse;\nexport function isUnexpected(\n response:\n | TimeZoneGetIanaVersion200Response\n | TimeZoneGetIanaVersionDefaultResponse,\n): response is TimeZoneGetIanaVersionDefaultResponse;\nexport function isUnexpected(\n response:\n | TimeZoneConvertWindowsTimezoneToIana200Response\n | TimeZoneConvertWindowsTimezoneToIanaDefaultResponse,\n): response is TimeZoneConvertWindowsTimezoneToIanaDefaultResponse;\nexport function isUnexpected(\n response:\n | TimeZoneGetTimeZoneByID200Response\n | TimeZoneGetTimeZoneByIDDefaultResponse\n | TimeZoneGetTimeZoneByCoordinates200Response\n | TimeZoneGetTimeZoneByCoordinatesDefaultResponse\n | TimeZoneGetWindowsTimezoneIds200Response\n | TimeZoneGetWindowsTimezoneIdsDefaultResponse\n | TimeZoneGetIanaTimezoneIds200Response\n | TimeZoneGetIanaTimezoneIdsDefaultResponse\n | TimeZoneGetIanaVersion200Response\n | TimeZoneGetIanaVersionDefaultResponse\n | TimeZoneConvertWindowsTimezoneToIana200Response\n | TimeZoneConvertWindowsTimezoneToIanaDefaultResponse,\n): response is\n | TimeZoneGetTimeZoneByIDDefaultResponse\n | TimeZoneGetTimeZoneByCoordinatesDefaultResponse\n | TimeZoneGetWindowsTimezoneIdsDefaultResponse\n | TimeZoneGetIanaTimezoneIdsDefaultResponse\n | TimeZoneGetIanaVersionDefaultResponse\n | TimeZoneConvertWindowsTimezoneToIanaDefaultResponse {\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/generated/logger.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,qCAAsC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/generated/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"maps-timezone\");\n"]}
|