order3000 0.20.0 → 0.21.0

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/client.cjs CHANGED
@@ -211,6 +211,26 @@ class ArticlesResource extends BaseResource {
211
211
  const path = qs ? `?${qs}` : "";
212
212
  return this.request("GET", path);
213
213
  }
214
+ /**
215
+ * Fetch a single article by id or accessor within the active venue.
216
+ * Returns the full row including the TipTap `content` document.
217
+ */
218
+ async getByAccessor(idOrAccessor) {
219
+ return this.request("GET", `/${encodeURIComponent(idOrAccessor)}`);
220
+ }
221
+ /**
222
+ * Partial-update an article. Locale-keyed fields (slug, title, excerpt)
223
+ * merge at the locale level — `{ slug: { en: 'foo' } }` updates `en`
224
+ * without touching `de`. Plain scalar / array fields fully replace.
225
+ * Returns the resulting article.
226
+ */
227
+ async patch(idOrAccessor, body) {
228
+ return this.request(
229
+ "PATCH",
230
+ `/${encodeURIComponent(idOrAccessor)}`,
231
+ body
232
+ );
233
+ }
214
234
  }
215
235
 
216
236
  class BasketsResource extends BaseResource {
@@ -796,6 +816,44 @@ class TeamOrdersResource {
796
816
  }
797
817
  }
798
818
 
819
+ class VenuesResource {
820
+ constructor(tokenManager, baseUrl) {
821
+ this.tokenManager = tokenManager;
822
+ this.baseUrl = baseUrl;
823
+ }
824
+ /**
825
+ * Fetch a venue by its UUID or its accessor (slug). The path accepts
826
+ * either form; the server resolves transparently.
827
+ *
828
+ * Powers the order3000-cli's `venues use <accessor>` validation step
829
+ * — the CLI hits this to prove the accessor exists and to cache the
830
+ * resolved UUID + display fields locally.
831
+ */
832
+ async getByAccessor(idOrAccessor) {
833
+ const token = await this.tokenManager.getToken();
834
+ const url = `${this.baseUrl}/venues/${encodeURIComponent(idOrAccessor)}`;
835
+ const response = await fetch(url, {
836
+ method: "GET",
837
+ headers: {
838
+ Authorization: `Bearer ${token}`,
839
+ "Content-Type": "application/json"
840
+ },
841
+ cache: "no-store"
842
+ });
843
+ if (!response.ok) {
844
+ let body = "";
845
+ try {
846
+ body = await response.text();
847
+ } catch {
848
+ }
849
+ throw new Error(
850
+ `HTTP ${response.status}: ${response.statusText}${body ? ` \u2014 ${body}` : ""}`
851
+ );
852
+ }
853
+ return response.json();
854
+ }
855
+ }
856
+
799
857
  var __defProp$2 = Object.defineProperty;
800
858
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
801
859
  var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1130,6 +1188,7 @@ class Order3000Client {
1130
1188
  __publicField(this, "reservations");
1131
1189
  __publicField(this, "subscriptions");
1132
1190
  __publicField(this, "teamOrders");
1191
+ __publicField(this, "venues");
1133
1192
  __publicField(this, "realtime");
1134
1193
  __publicField(this, "baseUrl");
1135
1194
  __publicField(this, "tokenManager");
@@ -1160,6 +1219,7 @@ class Order3000Client {
1160
1219
  this.baseUrl
1161
1220
  );
1162
1221
  this.teamOrders = new TeamOrdersResource(this.tokenManager, this.baseUrl);
1222
+ this.venues = new VenuesResource(this.tokenManager, this.baseUrl);
1163
1223
  this.realtime = new RealtimeManager(this.tokenManager, this.baseUrl);
1164
1224
  }
1165
1225
  }
package/dist/client.d.cts CHANGED
@@ -50,7 +50,7 @@ declare abstract class BaseResource {
50
50
  protected readonly baseUrl: string;
51
51
  protected readonly resourcePath: string;
52
52
  constructor(tokenManager: TokenManager, baseUrl: string, resourcePath: string);
53
- protected request<T>(method: 'GET' | 'POST' | 'DELETE', path: string, data?: unknown, cacheOptions?: RequestCacheOptions): Promise<T>;
53
+ protected request<T>(method: 'GET' | 'POST' | 'PATCH' | 'DELETE', path: string, data?: unknown, cacheOptions?: RequestCacheOptions): Promise<T>;
54
54
  }
55
55
 
56
56
  interface components {
@@ -234,21 +234,99 @@ interface components {
234
234
  };
235
235
  excerpt: {
236
236
  [key: string]: string;
237
- };
237
+ } | null;
238
238
  content: {
239
239
  [key: string]: unknown;
240
- };
240
+ } | null;
241
241
  tags: string[];
242
242
  featuredImageId: string | null;
243
243
  isActive: boolean;
244
244
  isFeatured: boolean;
245
245
  priority: number;
246
- publishedAt: string | null;
247
- createdAt: string | null;
248
- updatedAt: string | null;
246
+ publishedAt: unknown;
247
+ createdAt: unknown;
248
+ updatedAt: unknown;
249
249
  };
250
250
  /** ListArticlesResponse */
251
251
  ListArticlesResponse: components["schemas"]["Article"][];
