@meshtrade/api-web 1.54.0 → 1.56.0

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.
@@ -13,134 +13,127 @@ export declare const file_meshtrade_studio_instrument_v1_unit: GenFile;
13
13
  */
14
14
  export declare enum Unit {
15
15
  /**
16
- * The unit is not specified. This is the default value and should be
17
- * treated as an error or an uninitialized state.
16
+ *
17
+ * Unknown or not specified.
18
+ * This is a default value to prevent accidental assignment and should not be used.
18
19
  *
19
20
  * @generated from enum value: UNIT_UNSPECIFIED = 0;
20
21
  */
21
22
  UNSPECIFIED = 0,
22
23
  /**
23
- * Indicates that the instrument's name or code itself represents a single
24
- * unit. This is used for assets where a separate unit qualifier is redundant,
25
- * such as "1 US Dollar" or "1 Bitcoin".
24
+ * No unit.
26
25
  *
27
26
  * @generated from enum value: UNIT_NULL = 1;
28
27
  */
29
28
  NULL = 1,
30
29
  /**
31
- * A single unit of a debt instrument, such as a promissory note, commercial
32
- * paper, or an Exchange-Traded Note (ETN).
30
+ * Promissory note.
33
31
  *
34
32
  * @generated from enum value: UNIT_NOTE = 2;
35
33
  */
36
34
  NOTE = 2,
37
35
  /**
38
- * A single unit of equity ownership in a corporation.
36
+ * Equity share.
39
37
  *
40
38
  * @generated from enum value: UNIT_SHARE = 3;
41
39
  */
42
40
  SHARE = 3,
43
41
  /**
44
- * A single unit of a special class of equity that has preferential rights
45
- * over common shares.
42
+ * Preference share.
46
43
  *
47
44
  * @generated from enum value: UNIT_PREFERENCE_SHARE = 4;
48
45
  */
49
46
  PREFERENCE_SHARE = 4,
50
47
  /**
51
- * A single unit of a bond issuance, typically with a defined face value
52
- * (e.g., $1,000).
48
+ * Bond.
53
49
  *
54
50
  * @generated from enum value: UNIT_BOND = 5;
55
51
  */
56
52
  BOND = 5,
57
53
  /**
58
- * A single unit of a short-term debt obligation, such as a Treasury Bill
59
- * (T-Bill).
54
+ * Treasury bill or similar short-term debt.
60
55
  *
61
56
  * @generated from enum value: UNIT_BILL = 6;
62
57
  */
63
58
  BILL = 6,
64
59
  /**
65
- * The standard unit for a derivative, such as a futures or forward
66
- * agreement, representing a standardized quantity of the underlying asset.
60
+ * Derivative contract.
67
61
  *
68
62
  * @generated from enum value: UNIT_CONTRACT = 7;
69
63
  */
70
64
  CONTRACT = 7,
71
65
  /**
72
- * The standard unit for an options derivative, giving the right to buy or
73
- * sell a specific amount of an underlying asset. One contract often
74
- * represents 100 shares of stock.
66
+ * Option contract.
75
67
  *
76
68
  * @generated from enum value: UNIT_OPTION = 8;
77
69
  */
78
70
  OPTION = 8,
79
71
  /**
80
- * The smallest individual unit of a digital asset or cryptocurrency recorded
81
- * on a blockchain.
72
+ * Digital token.
82
73
  *
83
74
  * @generated from enum value: UNIT_TOKEN = 9;
84
75
  */
85
76
  TOKEN = 9,
86
77
  /**
87
- * A standard volumetric unit for crude oil and petroleum products,
88
- * equivalent to 42 US gallons.
78
+ * Barrel.
89
79
  *
90
80
  * @generated from enum value: UNIT_BARREL = 10;
91
81
  */
92
82
  BARREL = 10,
93
83
  /**
94
- * A metric unit of mass, commonly used for quoting prices of precious
95
- * metals.
84
+ * Gram.
96
85
  *
97
86
  * @generated from enum value: UNIT_GRAM = 11;
98
87
  */
99
88
  GRAM = 11,
100
89
  /**
101
- * A metric unit of mass equal to 1,000 grams.
90
+ * Kilogram.
102
91
  *
103
92
  * @generated from enum value: UNIT_KILOGRAM = 12;
104
93
  */
105
94
  KILOGRAM = 12,
106
95
  /**
107
- * A metric unit of mass equal to 1,000 kilograms, often used for industrial
108
- * metals and bulk agricultural products.
96
+ * Metric ton (1 000 kg).
109
97
  *
110
98
  * @generated from enum value: UNIT_METRIC_TON = 13;
111
99
  */
112
100
  METRIC_TON = 13,
113
101
  /**
114
- * A troy ounce, the standard unit of mass for precious metals, equivalent to
115
- * approximately 31.103 grams.
102
+ * Troy ounce.
116
103
  *
117
104
  * @generated from enum value: UNIT_OUNCE = 14;
118
105
  */
119
106
  OUNCE = 14,
120
107
  /**
121
- * A fractional unit representing one-half of a troy ounce.
108
+ * Half troy ounce.
122
109
  *
123
110
  * @generated from enum value: UNIT_HALF_OUNCE = 15;
124
111
  */
125
112
  HALF_OUNCE = 15,
126
113
  /**
127
- * A fractional unit representing one-quarter of a troy ounce.
114
+ * Quarter troy ounce.
128
115
  *
129
116
  * @generated from enum value: UNIT_QUARTER_OUNCE = 16;
130
117
  */
131
118
  QUARTER_OUNCE = 16,
132
119
  /**
133
- * A fractional unit representing one-tenth of a troy ounce.
120
+ * One-tenth troy ounce.
134
121
  *
135
122
  * @generated from enum value: UNIT_ONE_TENTH_OUNCE = 17;
136
123
  */
137
124
  ONE_TENTH_OUNCE = 17,
138
125
  /**
139
- * A fractional unit representing one-hundredth of a troy ounce.
126
+ * One-hundredth troy ounce.
140
127
  *
141
128
  * @generated from enum value: UNIT_ONE_HUNDREDTH_OUNCE = 18;
142
129
  */
143
- ONE_HUNDREDTH_OUNCE = 18
130
+ ONE_HUNDREDTH_OUNCE = 18,
131
+ /**
132
+ * Tonne (1 000 kg).
133
+ *
134
+ * @generated from enum value: UNIT_TONNE = 19;
135
+ */
136
+ TONNE = 19
144
137
  }
