firebase-functions 6.6.0 → 7.0.0-rc.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/lib/_virtual/rolldown_runtime.js +34 -0
- package/lib/bin/firebase-functions.js +78 -103
- package/lib/common/app.js +35 -55
- package/lib/common/change.js +54 -75
- package/lib/common/config.js +41 -41
- package/lib/common/debug.js +23 -47
- package/lib/common/encoding.js +59 -82
- package/lib/common/onInit.js +26 -28
- package/lib/common/options.js +22 -42
- package/lib/common/params.d.ts +6 -6
- package/lib/common/params.js +0 -23
- package/lib/common/providers/database.js +270 -300
- package/lib/common/providers/firestore.js +66 -92
- package/lib/common/providers/https.d.ts +0 -1
- package/lib/common/providers/https.js +537 -539
- package/lib/common/providers/identity.js +393 -444
- package/lib/common/providers/tasks.js +64 -98
- package/lib/common/timezone.js +544 -542
- package/lib/common/trace.d.ts +0 -1
- package/lib/common/trace.js +63 -55
- package/lib/common/utilities/assertions.d.ts +11 -0
- package/lib/common/utilities/assertions.js +18 -0
- package/lib/common/utilities/encoder.js +20 -37
- package/lib/common/utilities/path-pattern.js +106 -132
- package/lib/common/utilities/path.js +28 -27
- package/lib/common/utilities/utils.js +23 -45
- package/lib/esm/_virtual/rolldown_runtime.mjs +16 -0
- package/lib/esm/bin/firebase-functions.mjs +91 -0
- package/lib/esm/common/app.mjs +39 -0
- package/lib/esm/common/change.mjs +57 -0
- package/lib/esm/common/config.mjs +45 -0
- package/lib/esm/common/debug.mjs +28 -0
- package/lib/esm/common/encoding.mjs +69 -0
- package/lib/esm/common/onInit.mjs +33 -0
- package/lib/esm/common/options.mjs +22 -0
- package/lib/esm/common/params.mjs +1 -0
- package/lib/esm/common/providers/database.mjs +269 -0
- package/lib/esm/common/providers/firestore.mjs +78 -0
- package/lib/esm/common/providers/https.mjs +573 -0
- package/lib/esm/common/providers/identity.mjs +428 -0
- package/lib/esm/common/providers/tasks.mjs +67 -0
- package/lib/esm/common/timezone.mjs +544 -0
- package/lib/esm/common/trace.mjs +73 -0
- package/lib/esm/common/utilities/assertions.mjs +17 -0
- package/lib/esm/common/utilities/encoder.mjs +21 -0
- package/lib/esm/common/utilities/path-pattern.mjs +116 -0
- package/lib/esm/common/utilities/path.mjs +35 -0
- package/lib/esm/common/utilities/utils.mjs +29 -0
- package/lib/esm/function-configuration.mjs +1 -0
- package/lib/esm/logger/common.mjs +23 -0
- package/lib/esm/logger/compat.mjs +25 -0
- package/lib/esm/logger/index.mjs +131 -0
- package/lib/esm/params/index.mjs +160 -0
- package/lib/esm/params/types.mjs +400 -0
- package/lib/esm/runtime/loader.mjs +132 -0
- package/lib/esm/runtime/manifest.mjs +134 -0
- package/lib/esm/types/global.d.mjs +1 -0
- package/lib/esm/v1/cloud-functions.mjs +206 -0
- package/lib/esm/v1/config.mjs +14 -0
- package/lib/esm/v1/function-builder.mjs +252 -0
- package/lib/esm/v1/function-configuration.mjs +72 -0
- package/lib/esm/v1/index.mjs +27 -0
- package/lib/esm/v1/providers/analytics.mjs +212 -0
- package/lib/esm/v1/providers/auth.mjs +156 -0
- package/lib/esm/v1/providers/database.mjs +243 -0
- package/lib/esm/v1/providers/firestore.mjs +131 -0
- package/lib/esm/v1/providers/https.mjs +82 -0
- package/lib/esm/v1/providers/pubsub.mjs +175 -0
- package/lib/esm/v1/providers/remoteConfig.mjs +64 -0
- package/lib/esm/v1/providers/storage.mjs +163 -0
- package/lib/esm/v1/providers/tasks.mjs +63 -0
- package/lib/esm/v1/providers/testLab.mjs +94 -0
- package/lib/esm/v2/core.mjs +4 -0
- package/lib/esm/v2/index.mjs +28 -0
- package/lib/esm/v2/options.mjs +102 -0
- package/lib/esm/v2/providers/alerts/alerts.mjs +85 -0
- package/lib/esm/v2/providers/alerts/appDistribution.mjs +75 -0
- package/lib/esm/v2/providers/alerts/billing.mjs +51 -0
- package/lib/esm/v2/providers/alerts/crashlytics.mjs +122 -0
- package/lib/esm/v2/providers/alerts/index.mjs +22 -0
- package/lib/esm/v2/providers/alerts/performance.mjs +66 -0
- package/lib/esm/v2/providers/database.mjs +197 -0
- package/lib/esm/v2/providers/dataconnect.mjs +130 -0
- package/lib/esm/v2/providers/eventarc.mjs +51 -0
- package/lib/esm/v2/providers/firestore.mjs +294 -0
- package/lib/esm/v2/providers/https.mjs +210 -0
- package/lib/esm/v2/providers/identity.mjs +103 -0
- package/lib/esm/v2/providers/pubsub.mjs +148 -0
- package/lib/esm/v2/providers/remoteConfig.mjs +52 -0
- package/lib/esm/v2/providers/scheduler.mjs +84 -0
- package/lib/esm/v2/providers/storage.mjs +155 -0
- package/lib/esm/v2/providers/tasks.mjs +65 -0
- package/lib/esm/v2/providers/testLab.mjs +53 -0
- package/lib/esm/v2/trace.mjs +20 -0
- package/lib/function-configuration.d.ts +0 -0
- package/lib/function-configuration.js +0 -0
- package/lib/logger/common.js +21 -41
- package/lib/logger/compat.js +18 -33
- package/lib/logger/index.js +119 -130
- package/lib/params/index.d.ts +4 -2
- package/lib/params/index.js +150 -144
- package/lib/params/types.js +389 -423
- package/lib/runtime/loader.js +114 -148
- package/lib/runtime/manifest.js +106 -126
- package/lib/types/global.d.js +0 -0
- package/lib/v1/cloud-functions.d.ts +2 -2
- package/lib/v1/cloud-functions.js +193 -241
- package/lib/v1/config.d.ts +4 -7
- package/lib/v1/config.js +13 -75
- package/lib/v1/function-builder.js +239 -368
- package/lib/v1/function-configuration.js +70 -63
- package/lib/v1/index.js +118 -73
- package/lib/v1/providers/analytics.js +188 -235
- package/lib/v1/providers/auth.d.ts +2 -1
- package/lib/v1/providers/auth.js +159 -164
- package/lib/v1/providers/database.js +237 -242
- package/lib/v1/providers/firestore.js +131 -130
- package/lib/v1/providers/https.d.ts +2 -1
- package/lib/v1/providers/https.js +79 -86
- package/lib/v1/providers/pubsub.js +175 -172
- package/lib/v1/providers/remoteConfig.js +64 -68
- package/lib/v1/providers/storage.js +161 -163
- package/lib/v1/providers/tasks.d.ts +1 -1
- package/lib/v1/providers/tasks.js +65 -80
- package/lib/v1/providers/testLab.js +94 -94
- package/lib/v2/core.d.ts +1 -1
- package/lib/v2/core.js +5 -32
- package/lib/v2/index.d.ts +6 -3
- package/lib/v2/index.js +123 -75
- package/lib/v2/options.js +88 -114
- package/lib/v2/providers/alerts/alerts.js +76 -95
- package/lib/v2/providers/alerts/appDistribution.js +73 -78
- package/lib/v2/providers/alerts/billing.js +49 -53
- package/lib/v2/providers/alerts/crashlytics.js +110 -102
- package/lib/v2/providers/alerts/index.js +56 -53
- package/lib/v2/providers/alerts/performance.js +64 -74
- package/lib/v2/providers/database.js +177 -180
- package/lib/v2/providers/dataconnect.d.ts +95 -0
- package/lib/v2/providers/dataconnect.js +137 -0
- package/lib/v2/providers/eventarc.js +55 -77
- package/lib/v2/providers/firestore.js +262 -260
- package/lib/v2/providers/https.d.ts +3 -2
- package/lib/v2/providers/https.js +210 -247
- package/lib/v2/providers/identity.d.ts +2 -1
- package/lib/v2/providers/identity.js +96 -105
- package/lib/v2/providers/pubsub.js +149 -167
- package/lib/v2/providers/remoteConfig.js +54 -63
- package/lib/v2/providers/scheduler.js +84 -96
- package/lib/v2/providers/storage.js +147 -162
- package/lib/v2/providers/tasks.d.ts +1 -1
- package/lib/v2/providers/tasks.js +68 -95
- package/lib/v2/providers/testLab.js +55 -64
- package/lib/v2/trace.js +18 -19
- package/package.json +321 -88
- package/protos/compiledFirestore.mjs +3512 -0
- package/protos/update.sh +28 -7
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
//#region src/common/timezone.ts
|
|
2
|
+
const tzDatabase = {
|
|
3
|
+
"Africa/Abidjan": "+00:00",
|
|
4
|
+
"Africa/Accra": "+00:00",
|
|
5
|
+
"Africa/Addis_Ababa": "+03:00",
|
|
6
|
+
"Africa/Algiers": "+01:00",
|
|
7
|
+
"Africa/Asmara": "+03:00",
|
|
8
|
+
"Africa/Asmera": "+03:00",
|
|
9
|
+
"Africa/Bamako": "+00:00",
|
|
10
|
+
"Africa/Bangui": "+01:00",
|
|
11
|
+
"Africa/Banjul": "+00:00",
|
|
12
|
+
"Africa/Blantyre": "+02:00",
|
|
13
|
+
"Africa/Brazzaville": "+01:00",
|
|
14
|
+
"Africa/Bujumbura": "+02:00",
|
|
15
|
+
"Africa/Cairo": "+02:00",
|
|
16
|
+
"Africa/Casablanca": "+00:00",
|
|
17
|
+
"Africa/Ceuta": "+01:00",
|
|
18
|
+
"Africa/Conakry": "+00:00",
|
|
19
|
+
"Africa/Dakar": "+00:00",
|
|
20
|
+
"Africa/Dar_es_Salaam": "+03:00",
|
|
21
|
+
"Africa/Djibouti": "+03:00",
|
|
22
|
+
"Africa/Douala": "+01:00",
|
|
23
|
+
"Africa/El_Aaiun": "+00:00",
|
|
24
|
+
"Africa/Freetown": "+00:00",
|
|
25
|
+
"Africa/Gaborone": "+02:00",
|
|
26
|
+
"Africa/Harare": "+02:00",
|
|
27
|
+
"Africa/Johannesburg": "+02:00",
|
|
28
|
+
"Africa/Juba": "+03:00",
|
|
29
|
+
"Africa/Kampala": "+03:00",
|
|
30
|
+
"Africa/Khartoum": "+03:00",
|
|
31
|
+
"Africa/Kigali": "+02:00",
|
|
32
|
+
"Africa/Kinshasa": "+01:00",
|
|
33
|
+
"Africa/Lagos": "+01:00",
|
|
34
|
+
"Africa/Libreville": "+01:00",
|
|
35
|
+
"Africa/Lome": "+00:00",
|
|
36
|
+
"Africa/Luanda": "+01:00",
|
|
37
|
+
"Africa/Lubumbashi": "+02:00",
|
|
38
|
+
"Africa/Lusaka": "+02:00",
|
|
39
|
+
"Africa/Malabo": "+01:00",
|
|
40
|
+
"Africa/Maputo": "+02:00",
|
|
41
|
+
"Africa/Maseru": "+02:00",
|
|
42
|
+
"Africa/Mbabane": "+02:00",
|
|
43
|
+
"Africa/Mogadishu": "+03:00",
|
|
44
|
+
"Africa/Monrovia": "+00:00",
|
|
45
|
+
"Africa/Nairobi": "+03:00",
|
|
46
|
+
"Africa/Ndjamena": "+01:00",
|
|
47
|
+
"Africa/Niamey": "+01:00",
|
|
48
|
+
"Africa/Nouakchott": "+00:00",
|
|
49
|
+
"Africa/Ouagadougou": "+00:00",
|
|
50
|
+
"Africa/Porto-Novo": "+01:00",
|
|
51
|
+
"Africa/Sao_Tome": "+00:00",
|
|
52
|
+
"Africa/Timbuktu": "+00:00",
|
|
53
|
+
"Africa/Tripoli": "+02:00",
|
|
54
|
+
"Africa/Tunis": "+01:00",
|
|
55
|
+
"Africa/Windhoek": "+01:00",
|
|
56
|
+
"America/Adak": "-10:00",
|
|
57
|
+
"America/Anchorage": "-09:00",
|
|
58
|
+
"America/Anguilla": "-04:00",
|
|
59
|
+
"America/Antigua": "-04:00",
|
|
60
|
+
"America/Araguaina": "-03:00",
|
|
61
|
+
"America/Argentina/Buenos_Aires": "-03:00",
|
|
62
|
+
"America/Argentina/Catamarca": "-03:00",
|
|
63
|
+
"America/Argentina/ComodRivadavia": "-03:00",
|
|
64
|
+
"America/Argentina/Cordoba": "-03:00",
|
|
65
|
+
"America/Argentina/Jujuy": "-03:00",
|
|
66
|
+
"America/Argentina/La_Rioja": "-03:00",
|
|
67
|
+
"America/Argentina/Mendoza": "-03:00",
|
|
68
|
+
"America/Argentina/Rio_Gallegos": "-03:00",
|
|
69
|
+
"America/Argentina/Salta": "-03:00",
|
|
70
|
+
"America/Argentina/San_Juan": "-03:00",
|
|
71
|
+
"America/Argentina/San_Luis": "-03:00",
|
|
72
|
+
"America/Argentina/Tucuman": "-03:00",
|
|
73
|
+
"America/Argentina/Ushuaia": "-03:00",
|
|
74
|
+
"America/Aruba": "-04:00",
|
|
75
|
+
"America/Asuncion": "-04:00",
|
|
76
|
+
"America/Atikokan": "-05:00",
|
|
77
|
+
"America/Atka": "-10:00",
|
|
78
|
+
"America/Bahia": "-03:00",
|
|
79
|
+
"America/Bahia_Banderas": "-06:00",
|
|
80
|
+
"America/Barbados": "-04:00",
|
|
81
|
+
"America/Belem": "-03:00",
|
|
82
|
+
"America/Belize": "-06:00",
|
|
83
|
+
"America/Blanc-Sablon": "-04:00",
|
|
84
|
+
"America/Boa_Vista": "-04:00",
|
|
85
|
+
"America/Bogota": "-05:00",
|
|
86
|
+
"America/Boise": "-07:00",
|
|
87
|
+
"America/Buenos_Aires": "-03:00",
|
|
88
|
+
"America/Cambridge_Bay": "-07:00",
|
|
89
|
+
"America/Campo_Grande": "-04:00",
|
|
90
|
+
"America/Cancun": "-06:00",
|
|
91
|
+
"America/Caracas": "-04:30",
|
|
92
|
+
"America/Catamarca": "-03:00",
|
|
93
|
+
"America/Cayenne": "-03:00",
|
|
94
|
+
"America/Cayman": "-05:00",
|
|
95
|
+
"America/Chicago": "-06:00",
|
|
96
|
+
"America/Chihuahua": "-07:00",
|
|
97
|
+
"America/Coral_Harbour": "-05:00",
|
|
98
|
+
"America/Cordoba": "-03:00",
|
|
99
|
+
"America/Costa_Rica": "-06:00",
|
|
100
|
+
"America/Creston": "-07:00",
|
|
101
|
+
"America/Cuiaba": "-04:00",
|
|
102
|
+
"America/Curacao": "-04:00",
|
|
103
|
+
"America/Danmarkshavn": "+00:00",
|
|
104
|
+
"America/Dawson": "-08:00",
|
|
105
|
+
"America/Dawson_Creek": "-07:00",
|
|
106
|
+
"America/Denver": "-07:00",
|
|
107
|
+
"America/Detroit": "-05:00",
|
|
108
|
+
"America/Dominica": "-04:00",
|
|
109
|
+
"America/Edmonton": "-07:00",
|
|
110
|
+
"America/Eirunepe": "-05:00",
|
|
111
|
+
"America/El_Salvador": "-06:00",
|
|
112
|
+
"America/Ensenada": "-08:00",
|
|
113
|
+
"America/Fort_Wayne": "-05:00",
|
|
114
|
+
"America/Fortaleza": "-03:00",
|
|
115
|
+
"America/Glace_Bay": "-04:00",
|
|
116
|
+
"America/Godthab": "-03:00",
|
|
117
|
+
"America/Goose_Bay": "-04:00",
|
|
118
|
+
"America/Grand_Turk": "-05:00",
|
|
119
|
+
"America/Grenada": "-04:00",
|
|
120
|
+
"America/Guadeloupe": "-04:00",
|
|
121
|
+
"America/Guatemala": "-06:00",
|
|
122
|
+
"America/Guayaquil": "-05:00",
|
|
123
|
+
"America/Guyana": "-04:00",
|
|
124
|
+
"America/Halifax": "-04:00",
|
|
125
|
+
"America/Havana": "-05:00",
|
|
126
|
+
"America/Hermosillo": "-07:00",
|
|
127
|
+
"America/Indiana/Indianapolis": "-05:00",
|
|
128
|
+
"America/Indiana/Knox": "-06:00",
|
|
129
|
+
"America/Indiana/Marengo": "-05:00",
|
|
130
|
+
"America/Indiana/Petersburg": "-05:00",
|
|
131
|
+
"America/Indiana/Tell_City": "-06:00",
|
|
132
|
+
"America/Indiana/Valparaiso": "-06:00",
|
|
133
|
+
"America/Indiana/Vevay": "-05:00",
|
|
134
|
+
"America/Indiana/Vincennes": "-05:00",
|
|
135
|
+
"America/Indiana/Winamac": "-05:00",
|
|
136
|
+
"America/Indianapolis": "-05:00",
|
|
137
|
+
"America/Inuvik": "-07:00",
|
|
138
|
+
"America/Iqaluit": "-05:00",
|
|
139
|
+
"America/Jamaica": "-05:00",
|
|
140
|
+
"America/Jujuy": "-03:00",
|
|
141
|
+
"America/Juneau": "-09:00",
|
|
142
|
+
"America/Kentucky/Louisville": "-05:00",
|
|
143
|
+
"America/Kentucky/Monticello": "-05:00",
|
|
144
|
+
"America/Knox_IN": "-06:00",
|
|
145
|
+
"America/Kralendijk": "-04:00",
|
|
146
|
+
"America/La_Paz": "-04:00",
|
|
147
|
+
"America/Lima": "-05:00",
|
|
148
|
+
"America/Los_Angeles": "-08:00",
|
|
149
|
+
"America/Louisville": "-05:00",
|
|
150
|
+
"America/Lower_Princes": "-04:00",
|
|
151
|
+
"America/Maceio": "-03:00",
|
|
152
|
+
"America/Managua": "-06:00",
|
|
153
|
+
"America/Manaus": "-04:00",
|
|
154
|
+
"America/Marigot": "-04:00",
|
|
155
|
+
"America/Martinique": "-04:00",
|
|
156
|
+
"America/Matamoros": "-06:00",
|
|
157
|
+
"America/Mazatlan": "-07:00",
|
|
158
|
+
"America/Mendoza": "-03:00",
|
|
159
|
+
"America/Menominee": "-06:00",
|
|
160
|
+
"America/Merida": "-06:00",
|
|
161
|
+
"America/Metlakatla": "-08:00",
|
|
162
|
+
"America/Mexico_City": "-06:00",
|
|
163
|
+
"America/Miquelon": "-03:00",
|
|
164
|
+
"America/Moncton": "-04:00",
|
|
165
|
+
"America/Monterrey": "-06:00",
|
|
166
|
+
"America/Montevideo": "-03:00",
|
|
167
|
+
"America/Montreal": "-05:00",
|
|
168
|
+
"America/Montserrat": "-04:00",
|
|
169
|
+
"America/Nassau": "-05:00",
|
|
170
|
+
"America/New_York": "-05:00",
|
|
171
|
+
"America/Nipigon": "-05:00",
|
|
172
|
+
"America/Nome": "-09:00",
|
|
173
|
+
"America/Noronha": "-02:00",
|
|
174
|
+
"America/North_Dakota/Beulah": "-06:00",
|
|
175
|
+
"America/North_Dakota/Center": "-06:00",
|
|
176
|
+
"America/North_Dakota/New_Salem": "-06:00",
|
|
177
|
+
"America/Ojinaga": "-07:00",
|
|
178
|
+
"America/Panama": "-05:00",
|
|
179
|
+
"America/Pangnirtung": "-05:00",
|
|
180
|
+
"America/Paramaribo": "-03:00",
|
|
181
|
+
"America/Phoenix": "-07:00",
|
|
182
|
+
"America/Port_of_Spain": "-04:00",
|
|
183
|
+
"America/Port-au-Prince": "-05:00",
|
|
184
|
+
"America/Porto_Acre": "-05:00",
|
|
185
|
+
"America/Porto_Velho": "-04:00",
|
|
186
|
+
"America/Puerto_Rico": "-04:00",
|
|
187
|
+
"America/Rainy_River": "-06:00",
|
|
188
|
+
"America/Rankin_Inlet": "-06:00",
|
|
189
|
+
"America/Recife": "-03:00",
|
|
190
|
+
"America/Regina": "-06:00",
|
|
191
|
+
"America/Resolute": "-06:00",
|
|
192
|
+
"America/Rio_Branco": "-05:00",
|
|
193
|
+
"America/Rosario": "-03:00",
|
|
194
|
+
"America/Santa_Isabel": "-08:00",
|
|
195
|
+
"America/Santarem": "-03:00",
|
|
196
|
+
"America/Santiago": "-03:00",
|
|
197
|
+
"America/Santo_Domingo": "-04:00",
|
|
198
|
+
"America/Sao_Paulo": "-03:00",
|
|
199
|
+
"America/Scoresbysund": "-01:00",
|
|
200
|
+
"America/Shiprock": "-07:00",
|
|
201
|
+
"America/Sitka": "-09:00",
|
|
202
|
+
"America/St_Barthelemy": "-04:00",
|
|
203
|
+
"America/St_Johns": "-03:30",
|
|
204
|
+
"America/St_Kitts": "-04:00",
|
|
205
|
+
"America/St_Lucia": "-04:00",
|
|
206
|
+
"America/St_Thomas": "-04:00",
|
|
207
|
+
"America/St_Vincent": "-04:00",
|
|
208
|
+
"America/Swift_Current": "-06:00",
|
|
209
|
+
"America/Tegucigalpa": "-06:00",
|
|
210
|
+
"America/Thule": "-04:00",
|
|
211
|
+
"America/Thunder_Bay": "-05:00",
|
|
212
|
+
"America/Tijuana": "-08:00",
|
|
213
|
+
"America/Toronto": "-05:00",
|
|
214
|
+
"America/Tortola": "-04:00",
|
|
215
|
+
"America/Vancouver": "-08:00",
|
|
216
|
+
"America/Virgin": "-04:00",
|
|
217
|
+
"America/Whitehorse": "-08:00",
|
|
218
|
+
"America/Winnipeg": "-06:00",
|
|
219
|
+
"America/Yakutat": "-09:00",
|
|
220
|
+
"America/Yellowknife": "-07:00",
|
|
221
|
+
"Antarctica/Casey": "+11:00",
|
|
222
|
+
"Antarctica/Davis": "+05:00",
|
|
223
|
+
"Antarctica/DumontDUrville": "+10:00",
|
|
224
|
+
"Antarctica/Macquarie": "+11:00",
|
|
225
|
+
"Antarctica/Mawson": "+05:00",
|
|
226
|
+
"Antarctica/McMurdo": "+12:00",
|
|
227
|
+
"Antarctica/Palmer": "-04:00",
|
|
228
|
+
"Antarctica/Rothera": "-03:00",
|
|
229
|
+
"Antarctica/South_Pole": "+12:00",
|
|
230
|
+
"Antarctica/Syowa": "+03:00",
|
|
231
|
+
"Antarctica/Troll": "+00:00",
|
|
232
|
+
"Antarctica/Vostok": "+06:00",
|
|
233
|
+
"Arctic/Longyearbyen": "+01:00",
|
|
234
|
+
"Asia/Aden": "+03:00",
|
|
235
|
+
"Asia/Almaty": "+06:00",
|
|
236
|
+
"Asia/Amman": "+02:00",
|
|
237
|
+
"Asia/Anadyr": "+12:00",
|
|
238
|
+
"Asia/Aqtau": "+05:00",
|
|
239
|
+
"Asia/Aqtobe": "+05:00",
|
|
240
|
+
"Asia/Ashgabat": "+05:00",
|
|
241
|
+
"Asia/Ashkhabad": "+05:00",
|
|
242
|
+
"Asia/Baghdad": "+03:00",
|
|
243
|
+
"Asia/Bahrain": "+03:00",
|
|
244
|
+
"Asia/Baku": "+04:00",
|
|
245
|
+
"Asia/Bangkok": "+07:00",
|
|
246
|
+
"Asia/Beirut": "+02:00",
|
|
247
|
+
"Asia/Bishkek": "+06:00",
|
|
248
|
+
"Asia/Brunei": "+08:00",
|
|
249
|
+
"Asia/Calcutta": "+05:30",
|
|
250
|
+
"Asia/Choibalsan": "+08:00",
|
|
251
|
+
"Asia/Chongqing": "+08:00",
|
|
252
|
+
"Asia/Chungking": "+08:00",
|
|
253
|
+
"Asia/Colombo": "+05:30",
|
|
254
|
+
"Asia/Dacca": "+06:00",
|
|
255
|
+
"Asia/Damascus": "+02:00",
|
|
256
|
+
"Asia/Dhaka": "+06:00",
|
|
257
|
+
"Asia/Dili": "+09:00",
|
|
258
|
+
"Asia/Dubai": "+04:00",
|
|
259
|
+
"Asia/Dushanbe": "+05:00",
|
|
260
|
+
"Asia/Gaza": "+02:00",
|
|
261
|
+
"Asia/Harbin": "+08:00",
|
|
262
|
+
"Asia/Hebron": "+02:00",
|
|
263
|
+
"Asia/Ho_Chi_Minh": "+07:00",
|
|
264
|
+
"Asia/Hong_Kong": "+08:00",
|
|
265
|
+
"Asia/Hovd": "+07:00",
|
|
266
|
+
"Asia/Irkutsk": "+08:00",
|
|
267
|
+
"Asia/Istanbul": "+02:00",
|
|
268
|
+
"Asia/Jakarta": "+07:00",
|
|
269
|
+
"Asia/Jayapura": "+09:00",
|
|
270
|
+
"Asia/Jerusalem": "+02:00",
|
|
271
|
+
"Asia/Kabul": "+04:30",
|
|
272
|
+
"Asia/Kamchatka": "+12:00",
|
|
273
|
+
"Asia/Karachi": "+05:00",
|
|
274
|
+
"Asia/Kashgar": "+08:00",
|
|
275
|
+
"Asia/Kathmandu": "+05:45",
|
|
276
|
+
"Asia/Katmandu": "+05:45",
|
|
277
|
+
"Asia/Khandyga": "+09:00",
|
|
278
|
+
"Asia/Kolkata": "+05:30",
|
|
279
|
+
"Asia/Krasnoyarsk": "+07:00",
|
|
280
|
+
"Asia/Kuala_Lumpur": "+08:00",
|
|
281
|
+
"Asia/Kuching": "+08:00",
|
|
282
|
+
"Asia/Kuwait": "+03:00",
|
|
283
|
+
"Asia/Macao": "+08:00",
|
|
284
|
+
"Asia/Macau": "+08:00",
|
|
285
|
+
"Asia/Magadan": "+10:00",
|
|
286
|
+
"Asia/Makassar": "+08:00",
|
|
287
|
+
"Asia/Manila": "+08:00",
|
|
288
|
+
"Asia/Muscat": "+04:00",
|
|
289
|
+
"Asia/Nicosia": "+02:00",
|
|
290
|
+
"Asia/Novokuznetsk": "+07:00",
|
|
291
|
+
"Asia/Novosibirsk": "+06:00",
|
|
292
|
+
"Asia/Omsk": "+06:00",
|
|
293
|
+
"Asia/Oral": "+05:00",
|
|
294
|
+
"Asia/Phnom_Penh": "+07:00",
|
|
295
|
+
"Asia/Pontianak": "+07:00",
|
|
296
|
+
"Asia/Pyongyang": "+09:00",
|
|
297
|
+
"Asia/Qatar": "+03:00",
|
|
298
|
+
"Asia/Qyzylorda": "+06:00",
|
|
299
|
+
"Asia/Rangoon": "+06:30",
|
|
300
|
+
"Asia/Riyadh": "+03:00",
|
|
301
|
+
"Asia/Saigon": "+07:00",
|
|
302
|
+
"Asia/Sakhalin": "+11:00",
|
|
303
|
+
"Asia/Samarkand": "+05:00",
|
|
304
|
+
"Asia/Seoul": "+09:00",
|
|
305
|
+
"Asia/Shanghai": "+08:00",
|
|
306
|
+
"Asia/Singapore": "+08:00",
|
|
307
|
+
"Asia/Taipei": "+08:00",
|
|
308
|
+
"Asia/Tashkent": "+05:00",
|
|
309
|
+
"Asia/Tbilisi": "+04:00",
|
|
310
|
+
"Asia/Tehran": "+03:30",
|
|
311
|
+
"Asia/Tel_Aviv": "+02:00",
|
|
312
|
+
"Asia/Thimbu": "+06:00",
|
|
313
|
+
"Asia/Thimphu": "+06:00",
|
|
314
|
+
"Asia/Tokyo": "+09:00",
|
|
315
|
+
"Asia/Ujung_Pandang": "+08:00",
|
|
316
|
+
"Asia/Ulaanbaatar": "+08:00",
|
|
317
|
+
"Asia/Ulan_Bator": "+08:00",
|
|
318
|
+
"Asia/Urumqi": "+08:00",
|
|
319
|
+
"Asia/Ust-Nera": "+10:00",
|
|
320
|
+
"Asia/Vientiane": "+07:00",
|
|
321
|
+
"Asia/Vladivostok": "+10:00",
|
|
322
|
+
"Asia/Yakutsk": "+09:00",
|
|
323
|
+
"Asia/Yekaterinburg": "+05:00",
|
|
324
|
+
"Asia/Yerevan": "+04:00",
|
|
325
|
+
"Atlantic/Azores": "-01:00",
|
|
326
|
+
"Atlantic/Bermuda": "-04:00",
|
|
327
|
+
"Atlantic/Canary": "+00:00",
|
|
328
|
+
"Atlantic/Cape_Verde": "-01:00",
|
|
329
|
+
"Atlantic/Faeroe": "+00:00",
|
|
330
|
+
"Atlantic/Faroe": "+00:00",
|
|
331
|
+
"Atlantic/Jan_Mayen": "+01:00",
|
|
332
|
+
"Atlantic/Madeira": "+00:00",
|
|
333
|
+
"Atlantic/Reykjavik": "+00:00",
|
|
334
|
+
"Atlantic/South_Georgia": "-02:00",
|
|
335
|
+
"Atlantic/St_Helena": "+00:00",
|
|
336
|
+
"Atlantic/Stanley": "-03:00",
|
|
337
|
+
"Australia/ACT": "+10:00",
|
|
338
|
+
"Australia/Adelaide": "+09:30",
|
|
339
|
+
"Australia/Brisbane": "+10:00",
|
|
340
|
+
"Australia/Broken_Hill": "+09:30",
|
|
341
|
+
"Australia/Canberra": "+10:00",
|
|
342
|
+
"Australia/Currie": "+10:00",
|
|
343
|
+
"Australia/Darwin": "+09:30",
|
|
344
|
+
"Australia/Eucla": "+08:45",
|
|
345
|
+
"Australia/Hobart": "+10:00",
|
|
346
|
+
"Australia/LHI": "+10:30",
|
|
347
|
+
"Australia/Lindeman": "+10:00",
|
|
348
|
+
"Australia/Lord_Howe": "+10:30",
|
|
349
|
+
"Australia/Melbourne": "+10:00",
|
|
350
|
+
"Australia/North": "+09:30",
|
|
351
|
+
"Australia/NSW": "+10:00",
|
|
352
|
+
"Australia/Perth": "+08:00",
|
|
353
|
+
"Australia/Queensland": "+10:00",
|
|
354
|
+
"Australia/South": "+09:30",
|
|
355
|
+
"Australia/Sydney": "+10:00",
|
|
356
|
+
"Australia/Tasmania": "+10:00",
|
|
357
|
+
"Australia/Victoria": "+10:00",
|
|
358
|
+
"Australia/West": "+08:00",
|
|
359
|
+
"Australia/Yancowinna": "+09:30",
|
|
360
|
+
"Brazil/Acre": "-05:00",
|
|
361
|
+
"Brazil/DeNoronha": "-02:00",
|
|
362
|
+
"Brazil/East": "-03:00",
|
|
363
|
+
"Brazil/West": "-04:00",
|
|
364
|
+
"Canada/Atlantic": "-04:00",
|
|
365
|
+
"Canada/Central": "-06:00",
|
|
366
|
+
"Canada/Eastern": "-05:00",
|
|
367
|
+
"Canada/East-Saskatchewan": "-06:00",
|
|
368
|
+
"Canada/Mountain": "-07:00",
|
|
369
|
+
"Canada/Newfoundland": "-03:30",
|
|
370
|
+
"Canada/Pacific": "-08:00",
|
|
371
|
+
"Canada/Saskatchewan": "-06:00",
|
|
372
|
+
"Canada/Yukon": "-08:00",
|
|
373
|
+
"Chile/Continental": "-03:00",
|
|
374
|
+
"Chile/EasterIsland": "-05:00",
|
|
375
|
+
Cuba: "-05:00",
|
|
376
|
+
Egypt: "+02:00",
|
|
377
|
+
Eire: "+00:00",
|
|
378
|
+
"Etc/GMT": "+00:00",
|
|
379
|
+
"Etc/GMT+0": "+00:00",
|
|
380
|
+
"Etc/UCT": "+00:00",
|
|
381
|
+
"Etc/Universal": "+00:00",
|
|
382
|
+
"Etc/UTC": "+00:00",
|
|
383
|
+
"Etc/Zulu": "+00:00",
|
|
384
|
+
"Europe/Amsterdam": "+01:00",
|
|
385
|
+
"Europe/Andorra": "+01:00",
|
|
386
|
+
"Europe/Athens": "+02:00",
|
|
387
|
+
"Europe/Belfast": "+00:00",
|
|
388
|
+
"Europe/Belgrade": "+01:00",
|
|
389
|
+
"Europe/Berlin": "+01:00",
|
|
390
|
+
"Europe/Bratislava": "+01:00",
|
|
391
|
+
"Europe/Brussels": "+01:00",
|
|
392
|
+
"Europe/Bucharest": "+02:00",
|
|
393
|
+
"Europe/Budapest": "+01:00",
|
|
394
|
+
"Europe/Busingen": "+01:00",
|
|
395
|
+
"Europe/Chisinau": "+02:00",
|
|
396
|
+
"Europe/Copenhagen": "+01:00",
|
|
397
|
+
"Europe/Dublin": "+00:00",
|
|
398
|
+
"Europe/Gibraltar": "+01:00",
|
|
399
|
+
"Europe/Guernsey": "+00:00",
|
|
400
|
+
"Europe/Helsinki": "+02:00",
|
|
401
|
+
"Europe/Isle_of_Man": "+00:00",
|
|
402
|
+
"Europe/Istanbul": "+02:00",
|
|
403
|
+
"Europe/Jersey": "+00:00",
|
|
404
|
+
"Europe/Kaliningrad": "+02:00",
|
|
405
|
+
"Europe/Kiev": "+02:00",
|
|
406
|
+
"Europe/Lisbon": "+00:00",
|
|
407
|
+
"Europe/Ljubljana": "+01:00",
|
|
408
|
+
"Europe/London": "+00:00",
|
|
409
|
+
"Europe/Luxembourg": "+01:00",
|
|
410
|
+
"Europe/Madrid": "+01:00",
|
|
411
|
+
"Europe/Malta": "+01:00",
|
|
412
|
+
"Europe/Mariehamn": "+02:00",
|
|
413
|
+
"Europe/Minsk": "+03:00",
|
|
414
|
+
"Europe/Monaco": "+01:00",
|
|
415
|
+
"Europe/Moscow": "+03:00",
|
|
416
|
+
"Europe/Nicosia": "+02:00",
|
|
417
|
+
"Europe/Oslo": "+01:00",
|
|
418
|
+
"Europe/Paris": "+01:00",
|
|
419
|
+
"Europe/Podgorica": "+01:00",
|
|
420
|
+
"Europe/Prague": "+01:00",
|
|
421
|
+
"Europe/Riga": "+02:00",
|
|
422
|
+
"Europe/Rome": "+01:00",
|
|
423
|
+
"Europe/Samara": "+04:00",
|
|
424
|
+
"Europe/San_Marino": "+01:00",
|
|
425
|
+
"Europe/Sarajevo": "+01:00",
|
|
426
|
+
"Europe/Simferopol": "+03:00",
|
|
427
|
+
"Europe/Skopje": "+01:00",
|
|
428
|
+
"Europe/Sofia": "+02:00",
|
|
429
|
+
"Europe/Stockholm": "+01:00",
|
|
430
|
+
"Europe/Tallinn": "+02:00",
|
|
431
|
+
"Europe/Tirane": "+01:00",
|
|
432
|
+
"Europe/Tiraspol": "+02:00",
|
|
433
|
+
"Europe/Uzhgorod": "+02:00",
|
|
434
|
+
"Europe/Vaduz": "+01:00",
|
|
435
|
+
"Europe/Vatican": "+01:00",
|
|
436
|
+
"Europe/Vienna": "+01:00",
|
|
437
|
+
"Europe/Vilnius": "+02:00",
|
|
438
|
+
"Europe/Volgograd": "+03:00",
|
|
439
|
+
"Europe/Warsaw": "+01:00",
|
|
440
|
+
"Europe/Zagreb": "+01:00",
|
|
441
|
+
"Europe/Zaporozhye": "+02:00",
|
|
442
|
+
"Europe/Zurich": "+01:00",
|
|
443
|
+
GB: "+00:00",
|
|
444
|
+
"GB-Eire": "+00:00",
|
|
445
|
+
GMT: "+00:00",
|
|
446
|
+
"GMT+0": "+00:00",
|
|
447
|
+
GMT0: "+00:00",
|
|
448
|
+
"GMT-0": "+00:00",
|
|
449
|
+
Greenwich: "+00:00",
|
|
450
|
+
Hongkong: "+08:00",
|
|
451
|
+
Iceland: "+00:00",
|
|
452
|
+
"Indian/Antananarivo": "+03:00",
|
|
453
|
+
"Indian/Chagos": "+06:00",
|
|
454
|
+
"Indian/Christmas": "+07:00",
|
|
455
|
+
"Indian/Cocos": "+06:30",
|
|
456
|
+
"Indian/Comoro": "+03:00",
|
|
457
|
+
"Indian/Kerguelen": "+05:00",
|
|
458
|
+
"Indian/Mahe": "+04:00",
|
|
459
|
+
"Indian/Maldives": "+05:00",
|
|
460
|
+
"Indian/Mauritius": "+04:00",
|
|
461
|
+
"Indian/Mayotte": "+03:00",
|
|
462
|
+
"Indian/Reunion": "+04:00",
|
|
463
|
+
Iran: "+03:30",
|
|
464
|
+
Israel: "+02:00",
|
|
465
|
+
Jamaica: "-05:00",
|
|
466
|
+
Japan: "+09:00",
|
|
467
|
+
Kwajalein: "+12:00",
|
|
468
|
+
Libya: "+02:00",
|
|
469
|
+
"Mexico/BajaNorte": "-08:00",
|
|
470
|
+
"Mexico/BajaSur": "-07:00",
|
|
471
|
+
"Mexico/General": "-06:00",
|
|
472
|
+
Navajo: "-07:00",
|
|
473
|
+
NZ: "+12:00",
|
|
474
|
+
"NZ-CHAT": "+12:45",
|
|
475
|
+
"Pacific/Apia": "+13:00",
|
|
476
|
+
"Pacific/Auckland": "+12:00",
|
|
477
|
+
"Pacific/Chatham": "+12:45",
|
|
478
|
+
"Pacific/Chuuk": "+10:00",
|
|
479
|
+
"Pacific/Easter": "-06:00",
|
|
480
|
+
"Pacific/Efate": "+11:00",
|
|
481
|
+
"Pacific/Enderbury": "+13:00",
|
|
482
|
+
"Pacific/Fakaofo": "+13:00",
|
|
483
|
+
"Pacific/Fiji": "+12:00",
|
|
484
|
+
"Pacific/Funafuti": "+12:00",
|
|
485
|
+
"Pacific/Galapagos": "-06:00",
|
|
486
|
+
"Pacific/Gambier": "-09:00",
|
|
487
|
+
"Pacific/Guadalcanal": "+11:00",
|
|
488
|
+
"Pacific/Guam": "+10:00",
|
|
489
|
+
"Pacific/Honolulu": "-10:00",
|
|
490
|
+
"Pacific/Johnston": "-10:00",
|
|
491
|
+
"Pacific/Kiritimati": "+14:00",
|
|
492
|
+
"Pacific/Kosrae": "+11:00",
|
|
493
|
+
"Pacific/Kwajalein": "+12:00",
|
|
494
|
+
"Pacific/Majuro": "+12:00",
|
|
495
|
+
"Pacific/Marquesas": "-09:30",
|
|
496
|
+
"Pacific/Midway": "-11:00",
|
|
497
|
+
"Pacific/Nauru": "+12:00",
|
|
498
|
+
"Pacific/Niue": "-11:00",
|
|
499
|
+
"Pacific/Norfolk": "+11:30",
|
|
500
|
+
"Pacific/Noumea": "+11:00",
|
|
501
|
+
"Pacific/Pago_Pago": "-11:00",
|
|
502
|
+
"Pacific/Palau": "+09:00",
|
|
503
|
+
"Pacific/Pitcairn": "-08:00",
|
|
504
|
+
"Pacific/Pohnpei": "+11:00",
|
|
505
|
+
"Pacific/Ponape": "+11:00",
|
|
506
|
+
"Pacific/Port_Moresby": "+10:00",
|
|
507
|
+
"Pacific/Rarotonga": "-10:00",
|
|
508
|
+
"Pacific/Saipan": "+10:00",
|
|
509
|
+
"Pacific/Samoa": "-11:00",
|
|
510
|
+
"Pacific/Tahiti": "-10:00",
|
|
511
|
+
"Pacific/Tarawa": "+12:00",
|
|
512
|
+
"Pacific/Tongatapu": "+13:00",
|
|
513
|
+
"Pacific/Truk": "+10:00",
|
|
514
|
+
"Pacific/Wake": "+12:00",
|
|
515
|
+
"Pacific/Wallis": "+12:00",
|
|
516
|
+
"Pacific/Yap": "+10:00",
|
|
517
|
+
Poland: "+01:00",
|
|
518
|
+
Portugal: "+00:00",
|
|
519
|
+
PRC: "+08:00",
|
|
520
|
+
ROC: "+08:00",
|
|
521
|
+
ROK: "+09:00",
|
|
522
|
+
Singapore: "+08:00",
|
|
523
|
+
Turkey: "+02:00",
|
|
524
|
+
UCT: "+00:00",
|
|
525
|
+
Universal: "+00:00",
|
|
526
|
+
"US/Alaska": "-09:00",
|
|
527
|
+
"US/Aleutian": "-10:00",
|
|
528
|
+
"US/Arizona": "-07:00",
|
|
529
|
+
"US/Central": "-06:00",
|
|
530
|
+
"US/Eastern": "-05:00",
|
|
531
|
+
"US/East-Indiana": "-05:00",
|
|
532
|
+
"US/Hawaii": "-10:00",
|
|
533
|
+
"US/Indiana-Starke": "-06:00",
|
|
534
|
+
"US/Michigan": "-05:00",
|
|
535
|
+
"US/Mountain": "-07:00",
|
|
536
|
+
"US/Pacific": "-08:00",
|
|
537
|
+
"US/Samoa": "-11:00",
|
|
538
|
+
UTC: "+00:00",
|
|
539
|
+
"W-SU": "+03:00",
|
|
540
|
+
Zulu: "+00:00"
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
//#endregion
|
|
544
|
+
export { tzDatabase };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
2
|
+
|
|
3
|
+
//#region src/common/trace.ts
|
|
4
|
+
const traceContext = new AsyncLocalStorage();
|
|
5
|
+
/**
|
|
6
|
+
* A regex to match the Cloud Trace header.
|
|
7
|
+
* - ([A-Fa-f0-9]{32}): The trace id, a 32 character hex value. (e.g. 4bf92f3577b34da6a3ce929d0e0e4736)
|
|
8
|
+
* - ([0-9]+): The parent span id, a 64 bit integer. (e.g. 00f067aa0ba902b7)
|
|
9
|
+
* - (?:;o=([0-3])): The trace mask, 1-3 denote it should be traced.
|
|
10
|
+
*/
|
|
11
|
+
const CLOUD_TRACE_REGEX = new RegExp("^(?<traceId>[A-Fa-f0-9]{32})/" + "(?<parentIdInt>[0-9]+)" + "(?:;o=(?<traceMask>[0-3]))?$");
|
|
12
|
+
const CLOUD_TRACE_HEADER = "X-Cloud-Trace-Context";
|
|
13
|
+
function matchCloudTraceHeader(carrier) {
|
|
14
|
+
let header = carrier?.[CLOUD_TRACE_HEADER];
|
|
15
|
+
if (!header) {
|
|
16
|
+
header = carrier?.[CLOUD_TRACE_HEADER.toLowerCase()];
|
|
17
|
+
}
|
|
18
|
+
if (header && typeof header === "string") {
|
|
19
|
+
const matches = CLOUD_TRACE_REGEX.exec(header);
|
|
20
|
+
if (matches && matches.groups) {
|
|
21
|
+
const { traceId, parentIdInt, traceMask } = matches.groups;
|
|
22
|
+
const parentId = parseInt(parentIdInt);
|
|
23
|
+
if (isNaN(parentId)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const sample = !!traceMask && traceMask !== "0";
|
|
27
|
+
return {
|
|
28
|
+
traceId,
|
|
29
|
+
parentId: parentId.toString(16),
|
|
30
|
+
sample,
|
|
31
|
+
version: "00"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A regex to match the traceparent header.
|
|
38
|
+
* - ^([a-f0-9]{2}): The specification version (e.g. 00)
|
|
39
|
+
* - ([a-f0-9]{32}): The trace id, a 16-byte array. (e.g. 4bf92f3577b34da6a3ce929d0e0e4736)
|
|
40
|
+
* - ([a-f0-9]{16}): The parent span id, an 8-byte array. (e.g. 00f067aa0ba902b7)
|
|
41
|
+
* - ([a-f0-9]{2}: The sampled flag. (e.g. 00)
|
|
42
|
+
*/
|
|
43
|
+
const TRACEPARENT_REGEX = new RegExp("^(?<version>[a-f0-9]{2})-" + "(?<traceId>[a-f0-9]{32})-" + "(?<parentId>[a-f0-9]{16})-" + "(?<flag>[a-f0-9]{2})$");
|
|
44
|
+
const TRACEPARENT_HEADER = "traceparent";
|
|
45
|
+
function matchTraceparentHeader(carrier) {
|
|
46
|
+
const header = carrier?.[TRACEPARENT_HEADER];
|
|
47
|
+
if (header && typeof header === "string") {
|
|
48
|
+
const matches = TRACEPARENT_REGEX.exec(header);
|
|
49
|
+
if (matches && matches.groups) {
|
|
50
|
+
const { version, traceId, parentId, flag } = matches.groups;
|
|
51
|
+
const sample = flag === "01";
|
|
52
|
+
return {
|
|
53
|
+
traceId,
|
|
54
|
+
parentId,
|
|
55
|
+
sample,
|
|
56
|
+
version
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Extracts trace context from given carrier object, if any.
|
|
63
|
+
*
|
|
64
|
+
* Supports Cloud Trace and traceparent format.
|
|
65
|
+
*
|
|
66
|
+
* @param carrier
|
|
67
|
+
*/
|
|
68
|
+
function extractTraceContext(carrier) {
|
|
69
|
+
return matchCloudTraceHeader(carrier) || matchTraceparentHeader(carrier);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { extractTraceContext, traceContext };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/common/utilities/assertions.ts
|
|
2
|
+
/** @hidden
|
|
3
|
+
* @file Provides common assertion helpers which can be used to improve
|
|
4
|
+
* strictness of both type checking and runtime.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Checks that the given value is of type `never` — the type that’s left after
|
|
8
|
+
* all other cases have been removed.
|
|
9
|
+
*
|
|
10
|
+
* @param x A value of type `never`.
|
|
11
|
+
*/
|
|
12
|
+
function assertNever(x) {
|
|
13
|
+
throw new Error(`Unhandled discriminated union member: ${JSON.stringify(x)}.`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { assertNever };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/common/utilities/encoder.ts
|
|
2
|
+
function dateToTimestampProto(timeString) {
|
|
3
|
+
if (typeof timeString === "undefined") {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const date = new Date(timeString);
|
|
7
|
+
const seconds = Math.floor(date.getTime() / 1e3);
|
|
8
|
+
let nanos = 0;
|
|
9
|
+
if (timeString.length > 20) {
|
|
10
|
+
const nanoString = timeString.substring(20, timeString.length - 1);
|
|
11
|
+
const trailingZeroes = 9 - nanoString.length;
|
|
12
|
+
nanos = parseInt(nanoString, 10) * Math.pow(10, trailingZeroes);
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
seconds,
|
|
16
|
+
nanos
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { dateToTimestampProto };
|