252
+ /**
253
+ * GetArticleResponse
254
+ * @description A venue's article. `content` is a TipTap JSON document; treat it as opaque on the wire.
255
+ */
256
+ GetArticleResponse: {
257
+ id: string;
258
+ venueId: string;
259
+ accessor: string;
260
+ slug: {
261
+ [key: string]: string;
262
+ };
263
+ title: {
264
+ [key: string]: string;
265
+ };
266
+ excerpt: {
267
+ [key: string]: string;
268
+ } | null;
269
+ content: {
270
+ [key: string]: unknown;
271
+ } | null;
272
+ tags: string[];
273
+ featuredImageId: string | null;
274
+ isActive: boolean;
275
+ isFeatured: boolean;
276
+ priority: number;
277
+ publishedAt: unknown;
278
+ createdAt: unknown;
279
+ updatedAt: unknown;
280
+ };
281
+ /** PatchArticleRequest */
282
+ PatchArticleRequest: {
283
+ slug?: {
284
+ [key: string]: string;
285
+ };
286
+ title?: {
287
+ [key: string]: string;
288
+ };
289
+ excerpt?: {
290
+ [key: string]: string;
291
+ };
292
+ content?: {
293
+ [key: string]: unknown;
294
+ };
295
+ tags?: string[];
296
+ featuredImageId?: string | null;
297
+ isActive?: boolean;
298
+ isFeatured?: boolean;
299
+ priority?: number;
300
+ };
301
+ /**
302
+ * PatchArticleResponse
303
+ * @description A venue's article. `content` is a TipTap JSON document; treat it as opaque on the wire.
304
+ */
305
+ PatchArticleResponse: {
306
+ id: string;
307
+ venueId: string;
308
+ accessor: string;
309
+ slug: {
310
+ [key: string]: string;
311
+ };
312
+ title: {
313
+ [key: string]: string;
314
+ };
315
+ excerpt: {
316
+ [key: string]: string;
317
+ } | null;
318
+ content: {
319
+ [key: string]: unknown;
320
+ } | null;
321
+ tags: string[];
322
+ featuredImageId: string | null;
323
+ isActive: boolean;
324
+ isFeatured: boolean;
325
+ priority: number;
326
+ publishedAt: unknown;
327
+ createdAt: unknown;
328
+ updatedAt: unknown;
329
+ };
252
330
  /**
253
331
  * AddToBasketRequest
254
332
  * @description Add an item to the shopping basket
@@ -1097,6 +1175,23 @@ interface components {
1097
1175
  teamOrderId: string;
1098
1176
  deliveryAddressId: string;
1099
1177
  };
1178
+ /**
1179
+ * GetVenueResponse
1180
+ * @description A venue. The public API exposes only the minimal id + accessor + naming + locale fields the CLI's `venues use` / `auth whoami` consume.
1181
+ */
1182
+ GetVenueResponse: {
1183
+ id: string;
1184
+ accessor: string;
1185
+ officialName: string;
1186
+ legalName: string;
1187
+ shortName: string;
1188
+ brandName: string;
1189
+ primaryLocale: string;
1190
+ supportedLocales: string[];
1191
+ timezone: string;
1192
+ createdAt: unknown;
1193
+ updatedAt: unknown;
1194
+ };
1100
1195
  };
1101
1196
  responses: never;
1102
1197
  parameters: never;
@@ -1110,6 +1205,9 @@ type CreateEventRequest = schemas['CreateEventRequest'];
1110
1205
  type CreateEventResponse = schemas['CreateEventResponse'];
1111
1206
  type Article = schemas['Article'];
1112
1207
  type ListArticlesResponse = schemas['ListArticlesResponse'];
1208
+ type GetArticleResponse = schemas['GetArticleResponse'];
1209
+ type PatchArticleRequest = schemas['PatchArticleRequest'];
1210
+ type PatchArticleResponse = schemas['PatchArticleResponse'];
1113
1211
  interface ListArticlesOptions {
1114
1212
  /** Only return articles whose `tags` array contains this value. */
1115
1213
  tag?: string;
@@ -1118,6 +1216,8 @@ interface ListArticlesOptions {
1118
1216
  /** When `true`, include articles whose `isActive` is `false`. Default `false`. */
1119
1217
  includeInactive?: boolean;
1120
1218
  }
1219
+ type Venue = schemas['Venue'];
1220
+ type GetVenueResponse = schemas['GetVenueResponse'];
1121
1221
  /**
1122
1222
  * Order fulfillment type - matches order_fulfillment_type enum in order3000 database.
1123
1223
  * Keep in sync with apps/order3000/src/drizzle/enums.ts
@@ -1907,6 +2007,18 @@ declare class ArticlesResource extends BaseResource {
1907
2007
  * for human-friendly node addressing.
1908
2008
  */
1909
2009
  list(options?: ListArticlesOptions): Promise<ListArticlesResponse>;
2010
+ /**
2011
+ * Fetch a single article by id or accessor within the active venue.
2012
+ * Returns the full row including the TipTap `content` document.
2013
+ */
2014
+ getByAccessor(idOrAccessor: string): Promise<Article>;
2015
+ /**
2016
+ * Partial-update an article. Locale-keyed fields (slug, title, excerpt)
2017
+ * merge at the locale level — `{ slug: { en: 'foo' } }` updates `en`
2018
+ * without touching `de`. Plain scalar / array fields fully replace.
2019
+ * Returns the resulting article.
2020
+ */
2021
+ patch(idOrAccessor: string, body: PatchArticleRequest): Promise<Article>;
1910
2022
  }
1911
2023
 
1912
2024
  declare class BasketsResource extends BaseResource {
@@ -2592,6 +2704,27 @@ declare class TeamOrdersResource {
2592
2704
  }): Promise<UpdateDeliveryAddressResponse>;
2593
2705
  }
2594
2706
 
2707
+ /**
2708
+ * Reads at the venue level. Doesn't extend `BaseResource` because that
2709
+ * class hard-codes a `/venues/{venueId}/<resourcePath>` URL template,
2710
+ * which assumes a venue-scoped sub-resource. Venues themselves are AT
2711
+ * `/venues/:venueIdOrAccessor` directly.
2712
+ */
2713
+ declare class VenuesResource {
2714
+ private readonly tokenManager;
2715
+ private readonly baseUrl;
2716
+ constructor(tokenManager: TokenManager, baseUrl: string);
2717
+ /**
2718
+ * Fetch a venue by its UUID or its accessor (slug). The path accepts
2719
+ * either form; the server resolves transparently.
2720
+ *
2721
+ * Powers the order3000-cli's `venues use <accessor>` validation step
2722
+ * — the CLI hits this to prove the accessor exists and to cache the
2723
+ * resolved UUID + display fields locally.
2724
+ */
2725
+ getByAccessor(idOrAccessor: string): Promise<Venue>;
2726
+ }
2727
+
2595
2728
  type RealtimeEvent = 'INSERT' | 'UPDATE' | 'DELETE' | '*';
