@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
|
@@ -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.
|
|
@@ -72,6 +72,7 @@ class Stripe {
|
|
|
72
72
|
method: "POST",
|
|
73
73
|
endpoint: "/volt/api/stripe/webhook",
|
|
74
74
|
allow_unknown_params: true,
|
|
75
|
+
cache: false,
|
|
75
76
|
callback: async (stream) => {
|
|
76
77
|
await stream.join();
|
|
77
78
|
if (!this.webhook_signing_secret) {
|
|
@@ -106,6 +107,7 @@ class Stripe {
|
|
|
106
107
|
method: import_endpoint.Endpoint.method("GET"),
|
|
107
108
|
endpoint: import_endpoint.Endpoint.endpoint("/volt/api/stripe/v1/products"),
|
|
108
109
|
authenticated: false,
|
|
110
|
+
cache: false,
|
|
109
111
|
callback: async (stream) => {
|
|
110
112
|
return stream.send({
|
|
111
113
|
status: 200,
|
|
@@ -119,6 +121,7 @@ class Stripe {
|
|
|
119
121
|
method: import_endpoint.Endpoint.method("GET"),
|
|
120
122
|
endpoint: import_endpoint.Endpoint.endpoint("/volt/api/stripe/v1/subscriptions"),
|
|
121
123
|
authenticated: true,
|
|
124
|
+
cache: false,
|
|
122
125
|
callback: async (stream) => {
|
|
123
126
|
const subs = await this.get_active_subscriptions({
|
|
124
127
|
uid: stream.uid
|
|
@@ -142,6 +145,7 @@ class Stripe {
|
|
|
142
145
|
method: import_endpoint.Endpoint.method("GET"),
|
|
143
146
|
endpoint: import_endpoint.Endpoint.endpoint("/volt/api/stripe/v1/subscriptions/meters"),
|
|
144
147
|
authenticated: true,
|
|
148
|
+
cache: false,
|
|
145
149
|
callback: async (stream) => {
|
|
146
150
|
const active = await this.get_active_meters({
|
|
147
151
|
uid: stream.uid
|
|
@@ -166,6 +170,7 @@ class Stripe {
|
|
|
166
170
|
cancel_at_period_end: { type: "boolean", default: true }
|
|
167
171
|
},
|
|
168
172
|
authenticated: true,
|
|
173
|
+
cache: false,
|
|
169
174
|
callback: async (stream, params) => {
|
|
170
175
|
const res = await this.cancel_subscription({
|
|
171
176
|
uid: stream.uid,
|
|
@@ -182,6 +187,7 @@ class Stripe {
|
|
|
182
187
|
method: import_endpoint.Endpoint.method("POST"),
|
|
183
188
|
endpoint: import_endpoint.Endpoint.endpoint("/volt/api/stripe/v1/checkout/session_id"),
|
|
184
189
|
authenticated: false,
|
|
190
|
+
cache: false,
|
|
185
191
|
callback: async (stream) => {
|
|
186
192
|
return stream.send({
|
|
187
193
|
status: 200,
|
|
@@ -216,6 +222,7 @@ class Stripe {
|
|
|
216
222
|
tax_id_collection_enabled: "boolean"
|
|
217
223
|
},
|
|
218
224
|
authenticated: false,
|
|
225
|
+
cache: false,
|
|
219
226
|
callback: async (stream, params) => {
|
|
220
227
|
const res = await (0, import_checkout.start_checkout_session)(this.client, this.server, {
|
|
221
228
|
uid: stream.uid,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var stdin_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
@@ -496,7 +496,8 @@ class Server {
|
|
|
496
496
|
data: favicon.load_sync({ type: "buffer" }),
|
|
497
497
|
content_type: this.get_content_type(favicon.extension()),
|
|
498
498
|
_is_static: true,
|
|
499
|
-
server: this
|
|
499
|
+
server: this,
|
|
500
|
+
cache: true
|
|
500
501
|
});
|
|
501
502
|
}
|
|
502
503
|
const status_dir = this.source.join(".status");
|
|
@@ -518,6 +519,7 @@ class Server {
|
|
|
518
519
|
params: {
|
|
519
520
|
key: "string"
|
|
520
521
|
},
|
|
522
|
+
cache: false,
|
|
521
523
|
callback: async (stream, params) => {
|
|
522
524
|
if (params.key !== status_key) {
|
|
523
525
|
return stream.send({
|
|
@@ -583,7 +585,8 @@ class Server {
|
|
|
583
585
|
endpoint: "/sitemap.xml",
|
|
584
586
|
data: sitemap,
|
|
585
587
|
content_type: "application/xml",
|
|
586
|
-
_compress: false
|
|
588
|
+
_compress: false,
|
|
589
|
+
cache: true
|
|
587
590
|
});
|
|
588
591
|
}
|
|
589
592
|
// Create the robots.txt endpoint.
|
|
@@ -609,7 +612,8 @@ Sitemap: ${this.full_domain}/sitemap.xml`;
|
|
|
609
612
|
endpoint: "/robots.txt",
|
|
610
613
|
content_type: "text/plain",
|
|
611
614
|
data: robots,
|
|
612
|
-
_compress: false
|
|
615
|
+
_compress: false,
|
|
616
|
+
cache: true
|
|
613
617
|
});
|
|
614
618
|
}
|
|
615
619
|
// Create admin endpoint.
|
|
@@ -634,6 +634,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
634
634
|
params: {
|
|
635
635
|
email: "string"
|
|
636
636
|
},
|
|
637
|
+
cache: false,
|
|
637
638
|
callback: async (stream, params) => {
|
|
638
639
|
let uid;
|
|
639
640
|
if ((uid = await this.get_uid_by_email(params.email)) == null) {
|
|
@@ -656,6 +657,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
656
657
|
interval: 60,
|
|
657
658
|
group: "volt.auth"
|
|
658
659
|
},
|
|
660
|
+
cache: false,
|
|
659
661
|
callback: async (stream) => {
|
|
660
662
|
const uniform_delay = async () => {
|
|
661
663
|
if (this.avg_send_2fa_time.length >= 10) {
|
|
@@ -789,6 +791,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
789
791
|
content_type: "application/json",
|
|
790
792
|
authenticated: true,
|
|
791
793
|
rate_limit: "global",
|
|
794
|
+
cache: false,
|
|
792
795
|
callback: async (stream) => {
|
|
793
796
|
await this._deactivate_token(stream.uid);
|
|
794
797
|
this._reset_cookies(stream);
|
|
@@ -815,6 +818,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
815
818
|
phone_number: { type: "string", required: false },
|
|
816
819
|
code: { type: "string", required: false }
|
|
817
820
|
},
|
|
821
|
+
cache: false,
|
|
818
822
|
callback: async (stream, params) => {
|
|
819
823
|
console.log("signup 1", params);
|
|
820
824
|
const { error, invalid_fields } = this._verify_new_pass(params.password, params.verify_password);
|
|
@@ -909,6 +913,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
909
913
|
params: {
|
|
910
914
|
code: "string"
|
|
911
915
|
},
|
|
916
|
+
cache: false,
|
|
912
917
|
callback: async (stream, params) => {
|
|
913
918
|
let uid = stream.uid;
|
|
914
919
|
if (uid == null) {
|
|
@@ -946,6 +951,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
946
951
|
password: { type: "string", allow_empty: false },
|
|
947
952
|
verify_password: { type: "string", allow_empty: false }
|
|
948
953
|
},
|
|
954
|
+
cache: false,
|
|
949
955
|
callback: async (stream, params) => {
|
|
950
956
|
const { error, invalid_fields } = this._verify_new_pass(params.password, params.verify_password);
|
|
951
957
|
if (error) {
|
|
@@ -982,6 +988,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
982
988
|
params: {
|
|
983
989
|
// detailed: { type: "boolean", default: false },
|
|
984
990
|
},
|
|
991
|
+
cache: false,
|
|
985
992
|
callback: async (stream) => {
|
|
986
993
|
const user = await this.get(stream.uid);
|
|
987
994
|
if (user.password) {
|
|
@@ -1018,6 +1025,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1018
1025
|
content_type: "application/json",
|
|
1019
1026
|
authenticated: true,
|
|
1020
1027
|
rate_limit: "global",
|
|
1028
|
+
cache: false,
|
|
1021
1029
|
params: {
|
|
1022
1030
|
first_name: { type: "string", required: false, allow_empty: false },
|
|
1023
1031
|
last_name: { type: "string", required: false, allow_empty: false },
|
|
@@ -1063,6 +1071,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1063
1071
|
content_type: "application/json",
|
|
1064
1072
|
authenticated: true,
|
|
1065
1073
|
rate_limit: "global",
|
|
1074
|
+
cache: false,
|
|
1066
1075
|
params: {
|
|
1067
1076
|
current_password: { type: "string", allow_empty: false },
|
|
1068
1077
|
password: { type: "string", allow_empty: false },
|
|
@@ -1099,6 +1108,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1099
1108
|
content_type: "application/json",
|
|
1100
1109
|
authenticated: true,
|
|
1101
1110
|
rate_limit: "global",
|
|
1111
|
+
cache: false,
|
|
1102
1112
|
callback: async (stream) => {
|
|
1103
1113
|
await this.delete(stream.uid);
|
|
1104
1114
|
this._reset_cookies(stream);
|
|
@@ -1114,6 +1124,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1114
1124
|
content_type: "application/json",
|
|
1115
1125
|
authenticated: true,
|
|
1116
1126
|
rate_limit: "global",
|
|
1127
|
+
cache: false,
|
|
1117
1128
|
callback: async (stream) => {
|
|
1118
1129
|
return stream.success({
|
|
1119
1130
|
data: {
|
|
@@ -1129,6 +1140,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1129
1140
|
content_type: "application/json",
|
|
1130
1141
|
authenticated: true,
|
|
1131
1142
|
rate_limit: "global",
|
|
1143
|
+
cache: false,
|
|
1132
1144
|
callback: async (stream) => {
|
|
1133
1145
|
return stream.success({
|
|
1134
1146
|
data: {
|
|
@@ -1144,6 +1156,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1144
1156
|
content_type: "application/json",
|
|
1145
1157
|
authenticated: true,
|
|
1146
1158
|
rate_limit: "global",
|
|
1159
|
+
cache: false,
|
|
1147
1160
|
callback: async (stream) => {
|
|
1148
1161
|
await this.revoke_api_key(stream.uid);
|
|
1149
1162
|
return stream.send({
|
|
@@ -1203,6 +1216,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1203
1216
|
content_type: "application/json",
|
|
1204
1217
|
authenticated: true,
|
|
1205
1218
|
rate_limit: "global",
|
|
1219
|
+
cache: false,
|
|
1206
1220
|
params: {
|
|
1207
1221
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1208
1222
|
default: { type: Users.Endpoints.JsonValueSchemaType, required: false }
|
|
@@ -1241,6 +1255,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1241
1255
|
content_type: "application/json",
|
|
1242
1256
|
authenticated: true,
|
|
1243
1257
|
rate_limit: "global",
|
|
1258
|
+
cache: false,
|
|
1244
1259
|
params: {
|
|
1245
1260
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1246
1261
|
data: { type: Users.Endpoints.JsonValueSchemaType }
|
|
@@ -1262,6 +1277,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1262
1277
|
content_type: "application/json",
|
|
1263
1278
|
authenticated: true,
|
|
1264
1279
|
rate_limit: "global",
|
|
1280
|
+
cache: false,
|
|
1265
1281
|
params: {
|
|
1266
1282
|
query: { type: ["string", "object"], allow_empty: false }
|
|
1267
1283
|
},
|
|
@@ -1282,6 +1298,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1282
1298
|
content_type: "application/json",
|
|
1283
1299
|
authenticated: true,
|
|
1284
1300
|
rate_limit: "global",
|
|
1301
|
+
cache: false,
|
|
1285
1302
|
params: {
|
|
1286
1303
|
query: { type: ["string", "object"], allow_empty: false },
|
|
1287
1304
|
default: { type: Users.Endpoints.JsonValueSchemaType, required: false }
|
|
@@ -1319,6 +1336,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1319
1336
|
endpoint: "/volt/api/v1/support/pin",
|
|
1320
1337
|
content_type: "application/json",
|
|
1321
1338
|
authenticated: true,
|
|
1339
|
+
cache: false,
|
|
1322
1340
|
rate_limit: "global",
|
|
1323
1341
|
callback: async (stream) => {
|
|
1324
1342
|
const pin = await this.get_support_pin(stream.uid);
|
|
@@ -1334,6 +1352,7 @@ ${this.server.company.street} ${this.server.company.house_number}, ${this.server
|
|
|
1334
1352
|
method: "POST",
|
|
1335
1353
|
endpoint: "/volt/api/v1/support/submit",
|
|
1336
1354
|
content_type: "application/json",
|
|
1355
|
+
cache: false,
|
|
1337
1356
|
rate_limit: [
|
|
1338
1357
|
"global",
|
|
1339
1358
|
{
|
|
@@ -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,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|