@hello-bill/node 2.1.0-beta.2 → 2.1.0-beta.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.0-beta.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix the embed's data-route parity between the SDK and the node middleware. The
8
+ SDK middleware client now calls short, baseEndpoint-relative paths
9
+ (`/service-slots`, `/savings-summary`, `/loa-document`) consistent with the
10
+ other routes, and the node SDK mounts those three routes on all four framework
11
+ adapters (express, hono, koa, next), with a new `loaDocument` proxy handler.
12
+ Previously the SDK called full upstream paths the node middleware never served,
13
+ so service-slots, savings-summary, and loa-document bridge calls 404'd.
14
+
3
15
  ## 2.1.0-beta.2
4
16
 
5
17
  ## 2.1.0-beta.1
@@ -1,4 +1,4 @@
1
- import { C as CreateHellobillHandlerOptions } from '../index-lPvEf5hZ.cjs';
1
+ import { C as CreateHellobillHandlerOptions } from '../index-9PkSdjVq.cjs';
2
2
  import '../webhooks-Cv4e8oXp.cjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { C as CreateHellobillHandlerOptions } from '../index-D81ftBQo.js';
1
+ import { C as CreateHellobillHandlerOptions } from '../index-BAETgMms.js';
2
2
  import '../webhooks-Cv4e8oXp.js';
3
3
 
4
4
  /**
@@ -932,6 +932,21 @@ function createHellobillHandler(opts) {
932
932
  if (!result2) return;
933
933
  passthroughUpstream(res, result2.status, result2.body, result2.requestId, result2.headers);
934
934
  };
935
+ const loaDocument = async (req, res) => {
936
+ const rawLoa = req.query.loa_id ?? req.params?.id;
937
+ const loaId = Array.isArray(rawLoa) ? rawLoa[0] : rawLoa;
938
+ if (!loaId) {
939
+ sendError(res, 400, "validation.missing_required_field", "loa_id query parameter required");
940
+ return;
941
+ }
942
+ const result2 = await safeCallUpstream(res, {
943
+ method: "GET",
944
+ path: `/partner/loa/${encodeURIComponent(loaId)}/document`,
945
+ logger
946
+ });
947
+ if (!result2) return;
948
+ passthroughUpstream(res, result2.status, result2.body, result2.requestId, result2.headers);
949
+ };
935
950
  const webhookHandler = opts.webhook ? createWebhookHandler({ ...opts.webhook, logger: opts.webhook.logger ?? opts.logger }) : void 0;
936
951
  const result = {
937
952
  session,
@@ -943,7 +958,8 @@ function createHellobillHandler(opts) {
943
958
  property,
944
959
  sessions: { list: sessionsList, get: sessionsGet },
945
960
  savingsSummary,
946
- serviceSlots
961
+ serviceSlots,
962
+ loaDocument
947
963
  };
948
964
  if (webhookHandler !== void 0) {
949
965
  result.webhook = webhookHandler;
@@ -1032,6 +1048,9 @@ function createHellobillRouter(opts) {
1032
1048
  router.get("/property", asyncWrap(handlers.property));
1033
1049
  router.get("/sessions", asyncWrap(handlers.sessions.list));
1034
1050
  router.get("/sessions/:id", asyncWrap(handlers.sessions.get));
1051
+ router.get("/service-slots", asyncWrap(handlers.serviceSlots));
1052
+ router.get("/savings-summary", asyncWrap(handlers.savingsSummary));
1053
+ router.get("/loa-document", asyncWrap(handlers.loaDocument));
1035
1054
  router.use(
1036
1055
  (err, _req, res, _next) => {
1037
1056
  opts.logger?.error?.("hellobill.router_error", { message: err?.message });