2596
2729
  type RealtimeRow = {
2597
2730
  [key: string]: any;
@@ -2763,6 +2896,7 @@ declare class Order3000Client {
2763
2896
  reservations: ReservationsResource;
2764
2897
  subscriptions: SubscriptionsResource;
2765
2898
  teamOrders: TeamOrdersResource;
2899
+ venues: VenuesResource;
2766
2900
  realtime: RealtimeManager;
2767
2901
  private readonly baseUrl;
2768
2902
  private readonly tokenManager;
@@ -2770,4 +2904,4 @@ declare class Order3000Client {
2770
2904
  }
2771
2905
 
2772
2906
  export { Order3000Client, fulfillmentTypeEnum, getScheduleInfo, participantStatusEnum, paymentMethodEnum, teamOrderStatusEnum };
2773
- export type { AddToBasketRequest, AddToBasketResponse, Area, AreaAsset, AreaAvailabilityResponse, AreaAvailabilityWindow, AreaBookingMode, AreaBookingRequestResponse, AreaBookingRequestSource, AreaBookingRequestStatus, AreaBookingStatus, AreaFeature, Article, Basket, BasketItem, BasketItemDeposit, BasketItemMenuItemRef, BasketItemMetadata, BasketStatus, BasketTotals, CancelTeamOrderResponse, ConfirmOrderRequest, ConfirmOrderResponse, CreateDeltaPaymentIntentRequest, CreateDeltaPaymentIntentResponse, CreatePaymentIntentRequest, CreatePaymentIntentResponse, CreateTeamOrderRequest, CreateTeamOrderResponse, CropArea, Currency, DayOfWeek, DeclaredReturn, Event, EventByAccessor, EventMenu, EventPoster, EventRow, ExtendDeadlineResponse as ExtendTeamOrderDeadlineResponse, FetchTeamOrderResponse, GetAreaAvailabilityOptions, GetAreaOptions, GetEventOptions, GetMenuOptions, JoinTeamOrderRequest, JoinTeamOrderResponse, LatestOrder, ListArticlesOptions, ListArticlesResponse, ListEventsOptions, ListEventsResponse, Menu, MenuAsset, MenuBeverage, MenuBundle, MenuBundleDeposit, MenuDish, MenuItem, MenuItemRow, MenuItemType, MenuSubscription, MenuSubscriptionPoster, Order3000ClientConfig, OrderFulfillmentType, OrderStatus, PaymentStatus, PlaceOrderRequest, Promotion, RealtimeConfig, RealtimeEvent, RealtimeSubscription, RemoveFromBasketResponse, Schedule, ScheduleInfo, ScheduleOverride, ScheduleOverrideRow, ScheduleRow, ScheduleTimeSlot, ScheduleWithTimeSlots, SubmitAreaBookingRequestPayload, SubmitTeamOrderResponse, SubscribeRequest, SubscribeResponse, SubscriberStatus, SubscriptionCredit, SubscriptionCreditStatus, SubscriptionOptions, SubscriptionPeriod, SwitchFulfillmentResponse as SwitchTeamOrderFulfillmentResponse, TeamDeliveryAddress, TeamOrderBasketItem, TeamOrderBasketItemMenuItemRef, FulfillmentType as TeamOrderFulfillmentType, TeamOrderParticipant, ParticipantStatus as TeamOrderParticipantStatus, PaymentMethod as TeamOrderPaymentMethod, TeamOrderStatus, ThresholdCheck as TeamOrderThresholdCheck, TimeSlot, Unit, UpdateDeliveryAddressResponse as UpdateTeamOrderDeliveryAddressResponse };
2907
+ export type { AddToBasketRequest, AddToBasketResponse, Area, AreaAsset, AreaAvailabilityResponse, AreaAvailabilityWindow, AreaBookingMode, AreaBookingRequestResponse, AreaBookingRequestSource, AreaBookingRequestStatus, AreaBookingStatus, AreaFeature, Article, Basket, BasketItem, BasketItemDeposit, BasketItemMenuItemRef, BasketItemMetadata, BasketStatus, BasketTotals, CancelTeamOrderResponse, ConfirmOrderRequest, ConfirmOrderResponse, CreateDeltaPaymentIntentRequest, CreateDeltaPaymentIntentResponse, CreatePaymentIntentRequest, CreatePaymentIntentResponse, CreateTeamOrderRequest, CreateTeamOrderResponse, CropArea, Currency, DayOfWeek, DeclaredReturn, Event, EventByAccessor, EventMenu, EventPoster, EventRow, ExtendDeadlineResponse as ExtendTeamOrderDeadlineResponse, FetchTeamOrderResponse, GetAreaAvailabilityOptions, GetAreaOptions, GetArticleResponse, GetEventOptions, GetMenuOptions, GetVenueResponse, JoinTeamOrderRequest, JoinTeamOrderResponse, LatestOrder, ListArticlesOptions, ListArticlesResponse, ListEventsOptions, ListEventsResponse, Menu, MenuAsset, MenuBeverage, MenuBundle, MenuBundleDeposit, MenuDish, MenuItem, MenuItemRow, MenuItemType, MenuSubscription, MenuSubscriptionPoster, Order3000ClientConfig, OrderFulfillmentType, OrderStatus, PatchArticleRequest, PatchArticleResponse, PaymentStatus, PlaceOrderRequest, Promotion, RealtimeConfig, RealtimeEvent, RealtimeSubscription, RemoveFromBasketResponse, Schedule, ScheduleInfo, ScheduleOverride, ScheduleOverrideRow, ScheduleRow, ScheduleTimeSlot, ScheduleWithTimeSlots, SubmitAreaBookingRequestPayload, SubmitTeamOrderResponse, SubscribeRequest, SubscribeResponse, SubscriberStatus, SubscriptionCredit, SubscriptionCreditStatus, SubscriptionOptions, SubscriptionPeriod, SwitchFulfillmentResponse as SwitchTeamOrderFulfillmentResponse, TeamDeliveryAddress, TeamOrderBasketItem, TeamOrderBasketItemMenuItemRef, FulfillmentType as TeamOrderFulfillmentType, TeamOrderParticipant, ParticipantStatus as TeamOrderParticipantStatus, PaymentMethod as TeamOrderPaymentMethod, TeamOrderStatus, ThresholdCheck as TeamOrderThresholdCheck, TimeSlot, Unit, UpdateDeliveryAddressResponse as UpdateTeamOrderDeliveryAddressResponse, Venue };
package/dist/client.d.mts CHANGED
@@ -50,7 +50,7 @@ declare abstract class BaseResource {
50
50
  protected readonly baseUrl: string;
51
51
  protected readonly resourcePath: string;
52
52
  constructor(tokenManager: TokenManager, baseUrl: string, resourcePath: string);
53
- protected request<T>(method: 'GET' | 'POST' | 'DELETE', path: string, data?: unknown, cacheOptions?: RequestCacheOptions): Promise<T>;
53
+ protected request<T>(method: 'GET' | 'POST' | 'PATCH' | 'DELETE', path: string, data?: unknown, cacheOptions?: RequestCacheOptions): Promise<T>;
54
54
  }
55
55
 
56
56
  interface components {
@@ -234,21 +234,99 @@ interface components {
234
234
  };
235
235
  excerpt: {
236
236
  [key: string]: string;
237
- };
237
+ } | null;
238
238
  content: {
239
239
  [key: string]: unknown;
240
- };
240
+ } | null;
241
241
  tags: string[];
242
242
  featuredImageId: string | null;
243
243
  isActive: boolean;
244
244
  isFeatured: boolean;
245
245
  priority: number;
246
- publishedAt: string | null;
247
- createdAt: string | null;
248
- updatedAt: string | null;
246
+ publishedAt: unknown;
247
+ createdAt: unknown;
248
+ updatedAt: unknown;
249
249
  };
