@peektravel/app-utilities 0.8.2 → 0.9.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 +6 -3
- package/dist/index.cjs +127 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +104 -101
- package/dist/index.d.ts +104 -101
- package/dist/index.js +127 -77
- package/dist/index.js.map +1 -1
- package/docs/webhooks.md +11 -8
- package/llms.txt +19 -11
- package/package.json +1 -2
- package/docs/ui.md +0 -1175
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A platform's tiny map of **API endpoint key → relative path** (the "slug"
|
|
3
|
+
* inserted between the install's base API URL and the endpoint's own path).
|
|
4
|
+
*
|
|
5
|
+
* The base API URL is the install's app endpoint with no routing segment — the
|
|
6
|
+
* install webhook's `apiUrl` (with any slug stripped back off), or
|
|
7
|
+
* `baseUrl/appId` when built from the deprecated defaults. Each service class
|
|
8
|
+
* resolves *its own* slug through this lookup, so two services on the same
|
|
9
|
+
* platform can route through different slugs. Adding a new API — even one on a
|
|
10
|
+
* different slug than its siblings — is a single entry here.
|
|
11
|
+
*
|
|
12
|
+
* An empty-string path means the endpoint sits directly on the base with no
|
|
13
|
+
* slug (e.g. the legacy Peek v1 GraphQL gateway, which has no extendable slug).
|
|
14
|
+
*/
|
|
15
|
+
declare class ApiEndpoints<Key extends string = string> {
|
|
16
|
+
private readonly paths;
|
|
17
|
+
constructor(paths: Readonly<Record<Key, string>>);
|
|
18
|
+
/** The relative path (slug) for `endpoint`, appended to the base API URL. */
|
|
19
|
+
pathFor(endpoint: Key): string;
|
|
20
|
+
}
|
|
21
|
+
|
|
1
22
|
/**
|
|
2
23
|
* Minimal structured logger interface the package can write diagnostics to.
|
|
3
24
|
*
|
|
@@ -20,19 +41,13 @@ interface GraphQLBody<T> {
|
|
|
20
41
|
}
|
|
21
42
|
interface GraphQLClientOptions {
|
|
22
43
|
/**
|
|
23
|
-
* The install's
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* construction. Takes precedence over `baseUrl`.
|
|
44
|
+
* The install's **base API URL** (no trailing slash, no routing slug). Every
|
|
45
|
+
* GraphQL call POSTs to `baseApiUrl/<slug>`, where the slug comes from
|
|
46
|
+
* {@link endpoints} for the request's endpoint name.
|
|
27
47
|
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
* when `apiUrl` is not set; the URL is `baseUrl/appId/[prefix/]endpointName`.
|
|
32
|
-
*/
|
|
33
|
-
baseUrl?: string;
|
|
34
|
-
/** Peek app ID, used in the endpoint path (legacy `baseUrl` mode only). */
|
|
35
|
-
appId?: string;
|
|
48
|
+
baseApiUrl: string;
|
|
49
|
+
/** Maps an endpoint name to the relative slug appended to {@link baseApiUrl}. */
|
|
50
|
+
endpoints: ApiEndpoints;
|
|
36
51
|
/** API gateway key sent as the `pk-api-key` header. Omitted from headers when absent (v2 mode). */
|
|
37
52
|
gatewayKey?: string;
|
|
38
53
|
/** Supplies a valid bearer token for each request. */
|
|
@@ -43,11 +58,6 @@ interface GraphQLClientOptions {
|
|
|
43
58
|
logger: Logger;
|
|
44
59
|
/** `fetch` implementation to use. */
|
|
45
60
|
fetchFn: typeof fetch;
|
|
46
|
-
/**
|
|
47
|
-
* Optional fixed path segment inserted between `appId` and the endpoint name.
|
|
48
|
-
* Used in v2 mode: `baseUrl/appId/endpointPathPrefix/endpointName`.
|
|
49
|
-
*/
|
|
50
|
-
endpointPathPrefix?: string;
|
|
51
61
|
}
|
|
52
62
|
declare class GraphQLClient {
|
|
53
63
|
private readonly options;
|
|
@@ -1671,13 +1681,17 @@ interface BaseAccessServiceConfig {
|
|
|
1671
1681
|
/** JWT issuer — the app name / app ID. */
|
|
1672
1682
|
issuer: string;
|
|
1673
1683
|
/**
|
|
1674
|
-
* The install's **
|
|
1675
|
-
*
|
|
1676
|
-
*
|
|
1677
|
-
*
|
|
1678
|
-
*
|
|
1679
|
-
* it
|
|
1680
|
-
*
|
|
1684
|
+
* The install's **base API URL** — persist the install webhook's `apiUrl` and
|
|
1685
|
+
* pass it here. It is the app endpoint with no per-platform routing slug; each
|
|
1686
|
+
* service class appends its own slug (e.g. `peek_backoffice_api-v1`, via that
|
|
1687
|
+
* platform's endpoint lookup) when it makes a call, so different services can
|
|
1688
|
+
* route through different slugs. If the URL you pass still carries this
|
|
1689
|
+
* platform's slug it is stripped back off to recover the base; a URL carrying a
|
|
1690
|
+
* *different* platform's slug makes the constructor throw. No app-id/gateway
|
|
1691
|
+
* segment is inserted, so `appId` is not required. This is the forward-looking
|
|
1692
|
+
* way to target an install — prefer it over `baseUrl`/`appId`, which are
|
|
1693
|
+
* deprecated (the hardcoded base-URL fallbacks will be removed and a URL will
|
|
1694
|
+
* become required in a future release).
|
|
1681
1695
|
*/
|
|
1682
1696
|
apiUrl?: string;
|
|
1683
1697
|
/**
|
|
@@ -2178,109 +2192,101 @@ declare class PeekAccessService {
|
|
|
2178
2192
|
* authenticated transport. The instance is created lazily and reused.
|
|
2179
2193
|
*/
|
|
2180
2194
|
getReviewService(): ReviewService;
|
|
2181
|
-
/** All products (activities + add-ons).
|
|
2195
|
+
/** All products (activities + add-ons). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllProducts}. */
|
|
2182
2196
|
getAllProducts(): Promise<Product[]>;
|
|
2183
|
-
/** All activity products (excludes add-ons).
|
|
2197
|
+
/** All activity products (excludes add-ons). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllActivities}. */
|
|
2184
2198
|
getAllActivities(): Promise<Product[]>;
|
|
2185
|
-
/** All rental products.
|
|
2199
|
+
/** All rental products. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllRentals}. */
|
|
2186
2200
|
getAllRentals(): Promise<Product[]>;
|
|
2187
|
-
/** All add-on products.
|
|
2201
|
+
/** All add-on products. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllAddons}. */
|
|
2188
2202
|
getAllAddons(): Promise<Product[]>;
|
|
2189
|
-
/** An activity's custom questions.
|
|
2203
|
+
/** An activity's custom questions. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getCustomQuestions}. */
|
|
2190
2204
|
getCustomQuestions(productId: string): Promise<CustomQuestion[]>;
|
|
2191
|
-
/** All active account users.
|
|
2205
|
+
/** All active account users. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AccountUserService.getAll}. */
|
|
2192
2206
|
getAllAccountUsers(): Promise<AccountUser[]>;
|
|
2193
|
-
/** Account user by id, or null.
|
|
2207
|
+
/** Account user by id, or null. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AccountUserService.getById}. */
|
|
2194
2208
|
getAccountUserById(userId: string): Promise<AccountUser | null>;
|
|
2195
|
-
/** All resource pools.
|
|
2209
|
+
/** All resource pools. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ResourcePoolService.getAll}. */
|
|
2196
2210
|
getAllResourcePools(mode?: ResourcePoolMode): Promise<ResourcePool[]>;
|
|
2197
|
-
/** Timeslots for an activity on a given date.
|
|
2211
|
+
/** Timeslots for an activity on a given date. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.getForDay}. */
|
|
2198
2212
|
getTimeslotsForDay(productId: string, date: string, filter?: TimeslotFilter): Promise<Timeslot[]>;
|
|
2199
|
-
/** Single timeslot by id.
|
|
2213
|
+
/** Single timeslot by id. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.getById}. */
|
|
2200
2214
|
getTimeslotById(timeslotId: string): Promise<Timeslot | null>;
|
|
2201
|
-
/** Set timeslot status.
|
|
2215
|
+
/** Set timeslot status. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.setAvailability}. */
|
|
2202
2216
|
setTimeslotAvailability(timeslotId: string, status: string): Promise<UpdateTimeslotResult>;
|
|
2203
|
-
/** Set timeslot manifest notes.
|
|
2217
|
+
/** Set timeslot manifest notes. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.setNotes}. */
|
|
2204
2218
|
setTimeslotNotes(timeslotId: string, manifestNotes: string): Promise<UpdateTimeslotResult>;
|
|
2205
|
-
/** Assign or unassign guides on timeslots.
|
|
2219
|
+
/** Assign or unassign guides on timeslots. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.assignGuide}. */
|
|
2206
2220
|
assignTimeslotGuide(assignment: GuideAssignment): Promise<AssignGuideResult>;
|
|
2207
|
-
/** All reseller channels.
|
|
2221
|
+
/** All reseller channels. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ResellerService.getAllChannels}. */
|
|
2208
2222
|
getAllChannels(agentsPerChannel?: number): Promise<Channel[]>;
|
|
2209
|
-
/** All promo codes.
|
|
2223
|
+
/** All promo codes. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PromoCodeService.getAll}. */
|
|
2210
2224
|
getAllPromoCodes(): Promise<PromoCode[]>;
|
|
2211
|
-
/** Create a promo code.
|
|
2225
|
+
/** Create a promo code. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PromoCodeService.create}. */
|
|
2212
2226
|
createPromoCode(input: CreatePromoCodeInput): Promise<CreatedPromoCode>;
|
|
2213
|
-
/** Create a pricing engine.
|
|
2227
|
+
/** Create a pricing engine. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.createEngine}. */
|
|
2214
2228
|
createPricingEngine(input: CreateEngineInput): Promise<CreatedPricingEngine>;
|
|
2215
|
-
/** Update a pricing engine.
|
|
2229
|
+
/** Update a pricing engine. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.updateEngine}. */
|
|
2216
2230
|
updatePricingEngine(input: UpdateEngineInput): Promise<PricingEngine>;
|
|
2217
|
-
/** Delete a pricing engine (idempotent).
|
|
2231
|
+
/** Delete a pricing engine (idempotent). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.deleteEngine}. */
|
|
2218
2232
|
deletePricingEngine(engineId: string): Promise<void>;
|
|
2219
|
-
/** Upsert pricing overrides.
|
|
2233
|
+
/** Upsert pricing overrides. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.upsertOverrides}. */
|
|
2220
2234
|
upsertPricingOverrides(input: UpsertOverridesInput): Promise<UpsertOverridesResult>;
|
|
2221
|
-
/** Clear pricing overrides for a set of activities.
|
|
2235
|
+
/** Clear pricing overrides for a set of activities. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.clearOverrides}. */
|
|
2222
2236
|
clearPricingOverrides(input: ClearOverridesInput): Promise<UpsertOverridesResult>;
|
|
2223
|
-
/** Today's daily note.
|
|
2237
|
+
/** Today's daily note. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link DailyNoteService.getToday}. */
|
|
2224
2238
|
getDailyNoteToday(): Promise<DailyNote | null>;
|
|
2225
|
-
/** Update today's daily note.
|
|
2239
|
+
/** Update today's daily note. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link DailyNoteService.update}. */
|
|
2226
2240
|
updateDailyNote(note: string): Promise<DailyNote | null>;
|
|
2227
|
-
/** Availability times for an activity.
|
|
2241
|
+
/** Availability times for an activity. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AvailabilityService.getAvailabilityTimes}. */
|
|
2228
2242
|
getAvailabilityTimes(query: AvailabilityTimesQuery): Promise<AvailabilityTime[]>;
|
|
2229
|
-
/** All memberships.
|
|
2243
|
+
/** All memberships. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link MembershipService.getAll}. */
|
|
2230
2244
|
getAllMemberships(): Promise<Membership[]>;
|
|
2231
|
-
/** Purchase a membership.
|
|
2245
|
+
/** Purchase a membership. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link MembershipService.purchase}. */
|
|
2232
2246
|
purchaseMembership(input: MembershipPurchaseInput): Promise<PurchasedMembership>;
|
|
2233
|
-
/** Booking by id.
|
|
2247
|
+
/** Booking by id. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.getById}. */
|
|
2234
2248
|
getBookingById(bookingId: string, options?: BookingReadOptions): Promise<Booking | null>;
|
|
2235
|
-
/** Bookings by time range.
|
|
2249
|
+
/** Bookings by time range. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.searchByTimeRange}. */
|
|
2236
2250
|
searchBookingsByTimeRange(input: BookingTimeRangeSearch): Promise<Booking[]>;
|
|
2237
|
-
/** Bookings on a timeslot.
|
|
2251
|
+
/** Bookings on a timeslot. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.searchByTimeslot}. */
|
|
2238
2252
|
searchBookingsByTimeslot(timeslotId: string, options?: BookingReadOptions): Promise<Booking[]>;
|
|
2239
|
-
/** Guests on a booking.
|
|
2253
|
+
/** Guests on a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.getGuests}. */
|
|
2240
2254
|
getBookingGuests(bookingId: string): Promise<Guest[]>;
|
|
2241
|
-
/** Payments on file for a booking.
|
|
2255
|
+
/** Payments on file for a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.getPaymentsOnFile}. */
|
|
2242
2256
|
getBookingPaymentsOnFile(bookingId: string): Promise<BookingPaymentsOnFile | null>;
|
|
2243
|
-
/** Append or overwrite operator notes.
|
|
2257
|
+
/** Append or overwrite operator notes. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.appendNote}. */
|
|
2244
2258
|
appendBookingNote(bookingId: string, note: string, mode?: NoteMode): Promise<Booking | null>;
|
|
2245
|
-
/** Set booking check-in status.
|
|
2259
|
+
/** Set booking check-in status. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.setCheckinStatus}. */
|
|
2246
2260
|
setBookingCheckinStatus(bookingId: string, checkedIn: boolean): Promise<Booking | null>;
|
|
2247
|
-
/** Cancel a booking.
|
|
2261
|
+
/** Cancel a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.cancel}. */
|
|
2248
2262
|
cancelBooking(bookingId: string, notes?: string): Promise<CancelBookingResult>;
|
|
2249
|
-
/** Charge a booking.
|
|
2263
|
+
/** Charge a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.makePayment}. */
|
|
2250
2264
|
makeBookingPayment(input: MakePaymentInput): Promise<MakePaymentResult>;
|
|
2251
|
-
/** Refund a booking payment.
|
|
2265
|
+
/** Refund a booking payment. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.refund}. */
|
|
2252
2266
|
refundBooking(input: RefundInput): Promise<RefundResult>;
|
|
2253
|
-
/** Create an invoice link.
|
|
2267
|
+
/** Create an invoice link. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.createInvoiceLink}. */
|
|
2254
2268
|
createBookingInvoiceLink(bookingId: string): Promise<InvoiceLinkResult>;
|
|
2255
|
-
/** List add-ons on a booking.
|
|
2269
|
+
/** List add-ons on a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.listAddons}. */
|
|
2256
2270
|
listBookingAddons(bookingId: string): Promise<BookingAddons>;
|
|
2257
|
-
/** Add an add-on to a booking.
|
|
2271
|
+
/** Add an add-on to a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.addAddon}. */
|
|
2258
2272
|
addBookingAddon(bookingId: string, input: AddAddonInput): Promise<BookingAddonsMutationResult>;
|
|
2259
|
-
/** Remove an add-on from a booking.
|
|
2273
|
+
/** Remove an add-on from a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.removeAddon}. */
|
|
2260
2274
|
removeBookingAddon(bookingId: string, input: AddAddonInput): Promise<BookingAddonsMutationResult>;
|
|
2261
|
-
/** Create a booking.
|
|
2275
|
+
/** Create a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.create}. */
|
|
2262
2276
|
createBooking(input: CreateBookingInput): Promise<CreatedBooking>;
|
|
2263
|
-
/** Reviews for an activity.
|
|
2277
|
+
/** Reviews for an activity. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ReviewService.getReviews}. */
|
|
2264
2278
|
getReviews(productId: string, reviewCount?: number, reviewOffset?: number): Promise<Review[]>;
|
|
2265
2279
|
}
|
|
2266
2280
|
|
|
2267
2281
|
interface RestClientOptions$1 {
|
|
2268
2282
|
/**
|
|
2269
|
-
* The install's
|
|
2270
|
-
*
|
|
2271
|
-
*
|
|
2272
|
-
* `baseUrl`.
|
|
2283
|
+
* The install's **base API URL** (no trailing slash, no routing slug). Each
|
|
2284
|
+
* request builds `baseApiUrl/<slug>/<path>`, where the slug comes from
|
|
2285
|
+
* {@link endpoints} for the request's endpoint key.
|
|
2273
2286
|
*/
|
|
2274
|
-
|
|
2275
|
-
/**
|
|
2276
|
-
|
|
2277
|
-
* `apiUrl` is not set; the URL is `baseUrl/appId/extendableSlug/path`.
|
|
2278
|
-
*/
|
|
2279
|
-
baseUrl?: string;
|
|
2280
|
-
/** App ID, used in the endpoint path (legacy `baseUrl` mode only). */
|
|
2281
|
-
appId?: string;
|
|
2282
|
-
/** Fixed extendable slug inserted between `appId` and the REST path (legacy mode). */
|
|
2283
|
-
extendableSlug?: string;
|
|
2287
|
+
baseApiUrl: string;
|
|
2288
|
+
/** Maps an endpoint key to the relative slug appended to {@link baseApiUrl}. */
|
|
2289
|
+
endpoints: ApiEndpoints;
|
|
2284
2290
|
/** Supplies a valid bearer token for each request. */
|
|
2285
2291
|
getToken: () => string;
|
|
2286
2292
|
/** Backoff delays (ms) applied on successive HTTP 429 responses. */
|
|
@@ -2303,7 +2309,7 @@ declare class RestClient$1 {
|
|
|
2303
2309
|
* @throws {CngPermissionError} on HTTP 403 (app missing a permission)
|
|
2304
2310
|
* @throws {CngApiError} on any other non-2xx response
|
|
2305
2311
|
*/
|
|
2306
|
-
get<T>(path: string): Promise<T>;
|
|
2312
|
+
get<T>(endpoint: string, path: string): Promise<T>;
|
|
2307
2313
|
private endpoint;
|
|
2308
2314
|
private buildHeaders;
|
|
2309
2315
|
}
|
|
@@ -2390,7 +2396,7 @@ type CngAccessServiceConfig = BaseAccessServiceConfig;
|
|
|
2390
2396
|
* appId: process.env.PEEK_APP_ID!,
|
|
2391
2397
|
* });
|
|
2392
2398
|
*
|
|
2393
|
-
* const activities: Activity[] = await cng.getAllActivities();
|
|
2399
|
+
* const activities: Activity[] = await cng.getProductService().getAllActivities();
|
|
2394
2400
|
* ```
|
|
2395
2401
|
*
|
|
2396
2402
|
* @throws {Error} from the constructor when any required config field
|
|
@@ -2405,27 +2411,19 @@ declare class CngAccessService {
|
|
|
2405
2411
|
* authenticated transport. The instance is created lazily and reused.
|
|
2406
2412
|
*/
|
|
2407
2413
|
getProductService(): CngProductService;
|
|
2408
|
-
/** All activities.
|
|
2414
|
+
/** All activities. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link CngProductService.getAllActivities}. */
|
|
2409
2415
|
getAllActivities(): Promise<Activity[]>;
|
|
2410
2416
|
}
|
|
2411
2417
|
|
|
2412
2418
|
interface RestClientOptions {
|
|
2413
2419
|
/**
|
|
2414
|
-
* The install's
|
|
2415
|
-
*
|
|
2416
|
-
*
|
|
2417
|
-
* `baseUrl`.
|
|
2418
|
-
*/
|
|
2419
|
-
apiUrl?: string;
|
|
2420
|
-
/**
|
|
2421
|
-
* Base URL of the backoffice gateway (no trailing slash). Used only when
|
|
2422
|
-
* `apiUrl` is not set; the URL is `baseUrl/appId/extendableSlug/path`.
|
|
2420
|
+
* The install's **base API URL** (no trailing slash, no routing slug). Each
|
|
2421
|
+
* request builds `baseApiUrl/<slug>/<path>`, where the slug comes from
|
|
2422
|
+
* {@link endpoints} for the request's endpoint key.
|
|
2423
2423
|
*/
|
|
2424
|
-
|
|
2425
|
-
/**
|
|
2426
|
-
|
|
2427
|
-
/** Fixed extendable slug inserted between `appId` and the REST path (legacy mode). */
|
|
2428
|
-
extendableSlug?: string;
|
|
2424
|
+
baseApiUrl: string;
|
|
2425
|
+
/** Maps an endpoint key to the relative slug appended to {@link baseApiUrl}. */
|
|
2426
|
+
endpoints: ApiEndpoints;
|
|
2429
2427
|
/** Supplies a valid bearer token for each request. */
|
|
2430
2428
|
getToken: () => string;
|
|
2431
2429
|
/** Backoff delays (ms) applied on successive HTTP 429 responses. */
|
|
@@ -2447,7 +2445,7 @@ declare class RestClient {
|
|
|
2447
2445
|
* @throws {RateLimitError} on HTTP 429 after retries are exhausted
|
|
2448
2446
|
* @throws {AcmeApiError} on any other non-2xx response
|
|
2449
2447
|
*/
|
|
2450
|
-
get<T>(path: string): Promise<T>;
|
|
2448
|
+
get<T>(endpoint: string, path: string): Promise<T>;
|
|
2451
2449
|
private endpoint;
|
|
2452
2450
|
private buildHeaders;
|
|
2453
2451
|
}
|
|
@@ -2525,7 +2523,7 @@ type AcmeAccessServiceConfig = BaseAccessServiceConfig;
|
|
|
2525
2523
|
* appId: process.env.PEEK_APP_ID!,
|
|
2526
2524
|
* });
|
|
2527
2525
|
*
|
|
2528
|
-
* const activities: AcmeActivity[] = await acme.getAllActivities();
|
|
2526
|
+
* const activities: AcmeActivity[] = await acme.getProductService().getAllActivities();
|
|
2529
2527
|
* ```
|
|
2530
2528
|
*
|
|
2531
2529
|
* @throws {Error} from the constructor when any required config field
|
|
@@ -2540,7 +2538,7 @@ declare class AcmeAccessService {
|
|
|
2540
2538
|
* authenticated transport. The instance is created lazily and reused.
|
|
2541
2539
|
*/
|
|
2542
2540
|
getProductService(): AcmeProductService;
|
|
2543
|
-
/** All activities.
|
|
2541
|
+
/** All activities. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AcmeProductService.getAllActivities}. */
|
|
2544
2542
|
getAllActivities(): Promise<AcmeActivity[]>;
|
|
2545
2543
|
}
|
|
2546
2544
|
|
|
@@ -2565,7 +2563,12 @@ declare class AcmeAccessService {
|
|
|
2565
2563
|
interface InstallAccessTarget {
|
|
2566
2564
|
/** Which platform serves the install (the install webhook's `platform`). */
|
|
2567
2565
|
platform: PeekPlatform | null;
|
|
2568
|
-
/**
|
|
2566
|
+
/**
|
|
2567
|
+
* The install's base API URL (the install webhook's `apiUrl`). The chosen
|
|
2568
|
+
* access service's service classes append their own backoffice slug when they
|
|
2569
|
+
* call; a URL already carrying this platform's slug is stripped back to the
|
|
2570
|
+
* base, and one carrying a different platform's slug throws.
|
|
2571
|
+
*/
|
|
2569
2572
|
apiUrl: string;
|
|
2570
2573
|
/** The install id (the install webhook's `installId`) — becomes the JWT subject. */
|
|
2571
2574
|
installId: string;
|