@vandenberghinc/volt 1.2.12 → 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.
Files changed (26) hide show
  1. package/backend/dist/cjs/backend/src/endpoint.d.ts +1 -1
  2. package/backend/dist/cjs/backend/src/endpoint.js +1 -1
  3. package/backend/dist/cjs/backend/src/payments/stripe/products.js +6 -6
  4. package/backend/dist/cjs/backend/src/payments/stripe/stripe.js +7 -0
  5. package/backend/dist/cjs/backend/src/payments/stripe/webhooks.js +4 -0
  6. package/backend/dist/cjs/backend/src/plugins/caddy/caddy.d.ts +1 -0
  7. package/backend/dist/cjs/backend/src/plugins/caddy/caddy.js +15 -0
  8. package/backend/dist/cjs/backend/src/server.js +7 -3
  9. package/backend/dist/cjs/backend/src/users.js +19 -0
  10. package/backend/dist/esm/backend/src/endpoint.d.ts +1 -1
  11. package/backend/dist/esm/backend/src/endpoint.js +1 -1
  12. package/backend/dist/esm/backend/src/payments/stripe/products.js +6 -6
  13. package/backend/dist/esm/backend/src/payments/stripe/stripe.js +7 -0
  14. package/backend/dist/esm/backend/src/payments/stripe/webhooks.js +4 -0
  15. package/backend/dist/esm/backend/src/plugins/caddy/caddy.d.ts +1 -0
  16. package/backend/dist/esm/backend/src/plugins/caddy/caddy.js +592 -0
  17. package/backend/dist/esm/backend/src/server.js +4 -0
  18. package/backend/dist/esm/backend/src/users.js +19 -0
  19. package/frontend/dist/backend/src/endpoint.d.ts +1 -1
  20. package/frontend/dist/backend/src/endpoint.js +1 -1
  21. package/frontend/dist/backend/src/payments/stripe/products.js +6 -6
  22. package/frontend/dist/backend/src/payments/stripe/stripe.js +7 -0
  23. package/frontend/dist/backend/src/payments/stripe/webhooks.js +4 -0
  24. package/frontend/dist/backend/src/server.js +4 -0
  25. package/frontend/dist/backend/src/users.js +19 -0
  26. package/package.json +2 -2
