@zero-server/sdk 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +460 -443
- package/index.js +414 -412
- package/lib/app.js +1172 -1172
- package/lib/auth/authorize.js +399 -399
- package/lib/auth/enrollment.js +367 -367
- package/lib/auth/index.js +57 -57
- package/lib/auth/jwt.js +731 -731
- package/lib/auth/oauth.js +362 -362
- package/lib/auth/session.js +588 -588
- package/lib/auth/trustedDevice.js +409 -409
- package/lib/auth/twoFactor.js +1150 -1150
- package/lib/auth/webauthn.js +946 -946
- package/lib/body/index.js +14 -14
- package/lib/body/json.js +109 -109
- package/lib/body/multipart.js +440 -440
- package/lib/body/raw.js +71 -71
- package/lib/body/rawBuffer.js +160 -160
- package/lib/body/sendError.js +25 -25
- package/lib/body/text.js +75 -75
- package/lib/body/typeMatch.js +41 -41
- package/lib/body/urlencoded.js +235 -235
- package/lib/cli.js +845 -845
- package/lib/cluster.js +666 -666
- package/lib/debug.js +372 -372
- package/lib/env/index.js +465 -465
- package/lib/errors.js +683 -683
- package/lib/fetch/index.js +256 -256
- package/lib/grpc/balancer.js +378 -378
- package/lib/grpc/call.js +708 -708
- package/lib/grpc/client.js +764 -764
- package/lib/grpc/codec.js +1221 -1221
- package/lib/grpc/credentials.js +398 -398
- package/lib/grpc/frame.js +262 -262
- package/lib/grpc/health.js +287 -287
- package/lib/grpc/index.js +121 -121
- package/lib/grpc/metadata.js +461 -461
- package/lib/grpc/proto.js +821 -821
- package/lib/grpc/reflection.js +590 -590
- package/lib/grpc/server.js +445 -445
- package/lib/grpc/status.js +118 -118
- package/lib/grpc/watch.js +173 -173
- package/lib/http/index.js +10 -10
- package/lib/http/request.js +727 -727
- package/lib/http/response.js +799 -799
- package/lib/lifecycle.js +557 -557
- package/lib/middleware/compress.js +230 -230
- package/lib/middleware/cookieParser.js +237 -237
- package/lib/middleware/cors.js +93 -93
- package/lib/middleware/csrf.js +137 -137
- package/lib/middleware/errorHandler.js +101 -101
- package/lib/middleware/helmet.js +175 -175
- package/lib/middleware/index.js +19 -17
- package/lib/middleware/logger.js +74 -74
- package/lib/middleware/rateLimit.js +88 -88
- package/lib/middleware/requestId.js +53 -53
- package/lib/middleware/static.js +326 -326
- package/lib/middleware/timeout.js +71 -71
- package/lib/middleware/validator.js +255 -255
- package/lib/observe/health.js +326 -326
- package/lib/observe/index.js +50 -50
- package/lib/observe/logger.js +359 -359
- package/lib/observe/metrics.js +805 -805
- package/lib/observe/tracing.js +592 -592
- package/lib/orm/adapters/json.js +290 -290
- package/lib/orm/adapters/memory.js +764 -764
- package/lib/orm/adapters/mongo.js +764 -764
- package/lib/orm/adapters/mysql.js +933 -933
- package/lib/orm/adapters/postgres.js +1144 -1144
- package/lib/orm/adapters/redis.js +1534 -1534
- package/lib/orm/adapters/sql-base.js +212 -212
- package/lib/orm/adapters/sqlite.js +858 -858
- package/lib/orm/audit.js +649 -649
- package/lib/orm/cache.js +394 -394
- package/lib/orm/geo.js +387 -387
- package/lib/orm/index.js +784 -784
- package/lib/orm/migrate.js +432 -432
- package/lib/orm/model.js +1706 -1706
- package/lib/orm/plugin.js +375 -375
- package/lib/orm/procedures.js +836 -836
- package/lib/orm/profiler.js +233 -233
- package/lib/orm/query.js +1772 -1772
- package/lib/orm/replicas.js +241 -241
- package/lib/orm/schema.js +307 -307
- package/lib/orm/search.js +380 -380
- package/lib/orm/seed/data/commerce.js +136 -136
- package/lib/orm/seed/data/internet.js +111 -111
- package/lib/orm/seed/data/locations.js +204 -204
- package/lib/orm/seed/data/names.js +338 -338
- package/lib/orm/seed/data/person.js +128 -128
- package/lib/orm/seed/data/phone.js +211 -211
- package/lib/orm/seed/data/words.js +134 -134
- package/lib/orm/seed/factory.js +178 -178
- package/lib/orm/seed/fake.js +1186 -1186
- package/lib/orm/seed/index.js +18 -18
- package/lib/orm/seed/rng.js +70 -70
- package/lib/orm/seed/seeder.js +124 -124
- package/lib/orm/seed/unique.js +68 -68
- package/lib/orm/snapshot.js +366 -366
- package/lib/orm/tenancy.js +605 -605
- package/lib/orm/views.js +350 -350
- package/lib/router/index.js +436 -436
- package/lib/sse/index.js +8 -8
- package/lib/sse/stream.js +349 -349
- package/lib/ws/connection.js +451 -451
- package/lib/ws/handshake.js +125 -125
- package/lib/ws/index.js +14 -14
- package/lib/ws/room.js +223 -223
- package/package.json +73 -73
- package/types/app.d.ts +223 -223
- package/types/auth.d.ts +520 -520
- package/types/body.d.ts +14 -0
- package/types/cli.d.ts +2 -0
- package/types/cluster.d.ts +75 -75
- package/types/env.d.ts +80 -80
- package/types/errors.d.ts +316 -316
- package/types/fetch.d.ts +43 -43
- package/types/grpc.d.ts +432 -432
- package/types/index.d.ts +384 -384
- package/types/lifecycle.d.ts +60 -60
- package/types/middleware.d.ts +320 -320
- package/types/observe.d.ts +304 -304
- package/types/orm.d.ts +1887 -1887
- package/types/request.d.ts +109 -109
- package/types/response.d.ts +157 -157
- package/types/router.d.ts +78 -78
- package/types/sse.d.ts +78 -78
- package/types/websocket.d.ts +126 -126
|
@@ -1,211 +1,211 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @module seed/data/phone
|
|
5
|
-
* @description Phone format templates and country-code metadata.
|
|
6
|
-
*
|
|
7
|
-
* Format characters:
|
|
8
|
-
* # any digit (0–9)
|
|
9
|
-
* N non-zero digit (1–9)
|
|
10
|
-
* X subscriber digit (2–9)
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Array of { countryCode, dialCode, formats }
|
|
15
|
-
*
|
|
16
|
-
* formats.human – human-input style (e.g. 555-770-7727 x1234)
|
|
17
|
-
* formats.national – national format (e.g. (555) 123-4567)
|
|
18
|
-
* formats.international – E.123 style (e.g. +1 555 123 4567)
|
|
19
|
-
*/
|
|
20
|
-
const PHONE_DATA = [
|
|
21
|
-
{
|
|
22
|
-
countryCode: 'US',
|
|
23
|
-
dialCode: '+1',
|
|
24
|
-
formats: {
|
|
25
|
-
human: ['###-###-####', '(###) ###-####', '###.###.####', '###-###-#### x###'],
|
|
26
|
-
national: ['(###) ###-####'],
|
|
27
|
-
international: ['+1 (###) ###-####', '+1-###-###-####'],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
countryCode: 'CA',
|
|
32
|
-
dialCode: '+1',
|
|
33
|
-
formats: {
|
|
34
|
-
human: ['###-###-####', '(###) ###-####', '###.###.####'],
|
|
35
|
-
national: ['(###) ###-####'],
|
|
36
|
-
international: ['+1 (###) ###-####'],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
countryCode: 'GB',
|
|
41
|
-
dialCode: '+44',
|
|
42
|
-
formats: {
|
|
43
|
-
human: ['07### ######', '01### ######', '02# #### ####'],
|
|
44
|
-
national: ['07### ######', '(01###) ######'],
|
|
45
|
-
international: ['+44 7### ######', '+44 1### ######'],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
countryCode: 'DE',
|
|
50
|
-
dialCode: '+49',
|
|
51
|
-
formats: {
|
|
52
|
-
human: ['0### #######', '0## ########', '01## #######'],
|
|
53
|
-
national: ['(0###) #######'],
|
|
54
|
-
international: ['+49 ### #######', '+49 ## ########'],
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
countryCode: 'FR',
|
|
59
|
-
dialCode: '+33',
|
|
60
|
-
formats: {
|
|
61
|
-
human: ['0# ## ## ## ##', '06 ## ## ## ##', '07 ## ## ## ##'],
|
|
62
|
-
national: ['0# ## ## ## ##'],
|
|
63
|
-
international: ['+33 # ## ## ## ##'],
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
countryCode: 'IT',
|
|
68
|
-
dialCode: '+39',
|
|
69
|
-
formats: {
|
|
70
|
-
human: ['### #######', '3## #######'],
|
|
71
|
-
national: ['(###) #######'],
|
|
72
|
-
international: ['+39 ### #######'],
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
countryCode: 'ES',
|
|
77
|
-
dialCode: '+34',
|
|
78
|
-
formats: {
|
|
79
|
-
human: ['### ### ###', '6## ### ###'],
|
|
80
|
-
national: ['(###) ### ###'],
|
|
81
|
-
international: ['+34 ### ### ###'],
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
countryCode: 'PT',
|
|
86
|
-
dialCode: '+351',
|
|
87
|
-
formats: {
|
|
88
|
-
human: ['2## ### ###', '9## ### ###'],
|
|
89
|
-
national: ['(2##) ### ###'],
|
|
90
|
-
international: ['+351 ### ### ###'],
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
countryCode: 'BR',
|
|
95
|
-
dialCode: '+55',
|
|
96
|
-
formats: {
|
|
97
|
-
human: ['(##) ####-####', '(##) 9####-####'],
|
|
98
|
-
national: ['(##) ####-####'],
|
|
99
|
-
international: ['+55 ## #### ####'],
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
countryCode: 'MX',
|
|
104
|
-
dialCode: '+52',
|
|
105
|
-
formats: {
|
|
106
|
-
human: ['(###) ###-####', '## #### ####'],
|
|
107
|
-
national: ['(###) ###-####'],
|
|
108
|
-
international: ['+52 ### ### ####'],
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
countryCode: 'RU',
|
|
113
|
-
dialCode: '+7',
|
|
114
|
-
formats: {
|
|
115
|
-
human: ['8 (###) ###-##-##', '8-###-###-##-##'],
|
|
116
|
-
national: ['(###) ###-##-##'],
|
|
117
|
-
international: ['+7 (###) ###-##-##'],
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
countryCode: 'IN',
|
|
122
|
-
dialCode: '+91',
|
|
123
|
-
formats: {
|
|
124
|
-
human: ['#####-#####', '(0##) ###-####'],
|
|
125
|
-
national: ['##### #####'],
|
|
126
|
-
international: ['+91 ##### #####'],
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
countryCode: 'CN',
|
|
131
|
-
dialCode: '+86',
|
|
132
|
-
formats: {
|
|
133
|
-
human: ['### #### ####', '1## #### ####'],
|
|
134
|
-
national: ['(0##) #### ####'],
|
|
135
|
-
international: ['+86 ### #### ####'],
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
countryCode: 'JP',
|
|
140
|
-
dialCode: '+81',
|
|
141
|
-
formats: {
|
|
142
|
-
human: ['0##-####-####', '080-####-####', '090-####-####'],
|
|
143
|
-
national: ['(0##) ####-####'],
|
|
144
|
-
international: ['+81 ##-####-####'],
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
countryCode: 'KR',
|
|
149
|
-
dialCode: '+82',
|
|
150
|
-
formats: {
|
|
151
|
-
human: ['0##-####-####', '010-####-####'],
|
|
152
|
-
national: ['(0##) ####-####'],
|
|
153
|
-
international: ['+82 ##-####-####'],
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
countryCode: 'AU',
|
|
158
|
-
dialCode: '+61',
|
|
159
|
-
formats: {
|
|
160
|
-
human: ['04## ### ###', '0# #### ####'],
|
|
161
|
-
national: ['04## ### ###', '(0#) #### ####'],
|
|
162
|
-
international: ['+61 4## ### ###', '+61 # #### ####'],
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
countryCode: 'NL',
|
|
167
|
-
dialCode: '+31',
|
|
168
|
-
formats: {
|
|
169
|
-
human: ['0## ### ####', '06 ## ## ## ##'],
|
|
170
|
-
national: ['(0##) ### ####'],
|
|
171
|
-
international: ['+31 ## ### ####'],
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
countryCode: 'SE',
|
|
176
|
-
dialCode: '+46',
|
|
177
|
-
formats: {
|
|
178
|
-
human: ['0## ### ## ##', '07# ### ## ##'],
|
|
179
|
-
national: ['(0##) ### ## ##'],
|
|
180
|
-
international: ['+46 ## ### ## ##'],
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
countryCode: 'ZA',
|
|
185
|
-
dialCode: '+27',
|
|
186
|
-
formats: {
|
|
187
|
-
human: ['0## ### ####', '081 ### ####'],
|
|
188
|
-
national: ['(0##) ### ####'],
|
|
189
|
-
international: ['+27 ## ### ####'],
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
countryCode: 'NG',
|
|
194
|
-
dialCode: '+234',
|
|
195
|
-
formats: {
|
|
196
|
-
human: ['080 #### ####', '081 #### ####', '0## ### ####'],
|
|
197
|
-
national: ['0## ### ####'],
|
|
198
|
-
international: ['+234 ## #### ####'],
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
];
|
|
202
|
-
|
|
203
|
-
/** Indexed by country code for O(1) lookups. */
|
|
204
|
-
const PHONE_BY_COUNTRY = Object.fromEntries(
|
|
205
|
-
PHONE_DATA.map(p => [p.countryCode, p])
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
/** All supported country codes. */
|
|
209
|
-
const COUNTRY_CODES = PHONE_DATA.map(p => p.countryCode);
|
|
210
|
-
|
|
211
|
-
module.exports = { PHONE_DATA, PHONE_BY_COUNTRY, COUNTRY_CODES };
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @module seed/data/phone
|
|
5
|
+
* @description Phone format templates and country-code metadata.
|
|
6
|
+
*
|
|
7
|
+
* Format characters:
|
|
8
|
+
* # any digit (0–9)
|
|
9
|
+
* N non-zero digit (1–9)
|
|
10
|
+
* X subscriber digit (2–9)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Array of { countryCode, dialCode, formats }
|
|
15
|
+
*
|
|
16
|
+
* formats.human – human-input style (e.g. 555-770-7727 x1234)
|
|
17
|
+
* formats.national – national format (e.g. (555) 123-4567)
|
|
18
|
+
* formats.international – E.123 style (e.g. +1 555 123 4567)
|
|
19
|
+
*/
|
|
20
|
+
const PHONE_DATA = [
|
|
21
|
+
{
|
|
22
|
+
countryCode: 'US',
|
|
23
|
+
dialCode: '+1',
|
|
24
|
+
formats: {
|
|
25
|
+
human: ['###-###-####', '(###) ###-####', '###.###.####', '###-###-#### x###'],
|
|
26
|
+
national: ['(###) ###-####'],
|
|
27
|
+
international: ['+1 (###) ###-####', '+1-###-###-####'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
countryCode: 'CA',
|
|
32
|
+
dialCode: '+1',
|
|
33
|
+
formats: {
|
|
34
|
+
human: ['###-###-####', '(###) ###-####', '###.###.####'],
|
|
35
|
+
national: ['(###) ###-####'],
|
|
36
|
+
international: ['+1 (###) ###-####'],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
countryCode: 'GB',
|
|
41
|
+
dialCode: '+44',
|
|
42
|
+
formats: {
|
|
43
|
+
human: ['07### ######', '01### ######', '02# #### ####'],
|
|
44
|
+
national: ['07### ######', '(01###) ######'],
|
|
45
|
+
international: ['+44 7### ######', '+44 1### ######'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
countryCode: 'DE',
|
|
50
|
+
dialCode: '+49',
|
|
51
|
+
formats: {
|
|
52
|
+
human: ['0### #######', '0## ########', '01## #######'],
|
|
53
|
+
national: ['(0###) #######'],
|
|
54
|
+
international: ['+49 ### #######', '+49 ## ########'],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
countryCode: 'FR',
|
|
59
|
+
dialCode: '+33',
|
|
60
|
+
formats: {
|
|
61
|
+
human: ['0# ## ## ## ##', '06 ## ## ## ##', '07 ## ## ## ##'],
|
|
62
|
+
national: ['0# ## ## ## ##'],
|
|
63
|
+
international: ['+33 # ## ## ## ##'],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
countryCode: 'IT',
|
|
68
|
+
dialCode: '+39',
|
|
69
|
+
formats: {
|
|
70
|
+
human: ['### #######', '3## #######'],
|
|
71
|
+
national: ['(###) #######'],
|
|
72
|
+
international: ['+39 ### #######'],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
countryCode: 'ES',
|
|
77
|
+
dialCode: '+34',
|
|
78
|
+
formats: {
|
|
79
|
+
human: ['### ### ###', '6## ### ###'],
|
|
80
|
+
national: ['(###) ### ###'],
|
|
81
|
+
international: ['+34 ### ### ###'],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
countryCode: 'PT',
|
|
86
|
+
dialCode: '+351',
|
|
87
|
+
formats: {
|
|
88
|
+
human: ['2## ### ###', '9## ### ###'],
|
|
89
|
+
national: ['(2##) ### ###'],
|
|
90
|
+
international: ['+351 ### ### ###'],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
countryCode: 'BR',
|
|
95
|
+
dialCode: '+55',
|
|
96
|
+
formats: {
|
|
97
|
+
human: ['(##) ####-####', '(##) 9####-####'],
|
|
98
|
+
national: ['(##) ####-####'],
|
|
99
|
+
international: ['+55 ## #### ####'],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
countryCode: 'MX',
|
|
104
|
+
dialCode: '+52',
|
|
105
|
+
formats: {
|
|
106
|
+
human: ['(###) ###-####', '## #### ####'],
|
|
107
|
+
national: ['(###) ###-####'],
|
|
108
|
+
international: ['+52 ### ### ####'],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
countryCode: 'RU',
|
|
113
|
+
dialCode: '+7',
|
|
114
|
+
formats: {
|
|
115
|
+
human: ['8 (###) ###-##-##', '8-###-###-##-##'],
|
|
116
|
+
national: ['(###) ###-##-##'],
|
|
117
|
+
international: ['+7 (###) ###-##-##'],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
countryCode: 'IN',
|
|
122
|
+
dialCode: '+91',
|
|
123
|
+
formats: {
|
|
124
|
+
human: ['#####-#####', '(0##) ###-####'],
|
|
125
|
+
national: ['##### #####'],
|
|
126
|
+
international: ['+91 ##### #####'],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
countryCode: 'CN',
|
|
131
|
+
dialCode: '+86',
|
|
132
|
+
formats: {
|
|
133
|
+
human: ['### #### ####', '1## #### ####'],
|
|
134
|
+
national: ['(0##) #### ####'],
|
|
135
|
+
international: ['+86 ### #### ####'],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
countryCode: 'JP',
|
|
140
|
+
dialCode: '+81',
|
|
141
|
+
formats: {
|
|
142
|
+
human: ['0##-####-####', '080-####-####', '090-####-####'],
|
|
143
|
+
national: ['(0##) ####-####'],
|
|
144
|
+
international: ['+81 ##-####-####'],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
countryCode: 'KR',
|
|
149
|
+
dialCode: '+82',
|
|
150
|
+
formats: {
|
|
151
|
+
human: ['0##-####-####', '010-####-####'],
|
|
152
|
+
national: ['(0##) ####-####'],
|
|
153
|
+
international: ['+82 ##-####-####'],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
countryCode: 'AU',
|
|
158
|
+
dialCode: '+61',
|
|
159
|
+
formats: {
|
|
160
|
+
human: ['04## ### ###', '0# #### ####'],
|
|
161
|
+
national: ['04## ### ###', '(0#) #### ####'],
|
|
162
|
+
international: ['+61 4## ### ###', '+61 # #### ####'],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
countryCode: 'NL',
|
|
167
|
+
dialCode: '+31',
|
|
168
|
+
formats: {
|
|
169
|
+
human: ['0## ### ####', '06 ## ## ## ##'],
|
|
170
|
+
national: ['(0##) ### ####'],
|
|
171
|
+
international: ['+31 ## ### ####'],
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
countryCode: 'SE',
|
|
176
|
+
dialCode: '+46',
|
|
177
|
+
formats: {
|
|
178
|
+
human: ['0## ### ## ##', '07# ### ## ##'],
|
|
179
|
+
national: ['(0##) ### ## ##'],
|
|
180
|
+
international: ['+46 ## ### ## ##'],
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
countryCode: 'ZA',
|
|
185
|
+
dialCode: '+27',
|
|
186
|
+
formats: {
|
|
187
|
+
human: ['0## ### ####', '081 ### ####'],
|
|
188
|
+
national: ['(0##) ### ####'],
|
|
189
|
+
international: ['+27 ## ### ####'],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
countryCode: 'NG',
|
|
194
|
+
dialCode: '+234',
|
|
195
|
+
formats: {
|
|
196
|
+
human: ['080 #### ####', '081 #### ####', '0## ### ####'],
|
|
197
|
+
national: ['0## ### ####'],
|
|
198
|
+
international: ['+234 ## #### ####'],
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
];
|
|
202
|
+
|
|
203
|
+
/** Indexed by country code for O(1) lookups. */
|
|
204
|
+
const PHONE_BY_COUNTRY = Object.fromEntries(
|
|
205
|
+
PHONE_DATA.map(p => [p.countryCode, p])
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
/** All supported country codes. */
|
|
209
|
+
const COUNTRY_CODES = PHONE_DATA.map(p => p.countryCode);
|
|
210
|
+
|
|
211
|
+
module.exports = { PHONE_DATA, PHONE_BY_COUNTRY, COUNTRY_CODES };
|