250
250
  /** ListArticlesResponse */
251
251
  ListArticlesResponse: components["schemas"]["Article"][];
252
+ /**
253
+ * GetArticleResponse
254
+ * @description A venue's article. `content` is a TipTap JSON document; treat it as opaque on the wire.
255
+ */
256
+ GetArticleResponse: {
257
+ id: string;
258
+ venueId: string;
259
+ accessor: string;
260
+ slug: {
261
+ [key: string]: string;
262
+ };
263
+ title: {
264
+ [key: string]: string;
265
+ };
266
+ excerpt: {
267
+ [key: string]: string;
268
+ } | null;
269
+ content: {
270
+ [key: string]: unknown;
271
+ } | null;
272
+ tags: string[];
273
+ featuredImageId: string | null;
274
+ isActive: boolean;
275
+ isFeatured: boolean;
276
+ priority: number;
277
+ publishedAt: unknown;
278
+ createdAt: unknown;
279
+ updatedAt: unknown;
280
+ };
281
+ /** PatchArticleRequest */
282
+ PatchArticleRequest: {
283
+ slug?: {
284
+ [key: string]: string;
285
+ };
286
+ title?: {
287
+ [key: string]: string;
288
+ };
289
+ excerpt?: {
290
+ [key: string]: string;
291
+ };
292
+ content?: {
293
+ [key: string]: unknown;
294
+ };
295
+ tags?: string[];
296
+ featuredImageId?: string | null;
297
+ isActive?: boolean;
298
+ isFeatured?: boolean;
299
+ priority?: number;
300
+ };
301
+ /**
302
+ * PatchArticleResponse
303
+ * @description A venue's article. `content` is a TipTap JSON document; treat it as opaque on the wire.
304
+ */
305
+ PatchArticleResponse: {
306
+ id: string;
307
+ venueId: string;
308
+ accessor: string;
309
+ slug: {
310
+ [key: string]: string;
311
+ };
312
+ title: {
313
+ [key: string]: string;
314
+ };
315
+ excerpt: {
316
+ [key: string]: string;
317
+ } | null;
318
+ content: {
319
+ [key: string]: unknown;
320
+ } | null;
321
+ tags: string[];
322
+ featuredImageId: string | null;
323
+ isActive: boolean;
324
+ isFeatured: boolean;
325
+ priority: number;
326
+ publishedAt: unknown;
327
+ createdAt: unknown;
328
+ updatedAt: unknown;
329
+ };
252
330
  /**
253
331
  * AddToBasketRequest
254
332
  * @description Add an item to the shopping basket
@@ -1097,6 +1175,23 @@ interface components {
1097
1175
  teamOrderId: string;
1098
1176
  deliveryAddressId: string;
1099
1177
  };
1178
+ /**
1179
+ * GetVenueResponse
1180
+ * @description A venue. The public API exposes only the minimal id + accessor + naming + locale fields the CLI's `venues use` / `auth whoami` consume.
1181
+ */
1182
+ GetVenueResponse: {
1183
+ id: string;
1184
+ accessor: string;
1185
+ officialName: string;
1186
+ legalName: string;
1187
+ shortName: string;
1188
+ brandName: string;
1189
+ primaryLocale: string;
1190
+ supportedLocales: string[];
1191
+ timezone: string;
1192
+ createdAt: unknown;
1193
+ updatedAt: unknown;
1194
+ };
1100
1195
  };
1101
1196
  responses: never;
1102
1197
  parameters: never;
@@ -1110,6 +1205,9 @@ type CreateEventRequest = schemas['CreateEventRequest'];
1110
1205
  type CreateEventResponse = schemas['CreateEventResponse'];
1111
1206
  type Article = schemas['Article'];
1112
1207
  type ListArticlesResponse = schemas['ListArticlesResponse'];