145
138
  /**
146
139
  * Describes the enum meshtrade.studio.instrument.v1.Unit.
@@ -8,7 +8,7 @@ const codegenv2_1 = require("@bufbuild/protobuf/codegenv2");
8
8
  /**
9
9
  * Describes the file meshtrade/studio/instrument/v1/unit.proto.
10
10
  */
11
- exports.file_meshtrade_studio_instrument_v1_unit = (0, codegenv2_1.fileDesc)("CiltZXNodHJhZGUvc3R1ZGlvL2luc3RydW1lbnQvdjEvdW5pdC5wcm90bxIebWVzaHRyYWRlLnN0dWRpby5pbnN0cnVtZW50LnYxKvQCCgRVbml0EhQKEFVOSVRfVU5TUEVDSUZJRUQQABINCglVTklUX05VTEwQARINCglVTklUX05PVEUQAhIOCgpVTklUX1NIQVJFEAMSGQoVVU5JVF9QUkVGRVJFTkNFX1NIQVJFEAQSDQoJVU5JVF9CT05EEAUSDQoJVU5JVF9CSUxMEAYSEQoNVU5JVF9DT05UUkFDVBAHEg8KC1VOSVRfT1BUSU9OEAgSDgoKVU5JVF9UT0tFThAJEg8KC1VOSVRfQkFSUkVMEAoSDQoJVU5JVF9HUkFNEAsSEQoNVU5JVF9LSUxPR1JBTRAMEhMKD1VOSVRfTUVUUklDX1RPThANEg4KClVOSVRfT1VOQ0UQDhITCg9VTklUX0hBTEZfT1VOQ0UQDxIWChJVTklUX1FVQVJURVJfT1VOQ0UQEBIYChRVTklUX09ORV9URU5USF9PVU5DRRAREhwKGFVOSVRfT05FX0hVTkRSRURUSF9PVU5DRRASQmcKJWNvLm1lc2h0cmFkZS5hcGkuc3R1ZGlvLmluc3RydW1lbnQudjFaPmdpdGh1Yi5jb20vbWVzaHRyYWRlL2FwaS9nby9zdHVkaW8vaW5zdHJ1bWVudC92MTtpbnN0cnVtZW50X3YxYgZwcm90bzM");
11
+ exports.file_meshtrade_studio_instrument_v1_unit = (0, codegenv2_1.fileDesc)("CiltZXNodHJhZGUvc3R1ZGlvL2luc3RydW1lbnQvdjEvdW5pdC5wcm90bxIebWVzaHRyYWRlLnN0dWRpby5pbnN0cnVtZW50LnYxKoQDCgRVbml0EhQKEFVOSVRfVU5TUEVDSUZJRUQQABINCglVTklUX05VTEwQARINCglVTklUX05PVEUQAhIOCgpVTklUX1NIQVJFEAMSGQoVVU5JVF9QUkVGRVJFTkNFX1NIQVJFEAQSDQoJVU5JVF9CT05EEAUSDQoJVU5JVF9CSUxMEAYSEQoNVU5JVF9DT05UUkFDVBAHEg8KC1VOSVRfT1BUSU9OEAgSDgoKVU5JVF9UT0tFThAJEg8KC1VOSVRfQkFSUkVMEAoSDQoJVU5JVF9HUkFNEAsSEQoNVU5JVF9LSUxPR1JBTRAMEhMKD1VOSVRfTUVUUklDX1RPThANEg4KClVOSVRfT1VOQ0UQDhITCg9VTklUX0hBTEZfT1VOQ0UQDxIWChJVTklUX1FVQVJURVJfT1VOQ0UQEBIYChRVTklUX09ORV9URU5USF9PVU5DRRAREhwKGFVOSVRfT05FX0hVTkRSRURUSF9PVU5DRRASEg4KClVOSVRfVE9OTkUQE0JnCiVjby5tZXNodHJhZGUuYXBpLnN0dWRpby5pbnN0cnVtZW50LnYxWj5naXRodWIuY29tL21lc2h0cmFkZS9hcGkvZ28vc3R1ZGlvL2luc3RydW1lbnQvdjE7aW5zdHJ1bWVudF92MWIGcHJvdG8z");
12
12
  /**
13
13
  *
14
14
  * Unit defines the standard of measurement for an instrument, specifying how
@@ -20,134 +20,127 @@ exports.file_meshtrade_studio_instrument_v1_unit = (0, codegenv2_1.fileDesc)("Ci
20
20
  var Unit;
21
21
  (function (Unit) {
22
22
  /**
23
- * The unit is not specified. This is the default value and should be
24
- * treated as an error or an uninitialized state.
23
+ *
24
+ * Unknown or not specified.
25
+ * This is a default value to prevent accidental assignment and should not be used.
25
26
  *
26
27
  * @generated from enum value: UNIT_UNSPECIFIED = 0;
27
28
  */
