@odla-ai/chapter 0.43.0 → 0.43.2

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.
@@ -4435,6 +4435,13 @@ async function startGiftIntent(db, input) {
4435
4435
  };
4436
4436
  }
4437
4437
 
4438
+ // src/stripe-webhook-secret.ts
4439
+ async function resolveStripeWebhookSecret(db, runtime) {
4440
+ const scoped = await getVaultSecret(db, stripeWebhookSecretName(runtime));
4441
+ if (scoped || !runtime) return scoped;
4442
+ return getVaultSecret(db, "stripe_webhook_secret");
4443
+ }
4444
+
4438
4445
  // src/payments-route-support.ts
4439
4446
  var paymentErrorCode = (error) => error && typeof error === "object" && typeof error.code === "string" ? error.code : "unknown";
4440
4447
  function paymentLineItems(group) {
@@ -4643,7 +4650,7 @@ async function startSubscription(req, env, ctx) {
4643
4650
  }
4644
4651
  async function ingestWebhook(req, env, ctx) {
4645
4652
  const db = ctx.makeDb(env);
4646
- const webhookSecret = await getVaultSecret(db, stripeWebhookSecretName(env.ODLA_RUNTIME));
4653
+ const webhookSecret = await resolveStripeWebhookSecret(db, env.ODLA_RUNTIME);
4647
4654
  if (!webhookSecret) return json({ error: "webhook not configured" }, 503);
4648
4655
  const rawBody = await req.text();
4649
4656
  const ingest = await createStripeProvider({ webhookSecret }).ingestWebhook(rawBody, req.headers.get("stripe-signature") ?? "");
@@ -7101,9 +7108,10 @@ async function verifySource(req, db, ctx) {
7101
7108
  return null;
7102
7109
  }
7103
7110
  var handleBuilderLibraryControl = async (req, url, env, ctx) => {
7104
- if (req.method !== "POST" || url.pathname !== BUILDER_LIBRARY_CONTROL_PATH) return null;
7111
+ if (url.pathname !== BUILDER_LIBRARY_CONTROL_PATH) return null;
7105
7112
  const settings = ctx.chapter.builderLibrary;
7106
7113
  if (!settings) return json({ error: "not found" }, 404);
7114
+ if (req.method !== "POST") return json({ error: "unauthorized" }, 401);
7107
7115
  const db = ctx.makeDb(env);
7108
7116
  const verified = await verifySource(req, db, ctx);
7109
7117
  if (!verified) return json({ error: "unauthorized" }, 401);