1208
+ type GetArticleResponse = schemas['GetArticleResponse'];
1209
+ type PatchArticleRequest = schemas['PatchArticleRequest'];
1210
+ type PatchArticleResponse = schemas['PatchArticleResponse'];
1113
1211
  interface ListArticlesOptions {
1114
1212
  /** Only return articles whose `tags` array contains this value. */
1115
1213
  tag?: string;
@@ -1118,6 +1216,8 @@ interface ListArticlesOptions {
1118
1216
  /** When `true`, include articles whose `isActive` is `false`. Default `false`. */
1119
1217
  includeInactive?: boolean;
1120
1218
  }
1219
+ type Venue = schemas['Venue'];
1220
+ type GetVenueResponse = schemas['GetVenueResponse'];
1121
1221
  /**
1122
1222
  * Order fulfillment type - matches order_fulfillment_type enum in order3000 database.
1123
1223
  * Keep in sync with apps/order3000/src/drizzle/enums.ts
@@ -1907,6 +2007,18 @@ declare class ArticlesResource extends BaseResource {
1907
2007
  * for human-friendly node addressing.
1908
2008
  */
1909
2009
  list(options?: ListArticlesOptions): Promise<ListArticlesResponse>;
2010
+ /**
2011
+ * Fetch a single article by id or accessor within the active venue.
2012
+ * Returns the full row including the TipTap `content` document.
2013
+ */
2014
+ getByAccessor(idOrAccessor: string): Promise<Article>;
2015
+ /**
2016
+ * Partial-update an article. Locale-keyed fields (slug, title, excerpt)
2017
+ * merge at the locale level — `{ slug: { en: 'foo' } }` updates `en`
2018
+ * without touching `de`. Plain scalar / array fields fully replace.
2019
+ * Returns the resulting article.
2020
+ */
2021
+ patch(idOrAccessor: string, body: PatchArticleRequest): Promise<Article>;
1910
2022
  }
1911
2023
 
1912
2024
  declare class BasketsResource extends BaseResource {
@@ -2592,6 +2704,27 @@ declare class TeamOrdersResource {
2592
2704
  }): Promise<UpdateDeliveryAddressResponse>;
2593
2705
  }
2594
2706
 
2707
+ /**
2708
+ * Reads at the venue level. Doesn't extend `BaseResource` because that
2709
+ * class hard-codes a `/venues/{venueId}/<resourcePath>` URL template,
2710
+ * which assumes a venue-scoped sub-resource. Venues themselves are AT
2711
+ * `/venues/:venueIdOrAccessor` directly.
2712
+ */
2713
+ declare class VenuesResource {
2714
+ private readonly tokenManager;
2715
+ private readonly baseUrl;
2716
+ constructor(tokenManager: TokenManager, baseUrl: string);
2717
+ /**
2718
+ * Fetch a venue by its UUID or its accessor (slug). The path accepts
2719
+ * either form; the server resolves transparently.
2720
+ *
2721
+ * Powers the order3000-cli's `venues use <accessor>` validation step
2722
+ * — the CLI hits this to prove the accessor exists and to cache the
2723
+ * resolved UUID + display fields locally.
2724
+ */
2725
+ getByAccessor(idOrAccessor: string): Promise<Venue>;
2726
+ }
2727
+
2595
2728
  type RealtimeEvent = 'INSERT' | 'UPDATE' | 'DELETE' | '*';