28
29
  Unit[Unit["UNSPECIFIED"] = 0] = "UNSPECIFIED";
29
30
  /**
30
- * Indicates that the instrument's name or code itself represents a single
31
- * unit. This is used for assets where a separate unit qualifier is redundant,
32
- * such as "1 US Dollar" or "1 Bitcoin".
31
+ * No unit.
33
32
  *
34
33
  * @generated from enum value: UNIT_NULL = 1;
35
34
  */
36
35
  Unit[Unit["NULL"] = 1] = "NULL";
37
36
  /**
38
- * A single unit of a debt instrument, such as a promissory note, commercial
39
- * paper, or an Exchange-Traded Note (ETN).
37
+ * Promissory note.
40
38
  *
41
39
  * @generated from enum value: UNIT_NOTE = 2;
42
40
  */
43
41
  Unit[Unit["NOTE"] = 2] = "NOTE";
44
42
  /**
45
- * A single unit of equity ownership in a corporation.
43
+ * Equity share.
46
44
  *
47
45
  * @generated from enum value: UNIT_SHARE = 3;
48
46
  */
49
47
  Unit[Unit["SHARE"] = 3] = "SHARE";
50
48
  /**
51
- * A single unit of a special class of equity that has preferential rights
52
- * over common shares.
49
+ * Preference share.
53
50
  *
54
51
  * @generated from enum value: UNIT_PREFERENCE_SHARE = 4;
55
52
  */
