@peektravel/app-utilities 0.4.1 → 0.5.1
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/README.md +36 -2
- package/dist/index.cjs +519 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +352 -3
- package/dist/index.d.ts +352 -3
- package/dist/index.js +518 -104
- package/dist/index.js.map +1 -1
- package/docs/webhooks.md +9 -1
- package/llms.txt +45 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,6 +70,34 @@ add-on pages for you.
|
|
|
70
70
|
| `logger` | no-op | Inject a `Logger` for diagnostics |
|
|
71
71
|
| `fetch` | global `fetch` | Custom fetch (e.g. for tests) |
|
|
72
72
|
| `itemOptionsPageSize` | `50` | Add-on pagination page size |
|
|
73
|
+
| `accessOptions` | `{ fullCustomerAccess: false }` | PII exposure — see [Access options / PII](#access-options--pii) |
|
|
74
|
+
|
|
75
|
+
### Access options / PII
|
|
76
|
+
|
|
77
|
+
Every access service accepts `accessOptions?: AccessOptions` — today a single
|
|
78
|
+
flag, `fullCustomerAccess` (default `false`). It's an object so future cross-cutting
|
|
79
|
+
flags can be added without breaking signatures.
|
|
80
|
+
|
|
81
|
+
With `fullCustomerAccess` **off** (the default):
|
|
82
|
+
|
|
83
|
+
- **Customer PII is never requested** (the GraphQL queries omit the fields, so
|
|
84
|
+
they come back `null`/empty): booking guest identity (name/email/phone/DOB/
|
|
85
|
+
postal code/GDPR + custom field responses — guests keep only ids and
|
|
86
|
+
participation/opt-in flags), booking custom question answers, the customer
|
|
87
|
+
`portalUrl`, and review reviewer `customerName`/`customerEmail`. Waiver
|
|
88
|
+
webhooks (a fixed payload with no query to trim) instead have `guestName` and
|
|
89
|
+
`fileUrl` redacted at parse time.
|
|
90
|
+
- **Payment / booking-modification operations are disabled** —
|
|
91
|
+
`getPaymentsOnFile`, `makePayment`, `refund`, `createInvoiceLink`, `addAddon`,
|
|
92
|
+
and `removeAddon` throw `PiiAccessDisabledError`. `create` (including
|
|
93
|
+
`markAsPaid`) and non-payment reads/mutations remain available.
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
const peek = new PeekAccessService({
|
|
97
|
+
installId, jwtSecret, issuer, appId, gatewayKey,
|
|
98
|
+
accessOptions: { fullCustomerAccess: true }, // opt into PII + payment operations
|
|
99
|
+
});
|
|
100
|
+
```
|
|
73
101
|
|
|
74
102
|
### Errors
|
|
75
103
|
|
|
@@ -83,6 +111,9 @@ Two kinds of failures surface as exceptions:
|
|
|
83
111
|
exhausted. Carries `.statusCode === 429`.
|
|
84
112
|
- `PeekGraphQLError` — the response contained a GraphQL `errors` array, preserved
|
|
85
113
|
on `.graphqlErrors`.
|
|
114
|
+
- `PiiAccessDisabledError` — a payment / booking-modification operation was
|
|
115
|
+
called on an access service created without `fullCustomerAccess` (see [Access options
|
|
116
|
+
/ PII](#access-options--pii)). Carries `.operation` (the blocked method name).
|
|
86
117
|
|
|
87
118
|
**Plain `Error` validation/precondition failures** thrown by the service layer
|
|
88
119
|
*before* any network call — e.g. an empty config field, a `bookingId` that
|
|
@@ -216,13 +247,16 @@ app.post("/booking-webhook", (req, res) => {
|
|
|
216
247
|
});
|
|
217
248
|
|
|
218
249
|
app.post("/waiver-webhook", (req, res) => {
|
|
219
|
-
|
|
250
|
+
// guestName/fileUrl are redacted unless you opt into PII:
|
|
251
|
+
const waiver: Waiver = parseWaiverWebhook(req.body, { fullCustomerAccess: true });
|
|
220
252
|
res.sendStatus(200);
|
|
221
253
|
});
|
|
222
254
|
```
|
|
223
255
|
|
|
224
256
|
Both tolerate the delivery envelope / a bare node / a JSON string and never throw
|
|
225
|
-
on malformed input.
|
|
257
|
+
on malformed input. `parseWaiverWebhook` also takes an optional `AccessOptions`
|
|
258
|
+
(`{ fullCustomerAccess }`) and redacts the participant `guestName` + document `fileUrl`
|
|
259
|
+
by default — see [Access options / PII](#access-options--pii) below. They differ on registration: a **booking** webhook's payload
|
|
226
260
|
shape is set by a GraphQL query configured **once in an external system** (the
|
|
227
261
|
App Store `broadcast_to_url` config) — this package documents and drift-guards
|
|
228
262
|
the exact query to paste there — whereas a **waiver** webhook has a fixed payload,
|