@@ -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?: boolean | number;
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.
@@ -200,7 +200,7 @@ class Endpoint {
200
200
  rate_limit = void 0,
201
201
  params = void 0,
202
202
  compress = true,
203
- cache = true,
203
+ cache,
204
204
  ip_whitelist = void 0,
205
205
  sitemap = void 0,
206
206
  robots = void 0,
@@ -232,7 +232,7 @@ function find_matching_active_price(active_prices, app_price_id, expected_signat
232
232
  return match ?? null;
233
233
  }
234
234
  async function create_stripe_product(client, server, product) {
235
- server.log(0, `Creating Stripe product for product '${product.id}'`);
235
+ server.log(1, `Creating Stripe product for product '${product.id}'`);
236
236
  return await (0, import_utils.stripe_api_call)(() => client.products.create({
237
237
  name: product.name,
238
238
  description: product.description,
@@ -252,7 +252,7 @@ async function update_stripe_product_if_needed(client, server, stripe_product, p
252
252
  if (!needs_update) {
253
253
  return stripe_product;
254
254
  }
255
- server.log(0, `Updating Stripe product '${stripe_product.id}' to match app product '${product.id}'`);
255
+ server.log(1, `Updating Stripe product '${stripe_product.id}' to match app product '${product.id}'`);
256
256
  return await (0, import_utils.stripe_api_call)(() => client.products.update(stripe_product.id, {
257
257
  name: product.name,
258
258
  description: product.description,
@@ -277,13 +277,13 @@ async function update_stripe_product_default_price_if_needed(client, server, str
277
277
  if (default_price_id === default_price.id || other_plans_from_parent_subscription?.some((plan) => plan.stripe_price_id === default_price_id)) {
278
278
  return;
279
279
  }
280
- server.log(0, `Updating default price for Stripe product '${stripe_product.id}' to price '${default_price.id}'`);
280
+ server.log(1, `Updating default price for Stripe product '${stripe_product.id}' to price '${default_price.id}'`);
281
281
  await (0, import_utils.stripe_api_call)(() => client.products.update(stripe_product.id, {
282
282
  default_price: default_price.id
283
283
  }, { idempotencyKey: (0, import_utils.generate_random_idempotency_key)(`update_product_default_price_${stripe_product.id}_${default_price.id}`) }), { operation: "products.update", app_product_id: stripe_product.metadata?.[app_product_id_metadata_key], stripe_product_id: stripe_product.id, action: "update_default_price" });
284
284
  }
285
285
  async function create_one_time_price(client, server, opts) {
286
- server.log(0, `Creating stripe one-time price for product: ${opts.product_id}`);
286
+ server.log(1, `Creating stripe one-time price for product: ${opts.product_id}`);
287
287
  return await (0, import_utils.stripe_api_call)(() => client.prices.create({
288
288
  product: opts.stripe_product_id,
289
289
  currency: opts.currency,
@@ -321,7 +321,7 @@ async function create_recurring_price(client, server, opts) {
321
321
  usage_type: opts.recurring_usage.usage_type,
322
322
  meter_id: opts.recurring_usage.usage_type === "metered" ? opts.recurring_usage.meter_id : void 0
323
323
  });
324
- server.log(0, `Creating stripe recurring price for product: ${opts.product_id}`);
324
+ server.log(1, `Creating stripe recurring price for product: ${opts.product_id}`);
325
325
  return await (0, import_utils.stripe_api_call)(() => client.prices.create({
326
326
  product: opts.stripe_product_id,
327
327
  currency: opts.currency,
@@ -340,7 +340,7 @@ async function create_stripe_meter(client, server, product) {
340
340
  const aggregation_formula = product.aggregation_formula ?? "sum";
341
341
  const customer_mapping_event_payload_key = product.customer_mapping_event_payload_key ?? "stripe_customer_id";
342
342
  const value_settings_event_payload_key = product.value_settings_event_payload_key ?? "value";
343
- server.log(0, `Creating stripe billing meter for product: ${product.id}`);
343
+ server.log(1, `Creating stripe billing meter for product: ${product.id}`);
344
344
  return await (0, import_utils.stripe_api_call)(() => client.billing.meters.create({
345
345
  display_name: product.name,
346
346
  event_name: product.meter_event_name,
@@ -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,
@@ -215,6 +215,7 @@ async function register_or_update_stripe_webhook_endpoint(client, server, opts)
215
215
  const needs_event_update = !same_event_set(endpoint.enabled_events ?? [], enabled_events);
216
216
  const needs_enable = ensure_enabled && endpoint.status !== "enabled";
217
217
  if (needs_event_update || needs_enable) {
218
+ server.log(1, `Updating webhook ${opts.webhook_app_id} for URL ${opts.webhook_url}.`);
218
219
  const update_params = {
219
220
  enabled_events,
220
221
  ...needs_enable ? { disabled: false } : {},
@@ -257,6 +258,7 @@ async function register_or_update_stripe_webhook_endpoint(client, server, opts)
257
258
  const needs_enable = ensure_enabled && existing.status !== "enabled";
258
259
  const needs_url_update = existing.url !== opts.webhook_url;
259
260
  if (needs_event_update || needs_enable || needs_url_update) {
261
+ server.log(1, `Updating webhook ${opts.webhook_app_id} for URL ${opts.webhook_url}.`);
260
262
  const update_params = {
261
263
  enabled_events,
262
264
  ...needs_enable ? { disabled: false } : {},
@@ -277,6 +279,7 @@ async function register_or_update_stripe_webhook_endpoint(client, server, opts)
277
279
  }
278
280
  throw new import_error.InternalStripeError("webhook_endpoint_secret_missing", "Stripe webhook endpoint exists but signing secret is not available. Store the whsec_ value at creation time.", { webhook_url: opts.webhook_url, stripe_webhook_endpoint_id: existing.id });
279
281
  }
282
+ server.log(1, `Creating webhook ${opts.webhook_app_id} for URL ${opts.webhook_url}.`);
280
283
  const create_params = {
281
284
  // Docs: https://docs.stripe.com/api/webhook_endpoints/create
282
285
  url: opts.webhook_url,
@@ -295,6 +298,7 @@ async function register_or_update_stripe_webhook_endpoint(client, server, opts)
295
298
  throw new import_error.InternalStripeError("webhook_endpoint_secret_missing", "Stripe did not return a webhook signing secret on endpoint creation.", { webhook_url: opts.webhook_url, stripe_webhook_endpoint_id: created.id });
296
299
  }
297
300
  if (ensure_enabled && created.status !== "enabled") {
301
+ server.log(1, `Enabling webhook ${opts.webhook_app_id} for URL ${opts.webhook_url}.`);
298
302
  await (0, import_utils.stripe_api_call)(() => client.webhookEndpoints.update(created.id, { disabled: false }, {
299
303
  idempotencyKey: (0, import_utils.stable_idempotency_key)(`webhook_endpoints.enable:${created.id}:${opts.webhook_url}`, 255)
300
304
  }), {
@@ -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?: boolean | number;
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 = true, ip_whitelist = undefined, sitemap = undefined, robots = undefined, allow_unknown_params = false, _is_static = false,
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
  }) {
@@ -400,7 +400,7 @@ function find_matching_active_price(active_prices, app_price_id, expected_signat
400
400
  * Tax code docs: https://docs.stripe.com/tax/tax-codes
401
401
  */
402
402
  async function create_stripe_product(client, server, product) {
403
- server.log(0, `Creating Stripe product for product '${product.id}'`);
403
+ server.log(1, `Creating Stripe product for product '${product.id}'`);
404
404
  return await stripe_api_call(() => client.products.create({
405
405
  name: product.name,
406
406
  description: product.description,
@@ -429,7 +429,7 @@ async function update_stripe_product_if_needed(client, server, stripe_product, p
429
429
  if (!needs_update) {
430
430
  return stripe_product;
431
431
  }
432
- server.log(0, `Updating Stripe product '${stripe_product.id}' to match app product '${product.id}'`);
432
+ server.log(1, `Updating Stripe product '${stripe_product.id}' to match app product '${product.id}'`);
433
433
  return await stripe_api_call(() => client.products.update(stripe_product.id, {
434
434
  name: product.name,
435
435
  description: product.description,
@@ -463,7 +463,7 @@ async function update_stripe_product_default_price_if_needed(client, server, str
463
463
  || other_plans_from_parent_subscription?.some((plan) => plan.stripe_price_id === default_price_id)) {
464
464
  return;
465
465
  }
466
- server.log(0, `Updating default price for Stripe product '${stripe_product.id}' to price '${default_price.id}'`);
466
+ server.log(1, `Updating default price for Stripe product '${stripe_product.id}' to price '${default_price.id}'`);
467
467
  await stripe_api_call(() => client.products.update(stripe_product.id, {
468
468
  default_price: default_price.id,
469
469
  }, { idempotencyKey: generate_random_idempotency_key(`update_product_default_price_${stripe_product.id}_${default_price.id}`) }), { operation: "products.update", app_product_id: stripe_product.metadata?.[app_product_id_metadata_key], stripe_product_id: stripe_product.id, action: "update_default_price" });
@@ -474,7 +474,7 @@ async function update_stripe_product_default_price_if_needed(client, server, str
474
474
  * Docs: https://docs.stripe.com/api/prices/create
475
475
  */
476
476
  async function create_one_time_price(client, server, opts) {
477
- server.log(0, `Creating stripe one-time price for product: ${opts.product_id}`);
477
+ server.log(1, `Creating stripe one-time price for product: ${opts.product_id}`);
478
478
  return await stripe_api_call(() => client.prices.create({
479
479
  product: opts.stripe_product_id,
480
480
  currency: opts.currency,
@@ -520,7 +520,7 @@ async function create_recurring_price(client, server, opts) {
520
520
  usage_type: opts.recurring_usage.usage_type,
521
521
  meter_id: opts.recurring_usage.usage_type === "metered" ? opts.recurring_usage.meter_id : undefined,
522
522
  });
523
- server.log(0, `Creating stripe recurring price for product: ${opts.product_id}`);
523
+ server.log(1, `Creating stripe recurring price for product: ${opts.product_id}`);
524
524
  return await stripe_api_call(() => client.prices.create({
525
525
  product: opts.stripe_product_id,
526
526
  currency: opts.currency,
@@ -546,7 +546,7 @@ async function create_stripe_meter(client, server, product) {
546
546
  const aggregation_formula = product.aggregation_formula ?? "sum";
547
547
  const customer_mapping_event_payload_key = product.customer_mapping_event_payload_key ?? "stripe_customer_id";
548
548
  const value_settings_event_payload_key = product.value_settings_event_payload_key ?? "value";
549
- server.log(0, `Creating stripe billing meter for product: ${product.id}`);
549
+ server.log(1, `Creating stripe billing meter for product: ${product.id}`);
550
550
  return await stripe_api_call(() => client.billing.meters.create({
551
551
  display_name: product.name,
552
552
  event_name: product.meter_event_name,
@@ -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,
@@ -290,6 +290,7 @@ export async function register_or_update_stripe_webhook_endpoint(client, server,
290
290
  // Stripe's WebhookEndpoint has `status` (enabled/disabled).
291
291
  const needs_enable = ensure_enabled && endpoint.status !== "enabled";
292
292
  if (needs_event_update || needs_enable) {
293
+ server.log(1, `Updating webhook ${opts.webhook_app_id} for URL ${opts.webhook_url}.`);
293
294
  const update_params = {
294
295
  enabled_events,
295
296
  ...(needs_enable ? { disabled: false } : {}),
@@ -335,6 +336,7 @@ export async function register_or_update_stripe_webhook_endpoint(client, server,
335
336
  const needs_enable = ensure_enabled && existing.status !== "enabled";
336
337
  const needs_url_update = existing.url !== opts.webhook_url;
337
338
  if (needs_event_update || needs_enable || needs_url_update) {
339
+ server.log(1, `Updating webhook ${opts.webhook_app_id} for URL ${opts.webhook_url}.`);
338
340
  const update_params = {
339
341
  enabled_events,
340
342
  ...(needs_enable ? { disabled: false } : {}),
@@ -357,6 +359,7 @@ export async function register_or_update_stripe_webhook_endpoint(client, server,
357
359
  // If you reached this branch without a DB record, you must provide the secret out-of-band.
358
360
  throw new InternalStripeError("webhook_endpoint_secret_missing", "Stripe webhook endpoint exists but signing secret is not available. Store the whsec_ value at creation time.", { webhook_url: opts.webhook_url, stripe_webhook_endpoint_id: existing.id });
359
361
  }
362
+ server.log(1, `Creating webhook ${opts.webhook_app_id} for URL ${opts.webhook_url}.`);
360
363
  // Third: create a new endpoint in Stripe.
361
364
  const create_params = {
362
365
  // Docs: https://docs.stripe.com/api/webhook_endpoints/create
@@ -378,6 +381,7 @@ export async function register_or_update_stripe_webhook_endpoint(client, server,
378
381
  }
379
382
  // Optionally enforce enabled state (Stripe defaults to enabled, but we harden this anyway).
380
383
  if (ensure_enabled && created.status !== "enabled") {
384
+ server.log(1, `Enabling webhook ${opts.webhook_app_id} for URL ${opts.webhook_url}.`);
381
385
  await stripe_api_call(() => client.webhookEndpoints.update(created.id, { disabled: false }, {
382
386
  idempotencyKey: stable_idempotency_key(`webhook_endpoints.enable:${created.id}:${opts.webhook_url}`, 255),
383
387
  }), {