2596
2729
  type RealtimeRow = {
2597
2730
  [key: string]: any;
@@ -2763,6 +2896,7 @@ declare class Order3000Client {
2763
2896
  reservations: ReservationsResource;
2764
2897
  subscriptions: SubscriptionsResource;
2765
2898
  teamOrders: TeamOrdersResource;
2899
+ venues: VenuesResource;
2766
2900
  realtime: RealtimeManager;
2767
2901
  private readonly baseUrl;
2768
2902
  private readonly tokenManager;
@@ -2770,4 +2904,4 @@ declare class Order3000Client {
2770
2904
  }
2771
2905
 
2772
2906
  export { Order3000Client, fulfillmentTypeEnum, getScheduleInfo, participantStatusEnum, paymentMethodEnum, teamOrderStatusEnum };
2773
- export type { AddToBasketRequest, AddToBasketResponse, Area, AreaAsset, AreaAvailabilityResponse, AreaAvailabilityWindow, AreaBookingMode, AreaBookingRequestResponse, AreaBookingRequestSource, AreaBookingRequestStatus, AreaBookingStatus, AreaFeature, Article, Basket, BasketItem, BasketItemDeposit, BasketItemMenuItemRef, BasketItemMetadata, BasketStatus, BasketTotals, CancelTeamOrderResponse, ConfirmOrderRequest, ConfirmOrderResponse, CreateDeltaPaymentIntentRequest, CreateDeltaPaymentIntentResponse, CreatePaymentIntentRequest, CreatePaymentIntentResponse, CreateTeamOrderRequest, CreateTeamOrderResponse, CropArea, Currency, DayOfWeek, DeclaredReturn, Event, EventByAccessor, EventMenu, EventPoster, EventRow, ExtendDeadlineResponse as ExtendTeamOrderDeadlineResponse, FetchTeamOrderResponse, GetAreaAvailabilityOptions, GetAreaOptions, GetEventOptions, GetMenuOptions, JoinTeamOrderRequest, JoinTeamOrderResponse, LatestOrder, ListArticlesOptions, ListArticlesResponse, ListEventsOptions, ListEventsResponse, Menu, MenuAsset, MenuBeverage, MenuBundle, MenuBundleDeposit, MenuDish, MenuItem, MenuItemRow, MenuItemType, MenuSubscription, MenuSubscriptionPoster, Order3000ClientConfig, OrderFulfillmentType, OrderStatus, PaymentStatus, PlaceOrderRequest, Promotion, RealtimeConfig, RealtimeEvent, RealtimeSubscription, RemoveFromBasketResponse, Schedule, ScheduleInfo, ScheduleOverride, ScheduleOverrideRow, ScheduleRow, ScheduleTimeSlot, ScheduleWithTimeSlots, SubmitAreaBookingRequestPayload, SubmitTeamOrderResponse, SubscribeRequest, SubscribeResponse, SubscriberStatus, SubscriptionCredit, SubscriptionCreditStatus, SubscriptionOptions, SubscriptionPeriod, SwitchFulfillmentResponse as SwitchTeamOrderFulfillmentResponse, TeamDeliveryAddress, TeamOrderBasketItem, TeamOrderBasketItemMenuItemRef, FulfillmentType as TeamOrderFulfillmentType, TeamOrderParticipant, ParticipantStatus as TeamOrderParticipantStatus, PaymentMethod as TeamOrderPaymentMethod, TeamOrderStatus, ThresholdCheck as TeamOrderThresholdCheck, TimeSlot, Unit, UpdateDeliveryAddressResponse as UpdateTeamOrderDeliveryAddressResponse };
2907
+ export type { AddToBasketRequest, AddToBasketResponse, Area, AreaAsset, AreaAvailabilityResponse, AreaAvailabilityWindow, AreaBookingMode, AreaBookingRequestResponse, AreaBookingRequestSource, AreaBookingRequestStatus, AreaBookingStatus, AreaFeature, Article, Basket, BasketItem, BasketItemDeposit, BasketItemMenuItemRef, BasketItemMetadata, BasketStatus, BasketTotals, CancelTeamOrderResponse, ConfirmOrderRequest, ConfirmOrderResponse, CreateDeltaPaymentIntentRequest, CreateDeltaPaymentIntentResponse, CreatePaymentIntentRequest, CreatePaymentIntentResponse, CreateTeamOrderRequest, CreateTeamOrderResponse, CropArea, Currency, DayOfWeek, DeclaredReturn, Event, EventByAccessor, EventMenu, EventPoster, EventRow, ExtendDeadlineResponse as ExtendTeamOrderDeadlineResponse, FetchTeamOrderResponse, GetAreaAvailabilityOptions, GetAreaOptions, GetArticleResponse, GetEventOptions, GetMenuOptions, GetVenueResponse, JoinTeamOrderRequest, JoinTeamOrderResponse, LatestOrder, ListArticlesOptions, ListArticlesResponse, ListEventsOptions, ListEventsResponse, Menu, MenuAsset, MenuBeverage, MenuBundle, MenuBundleDeposit, MenuDish, MenuItem, MenuItemRow, MenuItemType, MenuSubscription, MenuSubscriptionPoster, Order3000ClientConfig, OrderFulfillmentType, OrderStatus, PatchArticleRequest, PatchArticleResponse, PaymentStatus, PlaceOrderRequest, Promotion, RealtimeConfig, RealtimeEvent, RealtimeSubscription, RemoveFromBasketResponse, Schedule, ScheduleInfo, ScheduleOverride, ScheduleOverrideRow, ScheduleRow, ScheduleTimeSlot, ScheduleWithTimeSlots, SubmitAreaBookingRequestPayload, SubmitTeamOrderResponse, SubscribeRequest, SubscribeResponse, SubscriberStatus, SubscriptionCredit, SubscriptionCreditStatus, SubscriptionOptions, SubscriptionPeriod, SwitchFulfillmentResponse as SwitchTeamOrderFulfillmentResponse, TeamDeliveryAddress, TeamOrderBasketItem, TeamOrderBasketItemMenuItemRef, FulfillmentType as TeamOrderFulfillmentType, TeamOrderParticipant, ParticipantStatus as TeamOrderParticipantStatus, PaymentMethod as TeamOrderPaymentMethod, TeamOrderStatus, ThresholdCheck as TeamOrderThresholdCheck, TimeSlot, Unit, UpdateDeliveryAddressResponse as UpdateTeamOrderDeliveryAddressResponse, Venue };
package/dist/client.mjs CHANGED
@@ -209,6 +209,26 @@ class ArticlesResource extends BaseResource {
209
209
  const path = qs ? `?${qs}` : "";
210
210
  return this.request("GET", path);
211
211
  }
212
+ /**
213
+ * Fetch a single article by id or accessor within the active venue.
214
+ * Returns the full row including the TipTap `content` document.
215
+ */
216
+ async getByAccessor(idOrAccessor) {
217
+ return this.request("GET", `/${encodeURIComponent(idOrAccessor)}`);
218
+ }
219
+ /**
220
+ * Partial-update an article. Locale-keyed fields (slug, title, excerpt)
221
+ * merge at the locale level — `{ slug: { en: 'foo' } }` updates `en`
222
+ * without touching `de`. Plain scalar / array fields fully replace.
223
+ * Returns the resulting article.
224
+ */
225
+ async patch(idOrAccessor, body) {
226
+ return this.request(
227
+ "PATCH",
228
+ `/${encodeURIComponent(idOrAccessor)}`,
229
+ body
230
+ );
231
+ }
212
232
  }
213
233
 
214
234
  class BasketsResource extends BaseResource {
@@ -794,6 +814,44 @@ class TeamOrdersResource {
794
814
  }
795
815
  }
796
816
 
817
+ class VenuesResource {
818
+ constructor(tokenManager, baseUrl) {
819
+ this.tokenManager = tokenManager;
820
+ this.baseUrl = baseUrl;
821
+ }
822
+ /**
823
+ * Fetch a venue by its UUID or its accessor (slug). The path accepts
824
+ * either form; the server resolves transparently.
825
+ *
826
+ * Powers the order3000-cli's `venues use <accessor>` validation step
827
+ * — the CLI hits this to prove the accessor exists and to cache the
828
+ * resolved UUID + display fields locally.
829
+ */
830
+ async getByAccessor(idOrAccessor) {
831
+ const token = await this.tokenManager.getToken();
832
+ const url = `${this.baseUrl}/venues/${encodeURIComponent(idOrAccessor)}`;
833
+ const response = await fetch(url, {
834
+ method: "GET",
835
+ headers: {
836
+ Authorization: `Bearer ${token}`,
837
+ "Content-Type": "application/json"
838
+ },
839
+ cache: "no-store"
840
+ });
841
+ if (!response.ok) {
842
+ let body = "";
843
+ try {
844
+ body = await response.text();
845
+ } catch {
846
+ }
847
+ throw new Error(
848
+ `HTTP ${response.status}: ${response.statusText}${body ? ` \u2014 ${body}` : ""}`
849
+ );
850
+ }
851
+ return response.json();
852
+ }
853
+ }
854
+
797
855
  var __defProp$2 = Object.defineProperty;
798
856
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
799
857
  var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1128,6 +1186,7 @@ class Order3000Client {
1128
1186
  __publicField(this, "reservations");
1129
1187
  __publicField(this, "subscriptions");
1130
1188
  __publicField(this, "teamOrders");
1189
+ __publicField(this, "venues");
1131
1190
  __publicField(this, "realtime");
1132
1191
  __publicField(this, "baseUrl");
1133
1192
  __publicField(this, "tokenManager");
@@ -1158,6 +1217,7 @@ class Order3000Client {
1158
1217
  this.baseUrl
1159
1218
  );
1160
1219
  this.teamOrders = new TeamOrdersResource(this.tokenManager, this.baseUrl);
1220
+ this.venues = new VenuesResource(this.tokenManager, this.baseUrl);
1161
1221
  this.realtime = new RealtimeManager(this.tokenManager, this.baseUrl);
1162
1222
  }
1163
1223
  }
