order3000 0.19.1 → 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 +92 -1
- package/dist/client.d.cts +198 -4
- package/dist/client.d.mts +198 -4
- package/dist/client.mjs +92 -1
- package/dist/schemas.cjs +15 -1
- package/dist/schemas.d.cts +279 -14
- package/dist/schemas.d.mts +279 -14
- package/dist/schemas.mjs +15 -1
- package/package.json +2 -2
package/dist/client.cjs
CHANGED
|
@@ -184,6 +184,55 @@ class AreasResource extends BaseResource {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
class ArticlesResource extends BaseResource {
|
|
188
|
+
constructor(tokenManager, baseUrl) {
|
|
189
|
+
super(tokenManager, baseUrl, "/articles");
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* List articles for the venue. Default behaviour returns published +
|
|
193
|
+
* active articles, ordered by `priority` (desc) then `publishedAt`
|
|
194
|
+
* (desc). Override defaults via `includeDrafts` / `includeInactive`,
|
|
195
|
+
* or filter by a single tag.
|
|
196
|
+
*
|
|
197
|
+
* `content` on each article is a TipTap JSON document — opaque on the
|
|
198
|
+
* wire. Use the order3000-cli's `articles outline` command (forthcoming)
|
|
199
|
+
* for human-friendly node addressing.
|
|
200
|
+
*/
|
|
201
|
+
async list(options) {
|
|
202
|
+
const params = new URLSearchParams();
|
|
203
|
+
if (options?.tag) params.set("tag", options.tag);
|
|
204
|
+
if (options?.includeDrafts !== void 0) {
|
|
205
|
+
params.set("includeDrafts", String(options.includeDrafts));
|
|
206
|
+
}
|
|
207
|
+
if (options?.includeInactive !== void 0) {
|
|
208
|
+
params.set("includeInactive", String(options.includeInactive));
|
|
209
|
+
}
|
|
210
|
+
const qs = params.toString();
|
|
211
|
+
const path = qs ? `?${qs}` : "";
|
|
212
|
+
return this.request("GET", path);
|
|
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
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
187
236
|
class BasketsResource extends BaseResource {
|
|
188
237
|
constructor(tokenManager, baseUrl) {
|
|
189
238
|
super(tokenManager, baseUrl, "/baskets");
|
|
@@ -767,6 +816,44 @@ class TeamOrdersResource {
|
|
|
767
816
|
}
|
|
768
817
|
}
|
|
769
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
|
+
|
|
770
857
|
var __defProp$2 = Object.defineProperty;
|
|
771
858
|
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
772
859
|
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -1092,6 +1179,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1092
1179
|
class Order3000Client {
|
|
1093
1180
|
constructor(config) {
|
|
1094
1181
|
__publicField(this, "areas");
|
|
1182
|
+
__publicField(this, "articles");
|
|
1095
1183
|
__publicField(this, "baskets");
|
|
1096
1184
|
__publicField(this, "events");
|
|
1097
1185
|
__publicField(this, "menus");
|
|
@@ -1100,11 +1188,12 @@ class Order3000Client {
|
|
|
1100
1188
|
__publicField(this, "reservations");
|
|
1101
1189
|
__publicField(this, "subscriptions");
|
|
1102
1190
|
__publicField(this, "teamOrders");
|
|
1191
|
+
__publicField(this, "venues");
|
|
1103
1192
|
__publicField(this, "realtime");
|
|
1104
1193
|
__publicField(this, "baseUrl");
|
|
1105
1194
|
__publicField(this, "tokenManager");
|
|
1106
1195
|
this.baseUrl = config.baseUrl || "https://order3000.com/api";
|
|
1107
|
-
const tokenUrl = config.tokenUrl || `${this.baseUrl}/
|
|
1196
|
+
const tokenUrl = config.tokenUrl || `${this.baseUrl}/m2m/token`;
|
|
1108
1197
|
this.tokenManager = new TokenManager(
|
|
1109
1198
|
config.clientId,
|
|
1110
1199
|
config.clientSecret,
|
|
@@ -1112,6 +1201,7 @@ class Order3000Client {
|
|
|
1112
1201
|
config.venueId
|
|
1113
1202
|
);
|
|
1114
1203
|
this.areas = new AreasResource(this.tokenManager, this.baseUrl);
|
|
1204
|
+
this.articles = new ArticlesResource(this.tokenManager, this.baseUrl);
|
|
1115
1205
|
this.baskets = new BasketsResource(this.tokenManager, this.baseUrl);
|
|
1116
1206
|
this.events = new EventsResource(this.tokenManager, this.baseUrl);
|
|
1117
1207
|
this.menus = new MenusResource(this.tokenManager, this.baseUrl);
|
|
@@ -1129,6 +1219,7 @@ class Order3000Client {
|
|
|
1129
1219
|
this.baseUrl
|
|
1130
1220
|
);
|
|
1131
1221
|
this.teamOrders = new TeamOrdersResource(this.tokenManager, this.baseUrl);
|
|
1222
|
+
this.venues = new VenuesResource(this.tokenManager, this.baseUrl);
|
|
1132
1223
|
this.realtime = new RealtimeManager(this.tokenManager, this.baseUrl);
|
|
1133
1224
|
}
|
|
1134
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 {
|
|
@@ -218,6 +218,115 @@ interface components {
|
|
|
218
218
|
createdAt: string | null;
|
|
219
219
|
updatedAt: string | null;
|
|
220
220
|
};
|
|
221
|
+
/**
|
|
222
|
+
* Article
|
|
223
|
+
* @description A venue's article. `content` is a TipTap JSON document; treat it as opaque on the wire.
|
|
224
|
+
*/
|
|
225
|
+
Article: {
|
|
226
|
+
id: string;
|
|
227
|
+
venueId: string;
|
|
228
|
+
accessor: string;
|
|
229
|
+
slug: {
|
|
230
|
+
[key: string]: string;
|
|
231
|
+
};
|
|
232
|
+
title: {
|
|
233
|
+
[key: string]: string;
|
|
234
|
+
};
|
|
235
|
+
excerpt: {
|
|
236
|
+
[key: string]: string;
|
|
237
|
+
} | null;
|
|
238
|
+
content: {
|
|
239
|
+
[key: string]: unknown;
|
|
240
|
+
} | null;
|
|
241
|
+
tags: string[];
|
|
242
|
+
featuredImageId: string | null;
|
|
243
|
+
isActive: boolean;
|
|
244
|
+
isFeatured: boolean;
|
|
245
|
+
priority: number;
|
|
246
|
+
publishedAt: unknown;
|
|
247
|
+
createdAt: unknown;
|
|
248
|
+
updatedAt: unknown;
|
|
249
|
+
};
|
|
250
|
+
/** ListArticlesResponse */
|
|
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
|
+
};
|
|
221
330
|
/**
|
|
222
331
|
* AddToBasketRequest
|
|
223
332
|
* @description Add an item to the shopping basket
|
|
@@ -1066,6 +1175,23 @@ interface components {
|
|
|
1066
1175
|
teamOrderId: string;
|
|
1067
1176
|
deliveryAddressId: string;
|
|
1068
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
|
+
};
|
|
1069
1195
|
};
|
|
1070
1196
|
responses: never;
|
|
1071
1197
|
parameters: never;
|
|
@@ -1077,6 +1203,21 @@ interface components {
|
|
|
1077
1203
|
type schemas = components['schemas'];
|
|
1078
1204
|
type CreateEventRequest = schemas['CreateEventRequest'];
|
|
1079
1205
|
type CreateEventResponse = schemas['CreateEventResponse'];
|
|
1206
|
+
type Article = schemas['Article'];
|
|
1207
|
+
type ListArticlesResponse = schemas['ListArticlesResponse'];
|
|
1208
|
+
type GetArticleResponse = schemas['GetArticleResponse'];
|
|
1209
|
+
type PatchArticleRequest = schemas['PatchArticleRequest'];
|
|
1210
|
+
type PatchArticleResponse = schemas['PatchArticleResponse'];
|
|
1211
|
+
interface ListArticlesOptions {
|
|
1212
|
+
/** Only return articles whose `tags` array contains this value. */
|
|
1213
|
+
tag?: string;
|
|
1214
|
+
/** When `true`, include articles whose `publishedAt` is null. Default `false`. */
|
|
1215
|
+
includeDrafts?: boolean;
|
|
1216
|
+
/** When `true`, include articles whose `isActive` is `false`. Default `false`. */
|
|
1217
|
+
includeInactive?: boolean;
|
|
1218
|
+
}
|
|
1219
|
+
type Venue = schemas['Venue'];
|
|
1220
|
+
type GetVenueResponse = schemas['GetVenueResponse'];
|
|
1080
1221
|
/**
|
|
1081
1222
|
* Order fulfillment type - matches order_fulfillment_type enum in order3000 database.
|
|
1082
1223
|
* Keep in sync with apps/order3000/src/drizzle/enums.ts
|
|
@@ -1853,6 +1994,33 @@ declare class AreasResource extends BaseResource {
|
|
|
1853
1994
|
private buildExpandQuery;
|
|
1854
1995
|
}
|
|
1855
1996
|
|
|
1997
|
+
declare class ArticlesResource extends BaseResource {
|
|
1998
|
+
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
1999
|
+
/**
|
|
2000
|
+
* List articles for the venue. Default behaviour returns published +
|
|
2001
|
+
* active articles, ordered by `priority` (desc) then `publishedAt`
|
|
2002
|
+
* (desc). Override defaults via `includeDrafts` / `includeInactive`,
|
|
2003
|
+
* or filter by a single tag.
|
|
2004
|
+
*
|
|
2005
|
+
* `content` on each article is a TipTap JSON document — opaque on the
|
|
2006
|
+
* wire. Use the order3000-cli's `articles outline` command (forthcoming)
|
|
2007
|
+
* for human-friendly node addressing.
|
|
2008
|
+
*/
|
|
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>;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
1856
2024
|
declare class BasketsResource extends BaseResource {
|
|
1857
2025
|
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
1858
2026
|
/**
|
|
@@ -2536,6 +2704,27 @@ declare class TeamOrdersResource {
|
|
|
2536
2704
|
}): Promise<UpdateDeliveryAddressResponse>;
|
|
2537
2705
|
}
|
|
2538
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
|
+
|
|
2539
2728
|
type RealtimeEvent = 'INSERT' | 'UPDATE' | 'DELETE' | '*';
|
|
2540
2729
|
type RealtimeRow = {
|
|
2541
2730
|
[key: string]: any;
|
|
@@ -2688,13 +2877,17 @@ interface Order3000ClientConfig {
|
|
|
2688
2877
|
*/
|
|
2689
2878
|
baseUrl?: string;
|
|
2690
2879
|
/**
|
|
2691
|
-
*
|
|
2692
|
-
*
|
|
2880
|
+
* Machine-to-machine token endpoint. The order3000 server hosts user
|
|
2881
|
+
* session routes under `/auth/*` and robot-account M2M token exchange
|
|
2882
|
+
* under `/m2m/token`; the SDK is exclusively an M2M consumer, so the
|
|
2883
|
+
* default points at the latter.
|
|
2884
|
+
* @default "${baseUrl}/m2m/token"
|
|
2693
2885
|
*/
|
|
2694
2886
|
tokenUrl?: string;
|
|
2695
2887
|
}
|
|
2696
2888
|
declare class Order3000Client {
|
|
2697
2889
|
areas: AreasResource;
|
|
2890
|
+
articles: ArticlesResource;
|
|
2698
2891
|
baskets: BasketsResource;
|
|
2699
2892
|
events: EventsResource;
|
|
2700
2893
|
menus: MenusResource;
|
|
@@ -2703,6 +2896,7 @@ declare class Order3000Client {
|
|
|
2703
2896
|
reservations: ReservationsResource;
|
|
2704
2897
|
subscriptions: SubscriptionsResource;
|
|
2705
2898
|
teamOrders: TeamOrdersResource;
|
|
2899
|
+
venues: VenuesResource;
|
|
2706
2900
|
realtime: RealtimeManager;
|
|
2707
2901
|
private readonly baseUrl;
|
|
2708
2902
|
private readonly tokenManager;
|
|
@@ -2710,4 +2904,4 @@ declare class Order3000Client {
|
|
|
2710
2904
|
}
|
|
2711
2905
|
|
|
2712
2906
|
export { Order3000Client, fulfillmentTypeEnum, getScheduleInfo, participantStatusEnum, paymentMethodEnum, teamOrderStatusEnum };
|
|
2713
|
-
export type { AddToBasketRequest, AddToBasketResponse, Area, AreaAsset, AreaAvailabilityResponse, AreaAvailabilityWindow, AreaBookingMode, AreaBookingRequestResponse, AreaBookingRequestSource, AreaBookingRequestStatus, AreaBookingStatus, AreaFeature, 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, 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 {
|
|
@@ -218,6 +218,115 @@ interface components {
|
|
|
218
218
|
createdAt: string | null;
|
|
219
219
|
updatedAt: string | null;
|
|
220
220
|
};
|
|
221
|
+
/**
|
|
222
|
+
* Article
|
|
223
|
+
* @description A venue's article. `content` is a TipTap JSON document; treat it as opaque on the wire.
|
|
224
|
+
*/
|
|
225
|
+
Article: {
|
|
226
|
+
id: string;
|
|
227
|
+
venueId: string;
|
|
228
|
+
accessor: string;
|
|
229
|
+
slug: {
|
|
230
|
+
[key: string]: string;
|
|
231
|
+
};
|
|
232
|
+
title: {
|
|
233
|
+
[key: string]: string;
|
|
234
|
+
};
|
|
235
|
+
excerpt: {
|
|
236
|
+
[key: string]: string;
|
|
237
|
+
} | null;
|
|
238
|
+
content: {
|
|
239
|
+
[key: string]: unknown;
|
|
240
|
+
} | null;
|
|
241
|
+
tags: string[];
|
|
242
|
+
featuredImageId: string | null;
|
|
243
|
+
isActive: boolean;
|
|
244
|
+
isFeatured: boolean;
|
|
245
|
+
priority: number;
|
|
246
|
+
publishedAt: unknown;
|
|
247
|
+
createdAt: unknown;
|
|
248
|
+
updatedAt: unknown;
|
|
249
|
+
};
|
|
250
|
+
/** ListArticlesResponse */
|
|
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
|
+
};
|
|
221
330
|
/**
|
|
222
331
|
* AddToBasketRequest
|
|
223
332
|
* @description Add an item to the shopping basket
|
|
@@ -1066,6 +1175,23 @@ interface components {
|
|
|
1066
1175
|
teamOrderId: string;
|
|
1067
1176
|
deliveryAddressId: string;
|
|
1068
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
|
+
};
|
|
1069
1195
|
};
|
|
1070
1196
|
responses: never;
|
|
1071
1197
|
parameters: never;
|
|
@@ -1077,6 +1203,21 @@ interface components {
|
|
|
1077
1203
|
type schemas = components['schemas'];
|
|
1078
1204
|
type CreateEventRequest = schemas['CreateEventRequest'];
|
|
1079
1205
|
type CreateEventResponse = schemas['CreateEventResponse'];
|
|
1206
|
+
type Article = schemas['Article'];
|
|
1207
|
+
type ListArticlesResponse = schemas['ListArticlesResponse'];
|
|
1208
|
+
type GetArticleResponse = schemas['GetArticleResponse'];
|
|
1209
|
+
type PatchArticleRequest = schemas['PatchArticleRequest'];
|
|
1210
|
+
type PatchArticleResponse = schemas['PatchArticleResponse'];
|
|
1211
|
+
interface ListArticlesOptions {
|
|
1212
|
+
/** Only return articles whose `tags` array contains this value. */
|
|
1213
|
+
tag?: string;
|
|
1214
|
+
/** When `true`, include articles whose `publishedAt` is null. Default `false`. */
|
|
1215
|
+
includeDrafts?: boolean;
|
|
1216
|
+
/** When `true`, include articles whose `isActive` is `false`. Default `false`. */
|
|
1217
|
+
includeInactive?: boolean;
|
|
1218
|
+
}
|
|
1219
|
+
type Venue = schemas['Venue'];
|
|
1220
|
+
type GetVenueResponse = schemas['GetVenueResponse'];
|
|
1080
1221
|
/**
|
|
1081
1222
|
* Order fulfillment type - matches order_fulfillment_type enum in order3000 database.
|
|
1082
1223
|
* Keep in sync with apps/order3000/src/drizzle/enums.ts
|
|
@@ -1853,6 +1994,33 @@ declare class AreasResource extends BaseResource {
|
|
|
1853
1994
|
private buildExpandQuery;
|
|
1854
1995
|
}
|
|
1855
1996
|
|
|
1997
|
+
declare class ArticlesResource extends BaseResource {
|
|
1998
|
+
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
1999
|
+
/**
|
|
2000
|
+
* List articles for the venue. Default behaviour returns published +
|
|
2001
|
+
* active articles, ordered by `priority` (desc) then `publishedAt`
|
|
2002
|
+
* (desc). Override defaults via `includeDrafts` / `includeInactive`,
|
|
2003
|
+
* or filter by a single tag.
|
|
2004
|
+
*
|
|
2005
|
+
* `content` on each article is a TipTap JSON document — opaque on the
|
|
2006
|
+
* wire. Use the order3000-cli's `articles outline` command (forthcoming)
|
|
2007
|
+
* for human-friendly node addressing.
|
|
2008
|
+
*/
|
|
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>;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
1856
2024
|
declare class BasketsResource extends BaseResource {
|
|
1857
2025
|
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
1858
2026
|
/**
|
|
@@ -2536,6 +2704,27 @@ declare class TeamOrdersResource {
|
|
|
2536
2704
|
}): Promise<UpdateDeliveryAddressResponse>;
|
|
2537
2705
|
}
|
|
2538
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
|
+
|
|
2539
2728
|
type RealtimeEvent = 'INSERT' | 'UPDATE' | 'DELETE' | '*';
|
|
2540
2729
|
type RealtimeRow = {
|
|
2541
2730
|
[key: string]: any;
|
|
@@ -2688,13 +2877,17 @@ interface Order3000ClientConfig {
|
|
|
2688
2877
|
*/
|
|
2689
2878
|
baseUrl?: string;
|
|
2690
2879
|
/**
|
|
2691
|
-
*
|
|
2692
|
-
*
|
|
2880
|
+
* Machine-to-machine token endpoint. The order3000 server hosts user
|
|
2881
|
+
* session routes under `/auth/*` and robot-account M2M token exchange
|
|
2882
|
+
* under `/m2m/token`; the SDK is exclusively an M2M consumer, so the
|
|
2883
|
+
* default points at the latter.
|
|
2884
|
+
* @default "${baseUrl}/m2m/token"
|
|
2693
2885
|
*/
|
|
2694
2886
|
tokenUrl?: string;
|
|
2695
2887
|
}
|
|
2696
2888
|
declare class Order3000Client {
|
|
2697
2889
|
areas: AreasResource;
|
|
2890
|
+
articles: ArticlesResource;
|
|
2698
2891
|
baskets: BasketsResource;
|
|
2699
2892
|
events: EventsResource;
|
|
2700
2893
|
menus: MenusResource;
|
|
@@ -2703,6 +2896,7 @@ declare class Order3000Client {
|
|
|
2703
2896
|
reservations: ReservationsResource;
|
|
2704
2897
|
subscriptions: SubscriptionsResource;
|
|
2705
2898
|
teamOrders: TeamOrdersResource;
|
|
2899
|
+
venues: VenuesResource;
|
|
2706
2900
|
realtime: RealtimeManager;
|
|
2707
2901
|
private readonly baseUrl;
|
|
2708
2902
|
private readonly tokenManager;
|
|
@@ -2710,4 +2904,4 @@ declare class Order3000Client {
|
|
|
2710
2904
|
}
|
|
2711
2905
|
|
|
2712
2906
|
export { Order3000Client, fulfillmentTypeEnum, getScheduleInfo, participantStatusEnum, paymentMethodEnum, teamOrderStatusEnum };
|
|
2713
|
-
export type { AddToBasketRequest, AddToBasketResponse, Area, AreaAsset, AreaAvailabilityResponse, AreaAvailabilityWindow, AreaBookingMode, AreaBookingRequestResponse, AreaBookingRequestSource, AreaBookingRequestStatus, AreaBookingStatus, AreaFeature, 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, 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 };
|