56
53
  Unit[Unit["PREFERENCE_SHARE"] = 4] = "PREFERENCE_SHARE";
57
54
  /**
58
- * A single unit of a bond issuance, typically with a defined face value
59
- * (e.g., $1,000).
55
+ * Bond.
60
56
  *
61
57
  * @generated from enum value: UNIT_BOND = 5;
62
58
  */
63
59
  Unit[Unit["BOND"] = 5] = "BOND";
64
60
  /**
65
- * A single unit of a short-term debt obligation, such as a Treasury Bill
66
- * (T-Bill).
61
+ * Treasury bill or similar short-term debt.
67
62
  *
68
63
  * @generated from enum value: UNIT_BILL = 6;
69
64
  */
70
65
  Unit[Unit["BILL"] = 6] = "BILL";
71
66
  /**
72
- * The standard unit for a derivative, such as a futures or forward
73
- * agreement, representing a standardized quantity of the underlying asset.
67
+ * Derivative contract.
74
68
  *
75
69
  * @generated from enum value: UNIT_CONTRACT = 7;
76
70
  */
77
71
  Unit[Unit["CONTRACT"] = 7] = "CONTRACT";
78
72
  /**
79
- * The standard unit for an options derivative, giving the right to buy or
80
- * sell a specific amount of an underlying asset. One contract often
81
- * represents 100 shares of stock.
73
+ * Option contract.
82
74
  *
83
75
  * @generated from enum value: UNIT_OPTION = 8;
84
76
  */
85
77
  Unit[Unit["OPTION"] = 8] = "OPTION";
86
78
  /**
87
- * The smallest individual unit of a digital asset or cryptocurrency recorded
88
- * on a blockchain.
79
+ * Digital token.
89
80
  *
90
81
  * @generated from enum value: UNIT_TOKEN = 9;
91
82
  */
92
83
  Unit[Unit["TOKEN"] = 9] = "TOKEN";
93
84
  /**
94
- * A standard volumetric unit for crude oil and petroleum products,
95
- * equivalent to 42 US gallons.
85
+ * Barrel.
96
86
  *
97
87
  * @generated from enum value: UNIT_BARREL = 10;
98
88
  */
99
89
  Unit[Unit["BARREL"] = 10] = "BARREL";
100
90
  /**
101
- * A metric unit of mass, commonly used for quoting prices of precious
102
- * metals.
91
+ * Gram.
103
92
  *
104
93
  * @generated from enum value: UNIT_GRAM = 11;
105
94
  */
106
95
  Unit[Unit["GRAM"] = 11] = "GRAM";
107
96
  /**
108
- * A metric unit of mass equal to 1,000 grams.
97
+ * Kilogram.
109
98
  *
110
99
  * @generated from enum value: UNIT_KILOGRAM = 12;
111
100
  */
112
101
  Unit[Unit["KILOGRAM"] = 12] = "KILOGRAM";
113
102
  /**
114
- * A metric unit of mass equal to 1,000 kilograms, often used for industrial
115
- * metals and bulk agricultural products.
103
+ * Metric ton (1 000 kg).
116
104
  *
117
105
  * @generated from enum value: UNIT_METRIC_TON = 13;
118
106
  */
119
107
  Unit[Unit["METRIC_TON"] = 13] = "METRIC_TON";
120
108
  /**
121
- * A troy ounce, the standard unit of mass for precious metals, equivalent to
122
- * approximately 31.103 grams.
109
+ * Troy ounce.
123
110
  *
124
111
  * @generated from enum value: UNIT_OUNCE = 14;
125
112
  */