package/dist/schemas.cjs CHANGED
@@ -9,8 +9,11 @@ const GetAreaAvailabilityResponse = zod.z.object({ from: zod.z.string().regex(/^
9
9
  const SubmitAreaBookingRequest = zod.z.object({ requestedDate: zod.z.string().regex(/^\d{4}-\d{2}-\d{2}$/), requestedStartTime: zod.z.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).optional(), requestedEndTime: zod.z.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).optional(), partySize: zod.z.number().int().lte(9007199254740991), customerFirstName: zod.z.string().min(1), customerLastName: zod.z.string().min(1), customerEmail: zod.z.string().regex(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/).email(), customerPhone: zod.z.string().optional(), message: zod.z.string().optional(), source: zod.z.enum(["website", "phone", "walk_in"]).optional() }).strict();
10
10
  const SubmitAreaBookingResponse = zod.z.object({ id: zod.z.string(), venueId: zod.z.string(), areaId: zod.z.string(), requestedDate: zod.z.string().regex(/^\d{4}-\d{2}-\d{2}$/), requestedStartTime: zod.z.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).nullable(), requestedEndTime: zod.z.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).nullable(), partySize: zod.z.number().int().gte(-9007199254740991).lte(9007199254740991), customerFirstName: zod.z.string(), customerLastName: zod.z.string(), customerEmail: zod.z.string(), customerPhone: zod.z.string().nullable(), message: zod.z.string().nullable(), source: zod.z.enum(["website", "phone", "walk_in"]), status: zod.z.enum(["pending", "approved", "rejected", "cancelled"]), areaBookingId: zod.z.string().nullable(), createdAt: zod.z.string().nullable(), updatedAt: zod.z.string().nullable() }).strict();
11
11
  const includeDrafts = zod.z.union([zod.z.literal("true"), zod.z.literal("false")]).optional();
12
- const Article = zod.z.object({ id: zod.z.string(), venueId: zod.z.string(), accessor: zod.z.string(), slug: zod.z.record(zod.z.string()), title: zod.z.record(zod.z.string()), excerpt: zod.z.record(zod.z.string()), content: zod.z.object({}).partial().strict().passthrough(), tags: zod.z.array(zod.z.string()), featuredImageId: zod.z.string().nullable(), isActive: zod.z.boolean(), isFeatured: zod.z.boolean(), priority: zod.z.number().int().gte(-9007199254740991).lte(9007199254740991), publishedAt: zod.z.string().nullable(), createdAt: zod.z.string().nullable(), updatedAt: zod.z.string().nullable() }).strict();
12
+ const Article = zod.z.object({ id: zod.z.string(), venueId: zod.z.string(), accessor: zod.z.string(), slug: zod.z.record(zod.z.string()), title: zod.z.record(zod.z.string()), excerpt: zod.z.record(zod.z.string()).nullable(), content: zod.z.object({}).partial().strict().passthrough().nullable(), tags: zod.z.array(zod.z.string()), featuredImageId: zod.z.string().nullable(), isActive: zod.z.boolean(), isFeatured: zod.z.boolean(), priority: zod.z.number().int().gte(-2147483648).lte(2147483647), publishedAt: zod.z.unknown().nullable(), createdAt: zod.z.unknown().nullable(), updatedAt: zod.z.unknown().nullable() }).strict();
13
13
  const ListArticlesResponse = zod.z.array(Article);
14
+ const GetArticleResponse = zod.z.object({ id: zod.z.string(), venueId: zod.z.string(), accessor: zod.z.string(), slug: zod.z.record(zod.z.string()), title: zod.z.record(zod.z.string()), excerpt: zod.z.record(zod.z.string()).nullable(), content: zod.z.object({}).partial().strict().passthrough().nullable(), tags: zod.z.array(zod.z.string()), featuredImageId: zod.z.string().nullable(), isActive: zod.z.boolean(), isFeatured: zod.z.boolean(), priority: zod.z.number().int().gte(-2147483648).lte(2147483647), publishedAt: zod.z.unknown().nullable(), createdAt: zod.z.unknown().nullable(), updatedAt: zod.z.unknown().nullable() }).strict();
15
+ const PatchArticleRequest = zod.z.object({ slug: zod.z.record(zod.z.string()), title: zod.z.record(zod.z.string()), excerpt: zod.z.record(zod.z.string()), content: zod.z.object({}).partial().strict().passthrough(), tags: zod.z.array(zod.z.string()), featuredImageId: zod.z.string().nullable(), isActive: zod.z.boolean(), isFeatured: zod.z.boolean(), priority: zod.z.number().int().gte(-9007199254740991).lte(9007199254740991) }).partial().strict();
16
+ const PatchArticleResponse = zod.z.object({ id: zod.z.string(), venueId: zod.z.string(), accessor: zod.z.string(), slug: zod.z.record(zod.z.string()), title: zod.z.record(zod.z.string()), excerpt: zod.z.record(zod.z.string()).nullable(), content: zod.z.object({}).partial().strict().passthrough().nullable(), tags: zod.z.array(zod.z.string()), featuredImageId: zod.z.string().nullable(), isActive: zod.z.boolean(), isFeatured: zod.z.boolean(), priority: zod.z.number().int().gte(-2147483648).lte(2147483647), publishedAt: zod.z.unknown().nullable(), createdAt: zod.z.unknown().nullable(), updatedAt: zod.z.unknown().nullable() }).strict();
14
17
  const AddToBasketRequest = zod.z.object({ venueId: zod.z.string().regex(/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/).uuid(), sessionId: zod.z.string().min(1), menuItems: zod.z.array(zod.z.object({ menuItemId: zod.z.string().min(1), role: zod.z.string().optional(), quantity: zod.z.number().gt(0).optional(), unit: zod.z.enum(["grams", "kilograms", "liters", "milliliters", "pieces"]).optional() }).strict()).min(1), metadata: zod.z.object({}).partial().strict().passthrough().optional() }).strict();
