order3000 1.10.0 → 1.11.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 +81 -0
- package/dist/client.d.cts +42 -3496
- package/dist/client.d.mts +42 -3496
- package/dist/client.mjs +81 -0
- package/dist/index-CQHgJH4m.d.cts +3648 -0
- package/dist/index-CQHgJH4m.d.mts +3648 -0
- package/dist/menu.cjs +35 -0
- package/dist/menu.d.cts +51 -0
- package/dist/menu.d.mts +51 -0
- package/dist/menu.mjs +30 -0
- package/dist/schemas.cjs +175 -0
- package/dist/schemas.d.cts +113 -0
- package/dist/schemas.d.mts +113 -0
- package/dist/schemas.mjs +175 -0
- package/package.json +13 -3
package/dist/client.mjs
CHANGED
|
@@ -626,6 +626,33 @@ class BasketsResource extends BaseResource {
|
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
628
|
|
|
629
|
+
class BeveragesResource extends BaseResource {
|
|
630
|
+
constructor(tokenManager, baseUrl) {
|
|
631
|
+
super(tokenManager, baseUrl, "/beverages");
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Upload an asset image for a beverage. The SDK builds the multipart body
|
|
635
|
+
* internally — pass a Buffer/Uint8Array, the original filename, the MIME type,
|
|
636
|
+
* and optional discovery `tags` (e.g. `['lunch-menu']`). The asset is stored,
|
|
637
|
+
* tagged, and linked to the beverage via `beverage_assets`; returns the new
|
|
638
|
+
* asset and its public URL. The beverage is addressed by its accessor.
|
|
639
|
+
*/
|
|
640
|
+
async uploadAsset(idOrAccessor, file) {
|
|
641
|
+
const form = new FormData();
|
|
642
|
+
form.append(
|
|
643
|
+
"file",
|
|
644
|
+
new Blob([new Uint8Array(file.data)], { type: file.contentType }),
|
|
645
|
+
file.filename
|
|
646
|
+
);
|
|
647
|
+
if (file.tags?.length) form.append("tags", file.tags.join(","));
|
|
648
|
+
return this.requestMultipart(
|
|
649
|
+
"POST",
|
|
650
|
+
`/${encodeURIComponent(idOrAccessor)}/assets`,
|
|
651
|
+
form
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
629
656
|
class CalloutsResource extends BaseResource {
|
|
630
657
|
constructor(tokenManager, baseUrl) {
|
|
631
658
|
super(tokenManager, baseUrl, "/callouts");
|
|
@@ -667,6 +694,56 @@ class CalloutsResource extends BaseResource {
|
|
|
667
694
|
}
|
|
668
695
|
}
|
|
669
696
|
|
|
697
|
+
class DishesResource extends BaseResource {
|
|
698
|
+
constructor(tokenManager, baseUrl) {
|
|
699
|
+
super(tokenManager, baseUrl, "/dishes");
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Fetch a dish by its `accessor` slug (localized name/description, dietary
|
|
703
|
+
* flags, price, assets with public URLs). Pair with `patch` for a safe
|
|
704
|
+
* read-modify-write rename that preserves untouched locales + flags.
|
|
705
|
+
*/
|
|
706
|
+
async get(accessor) {
|
|
707
|
+
return this.request(
|
|
708
|
+
"GET",
|
|
709
|
+
`/${encodeURIComponent(accessor)}`
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Edit a dish by id. `editDish` replaces the fields it receives (localized
|
|
714
|
+
* `name` is required), so callers wanting a partial change should read the
|
|
715
|
+
* dish with `get` first and merge. Returns the updated dish row.
|
|
716
|
+
*/
|
|
717
|
+
async patch(dishId, body) {
|
|
718
|
+
return this.request(
|
|
719
|
+
"PATCH",
|
|
720
|
+
`/${encodeURIComponent(dishId)}`,
|
|
721
|
+
body
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Upload an asset image for a dish. The SDK builds the multipart body
|
|
726
|
+
* internally — pass a Buffer/Uint8Array, the original filename, the MIME type,
|
|
727
|
+
* and optional discovery `tags` (e.g. `['lunch-menu']`). The asset is stored,
|
|
728
|
+
* tagged, and linked to the dish via `dish_assets`; returns the new asset and
|
|
729
|
+
* its public URL. The dish is addressed by its accessor.
|
|
730
|
+
*/
|
|
731
|
+
async uploadAsset(idOrAccessor, file) {
|
|
732
|
+
const form = new FormData();
|
|
733
|
+
form.append(
|
|
734
|
+
"file",
|
|
735
|
+
new Blob([new Uint8Array(file.data)], { type: file.contentType }),
|
|
736
|
+
file.filename
|
|
737
|
+
);
|
|
738
|
+
if (file.tags?.length) form.append("tags", file.tags.join(","));
|
|
739
|
+
return this.requestMultipart(
|
|
740
|
+
"POST",
|
|
741
|
+
`/${encodeURIComponent(idOrAccessor)}/assets`,
|
|
742
|
+
form
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
670
747
|
class EventsResource extends BaseResource {
|
|
671
748
|
constructor(tokenManager, baseUrl) {
|
|
672
749
|
super(tokenManager, baseUrl, "/events");
|
|
@@ -1623,7 +1700,9 @@ class O3KClient {
|
|
|
1623
1700
|
__publicField(this, "articles");
|
|
1624
1701
|
__publicField(this, "assets");
|
|
1625
1702
|
__publicField(this, "baskets");
|
|
1703
|
+
__publicField(this, "beverages");
|
|
1626
1704
|
__publicField(this, "callouts");
|
|
1705
|
+
__publicField(this, "dishes");
|
|
1627
1706
|
__publicField(this, "events");
|
|
1628
1707
|
__publicField(this, "menus");
|
|
1629
1708
|
__publicField(this, "orders");
|
|
@@ -1650,7 +1729,9 @@ class O3KClient {
|
|
|
1650
1729
|
this.articles = new ArticlesResource(this.tokenManager, this.baseUrl);
|
|
1651
1730
|
this.assets = new AssetsResource(this.tokenManager, this.baseUrl);
|
|
1652
1731
|
this.baskets = new BasketsResource(this.tokenManager, this.baseUrl);
|
|
1732
|
+
this.beverages = new BeveragesResource(this.tokenManager, this.baseUrl);
|
|
1653
1733
|
this.callouts = new CalloutsResource(this.tokenManager, this.baseUrl);
|
|
1734
|
+
this.dishes = new DishesResource(this.tokenManager, this.baseUrl);
|
|
1654
1735
|
this.events = new EventsResource(this.tokenManager, this.baseUrl);
|
|
1655
1736
|
this.menus = new MenusResource(this.tokenManager, this.baseUrl);
|
|
1656
1737
|
this.orders = new OrdersResource(this.tokenManager, this.baseUrl);
|