126
113
  Unit[Unit["OUNCE"] = 14] = "OUNCE";
127
114
  /**
128
- * A fractional unit representing one-half of a troy ounce.
115
+ * Half troy ounce.
129
116
  *
130
117
  * @generated from enum value: UNIT_HALF_OUNCE = 15;
131
118
  */
132
119
  Unit[Unit["HALF_OUNCE"] = 15] = "HALF_OUNCE";
133
120
  /**
134
- * A fractional unit representing one-quarter of a troy ounce.
121
+ * Quarter troy ounce.
135
122
  *
136
123
  * @generated from enum value: UNIT_QUARTER_OUNCE = 16;
137
124
  */
138
125
  Unit[Unit["QUARTER_OUNCE"] = 16] = "QUARTER_OUNCE";
139
126
  /**
140
- * A fractional unit representing one-tenth of a troy ounce.
127
+ * One-tenth troy ounce.
141
128
  *
142
129
  * @generated from enum value: UNIT_ONE_TENTH_OUNCE = 17;
143
130
  */
144
131
  Unit[Unit["ONE_TENTH_OUNCE"] = 17] = "ONE_TENTH_OUNCE";
145
132
  /**
146
- * A fractional unit representing one-hundredth of a troy ounce.
133
+ * One-hundredth troy ounce.
147
134
  *
148
135
  * @generated from enum value: UNIT_ONE_HUNDREDTH_OUNCE = 18;
149
136
  */
150
137
  Unit[Unit["ONE_HUNDREDTH_OUNCE"] = 18] = "ONE_HUNDREDTH_OUNCE";
138
+ /**
139
+ * Tonne (1 000 kg).
140
+ *
141
+ * @generated from enum value: UNIT_TONNE = 19;
142
+ */
143
+ Unit[Unit["TONNE"] = 19] = "TONNE";
151
144
  })(Unit || (exports.Unit = Unit = {}));
