order3000 1.2.0 → 1.3.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
@@ -116,13 +116,9 @@ class BaseResource {
116
116
  "Content-Type": "application/json"
117
117
  },
118
118
  body: data ? JSON.stringify(data) : void 0,
119
- signal: AbortSignal.timeout(36e4)
119
+ signal: AbortSignal.timeout(36e4),
120
+ cache: cacheOptions?.cache ?? "no-store"
120
121
  };
121
- if (cacheOptions?.next !== void 0) {
122
- init.next = cacheOptions.next;
123
- } else {
124
- init.cache = cacheOptions?.cache ?? "no-store";
125
- }
126
122
  const response = await fetch(url, init);
127
123
  if (!response.ok) {
128
124
  let body = "";
@@ -247,11 +243,12 @@ class AreasResource extends BaseResource {
247
243
  return this.request("GET", queryString);
248
244
  }
249
245
  /**
250
- * Fetch a single area by id or accessor.
246
+ * Fetch a single area by id or accessor. The server resolves either
247
+ * form transparently.
251
248
  */
252
- async getByAccessor(accessor, options) {
249
+ async get(idOrAccessor, options) {
253
250
  const queryString = this.buildExpandQuery(options?.expand);
254
- return this.request("GET", `/${accessor}${queryString}`);
251
+ return this.request("GET", `/${idOrAccessor}${queryString}`);
255
252
  }
256
253
  /**
257
254
  * List occupied date/time windows for an area between `from` and `to`.
@@ -312,9 +309,10 @@ class ArticlesResource extends BaseResource {
312
309
  }
313
310
  /**
314
311
  * Fetch a single article by id or accessor within the active venue.
315
- * Returns the full row including the TipTap `content` document.
312
+ * The server resolves either form transparently. Returns the full row
313
+ * including the TipTap `content` document.
316
314
  */
317
- async getByAccessor(idOrAccessor) {
315
+ async get(idOrAccessor) {
318
316
  return this.request("GET", `/${encodeURIComponent(idOrAccessor)}`);
319
317
  }
320
318
  /**
@@ -543,27 +541,15 @@ class EventsResource extends BaseResource {
543
541
  return this.request("POST", "", event);
544
542
  }
545
543
  /**
546
- * Get a single event by ID
547
- * @param eventId - The event ID
548
- * @returns The event details
549
- */
550
- async get(eventId) {
551
- return this.request("GET", `/${eventId}`);
552
- }
553
- /**
554
- * Get an event by accessor (slug)
555
- * @param accessor - The event accessor (e.g., 'lunch-menu')
544
+ * Get a single event by id or accessor (slug), with optional `expand`
545
+ * parts. The server resolves either form transparently.
546
+ * @param idOrAccessor - The event UUID or accessor (e.g., 'lunch-menu')
556
547
  * @param options - Optional expand options
557
548
  * @returns The event with optional schedule, timeSlots, menus, and posters
558
549
  */
559
- async getByAccessor(accessor, options) {
550
+ async get(idOrAccessor, options) {
560
551
  const queryString = this.buildQueryString(options);
561
- return this.request(
562
- "GET",
563
- `/${accessor}${queryString}`,
564
- void 0,
565
- { next: { revalidate: 2700 } }
566
- );
552
+ return this.request("GET", `/${idOrAccessor}${queryString}`);
567
553
  }
568
554
  buildQueryString(options) {
569
555
  if (!options?.expand?.length) return "";
@@ -596,11 +582,11 @@ class EventsResource extends BaseResource {
596
582
  }
597
583
  /**
598
584
  * List the posters attached to an event. Convenience over
599
- * `getByAccessor(idOrAccessor, { expand: ['posters'] })` — returns the
585
+ * `get(idOrAccessor, { expand: ['posters'] })` — returns the
600
586
  * `posters[]` array (empty when the event has none).
601
587
  */
602
588
  async listPosters(idOrAccessor) {
603
- const event = await this.getByAccessor(idOrAccessor, {
589
+ const event = await this.get(idOrAccessor, {
604
590
  expand: ["posters"]
605
591
  });
606
592
  return event.posters ?? [];
@@ -641,24 +627,15 @@ class MenusResource extends BaseResource {
641
627
  super(tokenManager, baseUrl, "/menus");
642
628
  }
643
629
  /**
644
- * Get a menu by ID
645
- * @param id - The menu UUID
630
+ * Get a menu by id or accessor (slug), with optional `expand` parts.
631
+ * The server resolves either form transparently.
632
+ * @param idOrAccessor - The menu UUID or accessor (slug)
646
633
  * @param options - Optional expand options
647
634
  * @returns The menu with optional items and assets
648
635
  */
649
- async get(id, options) {
636
+ async get(idOrAccessor, options) {
650
637
  const queryString = this.buildQueryString(options);
651
- return this.request("GET", `/${id}${queryString}`);
652
- }
653
- /**
654
- * Get a menu by accessor
655
- * @param accessor - The menu accessor (slug)
656
- * @param options - Optional expand options
657
- * @returns The menu with optional items and assets
658
- */
659
- async getByAccessor(accessor, options) {
660
- const queryString = this.buildQueryString(options);
661
- return this.request("GET", `/${accessor}${queryString}`);
638
+ return this.request("GET", `/${idOrAccessor}${queryString}`);
662
639
  }
663
640
  /**
664
641
  * Get all bundles for a menu
@@ -787,20 +764,13 @@ class SubscriptionsResource extends BaseResource {
787
764
  super(tokenManager, baseUrl, "/subscriptions");
788
765
  }
789
766
  /**
790
- * Get a subscription by ID
791
- * @param id - The subscription UUID
792
- * @returns The subscription with posters
793
- */
794
- async get(id) {
795
- return this.request("GET", `/${id}`);
796
- }
797
- /**
798
- * Get a subscription by accessor
799
- * @param accessor - The subscription accessor (slug)
767
+ * Get a subscription by id or accessor (slug). The server resolves
768
+ * either form transparently.
769
+ * @param idOrAccessor - The subscription UUID or accessor (slug)
800
770
  * @returns The subscription with posters
801
771
  */
802
- async getByAccessor(accessor) {
803
- return this.request("GET", `/${accessor}`);
772
+ async get(idOrAccessor) {
773
+ return this.request("GET", `/${idOrAccessor}`);
804
774
  }
805
775
  /**
806
776
  * Subscribe a customer to a subscription plan via Stripe Checkout
@@ -1053,7 +1023,7 @@ class VenuesResource {
1053
1023
  * — the CLI hits this to prove the accessor exists and to cache the
1054
1024
  * resolved UUID + display fields locally.
1055
1025
  */
1056
- async getByAccessor(idOrAccessor) {
1026
+ async get(idOrAccessor) {
1057
1027
  const token = await this.tokenManager.getToken();
1058
1028
  const url = `${this.baseUrl}/venues/${encodeURIComponent(idOrAccessor)}`;
1059
1029
  const response = await fetch(url, {
package/dist/client.d.cts CHANGED
@@ -30,21 +30,20 @@ declare class TokenManager {
30
30
  }
31
31
 
32
32
  /**
33
- * Per-call cache override. Default behaviour is `cache: 'no-store'`
33
+ * Per-call cache override. SDK reads are uniformly `cache: 'no-store'`
34
34
  * — correct for live-read endpoints (basket, team-order, payment
35
35
  * intents) where any caching causes stale responses against realtime
36
- * mutations. Resources that surface near-static data consumed during
37
- * static generation (e.g. `events.getByAccessor` for the Tiffinbox
38
- * event schedule) can override with `next: { revalidate: N }` so
39
- * Next.js can pre-render the calling page during the build instead
40
- * of bailing out to dynamic rendering with `DYNAMIC_SERVER_USAGE`.
36
+ * mutations. No SDK method bakes in ISR: apps that consume near-static
37
+ * data during static generation own caching at the call site by
38
+ * wrapping the SDK call in Next.js `unstable_cache(fn, key, { revalidate })`
39
+ * (e.g. thamarai's `getTiffinBoxEvent` / `getALaCarteMenu`), which is
40
+ * what lets Next.js pre-render the page during the build instead of
41
+ * bailing out to dynamic rendering with `DYNAMIC_SERVER_USAGE`. The
42
+ * `cache` field below remains only as a per-call escape hatch for the
43
+ * rare reader that needs a non-default `RequestCache` value.
41
44
  */
42
45
  interface RequestCacheOptions {
43
46
  cache?: RequestCache;
44
- next?: {
45
- revalidate?: number | false;
46
- tags?: string[];
47
- };
48
47
  }
49
48
  declare abstract class BaseResource {
50
49
  protected readonly tokenManager: TokenManager;
@@ -2556,18 +2555,18 @@ interface GetMenuOptions {
2556
2555
  type MenuBundle = schemas['FetchMenuBundlesResponse'][number];
2557
2556
  type MenuBundleDeposit = NonNullable<MenuBundle['deposit']>;
2558
2557
  /**
2559
- * A single event as returned by the `getByAccessor` endpoint, with
2558
+ * A single event as returned by the `events.get` endpoint, with
2560
2559
  * optional schedule / menus / posters expansions. Generated-bound to the
2561
2560
  * `FetchEventResponse` component (the order3000 `fetchEvent` output
2562
2561
  * schema is now precise) — request-shape drift is impossible.
2563
2562
  */
2564
2563
  type EventByAccessor = schemas['FetchEventResponse'];
2565
2564
  /**
2566
- * The `getByAccessor` event's schedule sub-object, including the optional
2565
+ * The fetched event's schedule sub-object, including the optional
2567
2566
  * `scheduleTimeSlots[]` expansion. Generated-bound to the non-null
2568
2567
  * `schedule` on `FetchEventResponse`. Kept as a distinct public SDK type
2569
2568
  * name (re-exported as `O3KScheduleWithTimeSlots`) for downstream
2570
- * stability; structurally it is the by-accessor schedule shape.
2569
+ * stability; structurally it is the single-event-fetch schedule shape.
2571
2570
  */
2572
2571
  type ScheduleWithTimeSlots = NonNullable<EventByAccessor['schedule']>;
2573
2572
  /**
@@ -2767,9 +2766,10 @@ declare class AreasResource extends BaseResource {
2767
2766
  */
2768
2767
  list(options?: GetAreaOptions): Promise<Area[]>;
2769
2768
  /**
2770
- * Fetch a single area by id or accessor.
2769
+ * Fetch a single area by id or accessor. The server resolves either
2770
+ * form transparently.
2771
2771
  */
2772
- getByAccessor(accessor: string, options?: GetAreaOptions): Promise<Area>;
2772
+ get(idOrAccessor: string, options?: GetAreaOptions): Promise<Area>;
2773
2773
  /**
2774
2774
  * List occupied date/time windows for an area between `from` and `to`.
2775
2775
  */
@@ -2796,9 +2796,10 @@ declare class ArticlesResource extends BaseResource {
2796
2796
  list(options?: ListArticlesOptions): Promise<ListArticlesResponse>;
2797
2797
  /**
2798
2798
  * Fetch a single article by id or accessor within the active venue.
2799
- * Returns the full row including the TipTap `content` document.
2799
+ * The server resolves either form transparently. Returns the full row
2800
+ * including the TipTap `content` document.
2800
2801
  */
2801
- getByAccessor(idOrAccessor: string): Promise<Article>;
2802
+ get(idOrAccessor: string): Promise<Article>;
2802
2803
  /**
2803
2804
  * Partial-update an article. Locale-keyed fields (slug, title, excerpt)
2804
2805
  * merge at the locale level — `{ slug: { en: 'foo' } }` updates `en`
@@ -2936,18 +2937,13 @@ declare class EventsResource extends BaseResource {
2936
2937
  */
2937
2938
  place(event: CreateEventRequest): Promise<CreateEventResponse>;
2938
2939
  /**
2939
- * Get a single event by ID
2940
- * @param eventId - The event ID
2941
- * @returns The event details
2942
- */
2943
- get(eventId: string): Promise<Event>;
2944
- /**
2945
- * Get an event by accessor (slug)
2946
- * @param accessor - The event accessor (e.g., 'lunch-menu')
2940
+ * Get a single event by id or accessor (slug), with optional `expand`
2941
+ * parts. The server resolves either form transparently.
2942
+ * @param idOrAccessor - The event UUID or accessor (e.g., 'lunch-menu')
2947
2943
  * @param options - Optional expand options
2948
2944
  * @returns The event with optional schedule, timeSlots, menus, and posters
2949
2945
  */
2950
- getByAccessor(accessor: string, options?: GetEventOptions): Promise<EventByAccessor>;
2946
+ get(idOrAccessor: string, options?: GetEventOptions): Promise<EventByAccessor>;
2951
2947
  private buildQueryString;
2952
2948
  /**
2953
2949
  * Partial-update an event by id or accessor. Every body field is
@@ -2965,7 +2961,7 @@ declare class EventsResource extends BaseResource {
2965
2961
  delete(idOrAccessor: string): Promise<DeleteEventResponse>;
2966
2962
  /**
2967
2963
  * List the posters attached to an event. Convenience over
2968
- * `getByAccessor(idOrAccessor, { expand: ['posters'] })` — returns the
2964
+ * `get(idOrAccessor, { expand: ['posters'] })` — returns the
2969
2965
  * `posters[]` array (empty when the event has none).
2970
2966
  */
2971
2967
  listPosters(idOrAccessor: string): Promise<EventPosterEntry[]>;
@@ -2988,19 +2984,13 @@ declare class EventsResource extends BaseResource {
2988
2984
  declare class MenusResource extends BaseResource {
2989
2985
  constructor(tokenManager: TokenManager, baseUrl: string);
2990
2986
  /**
2991
- * Get a menu by ID
2992
- * @param id - The menu UUID
2993
- * @param options - Optional expand options
2994
- * @returns The menu with optional items and assets
2995
- */
2996
- get(id: string, options?: GetMenuOptions): Promise<Menu>;
2997
- /**
2998
- * Get a menu by accessor
2999
- * @param accessor - The menu accessor (slug)
2987
+ * Get a menu by id or accessor (slug), with optional `expand` parts.
2988
+ * The server resolves either form transparently.
2989
+ * @param idOrAccessor - The menu UUID or accessor (slug)
3000
2990
  * @param options - Optional expand options
3001
2991
  * @returns The menu with optional items and assets
3002
2992
  */
3003
- getByAccessor(accessor: string, options?: GetMenuOptions): Promise<Menu>;
2993
+ get(idOrAccessor: string, options?: GetMenuOptions): Promise<Menu>;
3004
2994
  /**
3005
2995
  * Get all bundles for a menu
3006
2996
  * @param menuIdOrAccessor - The menu UUID or accessor (slug)
@@ -3089,17 +3079,12 @@ declare class ReservationsResource extends BaseResource {
3089
3079
  declare class SubscriptionsResource extends BaseResource {
3090
3080
  constructor(tokenManager: TokenManager, baseUrl: string);
3091
3081
  /**
3092
- * Get a subscription by ID
3093
- * @param id - The subscription UUID
3094
- * @returns The subscription with posters
3095
- */
3096
- get(id: string): Promise<MenuSubscription>;
3097
- /**
3098
- * Get a subscription by accessor
3099
- * @param accessor - The subscription accessor (slug)
3082
+ * Get a subscription by id or accessor (slug). The server resolves
3083
+ * either form transparently.
3084
+ * @param idOrAccessor - The subscription UUID or accessor (slug)
3100
3085
  * @returns The subscription with posters
3101
3086
  */
3102
- getByAccessor(accessor: string): Promise<MenuSubscription>;
3087
+ get(idOrAccessor: string): Promise<MenuSubscription>;
3103
3088
  /**
3104
3089
  * Subscribe a customer to a subscription plan via Stripe Checkout
3105
3090
  * @param subscriptionIdOrAccessor - The subscription UUID or accessor
@@ -3631,7 +3616,7 @@ declare class VenuesResource {
3631
3616
  * — the CLI hits this to prove the accessor exists and to cache the
3632
3617
  * resolved UUID + display fields locally.
3633
3618
  */
3634
- getByAccessor(idOrAccessor: string): Promise<Venue>;
3619
+ get(idOrAccessor: string): Promise<Venue>;
3635
3620
  }
3636
3621
 
3637
3622
  type RealtimeEvent = 'INSERT' | 'UPDATE' | 'DELETE' | '*';
package/dist/client.d.mts CHANGED
@@ -30,21 +30,20 @@ declare class TokenManager {
30
30
  }
31
31
 
32
32
  /**
33
- * Per-call cache override. Default behaviour is `cache: 'no-store'`
33
+ * Per-call cache override. SDK reads are uniformly `cache: 'no-store'`
34
34
  * — correct for live-read endpoints (basket, team-order, payment
35
35
  * intents) where any caching causes stale responses against realtime
36
- * mutations. Resources that surface near-static data consumed during
37
- * static generation (e.g. `events.getByAccessor` for the Tiffinbox
38
- * event schedule) can override with `next: { revalidate: N }` so
39
- * Next.js can pre-render the calling page during the build instead
40
- * of bailing out to dynamic rendering with `DYNAMIC_SERVER_USAGE`.
36
+ * mutations. No SDK method bakes in ISR: apps that consume near-static
37
+ * data during static generation own caching at the call site by
38
+ * wrapping the SDK call in Next.js `unstable_cache(fn, key, { revalidate })`
39
+ * (e.g. thamarai's `getTiffinBoxEvent` / `getALaCarteMenu`), which is
40
+ * what lets Next.js pre-render the page during the build instead of
41
+ * bailing out to dynamic rendering with `DYNAMIC_SERVER_USAGE`. The
42
+ * `cache` field below remains only as a per-call escape hatch for the
43
+ * rare reader that needs a non-default `RequestCache` value.
41
44
  */
42
45
  interface RequestCacheOptions {
43
46
  cache?: RequestCache;
44
- next?: {
45
- revalidate?: number | false;
46
- tags?: string[];
47
- };
48
47
  }
49
48
  declare abstract class BaseResource {
50
49
  protected readonly tokenManager: TokenManager;
@@ -2556,18 +2555,18 @@ interface GetMenuOptions {
2556
2555
  type MenuBundle = schemas['FetchMenuBundlesResponse'][number];
2557
2556
  type MenuBundleDeposit = NonNullable<MenuBundle['deposit']>;
2558
2557
  /**
2559
- * A single event as returned by the `getByAccessor` endpoint, with
2558
+ * A single event as returned by the `events.get` endpoint, with
2560
2559
  * optional schedule / menus / posters expansions. Generated-bound to the
2561
2560
  * `FetchEventResponse` component (the order3000 `fetchEvent` output
2562
2561
  * schema is now precise) — request-shape drift is impossible.
2563
2562
  */
2564
2563
  type EventByAccessor = schemas['FetchEventResponse'];
2565
2564
  /**
2566
- * The `getByAccessor` event's schedule sub-object, including the optional
2565
+ * The fetched event's schedule sub-object, including the optional
2567
2566
  * `scheduleTimeSlots[]` expansion. Generated-bound to the non-null
2568
2567
  * `schedule` on `FetchEventResponse`. Kept as a distinct public SDK type
2569
2568
  * name (re-exported as `O3KScheduleWithTimeSlots`) for downstream
2570
- * stability; structurally it is the by-accessor schedule shape.
2569
+ * stability; structurally it is the single-event-fetch schedule shape.
2571
2570
  */
2572
2571
  type ScheduleWithTimeSlots = NonNullable<EventByAccessor['schedule']>;
2573
2572
  /**
@@ -2767,9 +2766,10 @@ declare class AreasResource extends BaseResource {
2767
2766
  */
2768
2767
  list(options?: GetAreaOptions): Promise<Area[]>;
2769
2768
  /**
2770
- * Fetch a single area by id or accessor.
2769
+ * Fetch a single area by id or accessor. The server resolves either
2770
+ * form transparently.
2771
2771
  */
2772
- getByAccessor(accessor: string, options?: GetAreaOptions): Promise<Area>;
2772
+ get(idOrAccessor: string, options?: GetAreaOptions): Promise<Area>;
2773
2773
  /**
2774
2774
  * List occupied date/time windows for an area between `from` and `to`.
2775
2775
  */
@@ -2796,9 +2796,10 @@ declare class ArticlesResource extends BaseResource {
2796
2796
  list(options?: ListArticlesOptions): Promise<ListArticlesResponse>;
2797
2797
  /**
2798
2798
  * Fetch a single article by id or accessor within the active venue.
2799
- * Returns the full row including the TipTap `content` document.
2799
+ * The server resolves either form transparently. Returns the full row
2800
+ * including the TipTap `content` document.
2800
2801
  */
2801
- getByAccessor(idOrAccessor: string): Promise<Article>;
2802
+ get(idOrAccessor: string): Promise<Article>;
2802
2803
  /**
2803
2804
  * Partial-update an article. Locale-keyed fields (slug, title, excerpt)
2804
2805
  * merge at the locale level — `{ slug: { en: 'foo' } }` updates `en`
@@ -2936,18 +2937,13 @@ declare class EventsResource extends BaseResource {
2936
2937
  */
2937
2938
  place(event: CreateEventRequest): Promise<CreateEventResponse>;
2938
2939
  /**
2939
- * Get a single event by ID
2940
- * @param eventId - The event ID
2941
- * @returns The event details
2942
- */
2943
- get(eventId: string): Promise<Event>;
2944
- /**
2945
- * Get an event by accessor (slug)
2946
- * @param accessor - The event accessor (e.g., 'lunch-menu')
2940
+ * Get a single event by id or accessor (slug), with optional `expand`
2941
+ * parts. The server resolves either form transparently.
2942
+ * @param idOrAccessor - The event UUID or accessor (e.g., 'lunch-menu')
2947
2943
  * @param options - Optional expand options
2948
2944
  * @returns The event with optional schedule, timeSlots, menus, and posters
2949
2945
  */
2950
- getByAccessor(accessor: string, options?: GetEventOptions): Promise<EventByAccessor>;
2946
+ get(idOrAccessor: string, options?: GetEventOptions): Promise<EventByAccessor>;
2951
2947
  private buildQueryString;
2952
2948
  /**
2953
2949
  * Partial-update an event by id or accessor. Every body field is
@@ -2965,7 +2961,7 @@ declare class EventsResource extends BaseResource {
2965
2961
  delete(idOrAccessor: string): Promise<DeleteEventResponse>;
2966
2962
  /**
2967
2963
  * List the posters attached to an event. Convenience over
2968
- * `getByAccessor(idOrAccessor, { expand: ['posters'] })` — returns the
2964
+ * `get(idOrAccessor, { expand: ['posters'] })` — returns the
2969
2965
  * `posters[]` array (empty when the event has none).
2970
2966
  */
2971
2967
  listPosters(idOrAccessor: string): Promise<EventPosterEntry[]>;
@@ -2988,19 +2984,13 @@ declare class EventsResource extends BaseResource {
2988
2984
  declare class MenusResource extends BaseResource {
2989
2985
  constructor(tokenManager: TokenManager, baseUrl: string);
2990
2986
  /**
2991
- * Get a menu by ID
2992
- * @param id - The menu UUID
2993
- * @param options - Optional expand options
2994
- * @returns The menu with optional items and assets
2995
- */
2996
- get(id: string, options?: GetMenuOptions): Promise<Menu>;
2997
- /**
2998
- * Get a menu by accessor
2999
- * @param accessor - The menu accessor (slug)
2987
+ * Get a menu by id or accessor (slug), with optional `expand` parts.
2988
+ * The server resolves either form transparently.
2989
+ * @param idOrAccessor - The menu UUID or accessor (slug)
3000
2990
  * @param options - Optional expand options
3001
2991
  * @returns The menu with optional items and assets
3002
2992
  */
3003
- getByAccessor(accessor: string, options?: GetMenuOptions): Promise<Menu>;
2993
+ get(idOrAccessor: string, options?: GetMenuOptions): Promise<Menu>;
3004
2994
  /**
3005
2995
  * Get all bundles for a menu
3006
2996
  * @param menuIdOrAccessor - The menu UUID or accessor (slug)
@@ -3089,17 +3079,12 @@ declare class ReservationsResource extends BaseResource {
3089
3079
  declare class SubscriptionsResource extends BaseResource {
3090
3080
  constructor(tokenManager: TokenManager, baseUrl: string);
3091
3081
  /**
3092
- * Get a subscription by ID
3093
- * @param id - The subscription UUID
3094
- * @returns The subscription with posters
3095
- */
3096
- get(id: string): Promise<MenuSubscription>;
3097
- /**
3098
- * Get a subscription by accessor
3099
- * @param accessor - The subscription accessor (slug)
3082
+ * Get a subscription by id or accessor (slug). The server resolves
3083
+ * either form transparently.
3084
+ * @param idOrAccessor - The subscription UUID or accessor (slug)
3100
3085
  * @returns The subscription with posters
3101
3086
  */
3102
- getByAccessor(accessor: string): Promise<MenuSubscription>;
3087
+ get(idOrAccessor: string): Promise<MenuSubscription>;
3103
3088
  /**
3104
3089
  * Subscribe a customer to a subscription plan via Stripe Checkout
3105
3090
  * @param subscriptionIdOrAccessor - The subscription UUID or accessor
@@ -3631,7 +3616,7 @@ declare class VenuesResource {
3631
3616
  * — the CLI hits this to prove the accessor exists and to cache the
3632
3617
  * resolved UUID + display fields locally.
3633
3618
  */
3634
- getByAccessor(idOrAccessor: string): Promise<Venue>;
3619
+ get(idOrAccessor: string): Promise<Venue>;
3635
3620
  }
3636
3621
 
3637
3622
  type RealtimeEvent = 'INSERT' | 'UPDATE' | 'DELETE' | '*';
package/dist/client.mjs CHANGED
@@ -115,13 +115,9 @@ class BaseResource {
115
115
  "Content-Type": "application/json"
116
116
  },
117
117
  body: data ? JSON.stringify(data) : void 0,
118
- signal: AbortSignal.timeout(36e4)
118
+ signal: AbortSignal.timeout(36e4),
119
+ cache: cacheOptions?.cache ?? "no-store"
119
120
  };
120
- if (cacheOptions?.next !== void 0) {
121
- init.next = cacheOptions.next;
122
- } else {
123
- init.cache = cacheOptions?.cache ?? "no-store";
124
- }
125
121
  const response = await fetch(url, init);
126
122
  if (!response.ok) {
127
123
  let body = "";
@@ -246,11 +242,12 @@ class AreasResource extends BaseResource {
246
242
  return this.request("GET", queryString);
247
243
  }
248
244
  /**
249
- * Fetch a single area by id or accessor.
245
+ * Fetch a single area by id or accessor. The server resolves either
246
+ * form transparently.
250
247
  */
251
- async getByAccessor(accessor, options) {
248
+ async get(idOrAccessor, options) {
252
249
  const queryString = this.buildExpandQuery(options?.expand);
253
- return this.request("GET", `/${accessor}${queryString}`);
250
+ return this.request("GET", `/${idOrAccessor}${queryString}`);
254
251
  }
255
252
  /**
256
253
  * List occupied date/time windows for an area between `from` and `to`.
@@ -311,9 +308,10 @@ class ArticlesResource extends BaseResource {
311
308
  }
312
309
  /**
313
310
  * Fetch a single article by id or accessor within the active venue.
314
- * Returns the full row including the TipTap `content` document.
311
+ * The server resolves either form transparently. Returns the full row
312
+ * including the TipTap `content` document.
315
313
  */
316
- async getByAccessor(idOrAccessor) {
314
+ async get(idOrAccessor) {
317
315
  return this.request("GET", `/${encodeURIComponent(idOrAccessor)}`);
318
316
  }
319
317
  /**
@@ -542,27 +540,15 @@ class EventsResource extends BaseResource {
542
540
  return this.request("POST", "", event);
543
541
  }
544
542
  /**
545
- * Get a single event by ID
546
- * @param eventId - The event ID
547
- * @returns The event details
548
- */
549
- async get(eventId) {
550
- return this.request("GET", `/${eventId}`);
551
- }
552
- /**
553
- * Get an event by accessor (slug)
554
- * @param accessor - The event accessor (e.g., 'lunch-menu')
543
+ * Get a single event by id or accessor (slug), with optional `expand`
544
+ * parts. The server resolves either form transparently.
545
+ * @param idOrAccessor - The event UUID or accessor (e.g., 'lunch-menu')
555
546
  * @param options - Optional expand options
556
547
  * @returns The event with optional schedule, timeSlots, menus, and posters
557
548
  */
558
- async getByAccessor(accessor, options) {
549
+ async get(idOrAccessor, options) {
559
550
  const queryString = this.buildQueryString(options);
560
- return this.request(
561
- "GET",
562
- `/${accessor}${queryString}`,
563
- void 0,
564
- { next: { revalidate: 2700 } }
565
- );
551
+ return this.request("GET", `/${idOrAccessor}${queryString}`);
566
552
  }
567
553
  buildQueryString(options) {
568
554
  if (!options?.expand?.length) return "";
@@ -595,11 +581,11 @@ class EventsResource extends BaseResource {
595
581
  }
596
582
  /**
597
583
  * List the posters attached to an event. Convenience over
598
- * `getByAccessor(idOrAccessor, { expand: ['posters'] })` — returns the
584
+ * `get(idOrAccessor, { expand: ['posters'] })` — returns the
599
585
  * `posters[]` array (empty when the event has none).
600
586
  */
601
587
  async listPosters(idOrAccessor) {
602
- const event = await this.getByAccessor(idOrAccessor, {
588
+ const event = await this.get(idOrAccessor, {
603
589
  expand: ["posters"]
604
590
  });
605
591
  return event.posters ?? [];
@@ -640,24 +626,15 @@ class MenusResource extends BaseResource {
640
626
  super(tokenManager, baseUrl, "/menus");
641
627
  }
642
628
  /**
643
- * Get a menu by ID
644
- * @param id - The menu UUID
629
+ * Get a menu by id or accessor (slug), with optional `expand` parts.
630
+ * The server resolves either form transparently.
631
+ * @param idOrAccessor - The menu UUID or accessor (slug)
645
632
  * @param options - Optional expand options
646
633
  * @returns The menu with optional items and assets
647
634
  */
648
- async get(id, options) {
635
+ async get(idOrAccessor, options) {
649
636
  const queryString = this.buildQueryString(options);
650
- return this.request("GET", `/${id}${queryString}`);
651
- }
652
- /**
653
- * Get a menu by accessor
654
- * @param accessor - The menu accessor (slug)
655
- * @param options - Optional expand options
656
- * @returns The menu with optional items and assets
657
- */
658
- async getByAccessor(accessor, options) {
659
- const queryString = this.buildQueryString(options);
660
- return this.request("GET", `/${accessor}${queryString}`);
637
+ return this.request("GET", `/${idOrAccessor}${queryString}`);
661
638
  }
662
639
  /**
663
640
  * Get all bundles for a menu
@@ -786,20 +763,13 @@ class SubscriptionsResource extends BaseResource {
786
763
  super(tokenManager, baseUrl, "/subscriptions");
787
764
  }
788
765
  /**
789
- * Get a subscription by ID
790
- * @param id - The subscription UUID
791
- * @returns The subscription with posters
792
- */
793
- async get(id) {
794
- return this.request("GET", `/${id}`);
795
- }
796
- /**
797
- * Get a subscription by accessor
798
- * @param accessor - The subscription accessor (slug)
766
+ * Get a subscription by id or accessor (slug). The server resolves
767
+ * either form transparently.
768
+ * @param idOrAccessor - The subscription UUID or accessor (slug)
799
769
  * @returns The subscription with posters
800
770
  */
801
- async getByAccessor(accessor) {
802
- return this.request("GET", `/${accessor}`);
771
+ async get(idOrAccessor) {
772
+ return this.request("GET", `/${idOrAccessor}`);
803
773
  }
804
774
  /**
805
775
  * Subscribe a customer to a subscription plan via Stripe Checkout
@@ -1052,7 +1022,7 @@ class VenuesResource {
1052
1022
  * — the CLI hits this to prove the accessor exists and to cache the
1053
1023
  * resolved UUID + display fields locally.
1054
1024
  */
1055
- async getByAccessor(idOrAccessor) {
1025
+ async get(idOrAccessor) {
1056
1026
  const token = await this.tokenManager.getToken();
1057
1027
  const url = `${this.baseUrl}/venues/${encodeURIComponent(idOrAccessor)}`;
1058
1028
  const response = await fetch(url, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "order3000",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "order3000 node.js sdk",
5
5
  "main": "./dist/client.cjs",
6
6
  "module": "./dist/client.mjs",