@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.js
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
import { randomUUID } from 'crypto';
|
|
2
2
|
import * as jwt from 'jsonwebtoken';
|
|
3
3
|
|
|
4
|
+
// src/internal/api-endpoints.ts
|
|
5
|
+
var ApiEndpoints = class {
|
|
6
|
+
constructor(paths) {
|
|
7
|
+
this.paths = paths;
|
|
8
|
+
}
|
|
9
|
+
paths;
|
|
10
|
+
/** The relative path (slug) for `endpoint`, appended to the base API URL. */
|
|
11
|
+
pathFor(endpoint) {
|
|
12
|
+
return this.paths[endpoint];
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
function joinUrl(...parts) {
|
|
16
|
+
return parts.filter((part) => part.length > 0).join("/");
|
|
17
|
+
}
|
|
18
|
+
|
|
4
19
|
// src/internal/peek/gateway-endpoints.ts
|
|
5
20
|
var SALES_ENDPOINT = "sales";
|
|
6
21
|
var V2_EXTENDABLE_SLUG = "peek_backoffice_api-v1";
|
|
22
|
+
function peekApiEndpoints(useRegistrySlug) {
|
|
23
|
+
return new ApiEndpoints({
|
|
24
|
+
[SALES_ENDPOINT]: useRegistrySlug ? V2_EXTENDABLE_SLUG : SALES_ENDPOINT
|
|
25
|
+
});
|
|
26
|
+
}
|
|
7
27
|
|
|
8
28
|
// src/internal/peek/account-users/account-user-converter.ts
|
|
9
29
|
var ACTIVE_STATUS = "ACTIVE";
|
|
@@ -2077,6 +2097,21 @@ function requireNonEmpty(value, name, serviceName) {
|
|
|
2077
2097
|
throw new Error(`${serviceName}: "${name}" is required`);
|
|
2078
2098
|
}
|
|
2079
2099
|
}
|
|
2100
|
+
var EXTENDABLE_SLUG_RE = /^([a-z0-9]+)[-_]backoffice[-_]api[-_]v1$/i;
|
|
2101
|
+
function resolveBaseApiUrl(apiUrl, platformSlug, serviceName) {
|
|
2102
|
+
const trimmed = apiUrl.replace(/\/+$/, "");
|
|
2103
|
+
const lastSegment = trimmed.slice(trimmed.lastIndexOf("/") + 1);
|
|
2104
|
+
const found = EXTENDABLE_SLUG_RE.exec(lastSegment);
|
|
2105
|
+
if (!found) return trimmed;
|
|
2106
|
+
const foundPlatform = found[1].toLowerCase();
|
|
2107
|
+
const expectedPlatform = EXTENDABLE_SLUG_RE.exec(platformSlug)[1].toLowerCase();
|
|
2108
|
+
if (foundPlatform !== expectedPlatform) {
|
|
2109
|
+
throw new Error(
|
|
2110
|
+
`${serviceName}: "apiUrl" carries a "${foundPlatform}" backoffice slug but this service targets "${expectedPlatform}" \u2014 pass the install's ${expectedPlatform} app endpoint`
|
|
2111
|
+
);
|
|
2112
|
+
}
|
|
2113
|
+
return trimmed.slice(0, trimmed.lastIndexOf("/"));
|
|
2114
|
+
}
|
|
2080
2115
|
function createTokenManager(config) {
|
|
2081
2116
|
return new TokenManager({
|
|
2082
2117
|
secret: config.jwtSecret,
|
|
@@ -2124,6 +2159,12 @@ async function requestWithRetry(http, url, init, label, onResponse) {
|
|
|
2124
2159
|
throw new RateLimitError();
|
|
2125
2160
|
}
|
|
2126
2161
|
|
|
2162
|
+
// src/internal/sdk-headers.ts
|
|
2163
|
+
var SDK_HEADER_NAME = "x-peek-sdk";
|
|
2164
|
+
var SDK_PLATFORM = "js";
|
|
2165
|
+
var SDK_VERSION = "0.9.1";
|
|
2166
|
+
var SDK_HEADER_VALUE = `${SDK_PLATFORM}-${SDK_VERSION}`;
|
|
2167
|
+
|
|
2127
2168
|
// src/internal/peek/graphql-client.ts
|
|
2128
2169
|
var isObject = (value) => typeof value === "object" && value !== null;
|
|
2129
2170
|
var GraphQLClient = class {
|
|
@@ -2169,15 +2210,14 @@ var GraphQLClient = class {
|
|
|
2169
2210
|
);
|
|
2170
2211
|
}
|
|
2171
2212
|
endpoint(endpointName) {
|
|
2172
|
-
const {
|
|
2173
|
-
|
|
2174
|
-
const prefix = endpointPathPrefix ? `${endpointPathPrefix}/` : "";
|
|
2175
|
-
return `${baseUrl}/${appId}/${prefix}${endpointName}`;
|
|
2213
|
+
const { baseApiUrl, endpoints } = this.options;
|
|
2214
|
+
return joinUrl(baseApiUrl, endpoints.pathFor(endpointName));
|
|
2176
2215
|
}
|
|
2177
2216
|
buildHeaders() {
|
|
2178
2217
|
const headers = {
|
|
2179
2218
|
"X-Peek-Auth": `Bearer ${this.options.getToken()}`,
|
|
2180
|
-
"Content-Type": "application/json"
|
|
2219
|
+
"Content-Type": "application/json",
|
|
2220
|
+
[SDK_HEADER_NAME]: SDK_HEADER_VALUE
|
|
2181
2221
|
};
|
|
2182
2222
|
if (this.options.gatewayKey) {
|
|
2183
2223
|
headers["pk-api-key"] = this.options.gatewayKey;
|
|
@@ -3794,17 +3834,17 @@ var PeekAccessService = class {
|
|
|
3794
3834
|
this.jwtSecret = config.jwtSecret;
|
|
3795
3835
|
const logger = config.logger ?? noopLogger;
|
|
3796
3836
|
const tokens = createTokenManager(config);
|
|
3837
|
+
const useRegistrySlug = hasApiUrl || isV2;
|
|
3797
3838
|
const defaultBaseUrl = isV2 ? DEFAULT_V2_BASE_URL : DEFAULT_BASE_URL;
|
|
3839
|
+
const baseApiUrl = hasApiUrl ? resolveBaseApiUrl(config.apiUrl, V2_EXTENDABLE_SLUG, "PeekAccessService") : `${config.baseUrl ?? defaultBaseUrl}/${config.appId}`;
|
|
3798
3840
|
this.client = new GraphQLClient({
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
appId: hasApiUrl ? void 0 : config.appId,
|
|
3841
|
+
baseApiUrl,
|
|
3842
|
+
endpoints: peekApiEndpoints(useRegistrySlug),
|
|
3802
3843
|
gatewayKey: config.gatewayKey,
|
|
3803
3844
|
getToken: () => tokens.getToken(),
|
|
3804
3845
|
retryDelaysMs: config.retryDelaysMs ?? DEFAULT_RETRY_DELAYS_MS,
|
|
3805
3846
|
logger,
|
|
3806
|
-
fetchFn: config.fetch ?? globalThis.fetch
|
|
3807
|
-
endpointPathPrefix: !hasApiUrl && isV2 ? V2_EXTENDABLE_SLUG : void 0
|
|
3847
|
+
fetchFn: config.fetch ?? globalThis.fetch
|
|
3808
3848
|
});
|
|
3809
3849
|
this.productServiceOptions = {
|
|
3810
3850
|
itemOptionsPageSize: config.itemOptionsPageSize
|
|
@@ -3975,182 +4015,182 @@ var PeekAccessService = class {
|
|
|
3975
4015
|
return this.reviewService;
|
|
3976
4016
|
}
|
|
3977
4017
|
// ─── Product short-forms ─────────────────────────────────────────────────
|
|
3978
|
-
/** All products (activities + add-ons).
|
|
4018
|
+
/** All products (activities + add-ons). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllProducts}. */
|
|
3979
4019
|
getAllProducts() {
|
|
3980
4020
|
return this.getProductService().getAllProducts();
|
|
3981
4021
|
}
|
|
3982
|
-
/** All activity products (excludes add-ons).
|
|
4022
|
+
/** 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}. */
|
|
3983
4023
|
getAllActivities() {
|
|
3984
4024
|
return this.getProductService().getAllActivities();
|
|
3985
4025
|
}
|
|
3986
|
-
/** All rental products.
|
|
4026
|
+
/** All rental products. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllRentals}. */
|
|
3987
4027
|
getAllRentals() {
|
|
3988
4028
|
return this.getProductService().getAllRentals();
|
|
3989
4029
|
}
|
|
3990
|
-
/** All add-on products.
|
|
4030
|
+
/** All add-on products. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllAddons}. */
|
|
3991
4031
|
getAllAddons() {
|
|
3992
4032
|
return this.getProductService().getAllAddons();
|
|
3993
4033
|
}
|
|
3994
|
-
/** An activity's custom questions.
|
|
4034
|
+
/** An activity's custom questions. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getCustomQuestions}. */
|
|
3995
4035
|
getCustomQuestions(productId) {
|
|
3996
4036
|
return this.getProductService().getCustomQuestions(productId);
|
|
3997
4037
|
}
|
|
3998
4038
|
// ─── Account-user short-forms ─────────────────────────────────────────────
|
|
3999
|
-
/** All active account users.
|
|
4039
|
+
/** All active account users. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AccountUserService.getAll}. */
|
|
4000
4040
|
getAllAccountUsers() {
|
|
4001
4041
|
return this.getAccountUserService().getAll();
|
|
4002
4042
|
}
|
|
4003
|
-
/** Account user by id, or null.
|
|
4043
|
+
/** 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}. */
|
|
4004
4044
|
getAccountUserById(userId) {
|
|
4005
4045
|
return this.getAccountUserService().getById(userId);
|
|
4006
4046
|
}
|
|
4007
4047
|
// ─── Resource-pool short-forms ────────────────────────────────────────────
|
|
4008
|
-
/** All resource pools.
|
|
4048
|
+
/** All resource pools. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ResourcePoolService.getAll}. */
|
|
4009
4049
|
getAllResourcePools(mode) {
|
|
4010
4050
|
return this.getResourcePoolService().getAll(mode);
|
|
4011
4051
|
}
|
|
4012
4052
|
// ─── Timeslot short-forms ─────────────────────────────────────────────────
|
|
4013
|
-
/** Timeslots for an activity on a given date.
|
|
4053
|
+
/** 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}. */
|
|
4014
4054
|
getTimeslotsForDay(productId, date, filter) {
|
|
4015
4055
|
return this.getTimeslotService().getForDay(productId, date, filter);
|
|
4016
4056
|
}
|
|
4017
|
-
/** Single timeslot by id.
|
|
4057
|
+
/** Single timeslot by id. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.getById}. */
|
|
4018
4058
|
getTimeslotById(timeslotId) {
|
|
4019
4059
|
return this.getTimeslotService().getById(timeslotId);
|
|
4020
4060
|
}
|
|
4021
|
-
/** Set timeslot status.
|
|
4061
|
+
/** Set timeslot status. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.setAvailability}. */
|
|
4022
4062
|
setTimeslotAvailability(timeslotId, status) {
|
|
4023
4063
|
return this.getTimeslotService().setAvailability(timeslotId, status);
|
|
4024
4064
|
}
|
|
4025
|
-
/** Set timeslot manifest notes.
|
|
4065
|
+
/** Set timeslot manifest notes. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.setNotes}. */
|
|
4026
4066
|
setTimeslotNotes(timeslotId, manifestNotes) {
|
|
4027
4067
|
return this.getTimeslotService().setNotes(timeslotId, manifestNotes);
|
|
4028
4068
|
}
|
|
4029
|
-
/** Assign or unassign guides on timeslots.
|
|
4069
|
+
/** 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}. */
|
|
4030
4070
|
assignTimeslotGuide(assignment) {
|
|
4031
4071
|
return this.getTimeslotService().assignGuide(assignment);
|
|
4032
4072
|
}
|
|
4033
4073
|
// ─── Reseller short-forms ─────────────────────────────────────────────────
|
|
4034
|
-
/** All reseller channels.
|
|
4074
|
+
/** All reseller channels. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ResellerService.getAllChannels}. */
|
|
4035
4075
|
getAllChannels(agentsPerChannel) {
|
|
4036
4076
|
return this.getResellerService().getAllChannels(agentsPerChannel);
|
|
4037
4077
|
}
|
|
4038
4078
|
// ─── Promo-code short-forms ───────────────────────────────────────────────
|
|
4039
|
-
/** All promo codes.
|
|
4079
|
+
/** All promo codes. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PromoCodeService.getAll}. */
|
|
4040
4080
|
getAllPromoCodes() {
|
|
4041
4081
|
return this.getPromoCodeService().getAll();
|
|
4042
4082
|
}
|
|
4043
|
-
/** Create a promo code.
|
|
4083
|
+
/** Create a promo code. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PromoCodeService.create}. */
|
|
4044
4084
|
createPromoCode(input) {
|
|
4045
4085
|
return this.getPromoCodeService().create(input);
|
|
4046
4086
|
}
|
|
4047
4087
|
// ─── Pricing short-forms ──────────────────────────────────────────────────
|
|
4048
|
-
/** Create a pricing engine.
|
|
4088
|
+
/** Create a pricing engine. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.createEngine}. */
|
|
4049
4089
|
createPricingEngine(input) {
|
|
4050
4090
|
return this.getPricingService().createEngine(input);
|
|
4051
4091
|
}
|
|
4052
|
-
/** Update a pricing engine.
|
|
4092
|
+
/** Update a pricing engine. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.updateEngine}. */
|
|
4053
4093
|
updatePricingEngine(input) {
|
|
4054
4094
|
return this.getPricingService().updateEngine(input);
|
|
4055
4095
|
}
|
|
4056
|
-
/** Delete a pricing engine (idempotent).
|
|
4096
|
+
/** Delete a pricing engine (idempotent). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.deleteEngine}. */
|
|
4057
4097
|
deletePricingEngine(engineId) {
|
|
4058
4098
|
return this.getPricingService().deleteEngine(engineId);
|
|
4059
4099
|
}
|
|
4060
|
-
/** Upsert pricing overrides.
|
|
4100
|
+
/** Upsert pricing overrides. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.upsertOverrides}. */
|
|
4061
4101
|
upsertPricingOverrides(input) {
|
|
4062
4102
|
return this.getPricingService().upsertOverrides(input);
|
|
4063
4103
|
}
|
|
4064
|
-
/** Clear pricing overrides for a set of activities.
|
|
4104
|
+
/** 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}. */
|
|
4065
4105
|
clearPricingOverrides(input) {
|
|
4066
4106
|
return this.getPricingService().clearOverrides(input);
|
|
4067
4107
|
}
|
|
4068
4108
|
// ─── Daily-note short-forms ───────────────────────────────────────────────
|
|
4069
|
-
/** Today's daily note.
|
|
4109
|
+
/** Today's daily note. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link DailyNoteService.getToday}. */
|
|
4070
4110
|
getDailyNoteToday() {
|
|
4071
4111
|
return this.getDailyNoteService().getToday();
|
|
4072
4112
|
}
|
|
4073
|
-
/** Update today's daily note.
|
|
4113
|
+
/** Update today's daily note. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link DailyNoteService.update}. */
|
|
4074
4114
|
updateDailyNote(note) {
|
|
4075
4115
|
return this.getDailyNoteService().update(note);
|
|
4076
4116
|
}
|
|
4077
4117
|
// ─── Availability short-forms ─────────────────────────────────────────────
|
|
4078
|
-
/** Availability times for an activity.
|
|
4118
|
+
/** Availability times for an activity. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AvailabilityService.getAvailabilityTimes}. */
|
|
4079
4119
|
getAvailabilityTimes(query) {
|
|
4080
4120
|
return this.getAvailabilityService().getAvailabilityTimes(query);
|
|
4081
4121
|
}
|
|
4082
4122
|
// ─── Membership short-forms ───────────────────────────────────────────────
|
|
4083
|
-
/** All memberships.
|
|
4123
|
+
/** All memberships. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link MembershipService.getAll}. */
|
|
4084
4124
|
getAllMemberships() {
|
|
4085
4125
|
return this.getMembershipService().getAll();
|
|
4086
4126
|
}
|
|
4087
|
-
/** Purchase a membership.
|
|
4127
|
+
/** Purchase a membership. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link MembershipService.purchase}. */
|
|
4088
4128
|
purchaseMembership(input) {
|
|
4089
4129
|
return this.getMembershipService().purchase(input);
|
|
4090
4130
|
}
|
|
4091
4131
|
// ─── Booking short-forms ──────────────────────────────────────────────────
|
|
4092
|
-
/** Booking by id.
|
|
4132
|
+
/** Booking by id. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.getById}. */
|
|
4093
4133
|
getBookingById(bookingId, options) {
|
|
4094
4134
|
return this.getBookingService().getById(bookingId, options);
|
|
4095
4135
|
}
|
|
4096
|
-
/** Bookings by time range.
|
|
4136
|
+
/** Bookings by time range. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.searchByTimeRange}. */
|
|
4097
4137
|
searchBookingsByTimeRange(input) {
|
|
4098
4138
|
return this.getBookingService().searchByTimeRange(input);
|
|
4099
4139
|
}
|
|
4100
|
-
/** Bookings on a timeslot.
|
|
4140
|
+
/** Bookings on a timeslot. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.searchByTimeslot}. */
|
|
4101
4141
|
searchBookingsByTimeslot(timeslotId, options) {
|
|
4102
4142
|
return this.getBookingService().searchByTimeslot(timeslotId, options);
|
|
4103
4143
|
}
|
|
4104
|
-
/** Guests on a booking.
|
|
4144
|
+
/** Guests on a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.getGuests}. */
|
|
4105
4145
|
getBookingGuests(bookingId) {
|
|
4106
4146
|
return this.getBookingService().getGuests(bookingId);
|
|
4107
4147
|
}
|
|
4108
|
-
/** Payments on file for a booking.
|
|
4148
|
+
/** 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}. */
|
|
4109
4149
|
getBookingPaymentsOnFile(bookingId) {
|
|
4110
4150
|
return this.getBookingService().getPaymentsOnFile(bookingId);
|
|
4111
4151
|
}
|
|
4112
|
-
/** Append or overwrite operator notes.
|
|
4152
|
+
/** Append or overwrite operator notes. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.appendNote}. */
|
|
4113
4153
|
appendBookingNote(bookingId, note, mode) {
|
|
4114
4154
|
return this.getBookingService().appendNote(bookingId, note, mode);
|
|
4115
4155
|
}
|
|
4116
|
-
/** Set booking check-in status.
|
|
4156
|
+
/** Set booking check-in status. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.setCheckinStatus}. */
|
|
4117
4157
|
setBookingCheckinStatus(bookingId, checkedIn) {
|
|
4118
4158
|
return this.getBookingService().setCheckinStatus(bookingId, checkedIn);
|
|
4119
4159
|
}
|
|
4120
|
-
/** Cancel a booking.
|
|
4160
|
+
/** Cancel a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.cancel}. */
|
|
4121
4161
|
cancelBooking(bookingId, notes) {
|
|
4122
4162
|
return this.getBookingService().cancel(bookingId, notes);
|
|
4123
4163
|
}
|
|
4124
|
-
/** Charge a booking.
|
|
4164
|
+
/** Charge a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.makePayment}. */
|
|
4125
4165
|
makeBookingPayment(input) {
|
|
4126
4166
|
return this.getBookingService().makePayment(input);
|
|
4127
4167
|
}
|
|
4128
|
-
/** Refund a booking payment.
|
|
4168
|
+
/** Refund a booking payment. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.refund}. */
|
|
4129
4169
|
refundBooking(input) {
|
|
4130
4170
|
return this.getBookingService().refund(input);
|
|
4131
4171
|
}
|
|
4132
|
-
/** Create an invoice link.
|
|
4172
|
+
/** Create an invoice link. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.createInvoiceLink}. */
|
|
4133
4173
|
createBookingInvoiceLink(bookingId) {
|
|
4134
4174
|
return this.getBookingService().createInvoiceLink(bookingId);
|
|
4135
4175
|
}
|
|
4136
|
-
/** List add-ons on a booking.
|
|
4176
|
+
/** 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}. */
|
|
4137
4177
|
listBookingAddons(bookingId) {
|
|
4138
4178
|
return this.getBookingService().listAddons(bookingId);
|
|
4139
4179
|
}
|
|
4140
|
-
/** Add an add-on to a booking.
|
|
4180
|
+
/** 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}. */
|
|
4141
4181
|
addBookingAddon(bookingId, input) {
|
|
4142
4182
|
return this.getBookingService().addAddon(bookingId, input);
|
|
4143
4183
|
}
|
|
4144
|
-
/** Remove an add-on from a booking.
|
|
4184
|
+
/** 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}. */
|
|
4145
4185
|
removeBookingAddon(bookingId, input) {
|
|
4146
4186
|
return this.getBookingService().removeAddon(bookingId, input);
|
|
4147
4187
|
}
|
|
4148
|
-
/** Create a booking.
|
|
4188
|
+
/** Create a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.create}. */
|
|
4149
4189
|
createBooking(input) {
|
|
4150
4190
|
return this.getBookingService().create(input);
|
|
4151
4191
|
}
|
|
4152
4192
|
// ─── Review short-forms ───────────────────────────────────────────────────
|
|
4153
|
-
/** Reviews for an activity.
|
|
4193
|
+
/** Reviews for an activity. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ReviewService.getReviews}. */
|
|
4154
4194
|
getReviews(productId, reviewCount, reviewOffset) {
|
|
4155
4195
|
return this.getReviewService().getReviews(productId, reviewCount, reviewOffset);
|
|
4156
4196
|
}
|
|
@@ -4158,7 +4198,11 @@ var PeekAccessService = class {
|
|
|
4158
4198
|
|
|
4159
4199
|
// src/internal/cng/endpoints.ts
|
|
4160
4200
|
var CNG_EXTENDABLE_SLUG = "cng_backoffice_api-v1";
|
|
4201
|
+
var CNG_PRODUCTS_ENDPOINT = "products";
|
|
4161
4202
|
var PRODUCTS_PATH = "api/v2/app-registry/products?active=1";
|
|
4203
|
+
var CNG_API_ENDPOINTS = new ApiEndpoints({
|
|
4204
|
+
[CNG_PRODUCTS_ENDPOINT]: CNG_EXTENDABLE_SLUG
|
|
4205
|
+
});
|
|
4162
4206
|
|
|
4163
4207
|
// src/models/cng/product.ts
|
|
4164
4208
|
var ACTIVITY_PRODUCT_TYPE2 = "ACTIVITY";
|
|
@@ -4192,7 +4236,10 @@ var CngProductService = class {
|
|
|
4192
4236
|
* ```
|
|
4193
4237
|
*/
|
|
4194
4238
|
async getAllActivities() {
|
|
4195
|
-
const body = await this.client.get(
|
|
4239
|
+
const body = await this.client.get(
|
|
4240
|
+
CNG_PRODUCTS_ENDPOINT,
|
|
4241
|
+
PRODUCTS_PATH
|
|
4242
|
+
);
|
|
4196
4243
|
return fromProductNodes(body?.data ?? []);
|
|
4197
4244
|
}
|
|
4198
4245
|
};
|
|
@@ -4214,9 +4261,9 @@ var RestClient = class {
|
|
|
4214
4261
|
* @throws {CngPermissionError} on HTTP 403 (app missing a permission)
|
|
4215
4262
|
* @throws {CngApiError} on any other non-2xx response
|
|
4216
4263
|
*/
|
|
4217
|
-
async get(path) {
|
|
4264
|
+
async get(endpoint, path) {
|
|
4218
4265
|
const { logger } = this.options;
|
|
4219
|
-
const url = this.endpoint(path);
|
|
4266
|
+
const url = this.endpoint(endpoint, path);
|
|
4220
4267
|
logger.info("Making CNG request", { url, path });
|
|
4221
4268
|
return requestWithRetry(
|
|
4222
4269
|
this.options,
|
|
@@ -4238,15 +4285,15 @@ var RestClient = class {
|
|
|
4238
4285
|
}
|
|
4239
4286
|
);
|
|
4240
4287
|
}
|
|
4241
|
-
endpoint(path) {
|
|
4242
|
-
const {
|
|
4243
|
-
|
|
4244
|
-
return `${baseUrl}/${appId}/${extendableSlug}/${path}`;
|
|
4288
|
+
endpoint(endpoint, path) {
|
|
4289
|
+
const { baseApiUrl, endpoints } = this.options;
|
|
4290
|
+
return joinUrl(baseApiUrl, endpoints.pathFor(endpoint), path);
|
|
4245
4291
|
}
|
|
4246
4292
|
buildHeaders() {
|
|
4247
4293
|
return {
|
|
4248
4294
|
"X-Peek-Auth": `Bearer ${this.options.getToken()}`,
|
|
4249
|
-
"Content-Type": "application/json"
|
|
4295
|
+
"Content-Type": "application/json",
|
|
4296
|
+
[SDK_HEADER_NAME]: SDK_HEADER_VALUE
|
|
4250
4297
|
};
|
|
4251
4298
|
}
|
|
4252
4299
|
};
|
|
@@ -4270,11 +4317,10 @@ var CngAccessService = class {
|
|
|
4270
4317
|
if (!hasApiUrl) requireNonEmpty(config.appId ?? "", "appId", "CngAccessService");
|
|
4271
4318
|
const logger = config.logger ?? noopLogger;
|
|
4272
4319
|
const tokens = createTokenManager(config);
|
|
4320
|
+
const baseApiUrl = hasApiUrl ? resolveBaseApiUrl(config.apiUrl, CNG_EXTENDABLE_SLUG, "CngAccessService") : `${config.baseUrl ?? DEFAULT_BASE_URL2}/${config.appId}`;
|
|
4273
4321
|
this.client = new RestClient({
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
appId: hasApiUrl ? void 0 : config.appId,
|
|
4277
|
-
extendableSlug: CNG_EXTENDABLE_SLUG,
|
|
4322
|
+
baseApiUrl,
|
|
4323
|
+
endpoints: CNG_API_ENDPOINTS,
|
|
4278
4324
|
getToken: () => tokens.getToken(),
|
|
4279
4325
|
retryDelaysMs: config.retryDelaysMs ?? DEFAULT_RETRY_DELAYS_MS,
|
|
4280
4326
|
logger,
|
|
@@ -4291,7 +4337,7 @@ var CngAccessService = class {
|
|
|
4291
4337
|
}
|
|
4292
4338
|
return this.productService;
|
|
4293
4339
|
}
|
|
4294
|
-
/** All activities.
|
|
4340
|
+
/** All activities. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link CngProductService.getAllActivities}. */
|
|
4295
4341
|
getAllActivities() {
|
|
4296
4342
|
return this.getProductService().getAllActivities();
|
|
4297
4343
|
}
|
|
@@ -4299,7 +4345,11 @@ var CngAccessService = class {
|
|
|
4299
4345
|
|
|
4300
4346
|
// src/internal/acme/endpoints.ts
|
|
4301
4347
|
var ACME_EXTENDABLE_SLUG = "acme_backoffice_api-v1";
|
|
4348
|
+
var ACME_TEMPLATES_ENDPOINT = "templates";
|
|
4302
4349
|
var TEMPLATES_PATH = "v2/b2b/event/templates/names?pageSize=-1&page=1";
|
|
4350
|
+
var ACME_API_ENDPOINTS = new ApiEndpoints({
|
|
4351
|
+
[ACME_TEMPLATES_ENDPOINT]: ACME_EXTENDABLE_SLUG
|
|
4352
|
+
});
|
|
4303
4353
|
|
|
4304
4354
|
// src/models/acme/product.ts
|
|
4305
4355
|
var ACME_ACTIVITY_TYPE = "standard";
|
|
@@ -4337,6 +4387,7 @@ var AcmeProductService = class {
|
|
|
4337
4387
|
*/
|
|
4338
4388
|
async getAllActivities() {
|
|
4339
4389
|
const body = await this.client.get(
|
|
4390
|
+
ACME_TEMPLATES_ENDPOINT,
|
|
4340
4391
|
TEMPLATES_PATH
|
|
4341
4392
|
);
|
|
4342
4393
|
const nodes = Array.isArray(body) ? body : body?.list ?? [];
|
|
@@ -4359,9 +4410,9 @@ var RestClient2 = class {
|
|
|
4359
4410
|
* @throws {RateLimitError} on HTTP 429 after retries are exhausted
|
|
4360
4411
|
* @throws {AcmeApiError} on any other non-2xx response
|
|
4361
4412
|
*/
|
|
4362
|
-
async get(path) {
|
|
4413
|
+
async get(endpoint, path) {
|
|
4363
4414
|
const { logger } = this.options;
|
|
4364
|
-
const url = this.endpoint(path);
|
|
4415
|
+
const url = this.endpoint(endpoint, path);
|
|
4365
4416
|
logger.info("Making ACME request", { url, path });
|
|
4366
4417
|
return requestWithRetry(
|
|
4367
4418
|
this.options,
|
|
@@ -4378,15 +4429,15 @@ var RestClient2 = class {
|
|
|
4378
4429
|
}
|
|
4379
4430
|
);
|
|
4380
4431
|
}
|
|
4381
|
-
endpoint(path) {
|
|
4382
|
-
const {
|
|
4383
|
-
|
|
4384
|
-
return `${baseUrl}/${appId}/${extendableSlug}/${path}`;
|
|
4432
|
+
endpoint(endpoint, path) {
|
|
4433
|
+
const { baseApiUrl, endpoints } = this.options;
|
|
4434
|
+
return joinUrl(baseApiUrl, endpoints.pathFor(endpoint), path);
|
|
4385
4435
|
}
|
|
4386
4436
|
buildHeaders() {
|
|
4387
4437
|
return {
|
|
4388
4438
|
"X-Peek-Auth": `Bearer ${this.options.getToken()}`,
|
|
4389
|
-
"Content-Type": "application/json"
|
|
4439
|
+
"Content-Type": "application/json",
|
|
4440
|
+
[SDK_HEADER_NAME]: SDK_HEADER_VALUE
|
|
4390
4441
|
};
|
|
4391
4442
|
}
|
|
4392
4443
|
};
|
|
@@ -4404,11 +4455,10 @@ var AcmeAccessService = class {
|
|
|
4404
4455
|
if (!hasApiUrl) requireNonEmpty(config.appId ?? "", "appId", "AcmeAccessService");
|
|
4405
4456
|
const logger = config.logger ?? noopLogger;
|
|
4406
4457
|
const tokens = createTokenManager(config);
|
|
4458
|
+
const baseApiUrl = hasApiUrl ? resolveBaseApiUrl(config.apiUrl, ACME_EXTENDABLE_SLUG, "AcmeAccessService") : `${config.baseUrl ?? DEFAULT_BASE_URL3}/${config.appId}`;
|
|
4407
4459
|
this.client = new RestClient2({
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
appId: hasApiUrl ? void 0 : config.appId,
|
|
4411
|
-
extendableSlug: ACME_EXTENDABLE_SLUG,
|
|
4460
|
+
baseApiUrl,
|
|
4461
|
+
endpoints: ACME_API_ENDPOINTS,
|
|
4412
4462
|
getToken: () => tokens.getToken(),
|
|
4413
4463
|
retryDelaysMs: config.retryDelaysMs ?? DEFAULT_RETRY_DELAYS_MS,
|
|
4414
4464
|
logger,
|
|
@@ -4425,7 +4475,7 @@ var AcmeAccessService = class {
|
|
|
4425
4475
|
}
|
|
4426
4476
|
return this.productService;
|
|
4427
4477
|
}
|
|
4428
|
-
/** All activities.
|
|
4478
|
+
/** All activities. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AcmeProductService.getAllActivities}. */
|
|
4429
4479
|
getAllActivities() {
|
|
4430
4480
|
return this.getProductService().getAllActivities();
|
|
4431
4481
|
}
|