15
18
  const AddToBasketResponse = zod.z.object({ basketItemId: zod.z.string().regex(/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/).uuid(), itemCount: zod.z.number().int().gte(0).lte(9007199254740991), deposit: zod.z.object({ depositwareTemplateId: zod.z.string(), name: zod.z.record(zod.z.string()), amount: zod.z.number().int().gte(0).lte(9007199254740991), currency: zod.z.enum(["EUR", "CHF"]) }).strict().nullable(), totals: zod.z.object({ currency: zod.z.enum(["EUR", "CHF"]), itemsTotal: zod.z.number().int().gte(0).lte(9007199254740991), taxAmount: zod.z.number().int().gte(0).lte(9007199254740991), depositCharge: zod.z.number().int().gte(0).lte(9007199254740991), grossTotal: zod.z.number().int().gte(0).lte(9007199254740991), depositCredit: zod.z.number().int().gte(0).lte(9007199254740991), effectiveTotal: zod.z.number().int().gte(0).lte(9007199254740991), cashRefund: zod.z.number().int().gte(0).lte(9007199254740991), returnable: zod.z.array(zod.z.object({ depositwareTemplateId: zod.z.string(), count: zod.z.number().int().gte(0).lte(9007199254740991) }).strict()) }).strict() }).strict();
16
19
  const RemoveFromBasketResponse = zod.z.object({ success: zod.z.boolean(), basketItemId: zod.z.string().regex(/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/).uuid(), itemCount: zod.z.number().int().gte(0).lte(9007199254740991), totals: zod.z.object({ currency: zod.z.enum(["EUR", "CHF"]), itemsTotal: zod.z.number().int().gte(0).lte(9007199254740991), taxAmount: zod.z.number().int().gte(0).lte(9007199254740991), depositCharge: zod.z.number().int().gte(0).lte(9007199254740991), grossTotal: zod.z.number().int().gte(0).lte(9007199254740991), depositCredit: zod.z.number().int().gte(0).lte(9007199254740991), effectiveTotal: zod.z.number().int().gte(0).lte(9007199254740991), cashRefund: zod.z.number().int().gte(0).lte(9007199254740991), returnable: zod.z.array(zod.z.object({ depositwareTemplateId: zod.z.string(), count: zod.z.number().int().gte(0).lte(9007199254740991) }).strict()) }).strict().nullable() }).strict();
@@ -62,6 +65,7 @@ const SwitchFulfillmentTeamOrderRequest = zod.z.object({ publicId: zod.z.string(
62
65
  const SwitchFulfillmentTeamOrderResponse = zod.z.object({ teamOrderId: zod.z.string().regex(/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/).uuid(), status: zod.z.enum(["draft", "collecting", "locked", "placed", "ready", "completed", "cancelled"]), fulfillmentType: zod.z.enum(["pickup", "delivery"]), deliveryAddressId: zod.z.string().nullable() }).strict();
63
66
  const UpdateDeliveryAddressTeamOrderRequest = zod.z.object({ publicId: zod.z.string().min(1), sessionId: zod.z.string().min(1), deliveryAddress: zod.z.object({ street: zod.z.string(), city: zod.z.string(), state: zod.z.string(), postalCode: zod.z.string(), country: zod.z.string() }).strict() }).strict();
64
67
  const UpdateDeliveryAddressTeamOrderResponse = zod.z.object({ teamOrderId: zod.z.string().regex(/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/).uuid(), deliveryAddressId: zod.z.string() }).strict();
68
+ const GetVenueResponse = zod.z.object({ id: zod.z.string(), accessor: zod.z.string(), officialName: zod.z.string(), legalName: zod.z.string(), shortName: zod.z.string(), brandName: zod.z.string(), primaryLocale: zod.z.string(), supportedLocales: zod.z.array(zod.z.string()), timezone: zod.z.string(), createdAt: zod.z.unknown().nullable(), updatedAt: zod.z.unknown().nullable() }).strict();
65
69
  const schemas = {
66
70
  Area,
67
71
  ListAreasResponse,
@@ -72,6 +76,9 @@ const schemas = {
72
76
  includeDrafts,
73
77
  Article,
74
78
  ListArticlesResponse,
79
+ GetArticleResponse,
80
+ PatchArticleRequest,
81
+ PatchArticleResponse,
75
82
  AddToBasketRequest,
76
83
  AddToBasketResponse,
77
84
  RemoveFromBasketResponse,
@@ -122,7 +129,8 @@ const schemas = {
122
129
  SwitchFulfillmentTeamOrderRequest,
123
130
  SwitchFulfillmentTeamOrderResponse,
124
131
  UpdateDeliveryAddressTeamOrderRequest,
125
- UpdateDeliveryAddressTeamOrderResponse
132
+ UpdateDeliveryAddressTeamOrderResponse,
133
+ GetVenueResponse
126
134
  };
127
135
 
128
136
  exports.schemas = schemas;