152
145
  /**
153
146
  * Describes the enum meshtrade.studio.instrument.v1.Unit.
@@ -6,10 +6,12 @@ export * from "./decimal_pb";
6
6
  export * from "./ledger_pb";
7
7
  export * from "./sorting_pb";
8
8
  export * from "./time_of_day_pb";
9
+ export * from "./timezone_pb";
9
10
  export * from "./token_pb";
10
11
  export * from "./amount";
11
12
  export * from "./amountWrapper";
12
13
  export * from "./decimalConversions";
13
14
  export * from "./ledger";
14
15
  export * from "./token";
16
+ export * from "./timezone";
15
17
  export * from "./tokenWrapper";
@@ -34,6 +34,7 @@ __exportStar(require("./decimal_pb"), exports);
34
34
  __exportStar(require("./ledger_pb"), exports);
35
35
  __exportStar(require("./sorting_pb"), exports);
36
36
  __exportStar(require("./time_of_day_pb"), exports);
37
+ __exportStar(require("./timezone_pb"), exports);
37
38
  __exportStar(require("./token_pb"), exports);
38
39
  // ===================================================================
39
40
  // END OF AUTO-GENERATED SECTION
@@ -53,4 +54,5 @@ __exportStar(require("./amountWrapper"), exports);
53
54
  __exportStar(require("./decimalConversions"), exports);
54
55
  __exportStar(require("./ledger"), exports);
55
56
  __exportStar(require("./token"), exports);
57
+ __exportStar(require("./timezone"), exports);
56
58
  __exportStar(require("./tokenWrapper"), exports);
@@ -0,0 +1,27 @@
1
+ import { Timezone } from "./timezone_pb";
2
+ /**
3
+ * Converts a Timezone enum value to its IANA timezone string.
4
+ *
5
+ * The returned string is compatible with dayjs .tz(), Intl.DateTimeFormat,
6
+ * and any API that accepts IANA timezone identifiers.
7
+ *
8
+ * @example
9
+ * timezoneToString(Timezone.AFRICA_JOHANNESBURG) // "Africa/Johannesburg"
10
+ * timezoneToString(Timezone.UTC) // "UTC"
11
+ */
12
+ export declare function timezoneToString(timezone: Timezone): string;
13
+ /**
14
+ * Converts an IANA timezone string to the corresponding Timezone enum value.
15
+ *
16
+ * Accepts strings as returned by dayjs.tz.guess(), Intl.DateTimeFormat().resolvedOptions().timeZone,
17
+ * or any standard IANA identifier.
18
+ *
19
+ * @example
20
+ * stringToTimezone("Africa/Johannesburg") // Timezone.AFRICA_JOHANNESBURG
21
+ * stringToTimezone("UTC") // Timezone.UTC
22
+ */
23
+ export declare function stringToTimezone(timezoneStr: string): Timezone;
24
+ /**
25
+ * Returns all supported Timezone enum values (excluding UNSPECIFIED).
26
+ */
27
+ export declare const allTimezones: Timezone[];
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allTimezones = void 0;
4
+ exports.timezoneToString = timezoneToString;
5
+ exports.stringToTimezone = stringToTimezone;
6
+ const timezone_pb_1 = require("./timezone_pb");
7
+ /**
8
+ * Mapping from Timezone enum to IANA timezone string.
9
+ *
10
+ * These strings are compatible with dayjs .tz() and Intl.DateTimeFormat.
11
+ */
12
+ const timezoneToIANA = {
13
+ [timezone_pb_1.Timezone.UNSPECIFIED]: "",
14
+ [timezone_pb_1.Timezone.UTC]: "UTC",
15
+ [timezone_pb_1.Timezone.EUROPE_LONDON]: "Europe/London",
16
+ [timezone_pb_1.Timezone.AFRICA_CASABLANCA]: "Africa/Casablanca",
17
+ [timezone_pb_1.Timezone.AFRICA_LAGOS]: "Africa/Lagos",
18
+ [timezone_pb_1.Timezone.EUROPE_PARIS]: "Europe/Paris",
19
+ [timezone_pb_1.Timezone.AFRICA_JOHANNESBURG]: "Africa/Johannesburg",
20
+ [timezone_pb_1.Timezone.AFRICA_MAPUTO]: "Africa/Maputo",
21
+ [timezone_pb_1.Timezone.EUROPE_ATHENS]: "Europe/Athens",
22
+ [timezone_pb_1.Timezone.AFRICA_CAIRO]: "Africa/Cairo",
23
+ [timezone_pb_1.Timezone.ASIA_JERUSALEM]: "Asia/Jerusalem",
24
+ [timezone_pb_1.Timezone.EUROPE_MOSCOW]: "Europe/Moscow",
25
+ [timezone_pb_1.Timezone.EUROPE_ISTANBUL]: "Europe/Istanbul",
26
+ [timezone_pb_1.Timezone.AFRICA_NAIROBI]: "Africa/Nairobi",
27
+ [timezone_pb_1.Timezone.ASIA_RIYADH]: "Asia/Riyadh",
28
+ [timezone_pb_1.Timezone.ASIA_TEHRAN]: "Asia/Tehran",
29
+ [timezone_pb_1.Timezone.ASIA_DUBAI]: "Asia/Dubai",
30
+ [timezone_pb_1.Timezone.ASIA_KARACHI]: "Asia/Karachi",
31
+ [timezone_pb_1.Timezone.ASIA_KOLKATA]: "Asia/Kolkata",
32
+ [timezone_pb_1.Timezone.ASIA_DHAKA]: "Asia/Dhaka",
33
+ [timezone_pb_1.Timezone.ASIA_BANGKOK]: "Asia/Bangkok",
34
+ [timezone_pb_1.Timezone.ASIA_SHANGHAI]: "Asia/Shanghai",
35
+ [timezone_pb_1.Timezone.ASIA_SINGAPORE]: "Asia/Singapore",
36
+ [timezone_pb_1.Timezone.ASIA_HONG_KONG]: "Asia/Hong_Kong",
37
+ [timezone_pb_1.Timezone.AUSTRALIA_PERTH]: "Australia/Perth",
38
+ [timezone_pb_1.Timezone.ASIA_TOKYO]: "Asia/Tokyo",
39
+ [timezone_pb_1.Timezone.ASIA_SEOUL]: "Asia/Seoul",
40
+ [timezone_pb_1.Timezone.AUSTRALIA_ADELAIDE]: "Australia/Adelaide",
41
+ [timezone_pb_1.Timezone.AUSTRALIA_BRISBANE]: "Australia/Brisbane",
42
+ [timezone_pb_1.Timezone.AUSTRALIA_SYDNEY]: "Australia/Sydney",
43
+ [timezone_pb_1.Timezone.PACIFIC_AUCKLAND]: "Pacific/Auckland",
44
+ [timezone_pb_1.Timezone.AMERICA_SAO_PAULO]: "America/Sao_Paulo",
45
+ [timezone_pb_1.Timezone.AMERICA_ARGENTINA_BUENOS_AIRES]: "America/Argentina/Buenos_Aires",
46
+ [timezone_pb_1.Timezone.AMERICA_CARACAS]: "America/Caracas",
47
+ [timezone_pb_1.Timezone.AMERICA_SANTIAGO]: "America/Santiago",
48
+ [timezone_pb_1.Timezone.AMERICA_NEW_YORK]: "America/New_York",
49
+ [timezone_pb_1.Timezone.AMERICA_CHICAGO]: "America/Chicago",
50
+ [timezone_pb_1.Timezone.AMERICA_DENVER]: "America/Denver",
51
+ [timezone_pb_1.Timezone.AMERICA_LOS_ANGELES]: "America/Los_Angeles",
52
+ [timezone_pb_1.Timezone.AMERICA_ANCHORAGE]: "America/Anchorage",
53
+ [timezone_pb_1.Timezone.PACIFIC_HONOLULU]: "Pacific/Honolulu",
54
+ };
55
+ // Reverse mapping: IANA string → Timezone enum
56
+ const ianaToTimezone = {};
57
+ for (const [key, value] of Object.entries(timezoneToIANA)) {
58
+ if (value) {
59
+ ianaToTimezone[value] = Number(key);
60
+ }
61
+ }
62
+ /**
63
+ * Converts a Timezone enum value to its IANA timezone string.
64
+ *
65
+ * The returned string is compatible with dayjs .tz(), Intl.DateTimeFormat,
66
+ * and any API that accepts IANA timezone identifiers.
67
+ *
68
+ * @example
69
+ * timezoneToString(Timezone.AFRICA_JOHANNESBURG) // "Africa/Johannesburg"
70
+ * timezoneToString(Timezone.UTC) // "UTC"
71
+ */
72
+ function timezoneToString(timezone) {
73
+ const iana = timezoneToIANA[timezone];
74
+ if (iana === undefined) {
75
+ throw new Error(`Unsupported Timezone enum value: ${timezone}`);
76
+ }
77
+ return iana;
78
+ }
79
+ /**
80
+ * Converts an IANA timezone string to the corresponding Timezone enum value.
81
+ *
82
+ * Accepts strings as returned by dayjs.tz.guess(), Intl.DateTimeFormat().resolvedOptions().timeZone,
83
+ * or any standard IANA identifier.
84
+ *
85
+ * @example
86
+ * stringToTimezone("Africa/Johannesburg") // Timezone.AFRICA_JOHANNESBURG
87
+ * stringToTimezone("UTC") // Timezone.UTC
88
+ */
89
+ function stringToTimezone(timezoneStr) {
90
+ const tz = ianaToTimezone[timezoneStr];
91
+ if (tz === undefined) {
92
+ throw new Error(`Unsupported IANA timezone string: ${timezoneStr}`);
93
+ }
94
+ return tz;
95
+ }
96
+ /**
97
+ * Returns all supported Timezone enum values (excluding UNSPECIFIED).
98
+ */
99
+ exports.allTimezones = Object.keys(timezoneToIANA)
100
+ .map(Number)
101
+ .filter((v) => v !== timezone_pb_1.Timezone.UNSPECIFIED);