@hello-bill/node 2.1.3-beta.0 → 2.1.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/dist/express/index.d.cts +1 -1
- package/dist/express/index.d.ts +1 -1
- package/dist/express/index.js +8 -35
- package/dist/express/index.js.map +1 -1
- package/dist/express/index.mjs +8 -35
- package/dist/express/index.mjs.map +1 -1
- package/dist/hono/index.d.cts +1 -1
- package/dist/hono/index.d.ts +1 -1
- package/dist/hono/index.js +8 -35
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/index.mjs +8 -35
- package/dist/hono/index.mjs.map +1 -1
- package/dist/{index-C_gIXrzG.d.cts → index-D5WlUYVZ.d.cts} +0 -7
- package/dist/{index-DnEk4Y5R.d.ts → index-jK9cEnEY.d.ts} +0 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -32
- package/dist/index.mjs.map +1 -1
- package/dist/koa/index.d.cts +1 -1
- package/dist/koa/index.d.ts +1 -1
- package/dist/koa/index.js +8 -35
- package/dist/koa/index.js.map +1 -1
- package/dist/koa/index.mjs +8 -35
- package/dist/koa/index.mjs.map +1 -1
- package/dist/next/index.d.cts +1 -1
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +8 -38
- package/dist/next/index.js.map +1 -1
- package/dist/next/index.mjs +8 -38
- package/dist/next/index.mjs.map +1 -1
- package/dist/webhook/index.d.cts +1 -1
- package/dist/webhook/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TokenStorage, L as Logger } from './index-
|
|
2
|
-
export { C as CreateHellobillHandlerOptions, H as HellobillHandlerSet, a as HellobillRequest, b as HellobillResponse, I as InMemoryTokenStorage, c as InMemoryWebhookDedupeStore, d as TokenManager, e as TokenManagerOptions, U as UnknownWebhookEventError, V as VerifyWebhookOptions, W as WebhookDedupeStore, f as WebhookHandlerContext, g as WebhookHandlerOptions, h as WebhookHandlers, i as WebhookVerificationError, j as createHellobillHandler, k as createWebhookHandler, v as verifyWebhook, l as verifyWebhookSignature } from './index-
|
|
1
|
+
import { T as TokenStorage, L as Logger } from './index-jK9cEnEY.js';
|
|
2
|
+
export { C as CreateHellobillHandlerOptions, H as HellobillHandlerSet, a as HellobillRequest, b as HellobillResponse, I as InMemoryTokenStorage, c as InMemoryWebhookDedupeStore, d as TokenManager, e as TokenManagerOptions, U as UnknownWebhookEventError, V as VerifyWebhookOptions, W as WebhookDedupeStore, f as WebhookHandlerContext, g as WebhookHandlerOptions, h as WebhookHandlers, i as WebhookVerificationError, j as createHellobillHandler, k as createWebhookHandler, v as verifyWebhook, l as verifyWebhookSignature } from './index-jK9cEnEY.js';
|
|
3
3
|
import { R as RequestId, S as SessionPayload, a as SessionResponse, b as SessionGetResponse, P as ProductsQuery, c as ProductsResponse, d as PropertyDetailResponse, L as LoaListResponse, C as CreateCustomerInput, e as CustomerCreateResponse, f as CustomerId, g as CustomerStatusResponse, B as BankDetailsRequest, h as BankDetailsResponse } from './webhooks-DePW-Bjp.js';
|
|
4
4
|
export { A as Address, i as AddressObject, j as AddressesObject, k as ApiVersion, l as AppDeeplinks, m as BankDetailsCollected, n as BankDetailsConsent, o as BankDetailsObject, p as BankDetailsStatus, q as BillType, r as BreakdownCoverProduct, s as BroadbandProduct, t as BuildingStyle, u as BuildingType, v as CacheStatus, w as ClientMode, x as Consent, y as ContextEntry, z as CouncilTaxProduct, D as CreditCheckAddress, E as CreditCheckObject, F as Customer, G as CustomerType, H as DataCompleteness, I as DiscoveryStatus, J as Email, K as EnergyProduct, M as Environment, N as EpcRating, O as FinalRead, Q as FuelType, T as HeatingType, U as HomeInsuranceProduct, V as IdempotencyKey, W as IsoDate, X as IsoDateTime, Y as LoASignature, Z as LoaId, _ as LoaRecord, $ as LocationRole, a0 as MaskedSortCode, a1 as Meters, a2 as MobileProduct, a3 as MoveIn, a4 as MoveObject, a5 as MoveOut, a6 as MoveOutNotificationFailed, a7 as MoveOutNotificationSent, a8 as MoveOutNotifyFlags, a9 as MoveOutReason, aa as MoveOutStatus, ab as NearbyPoi, ac as OccupantObject, ad as OccupantType, ae as OnboardingInfo, af as OverallStatus, ag as Paginated, ah as Person, ai as PhoneNumber, aj as Postcode, ak as Product, al as ProductBase, am as ProductCategory, an as ProductConfidence, ao as ProductId, ap as ProductSetup, aq as PropertyDetailObject, ar as PropertyLocation, as as PropertyObject, at as PropertyType, au as PropertyTypeCode, av as PropertyTypeSubcode, aw as ProvidedFieldPath, ax as SESSION_IDEMPOTENCY_TTL_MS, ay as SavingsSummaryResponse, az as SelectedProduct, aA as SessionAccountCreated, aB as SessionAppDeferred, aC as SessionAppInstalled, aD as SessionDetailsConfirmed, aE as SessionEmbedOpened, aF as SessionLoaSigned, aG as SessionProductsSelected, aH as SetupStatus, aI as SetupStatusChanged, aJ as SignatureImage, aK as StoredBankDetails, aL as SubscriptionChanged, aM as SubscriptionStatus, aN as Title, aO as TvLicenceProduct, aP as Url, aQ as WaterProduct, aR as WebhookEvent, aS as WebhookEventBase, aT as WebhookEventId, aU as WebhookEventType } from './webhooks-DePW-Bjp.js';
|
|
5
5
|
import { ErrorEnvelope } from './types/index.js';
|
package/dist/index.js
CHANGED
|
@@ -133,10 +133,9 @@ function buildQueryString(query) {
|
|
|
133
133
|
async function callUpstream(apiBaseUrl, tokenManager, opts, fetchImpl) {
|
|
134
134
|
const base = apiBaseUrl.replace(/\/$/, "");
|
|
135
135
|
const url = `${base}${opts.path}${buildQueryString(opts.query)}`;
|
|
136
|
-
const
|
|
137
|
-
const bearerToken = opts.sessionBearer ?? m2mToken;
|
|
136
|
+
const token = await tokenManager.getAccessToken();
|
|
138
137
|
const headers = {
|
|
139
|
-
Authorization: `Bearer ${
|
|
138
|
+
Authorization: `Bearer ${token}`,
|
|
140
139
|
Accept: "application/json"
|
|
141
140
|
};
|
|
142
141
|
if (opts.body !== void 0) headers["Content-Type"] = "application/json";
|
|
@@ -146,15 +145,14 @@ async function callUpstream(apiBaseUrl, tokenManager, opts, fetchImpl) {
|
|
|
146
145
|
headers
|
|
147
146
|
};
|
|
148
147
|
if (opts.body !== void 0) init.body = JSON.stringify(opts.body);
|
|
149
|
-
const onTokenExpired = opts.sessionBearer ? void 0 : async () => {
|
|
150
|
-
await tokenManager.invalidate();
|
|
151
|
-
const fresh = await tokenManager.getAccessToken();
|
|
152
|
-
headers.Authorization = `Bearer ${fresh}`;
|
|
153
|
-
};
|
|
154
148
|
const res = await retryFetch(url, init, {
|
|
155
149
|
fetch: fetchImpl,
|
|
156
150
|
timeoutMs: opts.timeoutMs,
|
|
157
|
-
onTokenExpired
|
|
151
|
+
onTokenExpired: async () => {
|
|
152
|
+
await tokenManager.invalidate();
|
|
153
|
+
const fresh = await tokenManager.getAccessToken();
|
|
154
|
+
headers.Authorization = `Bearer ${fresh}`;
|
|
155
|
+
}
|
|
158
156
|
});
|
|
159
157
|
let body = null;
|
|
160
158
|
const text = await res.text();
|
|
@@ -974,27 +972,6 @@ function createHellobillHandler(opts) {
|
|
|
974
972
|
if (!result2) return;
|
|
975
973
|
passthroughUpstream(res, result2.status, result2.body, result2.requestId, result2.headers);
|
|
976
974
|
};
|
|
977
|
-
const loaDocument = async (req, res) => {
|
|
978
|
-
const rawLoa = req.query.loa_id ?? req.params?.id;
|
|
979
|
-
const loaId = Array.isArray(rawLoa) ? rawLoa[0] : rawLoa;
|
|
980
|
-
if (!loaId) {
|
|
981
|
-
sendError(res, 400, "validation.missing_required_field", "loa_id query parameter required");
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
const sessionBearer = extractBearer(req);
|
|
985
|
-
if (!sessionBearer) {
|
|
986
|
-
sendError(res, 401, "auth.token_malformed", "Missing Authorization bearer token");
|
|
987
|
-
return;
|
|
988
|
-
}
|
|
989
|
-
const result2 = await safeCallUpstream(res, {
|
|
990
|
-
method: "GET",
|
|
991
|
-
path: `/partner/loa/${encodeURIComponent(loaId)}/document`,
|
|
992
|
-
sessionBearer,
|
|
993
|
-
logger
|
|
994
|
-
});
|
|
995
|
-
if (!result2) return;
|
|
996
|
-
passthroughUpstream(res, result2.status, result2.body, result2.requestId, result2.headers);
|
|
997
|
-
};
|
|
998
975
|
const webhookHandler = opts.webhook ? createWebhookHandler({ ...opts.webhook, logger: opts.webhook.logger ?? opts.logger }) : void 0;
|
|
999
976
|
const result = {
|
|
1000
977
|
session,
|
|
@@ -1006,8 +983,7 @@ function createHellobillHandler(opts) {
|
|
|
1006
983
|
property,
|
|
1007
984
|
sessions: { list: sessionsList, get: sessionsGet },
|
|
1008
985
|
savingsSummary,
|
|
1009
|
-
serviceSlots
|
|
1010
|
-
loaDocument
|
|
986
|
+
serviceSlots
|
|
1011
987
|
};
|
|
1012
988
|
if (webhookHandler !== void 0) {
|
|
1013
989
|
result.webhook = webhookHandler;
|