nitro-web 0.0.184 → 0.0.186
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/components/auth/auth.api.js +4 -0
- package/package.json +1 -1
- package/server/constants.js +268 -0
- package/server/index.js +4 -1
- package/server/models/company.js +2 -2
- package/server/models/user.js +4 -3
- package/types/components/auth/auth.api.d.ts.map +1 -1
- package/types/server/constants.d.ts +26 -0
- package/types/server/constants.d.ts.map +1 -0
- package/types/server/index.d.ts +10 -1
- package/types/server/index.d.ts.map +1 -1
- package/types/server/models/user.d.ts +15 -31
- package/types/server/models/user.d.ts.map +1 -1
- package/types.ts +0 -1
|
@@ -274,10 +274,14 @@ export async function userFindFromProvider(query, passwordToCheck) {
|
|
|
274
274
|
}
|
|
275
275
|
if (!user) {
|
|
276
276
|
throw new Error(checkPassword ? 'Email or password is incorrect.' : 'Session-user is invalid.')
|
|
277
|
+
} else if (user.status && user.status !== 'active') {
|
|
278
|
+
throw new Error('This user account is not active.')
|
|
277
279
|
} else if (isMultiTenant && !user.company) {
|
|
278
280
|
throw new Error('The current company is no longer associated with this user')
|
|
279
281
|
} else if (isMultiTenant && user.company.status != 'active') {
|
|
280
282
|
throw new Error('This user is not associated with an active company')
|
|
283
|
+
} else if (isMultiTenant && !user.company.users?.find(u => u._id.toString() === user._id.toString())?.status === 'active') {
|
|
284
|
+
throw new Error('This user is not associated with an active company')
|
|
281
285
|
} else {
|
|
282
286
|
if (checkPassword) {
|
|
283
287
|
if (!user.password) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.186",
|
|
4
4
|
"repository": "github:boycce/nitro-web",
|
|
5
5
|
"homepage": "https://boycce.github.io/nitro-web/",
|
|
6
6
|
"description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
|
|
@@ -0,0 +1,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ua'|'ae'|'gb'|'us'|'uy'|'uz'|'vu'|'va'|'ve'|'vn'|'ye'|'zm'|'zw'} Country
|
|
12
|
+
* @typedef {'nzd'|'aud'|'usd'|'gbp'|'btc'|'aed'|'ars'|'bdt'|'bhd'|'brl'|'cad'|'chf'|'clp'|'cny'|'cop'|'czk'|'dkk'|'egp'|'eur'|
|
|
13
|
+
* 'hkd'|'huf'|'idr'|'ils'|'inr'|'jod'|'jpy'|'kes'|'krw'|'kwd'|'lkr'|'mad'|'mxn'|'myr'|'ngn'|'nok'|'omr'|'pen'|'php'|'pkt'|
|
|
14
|
+
* 'pln'|'qar'|'ron'|'rub'|'sar'|'sek'|'sgd'|'thb'|'try'|'twd'|'uah'|'vnd'|'zar'} Currency
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** @type {{ [key in Currency]: { name: string, symbol: string, digits: number } }} */
|
|
18
|
+
export const currencies = {
|
|
19
|
+
nzd: { name: 'New Zealand Dollar', symbol: '$', digits: 2 },
|
|
20
|
+
aud: { name: 'Australian Dollar', symbol: '$', digits: 2 },
|
|
21
|
+
usd: { name: 'US Dollar', symbol: '$', digits: 2 },
|
|
22
|
+
gbp: { name: 'Great Britain Pound', symbol: '£', digits: 2 },
|
|
23
|
+
btc: { name: 'Bitcoin', symbol: '₿', digits: 8 },
|
|
24
|
+
aed: { name: 'UAE Dirham', symbol: 'د.إ', digits: 2 },
|
|
25
|
+
ars: { name: 'Argentine Peso', symbol: '$', digits: 2 },
|
|
26
|
+
bdt: { name: 'Bangladeshi Taka', symbol: '৳', digits: 2 },
|
|
27
|
+
bhd: { name: 'Bahraini Dinar', symbol: '.د.ب', digits: 3 },
|
|
28
|
+
brl: { name: 'Brazilian Real', symbol: 'R$', digits: 2 },
|
|
29
|
+
cad: { name: 'Canadian Dollar', symbol: '$', digits: 2 },
|
|
30
|
+
chf: { name: 'Swiss Franc', symbol: 'Fr', digits: 2 },
|
|
31
|
+
clp: { name: 'Chilean Peso', symbol: '$', digits: 0 },
|
|
32
|
+
cny: { name: 'Chinese Yuan', symbol: '¥', digits: 2 },
|
|
33
|
+
cop: { name: 'Colombian Peso', symbol: '$', digits: 2 },
|
|
34
|
+
czk: { name: 'Czech Koruna', symbol: 'Kč', digits: 2 },
|
|
35
|
+
dkk: { name: 'Danish Krone', symbol: 'kr', digits: 2 },
|
|
36
|
+
egp: { name: 'Egyptian Pound', symbol: '£', digits: 2 },
|
|
37
|
+
eur: { name: 'Euro', symbol: '€', digits: 2 },
|
|
38
|
+
hkd: { name: 'Hong Kong Dollar', symbol: '$', digits: 2 },
|
|
39
|
+
huf: { name: 'Hungarian Forint', symbol: 'Ft', digits: 0 },
|
|
40
|
+
idr: { name: 'Indonesian Rupiah', symbol: 'Rp', digits: 0 },
|
|
41
|
+
ils: { name: 'Israeli Shekel', symbol: '₪', digits: 2 },
|
|
42
|
+
inr: { name: 'Indian Rupee', symbol: '₹', digits: 2 },
|
|
43
|
+
jod: { name: 'Jordanian Dinar', symbol: 'د.ا', digits: 3 },
|
|
44
|
+
jpy: { name: 'Japanese Yen', symbol: '¥', digits: 0 },
|
|
45
|
+
kes: { name: 'Kenyan Shilling', symbol: 'Sh', digits: 2 },
|
|
46
|
+
krw: { name: 'South Korean Won', symbol: '₩', digits: 0 },
|
|
47
|
+
kwd: { name: 'Kuwaiti Dinar', symbol: 'د.ك', digits: 3 },
|
|
48
|
+
lkr: { name: 'Sri Lankan Rupee', symbol: 'Rs', digits: 2 },
|
|
49
|
+
mad: { name: 'Moroccan Dirham', symbol: 'د.م.', digits: 2 },
|
|
50
|
+
mxn: { name: 'Mexican Peso', symbol: '$', digits: 2 },
|
|
51
|
+
myr: { name: 'Malaysian Ringgit', symbol: 'RM', digits: 2 },
|
|
52
|
+
ngn: { name: 'Nigerian Naira', symbol: '₦', digits: 2 },
|
|
53
|
+
nok: { name: 'Norwegian Krone', symbol: 'kr', digits: 2 },
|
|
54
|
+
omr: { name: 'Omani Rial', symbol: '﷼', digits: 3 },
|
|
55
|
+
pen: { name: 'Peruvian Sol', symbol: 'S/', digits: 2 },
|
|
56
|
+
php: { name: 'Philippine Peso', symbol: '₱', digits: 2 },
|
|
57
|
+
pkt: { name: 'Pakistani Rupee', symbol: '₨', digits: 2 },
|
|
58
|
+
pln: { name: 'Polish Zloty', symbol: 'zł', digits: 2 },
|
|
59
|
+
qar: { name: 'Qatari Riyal', symbol: '﷼', digits: 2 },
|
|
60
|
+
ron: { name: 'Romanian Leu', symbol: 'lei', digits: 2 },
|
|
61
|
+
rub: { name: 'Russian Ruble', symbol: '₽', digits: 2 },
|
|
62
|
+
sar: { name: 'Saudi Riyal', symbol: '﷼', digits: 2 },
|
|
63
|
+
sek: { name: 'Swedish Krona', symbol: 'kr', digits: 2 },
|
|
64
|
+
sgd: { name: 'Singapore Dollar', symbol: '$', digits: 2 },
|
|
65
|
+
thb: { name: 'Thai Baht', symbol: '฿', digits: 2 },
|
|
66
|
+
try: { name: 'Turkish Lira', symbol: '₺', digits: 2 },
|
|
67
|
+
twd: { name: 'New Taiwan Dollar', symbol: 'NT$', digits: 2 },
|
|
68
|
+
uah: { name: 'Ukrainian Hryvnia', symbol: '₴', digits: 2 },
|
|
69
|
+
vnd: { name: 'Vietnamese Dong', symbol: '₫', digits: 0 },
|
|
70
|
+
zar: { name: 'South African Rand', symbol: 'R', digits: 2 },
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** @type {{ [key in Country]: { name: string } }} */
|
|
74
|
+
export const countries = {
|
|
75
|
+
af: { name: 'Afghanistan' },
|
|
76
|
+
al: { name: 'Albania' },
|
|
77
|
+
dz: { name: 'Algeria' },
|
|
78
|
+
ad: { name: 'Andorra' },
|
|
79
|
+
ao: { name: 'Angola' },
|
|
80
|
+
ag: { name: 'Antigua and Barbuda' },
|
|
81
|
+
ar: { name: 'Argentina' },
|
|
82
|
+
am: { name: 'Armenia' },
|
|
83
|
+
au: { name: 'Australia' },
|
|
84
|
+
at: { name: 'Austria' },
|
|
85
|
+
az: { name: 'Azerbaijan' },
|
|
86
|
+
bs: { name: 'Bahamas' },
|
|
87
|
+
bh: { name: 'Bahrain' },
|
|
88
|
+
bd: { name: 'Bangladesh' },
|
|
89
|
+
bb: { name: 'Barbados' },
|
|
90
|
+
by: { name: 'Belarus' },
|
|
91
|
+
be: { name: 'Belgium' },
|
|
92
|
+
bz: { name: 'Belize' },
|
|
93
|
+
bj: { name: 'Benin' },
|
|
94
|
+
bt: { name: 'Bhutan' },
|
|
95
|
+
bo: { name: 'Bolivia' },
|
|
96
|
+
ba: { name: 'Bosnia and Herzegovina' },
|
|
97
|
+
bw: { name: 'Botswana' },
|
|
98
|
+
br: { name: 'Brazil' },
|
|
99
|
+
bn: { name: 'Brunei' },
|
|
100
|
+
bg: { name: 'Bulgaria' },
|
|
101
|
+
bf: { name: 'Burkina Faso' },
|
|
102
|
+
bi: { name: 'Burundi' },
|
|
103
|
+
cv: { name: 'Cabo Verde' },
|
|
104
|
+
kh: { name: 'Cambodia' },
|
|
105
|
+
cm: { name: 'Cameroon' },
|
|
106
|
+
ca: { name: 'Canada' },
|
|
107
|
+
cf: { name: 'Central African Republic' },
|
|
108
|
+
td: { name: 'Chad' },
|
|
109
|
+
cl: { name: 'Chile' },
|
|
110
|
+
cn: { name: 'China' },
|
|
111
|
+
co: { name: 'Colombia' },
|
|
112
|
+
km: { name: 'Comoros' },
|
|
113
|
+
cg: { name: 'Congo (Congo-Brazzaville)' },
|
|
114
|
+
cr: { name: 'Costa Rica' },
|
|
115
|
+
hr: { name: 'Croatia' },
|
|
116
|
+
cu: { name: 'Cuba' },
|
|
117
|
+
cy: { name: 'Cyprus' },
|
|
118
|
+
cz: { name: 'Czechia' },
|
|
119
|
+
cd: { name: 'Democratic Republic of the Congo' },
|
|
120
|
+
dk: { name: 'Denmark' },
|
|
121
|
+
dj: { name: 'Djibouti' },
|
|
122
|
+
dm: { name: 'Dominica' },
|
|
123
|
+
do: { name: 'Dominican Republic' },
|
|
124
|
+
ec: { name: 'Ecuador' },
|
|
125
|
+
eg: { name: 'Egypt' },
|
|
126
|
+
sv: { name: 'El Salvador' },
|
|
127
|
+
gq: { name: 'Equatorial Guinea' },
|
|
128
|
+
er: { name: 'Eritrea' },
|
|
129
|
+
ee: { name: 'Estonia' },
|
|
130
|
+
sz: { name: 'Eswatini' },
|
|
131
|
+
et: { name: 'Ethiopia' },
|
|
132
|
+
fj: { name: 'Fiji' },
|
|
133
|
+
fi: { name: 'Finland' },
|
|
134
|
+
fr: { name: 'France' },
|
|
135
|
+
ga: { name: 'Gabon' },
|
|
136
|
+
gm: { name: 'Gambia' },
|
|
137
|
+
ge: { name: 'Georgia' },
|
|
138
|
+
de: { name: 'Germany' },
|
|
139
|
+
gh: { name: 'Ghana' },
|
|
140
|
+
gr: { name: 'Greece' },
|
|
141
|
+
gd: { name: 'Grenada' },
|
|
142
|
+
gt: { name: 'Guatemala' },
|
|
143
|
+
gn: { name: 'Guinea' },
|
|
144
|
+
gw: { name: 'Guinea-Bissau' },
|
|
145
|
+
gy: { name: 'Guyana' },
|
|
146
|
+
ht: { name: 'Haiti' },
|
|
147
|
+
hn: { name: 'Honduras' },
|
|
148
|
+
hu: { name: 'Hungary' },
|
|
149
|
+
is: { name: 'Iceland' },
|
|
150
|
+
in: { name: 'India' },
|
|
151
|
+
id: { name: 'Indonesia' },
|
|
152
|
+
ir: { name: 'Iran' },
|
|
153
|
+
iq: { name: 'Iraq' },
|
|
154
|
+
ie: { name: 'Ireland' },
|
|
155
|
+
il: { name: 'Israel' },
|
|
156
|
+
it: { name: 'Italy' },
|
|
157
|
+
jm: { name: 'Jamaica' },
|
|
158
|
+
jp: { name: 'Japan' },
|
|
159
|
+
jo: { name: 'Jordan' },
|
|
160
|
+
kz: { name: 'Kazakhstan' },
|
|
161
|
+
ke: { name: 'Kenya' },
|
|
162
|
+
ki: { name: 'Kiribati' },
|
|
163
|
+
kw: { name: 'Kuwait' },
|
|
164
|
+
kg: { name: 'Kyrgyzstan' },
|
|
165
|
+
la: { name: 'Laos' },
|
|
166
|
+
lv: { name: 'Latvia' },
|
|
167
|
+
lb: { name: 'Lebanon' },
|
|
168
|
+
ls: { name: 'Lesotho' },
|
|
169
|
+
lr: { name: 'Liberia' },
|
|
170
|
+
ly: { name: 'Libya' },
|
|
171
|
+
li: { name: 'Liechtenstein' },
|
|
172
|
+
lt: { name: 'Lithuania' },
|
|
173
|
+
lu: { name: 'Luxembourg' },
|
|
174
|
+
mg: { name: 'Madagascar' },
|
|
175
|
+
mw: { name: 'Malawi' },
|
|
176
|
+
my: { name: 'Malaysia' },
|
|
177
|
+
mv: { name: 'Maldives' },
|
|
178
|
+
ml: { name: 'Mali' },
|
|
179
|
+
mt: { name: 'Malta' },
|
|
180
|
+
mh: { name: 'Marshall Islands' },
|
|
181
|
+
mr: { name: 'Mauritania' },
|
|
182
|
+
mu: { name: 'Mauritius' },
|
|
183
|
+
mx: { name: 'Mexico' },
|
|
184
|
+
fm: { name: 'Micronesia' },
|
|
185
|
+
md: { name: 'Moldova' },
|
|
186
|
+
mc: { name: 'Monaco' },
|
|
187
|
+
mn: { name: 'Mongolia' },
|
|
188
|
+
me: { name: 'Montenegro' },
|
|
189
|
+
ma: { name: 'Morocco' },
|
|
190
|
+
mz: { name: 'Mozambique' },
|
|
191
|
+
mm: { name: 'Myanmar' },
|
|
192
|
+
na: { name: 'Namibia' },
|
|
193
|
+
nr: { name: 'Nauru' },
|
|
194
|
+
np: { name: 'Nepal' },
|
|
195
|
+
nl: { name: 'Netherlands' },
|
|
196
|
+
nz: { name: 'New Zealand' },
|
|
197
|
+
ni: { name: 'Nicaragua' },
|
|
198
|
+
ne: { name: 'Niger' },
|
|
199
|
+
ng: { name: 'Nigeria' },
|
|
200
|
+
kp: { name: 'North Korea' },
|
|
201
|
+
mk: { name: 'North Macedonia' },
|
|
202
|
+
no: { name: 'Norway' },
|
|
203
|
+
om: { name: 'Oman' },
|
|
204
|
+
pk: { name: 'Pakistan' },
|
|
205
|
+
pw: { name: 'Palau' },
|
|
206
|
+
pa: { name: 'Panama' },
|
|
207
|
+
pg: { name: 'Papua New Guinea' },
|
|
208
|
+
py: { name: 'Paraguay' },
|
|
209
|
+
pe: { name: 'Peru' },
|
|
210
|
+
ph: { name: 'Philippines' },
|
|
211
|
+
pl: { name: 'Poland' },
|
|
212
|
+
pt: { name: 'Portugal' },
|
|
213
|
+
qa: { name: 'Qatar' },
|
|
214
|
+
ro: { name: 'Romania' },
|
|
215
|
+
ru: { name: 'Russia' },
|
|
216
|
+
rw: { name: 'Rwanda' },
|
|
217
|
+
kn: { name: 'Saint Kitts and Nevis' },
|
|
218
|
+
lc: { name: 'Saint Lucia' },
|
|
219
|
+
vc: { name: 'Saint Vincent and the Grenadines' },
|
|
220
|
+
ws: { name: 'Samoa' },
|
|
221
|
+
sm: { name: 'San Marino' },
|
|
222
|
+
st: { name: 'Sao Tome and Principe' },
|
|
223
|
+
sa: { name: 'Saudi Arabia' },
|
|
224
|
+
sn: { name: 'Senegal' },
|
|
225
|
+
rs: { name: 'Serbia' },
|
|
226
|
+
sc: { name: 'Seychelles' },
|
|
227
|
+
sl: { name: 'Sierra Leone' },
|
|
228
|
+
sg: { name: 'Singapore' },
|
|
229
|
+
sk: { name: 'Slovakia' },
|
|
230
|
+
si: { name: 'Slovenia' },
|
|
231
|
+
sb: { name: 'Solomon Islands' },
|
|
232
|
+
so: { name: 'Somalia' },
|
|
233
|
+
za: { name: 'South Africa' },
|
|
234
|
+
kr: { name: 'South Korea' },
|
|
235
|
+
ss: { name: 'South Sudan' },
|
|
236
|
+
es: { name: 'Spain' },
|
|
237
|
+
lk: { name: 'Sri Lanka' },
|
|
238
|
+
sd: { name: 'Sudan' },
|
|
239
|
+
sr: { name: 'Suriname' },
|
|
240
|
+
se: { name: 'Sweden' },
|
|
241
|
+
ch: { name: 'Switzerland' },
|
|
242
|
+
sy: { name: 'Syria' },
|
|
243
|
+
tj: { name: 'Tajikistan' },
|
|
244
|
+
tz: { name: 'Tanzania' },
|
|
245
|
+
th: { name: 'Thailand' },
|
|
246
|
+
tl: { name: 'Timor-Leste' },
|
|
247
|
+
tg: { name: 'Togo' },
|
|
248
|
+
to: { name: 'Tonga' },
|
|
249
|
+
tt: { name: 'Trinidad and Tobago' },
|
|
250
|
+
tn: { name: 'Tunisia' },
|
|
251
|
+
tr: { name: 'Turkey' },
|
|
252
|
+
tm: { name: 'Turkmenistan' },
|
|
253
|
+
tv: { name: 'Tuvalu' },
|
|
254
|
+
ug: { name: 'Uganda' },
|
|
255
|
+
ua: { name: 'Ukraine' },
|
|
256
|
+
ae: { name: 'United Arab Emirates' },
|
|
257
|
+
gb: { name: 'United Kingdom' },
|
|
258
|
+
us: { name: 'United States' },
|
|
259
|
+
uy: { name: 'Uruguay' },
|
|
260
|
+
uz: { name: 'Uzbekistan' },
|
|
261
|
+
vu: { name: 'Vanuatu' },
|
|
262
|
+
va: { name: 'Vatican City' },
|
|
263
|
+
ve: { name: 'Venezuela' },
|
|
264
|
+
vn: { name: 'Vietnam' },
|
|
265
|
+
ye: { name: 'Yemen' },
|
|
266
|
+
zm: { name: 'Zambia' },
|
|
267
|
+
zw: { name: 'Zimbabwe' },
|
|
268
|
+
}
|
package/server/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
export * from '../util.js'
|
|
3
3
|
export * as util from '../util.js'
|
|
4
|
+
export { currencies, countries } from './constants.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
|
-
* Re-export
|
|
7
|
+
* Re-export types from nitro-web/server
|
|
7
8
|
* @typedef {import('./router.js').MiddlewareConfig} MiddlewareConfig
|
|
9
|
+
* @typedef {import('./constants.js').Country} Country
|
|
10
|
+
* @typedef {import('./constants.js').Currency} Currency
|
|
8
11
|
*/
|
|
9
12
|
|
|
10
13
|
// Export models
|
package/server/models/company.js
CHANGED
|
@@ -16,12 +16,12 @@ export default {
|
|
|
16
16
|
status: { type: 'string', default: 'active', enum: ['active', 'unpaid', 'deleted'], required: true },
|
|
17
17
|
users: [{
|
|
18
18
|
_id: { model: 'user', required: true },
|
|
19
|
-
role: { type: 'string', enum: ['owner', 'manager'
|
|
19
|
+
role: { type: 'string', enum: ['owner', 'manager'], required: true },
|
|
20
20
|
status: { type: 'string', default: 'active', enum: ['active', 'deleted'], required: true },
|
|
21
21
|
}],
|
|
22
22
|
invites: [{
|
|
23
23
|
email: { type: 'email', required: true },
|
|
24
|
-
role: { type: 'string', enum: ['owner', 'manager'
|
|
24
|
+
role: { type: 'string', enum: ['owner', 'manager'], required: true },
|
|
25
25
|
inviteToken: { type: 'string', required: true },
|
|
26
26
|
}],
|
|
27
27
|
},
|
package/server/models/user.js
CHANGED
|
@@ -8,18 +8,19 @@ export default {
|
|
|
8
8
|
company: { model: 'company', required: true }, // AKA "active company"
|
|
9
9
|
email: { type: 'email', required: true, index: 'unique' },
|
|
10
10
|
isAdmin: { type: 'boolean', default: false },
|
|
11
|
-
isInvited: { type: 'boolean' },
|
|
12
11
|
firstName: { type: 'string', required: true },
|
|
13
12
|
lastName: { type: 'string', required: true },
|
|
14
|
-
status: { type: 'string', default: 'active', enum: ['active', 'deleted', 'inactive'] },
|
|
15
13
|
stripeCustomer: { type: 'any' },
|
|
16
14
|
stripeSubscription: { type: 'any' },
|
|
17
15
|
stripeIntents: { type: 'any' },
|
|
18
16
|
usedFreeTrial: { type: 'boolean', default: false },
|
|
19
17
|
// hidden fields
|
|
20
18
|
password: { type: 'string', minLength: 6 },
|
|
21
|
-
inviteToken: { type: 'string' },
|
|
22
19
|
resetToken: { type: 'string' },
|
|
20
|
+
// If single tenancy application
|
|
21
|
+
// status: { type: 'string', default: 'active', enum: ['active', 'deleted'] },
|
|
22
|
+
// isInvited: { type: 'boolean' }
|
|
23
|
+
// inviteToken: { type: 'string' },
|
|
23
24
|
},
|
|
24
25
|
|
|
25
26
|
findBL: ['password', 'inviteToken', 'resetToken'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.api.d.ts","sourceRoot":"","sources":["../../../components/auth/auth.api.js"],"names":[],"mappings":"AAuKA,qEAeC;AAED,sEAsCC;AAED,gEAMC;AAED,iEAgBC;AAID,
|
|
1
|
+
{"version":3,"file":"auth.api.d.ts","sourceRoot":"","sources":["../../../components/auth/auth.api.js"],"names":[],"mappings":"AAuKA,qEAeC;AAED,sEAsCC;AAED,gEAMC;AAED,iEAgBC;AAID,qGA8CC;AAED,4EAOC;AAED;;GAKC;AAID;;;;;;;;GAQG;AACH,8EANG;IAA0B,QAAQ,GAA1B,MAAM;IACY,SAAS,GAA3B,MAAM;IACY,OAAO,GAAzB,MAAM;CACd,kBAAQ,OAAO,GACL,OAAO,CAAC,MAAM,CAAC,CA0D3B;AAED,kFAiBC;AAED,mEAOC;AAED,+EAWC;AAED,6DAEC;AAED,kFAoBC;AAED,mEA4BC;AAED;;;;;;;;;;GAUG;AACH,0FARG;IAAsD,IAAI,EAAlD,OAAO,GAAG,QAAQ,GAAG,eAAe;IACpB,GAAG,EAAnB,MAAM;IACU,KAAK,EAArB,MAAM;IACU,SAAS,EAAzB,MAAM;IACa,YAAY;IACZ,eAAe;CAC1C,GAAU,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAAC,CAAC,CAuCtE;AA9fD;;;;;;;;;;;EAaC;AAyED,0DAEC;AA6BD,mDAEC;AAnBD,iDAeC;AAzBD,2DAQC;AAuBD,2DAwBC;AAlID,0EAqEC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {'af'|'al'|'dz'|'ad'|'ao'|'ag'|'ar'|'am'|'au'|'at'|'az'|'bs'|'bh'|'bd'|'bb'|'by'|'be'|'bz'|'bj'|'bt'|'bo'|'ba'|'bw'|'br'|
|
|
3
|
+
* 'bn'|'bg'|'bf'|'bi'|'cv'|'kh'|'cm'|'ca'|'cf'|'td'|'cl'|'cn'|'co'|'km'|'cg'|'cr'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ngn'|'nok'|'omr'|'pen'|'php'|'pkt'|
|
|
12
|
+
* 'pln'|'qar'|'ron'|'rub'|'sar'|'sek'|'sgd'|'thb'|'try'|'twd'|'uah'|'vnd'|'zar'} Currency
|
|
13
|
+
*/
|
|
14
|
+
/** @type {{ [key in Currency]: { name: string, symbol: string, digits: number } }} */
|
|
15
|
+
export const currencies: { [key in Currency]: {
|
|
16
|
+
name: string;
|
|
17
|
+
symbol: string;
|
|
18
|
+
digits: number;
|
|
19
|
+
}; };
|
|
20
|
+
/** @type {{ [key in Country]: { name: string } }} */
|
|
21
|
+
export const countries: { [key in Country]: {
|
|
22
|
+
name: string;
|
|
23
|
+
}; };
|
|
24
|
+
export type Country = "af" | "al" | "dz" | "ad" | "ao" | "ag" | "ar" | "am" | "au" | "at" | "az" | "bs" | "bh" | "bd" | "bb" | "by" | "be" | "bz" | "bj" | "bt" | "bo" | "ba" | "bw" | "br" | "bn" | "bg" | "bf" | "bi" | "cv" | "kh" | "cm" | "ca" | "cf" | "td" | "cl" | "cn" | "co" | "km" | "cg" | "cr" | "hr" | "cu" | "cy" | "cz" | "cd" | "dk" | "dj" | "dm" | "do" | "ec" | "eg" | "sv" | "gq" | "er" | "ee" | "sz" | "et" | "fj" | "fi" | "fr" | "ga" | "gm" | "ge" | "de" | "gh" | "gr" | "gd" | "gt" | "gn" | "gw" | "gy" | "ht" | "hn" | "hu" | "is" | "in" | "id" | "ir" | "iq" | "ie" | "il" | "it" | "jm" | "jp" | "jo" | "kz" | "ke" | "ki" | "kw" | "kg" | "la" | "lv" | "lb" | "ls" | "lr" | "ly" | "li" | "lt" | "lu" | "mg" | "mw" | "my" | "mv" | "ml" | "mt" | "mh" | "mr" | "mu" | "mx" | "fm" | "md" | "mc" | "mn" | "me" | "ma" | "mz" | "mm" | "na" | "nr" | "np" | "nl" | "nz" | "ni" | "ne" | "ng" | "kp" | "mk" | "no" | "om" | "pk" | "pw" | "pa" | "pg" | "py" | "pe" | "ph" | "pl" | "pt" | "qa" | "ro" | "ru" | "rw" | "kn" | "lc" | "vc" | "ws" | "sm" | "st" | "sa" | "sn" | "rs" | "sc" | "sl" | "sg" | "sk" | "si" | "sb" | "so" | "za" | "kr" | "ss" | "es" | "lk" | "sd" | "sr" | "se" | "ch" | "sy" | "tj" | "tz" | "th" | "tl" | "tg" | "to" | "tt" | "tn" | "tr" | "tm" | "tv" | "ug" | "ua" | "ae" | "gb" | "us" | "uy" | "uz" | "vu" | "va" | "ve" | "vn" | "ye" | "zm" | "zw";
|
|
25
|
+
export type Currency = "nzd" | "aud" | "usd" | "gbp" | "btc" | "aed" | "ars" | "bdt" | "bhd" | "brl" | "cad" | "chf" | "clp" | "cny" | "cop" | "czk" | "dkk" | "egp" | "eur" | "hkd" | "huf" | "idr" | "ils" | "inr" | "jod" | "jpy" | "kes" | "krw" | "kwd" | "lkr" | "mad" | "mxn" | "myr" | "ngn" | "nok" | "omr" | "pen" | "php" | "pkt" | "pln" | "qar" | "ron" | "rub" | "sar" | "sek" | "sgd" | "thb" | "try" | "twd" | "uah" | "vnd" | "zar";
|
|
26
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../server/constants.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,sFAAsF;AACtF,yBADW,GAAG,GAAG,IAAI,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAE,CAsDjF;AAED,qDAAqD;AACrD,wBADW,GAAG,GAAG,IAAI,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAE,CAmMhD;sBAxQY,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,G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AAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAC1H,KAAQ,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK"}
|
package/types/server/index.d.ts
CHANGED
|
@@ -6,12 +6,21 @@ export { sendEmail } from "./email/index.js";
|
|
|
6
6
|
export { routes as authRoutes } from "../components/auth/auth.api.js";
|
|
7
7
|
export { routes as stripeRoutes } from "../components/billing/stripe.api.js";
|
|
8
8
|
/**
|
|
9
|
-
* Re-export
|
|
9
|
+
* Re-export types from nitro-web/server
|
|
10
10
|
*/
|
|
11
11
|
export type MiddlewareConfig = import("./router.js").MiddlewareConfig;
|
|
12
|
+
/**
|
|
13
|
+
* Re-export types from nitro-web/server
|
|
14
|
+
*/
|
|
15
|
+
export type Country = import("./constants.js").Country;
|
|
16
|
+
/**
|
|
17
|
+
* Re-export types from nitro-web/server
|
|
18
|
+
*/
|
|
19
|
+
export type Currency = import("./constants.js").Currency;
|
|
12
20
|
import userModel from './models/user.js';
|
|
13
21
|
import companyModel from './models/company.js';
|
|
14
22
|
export function setupDefaultModels(db: any): Promise<void>;
|
|
15
23
|
export { userModel, companyModel };
|
|
24
|
+
export { currencies, countries } from "./constants.js";
|
|
16
25
|
export { setupRouter, middleware, isValidUserOrRespond, isAdminUser } from "./router.js";
|
|
17
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../server/index.js"],"names":[],"mappings":";;;;;;;;;;+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../server/index.js"],"names":[],"mappings":";;;;;;;;;;+BAOa,OAAO,aAAa,EAAE,gBAAgB;;;;sBACtC,OAAO,gBAAgB,EAAE,OAAO;;;;uBAChC,OAAO,gBAAgB,EAAE,QAAQ;sBAIxB,kBAAkB;yBACf,qBAAqB;AAC9C,2DAIC"}
|
|
@@ -20,60 +20,44 @@ declare namespace _default {
|
|
|
20
20
|
let _default: boolean;
|
|
21
21
|
export { _default as default };
|
|
22
22
|
}
|
|
23
|
-
namespace
|
|
23
|
+
namespace firstName {
|
|
24
24
|
let type_3: string;
|
|
25
25
|
export { type_3 as type };
|
|
26
|
-
}
|
|
27
|
-
namespace firstName {
|
|
28
|
-
let type_4: string;
|
|
29
|
-
export { type_4 as type };
|
|
30
26
|
let required_2: boolean;
|
|
31
27
|
export { required_2 as required };
|
|
32
28
|
}
|
|
33
29
|
namespace lastName {
|
|
34
|
-
let
|
|
35
|
-
export {
|
|
30
|
+
let type_4: string;
|
|
31
|
+
export { type_4 as type };
|
|
36
32
|
let required_3: boolean;
|
|
37
33
|
export { required_3 as required };
|
|
38
34
|
}
|
|
39
|
-
namespace
|
|
35
|
+
namespace stripeCustomer {
|
|
36
|
+
let type_5: string;
|
|
37
|
+
export { type_5 as type };
|
|
38
|
+
}
|
|
39
|
+
namespace stripeSubscription {
|
|
40
40
|
let type_6: string;
|
|
41
41
|
export { type_6 as type };
|
|
42
|
-
let _default_1: string;
|
|
43
|
-
export { _default_1 as default };
|
|
44
|
-
let _enum: string[];
|
|
45
|
-
export { _enum as enum };
|
|
46
42
|
}
|
|
47
|
-
namespace
|
|
43
|
+
namespace stripeIntents {
|
|
48
44
|
let type_7: string;
|
|
49
45
|
export { type_7 as type };
|
|
50
46
|
}
|
|
51
|
-
namespace
|
|
47
|
+
namespace usedFreeTrial {
|
|
52
48
|
let type_8: string;
|
|
53
49
|
export { type_8 as type };
|
|
50
|
+
let _default_1: boolean;
|
|
51
|
+
export { _default_1 as default };
|
|
54
52
|
}
|
|
55
|
-
namespace
|
|
53
|
+
namespace password {
|
|
56
54
|
let type_9: string;
|
|
57
55
|
export { type_9 as type };
|
|
58
|
-
}
|
|
59
|
-
namespace usedFreeTrial {
|
|
60
|
-
let type_10: string;
|
|
61
|
-
export { type_10 as type };
|
|
62
|
-
let _default_2: boolean;
|
|
63
|
-
export { _default_2 as default };
|
|
64
|
-
}
|
|
65
|
-
namespace password {
|
|
66
|
-
let type_11: string;
|
|
67
|
-
export { type_11 as type };
|
|
68
56
|
export let minLength: number;
|
|
69
57
|
}
|
|
70
|
-
namespace inviteToken {
|
|
71
|
-
let type_12: string;
|
|
72
|
-
export { type_12 as type };
|
|
73
|
-
}
|
|
74
58
|
namespace resetToken {
|
|
75
|
-
let
|
|
76
|
-
export {
|
|
59
|
+
let type_10: string;
|
|
60
|
+
export { type_10 as type };
|
|
77
61
|
}
|
|
78
62
|
}
|
|
79
63
|
let findBL: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../server/models/user.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../server/models/user.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAkDmB,gCAEd"}
|