@vandenberghinc/volt 1.2.13 → 1.2.14
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/backend/dist/cjs/backend/src/endpoint.d.ts +1 -1
- package/backend/dist/cjs/backend/src/endpoint.js +1 -1
- package/backend/dist/cjs/backend/src/payments/stripe/stripe.js +7 -0
- package/backend/dist/cjs/backend/src/plugins/caddy/caddy.d.ts +1 -0
- package/backend/dist/cjs/backend/src/plugins/caddy/caddy.js +15 -0
- package/backend/dist/cjs/backend/src/server.js +7 -3
- package/backend/dist/cjs/backend/src/users.js +19 -0
- package/backend/dist/esm/backend/src/endpoint.d.ts +1 -1
- package/backend/dist/esm/backend/src/endpoint.js +1 -1
- package/backend/dist/esm/backend/src/payments/stripe/stripe.js +7 -0
- package/backend/dist/esm/backend/src/plugins/caddy/caddy.d.ts +1 -0
- package/backend/dist/esm/backend/src/plugins/caddy/caddy.js +592 -0
- package/backend/dist/esm/backend/src/server.js +4 -0
- package/backend/dist/esm/backend/src/users.js +19 -0
- package/frontend/dist/backend/src/endpoint.d.ts +1 -1
- package/frontend/dist/backend/src/endpoint.js +1 -1
- package/frontend/dist/backend/src/payments/stripe/stripe.js +7 -0
- package/frontend/dist/backend/src/server.js +4 -0
- package/frontend/dist/backend/src/users.js +19 -0
- package/package.json +1 -1
|
@@ -686,6 +686,7 @@ export class Users {
|
|
|
686
686
|
params: {
|
|
687
687
|
email: "string",
|
|
688
688
|
},
|
|
689
|
+
cache: false,
|
|
689
690
|
callback: async (stream, params) => {
|
|
690
691
|
// Get uid.
|
|
691
692
|
let uid;
|
|
@@ -711,6 +712,7 @@ export class Users {
|
|
|
711
712
|
interval: 60,
|
|
712
713
|
group: "volt.auth"
|
|
713
714
|
},
|
|
715
|
+
cache: false,
|
|
714
716
|
callback: async (stream) => {
|
|
715
717
|
// console.log("signin 1")
|
|
716
718
|
// Uniform delay on failure.
|
|
@@ -873,6 +875,7 @@ export class Users {
|
|
|
873
875
|
content_type: "application/json",
|
|
874
876
|
authenticated: true,
|
|
875
877
|
rate_limit: "global",
|
|
878
|
+
cache: false,
|
|
876
879
|
callback: async (stream) => {
|
|
877
880
|
// Delete token.
|
|
878
881
|
await this._deactivate_token(stream.uid);
|
|
@@ -903,6 +906,7 @@ export class Users {
|
|
|
903
906
|
phone_number: { type: "string", required: false },
|
|
904
907
|
code: { type: "string", required: false },
|
|
905
908
|
},
|
|
909
|
+
cache: false,
|
|
906
910
|
callback: async (stream, params) => {
|
|
907
911
|
console.log("signup 1", params);
|
|
908
912
|
// Verify password.
|
|
@@ -1006,6 +1010,7 @@ export class Users {
|
|
|
1006
1010
|
params: {
|
|
1007
1011
|
code: "string",
|
|
1008
1012
|
},
|
|
1013
|
+
cache: false,
|
|
1009
1014
|
callback: async (stream, params) => {
|
|
1010
1015
|
// Vars.
|
|
1011
1016
|
let uid = stream.uid;
|
|
@@ -1050,6 +1055,7 @@ export class Users {
|
|
|
1050
1055
|
password: { type: "string", allow_empty: false },
|
|
1051
1056
|
verify_password: { type: "string", allow_empty: false },
|
|
1052
1057
|
},
|
|
1058
|
+
cache: false,
|
|
1053
1059
|
callback: async (stream, params) => {
|
|
1054
1060
|
// Verify password.
|
|
1055
1061
|
const { error, invalid_fields } = this._verify_new_pass(params.password, params.verify_password);
|
|
@@ -1094,6 +1100,7 @@ export class Users {
|
|
|
1094
1100
|
params: {
|
|
1095
1101
|
// detailed: { type: "boolean", default: false },
|
|
1096
1102
|
},
|
|
1103
|
+
cache: false,
|
|
1097
1104
|
callback: async (stream) => {
|
|
1098
1105
|
const user = await this.get(stream.uid);
|
|
1099
1106
|
// Mask sensitive data.
|
|
@@ -1134,6 +1141,7 @@ export class Users {
|
|
|
1134
1141
|
content_type: "application/json",
|
|
1135
1142
|
authenticated: true,
|
|
1136
1143
|
rate_limit: "global",
|
|
1144
|
+
cache: false,
|
|
1137
1145
|
params: {
|
|
1138
1146
|
first_name: { type: "string", required: false, allow_empty: false },
|
|
1139
1147
|
last_name: { type: "string", required: false, allow_empty: false },
|
|
@@ -1180,6 +1188,7 @@ export class Users {
|
|
|
1180
1188
|
content_type: "application/json",
|
|
1181
1189
|
authenticated: true,
|
|
1182
1190
|
rate_limit: "global",
|
|
1191
|
+
cache: false,
|
|
1183
1192
|
params: {
|
|
1184
1193
|
current_password: { type: "string", allow_empty: false },
|
|
1185
1194
|
password: { type: "string", allow_empty: false },
|
|
@@ -1221,6 +1230,7 @@ export class Users {
|
|
|
1221
1230
|
content_type: "application/json",
|
|
1222
1231
|
authenticated: true,
|
|
1223
1232
|
rate_limit: "global",
|
|
1233
|
+
cache: false,
|
|
1224
1234
|
callback: async (stream) => {
|
|
1225
1235
|
// Delete.
|
|
1226
1236
|
await this.delete(stream.uid);
|
|
@@ -1240,6 +1250,7 @@ export class Users {
|
|
|
1240
1250
|
content_type: "application/json",
|
|
1241
1251
|
authenticated: true,
|
|
1242
1252
|
rate_limit: "global",
|
|
1253
|
+
cache: false,
|
|
1243
1254
|
callback: async (stream) => {
|
|
1244
1255
|
return stream.success({
|
|
1245
1256
|
data: {
|
|
@@ -1256,6 +1267,7 @@ export class Users {
|
|
|
1256
1267
|
content_type: "application/json",
|
|
1257
1268
|
authenticated: true,
|
|
1258
1269
|
rate_limit: "global",
|
|
1270
|
+
cache: false,
|
|
1259
1271
|
callback: async (stream) => {
|
|
1260
1272
|
return stream.success({
|
|
1261
1273
|
data: {
|
|
@@ -1272,6 +1284,7 @@ export class Users {
|
|
|
1272
1284
|
content_type: "application/json",
|
|
1273
1285
|
authenticated: true,
|
|
1274
1286
|
rate_limit: "global",
|
|
1287
|
+
cache: false,
|
|
1275
1288
|
callback: async (stream) => {
|
|
1276
1289
|
await this.revoke_api_key(stream.uid);
|
|
1277
1290
|
return stream.send({
|
|
@@ -1338,6 +1351,7 @@ export class Users {
|
|
|
1338
1351
|
content_type: "application/json",
|
|
1339
1352
|
authenticated: true,
|
|
1340
1353
|
rate_limit: "global",
|
|
1354
|
+
cache: false,
|
|
1341
1355
|
params: {
|
|
1342
1356
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1343
1357
|
default: { type: Users.Endpoints.JsonValueSchemaType, required: false },
|
|
@@ -1380,6 +1394,7 @@ export class Users {
|
|
|
1380
1394
|
content_type: "application/json",
|
|
1381
1395
|
authenticated: true,
|
|
1382
1396
|
rate_limit: "global",
|
|
1397
|
+
cache: false,
|
|
1383
1398
|
params: {
|
|
1384
1399
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1385
1400
|
data: { type: Users.Endpoints.JsonValueSchemaType },
|
|
@@ -1402,6 +1417,7 @@ export class Users {
|
|
|
1402
1417
|
content_type: "application/json",
|
|
1403
1418
|
authenticated: true,
|
|
1404
1419
|
rate_limit: "global",
|
|
1420
|
+
cache: false,
|
|
1405
1421
|
params: {
|
|
1406
1422
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1407
1423
|
},
|
|
@@ -1423,6 +1439,7 @@ export class Users {
|
|
|
1423
1439
|
content_type: "application/json",
|
|
1424
1440
|
authenticated: true,
|
|
1425
1441
|
rate_limit: "global",
|
|
1442
|
+
cache: false,
|
|
1426
1443
|
params: {
|
|
1427
1444
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1428
1445
|
default: { type: Users.Endpoints.JsonValueSchemaType, required: false },
|
|
@@ -1466,6 +1483,7 @@ export class Users {
|
|
|
1466
1483
|
endpoint: "/volt/api/v1/support/pin",
|
|
1467
1484
|
content_type: "application/json",
|
|
1468
1485
|
authenticated: true,
|
|
1486
|
+
cache: false,
|
|
1469
1487
|
rate_limit: "global",
|
|
1470
1488
|
callback: async (stream) => {
|
|
1471
1489
|
// Sign in.
|
|
@@ -1483,6 +1501,7 @@ export class Users {
|
|
|
1483
1501
|
method: "POST",
|
|
1484
1502
|
endpoint: "/volt/api/v1/support/submit",
|
|
1485
1503
|
content_type: "application/json",
|
|
1504
|
+
cache: false,
|
|
1486
1505
|
rate_limit: [
|
|
1487
1506
|
"global",
|
|
1488
1507
|
{
|
|
@@ -226,7 +226,7 @@ export declare namespace Endpoint {
|
|
|
226
226
|
* When production mode is disabled responses are never cached, even though the parameter is assigned.
|
|
227
227
|
* The response of an endpoint that uses parameter `callback` is never cached.
|
|
228
228
|
*/
|
|
229
|
-
cache
|
|
229
|
+
cache: boolean | number;
|
|
230
230
|
/**
|
|
231
231
|
* An IP whitelist for the endpoint. When the parameter is defined with an Array,
|
|
232
232
|
* the whitelist will become active.
|
|
@@ -174,7 +174,7 @@ export class Endpoint {
|
|
|
174
174
|
* Construct an endpoint.
|
|
175
175
|
* @docs
|
|
176
176
|
*/
|
|
177
|
-
constructor({ method, endpoint, authenticated = false, rate_limit = undefined, params = undefined, compress = true, cache
|
|
177
|
+
constructor({ method, endpoint, authenticated = false, rate_limit = undefined, params = undefined, compress = true, cache, ip_whitelist = undefined, sitemap = undefined, robots = undefined, allow_unknown_params = false, _is_static = false,
|
|
178
178
|
// mode options.
|
|
179
179
|
callback = undefined, view = undefined, data = undefined, file_path = undefined, content_type, // = "text/plain",
|
|
180
180
|
}) {
|
|
@@ -48,6 +48,7 @@ export class Stripe {
|
|
|
48
48
|
method: "POST",
|
|
49
49
|
endpoint: "/volt/api/stripe/webhook",
|
|
50
50
|
allow_unknown_params: true,
|
|
51
|
+
cache: false,
|
|
51
52
|
callback: async (stream) => {
|
|
52
53
|
// Ensure the request body is fully received.
|
|
53
54
|
await stream.join();
|
|
@@ -89,6 +90,7 @@ export class Stripe {
|
|
|
89
90
|
method: Endpoint.method("GET"),
|
|
90
91
|
endpoint: Endpoint.endpoint("/volt/api/stripe/v1/products"),
|
|
91
92
|
authenticated: false,
|
|
93
|
+
cache: false,
|
|
92
94
|
callback: async (stream) => {
|
|
93
95
|
return stream.send({
|
|
94
96
|
status: 200,
|
|
@@ -105,6 +107,7 @@ export class Stripe {
|
|
|
105
107
|
method: Endpoint.method("GET"),
|
|
106
108
|
endpoint: Endpoint.endpoint("/volt/api/stripe/v1/subscriptions"),
|
|
107
109
|
authenticated: true,
|
|
110
|
+
cache: false,
|
|
108
111
|
callback: async (stream) => {
|
|
109
112
|
// Fetch all subscriptions.
|
|
110
113
|
const subs = await this.get_active_subscriptions({
|
|
@@ -130,6 +133,7 @@ export class Stripe {
|
|
|
130
133
|
method: Endpoint.method("GET"),
|
|
131
134
|
endpoint: Endpoint.endpoint("/volt/api/stripe/v1/subscriptions/meters"),
|
|
132
135
|
authenticated: true,
|
|
136
|
+
cache: false,
|
|
133
137
|
callback: async (stream) => {
|
|
134
138
|
// Fetch all subscriptions.
|
|
135
139
|
const active = await this.get_active_meters({
|
|
@@ -156,6 +160,7 @@ export class Stripe {
|
|
|
156
160
|
cancel_at_period_end: { type: "boolean", default: true },
|
|
157
161
|
},
|
|
158
162
|
authenticated: true,
|
|
163
|
+
cache: false,
|
|
159
164
|
callback: async (stream, params) => {
|
|
160
165
|
// Fetch all subscriptions.
|
|
161
166
|
const res = await this.cancel_subscription({
|
|
@@ -176,6 +181,7 @@ export class Stripe {
|
|
|
176
181
|
method: Endpoint.method("POST"),
|
|
177
182
|
endpoint: Endpoint.endpoint("/volt/api/stripe/v1/checkout/session_id"),
|
|
178
183
|
authenticated: false,
|
|
184
|
+
cache: false,
|
|
179
185
|
callback: async (stream) => {
|
|
180
186
|
return stream.send({
|
|
181
187
|
status: 200,
|
|
@@ -211,6 +217,7 @@ export class Stripe {
|
|
|
211
217
|
tax_id_collection_enabled: "boolean",
|
|
212
218
|
},
|
|
213
219
|
authenticated: false,
|
|
220
|
+
cache: false,
|
|
214
221
|
callback: async (stream, params) => {
|
|
215
222
|
const res = await start_checkout_session(this.client, this.server, {
|
|
216
223
|
uid: stream.uid,
|
|
@@ -609,6 +609,7 @@ export class Server {
|
|
|
609
609
|
content_type: this.get_content_type(favicon.extension()),
|
|
610
610
|
_is_static: true,
|
|
611
611
|
server: this,
|
|
612
|
+
cache: true,
|
|
612
613
|
});
|
|
613
614
|
}
|
|
614
615
|
// Create status endpoint.
|
|
@@ -632,6 +633,7 @@ export class Server {
|
|
|
632
633
|
params: {
|
|
633
634
|
key: "string",
|
|
634
635
|
},
|
|
636
|
+
cache: false,
|
|
635
637
|
callback: async (stream, params) => {
|
|
636
638
|
// Check key.
|
|
637
639
|
if (params.key !== status_key) {
|
|
@@ -699,6 +701,7 @@ export class Server {
|
|
|
699
701
|
data: sitemap,
|
|
700
702
|
content_type: "application/xml",
|
|
701
703
|
_compress: false,
|
|
704
|
+
cache: true,
|
|
702
705
|
});
|
|
703
706
|
}
|
|
704
707
|
// Create the robots.txt endpoint.
|
|
@@ -724,6 +727,7 @@ export class Server {
|
|
|
724
727
|
content_type: "text/plain",
|
|
725
728
|
data: robots,
|
|
726
729
|
_compress: false,
|
|
730
|
+
cache: true,
|
|
727
731
|
});
|
|
728
732
|
}
|
|
729
733
|
// Create admin endpoint.
|
|
@@ -686,6 +686,7 @@ export class Users {
|
|
|
686
686
|
params: {
|
|
687
687
|
email: "string",
|
|
688
688
|
},
|
|
689
|
+
cache: false,
|
|
689
690
|
callback: async (stream, params) => {
|
|
690
691
|
// Get uid.
|
|
691
692
|
let uid;
|
|
@@ -711,6 +712,7 @@ export class Users {
|
|
|
711
712
|
interval: 60,
|
|
712
713
|
group: "volt.auth"
|
|
713
714
|
},
|
|
715
|
+
cache: false,
|
|
714
716
|
callback: async (stream) => {
|
|
715
717
|
// console.log("signin 1")
|
|
716
718
|
// Uniform delay on failure.
|
|
@@ -873,6 +875,7 @@ export class Users {
|
|
|
873
875
|
content_type: "application/json",
|
|
874
876
|
authenticated: true,
|
|
875
877
|
rate_limit: "global",
|
|
878
|
+
cache: false,
|
|
876
879
|
callback: async (stream) => {
|
|
877
880
|
// Delete token.
|
|
878
881
|
await this._deactivate_token(stream.uid);
|
|
@@ -903,6 +906,7 @@ export class Users {
|
|
|
903
906
|
phone_number: { type: "string", required: false },
|
|
904
907
|
code: { type: "string", required: false },
|
|
905
908
|
},
|
|
909
|
+
cache: false,
|
|
906
910
|
callback: async (stream, params) => {
|
|
907
911
|
console.log("signup 1", params);
|
|
908
912
|
// Verify password.
|
|
@@ -1006,6 +1010,7 @@ export class Users {
|
|
|
1006
1010
|
params: {
|
|
1007
1011
|
code: "string",
|
|
1008
1012
|
},
|
|
1013
|
+
cache: false,
|
|
1009
1014
|
callback: async (stream, params) => {
|
|
1010
1015
|
// Vars.
|
|
1011
1016
|
let uid = stream.uid;
|
|
@@ -1050,6 +1055,7 @@ export class Users {
|
|
|
1050
1055
|
password: { type: "string", allow_empty: false },
|
|
1051
1056
|
verify_password: { type: "string", allow_empty: false },
|
|
1052
1057
|
},
|
|
1058
|
+
cache: false,
|
|
1053
1059
|
callback: async (stream, params) => {
|
|
1054
1060
|
// Verify password.
|
|
1055
1061
|
const { error, invalid_fields } = this._verify_new_pass(params.password, params.verify_password);
|
|
@@ -1094,6 +1100,7 @@ export class Users {
|
|
|
1094
1100
|
params: {
|
|
1095
1101
|
// detailed: { type: "boolean", default: false },
|
|
1096
1102
|
},
|
|
1103
|
+
cache: false,
|
|
1097
1104
|
callback: async (stream) => {
|
|
1098
1105
|
const user = await this.get(stream.uid);
|
|
1099
1106
|
// Mask sensitive data.
|
|
@@ -1134,6 +1141,7 @@ export class Users {
|
|
|
1134
1141
|
content_type: "application/json",
|
|
1135
1142
|
authenticated: true,
|
|
1136
1143
|
rate_limit: "global",
|
|
1144
|
+
cache: false,
|
|
1137
1145
|
params: {
|
|
1138
1146
|
first_name: { type: "string", required: false, allow_empty: false },
|
|
1139
1147
|
last_name: { type: "string", required: false, allow_empty: false },
|
|
@@ -1180,6 +1188,7 @@ export class Users {
|
|
|
1180
1188
|
content_type: "application/json",
|
|
1181
1189
|
authenticated: true,
|
|
1182
1190
|
rate_limit: "global",
|
|
1191
|
+
cache: false,
|
|
1183
1192
|
params: {
|
|
1184
1193
|
current_password: { type: "string", allow_empty: false },
|
|
1185
1194
|
password: { type: "string", allow_empty: false },
|
|
@@ -1221,6 +1230,7 @@ export class Users {
|
|
|
1221
1230
|
content_type: "application/json",
|
|
1222
1231
|
authenticated: true,
|
|
1223
1232
|
rate_limit: "global",
|
|
1233
|
+
cache: false,
|
|
1224
1234
|
callback: async (stream) => {
|
|
1225
1235
|
// Delete.
|
|
1226
1236
|
await this.delete(stream.uid);
|
|
@@ -1240,6 +1250,7 @@ export class Users {
|
|
|
1240
1250
|
content_type: "application/json",
|
|
1241
1251
|
authenticated: true,
|
|
1242
1252
|
rate_limit: "global",
|
|
1253
|
+
cache: false,
|
|
1243
1254
|
callback: async (stream) => {
|
|
1244
1255
|
return stream.success({
|
|
1245
1256
|
data: {
|
|
@@ -1256,6 +1267,7 @@ export class Users {
|
|
|
1256
1267
|
content_type: "application/json",
|
|
1257
1268
|
authenticated: true,
|
|
1258
1269
|
rate_limit: "global",
|
|
1270
|
+
cache: false,
|
|
1259
1271
|
callback: async (stream) => {
|
|
1260
1272
|
return stream.success({
|
|
1261
1273
|
data: {
|
|
@@ -1272,6 +1284,7 @@ export class Users {
|
|
|
1272
1284
|
content_type: "application/json",
|
|
1273
1285
|
authenticated: true,
|
|
1274
1286
|
rate_limit: "global",
|
|
1287
|
+
cache: false,
|
|
1275
1288
|
callback: async (stream) => {
|
|
1276
1289
|
await this.revoke_api_key(stream.uid);
|
|
1277
1290
|
return stream.send({
|
|
@@ -1338,6 +1351,7 @@ export class Users {
|
|
|
1338
1351
|
content_type: "application/json",
|
|
1339
1352
|
authenticated: true,
|
|
1340
1353
|
rate_limit: "global",
|
|
1354
|
+
cache: false,
|
|
1341
1355
|
params: {
|
|
1342
1356
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1343
1357
|
default: { type: Users.Endpoints.JsonValueSchemaType, required: false },
|
|
@@ -1380,6 +1394,7 @@ export class Users {
|
|
|
1380
1394
|
content_type: "application/json",
|
|
1381
1395
|
authenticated: true,
|
|
1382
1396
|
rate_limit: "global",
|
|
1397
|
+
cache: false,
|
|
1383
1398
|
params: {
|
|
1384
1399
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1385
1400
|
data: { type: Users.Endpoints.JsonValueSchemaType },
|
|
@@ -1402,6 +1417,7 @@ export class Users {
|
|
|
1402
1417
|
content_type: "application/json",
|
|
1403
1418
|
authenticated: true,
|
|
1404
1419
|
rate_limit: "global",
|
|
1420
|
+
cache: false,
|
|
1405
1421
|
params: {
|
|
1406
1422
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1407
1423
|
},
|
|
@@ -1423,6 +1439,7 @@ export class Users {
|
|
|
1423
1439
|
content_type: "application/json",
|
|
1424
1440
|
authenticated: true,
|
|
1425
1441
|
rate_limit: "global",
|
|
1442
|
+
cache: false,
|
|
1426
1443
|
params: {
|
|
1427
1444
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1428
1445
|
default: { type: Users.Endpoints.JsonValueSchemaType, required: false },
|
|
@@ -1466,6 +1483,7 @@ export class Users {
|
|
|
1466
1483
|
endpoint: "/volt/api/v1/support/pin",
|
|
1467
1484
|
content_type: "application/json",
|
|
1468
1485
|
authenticated: true,
|
|
1486
|
+
cache: false,
|
|
1469
1487
|
rate_limit: "global",
|
|
1470
1488
|
callback: async (stream) => {
|
|
1471
1489
|
// Sign in.
|
|
@@ -1483,6 +1501,7 @@ export class Users {
|
|
|
1483
1501
|
method: "POST",
|
|
1484
1502
|
endpoint: "/volt/api/v1/support/submit",
|
|
1485
1503
|
content_type: "application/json",
|
|
1504
|
+
cache: false,
|
|
1486
1505
|
rate_limit: [
|
|
1487
1506
|
"global",
|
|
1488
1507
|
{
|